commit aaf3bbeb8b1020ce729db3008eced8c10d3d7ace Author: zdpcdt Date: Mon Feb 9 16:00:19 2026 +0000 Deploying to gh-pages from @ irihitech/Semi.Avalonia@d57c843032440d4a48efa76c48606bc52e6de5c0 🚀 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..c295e05 --- /dev/null +++ b/404.html @@ -0,0 +1,37 @@ + + + + + Semi.Avalonia.Demo.Web + + + + + + + +
+
+

+ Powered by + + + + + + + + + + + + + + +

+
+
+ + + + diff --git a/_framework/Avalonia.Base.b55b9qm4in.wasm b/_framework/Avalonia.Base.b55b9qm4in.wasm new file mode 100644 index 0000000..681b2d7 Binary files /dev/null and b/_framework/Avalonia.Base.b55b9qm4in.wasm differ diff --git a/_framework/Avalonia.Base.b55b9qm4in.wasm.br b/_framework/Avalonia.Base.b55b9qm4in.wasm.br new file mode 100644 index 0000000..e5e3e8c Binary files /dev/null and b/_framework/Avalonia.Base.b55b9qm4in.wasm.br differ diff --git a/_framework/Avalonia.Base.b55b9qm4in.wasm.gz b/_framework/Avalonia.Base.b55b9qm4in.wasm.gz new file mode 100644 index 0000000..d648ecc Binary files /dev/null and b/_framework/Avalonia.Base.b55b9qm4in.wasm.gz differ diff --git a/_framework/Avalonia.Browser.0vx86ewdky.wasm b/_framework/Avalonia.Browser.0vx86ewdky.wasm new file mode 100644 index 0000000..b987eaa Binary files /dev/null and b/_framework/Avalonia.Browser.0vx86ewdky.wasm differ diff --git a/_framework/Avalonia.Browser.0vx86ewdky.wasm.br b/_framework/Avalonia.Browser.0vx86ewdky.wasm.br new file mode 100644 index 0000000..2a94e09 Binary files /dev/null and b/_framework/Avalonia.Browser.0vx86ewdky.wasm.br differ diff --git a/_framework/Avalonia.Browser.0vx86ewdky.wasm.gz b/_framework/Avalonia.Browser.0vx86ewdky.wasm.gz new file mode 100644 index 0000000..109ecb1 Binary files /dev/null and b/_framework/Avalonia.Browser.0vx86ewdky.wasm.gz differ diff --git a/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm new file mode 100644 index 0000000..fed77e6 Binary files /dev/null and b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm differ diff --git a/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.br b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.br new file mode 100644 index 0000000..f16ae3d Binary files /dev/null and b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.br differ diff --git a/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.gz b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.gz new file mode 100644 index 0000000..135c37d Binary files /dev/null and b/_framework/Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm.gz differ diff --git a/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm new file mode 100644 index 0000000..edc96f2 Binary files /dev/null and b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm differ diff --git a/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.br b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.br new file mode 100644 index 0000000..cfb2e80 Binary files /dev/null and b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.br differ diff --git a/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.gz b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.gz new file mode 100644 index 0000000..8c5ef35 Binary files /dev/null and b/_framework/Avalonia.Controls.DataGrid.bc8o233m2e.wasm.gz differ diff --git a/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm new file mode 100644 index 0000000..86c5707 Binary files /dev/null and b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm differ diff --git a/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.br b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.br new file mode 100644 index 0000000..a84872d Binary files /dev/null and b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.br differ diff --git a/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.gz b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.gz new file mode 100644 index 0000000..75208c5 Binary files /dev/null and b/_framework/Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm.gz differ diff --git a/_framework/Avalonia.Controls.m4p7gy8jps.wasm b/_framework/Avalonia.Controls.m4p7gy8jps.wasm new file mode 100644 index 0000000..3dbf84a Binary files /dev/null and b/_framework/Avalonia.Controls.m4p7gy8jps.wasm differ diff --git a/_framework/Avalonia.Controls.m4p7gy8jps.wasm.br b/_framework/Avalonia.Controls.m4p7gy8jps.wasm.br new file mode 100644 index 0000000..dd5904c Binary files /dev/null and b/_framework/Avalonia.Controls.m4p7gy8jps.wasm.br differ diff --git a/_framework/Avalonia.Controls.m4p7gy8jps.wasm.gz b/_framework/Avalonia.Controls.m4p7gy8jps.wasm.gz new file mode 100644 index 0000000..399236f Binary files /dev/null and b/_framework/Avalonia.Controls.m4p7gy8jps.wasm.gz differ diff --git a/_framework/Avalonia.Dialogs.i887k2h472.wasm b/_framework/Avalonia.Dialogs.i887k2h472.wasm new file mode 100644 index 0000000..4c15389 Binary files /dev/null and b/_framework/Avalonia.Dialogs.i887k2h472.wasm differ diff --git a/_framework/Avalonia.Dialogs.i887k2h472.wasm.br b/_framework/Avalonia.Dialogs.i887k2h472.wasm.br new file mode 100644 index 0000000..8d8ae84 Binary files /dev/null and b/_framework/Avalonia.Dialogs.i887k2h472.wasm.br differ diff --git a/_framework/Avalonia.Dialogs.i887k2h472.wasm.gz b/_framework/Avalonia.Dialogs.i887k2h472.wasm.gz new file mode 100644 index 0000000..cf2ba72 Binary files /dev/null and b/_framework/Avalonia.Dialogs.i887k2h472.wasm.gz differ diff --git a/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm new file mode 100644 index 0000000..f0230bb Binary files /dev/null and b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm differ diff --git a/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.br b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.br new file mode 100644 index 0000000..0f3f14a Binary files /dev/null and b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.br differ diff --git a/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.gz b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.gz new file mode 100644 index 0000000..a870857 Binary files /dev/null and b/_framework/Avalonia.Markup.Xaml.vm63lr44rr.wasm.gz differ diff --git a/_framework/Avalonia.Markup.p6cjgzcx7z.wasm b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm new file mode 100644 index 0000000..0c098e2 Binary files /dev/null and b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm differ diff --git a/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.br b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.br new file mode 100644 index 0000000..840a675 Binary files /dev/null and b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.br differ diff --git a/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.gz b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.gz new file mode 100644 index 0000000..eb509e8 Binary files /dev/null and b/_framework/Avalonia.Markup.p6cjgzcx7z.wasm.gz differ diff --git a/_framework/Avalonia.Metal.lj5j0lvb30.wasm b/_framework/Avalonia.Metal.lj5j0lvb30.wasm new file mode 100644 index 0000000..a99c76d Binary files /dev/null and b/_framework/Avalonia.Metal.lj5j0lvb30.wasm differ diff --git a/_framework/Avalonia.Metal.lj5j0lvb30.wasm.br b/_framework/Avalonia.Metal.lj5j0lvb30.wasm.br new file mode 100644 index 0000000..f36b984 Binary files /dev/null and b/_framework/Avalonia.Metal.lj5j0lvb30.wasm.br differ diff --git a/_framework/Avalonia.Metal.lj5j0lvb30.wasm.gz b/_framework/Avalonia.Metal.lj5j0lvb30.wasm.gz new file mode 100644 index 0000000..4bf017a Binary files /dev/null and b/_framework/Avalonia.Metal.lj5j0lvb30.wasm.gz differ diff --git a/_framework/Avalonia.OpenGL.4793gyniz7.wasm b/_framework/Avalonia.OpenGL.4793gyniz7.wasm new file mode 100644 index 0000000..4ee70e8 Binary files /dev/null and b/_framework/Avalonia.OpenGL.4793gyniz7.wasm differ diff --git a/_framework/Avalonia.OpenGL.4793gyniz7.wasm.br b/_framework/Avalonia.OpenGL.4793gyniz7.wasm.br new file mode 100644 index 0000000..f8cc88c Binary files /dev/null and b/_framework/Avalonia.OpenGL.4793gyniz7.wasm.br differ diff --git a/_framework/Avalonia.OpenGL.4793gyniz7.wasm.gz b/_framework/Avalonia.OpenGL.4793gyniz7.wasm.gz new file mode 100644 index 0000000..4fb5562 Binary files /dev/null and b/_framework/Avalonia.OpenGL.4793gyniz7.wasm.gz differ diff --git a/_framework/Avalonia.Skia.s1d9s3bo6y.wasm b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm new file mode 100644 index 0000000..3a9d6f5 Binary files /dev/null and b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm differ diff --git a/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.br b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.br new file mode 100644 index 0000000..5d0ed8b Binary files /dev/null and b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.br differ diff --git a/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.gz b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.gz new file mode 100644 index 0000000..95a2fb6 Binary files /dev/null and b/_framework/Avalonia.Skia.s1d9s3bo6y.wasm.gz differ diff --git a/_framework/Avalonia.Vulkan.jqpn47ht00.wasm b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm new file mode 100644 index 0000000..6b64e97 Binary files /dev/null and b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm differ diff --git a/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.br b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.br new file mode 100644 index 0000000..d754101 Binary files /dev/null and b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.br differ diff --git a/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.gz b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.gz new file mode 100644 index 0000000..7c91043 Binary files /dev/null and b/_framework/Avalonia.Vulkan.jqpn47ht00.wasm.gz differ diff --git a/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm new file mode 100644 index 0000000..f1cd00f Binary files /dev/null and b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm differ diff --git a/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.br b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.br new file mode 100644 index 0000000..7d25ecc Binary files /dev/null and b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.br differ diff --git a/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.gz b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.gz new file mode 100644 index 0000000..bcb41eb Binary files /dev/null and b/_framework/CommunityToolkit.Mvvm.ojrsxcaklv.wasm.gz differ diff --git a/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm new file mode 100644 index 0000000..0716dd2 Binary files /dev/null and b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm differ diff --git a/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.br b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.br new file mode 100644 index 0000000..0d9e86a Binary files /dev/null and b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.br differ diff --git a/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.gz b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.gz new file mode 100644 index 0000000..352d070 Binary files /dev/null and b/_framework/HarfBuzzSharp.7hxr3k2jxz.wasm.gz differ diff --git a/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm new file mode 100644 index 0000000..14299ac Binary files /dev/null and b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm differ diff --git a/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.br b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.br new file mode 100644 index 0000000..7fae576 Binary files /dev/null and b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.br differ diff --git a/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.gz b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.gz new file mode 100644 index 0000000..674889b Binary files /dev/null and b/_framework/Irihi.Avalonia.Shared.49aeyu7lil.wasm.gz differ diff --git a/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm new file mode 100644 index 0000000..83e6cb5 Binary files /dev/null and b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm differ diff --git a/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.br b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.br new file mode 100644 index 0000000..b3a2ffe Binary files /dev/null and b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.br differ diff --git a/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.gz b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.gz new file mode 100644 index 0000000..dcf8746 Binary files /dev/null and b/_framework/Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm.gz differ diff --git a/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm new file mode 100644 index 0000000..85eca0e Binary files /dev/null and b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm differ diff --git a/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.br b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.br new file mode 100644 index 0000000..a4bead6 Binary files /dev/null and b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.br differ diff --git a/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.gz b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.gz new file mode 100644 index 0000000..aa8f360 Binary files /dev/null and b/_framework/Semi.Avalonia.DataGrid.9cuvva2nxq.wasm.gz differ diff --git a/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm new file mode 100644 index 0000000..fe53f93 Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm differ diff --git a/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.br b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.br new file mode 100644 index 0000000..288798e Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.br differ diff --git a/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.gz b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.gz new file mode 100644 index 0000000..b5977b6 Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.Web.so75ixgk5b.wasm.gz differ diff --git a/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm new file mode 100644 index 0000000..3e5bf3d Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm differ diff --git a/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.br b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.br new file mode 100644 index 0000000..70e8fcb Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.br differ diff --git a/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.gz b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.gz new file mode 100644 index 0000000..7da5d85 Binary files /dev/null and b/_framework/Semi.Avalonia.Demo.z0gvi7vqpx.wasm.gz differ diff --git a/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm new file mode 100644 index 0000000..cbb9e55 Binary files /dev/null and b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm differ diff --git a/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.br b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.br new file mode 100644 index 0000000..f5fbd58 Binary files /dev/null and b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.br differ diff --git a/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.gz b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.gz new file mode 100644 index 0000000..9ec9c5e Binary files /dev/null and b/_framework/Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm.gz differ diff --git a/_framework/Semi.Avalonia.v3cq3bt4tg.wasm b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm new file mode 100644 index 0000000..a7d9dc3 Binary files /dev/null and b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm differ diff --git a/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.br b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.br new file mode 100644 index 0000000..7a08a67 Binary files /dev/null and b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.br differ diff --git a/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.gz b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.gz new file mode 100644 index 0000000..45bed40 Binary files /dev/null and b/_framework/Semi.Avalonia.v3cq3bt4tg.wasm.gz differ diff --git a/_framework/SkiaSharp.8rdsog2snz.wasm b/_framework/SkiaSharp.8rdsog2snz.wasm new file mode 100644 index 0000000..f2dd127 Binary files /dev/null and b/_framework/SkiaSharp.8rdsog2snz.wasm differ diff --git a/_framework/SkiaSharp.8rdsog2snz.wasm.br b/_framework/SkiaSharp.8rdsog2snz.wasm.br new file mode 100644 index 0000000..c9cffd3 Binary files /dev/null and b/_framework/SkiaSharp.8rdsog2snz.wasm.br differ diff --git a/_framework/SkiaSharp.8rdsog2snz.wasm.gz b/_framework/SkiaSharp.8rdsog2snz.wasm.gz new file mode 100644 index 0000000..2fa7ce0 Binary files /dev/null and b/_framework/SkiaSharp.8rdsog2snz.wasm.gz differ diff --git a/_framework/System.Collections.6on6n2gctf.wasm b/_framework/System.Collections.6on6n2gctf.wasm new file mode 100644 index 0000000..3967fa2 Binary files /dev/null and b/_framework/System.Collections.6on6n2gctf.wasm differ diff --git a/_framework/System.Collections.6on6n2gctf.wasm.br b/_framework/System.Collections.6on6n2gctf.wasm.br new file mode 100644 index 0000000..f4b5fe9 Binary files /dev/null and b/_framework/System.Collections.6on6n2gctf.wasm.br differ diff --git a/_framework/System.Collections.6on6n2gctf.wasm.gz b/_framework/System.Collections.6on6n2gctf.wasm.gz new file mode 100644 index 0000000..fb4f864 Binary files /dev/null and b/_framework/System.Collections.6on6n2gctf.wasm.gz differ diff --git a/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm new file mode 100644 index 0000000..0d012a6 Binary files /dev/null and b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm differ diff --git a/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.br b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.br new file mode 100644 index 0000000..5fb9cac Binary files /dev/null and b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.br differ diff --git a/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.gz b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.gz new file mode 100644 index 0000000..9dcd612 Binary files /dev/null and b/_framework/System.Collections.Concurrent.9muq2b0o9c.wasm.gz differ diff --git a/_framework/System.Collections.NonGeneric.euj10syi7w.wasm b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm new file mode 100644 index 0000000..d59bcf9 Binary files /dev/null and b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm differ diff --git a/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.br b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.br new file mode 100644 index 0000000..6c4d19e Binary files /dev/null and b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.br differ diff --git a/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.gz b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.gz new file mode 100644 index 0000000..7966500 Binary files /dev/null and b/_framework/System.Collections.NonGeneric.euj10syi7w.wasm.gz differ diff --git a/_framework/System.Collections.Specialized.pmrze1vkyp.wasm b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm new file mode 100644 index 0000000..27a21bb Binary files /dev/null and b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm differ diff --git a/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.br b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.br new file mode 100644 index 0000000..e834553 Binary files /dev/null and b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.br differ diff --git a/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.gz b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.gz new file mode 100644 index 0000000..6ed5b76 Binary files /dev/null and b/_framework/System.Collections.Specialized.pmrze1vkyp.wasm.gz differ diff --git a/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm new file mode 100644 index 0000000..1457663 Binary files /dev/null and b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm differ diff --git a/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.br b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.br new file mode 100644 index 0000000..93abbcb Binary files /dev/null and b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.br differ diff --git a/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.gz b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.gz new file mode 100644 index 0000000..ffd9925 Binary files /dev/null and b/_framework/System.ComponentModel.Annotations.kbmzgbmpxf.wasm.gz differ diff --git a/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm new file mode 100644 index 0000000..c185430 Binary files /dev/null and b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm differ diff --git a/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.br b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.br new file mode 100644 index 0000000..8865b4f Binary files /dev/null and b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.br differ diff --git a/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.gz b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.gz new file mode 100644 index 0000000..bd38af2 Binary files /dev/null and b/_framework/System.ComponentModel.Primitives.1re2gdp06l.wasm.gz differ diff --git a/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm new file mode 100644 index 0000000..a0120a9 Binary files /dev/null and b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm differ diff --git a/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.br b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.br new file mode 100644 index 0000000..7d0cc20 Binary files /dev/null and b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.br differ diff --git a/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.gz b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.gz new file mode 100644 index 0000000..f853a45 Binary files /dev/null and b/_framework/System.ComponentModel.TypeConverter.rruxrd4n56.wasm.gz differ diff --git a/_framework/System.ComponentModel.g0zcsbgwop.wasm b/_framework/System.ComponentModel.g0zcsbgwop.wasm new file mode 100644 index 0000000..52535ad Binary files /dev/null and b/_framework/System.ComponentModel.g0zcsbgwop.wasm differ diff --git a/_framework/System.ComponentModel.g0zcsbgwop.wasm.br b/_framework/System.ComponentModel.g0zcsbgwop.wasm.br new file mode 100644 index 0000000..ee57ded Binary files /dev/null and b/_framework/System.ComponentModel.g0zcsbgwop.wasm.br differ diff --git a/_framework/System.ComponentModel.g0zcsbgwop.wasm.gz b/_framework/System.ComponentModel.g0zcsbgwop.wasm.gz new file mode 100644 index 0000000..836f434 Binary files /dev/null and b/_framework/System.ComponentModel.g0zcsbgwop.wasm.gz differ diff --git a/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm new file mode 100644 index 0000000..264ea83 Binary files /dev/null and b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm differ diff --git a/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.br b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.br new file mode 100644 index 0000000..72aaaff Binary files /dev/null and b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.br differ diff --git a/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.gz b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.gz new file mode 100644 index 0000000..4bd191b Binary files /dev/null and b/_framework/System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm.gz differ diff --git a/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm new file mode 100644 index 0000000..420593f Binary files /dev/null and b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm differ diff --git a/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.br b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.br new file mode 100644 index 0000000..bd33e87 Binary files /dev/null and b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.br differ diff --git a/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.gz b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.gz new file mode 100644 index 0000000..253a964 Binary files /dev/null and b/_framework/System.Diagnostics.TraceSource.38othyre2c.wasm.gz differ diff --git a/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm new file mode 100644 index 0000000..65c8862 Binary files /dev/null and b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm differ diff --git a/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.br b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.br new file mode 100644 index 0000000..9864794 Binary files /dev/null and b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.br differ diff --git a/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.gz b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.gz new file mode 100644 index 0000000..d54508d Binary files /dev/null and b/_framework/System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm.gz differ diff --git a/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm new file mode 100644 index 0000000..8bd4621 Binary files /dev/null and b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm differ diff --git a/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.br b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.br new file mode 100644 index 0000000..872ea28 Binary files /dev/null and b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.br differ diff --git a/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.gz b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.gz new file mode 100644 index 0000000..a0ebcc2 Binary files /dev/null and b/_framework/System.IO.FileSystem.Watcher.4azd8fnhst.wasm.gz differ diff --git a/_framework/System.Linq.Expressions.352bh30971.wasm b/_framework/System.Linq.Expressions.352bh30971.wasm new file mode 100644 index 0000000..550fdaf Binary files /dev/null and b/_framework/System.Linq.Expressions.352bh30971.wasm differ diff --git a/_framework/System.Linq.Expressions.352bh30971.wasm.br b/_framework/System.Linq.Expressions.352bh30971.wasm.br new file mode 100644 index 0000000..693d28c Binary files /dev/null and b/_framework/System.Linq.Expressions.352bh30971.wasm.br differ diff --git a/_framework/System.Linq.Expressions.352bh30971.wasm.gz b/_framework/System.Linq.Expressions.352bh30971.wasm.gz new file mode 100644 index 0000000..6341461 Binary files /dev/null and b/_framework/System.Linq.Expressions.352bh30971.wasm.gz differ diff --git a/_framework/System.Linq.jycnfjy4ii.wasm b/_framework/System.Linq.jycnfjy4ii.wasm new file mode 100644 index 0000000..e08e0cf Binary files /dev/null and b/_framework/System.Linq.jycnfjy4ii.wasm differ diff --git a/_framework/System.Linq.jycnfjy4ii.wasm.br b/_framework/System.Linq.jycnfjy4ii.wasm.br new file mode 100644 index 0000000..f94ff32 Binary files /dev/null and b/_framework/System.Linq.jycnfjy4ii.wasm.br differ diff --git a/_framework/System.Linq.jycnfjy4ii.wasm.gz b/_framework/System.Linq.jycnfjy4ii.wasm.gz new file mode 100644 index 0000000..80c1a21 Binary files /dev/null and b/_framework/System.Linq.jycnfjy4ii.wasm.gz differ diff --git a/_framework/System.ObjectModel.vbk301pval.wasm b/_framework/System.ObjectModel.vbk301pval.wasm new file mode 100644 index 0000000..43fb519 Binary files /dev/null and b/_framework/System.ObjectModel.vbk301pval.wasm differ diff --git a/_framework/System.ObjectModel.vbk301pval.wasm.br b/_framework/System.ObjectModel.vbk301pval.wasm.br new file mode 100644 index 0000000..b0d8a42 Binary files /dev/null and b/_framework/System.ObjectModel.vbk301pval.wasm.br differ diff --git a/_framework/System.ObjectModel.vbk301pval.wasm.gz b/_framework/System.ObjectModel.vbk301pval.wasm.gz new file mode 100644 index 0000000..4588424 Binary files /dev/null and b/_framework/System.ObjectModel.vbk301pval.wasm.gz differ diff --git a/_framework/System.Private.CoreLib.qeffafn2ym.wasm b/_framework/System.Private.CoreLib.qeffafn2ym.wasm new file mode 100644 index 0000000..f3555cf Binary files /dev/null and b/_framework/System.Private.CoreLib.qeffafn2ym.wasm differ diff --git a/_framework/System.Private.CoreLib.qeffafn2ym.wasm.br b/_framework/System.Private.CoreLib.qeffafn2ym.wasm.br new file mode 100644 index 0000000..7cdd468 Binary files /dev/null and b/_framework/System.Private.CoreLib.qeffafn2ym.wasm.br differ diff --git a/_framework/System.Private.CoreLib.qeffafn2ym.wasm.gz b/_framework/System.Private.CoreLib.qeffafn2ym.wasm.gz new file mode 100644 index 0000000..2b36ec1 Binary files /dev/null and b/_framework/System.Private.CoreLib.qeffafn2ym.wasm.gz differ diff --git a/_framework/System.Private.Uri.kw0xtqvd96.wasm b/_framework/System.Private.Uri.kw0xtqvd96.wasm new file mode 100644 index 0000000..580ec2c Binary files /dev/null and b/_framework/System.Private.Uri.kw0xtqvd96.wasm differ diff --git a/_framework/System.Private.Uri.kw0xtqvd96.wasm.br b/_framework/System.Private.Uri.kw0xtqvd96.wasm.br new file mode 100644 index 0000000..8e5871d Binary files /dev/null and b/_framework/System.Private.Uri.kw0xtqvd96.wasm.br differ diff --git a/_framework/System.Private.Uri.kw0xtqvd96.wasm.gz b/_framework/System.Private.Uri.kw0xtqvd96.wasm.gz new file mode 100644 index 0000000..da6c3c1 Binary files /dev/null and b/_framework/System.Private.Uri.kw0xtqvd96.wasm.gz differ diff --git a/_framework/System.Reactive.fmiefo5nve.wasm b/_framework/System.Reactive.fmiefo5nve.wasm new file mode 100644 index 0000000..6cf1925 Binary files /dev/null and b/_framework/System.Reactive.fmiefo5nve.wasm differ diff --git a/_framework/System.Reactive.fmiefo5nve.wasm.br b/_framework/System.Reactive.fmiefo5nve.wasm.br new file mode 100644 index 0000000..253a5a6 Binary files /dev/null and b/_framework/System.Reactive.fmiefo5nve.wasm.br differ diff --git a/_framework/System.Reactive.fmiefo5nve.wasm.gz b/_framework/System.Reactive.fmiefo5nve.wasm.gz new file mode 100644 index 0000000..06f6bd8 Binary files /dev/null and b/_framework/System.Reactive.fmiefo5nve.wasm.gz differ diff --git a/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm new file mode 100644 index 0000000..1201c42 Binary files /dev/null and b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm differ diff --git a/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.br b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.br new file mode 100644 index 0000000..54fb61a Binary files /dev/null and b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.br differ diff --git a/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.gz b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.gz new file mode 100644 index 0000000..db5b3f6 Binary files /dev/null and b/_framework/System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm.gz differ diff --git a/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm new file mode 100644 index 0000000..166ee74 Binary files /dev/null and b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm differ diff --git a/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.br b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.br new file mode 100644 index 0000000..2a37331 Binary files /dev/null and b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.br differ diff --git a/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.gz b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.gz new file mode 100644 index 0000000..71e53b8 Binary files /dev/null and b/_framework/System.Text.RegularExpressions.hcclc4n26u.wasm.gz differ diff --git a/_framework/System.l9jolnojrw.wasm b/_framework/System.l9jolnojrw.wasm new file mode 100644 index 0000000..6fc1124 Binary files /dev/null and b/_framework/System.l9jolnojrw.wasm differ diff --git a/_framework/System.l9jolnojrw.wasm.br b/_framework/System.l9jolnojrw.wasm.br new file mode 100644 index 0000000..94523a0 Binary files /dev/null and b/_framework/System.l9jolnojrw.wasm.br differ diff --git a/_framework/System.l9jolnojrw.wasm.gz b/_framework/System.l9jolnojrw.wasm.gz new file mode 100644 index 0000000..2fc66f2 Binary files /dev/null and b/_framework/System.l9jolnojrw.wasm.gz differ diff --git a/_framework/avalonia.js b/_framework/avalonia.js new file mode 100755 index 0000000..57ed1cb --- /dev/null +++ b/_framework/avalonia.js @@ -0,0 +1,2 @@ +var T=class{static getCaretCoordinates(e,t,r){var p,x;if(!G)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");let n=(p=r==null?void 0:r.debug)!=null?p:!1;if(n){let h=document.querySelector("#input-textarea-caret-position-mirror-div");h&&((x=h.parentNode)==null||x.removeChild(h))}let i=document.createElement("div");i.id="input-textarea-caret-position-mirror-div",document.body.appendChild(i);let s=i.style,o=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,a=e.nodeName==="INPUT";s.whiteSpace="pre-wrap",a||(s.wordWrap="break-word"),s.position="absolute",n||(s.visibility="hidden"),K.forEach(h=>{if(a&&h==="lineHeight")if(o.boxSizing==="border-box"){let L=parseInt(o.height),N=parseInt(o.paddingTop)+parseInt(o.paddingBottom)+parseInt(o.borderTopWidth)+parseInt(o.borderBottomWidth),U=N+parseInt(o.lineHeight);L>U?s.lineHeight=`${L-N}px`:L===U?s.lineHeight=o.lineHeight:s.lineHeight="0"}else s.lineHeight=o.height;else s[h]=o[h]}),V?e.scrollHeight>parseInt(o.height)&&(s.overflowY="scroll"):s.overflow="hidden",i.textContent=e.value.substring(0,t),a&&(i.textContent=i.textContent.replace(/\s/g,"\xA0"));let d=document.createElement("span");d.textContent=e.value.substring(t)||".",i.appendChild(d);let u={top:d.offsetTop+parseInt(o.borderTopWidth),left:d.offsetLeft+parseInt(o.borderLeftWidth),height:parseInt(o.lineHeight)};return n?d.style.backgroundColor="#aaa":document.body.removeChild(i),u}},K=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],G=typeof window!="undefined",V=G&&window.mozInnerScreenX!=null;var l=class{static get InputHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.InputHelper}static get DomHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.DomHelper}static get TimerHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.TimerHelper}static get CanvasHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.CanvasHelper}};async function j(){let c=await globalThis.getDotnetRuntime(0);if(c!=null)return l.resolvedExports=await c.getAssemblyExports("Avalonia.Browser.dll"),l.resolvedExports}l.exportsPromise=j();var D=class{constructor(e){this.database=e}openStore(e,t){return this.database.transaction(e,t).objectStore(e)}async put(e,t,r){let n=this.openStore(e,"readwrite");return await new Promise((i,s)=>{let o=n.put(t,r);o.onsuccess=()=>{i(o.result)},o.onerror=()=>{s(o.error)}})}get(e,t){let r=this.openStore(e,"readonly");return new Promise((n,i)=>{let s=r.get(t);s.onsuccess=()=>{n(s.result)},s.onerror=()=>{i(s.error)}})}async delete(e,t){let r=this.openStore(e,"readwrite");return await new Promise((n,i)=>{let s=r.delete(t);s.onsuccess=()=>{n()},s.onerror=()=>{i(s.error)}})}close(){this.database.close()}},B=class{constructor(e,t){this.databaseName=e;this.objectStores=t}async connect(){let e=window.indexedDB.open(this.databaseName,1);return e.onupgradeneeded=t=>{let r=t.target.result;this.objectStores.forEach(n=>{r.createObjectStore(n)})},await new Promise((t,r)=>{e.onsuccess=n=>{t(new D(n.target.result))},e.onerror=n=>{r(n.target.error)}})}},P="fileBookmarks",M=new B("AvaloniaDb",[P]);var b=class{constructor(e,t,r,n){this.handle=e;this.file=t;this.bookmarkId=r;this.wellKnownType=n}get name(){var e;return this.handle?this.handle.name:this.file?this.file.name:(e=this.wellKnownType)!=null?e:""}get kind(){return this.handle?this.handle.kind:this.file?"file":"directory"}static createFromHandle(e,t){return new b(e,void 0,t,void 0)}static createFromFile(e){return new b(void 0,e,void 0,void 0)}static createWellKnownDirectory(e){return new b(void 0,void 0,void 0,e)}static async openRead(e){if(e.file)return e.file;if(!e.handle||e.kind!=="file")throw new Error("StorageItem is not a file");return await e.verityPermissions("read"),await e.handle.getFile()}static async openWrite(e){if(!e.handle||e.kind!=="file")throw new Error("StorageItem is not a writeable file");return await e.verityPermissions("readwrite"),await e.handle.createWritable({keepExistingData:!0})}static async getProperties(e){try{let t=e.handle&&"getFile"in e.handle?await e.handle.getFile():e.file;return t?{Size:t.size,LastModified:t.lastModified,Type:t.type}:null}catch{return null}}static getItemsIterator(e){return e.kind!=="directory"||!e.handle?null:e.handle.entries()}static async createFile(e,t){if(e.kind!=="directory"||!e.handle)throw new TypeError("Unable to create item in the requested directory");return await e.verityPermissions("readwrite"),await e.handle.getFileHandle(t,{create:!0})}static async getFile(e,t){return e.kind!=="directory"||!e.handle?null:(await e.verityPermissions("read"),await e.handle.getFileHandle(t))}static async createFolder(e,t){if(e.kind!=="directory"||!e.handle)throw new TypeError("Unable to create item in the requested directory");return await e.verityPermissions("readwrite"),await e.handle.getDirectoryHandle(t,{create:!0})}static async getFolder(e,t){return e.kind!=="directory"||!e.handle?null:(await e.verityPermissions("read"),await e.handle.getDirectoryHandle(t))}static async deleteAsync(e){return e.handle?(await e.verityPermissions("readwrite"),await e.handle.remove({recursive:!0})):null}static async moveAsync(e,t){if(!e.handle)return null;if(t.kind!=="directory"||!t.handle)throw new TypeError("Unable to move item to the requested directory");return await e.verityPermissions("readwrite"),await e.handle.move(t)}async verityPermissions(e){if(!!this.handle&&!!v.hasNativeFilePicker()&&await this.handle.queryPermission({mode:e})!=="granted"&&await this.handle.requestPermission({mode:e})==="denied")throw new Error("Permissions denied")}static async saveBookmark(e){if(e.bookmarkId)return e.bookmarkId;if(!e.handle||!v.hasNativeFilePicker())return null;let t=await M.connect();try{return await t.put(P,e.handle,e.generateBookmarkId())}finally{t.close()}}static async deleteBookmark(e){if(!e.bookmarkId||!v.hasNativeFilePicker())return;let t=await M.connect();try{await t.delete(P,e.bookmarkId)}finally{t.close()}}generateBookmarkId(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}};var k=class{static initializeBackgroundHandlers(){this.clipboardState===0&&(globalThis.document.addEventListener("paste",e=>{if(this.clipboardState!==2||!this.resolveClipboard)return;let t=this.getDataTransferItems(e.clipboardData);this.resolveClipboard(t.map(r=>({type:"dataTransferItem",value:r})))}),this.clipboardState=1)}static getDataTransferItems(e){let t=e==null?void 0:e.items;return t==null?[]:Array.from(t)}static isClipboardFormatSupported(e){return ClipboardItem.supports?ClipboardItem.supports(e):e==="text/plain"||e==="text/html"||e==="image/png"}static createWriteableClipboardSource(){return{items:[]}}static createWriteableClipboardItem(e){let t={data:{}};return e.items.push(t),t}static addStringToWriteableClipboardItem(e,t,r){e.data[t]=r}static addBytesToWriteableClipboardItem(e,t,r){let n=r.slice(0,r.byteLength);e.data[t]=new Blob([n],{type:t})}static async readClipboard(e){let t=e.navigator.clipboard;if(t.read)return(await t.read()).map(n=>({type:"clipboardItem",value:n}));if(t.readText)return[{type:"string",value:await t.readText()}];try{return await new Promise((r,n)=>{this.clipboardState=2,this.resolveClipboard=r,this.rejectClipboard=n})}finally{this.clipboardState=1,this.resolveClipboard=void 0,this.rejectClipboard=void 0}}static async writeClipboard(e,t){var n;let r=(n=t==null?void 0:t.items)!=null?n:[];if(r.length===0){await e.navigator.clipboard.writeText("");return}return e.navigator.clipboard.write?await e.navigator.clipboard.write(r.map(i=>new ClipboardItem(i.data))):await this.writeFirstText(e,r)}static async writeFirstText(e,t){for(let r of t)for(let n in r.data){if(!n.startsWith("text/"))continue;let i=r.data[n];typeof i!="string"&&(i=""),await e.navigator.clipboard.writeText(i);return}}static getReadableDataItemFormats(e){switch(e.type){case"clipboardItem":return e.value.types;case"dataTransferItem":switch(e.value.kind){case"string":return[e.value.type];case"file":return["Files"];default:return[]}case"string":return["text/plain"];default:return[]}}static async tryGetReadableDataItemValueAsync(e,t){switch(e.type){case"clipboardItem":{let n=e.value;if(!n.types.includes(t))return null;let i=await n.getType(t);return t.startsWith("text/")?{type:"string",value:await i.text()}:{type:"bytes",value:await this.getBlobBytes(i)}}case"dataTransferItem":{let n=e.value;switch(n.kind){case"string":{if(t!==n.type)return null;let i=await new Promise(s=>n.getAsString(o=>s(o)));return{type:"string",value:i}}case"file":{if(t!=="Files")return null;let i=n.getAsFile();return i==null?null:{type:"file",value:b.createFromFile(i)}}default:return null}}case"string":return t.startsWith("text/")?{type:"string",value:e.value}:{type:"bytes",value:await this.getBlobBytes(new Blob([e.value]))};default:return null}}static tryGetReadableDataItemValue(e,t){if(e.type!=="dataTransferItem")return null;let n=e.value;switch(n.kind){case"string":{if(t!==n.type)return null;let i="";return n.getAsString(function(s){i=s}),{type:"string",value:i}}case"file":{if(t!=="Files")return null;let i=n.getAsFile();return i==null?null:{type:"file",value:b.createFromFile(i)}}default:return null}}static async getBlobBytes(e){return e.bytes?await e.bytes():new Uint8Array(await e.arrayBuffer())}static subscribeInputEvents(e,t){let r=this.subscribeKeyEvents(e,t),n=this.subscribePointerEvents(e,t),i=this.subscribeTextEvents(e,t),s=this.subscribeDropEvents(e,t),o=this.subscribeKeyboardGeometryChange(e,t);return()=>{r(),n(),i(),s(),o()}}static subscribeKeyEvents(e,t){let r=i=>{l.InputHelper.OnKeyDown(t,i.code,i.key,this.getModifiers(i)).then(s=>{(!s||this.clipboardState!==2)&&i.preventDefault()})};e.addEventListener("keydown",r);let n=i=>{l.InputHelper.OnKeyUp(t,i.code,i.key,this.getModifiers(i)).then(s=>{s||i.preventDefault()}),this.rejectClipboard&&this.rejectClipboard()};return e.addEventListener("keyup",n),()=>{e.removeEventListener("keydown",r),e.removeEventListener("keyup",n)}}static subscribeTextEvents(e,t){let r=o=>{l.InputHelper.OnCompositionStart(t)};e.addEventListener("compositionstart",r);let n=o=>{let a=o.getTargetRanges(),d=-1,u=-1;a.length>0&&(d=a[0].startOffset,u=a[0].endOffset),o.inputType==="insertCompositionText"&&(d=2,u=d+2),l.InputHelper.OnBeforeInput(t,o.inputType,d,u)};e.addEventListener("beforeinput",n);let i=o=>{l.InputHelper.OnCompositionUpdate(t,o.data)};e.addEventListener("compositionupdate",i);let s=o=>{l.InputHelper.OnCompositionEnd(t,o.data),o.preventDefault()};return e.addEventListener("compositionend",s),()=>{e.removeEventListener("compositionstart",r),e.removeEventListener("compositionupdate",i),e.removeEventListener("compositionend",s)}}static subscribePointerEvents(e,t){let r=a=>{l.InputHelper.OnPointerMove(t,a.pointerType,a.pointerId,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a),a),a.preventDefault()},n=a=>{l.InputHelper.OnPointerDown(t,a.pointerType,a.pointerId,a.button,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a)),a.preventDefault()},i=a=>{l.InputHelper.OnPointerUp(t,a.pointerType,a.pointerId,a.button,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a)),a.preventDefault()},s=a=>{l.InputHelper.OnPointerCancel(t,a.pointerType,a.pointerId,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a))},o=a=>{l.InputHelper.OnWheel(t,a.offsetX,a.offsetY,a.deltaX,a.deltaY,this.getModifiers(a)),a.preventDefault()};return e.addEventListener("pointermove",r),e.addEventListener("pointerdown",n),e.addEventListener("pointerup",i),e.addEventListener("wheel",o),e.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerover",r),e.removeEventListener("pointerdown",n),e.removeEventListener("pointerup",i),e.removeEventListener("pointercancel",s),e.removeEventListener("wheel",o)}}static subscribeDropEvents(e,t){let r=i=>{let s=i.dataTransfer;if(s==null)return;let o=this.getDataTransferItems(s).map(a=>({type:"dataTransferItem",value:a}));l.InputHelper.OnDragDrop(t,i.type,i.offsetX,i.offsetY,this.getModifiers(i),s,o)},n=i=>{i.preventDefault(),r(i)};return e.addEventListener("dragover",n),e.addEventListener("dragenter",r),e.addEventListener("dragleave",r),e.addEventListener("drop",n),()=>{e.removeEventListener("dragover",n),e.removeEventListener("dragenter",r),e.removeEventListener("dragleave",r),e.removeEventListener("drop",n)}}static getCoalescedEvents(e){return e.getCoalescedEvents().flatMap(t=>[t.offsetX,t.offsetY,t.pressure,t.tiltX,t.tiltY,t.twist])}static subscribeKeyboardGeometryChange(e,t){if("virtualKeyboard"in navigator){let r=n=>{let i=e.getBoundingClientRect(),s=n.target.boundingRect;l.InputHelper.OnKeyboardGeometryChange(t,s.x-i.x,s.y-i.y,s.width,s.height)};return navigator.virtualKeyboard.addEventListener("geometrychange",r),()=>{navigator.virtualKeyboard.removeEventListener("geometrychange",r)}}return()=>{}}static clearInput(e){e.value=""}static focusElement(e){e.focus()}static setCursor(e,t){t==="default"?e.style.removeProperty("cursor"):e.style.cursor=t}static setBounds(e,t,r,n,i,s){e.style.left=t.toFixed(0)+"px",e.style.top=r.toFixed(0)+"px";let{left:o,top:a}=T.getCaretCoordinates(e,s);e.style.left=(t-o).toFixed(0)+"px",e.style.top=(r-a).toFixed(0)+"px"}static hide(e){e.style.display="none"}static show(e){e.style.display="block"}static setSurroundingText(e,t,r,n){!e||(e.value=t,e.setSelectionRange(r,n),e.style.width="20px",e.style.width=`${e.scrollWidth}px`)}static getModifiers(e){let t=0;e.ctrlKey&&(t|=2),e.altKey&&(t|=1),e.shiftKey&&(t|=4),e.metaKey&&(t|=8);let r=e.buttons;return r&&(r&1&&(t|=16),r&2&&(t|=e.type==="pen"?2048:32),r&4&&(t|=64),r&8&&(t|=128),r&16&&(t|=256),r&32&&(t|=1024)),t}static setPointerCapture(e,t){e.setPointerCapture(t)}static releasePointerCapture(e,t){e.hasPointerCapture(t)&&e.releasePointerCapture(t)}};k.clipboardState=0;var g=class{static getGlobalThis(){return globalThis}static addClass(e,t){e.classList.add(t)}static getFirstElementById(e,t){return(t instanceof Window?t.document:t.ownerDocument).getElementById(e)}static getFirstElementByClassName(e,t){let n=(t instanceof Window?t.document:t).getElementsByClassName(e);return n?n[0]:null}static createAvaloniaCanvas(e){var n;let t=(n=e.getAttribute("data-containerId"))!=null?n:"0000",r=document.createElement("canvas");return r.id=`canvas${t}`,r.classList.add("avalonia-canvas"),r.style.width="100%",r.style.height="100%",r.style.position="absolute",r}static attachCanvas(e,t){e.prepend(t)}static detachCanvas(e,t){e.removeChild(t)}static createAvaloniaHost(e){let t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10);e.classList.add("avalonia-container"),e.tabIndex=0,e.setAttribute("data-containerId",t),e.oncontextmenu=function(){return!1},e.style.overflow="hidden",e.style.touchAction="none";let r=document.createElement("div");r.id=`nativeHost${t}`,r.classList.add("avalonia-native-host"),r.style.left="0px",r.style.top="0px",r.style.width="100%",r.style.height="100%",r.style.position="absolute";let n=document.createElement("input");return n.id=`inputElement${t}`,n.classList.add("avalonia-input-element"),n.autocapitalize="none",n.type="text",n.spellcheck=!1,n.style.padding="0",n.style.margin="0",n.style.borderWidth="0",n.style.position="absolute",n.style.overflow="hidden",n.style.borderStyle="hidden",n.style.outline="none",n.style.background="transparent",n.style.color="transparent",n.style.display="none",n.style.height="20px",n.style.zIndex="-1",n.onpaste=function(){return!1},n.oncopy=function(){return!1},n.oncut=function(){return!1},e.prepend(n),e.prepend(r),{host:e,nativeHost:r,inputElement:n}}static isFullscreen(e){return e.document.fullscreenElement!=null}static async setFullscreen(e,t){t?await e.document.documentElement.requestFullscreen():await e.document.exitFullscreen()}static initGlobalDomEvents(e){if(e.document.documentElement.style.setProperty("--av-sat","env(safe-area-inset-top)"),e.document.documentElement.style.setProperty("--av-sar","env(safe-area-inset-right)"),e.document.documentElement.style.setProperty("--av-sab","env(safe-area-inset-bottom)"),e.document.documentElement.style.setProperty("--av-sal","env(safe-area-inset-left)"),e.matchMedia!==void 0){let t=e.matchMedia("(prefers-color-scheme: dark)"),r=e.matchMedia("(prefers-contrast: more)");t.addEventListener("change",n=>{l.DomHelper.DarkModeChanged(n.matches,r.matches)}),r.addEventListener("change",n=>{l.DomHelper.DarkModeChanged(t.matches,n.matches)})}e.document.addEventListener("visibilitychange",()=>{l.DomHelper.DocumentVisibilityChanged(e.document.visibilityState)}),e.document.visibilityState==="visible"&&e.setTimeout(()=>{l.DomHelper.DocumentVisibilityChanged(e.document.visibilityState)},10)}static getSafeAreaPadding(e){let t=parseFloat(getComputedStyle(e.document.documentElement).getPropertyValue("--av-sat")),r=parseFloat(getComputedStyle(e.document.documentElement).getPropertyValue("--av-sab")),n=parseFloat(getComputedStyle(e.document.documentElement).getPropertyValue("--av-sal")),i=parseFloat(getComputedStyle(e.document.documentElement).getPropertyValue("--av-sar"));return[n,t,r,i]}static getDarkMode(e){if(e.matchMedia===void 0)return[0,0];let t=e.matchMedia("(prefers-color-scheme: dark)"),r=e.matchMedia("(prefers-contrast: more)");return[t.matches?1:0,r.matches?1:0]}};var v=class{static hasNativeFilePicker(){return"showSaveFilePicker"in globalThis}static isMobile(){var i;let e=(i=globalThis.navigator)==null?void 0:i.userAgentData;if(e)return e.mobile;let t=navigator.userAgent,r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,n=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i;return r.test(t)||n.test(t.substr(0,4))}static isTv(){return navigator.userAgent.includes("SmartTV")}};var q=typeof SharedArrayBuffer!="undefined";function _(c){return q&&c[Symbol.toStringTag]==="SharedArrayBuffer"}var W=class{static async seek(e,t){return await e.seek(t)}static async truncate(e,t){return await e.truncate(t)}static async close(e){return await e.close()}static async write(e,t,r,n){var o;let i=(o=globalThis.getDotnetRuntime(0))==null?void 0:o.localHeapViewU8(),s;if(t._pointer>0&&t._length>0&&i&&!_(i.buffer))s=new Uint8Array(i.buffer,t._pointer+r,n);else{let a=new Uint8Array(n);t.copyTo(a,r),s=t}return await e.write(s)}static byteLength(e){return e.size}static async sliceArrayBuffer(e,t,r){let n=await e.slice(t,t+r).arrayBuffer();return new Uint8Array(n)}static toMemoryView(e){return e}};var F=class{},A=class{static createDefaultChild(e){return document.createElement("div")}static createAttachment(){return new F}static initializeWithChildHandle(e,t){e._child=t,e._child.style.position="absolute"}static attachTo(e,t){e._host&&e._child&&e._host.removeChild(e._child),e._host=t,e._host&&e._child&&e._host.appendChild(e._child)}static showInBounds(e,t,r,n,i){e._child&&(e._child.style.top=`${r}px`,e._child.style.left=`${t}px`,e._child.style.width=`${n}px`,e._child.style.height=`${i}px`,e._child.style.display="block")}static hideWithSize(e,t,r){e._child&&(e._child.style.width=`${t}px`,e._child.style.height=`${r}px`,e._child.style.display="none")}static releaseChild(e){e._child&&(e._child=void 0)}};var z=class{static addBackHandler(e){history.pushState(null,"",window.location.href),window.onpopstate=()=>{e()?history.forward():history.back()}}static openUri(e,t){return!!window.open(e,t)}};var R=class{static itemsArrayAt(e,t){let r=e[t];if(!r)return[];let n=[];for(let i=0;i{var r,n;(r=this.resizeObserver)==null||r.callbacks.delete(e),(n=this.resizeObserver)==null||n.unobserve(e)}}static onResize(e,t){for(let r of e){let n=t.callbacks.get(r.target);if(!n)continue;let i=window.devicePixelRatio,s,o,a=i;r.devicePixelContentBoxSize?(s=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize,a=1):r.contentBoxSize?r.contentBoxSize[0]?(s=r.contentBoxSize[0].inlineSize,o=r.contentBoxSize[0].blockSize):(s=r.contentBoxSize.inlineSize,o=r.contentBoxSize.blockSize):(s=r.contentRect.width,o=r.contentRect.height);let d=Math.round(s*a),u=Math.round(o*a);n(d,u,i)}}};var w=class{constructor(e,t){this.canvas=e;this.renderTargetType=t}static setSize(e,t,r){e.canvas.width=t,e.canvas.height=r}};function Y(){var t,r,n,i;let c=globalThis,e=(r=c.Module)!=null?r:(t=c.getDotnetRuntime(0))==null?void 0:t.Module;return(i=(n=e==null?void 0:e.GL)!=null?n:c.AvaloniaGL)!=null?i:c.SkiaSharpGL}var f=class extends w{constructor(t,r){var o,a;if(f._gl==null&&(f._gl=Y()),!f._gl)throw new Error("Module.GL object wasn't initialized, WebGL can't be used.");let n={alpha:!0,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!0,majorVersion:r===2?1:2,minorVersion:0,enableExtensionsByDefault:1,explicitSwapControl:0},i=r===2?t.getContext("webgl",n):t.getContext("webgl2",n);if(!i)throw new Error("HTMLCanvasElement.getContext returned null.");let s=f._gl.registerContext(i,n);i.gl_handle=s;super(t,"webgl");this.canvas=t;this.contextHandle=s,this.fboId=(a=(o=i.getParameter(i.FRAMEBUFFER_BINDING))==null?void 0:o.id)!=null?a:0,this.stencil=i.getParameter(i.STENCIL_BITS),this.sample=i.getParameter(i.SAMPLES),this.depth=i.getParameter(i.DEPTH_BITS),this.attrs=n}static getCurrentContext(){var t,r,n;return(n=(r=(t=f._gl)==null?void 0:t.currentContext)==null?void 0:r.handle)!=null?n:0}static makeContextCurrent(t){if(f._gl==null)return!1;let r=f._gl.makeContextCurrent(t);return t===0||r}},E=f;E._gl=null;var C=class extends w{constructor(t){let r=t.getContext("2d",{alpha:!0});if(!r)throw new Error("HTMLCanvasElement.getContext(2d) returned null.");super(t,"software");this.context=r,this.runtime=globalThis.getDotnetRuntime(0)}putPixelData(t,r,n,i){var d;let s=(d=this.runtime)==null?void 0:d.localHeapViewU8(),o;if(s!=null&&s.buffer){if(o=new Uint8ClampedArray(s.buffer,t,r),this.canvas instanceof OffscreenCanvas){let u=new ArrayBuffer(o.byteLength),p=new Uint8ClampedArray(u);p.set(o),o=p}}else throw new Error("Unable to access .NET memory");let a=new ImageData(o,n,i);this.context.putImageData(a,0,0)}static staticPutPixelData(t,r,n,i,s){t.putPixelData(r,n,i,s)}};var m=class{static create(e,t,r){var i,s;let n=m.nextId++;if(e===0)m.registry[n]={canvas:t},m.targets[n]=m.createRenderTarget(t,r);else{let o=globalThis,a=(s=o.Module)!=null?s:(i=o.getDotnetRuntime(0))==null?void 0:i.Module,d=a==null?void 0:a.PThread;if(d==null)throw new Error("Unable to access emscripten PThread api");let u=d.pthreads[e];if(u==null)throw new Error(`Unable get pthread with id ${e}`);let p;if(u.postMessage!=null?p=u:p=u.worker,p==null)throw new Error(`Unable get Worker for pthread ${e}`);let x=t.transferControlToOffscreen();p.postMessage({avaloniaCmd:"registerCanvas",canvas:x,modes:r,id:n},[x]),m.registry[n]={canvas:t,worker:p}}return n}static initializeWorker(){let e=self.onmessage;self.onmessage=t=>{let r=t;r.data.avaloniaCmd==="registerCanvas"?m.targets[r.data.id]=m.createRenderTarget(r.data.canvas,r.data.modes):r.data.avaloniaCmd==="unregisterCanvas"?delete m.targets[r.data.id]:e!=null&&e.call(self,t)}}static getRenderTarget(e){return m.targets[e]}static createRenderTarget(e,t){for(let r of t)try{return r===1?new C(e):new E(e,r)}catch(n){let i="";n instanceof Error&&(i=": "+n.message),console.error(`Failed to create render target for mode ${r} ${i}`)}return new C(e)}},y=m;y.targets={},y.registry={},y.nextId=1;var I=class{constructor(e,t,r,n){this.canvas=e;this.targetId=y.create(n,e,t),H.observeSize(e,(i,s,o)=>{var a;this.sizeParams=[i,s,o],(a=l.CanvasHelper)==null||a.OnSizeChanged(r,i,s,o)})}get width(){return this.sizeParams?this.sizeParams[0]:1}get height(){return this.sizeParams?this.sizeParams[1]:1}get scaling(){return this.sizeParams?this.sizeParams[2]:1}destroy(){}static create(e,t,r,n){let i=g.createAvaloniaCanvas(e);g.attachCanvas(e,i);try{return new I(i,t,r,n)}catch(s){throw g.detachCanvas(e,i),s}}static destroy(e){e.destroy()}};var O=class{static raiseOnChanged(){l.DomHelper.ScreensChanged()}static async checkPermissions(e){let{state:t}=await e.navigator.permissions.query({name:"window-management"});t==="granted"&&await this.requestDetailedScreens(e)}static subscribeOnChanged(e){if(this.detailedScreens){e.screen.removeEventListener("change",this.raiseOnChanged),this.detailedScreens.addEventListener("screenschange",this.raiseOnChanged);for(let t of this.detailedScreens.screens)t.addEventListener("change",this.raiseOnChanged)}else e.screen.addEventListener("change",this.raiseOnChanged)}static getAllScreens(e){return this.detailedScreens?this.detailedScreens.screens:[Object.assign(e.screen,{window:e})]}static async requestDetailedScreens(e){return this.detailedScreens?!0:"getScreenDetails"in e&&(this.detailedScreens=await e.getScreenDetails(),this.detailedScreens)?(this.subscribeOnChanged(e),e.setTimeout(this.raiseOnChanged,1),!0):!1}static getDisplayName(e){return e==null?void 0:e.label}static getScaling(e){return"devicePixelRatio"in e?e.devicePixelRatio:"window"in e?e.window.devicePixelRatio:1}static getBounds(e){let t=e.width,r=e.height;return"left"in e&&"top"in e?[e.left,e.top,t,r]:"availLeft"in e&&"availTop"in e?[e.availLeft,e.availTop,t,r]:[0,0,t,r]}static getWorkingArea(e){let t=e.availWidth,r=e.availHeight;return"availLeft"in e&&"availTop"in e?[e.availLeft,e.availTop,t,r]:[0,0,t,r]}static isCurrent(e){return this.detailedScreens?this.detailedScreens.currentScreen===e:!0}static isPrimary(e){return"isPrimary"in e?e.isPrimary:!0}static getCurrentOrientation(e){switch(e.orientation.type){case"landscape-primary":return 1;case"landscape-secondary":return 4;case"portrait-primary":return 2;case"portrait-secondary":return 8}}};async function Xe(c,e){"serviceWorker"in navigator&&await globalThis.navigator.serviceWorker.register(c,e?{scope:e}:void 0)}export{g as AvaloniaDOM,v as Caniuse,I as CanvasSurface,R as GeneralHelpers,k as InputHelper,A as NativeControlHost,z as NavigationHelper,O as ScreenHelper,C as SoftwareRenderTarget,W as StreamHelper,S as TimerHelper,E as WebGlRenderTarget,w as WebRenderTarget,y as WebRenderTargetRegistry,Xe as registerServiceWorker}; +//# sourceMappingURL=avalonia.js.map diff --git a/_framework/avalonia.js.br b/_framework/avalonia.js.br new file mode 100644 index 0000000..054a513 Binary files /dev/null and b/_framework/avalonia.js.br differ diff --git a/_framework/avalonia.js.gz b/_framework/avalonia.js.gz new file mode 100644 index 0000000..7d6e4b6 Binary files /dev/null and b/_framework/avalonia.js.gz differ diff --git a/_framework/avalonia.js.map b/_framework/avalonia.js.map new file mode 100755 index 0000000..3ffa2dd --- /dev/null +++ b/_framework/avalonia.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../webapp/modules/avalonia/caretHelper.ts", "../webapp/modules/avalonia/jsExports.ts", "../webapp/modules/storage/indexedDb.ts", "../webapp/modules/storage/storageItem.ts", "../webapp/modules/avalonia/input.ts", "../webapp/modules/avalonia/dom.ts", "../webapp/modules/avalonia/caniuse.ts", "../webapp/modules/avalonia/stream.ts", "../webapp/modules/avalonia/nativeControlHost.ts", "../webapp/modules/avalonia/navigationHelper.ts", "../webapp/modules/avalonia/generalHelpers.ts", "../webapp/modules/avalonia/timer.ts", "../webapp/modules/avalonia/rendering/resizeHandler.ts", "../webapp/modules/avalonia/rendering/webRenderTarget.ts", "../webapp/modules/avalonia/rendering/webGlRenderTarget.ts", "../webapp/modules/avalonia/rendering/softwareRenderTarget.ts", "../webapp/modules/avalonia/rendering/webRenderTargetRegistry.ts", "../webapp/modules/avalonia/rendering/canvasSurface.ts", "../webapp/modules/avalonia/screens.ts", "../webapp/modules/avalonia.ts"], + "sourcesContent": ["// Based on https://github.com/component/textarea-caret-position/blob/master/index.js\r\nexport class CaretHelper {\r\n public static getCaretCoordinates(\r\n element: HTMLInputElement | HTMLTextAreaElement,\r\n position: number,\r\n options?: { debug: boolean }\r\n ) {\r\n if (!isBrowser) {\r\n throw new Error(\r\n \"textarea-caret-position#getCaretCoordinates should only be called in a browser\"\r\n );\r\n }\r\n\r\n const debug = options?.debug ?? false;\r\n if (debug) {\r\n const el = document.querySelector(\r\n \"#input-textarea-caret-position-mirror-div\"\r\n );\r\n if (el) el.parentNode?.removeChild(el);\r\n }\r\n\r\n // The mirror div will replicate the textarea's style\r\n const div = document.createElement(\"div\");\r\n div.id = \"input-textarea-caret-position-mirror-div\";\r\n document.body.appendChild(div);\r\n\r\n const style = div.style;\r\n const computed = window.getComputedStyle\r\n ? window.getComputedStyle(element)\r\n : ((element as any).currentStyle as CSSStyleDeclaration); // currentStyle for IE < 9\r\n const isInput = element.nodeName === \"INPUT\";\r\n\r\n // Default textarea styles\r\n style.whiteSpace = \"pre-wrap\";\r\n if (!isInput) style.wordWrap = \"break-word\"; // only for textarea-s\r\n\r\n // Position off-screen\r\n style.position = \"absolute\"; // required to return coordinates properly\r\n if (!debug) style.visibility = \"hidden\"; // not 'display: none' because we want rendering\r\n\r\n // Transfer the element's properties to the div\r\n properties.forEach((prop: string) => {\r\n if (isInput && prop === \"lineHeight\") {\r\n // Special case for s because text is rendered centered and line height may be != height\r\n if (computed.boxSizing === \"border-box\") {\r\n const height = parseInt(computed.height);\r\n const outerHeight =\r\n parseInt(computed.paddingTop) +\r\n parseInt(computed.paddingBottom) +\r\n parseInt(computed.borderTopWidth) +\r\n parseInt(computed.borderBottomWidth);\r\n const targetHeight = outerHeight + parseInt(computed.lineHeight);\r\n if (height > targetHeight) {\r\n style.lineHeight = `${height - outerHeight}px`;\r\n } else if (height === targetHeight) {\r\n style.lineHeight = computed.lineHeight;\r\n } else {\r\n style.lineHeight = \"0\";\r\n }\r\n } else {\r\n style.lineHeight = computed.height;\r\n }\r\n } else {\r\n (style as any)[prop] = (computed as any)[prop];\r\n }\r\n });\r\n\r\n if (isFirefox) {\r\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\r\n if (element.scrollHeight > parseInt(computed.height)) {\r\n style.overflowY = \"scroll\";\r\n }\r\n } else {\r\n style.overflow = \"hidden\"; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\r\n }\r\n\r\n div.textContent = element.value.substring(0, position);\r\n // The second special handling for input type=\"text\" vs textarea:\r\n // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\r\n if (isInput) div.textContent = div.textContent.replace(/\\s/g, \"\\u00a0\");\r\n\r\n const span = document.createElement(\"span\");\r\n // Wrapping must be replicated *exactly*, including when a long word gets\r\n // onto the next line, with whitespace at the end of the line before (#7).\r\n // The *only* reliable way to do that is to copy the *entire* rest of the\r\n // textarea's content into the created at the caret position.\r\n // For inputs, just '.' would be enough, but no need to bother.\r\n span.textContent = element.value.substring(position) || \".\"; // || because a completely empty faux span doesn't render at all\r\n div.appendChild(span);\r\n\r\n const coordinates = {\r\n top: span.offsetTop + parseInt(computed.borderTopWidth),\r\n left: span.offsetLeft + parseInt(computed.borderLeftWidth),\r\n height: parseInt(computed.lineHeight)\r\n };\r\n\r\n if (debug) {\r\n span.style.backgroundColor = \"#aaa\";\r\n } else {\r\n document.body.removeChild(div);\r\n }\r\n\r\n return coordinates;\r\n }\r\n}\r\n\r\nconst properties = [\r\n \"direction\", // RTL support\r\n \"boxSizing\",\r\n \"width\", // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\r\n \"height\",\r\n \"overflowX\",\r\n \"overflowY\", // copy the scrollbar for IE\r\n\r\n \"borderTopWidth\",\r\n \"borderRightWidth\",\r\n \"borderBottomWidth\",\r\n \"borderLeftWidth\",\r\n \"borderStyle\",\r\n\r\n \"paddingTop\",\r\n \"paddingRight\",\r\n \"paddingBottom\",\r\n \"paddingLeft\",\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\r\n \"fontStyle\",\r\n \"fontVariant\",\r\n \"fontWeight\",\r\n \"fontStretch\",\r\n \"fontSize\",\r\n \"fontSizeAdjust\",\r\n \"lineHeight\",\r\n \"fontFamily\",\r\n\r\n \"textAlign\",\r\n \"textTransform\",\r\n \"textIndent\",\r\n \"textDecoration\", // might not make a difference, but better be safe\r\n\r\n \"letterSpacing\",\r\n \"wordSpacing\",\r\n\r\n \"tabSize\",\r\n \"MozTabSize\"\r\n];\r\n\r\nconst isBrowser = typeof window !== \"undefined\";\r\nconst isFirefox = isBrowser && (window as any).mozInnerScreenX != null;\r\n", "export class JsExports {\r\n public static resolvedExports?: any;\r\n public static exportsPromise: Promise;\r\n\r\n public static get InputHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.InputHelper;\r\n }\r\n\r\n public static get DomHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.DomHelper;\r\n }\r\n\r\n public static get TimerHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.TimerHelper;\r\n }\r\n\r\n public static get CanvasHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.CanvasHelper;\r\n }\r\n}\r\nasync function resolveExports (): Promise {\r\n const runtimeApi = await globalThis.getDotnetRuntime(0);\r\n if (runtimeApi == null) { return; }\r\n JsExports.resolvedExports = await runtimeApi.getAssemblyExports(\"Avalonia.Browser.dll\");\r\n return JsExports.resolvedExports;\r\n}\r\n\r\nJsExports.exportsPromise = resolveExports();\r\n", "class InnerDbConnection {\r\n constructor(private readonly database: IDBDatabase) { }\r\n\r\n private openStore(store: string, mode: IDBTransactionMode): IDBObjectStore {\r\n const tx = this.database.transaction(store, mode);\r\n return tx.objectStore(store);\r\n }\r\n\r\n public async put(store: string, obj: any, key?: IDBValidKey): Promise {\r\n const os = this.openStore(store, \"readwrite\");\r\n\r\n return await new Promise((resolve, reject) => {\r\n const response = os.put(obj, key);\r\n response.onsuccess = () => {\r\n resolve(response.result);\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public get(store: string, key: IDBValidKey): any {\r\n const os = this.openStore(store, \"readonly\");\r\n\r\n return new Promise((resolve, reject) => {\r\n const response = os.get(key);\r\n response.onsuccess = () => {\r\n resolve(response.result);\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public async delete(store: string, key: IDBValidKey): Promise {\r\n const os = this.openStore(store, \"readwrite\");\r\n\r\n return await new Promise((resolve, reject) => {\r\n const response = os.delete(key);\r\n response.onsuccess = () => {\r\n resolve();\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public close() {\r\n this.database.close();\r\n }\r\n}\r\n\r\nclass IndexedDbWrapper {\r\n constructor(private readonly databaseName: string, private readonly objectStores: [string]) {\r\n }\r\n\r\n public async connect(): Promise {\r\n const conn = window.indexedDB.open(this.databaseName, 1);\r\n\r\n conn.onupgradeneeded = event => {\r\n const db = (event.target as IDBRequest).result;\r\n this.objectStores.forEach(store => {\r\n db.createObjectStore(store);\r\n });\r\n };\r\n\r\n return await new Promise((resolve, reject) => {\r\n conn.onsuccess = event => {\r\n resolve(new InnerDbConnection((event.target as IDBRequest).result));\r\n };\r\n conn.onerror = event => {\r\n reject((event.target as IDBRequest).error);\r\n };\r\n });\r\n }\r\n}\r\n\r\nexport const fileBookmarksStore: string = \"fileBookmarks\";\r\nexport const avaloniaDb = new IndexedDbWrapper(\"AvaloniaDb\", [\r\n fileBookmarksStore\r\n]);\r\n", "import { avaloniaDb, fileBookmarksStore } from \"./indexedDb\";\r\nimport { FileSystemFileHandle, FileSystemDirectoryHandle, FileSystemWritableFileStream } from \"native-file-system-adapter\";\r\nimport { Caniuse } from \"../avalonia\";\r\n\r\nexport class StorageItem {\r\n private constructor(\r\n public handle?: FileSystemFileHandle | FileSystemDirectoryHandle,\r\n private readonly file?: File,\r\n private readonly bookmarkId?: string,\r\n public wellKnownType?: WellKnownDirectory\r\n ) {\r\n }\r\n\r\n public get name(): string {\r\n if (this.handle) {\r\n return this.handle.name;\r\n }\r\n if (this.file) {\r\n return this.file.name;\r\n }\r\n return this.wellKnownType ?? \"\";\r\n }\r\n\r\n public get kind(): \"file\" | \"directory\" {\r\n if (this.handle) {\r\n return this.handle.kind;\r\n }\r\n if (this.file) {\r\n return \"file\";\r\n }\r\n return \"directory\";\r\n }\r\n\r\n public static createFromHandle(handle: FileSystemFileHandle | FileSystemDirectoryHandle, bookmarkId?: string) {\r\n return new StorageItem(handle, undefined, bookmarkId, undefined);\r\n }\r\n\r\n public static createFromFile(file: File) {\r\n return new StorageItem(undefined, file, undefined, undefined);\r\n }\r\n\r\n public static createWellKnownDirectory(type: WellKnownDirectory) {\r\n return new StorageItem(undefined, undefined, undefined, type);\r\n }\r\n\r\n public static async openRead(item: StorageItem): Promise {\r\n if (item.file) {\r\n return item.file;\r\n }\r\n\r\n if (!item.handle || item.kind !== \"file\") {\r\n throw new Error(\"StorageItem is not a file\");\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n const file = await (item.handle as FileSystemFileHandle).getFile();\r\n return file;\r\n }\r\n\r\n public static async openWrite(item: StorageItem): Promise {\r\n if (!item.handle || item.kind !== \"file\") {\r\n throw new Error(\"StorageItem is not a writeable file\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await (item.handle as FileSystemFileHandle).createWritable({ keepExistingData: true });\r\n }\r\n\r\n public static async getProperties(item: StorageItem): Promise<{ Size: number; LastModified: number; Type: string } | null> {\r\n // getFile can fail with an exception depending if we use polyfill with a save file dialog or not.\r\n try {\r\n const file = item.handle && \"getFile\" in item.handle\r\n ? await item.handle.getFile()\r\n : item.file;\r\n\r\n if (!file) {\r\n return null;\r\n }\r\n\r\n return {\r\n Size: file.size,\r\n LastModified: file.lastModified,\r\n Type: file.type\r\n };\r\n } catch {\r\n return null;\r\n }\r\n }\r\n\r\n public static getItemsIterator(item: StorageItem): any | null {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n return (item.handle as any).entries();\r\n }\r\n\r\n public static async createFile(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n throw new TypeError(\"Unable to create item in the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).getFileHandle(name, { create: true }) as Promise);\r\n }\r\n\r\n public static async getFile(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n return await ((item.handle as any).getFileHandle(name) as Promise);\r\n }\r\n\r\n public static async createFolder(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n throw new TypeError(\"Unable to create item in the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).getDirectoryHandle(name, { create: true }) as Promise);\r\n }\r\n\r\n public static async getFolder(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n return await ((item.handle as any).getDirectoryHandle(name) as Promise);\r\n }\r\n\r\n public static async deleteAsync(item: StorageItem): Promise {\r\n if (!item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).remove({ recursive: true }) as Promise);\r\n }\r\n\r\n public static async moveAsync(item: StorageItem, destination: StorageItem): Promise {\r\n if (!item.handle) {\r\n return null;\r\n }\r\n if (destination.kind !== \"directory\" || !destination.handle) {\r\n throw new TypeError(\"Unable to move item to the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).move(destination /*, newName */) as Promise);\r\n }\r\n\r\n private async verityPermissions(mode: \"read\" | \"readwrite\"): Promise {\r\n if (!this.handle) {\r\n return;\r\n }\r\n\r\n // If we are using polyfill, let it decide permissions by itself, we can't request anything in this case.\r\n if (!Caniuse.hasNativeFilePicker()) {\r\n return;\r\n }\r\n\r\n if (await this.handle.queryPermission({ mode }) === \"granted\") {\r\n return;\r\n }\r\n\r\n if (await this.handle.requestPermission({ mode }) === \"denied\") {\r\n throw new Error(\"Permissions denied\");\r\n }\r\n }\r\n\r\n public static async saveBookmark(item: StorageItem): Promise {\r\n // If file was previously bookmarked, just return old one.\r\n if (item.bookmarkId) {\r\n return item.bookmarkId;\r\n }\r\n\r\n // Bookmarks are not supported with polyfill.\r\n if (!item.handle || !Caniuse.hasNativeFilePicker()) {\r\n return null;\r\n }\r\n\r\n const connection = await avaloniaDb.connect();\r\n try {\r\n const key = await connection.put(fileBookmarksStore, item.handle, item.generateBookmarkId());\r\n return key as string;\r\n } finally {\r\n connection.close();\r\n }\r\n }\r\n\r\n public static async deleteBookmark(item: StorageItem): Promise {\r\n if (!item.bookmarkId || !Caniuse.hasNativeFilePicker()) {\r\n return;\r\n }\r\n\r\n const connection = await avaloniaDb.connect();\r\n try {\r\n await connection.delete(fileBookmarksStore, item.bookmarkId);\r\n } finally {\r\n connection.close();\r\n }\r\n }\r\n\r\n private generateBookmarkId(): string {\r\n return Date.now().toString(36) + Math.random().toString(36).substring(2);\r\n }\r\n}\r\n\r\nexport class StorageItems {\r\n constructor(private readonly items: StorageItem[]) { }\r\n\r\n public static itemsArray(instance: StorageItems): StorageItem[] {\r\n return instance.items;\r\n }\r\n\r\n public static filesToItemsArray(files: File[]): StorageItem[] {\r\n if (!files) {\r\n return [];\r\n }\r\n\r\n const retItems = [];\r\n for (let i = 0; i < files.length; i++) {\r\n retItems[i] = StorageItem.createFromFile(files[i]);\r\n }\r\n return retItems;\r\n }\r\n}\r\n", "import { CaretHelper } from \"./caretHelper\";\r\nimport { JsExports } from \"./jsExports\";\r\nimport { IMemoryView } from \"../../types/dotnet\";\r\nimport { StorageItem } from \"../storage/storageItem\";\r\n\r\nenum RawInputModifiers {\r\n None = 0,\r\n Alt = 1,\r\n Control = 2,\r\n Shift = 4,\r\n Meta = 8,\r\n\r\n LeftMouseButton = 16,\r\n RightMouseButton = 32,\r\n MiddleMouseButton = 64,\r\n XButton1MouseButton = 128,\r\n XButton2MouseButton = 256,\r\n KeyboardMask = Alt | Control | Shift | Meta,\r\n\r\n PenInverted = 512,\r\n PenEraser = 1024,\r\n PenBarrelButton = 2048\r\n}\r\n\r\n/*\r\n* This is a hack to handle older Firefox (before v127 from June 2024) clipboard events in a more convenient way for framework users.\r\n* In the browser, events go in order KeyDown -> Paste -> KeyUp.\r\n* On KeyDown we trigger Avalonia handlers, which might execute readClipboard.\r\n* When readClipboard was executed, we mark ClipboardState as Pending and setup clipboard promise,\r\n* which will un-handle KeyDown event, basically allowing browser to pass a Paste event properly.\r\n* On actual Paste event we execute promise callbacks, resuming async operation, and returning pasted text to the app.\r\n* Note #1, on every KeyUp event we will reset all the state and reject pending promises if any, as this event it expected to come after Paste.\r\n* Note #2, whole this code will be executed only on older browsers where clipboard.read/readText is not available.\r\n* Note #3, with all of these hacks Clipboard.ReadText will still work only on actual \"paste\" gesture initiated by user.\r\n* */\r\nenum ClipboardState {\r\n None,\r\n Ready,\r\n Pending\r\n}\r\n\r\ninterface WriteableClipboardItem {\r\n data: Record;\r\n}\r\n\r\ninterface WriteableClipboardSource {\r\n items: WriteableClipboardItem[];\r\n}\r\n\r\ntype ReadableDataItem = {\r\n type: \"clipboardItem\";\r\n value: ClipboardItem;\r\n} | {\r\n type: \"dataTransferItem\";\r\n value: DataTransferItem;\r\n} | {\r\n type: \"string\";\r\n value: string;\r\n};\r\n\r\ntype ReadableDataValue = {\r\n type: \"string\";\r\n value: string;\r\n} | {\r\n type: \"bytes\";\r\n value: Uint8Array;\r\n} | {\r\n type: \"file\";\r\n value: StorageItem;\r\n};\r\n\r\nexport class InputHelper {\r\n static clipboardState: ClipboardState = ClipboardState.None;\r\n static resolveClipboard?: (value: readonly ReadableDataItem[]) => void;\r\n static rejectClipboard?: (reason?: any) => void;\r\n\r\n public static initializeBackgroundHandlers() {\r\n if (this.clipboardState !== ClipboardState.None) {\r\n return;\r\n }\r\n\r\n globalThis.document.addEventListener(\"paste\", args => {\r\n if (this.clipboardState !== ClipboardState.Pending || !this.resolveClipboard) {\r\n return;\r\n }\r\n\r\n const items = this.getDataTransferItems(args.clipboardData);\r\n this.resolveClipboard(items.map((item) => ({ type: \"dataTransferItem\", value: item })));\r\n });\r\n this.clipboardState = ClipboardState.Ready;\r\n }\r\n\r\n private static getDataTransferItems(dataTransfer?: DataTransfer | null): DataTransferItem[] {\r\n const dataTransferList = dataTransfer?.items;\r\n return dataTransferList == null ? [] : Array.from(dataTransferList);\r\n }\r\n\r\n public static isClipboardFormatSupported(format: string): boolean {\r\n if (ClipboardItem.supports) {\r\n return ClipboardItem.supports(format);\r\n }\r\n\r\n return format === \"text/plain\" || format === \"text/html\" || format === \"image/png\";\r\n }\r\n\r\n public static createWriteableClipboardSource(): WriteableClipboardSource {\r\n return { items: [] };\r\n }\r\n\r\n public static createWriteableClipboardItem(source: WriteableClipboardSource): WriteableClipboardItem {\r\n const item = { data: {} };\r\n source.items.push(item);\r\n return item;\r\n }\r\n\r\n public static addStringToWriteableClipboardItem(item: WriteableClipboardItem, format: string, value: string) {\r\n item.data[format] = value;\r\n }\r\n\r\n public static addBytesToWriteableClipboardItem(item: WriteableClipboardItem, format: string, value: IMemoryView) {\r\n const bytes = value.slice(0, value.byteLength);\r\n item.data[format] = new Blob([bytes], { type: format });\r\n }\r\n\r\n public static async readClipboard(window: Window): Promise {\r\n const clipboard = window.navigator.clipboard;\r\n\r\n if (clipboard.read) {\r\n const clipboardItems = await clipboard.read();\r\n return clipboardItems.map((item) => ({ type: \"clipboardItem\", value: item }));\r\n } else if (clipboard.readText) {\r\n const item: ReadableDataItem = {\r\n type: \"string\",\r\n value: await clipboard.readText()\r\n };\r\n return [item];\r\n } else {\r\n try {\r\n return await new Promise((resolve, reject) => {\r\n this.clipboardState = ClipboardState.Pending;\r\n this.resolveClipboard = resolve;\r\n this.rejectClipboard = reject;\r\n });\r\n } finally {\r\n this.clipboardState = ClipboardState.Ready;\r\n this.resolveClipboard = undefined;\r\n this.rejectClipboard = undefined;\r\n }\r\n }\r\n }\r\n\r\n public static async writeClipboard(window: Window, source?: WriteableClipboardSource | null): Promise {\r\n const items = source?.items ?? [];\r\n if (items.length === 0) {\r\n await window.navigator.clipboard.writeText(\"\");\r\n return;\r\n }\r\n\r\n return window.navigator.clipboard.write\r\n ? await window.navigator.clipboard.write(items.map(item => new ClipboardItem(item.data)))\r\n : await this.writeFirstText(window, items);\r\n }\r\n\r\n private static async writeFirstText(window: Window, items: WriteableClipboardItem[]): Promise {\r\n for (const item of items) {\r\n for (const format in item.data) {\r\n if (!format.startsWith(\"text/\")) {\r\n continue;\r\n }\r\n\r\n let value = item.data[format];\r\n if (typeof value !== \"string\") {\r\n value = \"\";\r\n }\r\n\r\n await window.navigator.clipboard.writeText(value);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n public static getReadableDataItemFormats(item: ReadableDataItem): readonly string[] {\r\n /* eslint-disable indent */\r\n switch (item.type) {\r\n case \"clipboardItem\":\r\n return item.value.types;\r\n case \"dataTransferItem\":\r\n switch (item.value.kind) {\r\n case \"string\":\r\n return [item.value.type];\r\n case \"file\":\r\n return [\"Files\"];\r\n default:\r\n return [];\r\n }\r\n case \"string\":\r\n return [\"text/plain\"];\r\n default:\r\n return [];\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n // Asynchronous, used to read the clipboard.\r\n public static async tryGetReadableDataItemValueAsync(item: ReadableDataItem, format: string): Promise {\r\n const type = item.type;\r\n\r\n /* eslint-disable indent */\r\n switch (type) {\r\n case \"clipboardItem\": {\r\n const clipboardItem = item.value;\r\n if (!clipboardItem.types.includes(format)) {\r\n return null;\r\n }\r\n\r\n const blob = await clipboardItem.getType(format);\r\n\r\n return format.startsWith(\"text/\")\r\n ? { type: \"string\", value: await blob.text() }\r\n : { type: \"bytes\", value: await this.getBlobBytes(blob) };\r\n }\r\n\r\n case \"dataTransferItem\": {\r\n const dataTransferItem = item.value;\r\n\r\n switch (dataTransferItem.kind) {\r\n case \"string\": {\r\n if (format !== dataTransferItem.type) {\r\n return null;\r\n }\r\n\r\n const stringValue = await new Promise((resolve) => dataTransferItem.getAsString((str) => resolve(str)));\r\n return { type: \"string\", value: stringValue };\r\n }\r\n\r\n case \"file\": {\r\n if (format !== \"Files\") {\r\n return null;\r\n }\r\n\r\n const file = dataTransferItem.getAsFile();\r\n return file == null ? null : { type: \"file\", value: StorageItem.createFromFile(file) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n case \"string\": {\r\n return format.startsWith(\"text/\")\r\n ? { type: \"string\", value: item.value }\r\n : { type: \"bytes\", value: await this.getBlobBytes(new Blob([item.value])) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n // Synchronous, used only to read a drag-and-drop item.\r\n public static tryGetReadableDataItemValue(item: ReadableDataItem, format: string): ReadableDataValue | null {\r\n const type = item.type;\r\n\r\n if (type !== \"dataTransferItem\") {\r\n return null;\r\n }\r\n\r\n const dataTransferItem = item.value;\r\n\r\n /* eslint-disable indent */\r\n switch (dataTransferItem.kind) {\r\n case \"string\": {\r\n if (format !== dataTransferItem.type) {\r\n return null;\r\n }\r\n\r\n let stringValue = \"\";\r\n dataTransferItem.getAsString(function (str) { stringValue = str; });\r\n return { type: \"string\", value: stringValue };\r\n }\r\n\r\n case \"file\": {\r\n if (format !== \"Files\") {\r\n return null;\r\n }\r\n\r\n const file = dataTransferItem.getAsFile();\r\n return file == null ? null : { type: \"file\", value: StorageItem.createFromFile(file) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n private static async getBlobBytes(blob: Blob): Promise {\r\n return blob.bytes\r\n ? await blob.bytes()\r\n : new Uint8Array(await blob.arrayBuffer());\r\n }\r\n\r\n public static subscribeInputEvents(element: HTMLInputElement, topLevelId: number) {\r\n const keySub = this.subscribeKeyEvents(element, topLevelId);\r\n const pointerSub = this.subscribePointerEvents(element, topLevelId);\r\n const textSub = this.subscribeTextEvents(element, topLevelId);\r\n const dndSub = this.subscribeDropEvents(element, topLevelId);\r\n const paneSub = this.subscribeKeyboardGeometryChange(element, topLevelId);\r\n\r\n return () => {\r\n keySub();\r\n pointerSub();\r\n textSub();\r\n dndSub();\r\n paneSub();\r\n };\r\n }\r\n\r\n public static subscribeKeyEvents(element: HTMLInputElement, topLevelId: number) {\r\n const keyDownHandler = (args: KeyboardEvent) => {\r\n JsExports.InputHelper.OnKeyDown(topLevelId, args.code, args.key, this.getModifiers(args))\r\n .then((handled: boolean) => {\r\n if (!handled || this.clipboardState !== ClipboardState.Pending) {\r\n args.preventDefault();\r\n }\r\n });\r\n };\r\n element.addEventListener(\"keydown\", keyDownHandler);\r\n\r\n const keyUpHandler = (args: KeyboardEvent) => {\r\n JsExports.InputHelper.OnKeyUp(topLevelId, args.code, args.key, this.getModifiers(args))\r\n .then((handled: boolean) => {\r\n if (!handled) {\r\n args.preventDefault();\r\n }\r\n });\r\n\r\n if (this.rejectClipboard) {\r\n this.rejectClipboard();\r\n }\r\n };\r\n\r\n element.addEventListener(\"keyup\", keyUpHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"keydown\", keyDownHandler);\r\n element.removeEventListener(\"keyup\", keyUpHandler);\r\n };\r\n }\r\n\r\n public static subscribeTextEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number) {\r\n const compositionStartHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionStart(topLevelId);\r\n };\r\n element.addEventListener(\"compositionstart\", compositionStartHandler);\r\n\r\n const beforeInputHandler = (args: InputEvent) => {\r\n const ranges = args.getTargetRanges();\r\n let start = -1;\r\n let end = -1;\r\n if (ranges.length > 0) {\r\n start = ranges[0].startOffset;\r\n end = ranges[0].endOffset;\r\n }\r\n\r\n if (args.inputType === \"insertCompositionText\") {\r\n start = 2;\r\n end = start + 2;\r\n }\r\n\r\n JsExports.InputHelper.OnBeforeInput(topLevelId, args.inputType, start, end);\r\n };\r\n element.addEventListener(\"beforeinput\", beforeInputHandler);\r\n\r\n const compositionUpdateHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionUpdate(topLevelId, args.data);\r\n };\r\n element.addEventListener(\"compositionupdate\", compositionUpdateHandler);\r\n\r\n const compositionEndHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionEnd(topLevelId, args.data);\r\n args.preventDefault();\r\n };\r\n element.addEventListener(\"compositionend\", compositionEndHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"compositionstart\", compositionStartHandler);\r\n element.removeEventListener(\"compositionupdate\", compositionUpdateHandler);\r\n element.removeEventListener(\"compositionend\", compositionEndHandler);\r\n };\r\n }\r\n\r\n public static subscribePointerEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number\r\n ) {\r\n const pointerMoveHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerMove(\r\n topLevelId, args.pointerType, args.pointerId, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args), args);\r\n args.preventDefault();\r\n };\r\n\r\n const pointerDownHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerDown(\r\n topLevelId, args.pointerType, args.pointerId, args.button, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n const pointerUpHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerUp(\r\n topLevelId, args.pointerType, args.pointerId, args.button, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n const pointerCancelHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerCancel(\r\n topLevelId, args.pointerType, args.pointerId, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n };\r\n\r\n const wheelHandler = (args: WheelEvent) => {\r\n JsExports.InputHelper.OnWheel(\r\n topLevelId, args.offsetX, args.offsetY, args.deltaX, args.deltaY, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n element.addEventListener(\"pointermove\", pointerMoveHandler);\r\n element.addEventListener(\"pointerdown\", pointerDownHandler);\r\n element.addEventListener(\"pointerup\", pointerUpHandler);\r\n element.addEventListener(\"wheel\", wheelHandler);\r\n element.addEventListener(\"pointercancel\", pointerCancelHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"pointerover\", pointerMoveHandler);\r\n element.removeEventListener(\"pointerdown\", pointerDownHandler);\r\n element.removeEventListener(\"pointerup\", pointerUpHandler);\r\n element.removeEventListener(\"pointercancel\", pointerCancelHandler);\r\n element.removeEventListener(\"wheel\", wheelHandler);\r\n };\r\n }\r\n\r\n public static subscribeDropEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number\r\n ) {\r\n const handler = (args: DragEvent) => {\r\n const dataTransfer = args.dataTransfer;\r\n if (dataTransfer == null) {\r\n return;\r\n }\r\n\r\n const items: ReadableDataItem[] =\r\n this.getDataTransferItems(dataTransfer).map((item) => ({ type: \"dataTransferItem\", value: item }));\r\n\r\n JsExports.InputHelper.OnDragDrop(topLevelId, args.type, args.offsetX, args.offsetY, this.getModifiers(args), dataTransfer, items);\r\n };\r\n const overAndDropHandler = (args: DragEvent) => {\r\n args.preventDefault();\r\n handler(args);\r\n };\r\n element.addEventListener(\"dragover\", overAndDropHandler);\r\n element.addEventListener(\"dragenter\", handler);\r\n element.addEventListener(\"dragleave\", handler);\r\n element.addEventListener(\"drop\", overAndDropHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"dragover\", overAndDropHandler);\r\n element.removeEventListener(\"dragenter\", handler);\r\n element.removeEventListener(\"dragleave\", handler);\r\n element.removeEventListener(\"drop\", overAndDropHandler);\r\n };\r\n }\r\n\r\n public static getCoalescedEvents(pointerEvent: PointerEvent): number[] {\r\n return pointerEvent.getCoalescedEvents()\r\n .flatMap(e => [e.offsetX, e.offsetY, e.pressure, e.tiltX, e.tiltY, e.twist]);\r\n }\r\n\r\n public static subscribeKeyboardGeometryChange(\r\n element: HTMLInputElement,\r\n topLevelId: number) {\r\n if (\"virtualKeyboard\" in navigator) {\r\n // (navigator as any).virtualKeyboard.overlaysContent = true;\r\n const listener = (event: any) => {\r\n const elementRect = element.getBoundingClientRect();\r\n const keyboardRect = event.target.boundingRect as DOMRect;\r\n\r\n JsExports.InputHelper.OnKeyboardGeometryChange(\r\n topLevelId,\r\n keyboardRect.x - elementRect.x,\r\n keyboardRect.y - elementRect.y,\r\n keyboardRect.width,\r\n keyboardRect.height);\r\n };\r\n (navigator as any).virtualKeyboard.addEventListener(\"geometrychange\", listener);\r\n return () => {\r\n (navigator as any).virtualKeyboard.removeEventListener(\"geometrychange\", listener);\r\n };\r\n }\r\n\r\n return () => {};\r\n }\r\n\r\n public static clearInput(inputElement: HTMLInputElement) {\r\n inputElement.value = \"\";\r\n }\r\n\r\n public static focusElement(inputElement: HTMLElement) {\r\n inputElement.focus();\r\n }\r\n\r\n public static setCursor(inputElement: HTMLInputElement, kind: string) {\r\n if (kind === \"default\") {\r\n inputElement.style.removeProperty(\"cursor\");\r\n } else {\r\n inputElement.style.cursor = kind;\r\n }\r\n }\r\n\r\n public static setBounds(inputElement: HTMLInputElement, x: number, y: number, caretWidth: number, caretHeight: number, caret: number) {\r\n inputElement.style.left = (x).toFixed(0) + \"px\";\r\n inputElement.style.top = (y).toFixed(0) + \"px\";\r\n\r\n const { left, top } = CaretHelper.getCaretCoordinates(inputElement, caret);\r\n\r\n inputElement.style.left = (x - left).toFixed(0) + \"px\";\r\n inputElement.style.top = (y - top).toFixed(0) + \"px\";\r\n }\r\n\r\n public static hide(inputElement: HTMLInputElement) {\r\n inputElement.style.display = \"none\";\r\n }\r\n\r\n public static show(inputElement: HTMLInputElement) {\r\n inputElement.style.display = \"block\";\r\n }\r\n\r\n public static setSurroundingText(inputElement: HTMLInputElement, text: string, start: number, end: number) {\r\n if (!inputElement) {\r\n return;\r\n }\r\n\r\n inputElement.value = text;\r\n inputElement.setSelectionRange(start, end);\r\n inputElement.style.width = \"20px\";\r\n inputElement.style.width = `${inputElement.scrollWidth}px`;\r\n }\r\n\r\n private static getModifiers(args: KeyboardEvent | PointerEvent | WheelEvent | DragEvent): number {\r\n let modifiers = RawInputModifiers.None;\r\n\r\n if (args.ctrlKey) { modifiers |= RawInputModifiers.Control; }\r\n if (args.altKey) { modifiers |= RawInputModifiers.Alt; }\r\n if (args.shiftKey) { modifiers |= RawInputModifiers.Shift; }\r\n if (args.metaKey) { modifiers |= RawInputModifiers.Meta; }\r\n\r\n const buttons = (args as PointerEvent).buttons;\r\n if (buttons) {\r\n if (buttons & 1) { modifiers |= RawInputModifiers.LeftMouseButton; }\r\n if (buttons & 2) { modifiers |= (args.type === \"pen\" ? RawInputModifiers.PenBarrelButton : RawInputModifiers.RightMouseButton); }\r\n if (buttons & 4) { modifiers |= RawInputModifiers.MiddleMouseButton; }\r\n if (buttons & 8) { modifiers |= RawInputModifiers.XButton1MouseButton; }\r\n if (buttons & 16) { modifiers |= RawInputModifiers.XButton2MouseButton; }\r\n if (buttons & 32) { modifiers |= RawInputModifiers.PenEraser; }\r\n }\r\n\r\n return modifiers;\r\n }\r\n\r\n public static setPointerCapture(containerElement: HTMLInputElement, pointerId: number): void {\r\n containerElement.setPointerCapture(pointerId);\r\n }\r\n\r\n public static releasePointerCapture(containerElement: HTMLInputElement, pointerId: number): void {\r\n if (containerElement.hasPointerCapture(pointerId)) {\r\n containerElement.releasePointerCapture(pointerId);\r\n }\r\n }\r\n}\r\n", "import { JsExports } from \"./jsExports\";\r\n\r\nexport class AvaloniaDOM {\r\n public static getGlobalThis() {\r\n return globalThis;\r\n }\r\n\r\n public static addClass(element: HTMLElement, className: string): void {\r\n element.classList.add(className);\r\n }\r\n\r\n static getFirstElementById(className: string, parent: HTMLElement | Window): Element | null {\r\n const parentNode = parent instanceof Window\r\n ? parent.document\r\n : parent.ownerDocument;\r\n\r\n return parentNode.getElementById(className);\r\n }\r\n\r\n static getFirstElementByClassName(className: string, parent: HTMLElement | Window): Element | null {\r\n const parentNode = parent instanceof Window\r\n ? parent.document\r\n : parent;\r\n\r\n const elements = parentNode.getElementsByClassName(className);\r\n return elements ? elements[0] : null;\r\n }\r\n\r\n static createAvaloniaCanvas(host: HTMLElement): HTMLCanvasElement {\r\n const containerId = host.getAttribute(\"data-containerId\") ?? \"0000\";\r\n\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.id = `canvas${containerId}`;\r\n canvas.classList.add(\"avalonia-canvas\");\r\n canvas.style.width = \"100%\";\r\n canvas.style.height = \"100%\";\r\n canvas.style.position = \"absolute\";\r\n\r\n return canvas;\r\n }\r\n\r\n static attachCanvas(host: HTMLElement, canvas: HTMLCanvasElement): void {\r\n host.prepend(canvas);\r\n }\r\n\r\n static detachCanvas(host: HTMLElement, canvas: HTMLCanvasElement): void {\r\n host.removeChild(canvas);\r\n }\r\n\r\n static createAvaloniaHost(host: HTMLElement) {\r\n const containerId = Math.random().toString(36).replace(/[^a-z]+/g, \"\").substr(2, 10);\r\n\r\n // Root element\r\n host.classList.add(\"avalonia-container\");\r\n host.tabIndex = 0;\r\n host.setAttribute(\"data-containerId\", containerId);\r\n host.oncontextmenu = function () { return false; };\r\n host.style.overflow = \"hidden\";\r\n host.style.touchAction = \"none\";\r\n\r\n // Canvas is lazily created depending on the rendering mode. See createAvaloniaCanvas usage.\r\n\r\n // Native controls host\r\n const nativeHost = document.createElement(\"div\");\r\n nativeHost.id = `nativeHost${containerId}`;\r\n nativeHost.classList.add(\"avalonia-native-host\");\r\n nativeHost.style.left = \"0px\";\r\n nativeHost.style.top = \"0px\";\r\n nativeHost.style.width = \"100%\";\r\n nativeHost.style.height = \"100%\";\r\n nativeHost.style.position = \"absolute\";\r\n\r\n // IME\r\n const inputElement = document.createElement(\"input\");\r\n inputElement.id = `inputElement${containerId}`;\r\n inputElement.classList.add(\"avalonia-input-element\");\r\n inputElement.autocapitalize = \"none\";\r\n inputElement.type = \"text\";\r\n inputElement.spellcheck = false;\r\n inputElement.style.padding = \"0\";\r\n inputElement.style.margin = \"0\";\r\n inputElement.style.borderWidth = \"0\";\r\n inputElement.style.position = \"absolute\";\r\n inputElement.style.overflow = \"hidden\";\r\n inputElement.style.borderStyle = \"hidden\";\r\n inputElement.style.outline = \"none\";\r\n inputElement.style.background = \"transparent\";\r\n inputElement.style.color = \"transparent\";\r\n inputElement.style.display = \"none\";\r\n inputElement.style.height = \"20px\";\r\n inputElement.style.zIndex = \"-1\";\r\n inputElement.onpaste = function () { return false; };\r\n inputElement.oncopy = function () { return false; };\r\n inputElement.oncut = function () { return false; };\r\n\r\n host.prepend(inputElement);\r\n host.prepend(nativeHost);\r\n\r\n return {\r\n host,\r\n nativeHost,\r\n inputElement\r\n };\r\n }\r\n\r\n public static isFullscreen(globalThis: Window): boolean {\r\n return globalThis.document.fullscreenElement != null;\r\n }\r\n\r\n public static async setFullscreen(globalThis: Window, isFullscreen: boolean) {\r\n if (isFullscreen) {\r\n const doc = globalThis.document.documentElement;\r\n await doc.requestFullscreen();\r\n } else {\r\n await globalThis.document.exitFullscreen();\r\n }\r\n }\r\n\r\n public static initGlobalDomEvents(globalThis: Window): void {\r\n // Init Safe Area properties.\r\n globalThis.document.documentElement.style.setProperty(\"--av-sat\", \"env(safe-area-inset-top)\");\r\n globalThis.document.documentElement.style.setProperty(\"--av-sar\", \"env(safe-area-inset-right)\");\r\n globalThis.document.documentElement.style.setProperty(\"--av-sab\", \"env(safe-area-inset-bottom)\");\r\n globalThis.document.documentElement.style.setProperty(\"--av-sal\", \"env(safe-area-inset-left)\");\r\n\r\n // Subscribe on DarkMode changes.\r\n if (globalThis.matchMedia !== undefined) {\r\n const colorSchemeMedia = globalThis.matchMedia(\"(prefers-color-scheme: dark)\");\r\n const prefersContrastMedia = globalThis.matchMedia(\"(prefers-contrast: more)\");\r\n\r\n colorSchemeMedia.addEventListener(\"change\", (args: MediaQueryListEvent) => {\r\n JsExports.DomHelper.DarkModeChanged(args.matches, prefersContrastMedia.matches);\r\n });\r\n prefersContrastMedia.addEventListener(\"change\", (args: MediaQueryListEvent) => {\r\n JsExports.DomHelper.DarkModeChanged(colorSchemeMedia.matches, args.matches);\r\n });\r\n }\r\n\r\n globalThis.document.addEventListener(\"visibilitychange\", () => {\r\n JsExports.DomHelper.DocumentVisibilityChanged(globalThis.document.visibilityState);\r\n });\r\n\r\n // Report initial value.\r\n if (globalThis.document.visibilityState === \"visible\") {\r\n globalThis.setTimeout(() => {\r\n JsExports.DomHelper.DocumentVisibilityChanged(globalThis.document.visibilityState);\r\n }, 10);\r\n }\r\n }\r\n\r\n public static getSafeAreaPadding(globalThis: Window): number[] {\r\n const top = parseFloat(getComputedStyle(globalThis.document.documentElement).getPropertyValue(\"--av-sat\"));\r\n const bottom = parseFloat(getComputedStyle(globalThis.document.documentElement).getPropertyValue(\"--av-sab\"));\r\n const left = parseFloat(getComputedStyle(globalThis.document.documentElement).getPropertyValue(\"--av-sal\"));\r\n const right = parseFloat(getComputedStyle(globalThis.document.documentElement).getPropertyValue(\"--av-sar\"));\r\n\r\n return [left, top, bottom, right];\r\n }\r\n\r\n public static getDarkMode(globalThis: Window): number[] {\r\n if (globalThis.matchMedia === undefined) return [0, 0];\r\n\r\n const colorSchemeMedia = globalThis.matchMedia(\"(prefers-color-scheme: dark)\");\r\n const prefersContrastMedia = globalThis.matchMedia(\"(prefers-contrast: more)\");\r\n return [\r\n colorSchemeMedia.matches ? 1 : 0,\r\n prefersContrastMedia.matches ? 1 : 0\r\n ];\r\n }\r\n}\r\n", "export class Caniuse {\r\n public static hasNativeFilePicker(): boolean {\r\n return \"showSaveFilePicker\" in globalThis;\r\n }\r\n\r\n public static isMobile(): boolean {\r\n const userAgentData = (globalThis.navigator as any)?.userAgentData;\r\n if (userAgentData) {\r\n return userAgentData.mobile;\r\n }\r\n\r\n const userAgent = navigator.userAgent;\r\n const regex1 = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i;\r\n const regex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i;\r\n return regex1.test(userAgent) || regex2.test(userAgent.substr(0, 4));\r\n }\r\n\r\n public static isTv(): boolean {\r\n return navigator.userAgent.includes(\"SmartTV\");\r\n }\r\n}\r\n", "import FileSystemWritableFileStream from \"native-file-system-adapter/types/src/FileSystemWritableFileStream\";\r\n\r\nconst sharedArrayBufferDefined = typeof SharedArrayBuffer !== \"undefined\";\r\nexport function isSharedArrayBuffer(buffer: any): buffer is SharedArrayBuffer {\r\n // BEWARE: In some cases, `instanceof SharedArrayBuffer` returns false even though buffer is an SAB.\r\n // Patch adapted from https://github.com/emscripten-core/emscripten/pull/16994\r\n // See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag\r\n return sharedArrayBufferDefined && buffer[Symbol.toStringTag] === \"SharedArrayBuffer\";\r\n}\r\n\r\nexport class StreamHelper {\r\n public static async seek(stream: FileSystemWritableFileStream, position: number) {\r\n return await stream.seek(position);\r\n }\r\n\r\n public static async truncate(stream: FileSystemWritableFileStream, size: number) {\r\n return await stream.truncate(size);\r\n }\r\n\r\n public static async close(stream: FileSystemWritableFileStream) {\r\n return await stream.close();\r\n }\r\n\r\n public static async write(stream: FileSystemWritableFileStream, span: any, offset: number, count: number) {\r\n const heap8 = globalThis.getDotnetRuntime(0)?.localHeapViewU8();\r\n\r\n let buffer: Uint8Array;\r\n if (span._pointer > 0 && span._length > 0 && heap8 && !isSharedArrayBuffer(heap8.buffer)) {\r\n // Attempt to use undocumented access to the HEAP8 directly\r\n // Note, SharedArrayBuffer cannot be used with ImageData (when WasmEnableThreads = true).\r\n buffer = new Uint8Array(heap8.buffer, span._pointer as number + offset, count);\r\n } else {\r\n // Or fallback to the normal API that does multiple array copies.\r\n const copy = new Uint8Array(count);\r\n span.copyTo(copy, offset);\r\n buffer = span;\r\n }\r\n\r\n return await stream.write(buffer);\r\n }\r\n\r\n public static byteLength(stream: Blob) {\r\n return stream.size;\r\n }\r\n\r\n public static async sliceArrayBuffer(stream: Blob, offset: number, count: number) {\r\n const buffer = await stream.slice(offset, offset + count).arrayBuffer();\r\n return new Uint8Array(buffer);\r\n }\r\n\r\n public static toMemoryView(buffer: Uint8Array): Uint8Array {\r\n return buffer;\r\n }\r\n}\r\n", "class NativeControlHostTopLevelAttachment {\r\n _child?: HTMLElement;\r\n _host?: HTMLElement;\r\n}\r\n\r\nexport class NativeControlHost {\r\n public static createDefaultChild(parent?: HTMLElement): HTMLElement {\r\n return document.createElement(\"div\");\r\n }\r\n\r\n public static createAttachment(): NativeControlHostTopLevelAttachment {\r\n return new NativeControlHostTopLevelAttachment();\r\n }\r\n\r\n public static initializeWithChildHandle(element: NativeControlHostTopLevelAttachment, child: HTMLElement): void {\r\n element._child = child;\r\n element._child.style.position = \"absolute\";\r\n }\r\n\r\n public static attachTo(element: NativeControlHostTopLevelAttachment, host?: HTMLElement): void {\r\n if (element._host && element._child) {\r\n element._host.removeChild(element._child);\r\n }\r\n\r\n element._host = host;\r\n\r\n if (element._host && element._child) {\r\n element._host.appendChild(element._child);\r\n }\r\n }\r\n\r\n public static showInBounds(element: NativeControlHostTopLevelAttachment, x: number, y: number, width: number, height: number): void {\r\n if (element._child) {\r\n element._child.style.top = `${y}px`;\r\n element._child.style.left = `${x}px`;\r\n element._child.style.width = `${width}px`;\r\n element._child.style.height = `${height}px`;\r\n element._child.style.display = \"block\";\r\n }\r\n }\r\n\r\n public static hideWithSize(element: NativeControlHostTopLevelAttachment, width: number, height: number): void {\r\n if (element._child) {\r\n element._child.style.width = `${width}px`;\r\n element._child.style.height = `${height}px`;\r\n element._child.style.display = \"none\";\r\n }\r\n }\r\n\r\n public static releaseChild(element: NativeControlHostTopLevelAttachment): void {\r\n if (element._child) {\r\n element._child = undefined;\r\n }\r\n }\r\n}\r\n", "export class NavigationHelper {\r\n public static addBackHandler(backHandlerCallback: () => Boolean) {\r\n history.pushState(null, \"\", window.location.href);\r\n window.onpopstate = () => {\r\n const handled = backHandlerCallback();\r\n\r\n if (!handled) {\r\n history.back();\r\n } else {\r\n history.forward();\r\n }\r\n };\r\n }\r\n\r\n public static openUri(uri?: string, target?: string) {\r\n return !!window.open(uri, target);\r\n }\r\n}\r\n", "export class GeneralHelpers {\r\n public static itemsArrayAt(instance: any, key: any): any[] {\r\n const items = instance[key];\r\n if (!items) {\r\n return [];\r\n }\r\n\r\n const retItems = [];\r\n for (let i = 0; i < items.length; i++) {\r\n retItems[i] = items[i];\r\n }\r\n return retItems;\r\n }\r\n\r\n public static itemAt(instance: any, key: any): any {\r\n const item = instance[key];\r\n return item;\r\n }\r\n\r\n public static callMethod(instance: any, name: string /*, args */): any {\r\n const args = Array.prototype.slice.call(arguments, 2);\r\n return instance[name].apply(instance, args);\r\n }\r\n}\r\n", "import { JsExports } from \"./jsExports\";\r\n\r\nexport class TimerHelper {\r\n public static runAnimationFrames(): void {\r\n function render(time: number) {\r\n JsExports.TimerHelper?.JsExportOnAnimationFrame();\r\n self.requestAnimationFrame(render);\r\n }\r\n self.requestAnimationFrame(render);\r\n }\r\n\r\n static onTimeout() {\r\n JsExports.TimerHelper?.JsExportOnTimeout();\r\n }\r\n\r\n static onInterval() {\r\n JsExports.TimerHelper?.JsExportOnInterval();\r\n }\r\n\r\n public static setTimeout(interval: number): number {\r\n return setTimeout(TimerHelper.onTimeout, interval);\r\n }\r\n\r\n public static setInterval(interval: number): number {\r\n return setInterval(TimerHelper.onInterval, interval);\r\n }\r\n}\r\n", "type ResizeObserverWithCallbacks = {\r\n callbacks: Map void)>;\r\n} & ResizeObserver;\r\n\r\nexport class ResizeHandler {\r\n private static resizeObserver?: ResizeObserverWithCallbacks;\r\n\r\n public static observeSize(element: HTMLElement, callback: (width: number, height: number, dpr: number) => void) : (() => void) {\r\n if (!this.resizeObserver) {\r\n this.resizeObserver = new ResizeObserver(this.onResize) as ResizeObserverWithCallbacks;\r\n this.resizeObserver.callbacks = new Map void)>();\r\n }\r\n\r\n this.resizeObserver.callbacks.set(element, callback);\r\n this.resizeObserver.observe(element, { box: \"content-box\" });\r\n\r\n return () => {\r\n this.resizeObserver?.callbacks.delete(element);\r\n this.resizeObserver?.unobserve(element);\r\n };\r\n }\r\n\r\n private static onResize(entries: ResizeObserverEntry[], observer: ResizeObserver) {\r\n for (const entry of entries) {\r\n const callback = (observer as ResizeObserverWithCallbacks).callbacks.get(entry.target);\r\n if (!callback) {\r\n continue;\r\n }\r\n\r\n const trueDpr = window.devicePixelRatio;\r\n let width;\r\n let height;\r\n let dpr = trueDpr;\r\n if (entry.devicePixelContentBoxSize) {\r\n // NOTE: Only this path gives the correct answer\r\n // The other paths are imperfect fallbacks\r\n // for browsers that don't provide anyway to do this\r\n width = entry.devicePixelContentBoxSize[0].inlineSize;\r\n height = entry.devicePixelContentBoxSize[0].blockSize;\r\n dpr = 1; // it's already in width and height\r\n } else if (entry.contentBoxSize) {\r\n if (entry.contentBoxSize[0]) {\r\n width = entry.contentBoxSize[0].inlineSize;\r\n height = entry.contentBoxSize[0].blockSize;\r\n } else {\r\n width = (entry.contentBoxSize as any).inlineSize;\r\n height = (entry.contentBoxSize as any).blockSize;\r\n }\r\n } else {\r\n width = entry.contentRect.width;\r\n height = entry.contentRect.height;\r\n }\r\n const displayWidth = Math.round(width * dpr);\r\n const displayHeight = Math.round(height * dpr);\r\n callback(displayWidth, displayHeight, trueDpr);\r\n }\r\n }\r\n}\r\n", "export class WebRenderTarget {\r\n renderTargetType: string;\r\n constructor(protected canvas: HTMLCanvasElement | OffscreenCanvas, type: string) {\r\n this.renderTargetType = type;\r\n }\r\n\r\n static setSize(target: WebRenderTarget, w: number, h: number) {\r\n target.canvas.width = w;\r\n target.canvas.height = h;\r\n }\r\n}\r\n", "import { BrowserRenderingMode } from \"./renderingMode\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\ninterface EmscriptenGlContext {\r\n handle: number;\r\n}\r\n\r\ninterface EmscriptenGL {\r\n registerContext: (ctx: WebGLRenderingContext, attrs: WebGLContextAttributes) => number;\r\n currentContext?: EmscriptenGlContext;\r\n makeContextCurrent: (handle: number) => boolean;\r\n}\r\n\r\nfunction getGL(): EmscriptenGL {\r\n const self = globalThis as any;\r\n const module = self.Module ?? self.getDotnetRuntime(0)?.Module;\r\n return (module?.GL ?? self.AvaloniaGL ?? self.SkiaSharpGL) as EmscriptenGL;\r\n}\r\n\r\nexport class WebGlRenderTarget extends WebRenderTarget {\r\n public contextHandle?: number;\r\n public attrs: WebGLContextAttributes;\r\n public fboId?: number;\r\n public stencil?: number;\r\n public sample?: number;\r\n public depth?: number;\r\n private static _gl: EmscriptenGL | null = null;\r\n\r\n constructor(public canvas: HTMLCanvasElement | OffscreenCanvas, mode: BrowserRenderingMode) {\r\n // Skia only understands WebGL context wrapped in Emscripten.\r\n if (WebGlRenderTarget._gl == null) { WebGlRenderTarget._gl = getGL(); }\r\n if (!WebGlRenderTarget._gl) {\r\n throw new Error(\"Module.GL object wasn't initialized, WebGL can't be used.\");\r\n }\r\n\r\n const attrs: WebGLContextAttributes | any =\r\n {\r\n alpha: true,\r\n depth: true,\r\n stencil: true,\r\n antialias: false,\r\n premultipliedAlpha: true,\r\n preserveDrawingBuffer: false,\r\n // only supported on older browsers, which is perfect as we want to fallback to 2d there.\r\n failIfMajorPerformanceCaveat: true,\r\n // attrs used by Emscripten:\r\n majorVersion: mode === BrowserRenderingMode.WebGL1 ? 1 : 2,\r\n minorVersion: 0,\r\n enableExtensionsByDefault: 1,\r\n explicitSwapControl: 0\r\n };\r\n\r\n const context = (mode === BrowserRenderingMode.WebGL1\r\n ? canvas.getContext(\"webgl\", attrs)\r\n : canvas.getContext(\"webgl2\", attrs)) as WebGLRenderingContext;\r\n if (!context) {\r\n throw new Error(\"HTMLCanvasElement.getContext returned null.\");\r\n }\r\n\r\n const handle = WebGlRenderTarget._gl.registerContext(context, attrs);\r\n (context as any).gl_handle = handle;\r\n super(canvas, \"webgl\");\r\n\r\n this.contextHandle = handle;\r\n this.fboId = context.getParameter(context.FRAMEBUFFER_BINDING)?.id ?? 0;\r\n this.stencil = context.getParameter(context.STENCIL_BITS);\r\n this.sample = context.getParameter(context.SAMPLES);\r\n this.depth = context.getParameter(context.DEPTH_BITS);\r\n this.attrs = attrs;\r\n }\r\n\r\n public static getCurrentContext(): number {\r\n return WebGlRenderTarget._gl?.currentContext?.handle ?? 0;\r\n }\r\n\r\n public static makeContextCurrent(handle: number): boolean {\r\n if (WebGlRenderTarget._gl == null) { return false; }\r\n const ret = WebGlRenderTarget._gl.makeContextCurrent(handle);\r\n return handle === 0 || ret;\r\n }\r\n}\r\n", "import { RuntimeAPI } from \"../../../types/dotnet\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\n\r\nexport class SoftwareRenderTarget extends WebRenderTarget {\r\n private readonly runtime: RuntimeAPI | undefined;\r\n private readonly context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\r\n constructor(canvas: HTMLCanvasElement | OffscreenCanvas) {\r\n const context = canvas.getContext(\"2d\", {\r\n alpha: true\r\n });\r\n if (!context) {\r\n throw new Error(\"HTMLCanvasElement.getContext(2d) returned null.\");\r\n }\r\n\r\n super(canvas, \"software\");\r\n this.context = context;\r\n\r\n this.runtime = globalThis.getDotnetRuntime(0);\r\n }\r\n\r\n public putPixelData(pointer: number, length: number, width: number, height: number): void {\r\n const heap8 = this.runtime?.localHeapViewU8();\r\n\r\n let clampedBuffer: Uint8ClampedArray;\r\n if (heap8?.buffer) {\r\n clampedBuffer = new Uint8ClampedArray(heap8.buffer, pointer, length);\r\n\r\n // Need to make a copy if using MT, ImageData can't consume shared arrays\r\n if (this.canvas instanceof OffscreenCanvas) {\r\n const dstArrayBuffer = new ArrayBuffer(clampedBuffer.byteLength);\r\n const copy = new Uint8ClampedArray(dstArrayBuffer);\r\n copy.set(clampedBuffer);\r\n clampedBuffer = copy;\r\n }\r\n } else throw new Error(\"Unable to access .NET memory\");\r\n\r\n const imageData = new ImageData(clampedBuffer, width, height);\r\n (this.context).putImageData(imageData, 0, 0);\r\n }\r\n\r\n public static staticPutPixelData(target: SoftwareRenderTarget, pointer: number, length: number, width: number, height: number): void {\r\n target.putPixelData(pointer, length, width, height);\r\n }\r\n}\r\n", "import { BrowserRenderingMode } from \"./renderingMode\";\r\nimport { WebGlRenderTarget } from \"./webGlRenderTarget\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\nimport { SoftwareRenderTarget } from \"./softwareRenderTarget\";\r\n\r\nexport class WebRenderTargetRegistry {\r\n private static targets: { [id: number]: (WebRenderTarget) } = {};\r\n private static registry: { [id: number]: ({\r\n canvas: HTMLCanvasElement;\r\n worker?: Worker;\r\n }); } = {};\r\n\r\n private static nextId = 1;\r\n\r\n static create(pthreadId: number, canvas: HTMLCanvasElement, preferredModes: BrowserRenderingMode[]): number {\r\n const id = WebRenderTargetRegistry.nextId++;\r\n if (pthreadId === 0) {\r\n WebRenderTargetRegistry.registry[id] = {\r\n canvas\r\n };\r\n WebRenderTargetRegistry.targets[id] = WebRenderTargetRegistry.createRenderTarget(canvas, preferredModes);\r\n } else {\r\n const self = globalThis as any;\r\n const module = self.Module ?? self.getDotnetRuntime(0)?.Module;\r\n const pthreads = module?.PThread;\r\n if (pthreads == null) { throw new Error(\"Unable to access emscripten PThread api\"); }\r\n const pthread = pthreads.pthreads[pthreadId];\r\n if (pthread == null) { throw new Error(`Unable get pthread with id ${pthreadId}`); }\r\n let worker: Worker | undefined;\r\n if (pthread.postMessage != null) { worker = pthread as Worker; } else { worker = pthread.worker; }\r\n\r\n if (worker == null) { throw new Error(`Unable get Worker for pthread ${pthreadId}`); }\r\n const offscreen = canvas.transferControlToOffscreen();\r\n worker.postMessage({\r\n avaloniaCmd: \"registerCanvas\",\r\n canvas: offscreen,\r\n modes: preferredModes,\r\n id\r\n }, [offscreen]);\r\n WebRenderTargetRegistry.registry[id] = {\r\n canvas,\r\n worker\r\n };\r\n }\r\n return id;\r\n }\r\n\r\n static initializeWorker() {\r\n const oldHandler = self.onmessage;\r\n self.onmessage = ev => {\r\n const msg = ev;\r\n if (msg.data.avaloniaCmd === \"registerCanvas\") {\r\n WebRenderTargetRegistry.targets[msg.data.id] = WebRenderTargetRegistry.createRenderTarget(msg.data.canvas, msg.data.modes);\r\n } else if (msg.data.avaloniaCmd === \"unregisterCanvas\") {\r\n /* eslint-disable */\r\n // Our keys are _always_ numbers and are safe to delete\r\n delete WebRenderTargetRegistry.targets[msg.data.id];\r\n /* eslint-enable */\r\n } else if (oldHandler != null) { oldHandler.call(self, ev); }\r\n };\r\n }\r\n\r\n static getRenderTarget(id: number): WebRenderTarget | undefined {\r\n return WebRenderTargetRegistry.targets[id];\r\n }\r\n\r\n private static createRenderTarget(canvas: HTMLCanvasElement | OffscreenCanvas, modes: BrowserRenderingMode[]): WebRenderTarget {\r\n for (const mode of modes) {\r\n try {\r\n if (mode === BrowserRenderingMode.Software2D) { return new SoftwareRenderTarget(canvas); }\r\n return new WebGlRenderTarget(canvas, mode);\r\n } catch (e) {\r\n let message = \"\";\r\n if (e instanceof Error) { message = \": \" + e.message; }\r\n console.error(`Failed to create render target for mode ${mode} ${message}`);\r\n }\r\n }\r\n // Still try software as a fallback\r\n return new SoftwareRenderTarget(canvas);\r\n }\r\n}\r\n", "import { ResizeHandler } from \"./resizeHandler\";\r\nimport { WebRenderTargetRegistry } from \"./webRenderTargetRegistry\";\r\nimport { AvaloniaDOM } from \"../dom\";\r\nimport { BrowserRenderingMode } from \"./renderingMode\";\r\nimport { JsExports } from \"../jsExports\";\r\n\r\nexport class CanvasSurface {\r\n public targetId: number;\r\n private sizeParams?: [number, number, number];\r\n\r\n constructor(public canvas: HTMLCanvasElement, modes: BrowserRenderingMode[], topLevelId: number, threadId: number) {\r\n this.targetId = WebRenderTargetRegistry.create(threadId, canvas, modes);\r\n ResizeHandler.observeSize(canvas, (width, height, dpr) => {\r\n this.sizeParams = [width, height, dpr];\r\n\r\n JsExports.CanvasHelper?.OnSizeChanged(topLevelId, width, height, dpr);\r\n });\r\n }\r\n\r\n public get width() {\r\n if (this.sizeParams) { return this.sizeParams[0]; }\r\n return 1;\r\n }\r\n\r\n public get height() {\r\n if (this.sizeParams) { return this.sizeParams[1]; }\r\n return 1;\r\n }\r\n\r\n public get scaling() {\r\n if (this.sizeParams) { return this.sizeParams[2]; }\r\n return 1;\r\n }\r\n\r\n public destroy(): void {\r\n }\r\n\r\n public static create(container: HTMLElement, modes: BrowserRenderingMode[], topLevelId: number, threadId: number): CanvasSurface {\r\n const canvas = AvaloniaDOM.createAvaloniaCanvas(container);\r\n AvaloniaDOM.attachCanvas(container, canvas);\r\n try {\r\n return new CanvasSurface(canvas, modes, topLevelId, threadId);\r\n } catch (ex) {\r\n AvaloniaDOM.detachCanvas(container, canvas);\r\n throw ex;\r\n }\r\n }\r\n\r\n public static destroy(surface: CanvasSurface) {\r\n surface.destroy();\r\n }\r\n}\r\n", "import { JsExports } from \"./jsExports\";\r\n\r\ntype SingleScreen = Screen & { window: Window; availLeft: number; availTop: number };\r\ntype ScreenDetailedEx = ScreenDetailed & { availLeft: number; availTop: number };\r\ntype BrowserScreen = ScreenDetailedEx | SingleScreen;\r\nenum ScreenOrientation {\r\n None,\r\n Landscape = 1,\r\n Portrait = 2,\r\n LandscapeFlipped = 4,\r\n PortraitFlipped = 8\r\n}\r\n\r\nexport class ScreenHelper {\r\n static detailedScreens?: ScreenDetails;\r\n\r\n private static raiseOnChanged() {\r\n JsExports.DomHelper.ScreensChanged();\r\n }\r\n\r\n public static async checkPermissions(globalThis: Window): Promise {\r\n // If previous session already granted \"window-management\" permissions, just re-request details, before they are used.\r\n const { state } = await globalThis.navigator.permissions.query({ name: \"window-management\" } as any);\r\n if (state === \"granted\") {\r\n await this.requestDetailedScreens(globalThis);\r\n }\r\n }\r\n\r\n public static subscribeOnChanged(globalThis: Window) {\r\n if (this.detailedScreens) {\r\n globalThis.screen.removeEventListener(\"change\", this.raiseOnChanged);\r\n this.detailedScreens.addEventListener(\"screenschange\", this.raiseOnChanged);\r\n\r\n // When any screen was added, we re-subscribe on all of them to keep it simpler.\r\n // Just like in C#, it's safer to re-subscribe if handler is the same function - it will trigger it once.\r\n for (const screen of this.detailedScreens.screens) {\r\n screen.addEventListener(\"change\", this.raiseOnChanged);\r\n }\r\n } else {\r\n globalThis.screen.addEventListener(\"change\", this.raiseOnChanged);\r\n }\r\n }\r\n\r\n public static getAllScreens(globalThis: Window): BrowserScreen[] {\r\n if (this.detailedScreens) {\r\n return this.detailedScreens.screens as ScreenDetailedEx[];\r\n } else {\r\n const singleScreen = Object.assign(globalThis.screen, { window: globalThis }) as SingleScreen;\r\n return [singleScreen];\r\n }\r\n }\r\n\r\n public static async requestDetailedScreens(globalThis: Window): Promise {\r\n if (this.detailedScreens) {\r\n return true;\r\n }\r\n if (\"getScreenDetails\" in globalThis) {\r\n this.detailedScreens = await globalThis.getScreenDetails();\r\n if (this.detailedScreens) {\r\n this.subscribeOnChanged(globalThis);\r\n globalThis.setTimeout(this.raiseOnChanged, 1);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static getDisplayName(screen: BrowserScreen) {\r\n return (screen as ScreenDetailed)?.label;\r\n }\r\n\r\n static getScaling(screen: BrowserScreen) {\r\n if (\"devicePixelRatio\" in screen) {\r\n return screen.devicePixelRatio;\r\n }\r\n if (\"window\" in screen) {\r\n return screen.window.devicePixelRatio;\r\n }\r\n return 1;\r\n }\r\n\r\n static getBounds(screen: BrowserScreen): number[] {\r\n const width = screen.width;\r\n const height = screen.height;\r\n\r\n if (\"left\" in screen && \"top\" in screen) {\r\n return [screen.left, screen.top, width, height];\r\n } else if (\"availLeft\" in screen && \"availTop\" in screen) {\r\n // If webapp doesn't have \"window-management\" perms, \"left\" and \"top\" will be undefined.\r\n // To keep getBounds consistent getWorkingArea, while still usable, fallback to availLeft and availTop values.\r\n return [screen.availLeft, screen.availTop, width, height];\r\n }\r\n\r\n return [0, 0, width, height];\r\n }\r\n\r\n static getWorkingArea(screen: BrowserScreen): number[] {\r\n const width = screen.availWidth;\r\n const height = screen.availHeight;\r\n\r\n if (\"availLeft\" in screen && \"availTop\" in screen) {\r\n return [screen.availLeft, screen.availTop, width, height];\r\n }\r\n return [0, 0, width, height];\r\n }\r\n\r\n static isCurrent(screen: BrowserScreen): boolean {\r\n if (this.detailedScreens) {\r\n return this.detailedScreens.currentScreen === screen;\r\n }\r\n\r\n // If detailedScreens were not requested - we have a single screen which always is a current one.\r\n return true;\r\n }\r\n\r\n static isPrimary(screen: BrowserScreen): boolean {\r\n if (\"isPrimary\" in screen) {\r\n return screen.isPrimary;\r\n }\r\n\r\n // If detailedScreens were not requested - we have a single screen which always is a current one, and we assume it's a primary one as well.\r\n return true;\r\n }\r\n\r\n /* eslint-disable indent */\r\n static getCurrentOrientation(screen: BrowserScreen): ScreenOrientation {\r\n switch (screen.orientation.type) {\r\n case \"landscape-primary\":\r\n return ScreenOrientation.Landscape;\r\n case \"landscape-secondary\":\r\n return ScreenOrientation.LandscapeFlipped;\r\n case \"portrait-primary\":\r\n return ScreenOrientation.Portrait;\r\n case \"portrait-secondary\":\r\n return ScreenOrientation.PortraitFlipped;\r\n }\r\n }\r\n}\r\n", "import { InputHelper } from \"./avalonia/input\";\r\nimport { AvaloniaDOM } from \"./avalonia/dom\";\r\nimport { Caniuse } from \"./avalonia/caniuse\";\r\nimport { StreamHelper } from \"./avalonia/stream\";\r\nimport { NativeControlHost } from \"./avalonia/nativeControlHost\";\r\nimport { NavigationHelper } from \"./avalonia/navigationHelper\";\r\nimport { GeneralHelpers } from \"./avalonia/generalHelpers\";\r\nimport { TimerHelper } from \"./avalonia/timer\";\r\nimport { CanvasSurface } from \"./avalonia/rendering/canvasSurface\";\r\nimport { WebRenderTargetRegistry } from \"./avalonia/rendering/webRenderTargetRegistry\";\r\nimport { WebRenderTarget } from \"./avalonia/rendering/webRenderTarget\";\r\nimport { SoftwareRenderTarget } from \"./avalonia/rendering/softwareRenderTarget\";\r\nimport { WebGlRenderTarget } from \"./avalonia/rendering/webGlRenderTarget\";\r\nimport { ScreenHelper } from \"./avalonia/screens\";\r\n\r\nasync function registerServiceWorker(path: string, scope: string | undefined) {\r\n if (\"serviceWorker\" in navigator) {\r\n await globalThis.navigator.serviceWorker.register(path, scope ? { scope } : undefined);\r\n }\r\n}\r\n\r\nexport {\r\n Caniuse,\r\n InputHelper,\r\n AvaloniaDOM,\r\n StreamHelper,\r\n NativeControlHost,\r\n NavigationHelper,\r\n GeneralHelpers,\r\n ScreenHelper,\r\n TimerHelper,\r\n WebRenderTarget,\r\n CanvasSurface,\r\n WebRenderTargetRegistry,\r\n SoftwareRenderTarget,\r\n WebGlRenderTarget,\r\n registerServiceWorker\r\n};\r\n"], + "mappings": "AACO,IAAMA,EAAN,KAAkB,CACrB,OAAc,oBACVC,EACAC,EACAC,EACF,CANN,IAAAC,EAAAC,EAOQ,GAAI,CAACC,EACD,MAAM,IAAI,MACN,gFACJ,EAGJ,IAAMC,GAAQH,EAAAD,GAAA,YAAAA,EAAS,QAAT,KAAAC,EAAkB,GAChC,GAAIG,EAAO,CACP,IAAMC,EAAK,SAAS,cAChB,2CACJ,EACIA,KAAIH,EAAAG,EAAG,aAAH,MAAAH,EAAe,YAAYG,GACvC,CAGA,IAAMC,EAAM,SAAS,cAAc,KAAK,EACxCA,EAAI,GAAK,2CACT,SAAS,KAAK,YAAYA,CAAG,EAE7B,IAAMC,EAAQD,EAAI,MACZE,EAAW,OAAO,iBAClB,OAAO,iBAAiBV,CAAO,EAC7BA,EAAgB,aAClBW,EAAUX,EAAQ,WAAa,QAGrCS,EAAM,WAAa,WACdE,IAASF,EAAM,SAAW,cAG/BA,EAAM,SAAW,WACZH,IAAOG,EAAM,WAAa,UAG/BG,EAAW,QAASC,GAAiB,CACjC,GAAIF,GAAWE,IAAS,aAEpB,GAAIH,EAAS,YAAc,aAAc,CACrC,IAAMI,EAAS,SAASJ,EAAS,MAAM,EACjCK,EACF,SAASL,EAAS,UAAU,EAC5B,SAASA,EAAS,aAAa,EAC/B,SAASA,EAAS,cAAc,EAChC,SAASA,EAAS,iBAAiB,EACjCM,EAAeD,EAAc,SAASL,EAAS,UAAU,EAC3DI,EAASE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AAA,YAAAA,EAA2B,KACvC,CAEA,OAAO,WAAWA,EAAuB,CACrC,MAAI,qBAAsBA,EACfA,EAAO,iBAEd,WAAYA,EACLA,EAAO,OAAO,iBAElB,CACX,CAEA,OAAO,UAAUA,EAAiC,CAC9C,IAAMC,EAAQD,EAAO,MACfE,EAASF,EAAO,OAEtB,MAAI,SAAUA,GAAU,QAASA,EACtB,CAACA,EAAO,KAAMA,EAAO,IAAKC,EAAOC,CAAM,EACvC,cAAeF,GAAU,aAAcA,EAGvC,CAACA,EAAO,UAAWA,EAAO,SAAUC,EAAOC,CAAM,EAGrD,CAAC,EAAG,EAAGD,EAAOC,CAAM,CAC/B,CAEA,OAAO,eAAeF,EAAiC,CACnD,IAAMC,EAAQD,EAAO,WACfE,EAASF,EAAO,YAEtB,MAAI,cAAeA,GAAU,aAAcA,EAChC,CAACA,EAAO,UAAWA,EAAO,SAAUC,EAAOC,CAAM,EAErD,CAAC,EAAG,EAAGD,EAAOC,CAAM,CAC/B,CAEA,OAAO,UAAUF,EAAgC,CAC7C,OAAI,KAAK,gBACE,KAAK,gBAAgB,gBAAkBA,EAI3C,EACX,CAEA,OAAO,UAAUA,EAAgC,CAC7C,MAAI,cAAeA,EACRA,EAAO,UAIX,EACX,CAGA,OAAO,sBAAsBA,EAA0C,CACnE,OAAQA,EAAO,YAAY,KAAM,CAC7B,IAAK,oBACD,MAAO,GACX,IAAK,sBACD,MAAO,GACX,IAAK,mBACD,MAAO,GACX,IAAK,qBACD,MAAO,EACf,CACJ,CACJ,EC1HA,eAAeG,GAAsBC,EAAcC,EAA2B,CACtE,kBAAmB,WACnB,MAAM,WAAW,UAAU,cAAc,SAASD,EAAMC,EAAQ,CAAE,MAAAA,CAAM,EAAI,MAAS,CAE7F", + "names": ["CaretHelper", "element", "position", "options", "_a", "_b", "isBrowser", "debug", "el", "div", "style", "computed", "isInput", "properties", "prop", "height", "outerHeight", "targetHeight", "isFirefox", "span", "coordinates", "JsExports", "_a", "resolveExports", "runtimeApi", "InnerDbConnection", "database", "store", "mode", "obj", "key", "os", "resolve", "reject", "response", "IndexedDbWrapper", "databaseName", "objectStores", "conn", "event", "db", "fileBookmarksStore", "avaloniaDb", "StorageItem", "handle", "file", "bookmarkId", "wellKnownType", "_a", "type", "item", "name", "destination", "mode", "Caniuse", "connection", "avaloniaDb", "fileBookmarksStore", "InputHelper", "args", "items", "item", "dataTransfer", "dataTransferList", "format", "source", "value", "bytes", "window", "clipboard", "resolve", "reject", "_a", "clipboardItem", "blob", "dataTransferItem", "stringValue", "str", "file", "StorageItem", "element", "topLevelId", "keySub", "pointerSub", "textSub", "dndSub", "paneSub", "keyDownHandler", "JsExports", "handled", "keyUpHandler", "compositionStartHandler", "beforeInputHandler", "ranges", "start", "end", "compositionUpdateHandler", "compositionEndHandler", "pointerMoveHandler", "pointerDownHandler", "pointerUpHandler", "pointerCancelHandler", "wheelHandler", "handler", "overAndDropHandler", "pointerEvent", "e", "listener", "event", "elementRect", "keyboardRect", "inputElement", "kind", "x", "y", "caretWidth", "caretHeight", "caret", "left", "top", "CaretHelper", "text", "modifiers", "buttons", "containerElement", "pointerId", "AvaloniaDOM", "element", "className", "parent", "elements", "host", "_a", "containerId", "canvas", "nativeHost", "inputElement", "globalThis", "isFullscreen", "colorSchemeMedia", "prefersContrastMedia", "args", "JsExports", "top", "bottom", "left", "right", "Caniuse", "_a", "userAgentData", "userAgent", "regex1", "regex2", "sharedArrayBufferDefined", "isSharedArrayBuffer", "buffer", "StreamHelper", "stream", "position", "size", "span", "offset", "count", "_a", "heap8", "copy", "NativeControlHostTopLevelAttachment", "NativeControlHost", "parent", "element", "child", "host", "x", "y", "width", "height", "NavigationHelper", "backHandlerCallback", "uri", "target", "GeneralHelpers", "instance", "key", "items", "retItems", "name", "args", "TimerHelper", "render", "time", "_a", "JsExports", "interval", "ResizeHandler", "element", "callback", "_a", "_b", "entries", "observer", "entry", "trueDpr", "width", "height", "dpr", "displayWidth", "displayHeight", "WebRenderTarget", "canvas", "type", "target", "w", "h", "getGL", "_a", "_b", "_c", "_d", "self", "module", "_WebGlRenderTarget", "WebRenderTarget", "canvas", "mode", "attrs", "context", "handle", "ret", "WebGlRenderTarget", "SoftwareRenderTarget", "WebRenderTarget", "canvas", "context", "pointer", "length", "width", "height", "_a", "heap8", "clampedBuffer", "dstArrayBuffer", "copy", "imageData", "target", "_WebRenderTargetRegistry", "pthreadId", "canvas", "preferredModes", "_a", "_b", "id", "self", "module", "pthreads", "pthread", "worker", "offscreen", "oldHandler", "ev", "msg", "modes", "mode", "SoftwareRenderTarget", "WebGlRenderTarget", "e", "message", "WebRenderTargetRegistry", "CanvasSurface", "canvas", "modes", "topLevelId", "threadId", "WebRenderTargetRegistry", "ResizeHandler", "width", "height", "dpr", "_a", "JsExports", "container", "AvaloniaDOM", "ex", "surface", "ScreenHelper", "JsExports", "globalThis", "state", "screen", "width", "height", "registerServiceWorker", "path", "scope"] +} diff --git a/_framework/avalonia.js.map.br b/_framework/avalonia.js.map.br new file mode 100644 index 0000000..27a32e5 Binary files /dev/null and b/_framework/avalonia.js.map.br differ diff --git a/_framework/avalonia.js.map.gz b/_framework/avalonia.js.map.gz new file mode 100644 index 0000000..70414bb Binary files /dev/null and b/_framework/avalonia.js.map.gz differ diff --git a/_framework/dotnet.js b/_framework/dotnet.js new file mode 100644 index 0000000..b0e5391 --- /dev/null +++ b/_framework/dotnet.js @@ -0,0 +1,352 @@ +//! Licensed to the .NET Foundation under one or more agreements. +//! The .NET Foundation licenses this file to you under the MIT license. + +var e=!1;const t=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),o=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,15,1,13,0,65,1,253,15,65,2,253,15,253,128,2,11])),n=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),r=Symbol.for("wasm promise_control");function i(e,t){let o=null;const n=new Promise((function(n,r){o={isDone:!1,promise:null,resolve:t=>{o.isDone||(o.isDone=!0,n(t),e&&e())},reject:e=>{o.isDone||(o.isDone=!0,r(e),t&&t())}}}));o.promise=n;const i=n;return i[r]=o,{promise:i,promise_control:o}}function s(e){return e[r]}function a(e){e&&function(e){return void 0!==e[r]}(e)||Be(!1,"Promise is not controllable")}const l="__mono_message__",c=["debug","log","trace","warn","info","error"],d="MONO_WASM: ";let u,f,m,g,p,h;function w(e){g=e}function b(e){if(Pe.diagnosticTracing){const t="function"==typeof e?e():e;console.debug(d+t)}}function y(e,...t){console.info(d+e,...t)}function v(e,...t){console.info(e,...t)}function E(e,...t){console.warn(d+e,...t)}function _(e,...t){if(t&&t.length>0&&t[0]&&"object"==typeof t[0]){if(t[0].silent)return;if(t[0].toString)return void console.error(d+e,t[0].toString())}console.error(d+e,...t)}function x(e,t,o){return function(...n){try{let r=n[0];if(void 0===r)r="undefined";else if(null===r)r="null";else if("function"==typeof r)r=r.toString();else if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){r=r.toString()}t(o?JSON.stringify({method:e,payload:r,arguments:n.slice(1)}):[e+r,...n.slice(1)])}catch(e){m.error(`proxyConsole failed: ${e}`)}}}function j(e,t,o){f=t,g=e,m={...t};const n=`${o}/console`.replace("https://","wss://").replace("http://","ws://");u=new WebSocket(n),u.addEventListener("error",A),u.addEventListener("close",S),function(){for(const e of c)f[e]=x(`console.${e}`,T,!0)}()}function R(e){let t=30;const o=()=>{u?0==u.bufferedAmount||0==t?(e&&v(e),function(){for(const e of c)f[e]=x(`console.${e}`,m.log,!1)}(),u.removeEventListener("error",A),u.removeEventListener("close",S),u.close(1e3,e),u=void 0):(t--,globalThis.setTimeout(o,100)):e&&m&&m.log(e)};o()}function T(e){u&&u.readyState===WebSocket.OPEN?u.send(e):m.log(e)}function A(e){m.error(`[${g}] proxy console websocket error: ${e}`,e)}function S(e){m.debug(`[${g}] proxy console websocket closed: ${e}`,e)}function D(){Pe.preferredIcuAsset=O(Pe.config);let e="invariant"==Pe.config.globalizationMode;if(!e)if(Pe.preferredIcuAsset)Pe.diagnosticTracing&&b("ICU data archive(s) available, disabling invariant mode");else{if("custom"===Pe.config.globalizationMode||"all"===Pe.config.globalizationMode||"sharded"===Pe.config.globalizationMode){const e="invariant globalization mode is inactive and no ICU data archives are available";throw _(`ERROR: ${e}`),new Error(e)}Pe.diagnosticTracing&&b("ICU data archive(s) not available, using invariant globalization mode"),e=!0,Pe.preferredIcuAsset=null}const t="DOTNET_SYSTEM_GLOBALIZATION_INVARIANT",o=Pe.config.environmentVariables;if(void 0===o[t]&&e&&(o[t]="1"),void 0===o.TZ)try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||null;e&&(o.TZ=e)}catch(e){y("failed to detect timezone, will fallback to UTC")}}function O(e){var t;if((null===(t=e.resources)||void 0===t?void 0:t.icu)&&"invariant"!=e.globalizationMode){const t=e.applicationCulture||(ke?globalThis.navigator&&globalThis.navigator.languages&&globalThis.navigator.languages[0]:Intl.DateTimeFormat().resolvedOptions().locale),o=e.resources.icu;let n=null;if("custom"===e.globalizationMode){if(o.length>=1)return o[0].name}else t&&"all"!==e.globalizationMode?"sharded"===e.globalizationMode&&(n=function(e){const t=e.split("-")[0];return"en"===t||["fr","fr-FR","it","it-IT","de","de-DE","es","es-ES"].includes(e)?"icudt_EFIGS.dat":["zh","ko","ja"].includes(t)?"icudt_CJK.dat":"icudt_no_CJK.dat"}(t)):n="icudt.dat";if(n)for(let e=0;enull},url:e,arrayBuffer:()=>r,json:()=>JSON.parse(r),text:()=>{throw new Error("NotImplementedException")}}}if(o)return globalThis.fetch(e,t||{credentials:"same-origin"});if("function"==typeof read)return{ok:!0,url:e,headers:{length:0,get:()=>null},arrayBuffer:()=>new Uint8Array(read(e,"binary")),json:()=>JSON.parse(read(e,"utf8")),text:()=>read(e,"utf8")}}catch(t){return{ok:!1,url:e,status:500,headers:{length:0,get:()=>null},statusText:"ERR28: "+t,arrayBuffer:()=>{throw t},json:()=>{throw t},text:()=>{throw t}}}throw new Error("No fetch implementation available")}function I(e){return"string"!=typeof e&&Be(!1,"url must be a string"),!M(e)&&0!==e.indexOf("./")&&0!==e.indexOf("../")&&globalThis.URL&&globalThis.document&&globalThis.document.baseURI&&(e=new URL(e,globalThis.document.baseURI).toString()),e}const U=/^[a-zA-Z][a-zA-Z\d+\-.]*?:\/\//,P=/[a-zA-Z]:[\\/]/;function M(e){return Se||Ie?e.startsWith("/")||e.startsWith("\\")||-1!==e.indexOf("///")||P.test(e):U.test(e)}let L,N=0;const $=[],z=[],W=new Map,F={"js-module-threads":!0,"js-module-runtime":!0,"js-module-dotnet":!0,"js-module-native":!0,"js-module-diagnostics":!0},B={...F,"js-module-library-initializer":!0},V={...F,dotnetwasm:!0,heap:!0,manifest:!0},q={...B,manifest:!0},H={...B,dotnetwasm:!0},J={dotnetwasm:!0,symbols:!0},Z={...B,dotnetwasm:!0,symbols:!0},Q={symbols:!0};function G(e){return!("icu"==e.behavior&&e.name!=Pe.preferredIcuAsset)}function K(e,t,o){null!=t||(t=[]),Be(1==t.length,`Expect to have one ${o} asset in resources`);const n=t[0];return n.behavior=o,X(n),e.push(n),n}function X(e){V[e.behavior]&&W.set(e.behavior,e)}function Y(e){Be(V[e],`Unknown single asset behavior ${e}`);const t=W.get(e);if(t&&!t.resolvedUrl)if(t.resolvedUrl=Pe.locateFile(t.name),F[t.behavior]){const e=ge(t);e?("string"!=typeof e&&Be(!1,"loadBootResource response for 'dotnetjs' type should be a URL string"),t.resolvedUrl=e):t.resolvedUrl=ce(t.resolvedUrl,t.behavior)}else if("dotnetwasm"!==t.behavior)throw new Error(`Unknown single asset behavior ${e}`);return t}function ee(e){const t=Y(e);return Be(t,`Single asset for ${e} not found`),t}let te=!1;async function oe(){if(!te){te=!0,Pe.diagnosticTracing&&b("mono_download_assets");try{const e=[],t=[],o=(e,t)=>{!Z[e.behavior]&&G(e)&&Pe.expected_instantiated_assets_count++,!H[e.behavior]&&G(e)&&(Pe.expected_downloaded_assets_count++,t.push(se(e)))};for(const t of $)o(t,e);for(const e of z)o(e,t);Pe.allDownloadsQueued.promise_control.resolve(),Promise.all([...e,...t]).then((()=>{Pe.allDownloadsFinished.promise_control.resolve()})).catch((e=>{throw Pe.err("Error in mono_download_assets: "+e),Xe(1,e),e})),await Pe.runtimeModuleLoaded.promise;const n=async e=>{const t=await e;if(t.buffer){if(!Z[t.behavior]){t.buffer&&"object"==typeof t.buffer||Be(!1,"asset buffer must be array-like or buffer-like or promise of these"),"string"!=typeof t.resolvedUrl&&Be(!1,"resolvedUrl must be string");const e=t.resolvedUrl,o=await t.buffer,n=new Uint8Array(o);pe(t),await Ue.beforeOnRuntimeInitialized.promise,Ue.instantiate_asset(t,e,n)}}else J[t.behavior]?("symbols"===t.behavior&&(await Ue.instantiate_symbols_asset(t),pe(t)),J[t.behavior]&&++Pe.actual_downloaded_assets_count):(t.isOptional||Be(!1,"Expected asset to have the downloaded buffer"),!H[t.behavior]&&G(t)&&Pe.expected_downloaded_assets_count--,!Z[t.behavior]&&G(t)&&Pe.expected_instantiated_assets_count--)},r=[],i=[];for(const t of e)r.push(n(t));for(const e of t)i.push(n(e));Promise.all(r).then((()=>{Ce||Ue.coreAssetsInMemory.promise_control.resolve()})).catch((e=>{throw Pe.err("Error in mono_download_assets: "+e),Xe(1,e),e})),Promise.all(i).then((async()=>{Ce||(await Ue.coreAssetsInMemory.promise,Ue.allAssetsInMemory.promise_control.resolve())})).catch((e=>{throw Pe.err("Error in mono_download_assets: "+e),Xe(1,e),e}))}catch(e){throw Pe.err("Error in mono_download_assets: "+e),e}}}let ne=!1;function re(){if(ne)return;ne=!0;const e=Pe.config,t=[];if(e.assets)for(const t of e.assets)"object"!=typeof t&&Be(!1,`asset must be object, it was ${typeof t} : ${t}`),"string"!=typeof t.behavior&&Be(!1,"asset behavior must be known string"),"string"!=typeof t.name&&Be(!1,"asset name must be string"),t.resolvedUrl&&"string"!=typeof t.resolvedUrl&&Be(!1,"asset resolvedUrl could be string"),t.hash&&"string"!=typeof t.hash&&Be(!1,"asset resolvedUrl could be string"),t.pendingDownload&&"object"!=typeof t.pendingDownload&&Be(!1,"asset pendingDownload could be object"),t.isCore?$.push(t):z.push(t),X(t);else if(e.resources){const o=e.resources;o.wasmNative||Be(!1,"resources.wasmNative must be defined"),o.jsModuleNative||Be(!1,"resources.jsModuleNative must be defined"),o.jsModuleRuntime||Be(!1,"resources.jsModuleRuntime must be defined"),K(z,o.wasmNative,"dotnetwasm"),K(t,o.jsModuleNative,"js-module-native"),K(t,o.jsModuleRuntime,"js-module-runtime"),o.jsModuleDiagnostics&&K(t,o.jsModuleDiagnostics,"js-module-diagnostics");const n=(e,t,o)=>{const n=e;n.behavior=t,o?(n.isCore=!0,$.push(n)):z.push(n)};if(o.coreAssembly)for(let e=0;eglobalThis.setTimeout(e,100))),Pe.diagnosticTracing&&b(`Retrying download (2) '${e.name}' after delay`),await ae(e)}}}async function ae(e){for(;L;)await L.promise;try{++N,N==Pe.maxParallelDownloads&&(Pe.diagnosticTracing&&b("Throttling further parallel downloads"),L=i());const t=await async function(e){if(e.pendingDownload&&(e.pendingDownloadInternal=e.pendingDownload),e.pendingDownloadInternal&&e.pendingDownloadInternal.response)return e.pendingDownloadInternal.response;if(e.buffer){const t=await e.buffer;return e.resolvedUrl||(e.resolvedUrl="undefined://"+e.name),e.pendingDownloadInternal={url:e.resolvedUrl,name:e.name,response:Promise.resolve({ok:!0,arrayBuffer:()=>t,json:()=>JSON.parse(new TextDecoder("utf-8").decode(t)),text:()=>{throw new Error("NotImplementedException")},headers:{get:()=>{}}})},e.pendingDownloadInternal.response}const t=e.loadRemote&&Pe.config.remoteSources?Pe.config.remoteSources:[""];let o;for(let n of t){n=n.trim(),"./"===n&&(n="");const t=le(e,n);e.name===t?Pe.diagnosticTracing&&b(`Attempting to download '${t}'`):Pe.diagnosticTracing&&b(`Attempting to download '${t}' for ${e.name}`);try{e.resolvedUrl=t;const n=fe(e);if(e.pendingDownloadInternal=n,o=await n.response,!o||!o.ok)continue;return o}catch(e){o||(o={ok:!1,url:t,status:0,statusText:""+e});continue}}const n=e.isOptional||e.name.match(/\.pdb$/)&&Pe.config.ignorePdbLoadErrors;if(o||Be(!1,`Response undefined ${e.name}`),!n){const t=new Error(`download '${o.url}' for ${e.name} failed ${o.status} ${o.statusText}`);throw t.status=o.status,t}y(`optional download '${o.url}' for ${e.name} failed ${o.status} ${o.statusText}`)}(e);return t?(J[e.behavior]||(e.buffer=await t.arrayBuffer(),++Pe.actual_downloaded_assets_count),e):e}finally{if(--N,L&&N==Pe.maxParallelDownloads-1){Pe.diagnosticTracing&&b("Resuming more parallel downloads");const e=L;L=void 0,e.promise_control.resolve()}}}function le(e,t){let o;return null==t&&Be(!1,`sourcePrefix must be provided for ${e.name}`),e.resolvedUrl?o=e.resolvedUrl:(o=""===t?"assembly"===e.behavior||"pdb"===e.behavior?e.name:"resource"===e.behavior&&e.culture&&""!==e.culture?`${e.culture}/${e.name}`:e.name:t+e.name,o=ce(Pe.locateFile(o),e.behavior)),o&&"string"==typeof o||Be(!1,"attemptUrl need to be path or url string"),o}function ce(e,t){return Pe.modulesUniqueQuery&&q[t]&&(e+=Pe.modulesUniqueQuery),e}let de=0;const ue=new Set;function fe(e){try{e.resolvedUrl||Be(!1,"Request's resolvedUrl must be set");const t=function(e){let t=e.resolvedUrl;if(Pe.loadBootResource){const o=ge(e);if(o instanceof Promise)return o;"string"==typeof o&&(t=o)}const o={};return e.cache?o.cache=e.cache:Pe.config.disableNoCacheFetch||(o.cache="no-cache"),e.useCredentials?o.credentials="include":!Pe.config.disableIntegrityCheck&&e.hash&&(o.integrity=e.hash),Pe.fetch_like(t,o)}(e),o={name:e.name,url:e.resolvedUrl,response:t};return ue.add(e.name),o.response.then((()=>{"assembly"==e.behavior&&Pe.loadedAssemblies.push(e.name),de++,Pe.onDownloadResourceProgress&&Pe.onDownloadResourceProgress(de,ue.size)})),o}catch(t){const o={ok:!1,url:e.resolvedUrl,status:500,statusText:"ERR29: "+t,arrayBuffer:()=>{throw t},json:()=>{throw t}};return{name:e.name,url:e.resolvedUrl,response:Promise.resolve(o)}}}const me={resource:"assembly",assembly:"assembly",pdb:"pdb",icu:"globalization",vfs:"configuration",manifest:"manifest",dotnetwasm:"dotnetwasm","js-module-dotnet":"dotnetjs","js-module-native":"dotnetjs","js-module-runtime":"dotnetjs","js-module-threads":"dotnetjs"};function ge(e){var t;if(Pe.loadBootResource){const o=null!==(t=e.hash)&&void 0!==t?t:"",n=e.resolvedUrl,r=me[e.behavior];if(r){const t=Pe.loadBootResource(r,e.name,n,o,e.behavior);return"string"==typeof t?I(t):t}}}function pe(e){e.pendingDownloadInternal=null,e.pendingDownload=null,e.buffer=null,e.moduleExports=null}function he(e){let t=e.lastIndexOf("/");return t>=0&&t++,e.substring(t)}async function we(e){e&&await Promise.all((null!=e?e:[]).map((e=>async function(e){try{const t=e.name;if(!e.moduleExports){const o=ce(Pe.locateFile(t),"js-module-library-initializer");Pe.diagnosticTracing&&b(`Attempting to import '${o}' for ${e}`),e.moduleExports=await import(/*! webpackIgnore: true */o)}Pe.libraryInitializers.push({scriptName:t,exports:e.moduleExports})}catch(t){E(`Failed to import library initializer '${e}': ${t}`)}}(e))))}async function be(e,t){if(!Pe.libraryInitializers)return;const o=[];for(let n=0;nr.exports[e](...t))))}await Promise.all(o)}async function ye(e,t,o){try{await o()}catch(o){throw E(`Failed to invoke '${t}' on library initializer '${e}': ${o}`),Xe(1,o),o}}function ve(e,t){if(e===t)return e;const o={...t};return void 0!==o.assets&&o.assets!==e.assets&&(o.assets=[...e.assets||[],...o.assets||[]]),void 0!==o.resources&&(o.resources=_e(e.resources||{assembly:[],jsModuleNative:[],jsModuleRuntime:[],wasmNative:[]},o.resources)),void 0!==o.environmentVariables&&(o.environmentVariables={...e.environmentVariables||{},...o.environmentVariables||{}}),void 0!==o.runtimeOptions&&o.runtimeOptions!==e.runtimeOptions&&(o.runtimeOptions=[...e.runtimeOptions||[],...o.runtimeOptions||[]]),Object.assign(e,o)}function Ee(e,t){if(e===t)return e;const o={...t};return o.config&&(e.config||(e.config={}),o.config=ve(e.config,o.config)),Object.assign(e,o)}function _e(e,t){if(e===t)return e;const o={...t};return void 0!==o.coreAssembly&&(o.coreAssembly=[...e.coreAssembly||[],...o.coreAssembly||[]]),void 0!==o.assembly&&(o.assembly=[...e.assembly||[],...o.assembly||[]]),void 0!==o.lazyAssembly&&(o.lazyAssembly=[...e.lazyAssembly||[],...o.lazyAssembly||[]]),void 0!==o.corePdb&&(o.corePdb=[...e.corePdb||[],...o.corePdb||[]]),void 0!==o.pdb&&(o.pdb=[...e.pdb||[],...o.pdb||[]]),void 0!==o.jsModuleWorker&&(o.jsModuleWorker=[...e.jsModuleWorker||[],...o.jsModuleWorker||[]]),void 0!==o.jsModuleNative&&(o.jsModuleNative=[...e.jsModuleNative||[],...o.jsModuleNative||[]]),void 0!==o.jsModuleDiagnostics&&(o.jsModuleDiagnostics=[...e.jsModuleDiagnostics||[],...o.jsModuleDiagnostics||[]]),void 0!==o.jsModuleRuntime&&(o.jsModuleRuntime=[...e.jsModuleRuntime||[],...o.jsModuleRuntime||[]]),void 0!==o.wasmSymbols&&(o.wasmSymbols=[...e.wasmSymbols||[],...o.wasmSymbols||[]]),void 0!==o.wasmNative&&(o.wasmNative=[...e.wasmNative||[],...o.wasmNative||[]]),void 0!==o.icu&&(o.icu=[...e.icu||[],...o.icu||[]]),void 0!==o.satelliteResources&&(o.satelliteResources=function(e,t){if(e===t)return e;for(const o in t)e[o]=[...e[o]||[],...t[o]||[]];return e}(e.satelliteResources||{},o.satelliteResources||{})),void 0!==o.modulesAfterConfigLoaded&&(o.modulesAfterConfigLoaded=[...e.modulesAfterConfigLoaded||[],...o.modulesAfterConfigLoaded||[]]),void 0!==o.modulesAfterRuntimeReady&&(o.modulesAfterRuntimeReady=[...e.modulesAfterRuntimeReady||[],...o.modulesAfterRuntimeReady||[]]),void 0!==o.extensions&&(o.extensions={...e.extensions||{},...o.extensions||{}}),void 0!==o.vfs&&(o.vfs=[...e.vfs||[],...o.vfs||[]]),Object.assign(e,o)}function xe(){const e=Pe.config;if(e.environmentVariables=e.environmentVariables||{},e.runtimeOptions=e.runtimeOptions||[],e.resources=e.resources||{assembly:[],jsModuleNative:[],jsModuleWorker:[],jsModuleRuntime:[],wasmNative:[],vfs:[],satelliteResources:{}},e.assets){Pe.diagnosticTracing&&b("config.assets is deprecated, use config.resources instead");for(const t of e.assets){const o={};switch(t.behavior){case"assembly":o.assembly=[t];break;case"pdb":o.pdb=[t];break;case"resource":o.satelliteResources={},o.satelliteResources[t.culture]=[t];break;case"icu":o.icu=[t];break;case"symbols":o.wasmSymbols=[t];break;case"vfs":o.vfs=[t];break;case"dotnetwasm":o.wasmNative=[t];break;case"js-module-threads":o.jsModuleWorker=[t];break;case"js-module-runtime":o.jsModuleRuntime=[t];break;case"js-module-native":o.jsModuleNative=[t];break;case"js-module-diagnostics":o.jsModuleDiagnostics=[t];break;case"js-module-dotnet":break;default:throw new Error(`Unexpected behavior ${t.behavior} of asset ${t.name}`)}_e(e.resources,o)}}e.debugLevel,e.applicationEnvironment||(e.applicationEnvironment="Production"),e.applicationCulture&&(e.environmentVariables.LANG=`${e.applicationCulture}.UTF-8`),Ue.diagnosticTracing=Pe.diagnosticTracing=!!e.diagnosticTracing,Ue.waitForDebugger=e.waitForDebugger,Pe.maxParallelDownloads=e.maxParallelDownloads||Pe.maxParallelDownloads,Pe.enableDownloadRetry=void 0!==e.enableDownloadRetry?e.enableDownloadRetry:Pe.enableDownloadRetry}let je=!1;async function Re(e){var t;if(je)return void await Pe.afterConfigLoaded.promise;let o;try{if(e.configSrc||Pe.config&&0!==Object.keys(Pe.config).length&&(Pe.config.assets||Pe.config.resources)||(e.configSrc="dotnet.boot.js"),o=e.configSrc,je=!0,o&&(Pe.diagnosticTracing&&b("mono_wasm_load_config"),await async function(e){const t=e.configSrc,o=Pe.locateFile(t);let n=null;void 0!==Pe.loadBootResource&&(n=Pe.loadBootResource("manifest",t,o,"","manifest"));let r,i=null;if(n)if("string"==typeof n)n.includes(".json")?(i=await s(I(n)),r=await Ae(i)):r=(await import(I(n))).config;else{const e=await n;"function"==typeof e.json?(i=e,r=await Ae(i)):r=e.config}else o.includes(".json")?(i=await s(ce(o,"manifest")),r=await Ae(i)):r=(await import(ce(o,"manifest"))).config;function s(e){return Pe.fetch_like(e,{method:"GET",credentials:"include",cache:"no-cache"})}Pe.config.applicationEnvironment&&(r.applicationEnvironment=Pe.config.applicationEnvironment),ve(Pe.config,r)}(e)),xe(),await we(null===(t=Pe.config.resources)||void 0===t?void 0:t.modulesAfterConfigLoaded),await be("onRuntimeConfigLoaded",[Pe.config]),e.onConfigLoaded)try{await e.onConfigLoaded(Pe.config,Le),xe()}catch(e){throw _("onConfigLoaded() failed",e),e}xe(),Pe.afterConfigLoaded.promise_control.resolve(Pe.config)}catch(t){const n=`Failed to load config file ${o} ${t} ${null==t?void 0:t.stack}`;throw Pe.config=e.config=Object.assign(Pe.config,{message:n,error:t,isError:!0}),Xe(1,new Error(n)),t}}function Te(){return!!globalThis.navigator&&(Pe.isChromium||Pe.isFirefox)}async function Ae(e){const t=Pe.config,o=await e.json();t.applicationEnvironment||o.applicationEnvironment||(o.applicationEnvironment=e.headers.get("Blazor-Environment")||e.headers.get("DotNet-Environment")||void 0),o.environmentVariables||(o.environmentVariables={});const n=e.headers.get("DOTNET-MODIFIABLE-ASSEMBLIES");n&&(o.environmentVariables.DOTNET_MODIFIABLE_ASSEMBLIES=n);const r=e.headers.get("ASPNETCORE-BROWSER-TOOLS");return r&&(o.environmentVariables.__ASPNETCORE_BROWSER_TOOLS=r),o}"function"!=typeof importScripts||globalThis.onmessage||(globalThis.dotnetSidecar=!0);const Se="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,De="function"==typeof importScripts,Oe=De&&"undefined"!=typeof dotnetSidecar,Ce=De&&!Oe,ke="object"==typeof window||De&&!Se,Ie=!ke&&!Se;let Ue={},Pe={},Me={},Le={},Ne={},$e=!1;const ze={},We={config:ze},Fe={mono:{},binding:{},internal:Ne,module:We,loaderHelpers:Pe,runtimeHelpers:Ue,diagnosticHelpers:Me,api:Le};function Be(e,t){if(e)return;const o="Assert failed: "+("function"==typeof t?t():t),n=new Error(o);_(o,n),Ue.nativeAbort(n)}function Ve(){return void 0!==Pe.exitCode}function qe(){return Ue.runtimeReady&&!Ve()}function He(){Ve()&&Be(!1,`.NET runtime already exited with ${Pe.exitCode} ${Pe.exitReason}. You can use runtime.runMain() which doesn't exit the runtime.`),Ue.runtimeReady||Be(!1,".NET runtime didn't start yet. Please call dotnet.create() first.")}function Je(){ke&&(globalThis.addEventListener("unhandledrejection",et),globalThis.addEventListener("error",tt))}let Ze,Qe;function Ge(e){Qe&&Qe(e),Xe(e,Pe.exitReason)}function Ke(e){Ze&&Ze(e||Pe.exitReason),Xe(1,e||Pe.exitReason)}function Xe(t,o){var n,r;const i=o&&"object"==typeof o;t=i&&"number"==typeof o.status?o.status:void 0===t?-1:t;const s=i&&"string"==typeof o.message?o.message:""+o;(o=i?o:Ue.ExitStatus?function(e,t){const o=new Ue.ExitStatus(e);return o.message=t,o.toString=()=>t,o}(t,s):new Error("Exit with code "+t+" "+s)).status=t,o.message||(o.message=s);const a=""+(o.stack||(new Error).stack);try{Object.defineProperty(o,"stack",{get:()=>a})}catch(e){}const l=!!o.silent;if(o.silent=!0,Ve())Pe.diagnosticTracing&&b("mono_exit called after exit");else{try{We.onAbort==Ke&&(We.onAbort=Ze),We.onExit==Ge&&(We.onExit=Qe),ke&&(globalThis.removeEventListener("unhandledrejection",et),globalThis.removeEventListener("error",tt)),Ue.runtimeReady?(Ue.jiterpreter_dump_stats&&Ue.jiterpreter_dump_stats(!1),0===t&&(null===(n=Pe.config)||void 0===n?void 0:n.interopCleanupOnExit)&&Ue.forceDisposeProxies(!0,!0),e&&0!==t&&(null===(r=Pe.config)||void 0===r||r.dumpThreadsOnNonZeroExit)):(Pe.diagnosticTracing&&b(`abort_startup, reason: ${o}`),function(e){Pe.allDownloadsQueued.promise_control.reject(e),Pe.allDownloadsFinished.promise_control.reject(e),Pe.afterConfigLoaded.promise_control.reject(e),Pe.wasmCompilePromise.promise_control.reject(e),Pe.runtimeModuleLoaded.promise_control.reject(e),Ue.dotnetReady&&(Ue.dotnetReady.promise_control.reject(e),Ue.afterInstantiateWasm.promise_control.reject(e),Ue.beforePreInit.promise_control.reject(e),Ue.afterPreInit.promise_control.reject(e),Ue.afterPreRun.promise_control.reject(e),Ue.beforeOnRuntimeInitialized.promise_control.reject(e),Ue.afterOnRuntimeInitialized.promise_control.reject(e),Ue.afterPostRun.promise_control.reject(e))}(o))}catch(e){E("mono_exit A failed",e)}try{l||(function(e,t){if(0!==e&&t){const e=Ue.ExitStatus&&t instanceof Ue.ExitStatus?b:_;"string"==typeof t?e(t):(void 0===t.stack&&(t.stack=(new Error).stack+""),t.message?e(Ue.stringify_as_error_with_stack?Ue.stringify_as_error_with_stack(t.message+"\n"+t.stack):t.message+"\n"+t.stack):e(JSON.stringify(t)))}!Ce&&Pe.config&&(Pe.config.logExitCode?Pe.config.forwardConsoleLogsToWS?R("WASM EXIT "+e):v("WASM EXIT "+e):Pe.config.forwardConsoleLogsToWS&&R())}(t,o),function(e){if(ke&&!Ce&&Pe.config&&Pe.config.appendElementOnExit&&document){const t=document.createElement("label");t.id="tests_done",0!==e&&(t.style.background="red"),t.innerHTML=""+e,document.body.appendChild(t)}}(t))}catch(e){E("mono_exit B failed",e)}Pe.exitCode=t,Pe.exitReason||(Pe.exitReason=o),!Ce&&Ue.runtimeReady&&We.runtimeKeepalivePop()}if(Pe.config&&Pe.config.asyncFlushOnExit&&0===t)throw(async()=>{try{await async function(){try{const e=await import(/*! webpackIgnore: true */"process"),t=e=>new Promise(((t,o)=>{e.on("error",o),e.end("","utf8",t)})),o=t(e.stderr),n=t(e.stdout);let r;const i=new Promise((e=>{r=setTimeout((()=>e("timeout")),1e3)}));await Promise.race([Promise.all([n,o]),i]),clearTimeout(r)}catch(e){_(`flushing std* streams failed: ${e}`)}}()}finally{Ye(t,o)}})(),o;Ye(t,o)}function Ye(e,t){if(Ue.runtimeReady&&Ue.nativeExit)try{Ue.nativeExit(e)}catch(e){!Ue.ExitStatus||e instanceof Ue.ExitStatus||E("set_exit_code_and_quit_now failed: "+e.toString())}if(0!==e||!ke)throw Se&&Ne.process?Ne.process.exit(e):Ue.quit&&Ue.quit(e,t),t}function et(e){ot(e,e.reason,"rejection")}function tt(e){ot(e,e.error,"error")}function ot(e,t,o){e.preventDefault();try{t||(t=new Error("Unhandled "+o)),void 0===t.stack&&(t.stack=(new Error).stack),t.stack=t.stack+"",t.silent||(_("Unhandled error:",t),Xe(1,t))}catch(e){}}!function(e){if($e)throw new Error("Loader module already loaded");$e=!0,Ue=e.runtimeHelpers,Pe=e.loaderHelpers,Me=e.diagnosticHelpers,Le=e.api,Ne=e.internal,Object.assign(Le,{INTERNAL:Ne,invokeLibraryInitializers:be}),Object.assign(e.module,{config:ve(ze,{environmentVariables:{}})});const r={mono_wasm_bindings_is_ready:!1,config:e.module.config,diagnosticTracing:!1,nativeAbort:e=>{throw e||new Error("abort")},nativeExit:e=>{throw new Error("exit:"+e)}},l={gitHash:"44525024595742ebe09023abe709df51de65009b",config:e.module.config,diagnosticTracing:!1,maxParallelDownloads:16,enableDownloadRetry:!0,_loaded_files:[],loadedFiles:[],loadedAssemblies:[],libraryInitializers:[],workerNextNumber:1,actual_downloaded_assets_count:0,actual_instantiated_assets_count:0,expected_downloaded_assets_count:0,expected_instantiated_assets_count:0,afterConfigLoaded:i(),allDownloadsQueued:i(),allDownloadsFinished:i(),wasmCompilePromise:i(),runtimeModuleLoaded:i(),loadingWorkers:i(),is_exited:Ve,is_runtime_running:qe,assert_runtime_running:He,mono_exit:Xe,createPromiseController:i,getPromiseController:s,assertIsControllablePromise:a,mono_download_assets:oe,resolve_single_asset_path:ee,setup_proxy_console:j,set_thread_prefix:w,installUnhandledErrorHandler:Je,retrieve_asset_download:ie,invokeLibraryInitializers:be,isDebuggingSupported:Te,exceptions:t,simd:n,relaxedSimd:o};Object.assign(Ue,r),Object.assign(Pe,l)}(Fe);let nt,rt,it,st=!1,at=!1;async function lt(e){if(!at){if(at=!0,ke&&Pe.config.forwardConsoleLogsToWS&&void 0!==globalThis.WebSocket&&j("main",globalThis.console,globalThis.location.origin),We||Be(!1,"Null moduleConfig"),Pe.config||Be(!1,"Null moduleConfig.config"),"function"==typeof e){const t=e(Fe.api);if(t.ready)throw new Error("Module.ready couldn't be redefined.");Object.assign(We,t),Ee(We,t)}else{if("object"!=typeof e)throw new Error("Can't use moduleFactory callback of createDotnetRuntime function.");Ee(We,e)}await async function(e){if(Se){const e=await import(/*! webpackIgnore: true */"process"),t=14;if(e.versions.node.split(".")[0]0&&(Pe.modulesUniqueQuery=t.substring(o)),Pe.scriptUrl=t.replace(/\\/g,"/").replace(/[?#].*/,""),Pe.scriptDirectory=(n=Pe.scriptUrl).slice(0,n.lastIndexOf("/"))+"/",Pe.locateFile=e=>"URL"in globalThis&&globalThis.URL!==C?new URL(e,Pe.scriptDirectory).toString():M(e)?e:Pe.scriptDirectory+e,Pe.fetch_like=k,Pe.out=console.log,Pe.err=console.error,Pe.onDownloadResourceProgress=e.onDownloadResourceProgress,ke&&globalThis.navigator){const e=globalThis.navigator,t=e.userAgentData&&e.userAgentData.brands;t&&t.length>0?Pe.isChromium=t.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):e.userAgent&&(Pe.isChromium=e.userAgent.includes("Chrome"),Pe.isFirefox=e.userAgent.includes("Firefox"))}Ne.require=Se?await import(/*! webpackIgnore: true */"module").then((e=>e.createRequire(/*! webpackIgnore: true */import.meta.url))):Promise.resolve((()=>{throw new Error("require not supported")})),void 0===globalThis.URL&&(globalThis.URL=C)}(We)}}async function ct(e){return await lt(e),Ze=We.onAbort,Qe=We.onExit,We.onAbort=Ke,We.onExit=Ge,We.ENVIRONMENT_IS_PTHREAD?async function(){(function(){const e=new MessageChannel,t=e.port1,o=e.port2;t.addEventListener("message",(e=>{var n,r;n=JSON.parse(e.data.config),r=JSON.parse(e.data.monoThreadInfo),st?Pe.diagnosticTracing&&b("mono config already received"):(ve(Pe.config,n),Ue.monoThreadInfo=r,xe(),Pe.diagnosticTracing&&b("mono config received"),st=!0,Pe.afterConfigLoaded.promise_control.resolve(Pe.config),ke&&n.forwardConsoleLogsToWS&&void 0!==globalThis.WebSocket&&Pe.setup_proxy_console("worker-idle",console,globalThis.location.origin)),t.close(),o.close()}),{once:!0}),t.start(),self.postMessage({[l]:{monoCmd:"preload",port:o}},[o])})(),await Pe.afterConfigLoaded.promise,function(){const e=Pe.config;e.assets||Be(!1,"config.assets must be defined");for(const t of e.assets)X(t),Q[t.behavior]&&z.push(t)}(),setTimeout((async()=>{try{await oe()}catch(e){Xe(1,e)}}),0);const e=dt(),t=await Promise.all(e);return await ut(t),We}():async function(){var e;await Re(We),re();const t=dt();(async function(){try{const e=ee("dotnetwasm");await se(e),e&&e.pendingDownloadInternal&&e.pendingDownloadInternal.response||Be(!1,"Can't load dotnet.native.wasm");const t=await e.pendingDownloadInternal.response,o=t.headers&&t.headers.get?t.headers.get("Content-Type"):void 0;let n;if("function"==typeof WebAssembly.compileStreaming&&"application/wasm"===o)n=await WebAssembly.compileStreaming(t);else{ke&&"application/wasm"!==o&&E('WebAssembly resource does not have the expected content type "application/wasm", so falling back to slower ArrayBuffer instantiation.');const e=await t.arrayBuffer();Pe.diagnosticTracing&&b("instantiate_wasm_module buffered"),n=Ie?await Promise.resolve(new WebAssembly.Module(e)):await WebAssembly.compile(e)}e.pendingDownloadInternal=null,e.pendingDownload=null,e.buffer=null,e.moduleExports=null,Pe.wasmCompilePromise.promise_control.resolve(n)}catch(e){Pe.wasmCompilePromise.promise_control.reject(e)}})(),setTimeout((async()=>{try{D(),await oe()}catch(e){Xe(1,e)}}),0);const o=await Promise.all(t);return await ut(o),await Ue.dotnetReady.promise,await we(null===(e=Pe.config.resources)||void 0===e?void 0:e.modulesAfterRuntimeReady),await be("onRuntimeReady",[Fe.api]),Le}()}function dt(){const e=ee("js-module-runtime"),t=ee("js-module-native");if(nt&&rt)return[nt,rt,it];"object"==typeof e.moduleExports?nt=e.moduleExports:(Pe.diagnosticTracing&&b(`Attempting to import '${e.resolvedUrl}' for ${e.name}`),nt=import(/*! webpackIgnore: true */e.resolvedUrl)),"object"==typeof t.moduleExports?rt=t.moduleExports:(Pe.diagnosticTracing&&b(`Attempting to import '${t.resolvedUrl}' for ${t.name}`),rt=import(/*! webpackIgnore: true */t.resolvedUrl));const o=Y("js-module-diagnostics");return o&&("object"==typeof o.moduleExports?it=o.moduleExports:(Pe.diagnosticTracing&&b(`Attempting to import '${o.resolvedUrl}' for ${o.name}`),it=import(/*! webpackIgnore: true */o.resolvedUrl))),[nt,rt,it]}async function ut(e){const{initializeExports:t,initializeReplacements:o,configureRuntimeStartup:n,configureEmscriptenStartup:r,configureWorkerStartup:i,setRuntimeGlobals:s,passEmscriptenInternals:a}=e[0],{default:l}=e[1],c=e[2];s(Fe),t(Fe),c&&c.setRuntimeGlobals(Fe),await n(We),Pe.runtimeModuleLoaded.promise_control.resolve(),l((e=>(Object.assign(We,{ready:e.ready,__dotnet_runtime:{initializeReplacements:o,configureEmscriptenStartup:r,configureWorkerStartup:i,passEmscriptenInternals:a}}),We))).catch((e=>{if(e.message&&e.message.toLowerCase().includes("out of memory"))throw new Error(".NET runtime has failed to start, because too much memory was requested. Please decrease the memory by adjusting EmccMaximumHeapSize. See also https://aka.ms/dotnet-wasm-features");throw e}))}const ft=new class{withModuleConfig(e){try{return Ee(We,e),this}catch(e){throw Xe(1,e),e}}withOnConfigLoaded(e){try{return Ee(We,{onConfigLoaded:e}),this}catch(e){throw Xe(1,e),e}}withConsoleForwarding(){try{return ve(ze,{forwardConsoleLogsToWS:!0}),this}catch(e){throw Xe(1,e),e}}withExitOnUnhandledError(){try{return ve(ze,{exitOnUnhandledError:!0}),Je(),this}catch(e){throw Xe(1,e),e}}withAsyncFlushOnExit(){try{return ve(ze,{asyncFlushOnExit:!0}),this}catch(e){throw Xe(1,e),e}}withExitCodeLogging(){try{return ve(ze,{logExitCode:!0}),this}catch(e){throw Xe(1,e),e}}withElementOnExit(){try{return ve(ze,{appendElementOnExit:!0}),this}catch(e){throw Xe(1,e),e}}withInteropCleanupOnExit(){try{return ve(ze,{interopCleanupOnExit:!0}),this}catch(e){throw Xe(1,e),e}}withDumpThreadsOnNonZeroExit(){try{return ve(ze,{dumpThreadsOnNonZeroExit:!0}),this}catch(e){throw Xe(1,e),e}}withWaitingForDebugger(e){try{return ve(ze,{waitForDebugger:e}),this}catch(e){throw Xe(1,e),e}}withInterpreterPgo(e,t){try{return ve(ze,{interpreterPgo:e,interpreterPgoSaveDelay:t}),ze.runtimeOptions?ze.runtimeOptions.push("--interp-pgo-recording"):ze.runtimeOptions=["--interp-pgo-recording"],this}catch(e){throw Xe(1,e),e}}withConfig(e){try{return ve(ze,e),this}catch(e){throw Xe(1,e),e}}withConfigSrc(e){try{return e&&"string"==typeof e||Be(!1,"must be file path or URL"),Ee(We,{configSrc:e}),this}catch(e){throw Xe(1,e),e}}withVirtualWorkingDirectory(e){try{return e&&"string"==typeof e||Be(!1,"must be directory path"),ve(ze,{virtualWorkingDirectory:e}),this}catch(e){throw Xe(1,e),e}}withEnvironmentVariable(e,t){try{const o={};return o[e]=t,ve(ze,{environmentVariables:o}),this}catch(e){throw Xe(1,e),e}}withEnvironmentVariables(e){try{return e&&"object"==typeof e||Be(!1,"must be dictionary object"),ve(ze,{environmentVariables:e}),this}catch(e){throw Xe(1,e),e}}withDiagnosticTracing(e){try{return"boolean"!=typeof e&&Be(!1,"must be boolean"),ve(ze,{diagnosticTracing:e}),this}catch(e){throw Xe(1,e),e}}withDebugging(e){try{return null!=e&&"number"==typeof e||Be(!1,"must be number"),ve(ze,{debugLevel:e}),this}catch(e){throw Xe(1,e),e}}withApplicationArguments(...e){try{return e&&Array.isArray(e)||Be(!1,"must be array of strings"),ve(ze,{applicationArguments:e}),this}catch(e){throw Xe(1,e),e}}withRuntimeOptions(e){try{return e&&Array.isArray(e)||Be(!1,"must be array of strings"),ze.runtimeOptions?ze.runtimeOptions.push(...e):ze.runtimeOptions=e,this}catch(e){throw Xe(1,e),e}}withMainAssembly(e){try{return ve(ze,{mainAssemblyName:e}),this}catch(e){throw Xe(1,e),e}}withApplicationArgumentsFromQuery(){try{if(!globalThis.window)throw new Error("Missing window to the query parameters from");if(void 0===globalThis.URLSearchParams)throw new Error("URLSearchParams is supported");const e=new URLSearchParams(globalThis.window.location.search).getAll("arg");return this.withApplicationArguments(...e)}catch(e){throw Xe(1,e),e}}withApplicationEnvironment(e){try{return ve(ze,{applicationEnvironment:e}),this}catch(e){throw Xe(1,e),e}}withApplicationCulture(e){try{return ve(ze,{applicationCulture:e}),this}catch(e){throw Xe(1,e),e}}withResourceLoader(e){try{return Pe.loadBootResource=e,this}catch(e){throw Xe(1,e),e}}async download(){try{await async function(){lt(We),await Re(We),re(),D(),oe(),await Pe.allDownloadsFinished.promise}()}catch(e){throw Xe(1,e),e}}async create(){try{return this.instance||(this.instance=await async function(){return await ct(We),Fe.api}()),this.instance}catch(e){throw Xe(1,e),e}}async run(){try{return We.config||Be(!1,"Null moduleConfig.config"),this.instance||await this.create(),this.instance.runMainAndExit()}catch(e){throw Xe(1,e),e}}},mt=Xe,gt=ct;Ie||"function"==typeof globalThis.URL||Be(!1,"This browser/engine doesn't support URL API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"),"function"!=typeof globalThis.BigInt64Array&&Be(!1,"This browser/engine doesn't support BigInt64Array API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"),ft.withConfig(/*json-start*/{ + "mainAssemblyName": "Semi.Avalonia.Demo.Web", + "resources": { + "hash": "sha256-XIEf7/Y0AGOhhNeUYy1p1xssXuTT940whFFQQKLmSY0=", + "jsModuleNative": [ + { + "name": "dotnet.native.7bi0derspt.js" + } + ], + "jsModuleRuntime": [ + { + "name": "dotnet.runtime.2tx45g8lli.js" + } + ], + "wasmNative": [ + { + "name": "dotnet.native.49sd4kyzqm.wasm", + "integrity": "sha256-uPt1GPkmbhj4UaZ3rj3lLUXuDADNCUEYHLNbhAkls9I=", + "cache": "force-cache" + } + ], + "icu": [ + { + "virtualPath": "icudt_CJK.dat", + "name": "icudt_CJK.tjcz0u77k5.dat", + "integrity": "sha256-SZLtQnRc0JkwqHab0VUVP7T3uBPSeYzxzDnpxPpUnHk=", + "cache": "force-cache" + }, + { + "virtualPath": "icudt_EFIGS.dat", + "name": "icudt_EFIGS.tptq2av103.dat", + "integrity": "sha256-8fItetYY8kQ0ww6oxwTLiT3oXlBwHKumbeP2pRF4yTc=", + "cache": "force-cache" + }, + { + "virtualPath": "icudt_no_CJK.dat", + "name": "icudt_no_CJK.lfu7j35m59.dat", + "integrity": "sha256-L7sV7NEYP37/Qr2FPCePo5cJqRgTXRwGHuwF5Q+0Nfs=", + "cache": "force-cache" + } + ], + "coreAssembly": [ + { + "virtualPath": "System.Private.CoreLib.wasm", + "name": "System.Private.CoreLib.qeffafn2ym.wasm", + "integrity": "sha256-wtGrF6aDjlJRqHys2X+WwhjzQG7/ItzO0rXKccWB4wA=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Runtime.InteropServices.JavaScript.wasm", + "name": "System.Runtime.InteropServices.JavaScript.or5nkqm8oq.wasm", + "integrity": "sha256-DOcsisYhQhD9G8z2h3k26pzm4z+zC7Rosx2nG/F0aPc=", + "cache": "force-cache" + } + ], + "assembly": [ + { + "virtualPath": "Avalonia.Base.wasm", + "name": "Avalonia.Base.b55b9qm4in.wasm", + "integrity": "sha256-z581oz9doO8XvglvB/7l7jT7bNm9t1N+ml3WwUkC3D0=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Browser.wasm", + "name": "Avalonia.Browser.0vx86ewdky.wasm", + "integrity": "sha256-bFschMGbpSxx6BVqRvcdUytUCgtP+lYAdSxFNbRMRKg=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Controls.ColorPicker.wasm", + "name": "Avalonia.Controls.ColorPicker.up4d8pwb8n.wasm", + "integrity": "sha256-IiUz99WrXeIdExsa9W9i/SjVasuPa8ZjbcNGNK8qIGc=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Controls.DataGrid.wasm", + "name": "Avalonia.Controls.DataGrid.bc8o233m2e.wasm", + "integrity": "sha256-Ox4V9fSO7RR7i7JR4QRSEl6Tz0PBmxcWUKTVvlZobkQ=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Controls.TreeDataGrid.wasm", + "name": "Avalonia.Controls.TreeDataGrid.4gowlhdfw3.wasm", + "integrity": "sha256-xOzrSzPLJh5u42X68CS0rCYP8Fg9MgLiFegedcfIvNs=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Controls.wasm", + "name": "Avalonia.Controls.m4p7gy8jps.wasm", + "integrity": "sha256-9pLpvXCuSIAJ57VLMLsGItLOVtShClqUIrv19FhNIjY=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Dialogs.wasm", + "name": "Avalonia.Dialogs.i887k2h472.wasm", + "integrity": "sha256-ju68lpRsAkjMMIMpTvzesIxZPLbP6r7aI8MKdS0fFe8=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Markup.Xaml.wasm", + "name": "Avalonia.Markup.Xaml.vm63lr44rr.wasm", + "integrity": "sha256-VwVoaiZYNltD4Cu/6dbAaAsZiRd238JVv8JA6nWPKDI=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Markup.wasm", + "name": "Avalonia.Markup.p6cjgzcx7z.wasm", + "integrity": "sha256-cUA6H7BumeRMWH7agoMiQMtGo7+6ThmAhWp3IQEY3NA=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Metal.wasm", + "name": "Avalonia.Metal.lj5j0lvb30.wasm", + "integrity": "sha256-LzkwGLgKlR6suHn031Z5VOBHXB42+eIRoS1ja6RmfMY=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.OpenGL.wasm", + "name": "Avalonia.OpenGL.4793gyniz7.wasm", + "integrity": "sha256-UBlQ/Nfx+a92HXjb1RIrdEo4rD8ruliLXREKMmIQBc8=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Skia.wasm", + "name": "Avalonia.Skia.s1d9s3bo6y.wasm", + "integrity": "sha256-UOK9LsUur7xv2ppZ28XXGSiWa0Ak63Oyit3arLYACLM=", + "cache": "force-cache" + }, + { + "virtualPath": "Avalonia.Vulkan.wasm", + "name": "Avalonia.Vulkan.jqpn47ht00.wasm", + "integrity": "sha256-9c0QHbA3I3m3tDLdJ/hklAFwMHqCSZECRaQttFInBSA=", + "cache": "force-cache" + }, + { + "virtualPath": "CommunityToolkit.Mvvm.wasm", + "name": "CommunityToolkit.Mvvm.ojrsxcaklv.wasm", + "integrity": "sha256-jHRJxrepfBmemqezsk2s/2OeuzfogiCKSAg37j88c+U=", + "cache": "force-cache" + }, + { + "virtualPath": "HarfBuzzSharp.wasm", + "name": "HarfBuzzSharp.7hxr3k2jxz.wasm", + "integrity": "sha256-O3U/ErZMzgUWLIZp4ee+Iq/fIJZMn9oZg6nXZtOk37I=", + "cache": "force-cache" + }, + { + "virtualPath": "Irihi.Avalonia.Shared.wasm", + "name": "Irihi.Avalonia.Shared.49aeyu7lil.wasm", + "integrity": "sha256-mIokQ/brMLaE1HiGAHnvIKIt6XFAnfNWnjkZnf7YHj8=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.ColorPicker.wasm", + "name": "Semi.Avalonia.ColorPicker.8b9hmh2a55.wasm", + "integrity": "sha256-nFy15os7z22/aGzpFc+LAsCZZLPKnogcYAspyNaTmPc=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.DataGrid.wasm", + "name": "Semi.Avalonia.DataGrid.9cuvva2nxq.wasm", + "integrity": "sha256-WXJaAOM1T353QemIIUKNzFpSO61HSreqCQU1ZAMcGoo=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.Demo.Web.wasm", + "name": "Semi.Avalonia.Demo.Web.so75ixgk5b.wasm", + "integrity": "sha256-LCwflZ3bhXZOboEPYKDcAzX61/Z2Ngo5pKxQxkMSmAQ=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.Demo.wasm", + "name": "Semi.Avalonia.Demo.z0gvi7vqpx.wasm", + "integrity": "sha256-HV+v8J6BI1+KFMKN4wIa8a1PpLhntZMOy8c/6P59GHE=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.TreeDataGrid.wasm", + "name": "Semi.Avalonia.TreeDataGrid.47t04bhpar.wasm", + "integrity": "sha256-0HM2yoI0q1omKafELhno8MADjYA4mHruG/5qiVPxKfk=", + "cache": "force-cache" + }, + { + "virtualPath": "Semi.Avalonia.wasm", + "name": "Semi.Avalonia.v3cq3bt4tg.wasm", + "integrity": "sha256-y37vVXdeEewca2FgbCxEptyioIVtub6XmFu0pw1135U=", + "cache": "force-cache" + }, + { + "virtualPath": "SkiaSharp.wasm", + "name": "SkiaSharp.8rdsog2snz.wasm", + "integrity": "sha256-pKz1YSltVtEixR85O0DSq6/B4JTiPyLuD8OspN+mTyI=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Collections.wasm", + "name": "System.Collections.6on6n2gctf.wasm", + "integrity": "sha256-VnyswVxfNqph6qJIEOz2HyrS5wDjFftgJjZ7yalMPz4=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Collections.Concurrent.wasm", + "name": "System.Collections.Concurrent.9muq2b0o9c.wasm", + "integrity": "sha256-gWtaBu4+XGtyMckyPsDhvazYEN+BCI9e+9j7PB8DRdg=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Collections.NonGeneric.wasm", + "name": "System.Collections.NonGeneric.euj10syi7w.wasm", + "integrity": "sha256-SlVtaZgcjezX8OTFVud0qQ6HAZsodD20Ppc++m+io5I=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Collections.Specialized.wasm", + "name": "System.Collections.Specialized.pmrze1vkyp.wasm", + "integrity": "sha256-XyevzrCSvG+78TPX143emUcWBzsJ/HhZh57L/qRbGOo=", + "cache": "force-cache" + }, + { + "virtualPath": "System.ComponentModel.Annotations.wasm", + "name": "System.ComponentModel.Annotations.kbmzgbmpxf.wasm", + "integrity": "sha256-wBd1wYwOtipHD3xqwlJ5p5MCoLjxlBQ6YrS7iUJ6Z/g=", + "cache": "force-cache" + }, + { + "virtualPath": "System.ComponentModel.Primitives.wasm", + "name": "System.ComponentModel.Primitives.1re2gdp06l.wasm", + "integrity": "sha256-01Rnt87+bl3cRdxuZco/lq4N0bcrDwDyf3Qa8zzXo28=", + "cache": "force-cache" + }, + { + "virtualPath": "System.ComponentModel.TypeConverter.wasm", + "name": "System.ComponentModel.TypeConverter.rruxrd4n56.wasm", + "integrity": "sha256-+ZaoJguDFcL1n3TmOpjV0g65ROJT4yiizGt5Zg09eU8=", + "cache": "force-cache" + }, + { + "virtualPath": "System.ComponentModel.wasm", + "name": "System.ComponentModel.g0zcsbgwop.wasm", + "integrity": "sha256-QOTQCjGnsuRgNV5B48vqXXVvjxoRa4y8YI4ZH4Z4p3U=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Diagnostics.DiagnosticSource.wasm", + "name": "System.Diagnostics.DiagnosticSource.8bkzkifn1j.wasm", + "integrity": "sha256-bOK/jj4tnO/2OQuETdhGWAe6MJ9iQcr4im2B902/3z8=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Diagnostics.TraceSource.wasm", + "name": "System.Diagnostics.TraceSource.38othyre2c.wasm", + "integrity": "sha256-48jSj122y8MyE3rMWWRjSU0Ol9mDY7KPae2jMc60l6s=", + "cache": "force-cache" + }, + { + "virtualPath": "System.IO.FileSystem.DriveInfo.wasm", + "name": "System.IO.FileSystem.DriveInfo.16rceoo8ds.wasm", + "integrity": "sha256-dz3IUnonBdubQk9Ox1zZI8Ew/C4ZCih+ATS4IW2gbTw=", + "cache": "force-cache" + }, + { + "virtualPath": "System.IO.FileSystem.Watcher.wasm", + "name": "System.IO.FileSystem.Watcher.4azd8fnhst.wasm", + "integrity": "sha256-JLhscano0AvQ6tvq3KynqXVm59o03k+hTPZHl+k7KDc=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Linq.Expressions.wasm", + "name": "System.Linq.Expressions.352bh30971.wasm", + "integrity": "sha256-l7yWrOKUJDR3u+NynZFdWSGfsbEPRYFSPKwLKcSoGjo=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Linq.wasm", + "name": "System.Linq.jycnfjy4ii.wasm", + "integrity": "sha256-W1w+QMBJ4KJbrcdLrTtIuVVqgL02OYnT39LCFaUddHM=", + "cache": "force-cache" + }, + { + "virtualPath": "System.ObjectModel.wasm", + "name": "System.ObjectModel.vbk301pval.wasm", + "integrity": "sha256-VYIi/22HLuXJIqvyWaveK4lsxsZeGVQnSaFjrn4/V+A=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Private.Uri.wasm", + "name": "System.Private.Uri.kw0xtqvd96.wasm", + "integrity": "sha256-LGjvYHD5aF7fgIBlWLkMFchxdeFjpD5IO3pRbJA6U3E=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Reactive.wasm", + "name": "System.Reactive.fmiefo5nve.wasm", + "integrity": "sha256-OcvrVG1LMR3VtmJNz4jEeIbd/nGNoQadMEPYepUr3LI=", + "cache": "force-cache" + }, + { + "virtualPath": "System.Text.RegularExpressions.wasm", + "name": "System.Text.RegularExpressions.hcclc4n26u.wasm", + "integrity": "sha256-P8JN1pmb1VzgZjpxUb12PD2Kr/AlmVn0bMAV3eiZxZk=", + "cache": "force-cache" + }, + { + "virtualPath": "System.wasm", + "name": "System.l9jolnojrw.wasm", + "integrity": "sha256-d1dcH2nxptL8QLqZqtRI5G+lrjrbUKrUOnC/yloVB98=", + "cache": "force-cache" + } + ] + }, + "debugLevel": 0, + "linkerEnabled": true, + "globalizationMode": "sharded", + "runtimeConfig": { + "runtimeOptions": { + "configProperties": { + "MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT": true, + "Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability": true, + "System.ComponentModel.DefaultValueAttribute.IsSupported": false, + "System.ComponentModel.Design.IDesignerHost.IsSupported": false, + "System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization": false, + "System.ComponentModel.TypeDescriptor.IsComObjectDescriptorSupported": false, + "System.Data.DataSet.XmlSerializationIsSupported": false, + "System.Diagnostics.Debugger.IsSupported": false, + "System.Diagnostics.Metrics.Meter.IsSupported": false, + "System.Diagnostics.Tracing.EventSource.IsSupported": false, + "System.Globalization.Invariant": false, + "System.TimeZoneInfo.Invariant": false, + "System.Linq.Enumerable.IsSizeOptimized": true, + "System.Net.Http.EnableActivityPropagation": false, + "System.Net.Http.WasmEnableStreamingResponse": true, + "System.Net.SocketsHttpHandler.Http3Support": false, + "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, + "System.Resources.ResourceManager.AllowCustomResourceTypes": false, + "System.Resources.UseSystemResourceKeys": true, + "System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported": true, + "System.Runtime.InteropServices.BuiltInComInterop.IsSupported": false, + "System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": false, + "System.Runtime.InteropServices.EnableCppCLIHostActivation": false, + "System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop": false, + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false, + "System.StartupHookProvider.IsSupported": false, + "System.Text.Encoding.EnableUnsafeUTF7Encoding": false, + "System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault": false, + "System.Threading.Thread.EnableAutoreleasePool": false + } + } + } +}/*json-end*/);export{gt as default,ft as dotnet,mt as exit}; diff --git a/_framework/dotnet.js.br b/_framework/dotnet.js.br new file mode 100644 index 0000000..038dcdc Binary files /dev/null and b/_framework/dotnet.js.br differ diff --git a/_framework/dotnet.js.gz b/_framework/dotnet.js.gz new file mode 100644 index 0000000..48b487c Binary files /dev/null and b/_framework/dotnet.js.gz differ diff --git a/_framework/dotnet.native.49sd4kyzqm.wasm b/_framework/dotnet.native.49sd4kyzqm.wasm new file mode 100755 index 0000000..0e6df8a Binary files /dev/null and b/_framework/dotnet.native.49sd4kyzqm.wasm differ diff --git a/_framework/dotnet.native.49sd4kyzqm.wasm.br b/_framework/dotnet.native.49sd4kyzqm.wasm.br new file mode 100644 index 0000000..9ef13ee Binary files /dev/null and b/_framework/dotnet.native.49sd4kyzqm.wasm.br differ diff --git a/_framework/dotnet.native.49sd4kyzqm.wasm.gz b/_framework/dotnet.native.49sd4kyzqm.wasm.gz new file mode 100644 index 0000000..f39b289 Binary files /dev/null and b/_framework/dotnet.native.49sd4kyzqm.wasm.gz differ diff --git a/_framework/dotnet.native.7bi0derspt.js b/_framework/dotnet.native.7bi0derspt.js new file mode 100644 index 0000000..3f6e16c --- /dev/null +++ b/_framework/dotnet.native.7bi0derspt.js @@ -0,0 +1,10753 @@ + +var createDotnetRuntime = (() => { + var _scriptDir = import.meta.url; + + return ( +async function(moduleArg = {}) { + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(Module) { ..generated code.. } +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; +Module['ready'] = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// include: /usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/10.0.2/runtimes/browser-wasm/native/src/es6/dotnet.es6.pre.js +if (_nativeModuleLoaded) throw new Error("Native module already loaded"); +_nativeModuleLoaded = true; +createDotnetRuntime = Module = moduleArg(Module); +// end include: /usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/10.0.2/runtimes/browser-wasm/native/src/es6/dotnet.es6.pre.js + + +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; +var thisProgram = './this.program'; +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). + +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == 'object'; +var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ''; +function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var read_, + readAsync, + readBinary; + +if (ENVIRONMENT_IS_NODE) { + + // `require()` is no-op in an ESM module, use `createRequire()` to construct + // the require()` function. This is only necessary for multi-environment + // builds, `-sENVIRONMENT=node` emits a static import declaration instead. + // TODO: Swap all `require()`'s with `import()`'s? + const { createRequire } = await import('module'); + /** @suppress{duplicate} */ + var require = createRequire(import.meta.url); + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require('fs'); + var nodePath = require('path'); + + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = nodePath.dirname(scriptDirectory) + '/'; + } else { + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + scriptDirectory = require('url').fileURLToPath(new URL('./', import.meta.url)); // includes trailing slash + } + +// include: node_shell_read.js +read_ = (filename, binary) => { + // We need to re-wrap `file://` strings to URLs. Normalizing isn't + // necessary in that case, the path should already be absolute. + filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename); + return fs.readFileSync(filename, binary ? undefined : 'utf8'); +}; + +readBinary = (filename) => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + return ret; +}; + +readAsync = (filename, onload, onerror, binary = true) => { + // See the comment in the `read_` function. + filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename); + fs.readFile(filename, binary ? undefined : 'utf8', (err, data) => { + if (err) onerror(err); + else onload(binary ? data.buffer : data); + }); +}; +// end include: node_shell_read.js + if (!Module['thisProgram'] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, '/'); + } + + arguments_ = process.argv.slice(2); + + // MODULARIZE will export the module in the proper place outside, we don't need to export here + + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; + +} else +if (ENVIRONMENT_IS_SHELL) { + + if (typeof read != 'undefined') { + read_ = read; + } + + readBinary = (f) => { + if (typeof readbuffer == 'function') { + return new Uint8Array(readbuffer(f)); + } + let data = read(f, 'binary'); + assert(typeof data == 'object'); + return data; + }; + + readAsync = (f, onload, onerror) => { + setTimeout(() => onload(readBinary(f))); + }; + + if (typeof clearTimeout == 'undefined') { + globalThis.clearTimeout = (id) => {}; + } + + if (typeof setTimeout == 'undefined') { + // spidermonkey lacks setTimeout but we use it above in readAsync. + globalThis.setTimeout = (f) => (typeof f == 'function') ? f() : abort(); + } + + if (typeof scriptArgs != 'undefined') { + arguments_ = scriptArgs; + } else if (typeof arguments != 'undefined') { + arguments_ = arguments; + } + + if (typeof quit == 'function') { + quit_ = (status, toThrow) => { + // Unlike node which has process.exitCode, d8 has no such mechanism. So we + // have no way to set the exit code and then let the program exit with + // that code when it naturally stops running (say, when all setTimeouts + // have completed). For that reason, we must call `quit` - the only way to + // set the exit code - but quit also halts immediately. To increase + // consistency with node (and the web) we schedule the actual quit call + // using a setTimeout to give the current stack and any exception handlers + // a chance to run. This enables features such as addOnPostRun (which + // expected to be able to run code after main returns). + setTimeout(() => { + if (!(toThrow instanceof ExitStatus)) { + let toLog = toThrow; + if (toThrow && typeof toThrow == 'object' && toThrow.stack) { + toLog = [toThrow, toThrow.stack]; + } + err(`exiting due to exception: ${toLog}`); + } + quit(status); + }); + throw toThrow; + }; + } + + if (typeof print != 'undefined') { + // Prefer to use print/printErr where they exist, as they usually work better. + if (typeof console == 'undefined') console = /** @type{!Console} */({}); + console.log = /** @type{!function(this:Console, ...*): undefined} */ (print); + console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (typeof printErr != 'undefined' ? printErr : print); + } + +} else + +// Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith('blob:')) { + scriptDirectory = ''; + } else { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1); + } + + // Differentiate the Web Worker from the Node Worker case, as reading must + // be done differently. + { +// include: web_or_worker_shell_read.js +read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(null); + return xhr.responseText; + } + + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response)); + }; + } + + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0 + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + } + +// end include: web_or_worker_shell_read.js + } +} else +{ +} + +var out = Module['print'] || console.log.bind(console); +var err = Module['printErr'] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. + +if (Module['arguments']) arguments_ = Module['arguments']; + +if (Module['thisProgram']) thisProgram = Module['thisProgram']; + +if (Module['quit']) quit_ = Module['quit']; + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// end include: shell.js + +// include: preamble.js +// === Preamble library stuff === + +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html + +var wasmBinary; +if (Module['wasmBinary']) wasmBinary = Module['wasmBinary']; + +// include: base64Utils.js +// include: polyfill/atob.js +// Copied from https://github.com/strophe/strophejs/blob/e06d027/src/polyfills.js#L149 + +// This code was written by Tyler Akins and has been placed in the +// public domain. It would be nice if you left this header intact. +// Base64 code from Tyler Akins -- http://rumkin.com + +if (typeof atob == 'undefined') { + if (typeof global != 'undefined' && typeof globalThis == 'undefined') { + globalThis = global; + } + + /** + * Decodes a base64 string. + * @param {string} input The string to decode. + */ + globalThis.atob = function(input) { + var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + var output = ''; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + // remove all characters that are not A-Z, a-z, 0-9, +, /, or = + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; + }; +} +// end include: polyfill/atob.js +// Converts a string of base64 into a byte array (Uint8Array). +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE != 'undefined' && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, 'base64'); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.length); + } + + var decoded = atob(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0 ; i < decoded.length ; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; +} + +// If filename is a base64 data URI, parses and returns data (Buffer on node, +// Uint8Array otherwise). If filename is not a base64 data URI, returns undefined. +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} +// end include: base64Utils.js +// Wasm globals + +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== + +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ +function assert(condition, text) { + if (!condition) { + // This build was created without ASSERTIONS defined. `assert()` should not + // ever be called in this configuration but in case there are callers in + // the wild leave this simple abort() implementation here for now. + abort(text); + } +} + +// Memory management + +var HEAP, +/** @type {!Int8Array} */ + HEAP8, +/** @type {!Uint8Array} */ + HEAPU8, +/** @type {!Int16Array} */ + HEAP16, +/** @type {!Uint16Array} */ + HEAPU16, +/** @type {!Int32Array} */ + HEAP32, +/** @type {!Uint32Array} */ + HEAPU32, +/** @type {!Float32Array} */ + HEAPF32, +/* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ + HEAP64, +/* BigUInt64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ + HEAPU64, +/** @type {!Float64Array} */ + HEAPF64; + +// include: runtime_shared.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP64'] = HEAP64 = new BigInt64Array(b); + Module['HEAPU64'] = HEAPU64 = new BigUint64Array(b); +} +// end include: runtime_shared.js +// include: runtime_stack_check.js +// end include: runtime_stack_check.js +// include: runtime_assertions.js +// end include: runtime_assertions.js +var __ATPRERUN__ = []; // functions called before the runtime is initialized +var __ATINIT__ = []; // functions called during startup +var __ATEXIT__ = []; // functions called during shutdown +var __ATPOSTRUN__ = []; // functions called after the main() is called + +var runtimeInitialized = false; + +var runtimeExited = false; + +function preRun() { + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + runtimeInitialized = true; + + SOCKFS.root = FS.mount(SOCKFS, {}, null); + +if (!Module['noFSInit'] && !FS.init.initialized) + FS.init(); +FS.ignorePermissions = false; + +TTY.init(); + callRuntimeCallbacks(__ATINIT__); +} + +function exitRuntime() { + ___funcs_on_exit(); // Native atexit() functions + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); +TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +// include: runtime_math.js +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc + +// end include: runtime_math.js +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; +var runDependencyWatcher = null; +var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled + +function getUniqueRunDependency(id) { + return id; +} + +function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + +} + +function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); // can add another dependenciesFulfilled + } + } +} + +/** @param {string|number=} what */ +function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + + ABORT = true; + EXITSTATUS = 1; + + what += '. Build with -sASSERTIONS for more info.'; + + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + // See above, in the meantime, we resort to wasm code for trapping. + // + // In case abort() is called before the module is initialized, wasmExports + // and its exported '__trap' function is not available, in which case we throw + // a RuntimeError. + // + // We trap instead of throwing RuntimeError to prevent infinite-looping in + // Wasm EH code (because RuntimeError is considered as a foreign exception and + // caught by 'catch_all'), but in case throwing RuntimeError is fine because + // the module has not even been instantiated, even less running. + if (runtimeInitialized) { + ___trap(); + } + /** @suppress {checkTypes} */ + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: URIUtils.js +// Prefix of data URIs emitted by SINGLE_FILE and related options. +var dataURIPrefix = 'data:application/octet-stream;base64,'; + +/** + * Indicates whether filename is a base64 data URI. + * @noinline + */ +var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ +var isFileURI = (filename) => filename.startsWith('file://'); +// end include: URIUtils.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +var wasmBinaryFile; +if (Module['locateFile']) { + wasmBinaryFile = 'dotnet.native.wasm'; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + if (ENVIRONMENT_IS_SHELL) + wasmBinaryFile = 'dotnet.native.wasm'; + else + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + wasmBinaryFile = new URL('dotnet.native.wasm', import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; +} + +function getBinaryPromise(binaryFile) { + // If we don't have the binary yet, try to load it asynchronously. + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use fetch if it is available and the url is not a file, otherwise fall back to XHR. + if (!wasmBinary + && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == 'function' + && !isFileURI(binaryFile) + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then((response) => { + if (!response['ok']) { + throw `failed to load wasm binary file at '${binaryFile}'`; + } + return response['arrayBuffer'](); + }).catch(() => getBinarySync(binaryFile)); + } + else if (readAsync) { + // fetch is not available or url is file => try XHR (readAsync uses XHR internally) + return new Promise((resolve, reject) => { + readAsync(binaryFile, (response) => resolve(new Uint8Array(/** @type{!ArrayBuffer} */(response))), reject) + }); + } + } + + // Otherwise, getBinarySync should be able to get it synchronously + return Promise.resolve().then(() => getBinarySync(binaryFile)); +} + +function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile).then((binary) => { + return WebAssembly.instantiate(binary, imports); + }).then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); +} + +function instantiateAsync(binary, binaryFile, imports, callback) { + if (!binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + // Don't use streaming for file:// delivered objects in a webview, fetch them synchronously. + !isFileURI(binaryFile) && + // Avoid instantiateStreaming() on Node.js environment for now, as while + // Node.js v18.1.0 implements it, it does not have a full fetch() + // implementation yet. + // + // Reference: + // https://github.com/emscripten-core/emscripten/pull/16917 + !ENVIRONMENT_IS_NODE && + typeof fetch == 'function') { + return fetch(binaryFile, { credentials: 'same-origin' }).then((response) => { + // Suppress closure warning here since the upstream definition for + // instantiateStreaming only allows Promise rather than + // an actual Response. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed. + /** @suppress {checkTypes} */ + var result = WebAssembly.instantiateStreaming(response, imports); + + return result.then( + callback, + function(reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }); + } + return instantiateArrayBuffer(binaryFile, imports, callback); +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +function createWasm() { + // prepare imports + var info = { + 'env': wasmImports, + 'wasi_snapshot_preview1': wasmImports, + }; + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + Module['wasmExports'] = wasmExports; + + wasmMemory = wasmExports['memory']; + + updateMemoryViews(); + + wasmTable = wasmExports['__indirect_function_table']; + + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency('wasm-instantiate'); + + // Prefer streaming instantiation if available. + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + receiveInstance(result['instance']); + } + + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module['instantiateWasm']) { + + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch(e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + } + } + + // If instantiation fails, reject the module ready promise. + instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject); + return {}; // no exports yet; we'll fill them in later +} + +// include: runtime_debug.js +// end include: runtime_debug.js +// === Body === +// end include: preamble.js + + + /** @constructor */ + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } + }; + + + /** + * @param {number} ptr + * @param {string} type + */ + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': return HEAP8[ptr]; + case 'i8': return HEAP8[ptr]; + case 'i16': return HEAP16[((ptr)>>1)]; + case 'i32': return HEAP32[((ptr)>>2)]; + case 'i64': return HEAP64[((ptr)>>3)]; + case 'float': return HEAPF32[((ptr)>>2)]; + case 'double': return HEAPF64[((ptr)>>3)]; + case '*': return HEAPU32[((ptr)>>2)]; + default: abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || false; + + + /** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': HEAP8[ptr] = value; break; + case 'i8': HEAP8[ptr] = value; break; + case 'i16': HEAP16[((ptr)>>1)] = value; break; + case 'i32': HEAP32[((ptr)>>2)] = value; break; + case 'i64': HEAP64[((ptr)>>3)] = BigInt(value); break; + case 'float': HEAPF32[((ptr)>>2)] = value; break; + case 'double': HEAPF64[((ptr)>>3)] = value; break; + case '*': HEAPU32[((ptr)>>2)] = value; break; + default: abort(`invalid type for setValue: ${type}`); + } + } + + var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined; + + /** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number} idx + * @param {number=} maxBytesToRead + * @return {string} + */ + var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xF0) == 0xE0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF)); + } + } + return str; + }; + + /** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ + var UTF8ToString = (ptr, maxBytesToRead) => { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var ___assert_fail = (condition, filename, line, func) => { + abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']); + }; + + var initRandomFill = () => { + if (typeof crypto == 'object' && typeof crypto['getRandomValues'] == 'function') { + // for modern web browsers + return (view) => crypto.getRandomValues(view); + } else + if (ENVIRONMENT_IS_NODE) { + // for nodejs with or without crypto support included + try { + var crypto_module = require('crypto'); + var randomFillSync = crypto_module['randomFillSync']; + if (randomFillSync) { + // nodejs with LTS crypto support + return (view) => crypto_module['randomFillSync'](view); + } + // very old nodejs with the original crypto API + var randomBytes = crypto_module['randomBytes']; + return (view) => ( + view.set(randomBytes(view.byteLength)), + // Return the original view to match modern native implementations. + view + ); + } catch (e) { + // nodejs doesn't have crypto support + } + } + // we couldn't find a proper implementation, as Math.random() is not suitable for /dev/random, see emscripten-core/emscripten/pull/7096 + abort('initRandomDevice'); + }; + var randomFill = (view) => { + // Lazily init on the first invocation. + return (randomFill = initRandomFill())(view); + }; + + var PATH = { + isAbs:(path) => path.charAt(0) === '/', + splitPath:(filename) => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray:(parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize:(path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + // Normalize the path + path = PATH.normalizeArray(path.split('/').filter((p) => !!p), !isAbsolute).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname:(path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename:(path) => { + // EMSCRIPTEN return '/'' for '/', not an empty string + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash+1); + }, + join:(...paths) => PATH.normalize(paths.join('/')), + join2:(l, r) => PATH.normalize(l + '/' + r), + }; + + + var PATH_FS = { + resolve:(...args) => { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + return ''; // an invalid portion invalidates the whole thing + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter((p) => !!p), !resolvedAbsolute).join('/'); + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; + }, + relative:(from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + + + + var FS_stdin_getChar_buffer = []; + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); // possibly a lead surrogate + if (c <= 0x7F) { + len++; + } else if (c <= 0x7FF) { + len += 2; + } else if (c >= 0xD800 && c <= 0xDFFF) { + len += 4; ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) + return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); // possibly a lead surrogate + if (u >= 0xD800 && u <= 0xDFFF) { + var u1 = str.charCodeAt(++i); + u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF); + } + if (u <= 0x7F) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7FF) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xC0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xFFFF) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xE0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 0xF0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; + }; + /** @type {function(string, boolean=, number=)} */ + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy)+1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ + var fd = process.stdin.fd; + + try { + bytesRead = fs.readSync(fd, buf); + } catch(e) { + // Cross-platform differences: on Windows, reading EOF throws an exception, but on other OSes, + // reading EOF returns 0. Uniformize behavior by treating the EOF exception to return 0. + if (e.toString().includes('EOF')) bytesRead = 0; + else throw e; + } + + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString('utf-8'); + } else { + result = null; + } + } else + if (typeof window != 'undefined' && + typeof window.prompt == 'function') { + // Browser. + result = window.prompt('Input: '); // returns null on cancel + if (result !== null) { + result += '\n'; + } + } else if (typeof readline == 'function') { + // Command line. + result = readline(); + if (result !== null) { + result += '\n'; + } + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys:[], + init() { + // https://github.com/emscripten-core/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // currently, FS.init does not distinguish if process.stdin is a file or TTY + // // device, it always assumes it's a TTY device. because of this, we're forcing + // // process.stdin to UTF8 encoding to at least make stdin reading compatible + // // with text files until FS.init can be refactored. + // process.stdin.setEncoding('utf8'); + // } + }, + shutdown() { + // https://github.com/emscripten-core/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)? + // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation + // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists? + // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle + // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call + // process.stdin.pause(); + // } + }, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops:{ + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos /* ignored */) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset+i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset+i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops:{ + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); // val == 0 would cut text output off in the middle. + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a, 0x00, + 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops:{ + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + + + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + return address; + }; + + var alignMemory = (size, alignment) => { + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + return zeroMemory(ptr, size); + }; + var MEMFS = { + ops_table:null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511 /* 0777 */, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); // Copy old data over to the new storage. + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); // Copy old data over to the new storage. + } + node.usedBytes = newSize; + } + }, + node_ops:{ + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + // if we're overwriting a directory at new_name, make sure it's empty. + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + } + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now() + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key of Object.keys(node.contents)) { + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops:{ + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + + if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array? + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position+length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; // Or fall back to manual write if not. + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + }, + }, + }; + + /** @param {boolean=} noRunDep */ + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync(url, (arrayBuffer) => { + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, (event) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }); + if (dep) addRunDependency(dep); + }; + + + var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + + var preloadPlugins = Module['preloadPlugins'] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != 'undefined') Browser.init(); + + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, processData, onerror); + } else { + processData(url); + } + }; + + var FS_modeStringToFlags = (str) => { + var flagModes = { + 'r': 0, + 'r+': 2, + 'w': 512 | 64 | 1, + 'w+': 512 | 64 | 2, + 'a': 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + + + + var FS = { + root:null, + mounts:[], + devices:{ + }, + streams:[], + nextInode:1, + nameTable:null, + currentPath:"/", + initialized:false, + ignorePermissions:true, + ErrnoError:class { + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + // TODO(sbc): Use the inline member declaration syntax once we + // support it in acorn and closure. + this.name = 'ErrnoError'; + this.errno = errno; + } + }, + genericErrors:{ + }, + filesystems:null, + syncFSRequests:0, + FSStream:class { + constructor() { + // TODO(https://github.com/emscripten-core/emscripten/issues/21414): + // Use inline field declarations. + this.shared = {}; + } + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode:class { + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; // root node sets parent to itself + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + this.readMode = 292/*292*/ | 73/*73*/; + this.writeMode = 146/*146*/; + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + + if (!path) return { path: '', node: null }; + + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + opts = Object.assign(defaults, opts) + + if (opts.recurse_count > 8) { // max recursive lookup of 8 + throw new FS.ErrnoError(32); + } + + // split the absolute path + var parts = path.split('/').filter((p) => !!p); + + // start at the root + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length-1); + if (islast && opts.parent) { + // stop resolving + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + + var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count + 1 }); + current = lookup.node; + + if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + throw new FS.ErrnoError(32); + } + } + } + } + + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length-1] !== '/' ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + + FS.hashAddNode(node); + + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ['r', 'w', 'rw'][flag & 3]; + if ((flag & 512)) { + perms += 'w'; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) { + } + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || // opening for write + (flags & 512)) { // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS:4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream:(fd) => FS.streams[fd], + createStream(stream, fd = -1) { + + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + chrdev_stream_ops:{ + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major:(dev) => ((dev) >> 8), + minor:(dev) => ((dev) & 0xff), + makedev:(ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice:(dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + + while (check.length) { + var m = check.pop(); + + mounts.push(m); + + check.push(...m.mounts); + } + + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + + FS.syncFSRequests++; + + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + }; + + // sync all mounts + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + mountpoint = lookup.path; // use the absolute path + node = lookup.node; + + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + + while (current) { + var next = current.name_next; + + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + + current = next; + } + }); + + // no longer a mountpoint + node.mounted = null; + + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438 /* 0666 */; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511 /* 0777 */; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch(e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438 /* 0666 */; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + // not fatal + } + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? + FS.mayDelete(new_dir, new_name, isdir) : + FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now() + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + // we ignore the uid / gid for now + }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open(path, flags, mode) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + mode = typeof mode == 'undefined' ? 438 /* 0666 */ : mode; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) { + // ignore + } + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else { + // node doesn't exist, try to create it + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 + && (flags & 2) === 0 + && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data)+1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd:() => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices() { + // create /dev + FS.mkdir('/dev'); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, 'fd', 16384 | 511 /* 0777 */, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; // make it look like a simple root node + return ret; + } + }; + return node; + } + }, {}, '/proc/self/fd'); + }, + createStandardStreams() { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (Module['stdin']) { + FS.createDevice('/dev', 'stdin', Module['stdin']); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (Module['stdout']) { + FS.createDevice('/dev', 'stdout', null, Module['stdout']); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (Module['stderr']) { + FS.createDevice('/dev', 'stderr', null, Module['stderr']); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + staticInit() { + // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info) + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + + FS.nameTable = new Array(4096); + + FS.mount(MEMFS, {}, '/'); + + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + + FS.filesystems = { + 'MEMFS': MEMFS, + }; + }, + init(input, output, error) { + FS.init.initialized = true; + + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + Module['stdin'] = input || Module['stdin']; + Module['stdout'] = output || Module['stdout']; + Module['stderr'] = error || Module['stderr']; + + FS.createStandardStreams(); + }, + quit() { + FS.init.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) { + } + var ret = { + isRoot: false, exists: false, error: 0, name: null, path: null, object: null, + parentExists: false, parentPath: null, parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + }; + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) { + // ignore EEXIST + } + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos /* ignored */) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset+i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset+i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != 'undefined') { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + // Command-line. + try { + // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as + // read() will try to parse UTF8. + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error('Cannot load without read() or XMLHttpRequest.'); + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + constructor() { + this.lengthKnown = false; + this.chunks = []; // Loaded chunks. Index is the chunk number + } + get(idx) { + if (idx > this.length-1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize)|0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + + var chunkSize = 1024*1024; // Chunk size in bytes + + if (!hasByteServing) chunkSize = datalength; + + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!"); + + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + + // Some hints to the browser that we want binary data. + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */(xhr.response || [])); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum+1) * chunkSize - 1; // including this byte + end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { return this.contents.length; } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) + return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position) + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + var SOCKFS = { + mount(mount) { + // If Module['websocket'] has already been defined (e.g. for configuring + // the subprotocol/url) use that, if not initialise it to a new object. + Module['websocket'] = (Module['websocket'] && + ('object' === typeof Module['websocket'])) ? Module['websocket'] : {}; + + // Add the Event registration mechanism to the exported websocket configuration + // object so we can register network callbacks from native JavaScript too. + // For more documentation see system/include/emscripten/emscripten.h + Module['websocket']._callbacks = {}; + Module['websocket']['on'] = /** @this{Object} */ function(event, callback) { + if ('function' === typeof callback) { + this._callbacks[event] = callback; + } + return this; + }; + + Module['websocket'].emit = /** @this{Object} */ function(event, param) { + if ('function' === typeof this._callbacks[event]) { + this._callbacks[event].call(this, param); + } + }; + + // If debug is enabled register simple default logging callbacks for each Event. + + return FS.createNode(null, '/', 16384 | 511 /* 0777 */, 0); + }, + createSocket(family, type, protocol) { + type &= ~526336; // Some applications may pass it; it makes no sense for a single process. + var streaming = type == 1; + if (streaming && protocol && protocol != 6) { + throw new FS.ErrnoError(66); // if SOCK_STREAM, must be tcp or 0. + } + + // create our internal socket structure + var sock = { + family, + type, + protocol, + server: null, + error: null, // Used in getsockopt for SOL_SOCKET/SO_ERROR test + peers: {}, + pending: [], + recv_queue: [], + sock_ops: SOCKFS.websocket_sock_ops + }; + + // create the filesystem node to store the socket structure + var name = SOCKFS.nextname(); + var node = FS.createNode(SOCKFS.root, name, 49152, 0); + node.sock = sock; + + // and the wrapping stream that enables library functions such + // as read and write to indirectly interact with the socket + var stream = FS.createStream({ + path: name, + node, + flags: 2, + seekable: false, + stream_ops: SOCKFS.stream_ops + }); + + // map the new stream to the socket structure (sockets have a 1:1 + // relationship with a stream) + sock.stream = stream; + + return sock; + }, + getSocket(fd) { + var stream = FS.getStream(fd); + if (!stream || !FS.isSocket(stream.node.mode)) { + return null; + } + return stream.node.sock; + }, + stream_ops:{ + poll(stream) { + var sock = stream.node.sock; + return sock.sock_ops.poll(sock); + }, + ioctl(stream, request, varargs) { + var sock = stream.node.sock; + return sock.sock_ops.ioctl(sock, request, varargs); + }, + read(stream, buffer, offset, length, position /* ignored */) { + var sock = stream.node.sock; + var msg = sock.sock_ops.recvmsg(sock, length); + if (!msg) { + // socket is closed + return 0; + } + buffer.set(msg.buffer, offset); + return msg.buffer.length; + }, + write(stream, buffer, offset, length, position /* ignored */) { + var sock = stream.node.sock; + return sock.sock_ops.sendmsg(sock, buffer, offset, length); + }, + close(stream) { + var sock = stream.node.sock; + sock.sock_ops.close(sock); + }, + }, + nextname() { + if (!SOCKFS.nextname.current) { + SOCKFS.nextname.current = 0; + } + return 'socket[' + (SOCKFS.nextname.current++) + ']'; + }, + websocket_sock_ops:{ + createPeer(sock, addr, port) { + var ws; + + if (typeof addr == 'object') { + ws = addr; + addr = null; + port = null; + } + + if (ws) { + // for sockets that've already connected (e.g. we're the server) + // we can inspect the _socket property for the address + if (ws._socket) { + addr = ws._socket.remoteAddress; + port = ws._socket.remotePort; + } + // if we're just now initializing a connection to the remote, + // inspect the url property + else { + var result = /ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url); + if (!result) { + throw new Error('WebSocket URL must be in the format ws(s)://address:port'); + } + addr = result[1]; + port = parseInt(result[2], 10); + } + } else { + // create the actual websocket object and connect + try { + // runtimeConfig gets set to true if WebSocket runtime configuration is available. + var runtimeConfig = (Module['websocket'] && ('object' === typeof Module['websocket'])); + + // The default value is 'ws://' the replace is needed because the compiler replaces '//' comments with '#' + // comments without checking context, so we'd end up with ws:#, the replace swaps the '#' for '//' again. + var url = 'ws:#'.replace('#', '//'); + + if (runtimeConfig) { + if ('string' === typeof Module['websocket']['url']) { + url = Module['websocket']['url']; // Fetch runtime WebSocket URL config. + } + } + + if (url === 'ws://' || url === 'wss://') { // Is the supplied URL config just a prefix, if so complete it. + var parts = addr.split('/'); + url = url + parts[0] + ":" + port + "/" + parts.slice(1).join('/'); + } + + // Make the WebSocket subprotocol (Sec-WebSocket-Protocol) default to binary if no configuration is set. + var subProtocols = 'binary'; // The default value is 'binary' + + if (runtimeConfig) { + if ('string' === typeof Module['websocket']['subprotocol']) { + subProtocols = Module['websocket']['subprotocol']; // Fetch runtime WebSocket subprotocol config. + } + } + + // The default WebSocket options + var opts = undefined; + + if (subProtocols !== 'null') { + // The regex trims the string (removes spaces at the beginning and end, then splits the string by + // , into an Array. Whitespace removal is important for Websockify and ws. + subProtocols = subProtocols.replace(/^ +| +$/g,"").split(/ *, */); + + opts = subProtocols; + } + + // some webservers (azure) does not support subprotocol header + if (runtimeConfig && null === Module['websocket']['subprotocol']) { + subProtocols = 'null'; + opts = undefined; + } + + // If node we use the ws library. + var WebSocketConstructor; + if (ENVIRONMENT_IS_NODE) { + WebSocketConstructor = /** @type{(typeof WebSocket)} */(require('ws')); + } else + { + WebSocketConstructor = WebSocket; + } + ws = new WebSocketConstructor(url, opts); + ws.binaryType = 'arraybuffer'; + } catch (e) { + throw new FS.ErrnoError(23); + } + } + + var peer = { + addr, + port, + socket: ws, + dgram_send_queue: [] + }; + + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + SOCKFS.websocket_sock_ops.handlePeerEvents(sock, peer); + + // if this is a bound dgram socket, send the port number first to allow + // us to override the ephemeral port reported to us by remotePort on the + // remote end. + if (sock.type === 2 && typeof sock.sport != 'undefined') { + peer.dgram_send_queue.push(new Uint8Array([ + 255, 255, 255, 255, + 'p'.charCodeAt(0), 'o'.charCodeAt(0), 'r'.charCodeAt(0), 't'.charCodeAt(0), + ((sock.sport & 0xff00) >> 8) , (sock.sport & 0xff) + ])); + } + + return peer; + }, + getPeer(sock, addr, port) { + return sock.peers[addr + ':' + port]; + }, + addPeer(sock, peer) { + sock.peers[peer.addr + ':' + peer.port] = peer; + }, + removePeer(sock, peer) { + delete sock.peers[peer.addr + ':' + peer.port]; + }, + handlePeerEvents(sock, peer) { + var first = true; + + var handleOpen = function () { + + Module['websocket'].emit('open', sock.stream.fd); + + try { + var queued = peer.dgram_send_queue.shift(); + while (queued) { + peer.socket.send(queued); + queued = peer.dgram_send_queue.shift(); + } + } catch (e) { + // not much we can do here in the way of proper error handling as we've already + // lied and said this data was sent. shut it down. + peer.socket.close(); + } + }; + + function handleMessage(data) { + if (typeof data == 'string') { + var encoder = new TextEncoder(); // should be utf-8 + data = encoder.encode(data); // make a typed array from the string + } else { + assert(data.byteLength !== undefined); // must receive an ArrayBuffer + if (data.byteLength == 0) { + // An empty ArrayBuffer will emit a pseudo disconnect event + // as recv/recvmsg will return zero which indicates that a socket + // has performed a shutdown although the connection has not been disconnected yet. + return; + } + data = new Uint8Array(data); // make a typed array view on the array buffer + } + + // if this is the port message, override the peer's port with it + var wasfirst = first; + first = false; + if (wasfirst && + data.length === 10 && + data[0] === 255 && data[1] === 255 && data[2] === 255 && data[3] === 255 && + data[4] === 'p'.charCodeAt(0) && data[5] === 'o'.charCodeAt(0) && data[6] === 'r'.charCodeAt(0) && data[7] === 't'.charCodeAt(0)) { + // update the peer's port and it's key in the peer map + var newport = ((data[8] << 8) | data[9]); + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + peer.port = newport; + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + return; + } + + sock.recv_queue.push({ addr: peer.addr, port: peer.port, data: data }); + Module['websocket'].emit('message', sock.stream.fd); + }; + + if (ENVIRONMENT_IS_NODE) { + peer.socket.on('open', handleOpen); + peer.socket.on('message', function(data, isBinary) { + if (!isBinary) { + return; + } + handleMessage((new Uint8Array(data)).buffer); // copy from node Buffer -> ArrayBuffer + }); + peer.socket.on('close', function() { + Module['websocket'].emit('close', sock.stream.fd); + }); + peer.socket.on('error', function(error) { + // Although the ws library may pass errors that may be more descriptive than + // ECONNREFUSED they are not necessarily the expected error code e.g. + // ENOTFOUND on getaddrinfo seems to be node.js specific, so using ECONNREFUSED + // is still probably the most useful thing to do. + sock.error = 14; // Used in getsockopt for SOL_SOCKET/SO_ERROR test. + Module['websocket'].emit('error', [sock.stream.fd, sock.error, 'ECONNREFUSED: Connection refused']); + // don't throw + }); + } else { + peer.socket.onopen = handleOpen; + peer.socket.onclose = function() { + Module['websocket'].emit('close', sock.stream.fd); + }; + peer.socket.onmessage = function peer_socket_onmessage(event) { + handleMessage(event.data); + }; + peer.socket.onerror = function(error) { + // The WebSocket spec only allows a 'simple event' to be thrown on error, + // so we only really know as much as ECONNREFUSED. + sock.error = 14; // Used in getsockopt for SOL_SOCKET/SO_ERROR test. + Module['websocket'].emit('error', [sock.stream.fd, sock.error, 'ECONNREFUSED: Connection refused']); + }; + } + }, + poll(sock) { + if (sock.type === 1 && sock.server) { + // listen sockets should only say they're available for reading + // if there are pending clients. + return sock.pending.length ? (64 | 1) : 0; + } + + var mask = 0; + var dest = sock.type === 1 ? // we only care about the socket state for connection-based sockets + SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport) : + null; + + if (sock.recv_queue.length || + !dest || // connection-less sockets are always ready to read + (dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED)) { // let recv return 0 once closed + mask |= (64 | 1); + } + + if (!dest || // connection-less sockets are always ready to write + (dest && dest.socket.readyState === dest.socket.OPEN)) { + mask |= 4; + } + + if ((dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED)) { + mask |= 16; + } + + return mask; + }, + ioctl(sock, request, arg) { + switch (request) { + case 21531: + var bytes = 0; + if (sock.recv_queue.length) { + bytes = sock.recv_queue[0].data.length; + } + HEAP32[((arg)>>2)] = bytes; + return 0; + default: + return 28; + } + }, + close(sock) { + // if we've spawned a listen server, close it + if (sock.server) { + try { + sock.server.close(); + } catch (e) { + } + sock.server = null; + } + // close any peer connections + var peers = Object.keys(sock.peers); + for (var i = 0; i < peers.length; i++) { + var peer = sock.peers[peers[i]]; + try { + peer.socket.close(); + } catch (e) { + } + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + } + return 0; + }, + bind(sock, addr, port) { + if (typeof sock.saddr != 'undefined' || typeof sock.sport != 'undefined') { + throw new FS.ErrnoError(28); // already bound + } + sock.saddr = addr; + sock.sport = port; + // in order to emulate dgram sockets, we need to launch a listen server when + // binding on a connection-less socket + // note: this is only required on the server side + if (sock.type === 2) { + // close the existing server if it exists + if (sock.server) { + sock.server.close(); + sock.server = null; + } + // swallow error operation not supported error that occurs when binding in the + // browser where this isn't supported + try { + sock.sock_ops.listen(sock, 0); + } catch (e) { + if (!(e.name === 'ErrnoError')) throw e; + if (e.errno !== 138) throw e; + } + } + }, + connect(sock, addr, port) { + if (sock.server) { + throw new FS.ErrnoError(138); + } + + // TODO autobind + // if (!sock.addr && sock.type == 2) { + // } + + // early out if we're already connected / in the middle of connecting + if (typeof sock.daddr != 'undefined' && typeof sock.dport != 'undefined') { + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport); + if (dest) { + if (dest.socket.readyState === dest.socket.CONNECTING) { + throw new FS.ErrnoError(7); + } else { + throw new FS.ErrnoError(30); + } + } + } + + // add the socket to our peer list and set our + // destination address / port to match + var peer = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port); + sock.daddr = peer.addr; + sock.dport = peer.port; + + // always "fail" in non-blocking mode + throw new FS.ErrnoError(26); + }, + listen(sock, backlog) { + if (!ENVIRONMENT_IS_NODE) { + throw new FS.ErrnoError(138); + } + if (sock.server) { + throw new FS.ErrnoError(28); // already listening + } + var WebSocketServer = require('ws').Server; + var host = sock.saddr; + sock.server = new WebSocketServer({ + host, + port: sock.sport + // TODO support backlog + }); + Module['websocket'].emit('listen', sock.stream.fd); // Send Event with listen fd. + + sock.server.on('connection', function(ws) { + if (sock.type === 1) { + var newsock = SOCKFS.createSocket(sock.family, sock.type, sock.protocol); + + // create a peer on the new socket + var peer = SOCKFS.websocket_sock_ops.createPeer(newsock, ws); + newsock.daddr = peer.addr; + newsock.dport = peer.port; + + // push to queue for accept to pick up + sock.pending.push(newsock); + Module['websocket'].emit('connection', newsock.stream.fd); + } else { + // create a peer on the listen socket so calling sendto + // with the listen socket and an address will resolve + // to the correct client + SOCKFS.websocket_sock_ops.createPeer(sock, ws); + Module['websocket'].emit('connection', sock.stream.fd); + } + }); + sock.server.on('close', function() { + Module['websocket'].emit('close', sock.stream.fd); + sock.server = null; + }); + sock.server.on('error', function(error) { + // Although the ws library may pass errors that may be more descriptive than + // ECONNREFUSED they are not necessarily the expected error code e.g. + // ENOTFOUND on getaddrinfo seems to be node.js specific, so using EHOSTUNREACH + // is still probably the most useful thing to do. This error shouldn't + // occur in a well written app as errors should get trapped in the compiled + // app's own getaddrinfo call. + sock.error = 23; // Used in getsockopt for SOL_SOCKET/SO_ERROR test. + Module['websocket'].emit('error', [sock.stream.fd, sock.error, 'EHOSTUNREACH: Host is unreachable']); + // don't throw + }); + }, + accept(listensock) { + if (!listensock.server || !listensock.pending.length) { + throw new FS.ErrnoError(28); + } + var newsock = listensock.pending.shift(); + newsock.stream.flags = listensock.stream.flags; + return newsock; + }, + getname(sock, peer) { + var addr, port; + if (peer) { + if (sock.daddr === undefined || sock.dport === undefined) { + throw new FS.ErrnoError(53); + } + addr = sock.daddr; + port = sock.dport; + } else { + // TODO saddr and sport will be set for bind()'d UDP sockets, but what + // should we be returning for TCP sockets that've been connect()'d? + addr = sock.saddr || 0; + port = sock.sport || 0; + } + return { addr, port }; + }, + sendmsg(sock, buffer, offset, length, addr, port) { + if (sock.type === 2) { + // connection-less sockets will honor the message address, + // and otherwise fall back to the bound destination address + if (addr === undefined || port === undefined) { + addr = sock.daddr; + port = sock.dport; + } + // if there was no address to fall back to, error out + if (addr === undefined || port === undefined) { + throw new FS.ErrnoError(17); + } + } else { + // connection-based sockets will only use the bound + addr = sock.daddr; + port = sock.dport; + } + + // find the peer for the destination address + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, addr, port); + + // early out if not connected with a connection-based socket + if (sock.type === 1) { + if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + throw new FS.ErrnoError(53); + } else if (dest.socket.readyState === dest.socket.CONNECTING) { + throw new FS.ErrnoError(6); + } + } + + // create a copy of the incoming data to send, as the WebSocket API + // doesn't work entirely with an ArrayBufferView, it'll just send + // the entire underlying buffer + if (ArrayBuffer.isView(buffer)) { + offset += buffer.byteOffset; + buffer = buffer.buffer; + } + + var data; + data = buffer.slice(offset, offset + length); + + // if we're emulating a connection-less dgram socket and don't have + // a cached connection, queue the buffer to send upon connect and + // lie, saying the data was sent now. + if (sock.type === 2) { + if (!dest || dest.socket.readyState !== dest.socket.OPEN) { + // if we're not connected, open a new connection + if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + dest = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port); + } + dest.dgram_send_queue.push(data); + return length; + } + } + + try { + // send the actual data + dest.socket.send(data); + return length; + } catch (e) { + throw new FS.ErrnoError(28); + } + }, + recvmsg(sock, length) { + // http://pubs.opengroup.org/onlinepubs/7908799/xns/recvmsg.html + if (sock.type === 1 && sock.server) { + // tcp servers should not be recv()'ing on the listen socket + throw new FS.ErrnoError(53); + } + + var queued = sock.recv_queue.shift(); + if (!queued) { + if (sock.type === 1) { + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport); + + if (!dest) { + // if we have a destination address but are not connected, error out + throw new FS.ErrnoError(53); + } + if (dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + // return null if the socket has closed + return null; + } + // else, our socket is in a valid state but truly has nothing available + throw new FS.ErrnoError(6); + } + throw new FS.ErrnoError(6); + } + + // queued.data will be an ArrayBuffer if it's unadulterated, but if it's + // requeued TCP data it'll be an ArrayBufferView + var queuedLength = queued.data.byteLength || queued.data.length; + var queuedOffset = queued.data.byteOffset || 0; + var queuedBuffer = queued.data.buffer || queued.data; + var bytesRead = Math.min(length, queuedLength); + var res = { + buffer: new Uint8Array(queuedBuffer, queuedOffset, bytesRead), + addr: queued.addr, + port: queued.port + }; + + // push back any unread data for TCP connections + if (sock.type === 1 && bytesRead < queuedLength) { + var bytesRemaining = queuedLength - bytesRead; + queued.data = new Uint8Array(queuedBuffer, queuedOffset + bytesRead, bytesRemaining); + sock.recv_queue.unshift(queued); + } + + return res; + }, + }, + }; + + var getSocketFromFD = (fd) => { + var socket = SOCKFS.getSocket(fd); + if (!socket) throw new FS.ErrnoError(8); + return socket; + }; + + var Sockets = { + BUFFER_SIZE:10240, + MAX_BUFFER_SIZE:10485760, + nextFd:1, + fds:{ + }, + nextport:1, + maxport:65535, + peer:null, + connections:{ + }, + portmap:{ + }, + localAddr:4261412874, + addrPool:[33554442,50331658,67108874,83886090,100663306,117440522,134217738,150994954,167772170,184549386,201326602,218103818,234881034], + }; + + var inetNtop4 = (addr) => { + return (addr & 0xff) + '.' + ((addr >> 8) & 0xff) + '.' + ((addr >> 16) & 0xff) + '.' + ((addr >> 24) & 0xff) + }; + + + var inetNtop6 = (ints) => { + // ref: http://www.ietf.org/rfc/rfc2373.txt - section 2.5.4 + // Format for IPv4 compatible and mapped 128-bit IPv6 Addresses + // 128-bits are split into eight 16-bit words + // stored in network byte order (big-endian) + // | 80 bits | 16 | 32 bits | + // +-----------------------------------------------------------------+ + // | 10 bytes | 2 | 4 bytes | + // +--------------------------------------+--------------------------+ + // + 5 words | 1 | 2 words | + // +--------------------------------------+--------------------------+ + // |0000..............................0000|0000| IPv4 ADDRESS | (compatible) + // +--------------------------------------+----+---------------------+ + // |0000..............................0000|FFFF| IPv4 ADDRESS | (mapped) + // +--------------------------------------+----+---------------------+ + var str = ""; + var word = 0; + var longest = 0; + var lastzero = 0; + var zstart = 0; + var len = 0; + var i = 0; + var parts = [ + ints[0] & 0xffff, + (ints[0] >> 16), + ints[1] & 0xffff, + (ints[1] >> 16), + ints[2] & 0xffff, + (ints[2] >> 16), + ints[3] & 0xffff, + (ints[3] >> 16) + ]; + + // Handle IPv4-compatible, IPv4-mapped, loopback and any/unspecified addresses + + var hasipv4 = true; + var v4part = ""; + // check if the 10 high-order bytes are all zeros (first 5 words) + for (i = 0; i < 5; i++) { + if (parts[i] !== 0) { hasipv4 = false; break; } + } + + if (hasipv4) { + // low-order 32-bits store an IPv4 address (bytes 13 to 16) (last 2 words) + v4part = inetNtop4(parts[6] | (parts[7] << 16)); + // IPv4-mapped IPv6 address if 16-bit value (bytes 11 and 12) == 0xFFFF (6th word) + if (parts[5] === -1) { + str = "::ffff:"; + str += v4part; + return str; + } + // IPv4-compatible IPv6 address if 16-bit value (bytes 11 and 12) == 0x0000 (6th word) + if (parts[5] === 0) { + str = "::"; + //special case IPv6 addresses + if (v4part === "0.0.0.0") v4part = ""; // any/unspecified address + if (v4part === "0.0.0.1") v4part = "1";// loopback address + str += v4part; + return str; + } + } + + // Handle all other IPv6 addresses + + // first run to find the longest contiguous zero words + for (word = 0; word < 8; word++) { + if (parts[word] === 0) { + if (word - lastzero > 1) { + len = 0; + } + lastzero = word; + len++; + } + if (len > longest) { + longest = len; + zstart = word - longest + 1; + } + } + + for (word = 0; word < 8; word++) { + if (longest > 1) { + // compress contiguous zeros - to produce "::" + if (parts[word] === 0 && word >= zstart && word < (zstart + longest) ) { + if (word === zstart) { + str += ":"; + if (zstart === 0) str += ":"; //leading zeros case + } + continue; + } + } + // converts 16-bit words from big-endian to little-endian before converting to hex string + str += Number(_ntohs(parts[word] & 0xffff)).toString(16); + str += word < 7 ? ":" : ""; + } + return str; + }; + + var readSockaddr = (sa, salen) => { + // family / port offsets are common to both sockaddr_in and sockaddr_in6 + var family = HEAP16[((sa)>>1)]; + var port = _ntohs(HEAPU16[(((sa)+(2))>>1)]); + var addr; + + switch (family) { + case 2: + if (salen !== 16) { + return { errno: 28 }; + } + addr = HEAP32[(((sa)+(4))>>2)]; + addr = inetNtop4(addr); + break; + case 10: + if (salen !== 28) { + return { errno: 28 }; + } + addr = [ + HEAP32[(((sa)+(8))>>2)], + HEAP32[(((sa)+(12))>>2)], + HEAP32[(((sa)+(16))>>2)], + HEAP32[(((sa)+(20))>>2)] + ]; + addr = inetNtop6(addr); + break; + default: + return { errno: 5 }; + } + + return { family: family, addr: addr, port: port }; + }; + + + var inetPton4 = (str) => { + var b = str.split('.'); + for (var i = 0; i < 4; i++) { + var tmp = Number(b[i]); + if (isNaN(tmp)) return null; + b[i] = tmp; + } + return (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) >>> 0; + }; + + + /** @suppress {checkTypes} */ + var jstoi_q = (str) => parseInt(str); + var inetPton6 = (str) => { + var words; + var w, offset, z, i; + /* http://home.deds.nl/~aeron/regex/ */ + var valid6regx = /^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i + var parts = []; + if (!valid6regx.test(str)) { + return null; + } + if (str === "::") { + return [0, 0, 0, 0, 0, 0, 0, 0]; + } + // Z placeholder to keep track of zeros when splitting the string on ":" + if (str.startsWith("::")) { + str = str.replace("::", "Z:"); // leading zeros case + } else { + str = str.replace("::", ":Z:"); + } + + if (str.indexOf(".") > 0) { + // parse IPv4 embedded stress + str = str.replace(new RegExp('[.]', 'g'), ":"); + words = str.split(":"); + words[words.length-4] = jstoi_q(words[words.length-4]) + jstoi_q(words[words.length-3])*256; + words[words.length-3] = jstoi_q(words[words.length-2]) + jstoi_q(words[words.length-1])*256; + words = words.slice(0, words.length-2); + } else { + words = str.split(":"); + } + + offset = 0; z = 0; + for (w=0; w < words.length; w++) { + if (typeof words[w] == 'string') { + if (words[w] === 'Z') { + // compressed zeros - write appropriate number of zero words + for (z = 0; z < (8 - words.length+1); z++) { + parts[w+z] = 0; + } + offset = z-1; + } else { + // parse hex to field to 16-bit value and write it in network byte-order + parts[w+offset] = _htons(parseInt(words[w],16)); + } + } else { + // parsed IPv4 words + parts[w+offset] = words[w]; + } + } + return [ + (parts[1] << 16) | parts[0], + (parts[3] << 16) | parts[2], + (parts[5] << 16) | parts[4], + (parts[7] << 16) | parts[6] + ]; + }; + var DNS = { + address_map:{ + id:1, + addrs:{ + }, + names:{ + }, + }, + lookup_name(name) { + // If the name is already a valid ipv4 / ipv6 address, don't generate a fake one. + var res = inetPton4(name); + if (res !== null) { + return name; + } + res = inetPton6(name); + if (res !== null) { + return name; + } + + // See if this name is already mapped. + var addr; + + if (DNS.address_map.addrs[name]) { + addr = DNS.address_map.addrs[name]; + } else { + var id = DNS.address_map.id++; + assert(id < 65535, 'exceeded max address mappings of 65535'); + + addr = '172.29.' + (id & 0xff) + '.' + (id & 0xff00); + + DNS.address_map.names[addr] = name; + DNS.address_map.addrs[name] = addr; + } + + return addr; + }, + lookup_addr(addr) { + if (DNS.address_map.names[addr]) { + return DNS.address_map.names[addr]; + } + + return null; + }, + }; + /** @param {boolean=} allowNull */ + var getSocketAddress = (addrp, addrlen, allowNull) => { + if (allowNull && addrp === 0) return null; + var info = readSockaddr(addrp, addrlen); + if (info.errno) throw new FS.ErrnoError(info.errno); + info.addr = DNS.lookup_addr(info.addr) || info.addr; + return info; + }; + function ___syscall_connect(fd, addr, addrlen, d1, d2, d3) { + try { + + var sock = getSocketFromFD(fd); + var info = getSocketAddress(addr, addrlen); + sock.sock_ops.connect(sock, info.addr, info.port); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + + + var SYSCALLS = { + DEFAULT_POLLMASK:5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44);; + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + var stat = func(path); + HEAP32[((buf)>>2)] = stat.dev; + HEAP32[(((buf)+(4))>>2)] = stat.mode; + HEAPU32[(((buf)+(8))>>2)] = stat.nlink; + HEAP32[(((buf)+(12))>>2)] = stat.uid; + HEAP32[(((buf)+(16))>>2)] = stat.gid; + HEAP32[(((buf)+(20))>>2)] = stat.rdev; + HEAP64[(((buf)+(24))>>3)] = BigInt(stat.size); + HEAP32[(((buf)+(32))>>2)] = 4096; + HEAP32[(((buf)+(36))>>2)] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf)+(40))>>3)] = BigInt(Math.floor(atime / 1000)); + HEAPU32[(((buf)+(48))>>2)] = (atime % 1000) * 1000; + HEAP64[(((buf)+(56))>>3)] = BigInt(Math.floor(mtime / 1000)); + HEAPU32[(((buf)+(64))>>2)] = (mtime % 1000) * 1000; + HEAP64[(((buf)+(72))>>3)] = BigInt(Math.floor(ctime / 1000)); + HEAPU32[(((buf)+(80))>>2)] = (ctime % 1000) * 1000; + HEAP64[(((buf)+(88))>>3)] = BigInt(stat.ino); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + varargs:undefined, + get() { + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = HEAP32[((+SYSCALLS.varargs)>>2)]; + SYSCALLS.varargs += 4; + return ret; + }, + getp() { return SYSCALLS.get() }, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + }; + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + // need a valid mode + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms /* otherwise, they've just passed F_OK */ && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var ___syscall_fadvise64 = (fd, offset, len, advice) => { + return 0; // your advice is important to us (but we can't use it) + }; + + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 12: { + var arg = SYSCALLS.getp(); + var offset = 0; + // We're always unlocked. + HEAP16[(((arg)+(offset))>>1)] = 2; + return 0; + } + case 13: + case 14: + return 0; // Pretend that the locking is successful. + } + return -28; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstat64(fd, buf) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_statfs64(path, size, buf) { + try { + + path = SYSCALLS.getStr(path); + // NOTE: None of the constants here are true. We're just returning safe and + // sane values. + HEAP32[(((buf)+(4))>>2)] = 4096; + HEAP32[(((buf)+(40))>>2)] = 4096; + HEAP32[(((buf)+(8))>>2)] = 1000000; + HEAP32[(((buf)+(12))>>2)] = 500000; + HEAP32[(((buf)+(16))>>2)] = 500000; + HEAP32[(((buf)+(20))>>2)] = FS.nextInode; + HEAP32[(((buf)+(24))>>2)] = 1000000; + HEAP32[(((buf)+(28))>>2)] = 42; + HEAP32[(((buf)+(44))>>2)] = 2; // ST_NOSUID + HEAP32[(((buf)+(36))>>2)] = 255; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstatfs64(fd, size, buf) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + return ___syscall_statfs64(0, size, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var MAX_INT53 = 9007199254740992; + + var MIN_INT53 = -9007199254740992; + var bigintToI53Checked = (num) => (num < MIN_INT53 || num > MAX_INT53) ? NaN : Number(num); + function ___syscall_ftruncate64(fd, length) { + length = bigintToI53Checked(length); + + + try { + + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + ; + } + + + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + function ___syscall_getcwd(buf, size) { + try { + + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + + function ___syscall_getdents64(fd, dirp, count) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd) + stream.getdents ||= FS.readdir(stream.path); + + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + + var idx = Math.floor(off / struct_size); + + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === '.') { + id = stream.node.id; + type = 4; // DT_DIR + } + else if (name === '..') { + var lookup = FS.lookupPath(stream.path, { parent: true }); + id = lookup.node.id; + type = 4; // DT_DIR + } + else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) ? 2 : // DT_CHR, character device. + FS.isDir(child.mode) ? 4 : // DT_DIR, directory. + FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link. + 8; // DT_REG, regular file. + } + HEAP64[((dirp + pos)>>3)] = BigInt(id); + HEAP64[(((dirp + pos)+(8))>>3)] = BigInt((idx + 1) * struct_size); + HEAP16[(((dirp + pos)+(16))>>1)] = 280; + HEAP8[(dirp + pos)+(18)] = type; + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = SYSCALLS.getp(); + HEAP32[((argp)>>2)] = termios.c_iflag || 0; + HEAP32[(((argp)+(4))>>2)] = termios.c_oflag || 0; + HEAP32[(((argp)+(8))>>2)] = termios.c_cflag || 0; + HEAP32[(((argp)+(12))>>2)] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[(argp + i)+(17)] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; // no-op, not actually adjusting terminal settings + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = SYSCALLS.getp(); + var c_iflag = HEAP32[((argp)>>2)]; + var c_oflag = HEAP32[(((argp)+(4))>>2)]; + var c_cflag = HEAP32[(((argp)+(8))>>2)]; + var c_lflag = HEAP32[(((argp)+(12))>>2)]; + var c_cc = [] + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[(argp + i)+(17)]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { c_iflag, c_oflag, c_cflag, c_lflag, c_cc }); + } + return 0; // no-op, not actually adjusting terminal settings + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.getp(); + HEAP32[((argp)>>2)] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; // not supported + } + case 21531: { + var argp = SYSCALLS.getp(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = SYSCALLS.getp(); + HEAP16[((argp)>>1)] = winsize[0]; + HEAP16[(((argp)+(2))>>1)] = winsize[1]; + } + return 0; + } + case 21524: { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: return -28; // not supported + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_lstat64(path, buf) { + try { + + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? SYSCALLS.get() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + + + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf+len]; + stringToUTF8(ret, buf, bufsize+1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + HEAP8[buf+len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + + function ___syscall_sendto(fd, message, length, flags, addr, addr_len) { + try { + + var sock = getSocketFromFD(fd); + var dest = getSocketAddress(addr, addr_len, true); + if (!dest) { + // send, no address provided + return FS.write(sock.stream, HEAP8, message, length); + } + // sendto an address + return sock.sock_ops.sendmsg(sock, HEAP8, message, length, dest.addr, dest.port); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_socket(domain, type, protocol) { + try { + + var sock = SOCKFS.createSocket(domain, type, protocol); + return sock.stream.fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_stat64(path, buf) { + try { + + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_unlinkat(dirfd, path, flags) { + try { + + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var nowIsMonotonic = 1; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + + function __gmtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + + var date = new Date(time * 1000); + HEAP32[((tmPtr)>>2)] = date.getUTCSeconds(); + HEAP32[(((tmPtr)+(4))>>2)] = date.getUTCMinutes(); + HEAP32[(((tmPtr)+(8))>>2)] = date.getUTCHours(); + HEAP32[(((tmPtr)+(12))>>2)] = date.getUTCDate(); + HEAP32[(((tmPtr)+(16))>>2)] = date.getUTCMonth(); + HEAP32[(((tmPtr)+(20))>>2)] = date.getUTCFullYear()-1900; + HEAP32[(((tmPtr)+(24))>>2)] = date.getUTCDay(); + var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0); + var yday = ((date.getTime() - start) / (1000 * 60 * 60 * 24))|0; + HEAP32[(((tmPtr)+(28))>>2)] = yday; + ; + } + + var isLeapYear = (year) => year%4 === 0 && (year%100 !== 0 || year%400 === 0); + + var MONTH_DAYS_LEAP_CUMULATIVE = [0,31,60,91,121,152,182,213,244,274,305,335]; + + var MONTH_DAYS_REGULAR_CUMULATIVE = [0,31,59,90,120,151,181,212,243,273,304,334]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; // -1 since it's days since Jan 1 + + return yday; + }; + + function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + + var date = new Date(time*1000); + HEAP32[((tmPtr)>>2)] = date.getSeconds(); + HEAP32[(((tmPtr)+(4))>>2)] = date.getMinutes(); + HEAP32[(((tmPtr)+(8))>>2)] = date.getHours(); + HEAP32[(((tmPtr)+(12))>>2)] = date.getDate(); + HEAP32[(((tmPtr)+(16))>>2)] = date.getMonth(); + HEAP32[(((tmPtr)+(20))>>2)] = date.getFullYear()-1900; + HEAP32[(((tmPtr)+(24))>>2)] = date.getDay(); + + var yday = ydayFromDate(date)|0; + HEAP32[(((tmPtr)+(28))>>2)] = yday; + HEAP32[(((tmPtr)+(36))>>2)] = -(date.getTimezoneOffset() * 60); + + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset))|0; + HEAP32[(((tmPtr)+(32))>>2)] = dst; + ; + } + + + + + + + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + offset = bigintToI53Checked(offset); + + + try { + + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[((allocated)>>2)] = res.allocated; + HEAPU32[((addr)>>2)] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + ; + } + + + function __munmap_js(addr, len, prot, flags, fd, offset) { + offset = bigintToI53Checked(offset); + + + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + ; + } + + var __tzset_js = (timezone, daylight, std_name, dst_name) => { + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60; + + HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset); + + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + }; + var winterName = extractZone(winter); + var summerName = extractZone(summer); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 7); + stringToUTF8(summerName, dst_name, 7); + } else { + stringToUTF8(winterName, dst_name, 7); + stringToUTF8(summerName, std_name, 7); + } + }; + + var _abort = () => { + abort(''); + }; + + var _emscripten_date_now = () => Date.now(); + + + var runtimeKeepaliveCounter = 0; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module['onExit']?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + + /** @suppress {duplicate } */ + /** @param {boolean|number=} implicit */ + var exitJS = (status, implicit) => { + EXITSTATUS = status; + + if (!keepRuntimeAlive()) { + exitRuntime(); + } + + _proc_exit(status); + }; + var _exit = exitJS; + + var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + }; + + var _emscripten_force_exit = (status) => { + __emscripten_runtime_keepalive_clear(); + _exit(status); + }; + Module['_emscripten_force_exit'] = _emscripten_force_exit; + + var getHeapMax = () => + // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate + // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side + // for any code that deals with heap sizes, which would require special + // casing all heap size related code to treat 0 specially. + 2147483648; + var _emscripten_get_heap_max = () => getHeapMax(); + + var _emscripten_get_now; + // Modern environment where performance.now() is supported: + // N.B. a shorter form "_emscripten_get_now = performance.now;" is + // unfortunately not allowed even in current browsers (e.g. FF Nightly 75). + _emscripten_get_now = () => performance.now(); + ; + + var _emscripten_get_now_res = () => { // return resolution of get_now, in nanoseconds + if (ENVIRONMENT_IS_NODE) { + return 1; // nanoseconds + } + // Modern environment where performance.now() is supported: + return 1000; // microseconds (1/1000 of a millisecond) + }; + + var webgl_enable_ANGLE_instanced_arrays = (ctx) => { + // Extension available in WebGL 1 from Firefox 26 and Google Chrome 30 onwards. Core feature in WebGL 2. + var ext = ctx.getExtension('ANGLE_instanced_arrays'); + if (ext) { + ctx['vertexAttribDivisor'] = (index, divisor) => ext['vertexAttribDivisorANGLE'](index, divisor); + ctx['drawArraysInstanced'] = (mode, first, count, primcount) => ext['drawArraysInstancedANGLE'](mode, first, count, primcount); + ctx['drawElementsInstanced'] = (mode, count, type, indices, primcount) => ext['drawElementsInstancedANGLE'](mode, count, type, indices, primcount); + return 1; + } + }; + + var webgl_enable_OES_vertex_array_object = (ctx) => { + // Extension available in WebGL 1 from Firefox 25 and WebKit 536.28/desktop Safari 6.0.3 onwards. Core feature in WebGL 2. + var ext = ctx.getExtension('OES_vertex_array_object'); + if (ext) { + ctx['createVertexArray'] = () => ext['createVertexArrayOES'](); + ctx['deleteVertexArray'] = (vao) => ext['deleteVertexArrayOES'](vao); + ctx['bindVertexArray'] = (vao) => ext['bindVertexArrayOES'](vao); + ctx['isVertexArray'] = (vao) => ext['isVertexArrayOES'](vao); + return 1; + } + }; + + var webgl_enable_WEBGL_draw_buffers = (ctx) => { + // Extension available in WebGL 1 from Firefox 28 onwards. Core feature in WebGL 2. + var ext = ctx.getExtension('WEBGL_draw_buffers'); + if (ext) { + ctx['drawBuffers'] = (n, bufs) => ext['drawBuffersWEBGL'](n, bufs); + return 1; + } + }; + + var webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance = (ctx) => + // Closure is expected to be allowed to minify the '.dibvbi' property, so not accessing it quoted. + !!(ctx.dibvbi = ctx.getExtension('WEBGL_draw_instanced_base_vertex_base_instance')); + + var webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance = (ctx) => { + // Closure is expected to be allowed to minify the '.mdibvbi' property, so not accessing it quoted. + return !!(ctx.mdibvbi = ctx.getExtension('WEBGL_multi_draw_instanced_base_vertex_base_instance')); + }; + + var webgl_enable_WEBGL_multi_draw = (ctx) => { + // Closure is expected to be allowed to minify the '.multiDrawWebgl' property, so not accessing it quoted. + return !!(ctx.multiDrawWebgl = ctx.getExtension('WEBGL_multi_draw')); + }; + + var getEmscriptenSupportedExtensions = (ctx) => { + // Restrict the list of advertised extensions to those that we actually + // support. + var supportedExtensions = [ + // WebGL 1 extensions + 'ANGLE_instanced_arrays', + 'EXT_blend_minmax', + 'EXT_disjoint_timer_query', + 'EXT_frag_depth', + 'EXT_shader_texture_lod', + 'EXT_sRGB', + 'OES_element_index_uint', + 'OES_fbo_render_mipmap', + 'OES_standard_derivatives', + 'OES_texture_float', + 'OES_texture_half_float', + 'OES_texture_half_float_linear', + 'OES_vertex_array_object', + 'WEBGL_color_buffer_float', + 'WEBGL_depth_texture', + 'WEBGL_draw_buffers', + // WebGL 2 extensions + 'EXT_color_buffer_float', + 'EXT_conservative_depth', + 'EXT_disjoint_timer_query_webgl2', + 'EXT_texture_norm16', + 'NV_shader_noperspective_interpolation', + 'WEBGL_clip_cull_distance', + // WebGL 1 and WebGL 2 extensions + 'EXT_color_buffer_half_float', + 'EXT_depth_clamp', + 'EXT_float_blend', + 'EXT_texture_compression_bptc', + 'EXT_texture_compression_rgtc', + 'EXT_texture_filter_anisotropic', + 'KHR_parallel_shader_compile', + 'OES_texture_float_linear', + 'WEBGL_blend_func_extended', + 'WEBGL_compressed_texture_astc', + 'WEBGL_compressed_texture_etc', + 'WEBGL_compressed_texture_etc1', + 'WEBGL_compressed_texture_s3tc', + 'WEBGL_compressed_texture_s3tc_srgb', + 'WEBGL_debug_renderer_info', + 'WEBGL_debug_shaders', + 'WEBGL_lose_context', + 'WEBGL_multi_draw', + ]; + // .getSupportedExtensions() can return null if context is lost, so coerce to empty array. + return (ctx.getSupportedExtensions() || []).filter(ext => supportedExtensions.includes(ext)); + }; + + + var GL = { + counter:1, + buffers:[], + programs:[], + framebuffers:[], + renderbuffers:[], + textures:[], + shaders:[], + vaos:[], + contexts:[], + offscreenCanvases:{ + }, + queries:[], + samplers:[], + transformFeedbacks:[], + syncs:[], + stringCache:{ + }, + stringiCache:{ + }, + unpackAlignment:4, + recordError:(errorCode) => { + if (!GL.lastError) { + GL.lastError = errorCode; + } + }, + getNewId:(table) => { + var ret = GL.counter++; + for (var i = table.length; i < ret; i++) { + table[i] = null; + } + return ret; + }, + genObject:(n, buffers, createFunction, objectTable + ) => { + for (var i = 0; i < n; i++) { + var buffer = GLctx[createFunction](); + var id = buffer && GL.getNewId(objectTable); + if (buffer) { + buffer.name = id; + objectTable[id] = buffer; + } else { + GL.recordError(0x502 /* GL_INVALID_OPERATION */); + } + HEAP32[(((buffers)+(i*4))>>2)] = id; + } + }, + getSource:(shader, count, string, length) => { + var source = ''; + for (var i = 0; i < count; ++i) { + var len = length ? HEAPU32[(((length)+(i*4))>>2)] : undefined; + source += UTF8ToString(HEAPU32[(((string)+(i*4))>>2)], len); + } + return source; + }, + createContext:(/** @type {HTMLCanvasElement} */ canvas, webGLContextAttributes) => { + + // BUG: Workaround Safari WebGL issue: After successfully acquiring WebGL + // context on a canvas, calling .getContext() will always return that + // context independent of which 'webgl' or 'webgl2' + // context version was passed. See: + // https://bugs.webkit.org/show_bug.cgi?id=222758 + // and: + // https://github.com/emscripten-core/emscripten/issues/13295. + // TODO: Once the bug is fixed and shipped in Safari, adjust the Safari + // version field in above check. + if (!canvas.getContextSafariWebGL2Fixed) { + canvas.getContextSafariWebGL2Fixed = canvas.getContext; + /** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (Object|null)} */ + function fixedGetContext(ver, attrs) { + var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs); + return ((ver == 'webgl') == (gl instanceof WebGLRenderingContext)) ? gl : null; + } + canvas.getContext = fixedGetContext; + } + + var ctx = + (webGLContextAttributes.majorVersion > 1) + ? + canvas.getContext("webgl2", webGLContextAttributes) + : + (canvas.getContext("webgl", webGLContextAttributes) + // https://caniuse.com/#feat=webgl + ); + + if (!ctx) return 0; + + var handle = GL.registerContext(ctx, webGLContextAttributes); + + return handle; + }, + registerContext:(ctx, webGLContextAttributes) => { + // without pthreads a context is just an integer ID + var handle = GL.getNewId(GL.contexts); + + var context = { + handle, + attributes: webGLContextAttributes, + version: webGLContextAttributes.majorVersion, + GLctx: ctx + }; + + // Store the created context object so that we can access the context + // given a canvas without having to pass the parameters again. + if (ctx.canvas) ctx.canvas.GLctxObject = context; + GL.contexts[handle] = context; + if (typeof webGLContextAttributes.enableExtensionsByDefault == 'undefined' || webGLContextAttributes.enableExtensionsByDefault) { + GL.initExtensions(context); + } + + return handle; + }, + makeContextCurrent:(contextHandle) => { + + // Active Emscripten GL layer context object. + GL.currentContext = GL.contexts[contextHandle]; + // Active WebGL context object. + Module.ctx = GLctx = GL.currentContext?.GLctx; + return !(contextHandle && !GLctx); + }, + getContext:(contextHandle) => { + return GL.contexts[contextHandle]; + }, + deleteContext:(contextHandle) => { + if (GL.currentContext === GL.contexts[contextHandle]) { + GL.currentContext = null; + } + if (typeof JSEvents == 'object') { + // Release all JS event handlers on the DOM element that the GL context is + // associated with since the context is now deleted. + JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas); + } + // Make sure the canvas object no longer refers to the context object so + // there are no GC surprises. + if (GL.contexts[contextHandle] && GL.contexts[contextHandle].GLctx.canvas) { + GL.contexts[contextHandle].GLctx.canvas.GLctxObject = undefined; + } + GL.contexts[contextHandle] = null; + }, + initExtensions:(context) => { + // If this function is called without a specific context object, init the + // extensions of the currently active context. + context ||= GL.currentContext; + + if (context.initExtensionsDone) return; + context.initExtensionsDone = true; + + var GLctx = context.GLctx; + + // Detect the presence of a few extensions manually, ction GL interop + // layer itself will need to know if they exist. + + // Extensions that are only available in WebGL 1 (the calls will be no-ops + // if called on a WebGL 2 context active) + webgl_enable_ANGLE_instanced_arrays(GLctx); + webgl_enable_OES_vertex_array_object(GLctx); + webgl_enable_WEBGL_draw_buffers(GLctx); + // Extensions that are available from WebGL >= 2 (no-op if called on a WebGL 1 context active) + webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(GLctx); + webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(GLctx); + + // On WebGL 2, EXT_disjoint_timer_query is replaced with an alternative + // that's based on core APIs, and exposes only the queryCounterEXT() + // entrypoint. + if (context.version >= 2) { + GLctx.disjointTimerQueryExt = GLctx.getExtension("EXT_disjoint_timer_query_webgl2"); + } + + // However, Firefox exposes the WebGL 1 version on WebGL 2 as well and + // thus we look for the WebGL 1 version again if the WebGL 2 version + // isn't present. https://bugzilla.mozilla.org/show_bug.cgi?id=1328882 + if (context.version < 2 || !GLctx.disjointTimerQueryExt) + { + GLctx.disjointTimerQueryExt = GLctx.getExtension("EXT_disjoint_timer_query"); + } + + webgl_enable_WEBGL_multi_draw(GLctx); + + getEmscriptenSupportedExtensions(GLctx).forEach((ext) => { + // WEBGL_lose_context, WEBGL_debug_renderer_info and WEBGL_debug_shaders + // are not enabled by default. + if (!ext.includes('lose_context') && !ext.includes('debug')) { + // Call .getExtension() to enable that extension permanently. + GLctx.getExtension(ext); + } + }); + }, + }; + /** @suppress {duplicate } */ + var _glActiveTexture = (x0) => GLctx.activeTexture(x0); + var _emscripten_glActiveTexture = _glActiveTexture; + + /** @suppress {duplicate } */ + var _glAttachShader = (program, shader) => { + GLctx.attachShader(GL.programs[program], GL.shaders[shader]); + }; + var _emscripten_glAttachShader = _glAttachShader; + + /** @suppress {duplicate } */ + var _glBeginQuery = (target, id) => { + GLctx.beginQuery(target, GL.queries[id]); + }; + var _emscripten_glBeginQuery = _glBeginQuery; + + /** @suppress {duplicate } */ + var _glBeginQueryEXT = (target, id) => { + GLctx.disjointTimerQueryExt['beginQueryEXT'](target, GL.queries[id]); + }; + var _emscripten_glBeginQueryEXT = _glBeginQueryEXT; + + /** @suppress {duplicate } */ + var _glBeginTransformFeedback = (x0) => GLctx.beginTransformFeedback(x0); + var _emscripten_glBeginTransformFeedback = _glBeginTransformFeedback; + + + /** @suppress {duplicate } */ + var _glBindAttribLocation = (program, index, name) => { + GLctx.bindAttribLocation(GL.programs[program], index, UTF8ToString(name)); + }; + var _emscripten_glBindAttribLocation = _glBindAttribLocation; + + /** @suppress {duplicate } */ + var _glBindBuffer = (target, buffer) => { + + if (target == 0x88EB /*GL_PIXEL_PACK_BUFFER*/) { + // In WebGL 2 glReadPixels entry point, we need to use a different WebGL 2 + // API function call when a buffer is bound to + // GL_PIXEL_PACK_BUFFER_BINDING point, so must keep track whether that + // binding point is non-null to know what is the proper API function to + // call. + GLctx.currentPixelPackBufferBinding = buffer; + } else if (target == 0x88EC /*GL_PIXEL_UNPACK_BUFFER*/) { + // In WebGL 2 gl(Compressed)Tex(Sub)Image[23]D entry points, we need to + // use a different WebGL 2 API function call when a buffer is bound to + // GL_PIXEL_UNPACK_BUFFER_BINDING point, so must keep track whether that + // binding point is non-null to know what is the proper API function to + // call. + GLctx.currentPixelUnpackBufferBinding = buffer; + } + GLctx.bindBuffer(target, GL.buffers[buffer]); + }; + var _emscripten_glBindBuffer = _glBindBuffer; + + /** @suppress {duplicate } */ + var _glBindBufferBase = (target, index, buffer) => { + GLctx.bindBufferBase(target, index, GL.buffers[buffer]); + }; + var _emscripten_glBindBufferBase = _glBindBufferBase; + + /** @suppress {duplicate } */ + var _glBindBufferRange = (target, index, buffer, offset, ptrsize) => { + GLctx.bindBufferRange(target, index, GL.buffers[buffer], offset, ptrsize); + }; + var _emscripten_glBindBufferRange = _glBindBufferRange; + + /** @suppress {duplicate } */ + var _glBindFramebuffer = (target, framebuffer) => { + + GLctx.bindFramebuffer(target, GL.framebuffers[framebuffer]); + + }; + var _emscripten_glBindFramebuffer = _glBindFramebuffer; + + /** @suppress {duplicate } */ + var _glBindRenderbuffer = (target, renderbuffer) => { + GLctx.bindRenderbuffer(target, GL.renderbuffers[renderbuffer]); + }; + var _emscripten_glBindRenderbuffer = _glBindRenderbuffer; + + /** @suppress {duplicate } */ + var _glBindSampler = (unit, sampler) => { + GLctx.bindSampler(unit, GL.samplers[sampler]); + }; + var _emscripten_glBindSampler = _glBindSampler; + + /** @suppress {duplicate } */ + var _glBindTexture = (target, texture) => { + GLctx.bindTexture(target, GL.textures[texture]); + }; + var _emscripten_glBindTexture = _glBindTexture; + + /** @suppress {duplicate } */ + var _glBindTransformFeedback = (target, id) => { + GLctx.bindTransformFeedback(target, GL.transformFeedbacks[id]); + }; + var _emscripten_glBindTransformFeedback = _glBindTransformFeedback; + + /** @suppress {duplicate } */ + var _glBindVertexArray = (vao) => { + GLctx.bindVertexArray(GL.vaos[vao]); + }; + var _emscripten_glBindVertexArray = _glBindVertexArray; + + + /** @suppress {duplicate } */ + var _glBindVertexArrayOES = _glBindVertexArray; + var _emscripten_glBindVertexArrayOES = _glBindVertexArrayOES; + + /** @suppress {duplicate } */ + var _glBlendColor = (x0, x1, x2, x3) => GLctx.blendColor(x0, x1, x2, x3); + var _emscripten_glBlendColor = _glBlendColor; + + /** @suppress {duplicate } */ + var _glBlendEquation = (x0) => GLctx.blendEquation(x0); + var _emscripten_glBlendEquation = _glBlendEquation; + + /** @suppress {duplicate } */ + var _glBlendEquationSeparate = (x0, x1) => GLctx.blendEquationSeparate(x0, x1); + var _emscripten_glBlendEquationSeparate = _glBlendEquationSeparate; + + /** @suppress {duplicate } */ + var _glBlendFunc = (x0, x1) => GLctx.blendFunc(x0, x1); + var _emscripten_glBlendFunc = _glBlendFunc; + + /** @suppress {duplicate } */ + var _glBlendFuncSeparate = (x0, x1, x2, x3) => GLctx.blendFuncSeparate(x0, x1, x2, x3); + var _emscripten_glBlendFuncSeparate = _glBlendFuncSeparate; + + /** @suppress {duplicate } */ + var _glBlitFramebuffer = (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) => GLctx.blitFramebuffer(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); + var _emscripten_glBlitFramebuffer = _glBlitFramebuffer; + + /** @suppress {duplicate } */ + var _glBufferData = (target, size, data, usage) => { + + if (GL.currentContext.version >= 2) { + // If size is zero, WebGL would interpret uploading the whole input + // arraybuffer (starting from given offset), which would not make sense in + // WebAssembly, so avoid uploading if size is zero. However we must still + // call bufferData to establish a backing storage of zero bytes. + if (data && size) { + GLctx.bufferData(target, HEAPU8, usage, data, size); + } else { + GLctx.bufferData(target, size, usage); + } + return; + } + // N.b. here first form specifies a heap subarray, second form an integer + // size, so the ?: code here is polymorphic. It is advised to avoid + // randomly mixing both uses in calling code, to avoid any potential JS + // engine JIT issues. + GLctx.bufferData(target, data ? HEAPU8.subarray(data, data+size) : size, usage); + }; + var _emscripten_glBufferData = _glBufferData; + + /** @suppress {duplicate } */ + var _glBufferSubData = (target, offset, size, data) => { + if (GL.currentContext.version >= 2) { + size && GLctx.bufferSubData(target, offset, HEAPU8, data, size); + return; + } + GLctx.bufferSubData(target, offset, HEAPU8.subarray(data, data+size)); + }; + var _emscripten_glBufferSubData = _glBufferSubData; + + /** @suppress {duplicate } */ + var _glCheckFramebufferStatus = (x0) => GLctx.checkFramebufferStatus(x0); + var _emscripten_glCheckFramebufferStatus = _glCheckFramebufferStatus; + + /** @suppress {duplicate } */ + var _glClear = (x0) => GLctx.clear(x0); + var _emscripten_glClear = _glClear; + + /** @suppress {duplicate } */ + var _glClearBufferfi = (x0, x1, x2, x3) => GLctx.clearBufferfi(x0, x1, x2, x3); + var _emscripten_glClearBufferfi = _glClearBufferfi; + + /** @suppress {duplicate } */ + var _glClearBufferfv = (buffer, drawbuffer, value) => { + + GLctx.clearBufferfv(buffer, drawbuffer, HEAPF32, ((value)>>2)); + }; + var _emscripten_glClearBufferfv = _glClearBufferfv; + + /** @suppress {duplicate } */ + var _glClearBufferiv = (buffer, drawbuffer, value) => { + + GLctx.clearBufferiv(buffer, drawbuffer, HEAP32, ((value)>>2)); + }; + var _emscripten_glClearBufferiv = _glClearBufferiv; + + /** @suppress {duplicate } */ + var _glClearBufferuiv = (buffer, drawbuffer, value) => { + + GLctx.clearBufferuiv(buffer, drawbuffer, HEAPU32, ((value)>>2)); + }; + var _emscripten_glClearBufferuiv = _glClearBufferuiv; + + /** @suppress {duplicate } */ + var _glClearColor = (x0, x1, x2, x3) => GLctx.clearColor(x0, x1, x2, x3); + var _emscripten_glClearColor = _glClearColor; + + /** @suppress {duplicate } */ + var _glClearDepthf = (x0) => GLctx.clearDepth(x0); + var _emscripten_glClearDepthf = _glClearDepthf; + + /** @suppress {duplicate } */ + var _glClearStencil = (x0) => GLctx.clearStencil(x0); + var _emscripten_glClearStencil = _glClearStencil; + + /** @suppress {duplicate } */ + var _glClientWaitSync = (sync, flags, timeout) => { + // WebGL2 vs GLES3 differences: in GLES3, the timeout parameter is a uint64, where 0xFFFFFFFFFFFFFFFFULL means GL_TIMEOUT_IGNORED. + // In JS, there's no 64-bit value types, so instead timeout is taken to be signed, and GL_TIMEOUT_IGNORED is given value -1. + // Inherently the value accepted in the timeout is lossy, and can't take in arbitrary u64 bit pattern (but most likely doesn't matter) + // See https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.15 + timeout = Number(timeout); + return GLctx.clientWaitSync(GL.syncs[sync], flags, timeout); + }; + var _emscripten_glClientWaitSync = _glClientWaitSync; + + /** @suppress {duplicate } */ + var _glColorMask = (red, green, blue, alpha) => { + GLctx.colorMask(!!red, !!green, !!blue, !!alpha); + }; + var _emscripten_glColorMask = _glColorMask; + + /** @suppress {duplicate } */ + var _glCompileShader = (shader) => { + GLctx.compileShader(GL.shaders[shader]); + }; + var _emscripten_glCompileShader = _glCompileShader; + + /** @suppress {duplicate } */ + var _glCompressedTexImage2D = (target, level, internalFormat, width, height, border, imageSize, data) => { + if (GL.currentContext.version >= 2) { + if (GLctx.currentPixelUnpackBufferBinding || !imageSize) { + GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data); + return; + } + GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, HEAPU8, data, imageSize); + return; + } + GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, data ? HEAPU8.subarray((data), data+imageSize) : null); + }; + var _emscripten_glCompressedTexImage2D = _glCompressedTexImage2D; + + /** @suppress {duplicate } */ + var _glCompressedTexImage3D = (target, level, internalFormat, width, height, depth, border, imageSize, data) => { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.compressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, data); + } else { + GLctx.compressedTexImage3D(target, level, internalFormat, width, height, depth, border, HEAPU8, data, imageSize); + } + }; + var _emscripten_glCompressedTexImage3D = _glCompressedTexImage3D; + + /** @suppress {duplicate } */ + var _glCompressedTexSubImage2D = (target, level, xoffset, yoffset, width, height, format, imageSize, data) => { + if (GL.currentContext.version >= 2) { + if (GLctx.currentPixelUnpackBufferBinding || !imageSize) { + GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); + return; + } + GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, HEAPU8, data, imageSize); + return; + } + GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data ? HEAPU8.subarray((data), data+imageSize) : null); + }; + var _emscripten_glCompressedTexSubImage2D = _glCompressedTexSubImage2D; + + /** @suppress {duplicate } */ + var _glCompressedTexSubImage3D = (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data) => { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + } else { + GLctx.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, HEAPU8, data, imageSize); + } + }; + var _emscripten_glCompressedTexSubImage3D = _glCompressedTexSubImage3D; + + /** @suppress {duplicate } */ + var _glCopyBufferSubData = (x0, x1, x2, x3, x4) => GLctx.copyBufferSubData(x0, x1, x2, x3, x4); + var _emscripten_glCopyBufferSubData = _glCopyBufferSubData; + + /** @suppress {duplicate } */ + var _glCopyTexImage2D = (x0, x1, x2, x3, x4, x5, x6, x7) => GLctx.copyTexImage2D(x0, x1, x2, x3, x4, x5, x6, x7); + var _emscripten_glCopyTexImage2D = _glCopyTexImage2D; + + /** @suppress {duplicate } */ + var _glCopyTexSubImage2D = (x0, x1, x2, x3, x4, x5, x6, x7) => GLctx.copyTexSubImage2D(x0, x1, x2, x3, x4, x5, x6, x7); + var _emscripten_glCopyTexSubImage2D = _glCopyTexSubImage2D; + + /** @suppress {duplicate } */ + var _glCopyTexSubImage3D = (x0, x1, x2, x3, x4, x5, x6, x7, x8) => GLctx.copyTexSubImage3D(x0, x1, x2, x3, x4, x5, x6, x7, x8); + var _emscripten_glCopyTexSubImage3D = _glCopyTexSubImage3D; + + /** @suppress {duplicate } */ + var _glCreateProgram = () => { + var id = GL.getNewId(GL.programs); + var program = GLctx.createProgram(); + // Store additional information needed for each shader program: + program.name = id; + // Lazy cache results of + // glGetProgramiv(GL_ACTIVE_UNIFORM_MAX_LENGTH/GL_ACTIVE_ATTRIBUTE_MAX_LENGTH/GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH) + program.maxUniformLength = program.maxAttributeLength = program.maxUniformBlockNameLength = 0; + program.uniformIdCounter = 1; + GL.programs[id] = program; + return id; + }; + var _emscripten_glCreateProgram = _glCreateProgram; + + /** @suppress {duplicate } */ + var _glCreateShader = (shaderType) => { + var id = GL.getNewId(GL.shaders); + GL.shaders[id] = GLctx.createShader(shaderType); + + return id; + }; + var _emscripten_glCreateShader = _glCreateShader; + + /** @suppress {duplicate } */ + var _glCullFace = (x0) => GLctx.cullFace(x0); + var _emscripten_glCullFace = _glCullFace; + + /** @suppress {duplicate } */ + var _glDeleteBuffers = (n, buffers) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((buffers)+(i*4))>>2)]; + var buffer = GL.buffers[id]; + + // From spec: "glDeleteBuffers silently ignores 0's and names that do not + // correspond to existing buffer objects." + if (!buffer) continue; + + GLctx.deleteBuffer(buffer); + buffer.name = 0; + GL.buffers[id] = null; + + if (id == GLctx.currentPixelPackBufferBinding) GLctx.currentPixelPackBufferBinding = 0; + if (id == GLctx.currentPixelUnpackBufferBinding) GLctx.currentPixelUnpackBufferBinding = 0; + } + }; + var _emscripten_glDeleteBuffers = _glDeleteBuffers; + + /** @suppress {duplicate } */ + var _glDeleteFramebuffers = (n, framebuffers) => { + for (var i = 0; i < n; ++i) { + var id = HEAP32[(((framebuffers)+(i*4))>>2)]; + var framebuffer = GL.framebuffers[id]; + if (!framebuffer) continue; // GL spec: "glDeleteFramebuffers silently ignores 0s and names that do not correspond to existing framebuffer objects". + GLctx.deleteFramebuffer(framebuffer); + framebuffer.name = 0; + GL.framebuffers[id] = null; + } + }; + var _emscripten_glDeleteFramebuffers = _glDeleteFramebuffers; + + /** @suppress {duplicate } */ + var _glDeleteProgram = (id) => { + if (!id) return; + var program = GL.programs[id]; + if (!program) { + // glDeleteProgram actually signals an error when deleting a nonexisting + // object, unlike some other GL delete functions. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + GLctx.deleteProgram(program); + program.name = 0; + GL.programs[id] = null; + }; + var _emscripten_glDeleteProgram = _glDeleteProgram; + + /** @suppress {duplicate } */ + var _glDeleteQueries = (n, ids) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((ids)+(i*4))>>2)]; + var query = GL.queries[id]; + if (!query) continue; // GL spec: "unused names in ids are ignored, as is the name zero." + GLctx.deleteQuery(query); + GL.queries[id] = null; + } + }; + var _emscripten_glDeleteQueries = _glDeleteQueries; + + /** @suppress {duplicate } */ + var _glDeleteQueriesEXT = (n, ids) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((ids)+(i*4))>>2)]; + var query = GL.queries[id]; + if (!query) continue; // GL spec: "unused names in ids are ignored, as is the name zero." + GLctx.disjointTimerQueryExt['deleteQueryEXT'](query); + GL.queries[id] = null; + } + }; + var _emscripten_glDeleteQueriesEXT = _glDeleteQueriesEXT; + + /** @suppress {duplicate } */ + var _glDeleteRenderbuffers = (n, renderbuffers) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((renderbuffers)+(i*4))>>2)]; + var renderbuffer = GL.renderbuffers[id]; + if (!renderbuffer) continue; // GL spec: "glDeleteRenderbuffers silently ignores 0s and names that do not correspond to existing renderbuffer objects". + GLctx.deleteRenderbuffer(renderbuffer); + renderbuffer.name = 0; + GL.renderbuffers[id] = null; + } + }; + var _emscripten_glDeleteRenderbuffers = _glDeleteRenderbuffers; + + /** @suppress {duplicate } */ + var _glDeleteSamplers = (n, samplers) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((samplers)+(i*4))>>2)]; + var sampler = GL.samplers[id]; + if (!sampler) continue; + GLctx.deleteSampler(sampler); + sampler.name = 0; + GL.samplers[id] = null; + } + }; + var _emscripten_glDeleteSamplers = _glDeleteSamplers; + + /** @suppress {duplicate } */ + var _glDeleteShader = (id) => { + if (!id) return; + var shader = GL.shaders[id]; + if (!shader) { + // glDeleteShader actually signals an error when deleting a nonexisting + // object, unlike some other GL delete functions. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + GLctx.deleteShader(shader); + GL.shaders[id] = null; + }; + var _emscripten_glDeleteShader = _glDeleteShader; + + /** @suppress {duplicate } */ + var _glDeleteSync = (id) => { + if (!id) return; + var sync = GL.syncs[id]; + if (!sync) { // glDeleteSync signals an error when deleting a nonexisting object, unlike some other GL delete functions. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + GLctx.deleteSync(sync); + sync.name = 0; + GL.syncs[id] = null; + }; + var _emscripten_glDeleteSync = _glDeleteSync; + + /** @suppress {duplicate } */ + var _glDeleteTextures = (n, textures) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((textures)+(i*4))>>2)]; + var texture = GL.textures[id]; + // GL spec: "glDeleteTextures silently ignores 0s and names that do not + // correspond to existing textures". + if (!texture) continue; + GLctx.deleteTexture(texture); + texture.name = 0; + GL.textures[id] = null; + } + }; + var _emscripten_glDeleteTextures = _glDeleteTextures; + + /** @suppress {duplicate } */ + var _glDeleteTransformFeedbacks = (n, ids) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((ids)+(i*4))>>2)]; + var transformFeedback = GL.transformFeedbacks[id]; + if (!transformFeedback) continue; // GL spec: "unused names in ids are ignored, as is the name zero." + GLctx.deleteTransformFeedback(transformFeedback); + transformFeedback.name = 0; + GL.transformFeedbacks[id] = null; + } + }; + var _emscripten_glDeleteTransformFeedbacks = _glDeleteTransformFeedbacks; + + /** @suppress {duplicate } */ + var _glDeleteVertexArrays = (n, vaos) => { + for (var i = 0; i < n; i++) { + var id = HEAP32[(((vaos)+(i*4))>>2)]; + GLctx.deleteVertexArray(GL.vaos[id]); + GL.vaos[id] = null; + } + }; + var _emscripten_glDeleteVertexArrays = _glDeleteVertexArrays; + + + /** @suppress {duplicate } */ + var _glDeleteVertexArraysOES = _glDeleteVertexArrays; + var _emscripten_glDeleteVertexArraysOES = _glDeleteVertexArraysOES; + + /** @suppress {duplicate } */ + var _glDepthFunc = (x0) => GLctx.depthFunc(x0); + var _emscripten_glDepthFunc = _glDepthFunc; + + /** @suppress {duplicate } */ + var _glDepthMask = (flag) => { + GLctx.depthMask(!!flag); + }; + var _emscripten_glDepthMask = _glDepthMask; + + /** @suppress {duplicate } */ + var _glDepthRangef = (x0, x1) => GLctx.depthRange(x0, x1); + var _emscripten_glDepthRangef = _glDepthRangef; + + /** @suppress {duplicate } */ + var _glDetachShader = (program, shader) => { + GLctx.detachShader(GL.programs[program], GL.shaders[shader]); + }; + var _emscripten_glDetachShader = _glDetachShader; + + /** @suppress {duplicate } */ + var _glDisable = (x0) => GLctx.disable(x0); + var _emscripten_glDisable = _glDisable; + + /** @suppress {duplicate } */ + var _glDisableVertexAttribArray = (index) => { + GLctx.disableVertexAttribArray(index); + }; + var _emscripten_glDisableVertexAttribArray = _glDisableVertexAttribArray; + + /** @suppress {duplicate } */ + var _glDrawArrays = (mode, first, count) => { + + GLctx.drawArrays(mode, first, count); + + }; + var _emscripten_glDrawArrays = _glDrawArrays; + + /** @suppress {duplicate } */ + var _glDrawArraysInstanced = (mode, first, count, primcount) => { + GLctx.drawArraysInstanced(mode, first, count, primcount); + }; + var _emscripten_glDrawArraysInstanced = _glDrawArraysInstanced; + + + /** @suppress {duplicate } */ + var _glDrawArraysInstancedANGLE = _glDrawArraysInstanced; + var _emscripten_glDrawArraysInstancedANGLE = _glDrawArraysInstancedANGLE; + + + /** @suppress {duplicate } */ + var _glDrawArraysInstancedARB = _glDrawArraysInstanced; + var _emscripten_glDrawArraysInstancedARB = _glDrawArraysInstancedARB; + + + /** @suppress {duplicate } */ + var _glDrawArraysInstancedEXT = _glDrawArraysInstanced; + var _emscripten_glDrawArraysInstancedEXT = _glDrawArraysInstancedEXT; + + + /** @suppress {duplicate } */ + var _glDrawArraysInstancedNV = _glDrawArraysInstanced; + var _emscripten_glDrawArraysInstancedNV = _glDrawArraysInstancedNV; + + var tempFixedLengthArray = []; + + /** @suppress {duplicate } */ + var _glDrawBuffers = (n, bufs) => { + + var bufArray = tempFixedLengthArray[n]; + for (var i = 0; i < n; i++) { + bufArray[i] = HEAP32[(((bufs)+(i*4))>>2)]; + } + + GLctx.drawBuffers(bufArray); + }; + var _emscripten_glDrawBuffers = _glDrawBuffers; + + + /** @suppress {duplicate } */ + var _glDrawBuffersEXT = _glDrawBuffers; + var _emscripten_glDrawBuffersEXT = _glDrawBuffersEXT; + + + /** @suppress {duplicate } */ + var _glDrawBuffersWEBGL = _glDrawBuffers; + var _emscripten_glDrawBuffersWEBGL = _glDrawBuffersWEBGL; + + /** @suppress {duplicate } */ + var _glDrawElements = (mode, count, type, indices) => { + + GLctx.drawElements(mode, count, type, indices); + + }; + var _emscripten_glDrawElements = _glDrawElements; + + /** @suppress {duplicate } */ + var _glDrawElementsInstanced = (mode, count, type, indices, primcount) => { + GLctx.drawElementsInstanced(mode, count, type, indices, primcount); + }; + var _emscripten_glDrawElementsInstanced = _glDrawElementsInstanced; + + + /** @suppress {duplicate } */ + var _glDrawElementsInstancedANGLE = _glDrawElementsInstanced; + var _emscripten_glDrawElementsInstancedANGLE = _glDrawElementsInstancedANGLE; + + + /** @suppress {duplicate } */ + var _glDrawElementsInstancedARB = _glDrawElementsInstanced; + var _emscripten_glDrawElementsInstancedARB = _glDrawElementsInstancedARB; + + + /** @suppress {duplicate } */ + var _glDrawElementsInstancedEXT = _glDrawElementsInstanced; + var _emscripten_glDrawElementsInstancedEXT = _glDrawElementsInstancedEXT; + + + /** @suppress {duplicate } */ + var _glDrawElementsInstancedNV = _glDrawElementsInstanced; + var _emscripten_glDrawElementsInstancedNV = _glDrawElementsInstancedNV; + + /** @suppress {duplicate } */ + var _glDrawRangeElements = (mode, start, end, count, type, indices) => { + // TODO: This should be a trivial pass-though function registered at the bottom of this page as + // glFuncs[6][1] += ' drawRangeElements'; + // but due to https://bugzilla.mozilla.org/show_bug.cgi?id=1202427, + // we work around by ignoring the range. + _glDrawElements(mode, count, type, indices); + }; + var _emscripten_glDrawRangeElements = _glDrawRangeElements; + + /** @suppress {duplicate } */ + var _glEnable = (x0) => GLctx.enable(x0); + var _emscripten_glEnable = _glEnable; + + /** @suppress {duplicate } */ + var _glEnableVertexAttribArray = (index) => { + GLctx.enableVertexAttribArray(index); + }; + var _emscripten_glEnableVertexAttribArray = _glEnableVertexAttribArray; + + /** @suppress {duplicate } */ + var _glEndQuery = (x0) => GLctx.endQuery(x0); + var _emscripten_glEndQuery = _glEndQuery; + + /** @suppress {duplicate } */ + var _glEndQueryEXT = (target) => { + GLctx.disjointTimerQueryExt['endQueryEXT'](target); + }; + var _emscripten_glEndQueryEXT = _glEndQueryEXT; + + /** @suppress {duplicate } */ + var _glEndTransformFeedback = () => GLctx.endTransformFeedback(); + var _emscripten_glEndTransformFeedback = _glEndTransformFeedback; + + /** @suppress {duplicate } */ + var _glFenceSync = (condition, flags) => { + var sync = GLctx.fenceSync(condition, flags); + if (sync) { + var id = GL.getNewId(GL.syncs); + sync.name = id; + GL.syncs[id] = sync; + return id; + } + return 0; // Failed to create a sync object + }; + var _emscripten_glFenceSync = _glFenceSync; + + /** @suppress {duplicate } */ + var _glFinish = () => GLctx.finish(); + var _emscripten_glFinish = _glFinish; + + /** @suppress {duplicate } */ + var _glFlush = () => GLctx.flush(); + var _emscripten_glFlush = _glFlush; + + /** @suppress {duplicate } */ + var _glFramebufferRenderbuffer = (target, attachment, renderbuffertarget, renderbuffer) => { + GLctx.framebufferRenderbuffer(target, attachment, renderbuffertarget, + GL.renderbuffers[renderbuffer]); + }; + var _emscripten_glFramebufferRenderbuffer = _glFramebufferRenderbuffer; + + /** @suppress {duplicate } */ + var _glFramebufferTexture2D = (target, attachment, textarget, texture, level) => { + GLctx.framebufferTexture2D(target, attachment, textarget, + GL.textures[texture], level); + }; + var _emscripten_glFramebufferTexture2D = _glFramebufferTexture2D; + + /** @suppress {duplicate } */ + var _glFramebufferTextureLayer = (target, attachment, texture, level, layer) => { + GLctx.framebufferTextureLayer(target, attachment, GL.textures[texture], level, layer); + }; + var _emscripten_glFramebufferTextureLayer = _glFramebufferTextureLayer; + + /** @suppress {duplicate } */ + var _glFrontFace = (x0) => GLctx.frontFace(x0); + var _emscripten_glFrontFace = _glFrontFace; + + /** @suppress {duplicate } */ + var _glGenBuffers = (n, buffers) => { + GL.genObject(n, buffers, 'createBuffer', GL.buffers + ); + }; + var _emscripten_glGenBuffers = _glGenBuffers; + + /** @suppress {duplicate } */ + var _glGenFramebuffers = (n, ids) => { + GL.genObject(n, ids, 'createFramebuffer', GL.framebuffers + ); + }; + var _emscripten_glGenFramebuffers = _glGenFramebuffers; + + /** @suppress {duplicate } */ + var _glGenQueries = (n, ids) => { + GL.genObject(n, ids, 'createQuery', GL.queries + ); + }; + var _emscripten_glGenQueries = _glGenQueries; + + /** @suppress {duplicate } */ + var _glGenQueriesEXT = (n, ids) => { + for (var i = 0; i < n; i++) { + var query = GLctx.disjointTimerQueryExt['createQueryEXT'](); + if (!query) { + GL.recordError(0x502 /* GL_INVALID_OPERATION */); + while (i < n) HEAP32[(((ids)+(i++*4))>>2)] = 0; + return; + } + var id = GL.getNewId(GL.queries); + query.name = id; + GL.queries[id] = query; + HEAP32[(((ids)+(i*4))>>2)] = id; + } + }; + var _emscripten_glGenQueriesEXT = _glGenQueriesEXT; + + /** @suppress {duplicate } */ + var _glGenRenderbuffers = (n, renderbuffers) => { + GL.genObject(n, renderbuffers, 'createRenderbuffer', GL.renderbuffers + ); + }; + var _emscripten_glGenRenderbuffers = _glGenRenderbuffers; + + /** @suppress {duplicate } */ + var _glGenSamplers = (n, samplers) => { + GL.genObject(n, samplers, 'createSampler', GL.samplers + ); + }; + var _emscripten_glGenSamplers = _glGenSamplers; + + /** @suppress {duplicate } */ + var _glGenTextures = (n, textures) => { + GL.genObject(n, textures, 'createTexture', GL.textures + ); + }; + var _emscripten_glGenTextures = _glGenTextures; + + /** @suppress {duplicate } */ + var _glGenTransformFeedbacks = (n, ids) => { + GL.genObject(n, ids, 'createTransformFeedback', GL.transformFeedbacks + ); + }; + var _emscripten_glGenTransformFeedbacks = _glGenTransformFeedbacks; + + /** @suppress {duplicate } */ + var _glGenVertexArrays = (n, arrays) => { + GL.genObject(n, arrays, 'createVertexArray', GL.vaos + ); + }; + var _emscripten_glGenVertexArrays = _glGenVertexArrays; + + + /** @suppress {duplicate } */ + var _glGenVertexArraysOES = _glGenVertexArrays; + var _emscripten_glGenVertexArraysOES = _glGenVertexArraysOES; + + /** @suppress {duplicate } */ + var _glGenerateMipmap = (x0) => GLctx.generateMipmap(x0); + var _emscripten_glGenerateMipmap = _glGenerateMipmap; + + + var __glGetActiveAttribOrUniform = (funcName, program, index, bufSize, length, size, type, name) => { + program = GL.programs[program]; + var info = GLctx[funcName](program, index); + if (info) { + // If an error occurs, nothing will be written to length, size and type and name. + var numBytesWrittenExclNull = name && stringToUTF8(info.name, name, bufSize); + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + if (size) HEAP32[((size)>>2)] = info.size; + if (type) HEAP32[((type)>>2)] = info.type; + } + }; + + /** @suppress {duplicate } */ + var _glGetActiveAttrib = (program, index, bufSize, length, size, type, name) => { + __glGetActiveAttribOrUniform('getActiveAttrib', program, index, bufSize, length, size, type, name); + }; + var _emscripten_glGetActiveAttrib = _glGetActiveAttrib; + + + /** @suppress {duplicate } */ + var _glGetActiveUniform = (program, index, bufSize, length, size, type, name) => { + __glGetActiveAttribOrUniform('getActiveUniform', program, index, bufSize, length, size, type, name); + }; + var _emscripten_glGetActiveUniform = _glGetActiveUniform; + + /** @suppress {duplicate } */ + var _glGetActiveUniformBlockName = (program, uniformBlockIndex, bufSize, length, uniformBlockName) => { + program = GL.programs[program]; + + var result = GLctx.getActiveUniformBlockName(program, uniformBlockIndex); + if (!result) return; // If an error occurs, nothing will be written to uniformBlockName or length. + if (uniformBlockName && bufSize > 0) { + var numBytesWrittenExclNull = stringToUTF8(result, uniformBlockName, bufSize); + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + } else { + if (length) HEAP32[((length)>>2)] = 0; + } + }; + var _emscripten_glGetActiveUniformBlockName = _glGetActiveUniformBlockName; + + /** @suppress {duplicate } */ + var _glGetActiveUniformBlockiv = (program, uniformBlockIndex, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if params == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + program = GL.programs[program]; + + if (pname == 0x8A41 /* GL_UNIFORM_BLOCK_NAME_LENGTH */) { + var name = GLctx.getActiveUniformBlockName(program, uniformBlockIndex); + HEAP32[((params)>>2)] = name.length+1; + return; + } + + var result = GLctx.getActiveUniformBlockParameter(program, uniformBlockIndex, pname); + if (result === null) return; // If an error occurs, nothing should be written to params. + if (pname == 0x8A43 /*GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES*/) { + for (var i = 0; i < result.length; i++) { + HEAP32[(((params)+(i*4))>>2)] = result[i]; + } + } else { + HEAP32[((params)>>2)] = result; + } + }; + var _emscripten_glGetActiveUniformBlockiv = _glGetActiveUniformBlockiv; + + /** @suppress {duplicate } */ + var _glGetActiveUniformsiv = (program, uniformCount, uniformIndices, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if params == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + if (uniformCount > 0 && uniformIndices == 0) { + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + program = GL.programs[program]; + var ids = []; + for (var i = 0; i < uniformCount; i++) { + ids.push(HEAP32[(((uniformIndices)+(i*4))>>2)]); + } + + var result = GLctx.getActiveUniforms(program, ids, pname); + if (!result) return; // GL spec: If an error is generated, nothing is written out to params. + + var len = result.length; + for (var i = 0; i < len; i++) { + HEAP32[(((params)+(i*4))>>2)] = result[i]; + } + }; + var _emscripten_glGetActiveUniformsiv = _glGetActiveUniformsiv; + + /** @suppress {duplicate } */ + var _glGetAttachedShaders = (program, maxCount, count, shaders) => { + var result = GLctx.getAttachedShaders(GL.programs[program]); + var len = result.length; + if (len > maxCount) { + len = maxCount; + } + HEAP32[((count)>>2)] = len; + for (var i = 0; i < len; ++i) { + var id = GL.shaders.indexOf(result[i]); + HEAP32[(((shaders)+(i*4))>>2)] = id; + } + }; + var _emscripten_glGetAttachedShaders = _glGetAttachedShaders; + + + /** @suppress {duplicate } */ + var _glGetAttribLocation = (program, name) => { + return GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name)); + }; + var _emscripten_glGetAttribLocation = _glGetAttribLocation; + + var writeI53ToI64 = (ptr, num) => { + HEAPU32[((ptr)>>2)] = num; + var lower = HEAPU32[((ptr)>>2)]; + HEAPU32[(((ptr)+(4))>>2)] = (num - lower)/4294967296; + }; + + + var webglGetExtensions = function $webglGetExtensions() { + var exts = getEmscriptenSupportedExtensions(GLctx); + exts = exts.concat(exts.map((e) => "GL_" + e)); + return exts; + }; + + var emscriptenWebGLGet = (name_, p, type) => { + // Guard against user passing a null pointer. + // Note that GLES2 spec does not say anything about how passing a null + // pointer should be treated. Testing on desktop core GL 3, the application + // crashes on glGetIntegerv to a null pointer, but better to report an error + // instead of doing anything random. + if (!p) { + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var ret = undefined; + switch (name_) { // Handle a few trivial GLES values + case 0x8DFA: // GL_SHADER_COMPILER + ret = 1; + break; + case 0x8DF8: // GL_SHADER_BINARY_FORMATS + if (type != 0 && type != 1) { + GL.recordError(0x500); // GL_INVALID_ENUM + } + // Do not write anything to the out pointer, since no binary formats are + // supported. + return; + case 0x87FE: // GL_NUM_PROGRAM_BINARY_FORMATS + case 0x8DF9: // GL_NUM_SHADER_BINARY_FORMATS + ret = 0; + break; + case 0x86A2: // GL_NUM_COMPRESSED_TEXTURE_FORMATS + // WebGL doesn't have GL_NUM_COMPRESSED_TEXTURE_FORMATS (it's obsolete + // since GL_COMPRESSED_TEXTURE_FORMATS returns a JS array that can be + // queried for length), so implement it ourselves to allow C++ GLES2 + // code get the length. + var formats = GLctx.getParameter(0x86A3 /*GL_COMPRESSED_TEXTURE_FORMATS*/); + ret = formats ? formats.length : 0; + break; + + case 0x821D: // GL_NUM_EXTENSIONS + if (GL.currentContext.version < 2) { + // Calling GLES3/WebGL2 function with a GLES2/WebGL1 context + GL.recordError(0x502 /* GL_INVALID_OPERATION */); + return; + } + ret = webglGetExtensions().length; + break; + case 0x821B: // GL_MAJOR_VERSION + case 0x821C: // GL_MINOR_VERSION + if (GL.currentContext.version < 2) { + GL.recordError(0x500); // GL_INVALID_ENUM + return; + } + ret = name_ == 0x821B ? 3 : 0; // return version 3.0 + break; + } + + if (ret === undefined) { + var result = GLctx.getParameter(name_); + switch (typeof result) { + case "number": + ret = result; + break; + case "boolean": + ret = result ? 1 : 0; + break; + case "string": + GL.recordError(0x500); // GL_INVALID_ENUM + return; + case "object": + if (result === null) { + // null is a valid result for some (e.g., which buffer is bound - + // perhaps nothing is bound), but otherwise can mean an invalid + // name_, which we need to report as an error + switch (name_) { + case 0x8894: // ARRAY_BUFFER_BINDING + case 0x8B8D: // CURRENT_PROGRAM + case 0x8895: // ELEMENT_ARRAY_BUFFER_BINDING + case 0x8CA6: // FRAMEBUFFER_BINDING or DRAW_FRAMEBUFFER_BINDING + case 0x8CA7: // RENDERBUFFER_BINDING + case 0x8069: // TEXTURE_BINDING_2D + case 0x85B5: // WebGL 2 GL_VERTEX_ARRAY_BINDING, or WebGL 1 extension OES_vertex_array_object GL_VERTEX_ARRAY_BINDING_OES + case 0x8F36: // COPY_READ_BUFFER_BINDING or COPY_READ_BUFFER + case 0x8F37: // COPY_WRITE_BUFFER_BINDING or COPY_WRITE_BUFFER + case 0x88ED: // PIXEL_PACK_BUFFER_BINDING + case 0x88EF: // PIXEL_UNPACK_BUFFER_BINDING + case 0x8CAA: // READ_FRAMEBUFFER_BINDING + case 0x8919: // SAMPLER_BINDING + case 0x8C1D: // TEXTURE_BINDING_2D_ARRAY + case 0x806A: // TEXTURE_BINDING_3D + case 0x8E25: // TRANSFORM_FEEDBACK_BINDING + case 0x8C8F: // TRANSFORM_FEEDBACK_BUFFER_BINDING + case 0x8A28: // UNIFORM_BUFFER_BINDING + case 0x8514: { // TEXTURE_BINDING_CUBE_MAP + ret = 0; + break; + } + default: { + GL.recordError(0x500); // GL_INVALID_ENUM + return; + } + } + } else if (result instanceof Float32Array || + result instanceof Uint32Array || + result instanceof Int32Array || + result instanceof Array) { + for (var i = 0; i < result.length; ++i) { + switch (type) { + case 0: HEAP32[(((p)+(i*4))>>2)] = result[i]; break; + case 2: HEAPF32[(((p)+(i*4))>>2)] = result[i]; break; + case 4: HEAP8[(p)+(i)] = result[i] ? 1 : 0; break; + } + } + return; + } else { + try { + ret = result.name | 0; + } catch(e) { + GL.recordError(0x500); // GL_INVALID_ENUM + err(`GL_INVALID_ENUM in glGet${type}v: Unknown object returned from WebGL getParameter(${name_})! (error: ${e})`); + return; + } + } + break; + default: + GL.recordError(0x500); // GL_INVALID_ENUM + err(`GL_INVALID_ENUM in glGet${type}v: Native code calling glGet${type}v(${name_}) and it returns ${result} of type ${typeof(result)}!`); + return; + } + } + + switch (type) { + case 1: writeI53ToI64(p, ret); break; + case 0: HEAP32[((p)>>2)] = ret; break; + case 2: HEAPF32[((p)>>2)] = ret; break; + case 4: HEAP8[p] = ret ? 1 : 0; break; + } + }; + + /** @suppress {duplicate } */ + var _glGetBooleanv = (name_, p) => emscriptenWebGLGet(name_, p, 4); + var _emscripten_glGetBooleanv = _glGetBooleanv; + + /** @suppress {duplicate } */ + var _glGetBufferParameteri64v = (target, value, data) => { + if (!data) { + // GLES2 specification does not specify how to behave if data is a null pointer. Since calling this function does not make sense + // if data == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + writeI53ToI64(data, GLctx.getBufferParameter(target, value)); + }; + var _emscripten_glGetBufferParameteri64v = _glGetBufferParameteri64v; + + /** @suppress {duplicate } */ + var _glGetBufferParameteriv = (target, value, data) => { + if (!data) { + // GLES2 specification does not specify how to behave if data is a null + // pointer. Since calling this function does not make sense if data == + // null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((data)>>2)] = GLctx.getBufferParameter(target, value); + }; + var _emscripten_glGetBufferParameteriv = _glGetBufferParameteriv; + + /** @suppress {duplicate } */ + var _glGetError = () => { + var error = GLctx.getError() || GL.lastError; + GL.lastError = 0/*GL_NO_ERROR*/; + return error; + }; + var _emscripten_glGetError = _glGetError; + + + /** @suppress {duplicate } */ + var _glGetFloatv = (name_, p) => emscriptenWebGLGet(name_, p, 2); + var _emscripten_glGetFloatv = _glGetFloatv; + + /** @suppress {duplicate } */ + var _glGetFragDataLocation = (program, name) => { + return GLctx.getFragDataLocation(GL.programs[program], UTF8ToString(name)); + }; + var _emscripten_glGetFragDataLocation = _glGetFragDataLocation; + + /** @suppress {duplicate } */ + var _glGetFramebufferAttachmentParameteriv = (target, attachment, pname, params) => { + var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname); + if (result instanceof WebGLRenderbuffer || + result instanceof WebGLTexture) { + result = result.name | 0; + } + HEAP32[((params)>>2)] = result; + }; + var _emscripten_glGetFramebufferAttachmentParameteriv = _glGetFramebufferAttachmentParameteriv; + + var emscriptenWebGLGetIndexed = (target, index, data, type) => { + if (!data) { + // GLES2 specification does not specify how to behave if data is a null pointer. Since calling this function does not make sense + // if data == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var result = GLctx.getIndexedParameter(target, index); + var ret; + switch (typeof result) { + case 'boolean': + ret = result ? 1 : 0; + break; + case 'number': + ret = result; + break; + case 'object': + if (result === null) { + switch (target) { + case 0x8C8F: // TRANSFORM_FEEDBACK_BUFFER_BINDING + case 0x8A28: // UNIFORM_BUFFER_BINDING + ret = 0; + break; + default: { + GL.recordError(0x500); // GL_INVALID_ENUM + return; + } + } + } else if (result instanceof WebGLBuffer) { + ret = result.name | 0; + } else { + GL.recordError(0x500); // GL_INVALID_ENUM + return; + } + break; + default: + GL.recordError(0x500); // GL_INVALID_ENUM + return; + } + + switch (type) { + case 1: writeI53ToI64(data, ret); break; + case 0: HEAP32[((data)>>2)] = ret; break; + case 2: HEAPF32[((data)>>2)] = ret; break; + case 4: HEAP8[data] = ret ? 1 : 0; break; + default: throw 'internal emscriptenWebGLGetIndexed() error, bad type: ' + type; + } + }; + /** @suppress {duplicate } */ + var _glGetInteger64i_v = (target, index, data) => + emscriptenWebGLGetIndexed(target, index, data, 1); + var _emscripten_glGetInteger64i_v = _glGetInteger64i_v; + + /** @suppress {duplicate } */ + var _glGetInteger64v = (name_, p) => { + emscriptenWebGLGet(name_, p, 1); + }; + var _emscripten_glGetInteger64v = _glGetInteger64v; + + /** @suppress {duplicate } */ + var _glGetIntegeri_v = (target, index, data) => + emscriptenWebGLGetIndexed(target, index, data, 0); + var _emscripten_glGetIntegeri_v = _glGetIntegeri_v; + + + /** @suppress {duplicate } */ + var _glGetIntegerv = (name_, p) => emscriptenWebGLGet(name_, p, 0); + var _emscripten_glGetIntegerv = _glGetIntegerv; + + /** @suppress {duplicate } */ + var _glGetInternalformativ = (target, internalformat, pname, bufSize, params) => { + if (bufSize < 0) { + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + if (!params) { + // GLES3 specification does not specify how to behave if values is a null pointer. Since calling this function does not make sense + // if values == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var ret = GLctx.getInternalformatParameter(target, internalformat, pname); + if (ret === null) return; + for (var i = 0; i < ret.length && i < bufSize; ++i) { + HEAP32[(((params)+(i*4))>>2)] = ret[i]; + } + }; + var _emscripten_glGetInternalformativ = _glGetInternalformativ; + + /** @suppress {duplicate } */ + var _glGetProgramBinary = (program, bufSize, length, binaryFormat, binary) => { + GL.recordError(0x502/*GL_INVALID_OPERATION*/); + }; + var _emscripten_glGetProgramBinary = _glGetProgramBinary; + + /** @suppress {duplicate } */ + var _glGetProgramInfoLog = (program, maxLength, length, infoLog) => { + var log = GLctx.getProgramInfoLog(GL.programs[program]); + if (log === null) log = '(unknown error)'; + var numBytesWrittenExclNull = (maxLength > 0 && infoLog) ? stringToUTF8(log, infoLog, maxLength) : 0; + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + }; + var _emscripten_glGetProgramInfoLog = _glGetProgramInfoLog; + + /** @suppress {duplicate } */ + var _glGetProgramiv = (program, pname, p) => { + if (!p) { + // GLES2 specification does not specify how to behave if p is a null + // pointer. Since calling this function does not make sense if p == null, + // issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + + if (program >= GL.counter) { + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + + program = GL.programs[program]; + + if (pname == 0x8B84) { // GL_INFO_LOG_LENGTH + var log = GLctx.getProgramInfoLog(program); + if (log === null) log = '(unknown error)'; + HEAP32[((p)>>2)] = log.length + 1; + } else if (pname == 0x8B87 /* GL_ACTIVE_UNIFORM_MAX_LENGTH */) { + if (!program.maxUniformLength) { + for (var i = 0; i < GLctx.getProgramParameter(program, 0x8B86/*GL_ACTIVE_UNIFORMS*/); ++i) { + program.maxUniformLength = Math.max(program.maxUniformLength, GLctx.getActiveUniform(program, i).name.length+1); + } + } + HEAP32[((p)>>2)] = program.maxUniformLength; + } else if (pname == 0x8B8A /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */) { + if (!program.maxAttributeLength) { + for (var i = 0; i < GLctx.getProgramParameter(program, 0x8B89/*GL_ACTIVE_ATTRIBUTES*/); ++i) { + program.maxAttributeLength = Math.max(program.maxAttributeLength, GLctx.getActiveAttrib(program, i).name.length+1); + } + } + HEAP32[((p)>>2)] = program.maxAttributeLength; + } else if (pname == 0x8A35 /* GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */) { + if (!program.maxUniformBlockNameLength) { + for (var i = 0; i < GLctx.getProgramParameter(program, 0x8A36/*GL_ACTIVE_UNIFORM_BLOCKS*/); ++i) { + program.maxUniformBlockNameLength = Math.max(program.maxUniformBlockNameLength, GLctx.getActiveUniformBlockName(program, i).length+1); + } + } + HEAP32[((p)>>2)] = program.maxUniformBlockNameLength; + } else { + HEAP32[((p)>>2)] = GLctx.getProgramParameter(program, pname); + } + }; + var _emscripten_glGetProgramiv = _glGetProgramiv; + + + /** @suppress {duplicate } */ + var _glGetQueryObjecti64vEXT = (id, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var query = GL.queries[id]; + var param; + if (GL.currentContext.version < 2) + { + param = GLctx.disjointTimerQueryExt['getQueryObjectEXT'](query, pname); + } + else { + param = GLctx.getQueryParameter(query, pname); + } + var ret; + if (typeof param == 'boolean') { + ret = param ? 1 : 0; + } else { + ret = param; + } + writeI53ToI64(params, ret); + }; + var _emscripten_glGetQueryObjecti64vEXT = _glGetQueryObjecti64vEXT; + + /** @suppress {duplicate } */ + var _glGetQueryObjectivEXT = (id, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var query = GL.queries[id]; + var param = GLctx.disjointTimerQueryExt['getQueryObjectEXT'](query, pname); + var ret; + if (typeof param == 'boolean') { + ret = param ? 1 : 0; + } else { + ret = param; + } + HEAP32[((params)>>2)] = ret; + }; + var _emscripten_glGetQueryObjectivEXT = _glGetQueryObjectivEXT; + + + /** @suppress {duplicate } */ + var _glGetQueryObjectui64vEXT = _glGetQueryObjecti64vEXT; + var _emscripten_glGetQueryObjectui64vEXT = _glGetQueryObjectui64vEXT; + + /** @suppress {duplicate } */ + var _glGetQueryObjectuiv = (id, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var query = GL.queries[id]; + var param = GLctx.getQueryParameter(query, pname); + var ret; + if (typeof param == 'boolean') { + ret = param ? 1 : 0; + } else { + ret = param; + } + HEAP32[((params)>>2)] = ret; + }; + var _emscripten_glGetQueryObjectuiv = _glGetQueryObjectuiv; + + + /** @suppress {duplicate } */ + var _glGetQueryObjectuivEXT = _glGetQueryObjectivEXT; + var _emscripten_glGetQueryObjectuivEXT = _glGetQueryObjectuivEXT; + + /** @suppress {duplicate } */ + var _glGetQueryiv = (target, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((params)>>2)] = GLctx.getQuery(target, pname); + }; + var _emscripten_glGetQueryiv = _glGetQueryiv; + + /** @suppress {duplicate } */ + var _glGetQueryivEXT = (target, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((params)>>2)] = GLctx.disjointTimerQueryExt['getQueryEXT'](target, pname); + }; + var _emscripten_glGetQueryivEXT = _glGetQueryivEXT; + + /** @suppress {duplicate } */ + var _glGetRenderbufferParameteriv = (target, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if params == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((params)>>2)] = GLctx.getRenderbufferParameter(target, pname); + }; + var _emscripten_glGetRenderbufferParameteriv = _glGetRenderbufferParameteriv; + + /** @suppress {duplicate } */ + var _glGetSamplerParameterfv = (sampler, pname, params) => { + if (!params) { + // GLES3 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAPF32[((params)>>2)] = GLctx.getSamplerParameter(GL.samplers[sampler], pname); + }; + var _emscripten_glGetSamplerParameterfv = _glGetSamplerParameterfv; + + /** @suppress {duplicate } */ + var _glGetSamplerParameteriv = (sampler, pname, params) => { + if (!params) { + // GLES3 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense + // if p == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((params)>>2)] = GLctx.getSamplerParameter(GL.samplers[sampler], pname); + }; + var _emscripten_glGetSamplerParameteriv = _glGetSamplerParameteriv; + + + /** @suppress {duplicate } */ + var _glGetShaderInfoLog = (shader, maxLength, length, infoLog) => { + var log = GLctx.getShaderInfoLog(GL.shaders[shader]); + if (log === null) log = '(unknown error)'; + var numBytesWrittenExclNull = (maxLength > 0 && infoLog) ? stringToUTF8(log, infoLog, maxLength) : 0; + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + }; + var _emscripten_glGetShaderInfoLog = _glGetShaderInfoLog; + + /** @suppress {duplicate } */ + var _glGetShaderPrecisionFormat = (shaderType, precisionType, range, precision) => { + var result = GLctx.getShaderPrecisionFormat(shaderType, precisionType); + HEAP32[((range)>>2)] = result.rangeMin; + HEAP32[(((range)+(4))>>2)] = result.rangeMax; + HEAP32[((precision)>>2)] = result.precision; + }; + var _emscripten_glGetShaderPrecisionFormat = _glGetShaderPrecisionFormat; + + /** @suppress {duplicate } */ + var _glGetShaderSource = (shader, bufSize, length, source) => { + var result = GLctx.getShaderSource(GL.shaders[shader]); + if (!result) return; // If an error occurs, nothing will be written to length or source. + var numBytesWrittenExclNull = (bufSize > 0 && source) ? stringToUTF8(result, source, bufSize) : 0; + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + }; + var _emscripten_glGetShaderSource = _glGetShaderSource; + + /** @suppress {duplicate } */ + var _glGetShaderiv = (shader, pname, p) => { + if (!p) { + // GLES2 specification does not specify how to behave if p is a null + // pointer. Since calling this function does not make sense if p == null, + // issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + if (pname == 0x8B84) { // GL_INFO_LOG_LENGTH + var log = GLctx.getShaderInfoLog(GL.shaders[shader]); + if (log === null) log = '(unknown error)'; + // The GLES2 specification says that if the shader has an empty info log, + // a value of 0 is returned. Otherwise the log has a null char appended. + // (An empty string is falsey, so we can just check that instead of + // looking at log.length.) + var logLength = log ? log.length + 1 : 0; + HEAP32[((p)>>2)] = logLength; + } else if (pname == 0x8B88) { // GL_SHADER_SOURCE_LENGTH + var source = GLctx.getShaderSource(GL.shaders[shader]); + // source may be a null, or the empty string, both of which are falsey + // values that we report a 0 length for. + var sourceLength = source ? source.length + 1 : 0; + HEAP32[((p)>>2)] = sourceLength; + } else { + HEAP32[((p)>>2)] = GLctx.getShaderParameter(GL.shaders[shader], pname); + } + }; + var _emscripten_glGetShaderiv = _glGetShaderiv; + + + + var stringToNewUTF8 = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8(str, ret, size); + return ret; + }; + + + /** @suppress {duplicate } */ + var _glGetString = (name_) => { + var ret = GL.stringCache[name_]; + if (!ret) { + switch (name_) { + case 0x1F03 /* GL_EXTENSIONS */: + ret = stringToNewUTF8(webglGetExtensions().join(' ')); + break; + case 0x1F00 /* GL_VENDOR */: + case 0x1F01 /* GL_RENDERER */: + case 0x9245 /* UNMASKED_VENDOR_WEBGL */: + case 0x9246 /* UNMASKED_RENDERER_WEBGL */: + var s = GLctx.getParameter(name_); + if (!s) { + GL.recordError(0x500/*GL_INVALID_ENUM*/); + } + ret = s ? stringToNewUTF8(s) : 0; + break; + + case 0x1F02 /* GL_VERSION */: + var glVersion = GLctx.getParameter(0x1F02 /*GL_VERSION*/); + // return GLES version string corresponding to the version of the WebGL context + if (GL.currentContext.version >= 2) glVersion = `OpenGL ES 3.0 (${glVersion})`; + else + { + glVersion = `OpenGL ES 2.0 (${glVersion})`; + } + ret = stringToNewUTF8(glVersion); + break; + case 0x8B8C /* GL_SHADING_LANGUAGE_VERSION */: + var glslVersion = GLctx.getParameter(0x8B8C /*GL_SHADING_LANGUAGE_VERSION*/); + // extract the version number 'N.M' from the string 'WebGL GLSL ES N.M ...' + var ver_re = /^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/; + var ver_num = glslVersion.match(ver_re); + if (ver_num !== null) { + if (ver_num[1].length == 3) ver_num[1] = ver_num[1] + '0'; // ensure minor version has 2 digits + glslVersion = `OpenGL ES GLSL ES ${ver_num[1]} (${glslVersion})`; + } + ret = stringToNewUTF8(glslVersion); + break; + default: + GL.recordError(0x500/*GL_INVALID_ENUM*/); + // fall through + } + GL.stringCache[name_] = ret; + } + return ret; + }; + var _emscripten_glGetString = _glGetString; + + + /** @suppress {duplicate } */ + var _glGetStringi = (name, index) => { + if (GL.currentContext.version < 2) { + GL.recordError(0x502 /* GL_INVALID_OPERATION */); // Calling GLES3/WebGL2 function with a GLES2/WebGL1 context + return 0; + } + var stringiCache = GL.stringiCache[name]; + if (stringiCache) { + if (index < 0 || index >= stringiCache.length) { + GL.recordError(0x501/*GL_INVALID_VALUE*/); + return 0; + } + return stringiCache[index]; + } + switch (name) { + case 0x1F03 /* GL_EXTENSIONS */: + var exts = webglGetExtensions().map(stringToNewUTF8); + stringiCache = GL.stringiCache[name] = exts; + if (index < 0 || index >= stringiCache.length) { + GL.recordError(0x501/*GL_INVALID_VALUE*/); + return 0; + } + return stringiCache[index]; + default: + GL.recordError(0x500/*GL_INVALID_ENUM*/); + return 0; + } + }; + var _emscripten_glGetStringi = _glGetStringi; + + /** @suppress {duplicate } */ + var _glGetSynciv = (sync, pname, bufSize, length, values) => { + if (bufSize < 0) { + // GLES3 specification does not specify how to behave if bufSize < 0, however in the spec wording for glGetInternalformativ, it does say that GL_INVALID_VALUE should be raised, + // so raise GL_INVALID_VALUE here as well. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + if (!values) { + // GLES3 specification does not specify how to behave if values is a null pointer. Since calling this function does not make sense + // if values == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var ret = GLctx.getSyncParameter(GL.syncs[sync], pname); + if (ret !== null) { + HEAP32[((values)>>2)] = ret; + if (length) HEAP32[((length)>>2)] = 1; // Report a single value outputted. + } + }; + var _emscripten_glGetSynciv = _glGetSynciv; + + /** @suppress {duplicate } */ + var _glGetTexParameterfv = (target, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null + // pointer. Since calling this function does not make sense if p == null, + // issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAPF32[((params)>>2)] = GLctx.getTexParameter(target, pname); + }; + var _emscripten_glGetTexParameterfv = _glGetTexParameterfv; + + /** @suppress {duplicate } */ + var _glGetTexParameteriv = (target, pname, params) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null + // pointer. Since calling this function does not make sense if p == null, + // issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((params)>>2)] = GLctx.getTexParameter(target, pname); + }; + var _emscripten_glGetTexParameteriv = _glGetTexParameteriv; + + /** @suppress {duplicate } */ + var _glGetTransformFeedbackVarying = (program, index, bufSize, length, size, type, name) => { + program = GL.programs[program]; + var info = GLctx.getTransformFeedbackVarying(program, index); + if (!info) return; // If an error occurred, the return parameters length, size, type and name will be unmodified. + + if (name && bufSize > 0) { + var numBytesWrittenExclNull = stringToUTF8(info.name, name, bufSize); + if (length) HEAP32[((length)>>2)] = numBytesWrittenExclNull; + } else { + if (length) HEAP32[((length)>>2)] = 0; + } + + if (size) HEAP32[((size)>>2)] = info.size; + if (type) HEAP32[((type)>>2)] = info.type; + }; + var _emscripten_glGetTransformFeedbackVarying = _glGetTransformFeedbackVarying; + + /** @suppress {duplicate } */ + var _glGetUniformBlockIndex = (program, uniformBlockName) => { + return GLctx.getUniformBlockIndex(GL.programs[program], UTF8ToString(uniformBlockName)); + }; + var _emscripten_glGetUniformBlockIndex = _glGetUniformBlockIndex; + + /** @suppress {duplicate } */ + var _glGetUniformIndices = (program, uniformCount, uniformNames, uniformIndices) => { + if (!uniformIndices) { + // GLES2 specification does not specify how to behave if uniformIndices is a null pointer. Since calling this function does not make sense + // if uniformIndices == null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + if (uniformCount > 0 && (uniformNames == 0 || uniformIndices == 0)) { + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + program = GL.programs[program]; + var names = []; + for (var i = 0; i < uniformCount; i++) + names.push(UTF8ToString(HEAP32[(((uniformNames)+(i*4))>>2)])); + + var result = GLctx.getUniformIndices(program, names); + if (!result) return; // GL spec: If an error is generated, nothing is written out to uniformIndices. + + var len = result.length; + for (var i = 0; i < len; i++) { + HEAP32[(((uniformIndices)+(i*4))>>2)] = result[i]; + } + }; + var _emscripten_glGetUniformIndices = _glGetUniformIndices; + + + /** @noinline */ + var webglGetLeftBracePos = (name) => name.slice(-1) == ']' && name.lastIndexOf('['); + + var webglPrepareUniformLocationsBeforeFirstUse = (program) => { + var uniformLocsById = program.uniformLocsById, // Maps GLuint -> WebGLUniformLocation + uniformSizeAndIdsByName = program.uniformSizeAndIdsByName, // Maps name -> [uniform array length, GLuint] + i, j; + + // On the first time invocation of glGetUniformLocation on this shader program: + // initialize cache data structures and discover which uniforms are arrays. + if (!uniformLocsById) { + // maps GLint integer locations to WebGLUniformLocations + program.uniformLocsById = uniformLocsById = {}; + // maps integer locations back to uniform name strings, so that we can lazily fetch uniform array locations + program.uniformArrayNamesById = {}; + + for (i = 0; i < GLctx.getProgramParameter(program, 0x8B86/*GL_ACTIVE_UNIFORMS*/); ++i) { + var u = GLctx.getActiveUniform(program, i); + var nm = u.name; + var sz = u.size; + var lb = webglGetLeftBracePos(nm); + var arrayName = lb > 0 ? nm.slice(0, lb) : nm; + + // Assign a new location. + var id = program.uniformIdCounter; + program.uniformIdCounter += sz; + // Eagerly get the location of the uniformArray[0] base element. + // The remaining indices >0 will be left for lazy evaluation to + // improve performance. Those may never be needed to fetch, if the + // application fills arrays always in full starting from the first + // element of the array. + uniformSizeAndIdsByName[arrayName] = [sz, id]; + + // Store placeholder integers in place that highlight that these + // >0 index locations are array indices pending population. + for (j = 0; j < sz; ++j) { + uniformLocsById[id] = j; + program.uniformArrayNamesById[id++] = arrayName; + } + } + } + }; + + + + /** @suppress {duplicate } */ + var _glGetUniformLocation = (program, name) => { + + name = UTF8ToString(name); + + if (program = GL.programs[program]) { + webglPrepareUniformLocationsBeforeFirstUse(program); + var uniformLocsById = program.uniformLocsById; // Maps GLuint -> WebGLUniformLocation + var arrayIndex = 0; + var uniformBaseName = name; + + // Invariant: when populating integer IDs for uniform locations, we must + // maintain the precondition that arrays reside in contiguous addresses, + // i.e. for a 'vec4 colors[10];', colors[4] must be at location + // colors[0]+4. However, user might call glGetUniformLocation(program, + // "colors") for an array, so we cannot discover based on the user input + // arguments whether the uniform we are dealing with is an array. The only + // way to discover which uniforms are arrays is to enumerate over all the + // active uniforms in the program. + var leftBrace = webglGetLeftBracePos(name); + + // If user passed an array accessor "[index]", parse the array index off the accessor. + if (leftBrace > 0) { + arrayIndex = jstoi_q(name.slice(leftBrace + 1)) >>> 0; // "index]", coerce parseInt(']') with >>>0 to treat "foo[]" as "foo[0]" and foo[-1] as unsigned out-of-bounds. + uniformBaseName = name.slice(0, leftBrace); + } + + // Have we cached the location of this uniform before? + // A pair [array length, GLint of the uniform location] + var sizeAndId = program.uniformSizeAndIdsByName[uniformBaseName]; + + // If an uniform with this name exists, and if its index is within the + // array limits (if it's even an array), query the WebGLlocation, or + // return an existing cached location. + if (sizeAndId && arrayIndex < sizeAndId[0]) { + arrayIndex += sizeAndId[1]; // Add the base location of the uniform to the array index offset. + if ((uniformLocsById[arrayIndex] = uniformLocsById[arrayIndex] || GLctx.getUniformLocation(program, name))) { + return arrayIndex; + } + } + } + else { + // N.b. we are currently unable to distinguish between GL program IDs that + // never existed vs GL program IDs that have been deleted, so report + // GL_INVALID_VALUE in both cases. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + } + return -1; + }; + var _emscripten_glGetUniformLocation = _glGetUniformLocation; + + var webglGetUniformLocation = (location) => { + var p = GLctx.currentProgram; + + if (p) { + var webglLoc = p.uniformLocsById[location]; + // p.uniformLocsById[location] stores either an integer, or a + // WebGLUniformLocation. + // If an integer, we have not yet bound the location, so do it now. The + // integer value specifies the array index we should bind to. + if (typeof webglLoc == 'number') { + p.uniformLocsById[location] = webglLoc = GLctx.getUniformLocation(p, p.uniformArrayNamesById[location] + (webglLoc > 0 ? `[${webglLoc}]` : '')); + } + // Else an already cached WebGLUniformLocation, return it. + return webglLoc; + } else { + GL.recordError(0x502/*GL_INVALID_OPERATION*/); + } + }; + + + /** @suppress{checkTypes} */ + var emscriptenWebGLGetUniform = (program, location, params, type) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null + // pointer. Since calling this function does not make sense if params == + // null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + program = GL.programs[program]; + webglPrepareUniformLocationsBeforeFirstUse(program); + var data = GLctx.getUniform(program, webglGetUniformLocation(location)); + if (typeof data == 'number' || typeof data == 'boolean') { + switch (type) { + case 0: HEAP32[((params)>>2)] = data; break; + case 2: HEAPF32[((params)>>2)] = data; break; + } + } else { + for (var i = 0; i < data.length; i++) { + switch (type) { + case 0: HEAP32[(((params)+(i*4))>>2)] = data[i]; break; + case 2: HEAPF32[(((params)+(i*4))>>2)] = data[i]; break; + } + } + } + }; + + /** @suppress {duplicate } */ + var _glGetUniformfv = (program, location, params) => { + emscriptenWebGLGetUniform(program, location, params, 2); + }; + var _emscripten_glGetUniformfv = _glGetUniformfv; + + + /** @suppress {duplicate } */ + var _glGetUniformiv = (program, location, params) => { + emscriptenWebGLGetUniform(program, location, params, 0); + }; + var _emscripten_glGetUniformiv = _glGetUniformiv; + + /** @suppress {duplicate } */ + var _glGetUniformuiv = (program, location, params) => + emscriptenWebGLGetUniform(program, location, params, 0); + var _emscripten_glGetUniformuiv = _glGetUniformuiv; + + /** @suppress{checkTypes} */ + var emscriptenWebGLGetVertexAttrib = (index, pname, params, type) => { + if (!params) { + // GLES2 specification does not specify how to behave if params is a null + // pointer. Since calling this function does not make sense if params == + // null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + var data = GLctx.getVertexAttrib(index, pname); + if (pname == 0x889F/*VERTEX_ATTRIB_ARRAY_BUFFER_BINDING*/) { + HEAP32[((params)>>2)] = data && data["name"]; + } else if (typeof data == 'number' || typeof data == 'boolean') { + switch (type) { + case 0: HEAP32[((params)>>2)] = data; break; + case 2: HEAPF32[((params)>>2)] = data; break; + case 5: HEAP32[((params)>>2)] = Math.fround(data); break; + } + } else { + for (var i = 0; i < data.length; i++) { + switch (type) { + case 0: HEAP32[(((params)+(i*4))>>2)] = data[i]; break; + case 2: HEAPF32[(((params)+(i*4))>>2)] = data[i]; break; + case 5: HEAP32[(((params)+(i*4))>>2)] = Math.fround(data[i]); break; + } + } + } + }; + /** @suppress {duplicate } */ + var _glGetVertexAttribIiv = (index, pname, params) => { + // N.B. This function may only be called if the vertex attribute was specified using the function glVertexAttribI4iv(), + // otherwise the results are undefined. (GLES3 spec 6.1.12) + emscriptenWebGLGetVertexAttrib(index, pname, params, 0); + }; + var _emscripten_glGetVertexAttribIiv = _glGetVertexAttribIiv; + + + /** @suppress {duplicate } */ + var _glGetVertexAttribIuiv = _glGetVertexAttribIiv; + var _emscripten_glGetVertexAttribIuiv = _glGetVertexAttribIuiv; + + /** @suppress {duplicate } */ + var _glGetVertexAttribPointerv = (index, pname, pointer) => { + if (!pointer) { + // GLES2 specification does not specify how to behave if pointer is a null + // pointer. Since calling this function does not make sense if pointer == + // null, issue a GL error to notify user about it. + GL.recordError(0x501 /* GL_INVALID_VALUE */); + return; + } + HEAP32[((pointer)>>2)] = GLctx.getVertexAttribOffset(index, pname); + }; + var _emscripten_glGetVertexAttribPointerv = _glGetVertexAttribPointerv; + + + /** @suppress {duplicate } */ + var _glGetVertexAttribfv = (index, pname, params) => { + // N.B. This function may only be called if the vertex attribute was + // specified using the function glVertexAttrib*f(), otherwise the results + // are undefined. (GLES3 spec 6.1.12) + emscriptenWebGLGetVertexAttrib(index, pname, params, 2); + }; + var _emscripten_glGetVertexAttribfv = _glGetVertexAttribfv; + + + /** @suppress {duplicate } */ + var _glGetVertexAttribiv = (index, pname, params) => { + // N.B. This function may only be called if the vertex attribute was + // specified using the function glVertexAttrib*f(), otherwise the results + // are undefined. (GLES3 spec 6.1.12) + emscriptenWebGLGetVertexAttrib(index, pname, params, 5); + }; + var _emscripten_glGetVertexAttribiv = _glGetVertexAttribiv; + + /** @suppress {duplicate } */ + var _glHint = (x0, x1) => GLctx.hint(x0, x1); + var _emscripten_glHint = _glHint; + + /** @suppress {duplicate } */ + var _glInvalidateFramebuffer = (target, numAttachments, attachments) => { + var list = tempFixedLengthArray[numAttachments]; + for (var i = 0; i < numAttachments; i++) { + list[i] = HEAP32[(((attachments)+(i*4))>>2)]; + } + + GLctx.invalidateFramebuffer(target, list); + }; + var _emscripten_glInvalidateFramebuffer = _glInvalidateFramebuffer; + + /** @suppress {duplicate } */ + var _glInvalidateSubFramebuffer = (target, numAttachments, attachments, x, y, width, height) => { + var list = tempFixedLengthArray[numAttachments]; + for (var i = 0; i < numAttachments; i++) { + list[i] = HEAP32[(((attachments)+(i*4))>>2)]; + } + + GLctx.invalidateSubFramebuffer(target, list, x, y, width, height); + }; + var _emscripten_glInvalidateSubFramebuffer = _glInvalidateSubFramebuffer; + + /** @suppress {duplicate } */ + var _glIsBuffer = (buffer) => { + var b = GL.buffers[buffer]; + if (!b) return 0; + return GLctx.isBuffer(b); + }; + var _emscripten_glIsBuffer = _glIsBuffer; + + /** @suppress {duplicate } */ + var _glIsEnabled = (x0) => GLctx.isEnabled(x0); + var _emscripten_glIsEnabled = _glIsEnabled; + + /** @suppress {duplicate } */ + var _glIsFramebuffer = (framebuffer) => { + var fb = GL.framebuffers[framebuffer]; + if (!fb) return 0; + return GLctx.isFramebuffer(fb); + }; + var _emscripten_glIsFramebuffer = _glIsFramebuffer; + + /** @suppress {duplicate } */ + var _glIsProgram = (program) => { + program = GL.programs[program]; + if (!program) return 0; + return GLctx.isProgram(program); + }; + var _emscripten_glIsProgram = _glIsProgram; + + /** @suppress {duplicate } */ + var _glIsQuery = (id) => { + var query = GL.queries[id]; + if (!query) return 0; + return GLctx.isQuery(query); + }; + var _emscripten_glIsQuery = _glIsQuery; + + /** @suppress {duplicate } */ + var _glIsQueryEXT = (id) => { + var query = GL.queries[id]; + if (!query) return 0; + return GLctx.disjointTimerQueryExt['isQueryEXT'](query); + }; + var _emscripten_glIsQueryEXT = _glIsQueryEXT; + + /** @suppress {duplicate } */ + var _glIsRenderbuffer = (renderbuffer) => { + var rb = GL.renderbuffers[renderbuffer]; + if (!rb) return 0; + return GLctx.isRenderbuffer(rb); + }; + var _emscripten_glIsRenderbuffer = _glIsRenderbuffer; + + /** @suppress {duplicate } */ + var _glIsSampler = (id) => { + var sampler = GL.samplers[id]; + if (!sampler) return 0; + return GLctx.isSampler(sampler); + }; + var _emscripten_glIsSampler = _glIsSampler; + + /** @suppress {duplicate } */ + var _glIsShader = (shader) => { + var s = GL.shaders[shader]; + if (!s) return 0; + return GLctx.isShader(s); + }; + var _emscripten_glIsShader = _glIsShader; + + /** @suppress {duplicate } */ + var _glIsSync = (sync) => GLctx.isSync(GL.syncs[sync]); + var _emscripten_glIsSync = _glIsSync; + + /** @suppress {duplicate } */ + var _glIsTexture = (id) => { + var texture = GL.textures[id]; + if (!texture) return 0; + return GLctx.isTexture(texture); + }; + var _emscripten_glIsTexture = _glIsTexture; + + /** @suppress {duplicate } */ + var _glIsTransformFeedback = (id) => GLctx.isTransformFeedback(GL.transformFeedbacks[id]); + var _emscripten_glIsTransformFeedback = _glIsTransformFeedback; + + /** @suppress {duplicate } */ + var _glIsVertexArray = (array) => { + + var vao = GL.vaos[array]; + if (!vao) return 0; + return GLctx.isVertexArray(vao); + }; + var _emscripten_glIsVertexArray = _glIsVertexArray; + + + /** @suppress {duplicate } */ + var _glIsVertexArrayOES = _glIsVertexArray; + var _emscripten_glIsVertexArrayOES = _glIsVertexArrayOES; + + /** @suppress {duplicate } */ + var _glLineWidth = (x0) => GLctx.lineWidth(x0); + var _emscripten_glLineWidth = _glLineWidth; + + /** @suppress {duplicate } */ + var _glLinkProgram = (program) => { + program = GL.programs[program]; + GLctx.linkProgram(program); + // Invalidate earlier computed uniform->ID mappings, those have now become stale + program.uniformLocsById = 0; // Mark as null-like so that glGetUniformLocation() knows to populate this again. + program.uniformSizeAndIdsByName = {}; + + }; + var _emscripten_glLinkProgram = _glLinkProgram; + + /** @suppress {duplicate } */ + var _glPauseTransformFeedback = () => GLctx.pauseTransformFeedback(); + var _emscripten_glPauseTransformFeedback = _glPauseTransformFeedback; + + /** @suppress {duplicate } */ + var _glPixelStorei = (pname, param) => { + if (pname == 0xCF5 /* GL_UNPACK_ALIGNMENT */) { + GL.unpackAlignment = param; + } + GLctx.pixelStorei(pname, param); + }; + var _emscripten_glPixelStorei = _glPixelStorei; + + /** @suppress {duplicate } */ + var _glPolygonOffset = (x0, x1) => GLctx.polygonOffset(x0, x1); + var _emscripten_glPolygonOffset = _glPolygonOffset; + + /** @suppress {duplicate } */ + var _glProgramBinary = (program, binaryFormat, binary, length) => { + GL.recordError(0x500/*GL_INVALID_ENUM*/); + }; + var _emscripten_glProgramBinary = _glProgramBinary; + + /** @suppress {duplicate } */ + var _glProgramParameteri = (program, pname, value) => { + GL.recordError(0x500/*GL_INVALID_ENUM*/); + }; + var _emscripten_glProgramParameteri = _glProgramParameteri; + + /** @suppress {duplicate } */ + var _glQueryCounterEXT = (id, target) => { + GLctx.disjointTimerQueryExt['queryCounterEXT'](GL.queries[id], target); + }; + var _emscripten_glQueryCounterEXT = _glQueryCounterEXT; + + /** @suppress {duplicate } */ + var _glReadBuffer = (x0) => GLctx.readBuffer(x0); + var _emscripten_glReadBuffer = _glReadBuffer; + + var computeUnpackAlignedImageSize = (width, height, sizePerPixel, alignment) => { + function roundedToNextMultipleOf(x, y) { + return (x + y - 1) & -y; + } + var plainRowSize = width * sizePerPixel; + var alignedRowSize = roundedToNextMultipleOf(plainRowSize, alignment); + return height * alignedRowSize; + }; + + var colorChannelsInGlTextureFormat = (format) => { + // Micro-optimizations for size: map format to size by subtracting smallest + // enum value (0x1902) from all values first. Also omit the most common + // size value (1) from the list, which is assumed by formats not on the + // list. + var colorChannels = { + // 0x1902 /* GL_DEPTH_COMPONENT */ - 0x1902: 1, + // 0x1906 /* GL_ALPHA */ - 0x1902: 1, + 5: 3, + 6: 4, + // 0x1909 /* GL_LUMINANCE */ - 0x1902: 1, + 8: 2, + 29502: 3, + 29504: 4, + // 0x1903 /* GL_RED */ - 0x1902: 1, + 26917: 2, + 26918: 2, + // 0x8D94 /* GL_RED_INTEGER */ - 0x1902: 1, + 29846: 3, + 29847: 4 + }; + return colorChannels[format - 0x1902]||1; + }; + + var heapObjectForWebGLType = (type) => { + // Micro-optimization for size: Subtract lowest GL enum number (0x1400/* GL_BYTE */) from type to compare + // smaller values for the heap, for shorter generated code size. + // Also the type HEAPU16 is not tested for explicitly, but any unrecognized type will return out HEAPU16. + // (since most types are HEAPU16) + type -= 0x1400; + if (type == 0) return HEAP8; + + if (type == 1) return HEAPU8; + + if (type == 2) return HEAP16; + + if (type == 4) return HEAP32; + + if (type == 6) return HEAPF32; + + if (type == 5 + || type == 28922 + || type == 28520 + || type == 30779 + || type == 30782 + ) + return HEAPU32; + + return HEAPU16; + }; + + var toTypedArrayIndex = (pointer, heap) => + pointer >>> (31 - Math.clz32(heap.BYTES_PER_ELEMENT)); + + var emscriptenWebGLGetTexPixelData = (type, format, width, height, pixels, internalFormat) => { + var heap = heapObjectForWebGLType(type); + var sizePerPixel = colorChannelsInGlTextureFormat(format) * heap.BYTES_PER_ELEMENT; + var bytes = computeUnpackAlignedImageSize(width, height, sizePerPixel, GL.unpackAlignment); + return heap.subarray(toTypedArrayIndex(pixels, heap), toTypedArrayIndex(pixels + bytes, heap)); + }; + + + + /** @suppress {duplicate } */ + var _glReadPixels = (x, y, width, height, format, type, pixels) => { + if (GL.currentContext.version >= 2) { + if (GLctx.currentPixelPackBufferBinding) { + GLctx.readPixels(x, y, width, height, format, type, pixels); + return; + } + var heap = heapObjectForWebGLType(type); + var target = toTypedArrayIndex(pixels, heap); + GLctx.readPixels(x, y, width, height, format, type, heap, target); + return; + } + var pixelData = emscriptenWebGLGetTexPixelData(type, format, width, height, pixels, format); + if (!pixelData) { + GL.recordError(0x500/*GL_INVALID_ENUM*/); + return; + } + GLctx.readPixels(x, y, width, height, format, type, pixelData); + }; + var _emscripten_glReadPixels = _glReadPixels; + + /** @suppress {duplicate } */ + var _glReleaseShaderCompiler = () => { + // NOP (as allowed by GLES 2.0 spec) + }; + var _emscripten_glReleaseShaderCompiler = _glReleaseShaderCompiler; + + /** @suppress {duplicate } */ + var _glRenderbufferStorage = (x0, x1, x2, x3) => GLctx.renderbufferStorage(x0, x1, x2, x3); + var _emscripten_glRenderbufferStorage = _glRenderbufferStorage; + + /** @suppress {duplicate } */ + var _glRenderbufferStorageMultisample = (x0, x1, x2, x3, x4) => GLctx.renderbufferStorageMultisample(x0, x1, x2, x3, x4); + var _emscripten_glRenderbufferStorageMultisample = _glRenderbufferStorageMultisample; + + /** @suppress {duplicate } */ + var _glResumeTransformFeedback = () => GLctx.resumeTransformFeedback(); + var _emscripten_glResumeTransformFeedback = _glResumeTransformFeedback; + + /** @suppress {duplicate } */ + var _glSampleCoverage = (value, invert) => { + GLctx.sampleCoverage(value, !!invert); + }; + var _emscripten_glSampleCoverage = _glSampleCoverage; + + /** @suppress {duplicate } */ + var _glSamplerParameterf = (sampler, pname, param) => { + GLctx.samplerParameterf(GL.samplers[sampler], pname, param); + }; + var _emscripten_glSamplerParameterf = _glSamplerParameterf; + + /** @suppress {duplicate } */ + var _glSamplerParameterfv = (sampler, pname, params) => { + var param = HEAPF32[((params)>>2)]; + GLctx.samplerParameterf(GL.samplers[sampler], pname, param); + }; + var _emscripten_glSamplerParameterfv = _glSamplerParameterfv; + + /** @suppress {duplicate } */ + var _glSamplerParameteri = (sampler, pname, param) => { + GLctx.samplerParameteri(GL.samplers[sampler], pname, param); + }; + var _emscripten_glSamplerParameteri = _glSamplerParameteri; + + /** @suppress {duplicate } */ + var _glSamplerParameteriv = (sampler, pname, params) => { + var param = HEAP32[((params)>>2)]; + GLctx.samplerParameteri(GL.samplers[sampler], pname, param); + }; + var _emscripten_glSamplerParameteriv = _glSamplerParameteriv; + + /** @suppress {duplicate } */ + var _glScissor = (x0, x1, x2, x3) => GLctx.scissor(x0, x1, x2, x3); + var _emscripten_glScissor = _glScissor; + + /** @suppress {duplicate } */ + var _glShaderBinary = (count, shaders, binaryformat, binary, length) => { + GL.recordError(0x500/*GL_INVALID_ENUM*/); + }; + var _emscripten_glShaderBinary = _glShaderBinary; + + /** @suppress {duplicate } */ + var _glShaderSource = (shader, count, string, length) => { + var source = GL.getSource(shader, count, string, length); + + GLctx.shaderSource(GL.shaders[shader], source); + }; + var _emscripten_glShaderSource = _glShaderSource; + + /** @suppress {duplicate } */ + var _glStencilFunc = (x0, x1, x2) => GLctx.stencilFunc(x0, x1, x2); + var _emscripten_glStencilFunc = _glStencilFunc; + + /** @suppress {duplicate } */ + var _glStencilFuncSeparate = (x0, x1, x2, x3) => GLctx.stencilFuncSeparate(x0, x1, x2, x3); + var _emscripten_glStencilFuncSeparate = _glStencilFuncSeparate; + + /** @suppress {duplicate } */ + var _glStencilMask = (x0) => GLctx.stencilMask(x0); + var _emscripten_glStencilMask = _glStencilMask; + + /** @suppress {duplicate } */ + var _glStencilMaskSeparate = (x0, x1) => GLctx.stencilMaskSeparate(x0, x1); + var _emscripten_glStencilMaskSeparate = _glStencilMaskSeparate; + + /** @suppress {duplicate } */ + var _glStencilOp = (x0, x1, x2) => GLctx.stencilOp(x0, x1, x2); + var _emscripten_glStencilOp = _glStencilOp; + + /** @suppress {duplicate } */ + var _glStencilOpSeparate = (x0, x1, x2, x3) => GLctx.stencilOpSeparate(x0, x1, x2, x3); + var _emscripten_glStencilOpSeparate = _glStencilOpSeparate; + + + + + /** @suppress {duplicate } */ + var _glTexImage2D = (target, level, internalFormat, width, height, border, format, type, pixels) => { + if (GL.currentContext.version >= 2) { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixels); + return; + } + if (pixels) { + var heap = heapObjectForWebGLType(type); + var index = toTypedArrayIndex(pixels, heap); + GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, index); + return; + } + } + var pixelData = pixels ? emscriptenWebGLGetTexPixelData(type, format, width, height, pixels, internalFormat) : null; + GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixelData); + }; + var _emscripten_glTexImage2D = _glTexImage2D; + + + /** @suppress {duplicate } */ + var _glTexImage3D = (target, level, internalFormat, width, height, depth, border, format, type, pixels) => { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.texImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels); + } else if (pixels) { + var heap = heapObjectForWebGLType(type); + GLctx.texImage3D(target, level, internalFormat, width, height, depth, border, format, type, heap, toTypedArrayIndex(pixels, heap)); + } else { + GLctx.texImage3D(target, level, internalFormat, width, height, depth, border, format, type, null); + } + }; + var _emscripten_glTexImage3D = _glTexImage3D; + + /** @suppress {duplicate } */ + var _glTexParameterf = (x0, x1, x2) => GLctx.texParameterf(x0, x1, x2); + var _emscripten_glTexParameterf = _glTexParameterf; + + /** @suppress {duplicate } */ + var _glTexParameterfv = (target, pname, params) => { + var param = HEAPF32[((params)>>2)]; + GLctx.texParameterf(target, pname, param); + }; + var _emscripten_glTexParameterfv = _glTexParameterfv; + + /** @suppress {duplicate } */ + var _glTexParameteri = (x0, x1, x2) => GLctx.texParameteri(x0, x1, x2); + var _emscripten_glTexParameteri = _glTexParameteri; + + /** @suppress {duplicate } */ + var _glTexParameteriv = (target, pname, params) => { + var param = HEAP32[((params)>>2)]; + GLctx.texParameteri(target, pname, param); + }; + var _emscripten_glTexParameteriv = _glTexParameteriv; + + /** @suppress {duplicate } */ + var _glTexStorage2D = (x0, x1, x2, x3, x4) => GLctx.texStorage2D(x0, x1, x2, x3, x4); + var _emscripten_glTexStorage2D = _glTexStorage2D; + + /** @suppress {duplicate } */ + var _glTexStorage3D = (x0, x1, x2, x3, x4, x5) => GLctx.texStorage3D(x0, x1, x2, x3, x4, x5); + var _emscripten_glTexStorage3D = _glTexStorage3D; + + + + + /** @suppress {duplicate } */ + var _glTexSubImage2D = (target, level, xoffset, yoffset, width, height, format, type, pixels) => { + if (GL.currentContext.version >= 2) { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + return; + } + if (pixels) { + var heap = heapObjectForWebGLType(type); + GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, heap, toTypedArrayIndex(pixels, heap)); + return; + } + } + var pixelData = pixels ? emscriptenWebGLGetTexPixelData(type, format, width, height, pixels, 0) : null; + GLctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixelData); + }; + var _emscripten_glTexSubImage2D = _glTexSubImage2D; + + + /** @suppress {duplicate } */ + var _glTexSubImage3D = (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) => { + if (GLctx.currentPixelUnpackBufferBinding) { + GLctx.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + } else if (pixels) { + var heap = heapObjectForWebGLType(type); + GLctx.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, heap, toTypedArrayIndex(pixels, heap)); + } else { + GLctx.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, null); + } + }; + var _emscripten_glTexSubImage3D = _glTexSubImage3D; + + /** @suppress {duplicate } */ + var _glTransformFeedbackVaryings = (program, count, varyings, bufferMode) => { + program = GL.programs[program]; + var vars = []; + for (var i = 0; i < count; i++) + vars.push(UTF8ToString(HEAP32[(((varyings)+(i*4))>>2)])); + + GLctx.transformFeedbackVaryings(program, vars, bufferMode); + }; + var _emscripten_glTransformFeedbackVaryings = _glTransformFeedbackVaryings; + + + /** @suppress {duplicate } */ + var _glUniform1f = (location, v0) => { + GLctx.uniform1f(webglGetUniformLocation(location), v0); + }; + var _emscripten_glUniform1f = _glUniform1f; + + + var miniTempWebGLFloatBuffers = []; + + /** @suppress {duplicate } */ + var _glUniform1fv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform1fv(webglGetUniformLocation(location), HEAPF32, ((value)>>2), count); + return; + } + + if (count <= 288) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[count-1]; + for (var i = 0; i < count; ++i) { + view[i] = HEAPF32[(((value)+(4*i))>>2)]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*4)>>2)); + } + GLctx.uniform1fv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform1fv = _glUniform1fv; + + + /** @suppress {duplicate } */ + var _glUniform1i = (location, v0) => { + GLctx.uniform1i(webglGetUniformLocation(location), v0); + }; + var _emscripten_glUniform1i = _glUniform1i; + + + var miniTempWebGLIntBuffers = []; + + /** @suppress {duplicate } */ + var _glUniform1iv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform1iv(webglGetUniformLocation(location), HEAP32, ((value)>>2), count); + return; + } + + if (count <= 288) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLIntBuffers[count-1]; + for (var i = 0; i < count; ++i) { + view[i] = HEAP32[(((value)+(4*i))>>2)]; + } + } else + { + var view = HEAP32.subarray((((value)>>2)), ((value+count*4)>>2)); + } + GLctx.uniform1iv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform1iv = _glUniform1iv; + + /** @suppress {duplicate } */ + var _glUniform1ui = (location, v0) => { + GLctx.uniform1ui(webglGetUniformLocation(location), v0); + }; + var _emscripten_glUniform1ui = _glUniform1ui; + + /** @suppress {duplicate } */ + var _glUniform1uiv = (location, count, value) => { + count && GLctx.uniform1uiv(webglGetUniformLocation(location), HEAPU32, ((value)>>2), count); + }; + var _emscripten_glUniform1uiv = _glUniform1uiv; + + + /** @suppress {duplicate } */ + var _glUniform2f = (location, v0, v1) => { + GLctx.uniform2f(webglGetUniformLocation(location), v0, v1); + }; + var _emscripten_glUniform2f = _glUniform2f; + + + + /** @suppress {duplicate } */ + var _glUniform2fv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform2fv(webglGetUniformLocation(location), HEAPF32, ((value)>>2), count*2); + return; + } + + if (count <= 144) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[2*count-1]; + for (var i = 0; i < 2*count; i += 2) { + view[i] = HEAPF32[(((value)+(4*i))>>2)]; + view[i+1] = HEAPF32[(((value)+(4*i+4))>>2)]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*8)>>2)); + } + GLctx.uniform2fv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform2fv = _glUniform2fv; + + + /** @suppress {duplicate } */ + var _glUniform2i = (location, v0, v1) => { + GLctx.uniform2i(webglGetUniformLocation(location), v0, v1); + }; + var _emscripten_glUniform2i = _glUniform2i; + + + + /** @suppress {duplicate } */ + var _glUniform2iv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform2iv(webglGetUniformLocation(location), HEAP32, ((value)>>2), count*2); + return; + } + + if (count <= 144) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLIntBuffers[2*count-1]; + for (var i = 0; i < 2*count; i += 2) { + view[i] = HEAP32[(((value)+(4*i))>>2)]; + view[i+1] = HEAP32[(((value)+(4*i+4))>>2)]; + } + } else + { + var view = HEAP32.subarray((((value)>>2)), ((value+count*8)>>2)); + } + GLctx.uniform2iv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform2iv = _glUniform2iv; + + /** @suppress {duplicate } */ + var _glUniform2ui = (location, v0, v1) => { + GLctx.uniform2ui(webglGetUniformLocation(location), v0, v1); + }; + var _emscripten_glUniform2ui = _glUniform2ui; + + /** @suppress {duplicate } */ + var _glUniform2uiv = (location, count, value) => { + count && GLctx.uniform2uiv(webglGetUniformLocation(location), HEAPU32, ((value)>>2), count*2); + }; + var _emscripten_glUniform2uiv = _glUniform2uiv; + + + /** @suppress {duplicate } */ + var _glUniform3f = (location, v0, v1, v2) => { + GLctx.uniform3f(webglGetUniformLocation(location), v0, v1, v2); + }; + var _emscripten_glUniform3f = _glUniform3f; + + + + /** @suppress {duplicate } */ + var _glUniform3fv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform3fv(webglGetUniformLocation(location), HEAPF32, ((value)>>2), count*3); + return; + } + + if (count <= 96) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[3*count-1]; + for (var i = 0; i < 3*count; i += 3) { + view[i] = HEAPF32[(((value)+(4*i))>>2)]; + view[i+1] = HEAPF32[(((value)+(4*i+4))>>2)]; + view[i+2] = HEAPF32[(((value)+(4*i+8))>>2)]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*12)>>2)); + } + GLctx.uniform3fv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform3fv = _glUniform3fv; + + + /** @suppress {duplicate } */ + var _glUniform3i = (location, v0, v1, v2) => { + GLctx.uniform3i(webglGetUniformLocation(location), v0, v1, v2); + }; + var _emscripten_glUniform3i = _glUniform3i; + + + + /** @suppress {duplicate } */ + var _glUniform3iv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform3iv(webglGetUniformLocation(location), HEAP32, ((value)>>2), count*3); + return; + } + + if (count <= 96) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLIntBuffers[3*count-1]; + for (var i = 0; i < 3*count; i += 3) { + view[i] = HEAP32[(((value)+(4*i))>>2)]; + view[i+1] = HEAP32[(((value)+(4*i+4))>>2)]; + view[i+2] = HEAP32[(((value)+(4*i+8))>>2)]; + } + } else + { + var view = HEAP32.subarray((((value)>>2)), ((value+count*12)>>2)); + } + GLctx.uniform3iv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform3iv = _glUniform3iv; + + /** @suppress {duplicate } */ + var _glUniform3ui = (location, v0, v1, v2) => { + GLctx.uniform3ui(webglGetUniformLocation(location), v0, v1, v2); + }; + var _emscripten_glUniform3ui = _glUniform3ui; + + /** @suppress {duplicate } */ + var _glUniform3uiv = (location, count, value) => { + count && GLctx.uniform3uiv(webglGetUniformLocation(location), HEAPU32, ((value)>>2), count*3); + }; + var _emscripten_glUniform3uiv = _glUniform3uiv; + + + /** @suppress {duplicate } */ + var _glUniform4f = (location, v0, v1, v2, v3) => { + GLctx.uniform4f(webglGetUniformLocation(location), v0, v1, v2, v3); + }; + var _emscripten_glUniform4f = _glUniform4f; + + + + /** @suppress {duplicate } */ + var _glUniform4fv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform4fv(webglGetUniformLocation(location), HEAPF32, ((value)>>2), count*4); + return; + } + + if (count <= 72) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[4*count-1]; + // hoist the heap out of the loop for size and for pthreads+growth. + var heap = HEAPF32; + value = ((value)>>2); + for (var i = 0; i < 4 * count; i += 4) { + var dst = value + i; + view[i] = heap[dst]; + view[i + 1] = heap[dst + 1]; + view[i + 2] = heap[dst + 2]; + view[i + 3] = heap[dst + 3]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*16)>>2)); + } + GLctx.uniform4fv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform4fv = _glUniform4fv; + + + /** @suppress {duplicate } */ + var _glUniform4i = (location, v0, v1, v2, v3) => { + GLctx.uniform4i(webglGetUniformLocation(location), v0, v1, v2, v3); + }; + var _emscripten_glUniform4i = _glUniform4i; + + + + /** @suppress {duplicate } */ + var _glUniform4iv = (location, count, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniform4iv(webglGetUniformLocation(location), HEAP32, ((value)>>2), count*4); + return; + } + + if (count <= 72) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLIntBuffers[4*count-1]; + for (var i = 0; i < 4*count; i += 4) { + view[i] = HEAP32[(((value)+(4*i))>>2)]; + view[i+1] = HEAP32[(((value)+(4*i+4))>>2)]; + view[i+2] = HEAP32[(((value)+(4*i+8))>>2)]; + view[i+3] = HEAP32[(((value)+(4*i+12))>>2)]; + } + } else + { + var view = HEAP32.subarray((((value)>>2)), ((value+count*16)>>2)); + } + GLctx.uniform4iv(webglGetUniformLocation(location), view); + }; + var _emscripten_glUniform4iv = _glUniform4iv; + + /** @suppress {duplicate } */ + var _glUniform4ui = (location, v0, v1, v2, v3) => { + GLctx.uniform4ui(webglGetUniformLocation(location), v0, v1, v2, v3); + }; + var _emscripten_glUniform4ui = _glUniform4ui; + + /** @suppress {duplicate } */ + var _glUniform4uiv = (location, count, value) => { + count && GLctx.uniform4uiv(webglGetUniformLocation(location), HEAPU32, ((value)>>2), count*4); + }; + var _emscripten_glUniform4uiv = _glUniform4uiv; + + /** @suppress {duplicate } */ + var _glUniformBlockBinding = (program, uniformBlockIndex, uniformBlockBinding) => { + program = GL.programs[program]; + + GLctx.uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); + }; + var _emscripten_glUniformBlockBinding = _glUniformBlockBinding; + + + + /** @suppress {duplicate } */ + var _glUniformMatrix2fv = (location, count, transpose, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*4); + return; + } + + if (count <= 72) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[4*count-1]; + for (var i = 0; i < 4*count; i += 4) { + view[i] = HEAPF32[(((value)+(4*i))>>2)]; + view[i+1] = HEAPF32[(((value)+(4*i+4))>>2)]; + view[i+2] = HEAPF32[(((value)+(4*i+8))>>2)]; + view[i+3] = HEAPF32[(((value)+(4*i+12))>>2)]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*16)>>2)); + } + GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, view); + }; + var _emscripten_glUniformMatrix2fv = _glUniformMatrix2fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix2x3fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix2x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*6); + }; + var _emscripten_glUniformMatrix2x3fv = _glUniformMatrix2x3fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix2x4fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix2x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*8); + }; + var _emscripten_glUniformMatrix2x4fv = _glUniformMatrix2x4fv; + + + + /** @suppress {duplicate } */ + var _glUniformMatrix3fv = (location, count, transpose, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*9); + return; + } + + if (count <= 32) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[9*count-1]; + for (var i = 0; i < 9*count; i += 9) { + view[i] = HEAPF32[(((value)+(4*i))>>2)]; + view[i+1] = HEAPF32[(((value)+(4*i+4))>>2)]; + view[i+2] = HEAPF32[(((value)+(4*i+8))>>2)]; + view[i+3] = HEAPF32[(((value)+(4*i+12))>>2)]; + view[i+4] = HEAPF32[(((value)+(4*i+16))>>2)]; + view[i+5] = HEAPF32[(((value)+(4*i+20))>>2)]; + view[i+6] = HEAPF32[(((value)+(4*i+24))>>2)]; + view[i+7] = HEAPF32[(((value)+(4*i+28))>>2)]; + view[i+8] = HEAPF32[(((value)+(4*i+32))>>2)]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*36)>>2)); + } + GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, view); + }; + var _emscripten_glUniformMatrix3fv = _glUniformMatrix3fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix3x2fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix3x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*6); + }; + var _emscripten_glUniformMatrix3x2fv = _glUniformMatrix3x2fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix3x4fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix3x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*12); + }; + var _emscripten_glUniformMatrix3x4fv = _glUniformMatrix3x4fv; + + + + /** @suppress {duplicate } */ + var _glUniformMatrix4fv = (location, count, transpose, value) => { + + if (GL.currentContext.version >= 2) { + count && GLctx.uniformMatrix4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*16); + return; + } + + if (count <= 18) { + // avoid allocation when uploading few enough uniforms + var view = miniTempWebGLFloatBuffers[16*count-1]; + // hoist the heap out of the loop for size and for pthreads+growth. + var heap = HEAPF32; + value = ((value)>>2); + for (var i = 0; i < 16 * count; i += 16) { + var dst = value + i; + view[i] = heap[dst]; + view[i + 1] = heap[dst + 1]; + view[i + 2] = heap[dst + 2]; + view[i + 3] = heap[dst + 3]; + view[i + 4] = heap[dst + 4]; + view[i + 5] = heap[dst + 5]; + view[i + 6] = heap[dst + 6]; + view[i + 7] = heap[dst + 7]; + view[i + 8] = heap[dst + 8]; + view[i + 9] = heap[dst + 9]; + view[i + 10] = heap[dst + 10]; + view[i + 11] = heap[dst + 11]; + view[i + 12] = heap[dst + 12]; + view[i + 13] = heap[dst + 13]; + view[i + 14] = heap[dst + 14]; + view[i + 15] = heap[dst + 15]; + } + } else + { + var view = HEAPF32.subarray((((value)>>2)), ((value+count*64)>>2)); + } + GLctx.uniformMatrix4fv(webglGetUniformLocation(location), !!transpose, view); + }; + var _emscripten_glUniformMatrix4fv = _glUniformMatrix4fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix4x2fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix4x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*8); + }; + var _emscripten_glUniformMatrix4x2fv = _glUniformMatrix4x2fv; + + /** @suppress {duplicate } */ + var _glUniformMatrix4x3fv = (location, count, transpose, value) => { + count && GLctx.uniformMatrix4x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, ((value)>>2), count*12); + }; + var _emscripten_glUniformMatrix4x3fv = _glUniformMatrix4x3fv; + + /** @suppress {duplicate } */ + var _glUseProgram = (program) => { + program = GL.programs[program]; + GLctx.useProgram(program); + // Record the currently active program so that we can access the uniform + // mapping table of that program. + GLctx.currentProgram = program; + }; + var _emscripten_glUseProgram = _glUseProgram; + + /** @suppress {duplicate } */ + var _glValidateProgram = (program) => { + GLctx.validateProgram(GL.programs[program]); + }; + var _emscripten_glValidateProgram = _glValidateProgram; + + /** @suppress {duplicate } */ + var _glVertexAttrib1f = (x0, x1) => GLctx.vertexAttrib1f(x0, x1); + var _emscripten_glVertexAttrib1f = _glVertexAttrib1f; + + /** @suppress {duplicate } */ + var _glVertexAttrib1fv = (index, v) => { + + GLctx.vertexAttrib1f(index, HEAPF32[v>>2]); + }; + var _emscripten_glVertexAttrib1fv = _glVertexAttrib1fv; + + /** @suppress {duplicate } */ + var _glVertexAttrib2f = (x0, x1, x2) => GLctx.vertexAttrib2f(x0, x1, x2); + var _emscripten_glVertexAttrib2f = _glVertexAttrib2f; + + /** @suppress {duplicate } */ + var _glVertexAttrib2fv = (index, v) => { + + GLctx.vertexAttrib2f(index, HEAPF32[v>>2], HEAPF32[v+4>>2]); + }; + var _emscripten_glVertexAttrib2fv = _glVertexAttrib2fv; + + /** @suppress {duplicate } */ + var _glVertexAttrib3f = (x0, x1, x2, x3) => GLctx.vertexAttrib3f(x0, x1, x2, x3); + var _emscripten_glVertexAttrib3f = _glVertexAttrib3f; + + /** @suppress {duplicate } */ + var _glVertexAttrib3fv = (index, v) => { + + GLctx.vertexAttrib3f(index, HEAPF32[v>>2], HEAPF32[v+4>>2], HEAPF32[v+8>>2]); + }; + var _emscripten_glVertexAttrib3fv = _glVertexAttrib3fv; + + /** @suppress {duplicate } */ + var _glVertexAttrib4f = (x0, x1, x2, x3, x4) => GLctx.vertexAttrib4f(x0, x1, x2, x3, x4); + var _emscripten_glVertexAttrib4f = _glVertexAttrib4f; + + /** @suppress {duplicate } */ + var _glVertexAttrib4fv = (index, v) => { + + GLctx.vertexAttrib4f(index, HEAPF32[v>>2], HEAPF32[v+4>>2], HEAPF32[v+8>>2], HEAPF32[v+12>>2]); + }; + var _emscripten_glVertexAttrib4fv = _glVertexAttrib4fv; + + /** @suppress {duplicate } */ + var _glVertexAttribDivisor = (index, divisor) => { + GLctx.vertexAttribDivisor(index, divisor); + }; + var _emscripten_glVertexAttribDivisor = _glVertexAttribDivisor; + + + /** @suppress {duplicate } */ + var _glVertexAttribDivisorANGLE = _glVertexAttribDivisor; + var _emscripten_glVertexAttribDivisorANGLE = _glVertexAttribDivisorANGLE; + + + /** @suppress {duplicate } */ + var _glVertexAttribDivisorARB = _glVertexAttribDivisor; + var _emscripten_glVertexAttribDivisorARB = _glVertexAttribDivisorARB; + + + /** @suppress {duplicate } */ + var _glVertexAttribDivisorEXT = _glVertexAttribDivisor; + var _emscripten_glVertexAttribDivisorEXT = _glVertexAttribDivisorEXT; + + + /** @suppress {duplicate } */ + var _glVertexAttribDivisorNV = _glVertexAttribDivisor; + var _emscripten_glVertexAttribDivisorNV = _glVertexAttribDivisorNV; + + /** @suppress {duplicate } */ + var _glVertexAttribI4i = (x0, x1, x2, x3, x4) => GLctx.vertexAttribI4i(x0, x1, x2, x3, x4); + var _emscripten_glVertexAttribI4i = _glVertexAttribI4i; + + /** @suppress {duplicate } */ + var _glVertexAttribI4iv = (index, v) => { + GLctx.vertexAttribI4i(index, HEAP32[v>>2], HEAP32[v+4>>2], HEAP32[v+8>>2], HEAP32[v+12>>2]); + }; + var _emscripten_glVertexAttribI4iv = _glVertexAttribI4iv; + + /** @suppress {duplicate } */ + var _glVertexAttribI4ui = (x0, x1, x2, x3, x4) => GLctx.vertexAttribI4ui(x0, x1, x2, x3, x4); + var _emscripten_glVertexAttribI4ui = _glVertexAttribI4ui; + + /** @suppress {duplicate } */ + var _glVertexAttribI4uiv = (index, v) => { + GLctx.vertexAttribI4ui(index, HEAPU32[v>>2], HEAPU32[v+4>>2], HEAPU32[v+8>>2], HEAPU32[v+12>>2]); + }; + var _emscripten_glVertexAttribI4uiv = _glVertexAttribI4uiv; + + /** @suppress {duplicate } */ + var _glVertexAttribIPointer = (index, size, type, stride, ptr) => { + GLctx.vertexAttribIPointer(index, size, type, stride, ptr); + }; + var _emscripten_glVertexAttribIPointer = _glVertexAttribIPointer; + + /** @suppress {duplicate } */ + var _glVertexAttribPointer = (index, size, type, normalized, stride, ptr) => { + GLctx.vertexAttribPointer(index, size, type, !!normalized, stride, ptr); + }; + var _emscripten_glVertexAttribPointer = _glVertexAttribPointer; + + /** @suppress {duplicate } */ + var _glViewport = (x0, x1, x2, x3) => GLctx.viewport(x0, x1, x2, x3); + var _emscripten_glViewport = _glViewport; + + /** @suppress {duplicate } */ + var _glWaitSync = (sync, flags, timeout) => { + // See WebGL2 vs GLES3 difference on GL_TIMEOUT_IGNORED above (https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.15) + timeout = Number(timeout); + GLctx.waitSync(GL.syncs[sync], flags, timeout); + }; + var _emscripten_glWaitSync = _glWaitSync; + + + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = (size - b.byteLength + 65535) / 65536; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1 /*success*/; + } catch(e) { + } + // implicit 0 return to save code size (caller will cast "undefined" into 0 + // anyhow) + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. + requestedSize >>>= 0; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + + var alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple; + + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296 ); + + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + + var replacement = growMemory(newSize); + if (replacement) { + + return true; + } + } + return false; + }; + + var ENV = { + }; + + var getExecutableName = () => { + return thisProgram || './this.program'; + }; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == 'object' && navigator.languages && navigator.languages[0]) || 'C').replace('-', '_') + '.UTF-8'; + var env = { + 'USER': 'web_user', + 'LOGNAME': 'web_user', + 'PATH': '/', + 'PWD': '/', + 'HOME': '/home/web_user', + 'LANG': lang, + '_': getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++] = str.charCodeAt(i); + } + // Null-terminate the string + HEAP8[buffer] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU32[(((__environ)+(i*4))>>2)] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[((penviron_count)>>2)] = strings.length; + var bufSize = 0; + strings.forEach((string) => bufSize += string.length + 1); + HEAPU32[((penviron_buf_size)>>2)] = bufSize; + return 0; + }; + + + function _fd_close(fd) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + /** @param {number=} offset */ + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[((iov)>>2)]; + var len = HEAPU32[(((iov)+(4))>>2)]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; // nothing more to read + if (typeof offset !== 'undefined') { + offset += curr; + } + } + return ret; + }; + + + function _fd_pread(fd, iov, iovcnt, offset, pnum) { + offset = bigintToI53Checked(offset); + + + try { + + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd) + var num = doReadv(stream, iov, iovcnt, offset); + HEAPU32[((pnum)>>2)] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + ; + } + + /** @param {number=} offset */ + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[((iov)>>2)]; + var len = HEAPU32[(((iov)+(4))>>2)]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (typeof offset !== 'undefined') { + offset += curr; + } + } + return ret; + }; + + + function _fd_pwrite(fd, iov, iovcnt, offset, pnum) { + offset = bigintToI53Checked(offset); + + + try { + + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd) + var num = doWritev(stream, iov, iovcnt, offset); + HEAPU32[((pnum)>>2)] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + ; + } + + + function _fd_read(fd, iov, iovcnt, pnum) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[((pnum)>>2)] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + + + try { + + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset)>>3)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; // reset readdir state + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + ; + } + + function _fd_sync(fd) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + if (stream.stream_ops?.fsync) { + return stream.stream_ops.fsync(stream); + } + return 0; // we can't do anything synchronously; the in-memory FS is already synced to + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + + function _fd_write(fd, iov, iovcnt, pnum) { + try { + + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[((pnum)>>2)] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var _glDrawArraysInstancedBaseInstanceWEBGL = (mode, first, count, instanceCount, baseInstance) => { + GLctx.dibvbi['drawArraysInstancedBaseInstanceWEBGL'](mode, first, count, instanceCount, baseInstance); + }; + + + + + var _glDrawElementsInstancedBaseVertexBaseInstanceWEBGL = (mode, count, type, offset, instanceCount, baseVertex, baseinstance) => { + GLctx.dibvbi['drawElementsInstancedBaseVertexBaseInstanceWEBGL'](mode, count, type, offset, instanceCount, baseVertex, baseinstance); + }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var _glMultiDrawArraysInstancedBaseInstanceWEBGL = (mode, firsts, counts, instanceCounts, baseInstances, drawCount) => { + GLctx.mdibvbi['multiDrawArraysInstancedBaseInstanceWEBGL']( + mode, + HEAP32, + ((firsts)>>2), + HEAP32, + ((counts)>>2), + HEAP32, + ((instanceCounts)>>2), + HEAPU32, + ((baseInstances)>>2), + drawCount); + }; + + var _glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL = (mode, counts, type, offsets, instanceCounts, baseVertices, baseInstances, drawCount) => { + GLctx.mdibvbi['multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL']( + mode, + HEAP32, + ((counts)>>2), + type, + HEAP32, + ((offsets)>>2), + HEAP32, + ((instanceCounts)>>2), + HEAP32, + ((baseVertices)>>2), + HEAPU32, + ((baseInstances)>>2), + drawCount); + }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var DOTNET = { + setup:function setup(emscriptenBuildOptions) { + // USE_PTHREADS is emscripten's define symbol, which is passed to acorn optimizer, so we could use it here + const modulePThread = {}; + const ENVIRONMENT_IS_PTHREAD = false; + const dotnet_replacements = { + fetch: globalThis.fetch, + ENVIRONMENT_IS_WORKER, + require, + modulePThread, + scriptDirectory, + }; + + ENVIRONMENT_IS_WORKER = dotnet_replacements.ENVIRONMENT_IS_WORKER; + Module.__dotnet_runtime.initializeReplacements(dotnet_replacements); + noExitRuntime = dotnet_replacements.noExitRuntime; + fetch = dotnet_replacements.fetch; + require = dotnet_replacements.require; + _scriptDir = __dirname = scriptDirectory = dotnet_replacements.scriptDirectory; + Module.__dotnet_runtime.passEmscriptenInternals({ + isPThread: ENVIRONMENT_IS_PTHREAD, + quit_, ExitStatus, + updateMemoryViews, + getMemory: () => { return wasmMemory; }, + getWasmIndirectFunctionTable: () => { return wasmTable; }, + }, emscriptenBuildOptions); + + Module.__dotnet_runtime.configureEmscriptenStartup(Module); + }, + }; + function _mono_interp_flush_jitcall_queue( + ) { + return {runtime_idx:12};//mono_interp_flush_jitcall_queue + } + + function _mono_interp_invoke_wasm_jit_call_trampoline( + ) { + return {runtime_idx:11};//mono_interp_invoke_wasm_jit_call_trampoline + } + + function _mono_interp_jit_wasm_entry_trampoline( + ) { + return {runtime_idx:9};//mono_interp_jit_wasm_entry_trampoline + } + + function _mono_interp_jit_wasm_jit_call_trampoline( + ) { + return {runtime_idx:10};//mono_interp_jit_wasm_jit_call_trampoline + } + + function _mono_interp_record_interp_entry( + ) { + return {runtime_idx:8};//mono_interp_record_interp_entry + } + + function _mono_interp_tier_prepare_jiterpreter( + ) { + return {runtime_idx:7};//mono_interp_tier_prepare_jiterpreter + } + + function _mono_wasm_bind_js_import_ST( + ) { + return {runtime_idx:22};//mono_wasm_bind_js_import_ST + } + + function _mono_wasm_browser_entropy( + ) { + return {runtime_idx:18};//mono_wasm_browser_entropy + } + + function _mono_wasm_cancel_promise( + ) { + return {runtime_idx:26};//mono_wasm_cancel_promise + } + + function _mono_wasm_console_clear( + ) { + return {runtime_idx:20};//mono_wasm_console_clear + } + + function _mono_wasm_free_method_data( + ) { + return {runtime_idx:13};//mono_wasm_free_method_data + } + + function _mono_wasm_get_locale_info( + ) { + return {runtime_idx:27};//mono_wasm_get_locale_info + } + + function _mono_wasm_invoke_js_function( + ) { + return {runtime_idx:23};//mono_wasm_invoke_js_function + } + + function _mono_wasm_invoke_jsimport_ST( + ) { + return {runtime_idx:24};//mono_wasm_invoke_jsimport_ST + } + + function _mono_wasm_process_current_pid( + ) { + return {runtime_idx:19};//mono_wasm_process_current_pid + } + + function _mono_wasm_release_cs_owned_object( + ) { + return {runtime_idx:21};//mono_wasm_release_cs_owned_object + } + + function _mono_wasm_resolve_or_reject_promise( + ) { + return {runtime_idx:25};//mono_wasm_resolve_or_reject_promise + } + + function _mono_wasm_schedule_timer( + ) { + return {runtime_idx:0};//mono_wasm_schedule_timer + } + + function _mono_wasm_set_entrypoint_breakpoint( + ) { + return {runtime_idx:17};//mono_wasm_set_entrypoint_breakpoint + } + + function _mono_wasm_trace_logger( + ) { + return {runtime_idx:16};//mono_wasm_trace_logger + } + + function _schedule_background_exec( + ) { + return {runtime_idx:6};//schedule_background_exec + } + + + var arraySum = (array, index) => { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) { + // no-op + } + return sum; + }; + + + var MONTH_DAYS_LEAP = [31,29,31,30,31,30,31,31,30,31,30,31]; + + var MONTH_DAYS_REGULAR = [31,28,31,30,31,30,31,31,30,31,30,31]; + var addDays = (date, days) => { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = (leap ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR)[currentMonth]; + + if (days > daysInCurrentMonth-newDate.getDate()) { + // we spill over to next month + days -= (daysInCurrentMonth-newDate.getDate()+1); + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth+1) + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear()+1); + } + } else { + // we stay in current month + newDate.setDate(newDate.getDate()+days); + return newDate; + } + } + + return newDate; + }; + + + + + var writeArrayToMemory = (array, buffer) => { + HEAP8.set(array, buffer); + }; + + var _strftime = (s, maxsize, format, tm) => { + // size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr); + // http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html + + var tm_zone = HEAPU32[(((tm)+(40))>>2)]; + + var date = { + tm_sec: HEAP32[((tm)>>2)], + tm_min: HEAP32[(((tm)+(4))>>2)], + tm_hour: HEAP32[(((tm)+(8))>>2)], + tm_mday: HEAP32[(((tm)+(12))>>2)], + tm_mon: HEAP32[(((tm)+(16))>>2)], + tm_year: HEAP32[(((tm)+(20))>>2)], + tm_wday: HEAP32[(((tm)+(24))>>2)], + tm_yday: HEAP32[(((tm)+(28))>>2)], + tm_isdst: HEAP32[(((tm)+(32))>>2)], + tm_gmtoff: HEAP32[(((tm)+(36))>>2)], + tm_zone: tm_zone ? UTF8ToString(tm_zone) : '' + }; + + + var pattern = UTF8ToString(format); + + // expand format + var EXPANSION_RULES_1 = { + '%c': '%a %b %d %H:%M:%S %Y', // Replaced by the locale's appropriate date and time representation - e.g., Mon Aug 3 14:02:01 2013 + '%D': '%m/%d/%y', // Equivalent to %m / %d / %y + '%F': '%Y-%m-%d', // Equivalent to %Y - %m - %d + '%h': '%b', // Equivalent to %b + '%r': '%I:%M:%S %p', // Replaced by the time in a.m. and p.m. notation + '%R': '%H:%M', // Replaced by the time in 24-hour notation + '%T': '%H:%M:%S', // Replaced by the time + '%x': '%m/%d/%y', // Replaced by the locale's appropriate date representation + '%X': '%H:%M:%S', // Replaced by the locale's appropriate time representation + // Modified Conversion Specifiers + '%Ec': '%c', // Replaced by the locale's alternative appropriate date and time representation. + '%EC': '%C', // Replaced by the name of the base year (period) in the locale's alternative representation. + '%Ex': '%m/%d/%y', // Replaced by the locale's alternative date representation. + '%EX': '%H:%M:%S', // Replaced by the locale's alternative time representation. + '%Ey': '%y', // Replaced by the offset from %EC (year only) in the locale's alternative representation. + '%EY': '%Y', // Replaced by the full alternative year representation. + '%Od': '%d', // Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading zeros if there is any alternative symbol for zero; otherwise, with leading characters. + '%Oe': '%e', // Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading characters. + '%OH': '%H', // Replaced by the hour (24-hour clock) using the locale's alternative numeric symbols. + '%OI': '%I', // Replaced by the hour (12-hour clock) using the locale's alternative numeric symbols. + '%Om': '%m', // Replaced by the month using the locale's alternative numeric symbols. + '%OM': '%M', // Replaced by the minutes using the locale's alternative numeric symbols. + '%OS': '%S', // Replaced by the seconds using the locale's alternative numeric symbols. + '%Ou': '%u', // Replaced by the weekday as a number in the locale's alternative representation (Monday=1). + '%OU': '%U', // Replaced by the week number of the year (Sunday as the first day of the week, rules corresponding to %U ) using the locale's alternative numeric symbols. + '%OV': '%V', // Replaced by the week number of the year (Monday as the first day of the week, rules corresponding to %V ) using the locale's alternative numeric symbols. + '%Ow': '%w', // Replaced by the number of the weekday (Sunday=0) using the locale's alternative numeric symbols. + '%OW': '%W', // Replaced by the week number of the year (Monday as the first day of the week) using the locale's alternative numeric symbols. + '%Oy': '%y', // Replaced by the year (offset from %C ) using the locale's alternative numeric symbols. + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_1[rule]); + } + + var WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; + var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + + function leadingSomething(value, digits, character) { + var str = typeof value == 'number' ? value.toString() : (value || ''); + while (str.length < digits) { + str = character[0]+str; + } + return str; + } + + function leadingNulls(value, digits) { + return leadingSomething(value, digits, '0'); + } + + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : (value > 0 ? 1 : 0); + } + + var compare; + if ((compare = sgn(date1.getFullYear()-date2.getFullYear())) === 0) { + if ((compare = sgn(date1.getMonth()-date2.getMonth())) === 0) { + compare = sgn(date1.getDate()-date2.getDate()); + } + } + return compare; + } + + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: // Sunday + return new Date(janFourth.getFullYear()-1, 11, 29); + case 1: // Monday + return janFourth; + case 2: // Tuesday + return new Date(janFourth.getFullYear(), 0, 3); + case 3: // Wednesday + return new Date(janFourth.getFullYear(), 0, 2); + case 4: // Thursday + return new Date(janFourth.getFullYear(), 0, 1); + case 5: // Friday + return new Date(janFourth.getFullYear()-1, 11, 31); + case 6: // Saturday + return new Date(janFourth.getFullYear()-1, 11, 30); + } + } + + function getWeekBasedYear(date) { + var thisDate = addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday); + + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear()+1, 0, 4); + + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + // this date is after the start of the first week of this year + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear()+1; + } + return thisDate.getFullYear(); + } + return thisDate.getFullYear()-1; + } + + var EXPANSION_RULES_2 = { + '%a': (date) => WEEKDAYS[date.tm_wday].substring(0,3) , + '%A': (date) => WEEKDAYS[date.tm_wday], + '%b': (date) => MONTHS[date.tm_mon].substring(0,3), + '%B': (date) => MONTHS[date.tm_mon], + '%C': (date) => { + var year = date.tm_year+1900; + return leadingNulls((year/100)|0,2); + }, + '%d': (date) => leadingNulls(date.tm_mday, 2), + '%e': (date) => leadingSomething(date.tm_mday, 2, ' '), + '%g': (date) => { + // %g, %G, and %V give values according to the ISO 8601:2000 standard week-based year. + // In this system, weeks begin on a Monday and week 1 of the year is the week that includes + // January 4th, which is also the week that includes the first Thursday of the year, and + // is also the first week that contains at least four days in the year. + // If the first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of + // the last week of the preceding year; thus, for Saturday 2nd January 1999, + // %G is replaced by 1998 and %V is replaced by 53. If December 29th, 30th, + // or 31st is a Monday, it and any following days are part of week 1 of the following year. + // Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and %V is replaced by 01. + + return getWeekBasedYear(date).toString().substring(2); + }, + '%G': getWeekBasedYear, + '%H': (date) => leadingNulls(date.tm_hour, 2), + '%I': (date) => { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; + else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + '%j': (date) => { + // Day of the year (001-366) + return leadingNulls(date.tm_mday + arraySum(isLeapYear(date.tm_year+1900) ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR, date.tm_mon-1), 3); + }, + '%m': (date) => leadingNulls(date.tm_mon+1, 2), + '%M': (date) => leadingNulls(date.tm_min, 2), + '%n': () => '\n', + '%p': (date) => { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return 'AM'; + } + return 'PM'; + }, + '%S': (date) => leadingNulls(date.tm_sec, 2), + '%t': () => '\t', + '%u': (date) => date.tm_wday || 7, + '%U': (date) => { + var days = date.tm_yday + 7 - date.tm_wday; + return leadingNulls(Math.floor(days / 7), 2); + }, + '%V': (date) => { + // Replaced by the week number of the year (Monday as the first day of the week) + // as a decimal number [01,53]. If the week containing 1 January has four + // or more days in the new year, then it is considered week 1. + // Otherwise, it is the last week of the previous year, and the next week is week 1. + // Both January 4th and the first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday] + var val = Math.floor((date.tm_yday + 7 - (date.tm_wday + 6) % 7 ) / 7); + // If 1 Jan is just 1-3 days past Monday, the previous week + // is also in this year. + if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) { + val++; + } + if (!val) { + val = 52; + // If 31 December of prev year a Thursday, or Friday of a + // leap year, then the prev year has 53 weeks. + var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7; + if (dec31 == 4 || (dec31 == 5 && isLeapYear(date.tm_year%400-1))) { + val++; + } + } else if (val == 53) { + // If 1 January is not a Thursday, and not a Wednesday of a + // leap year, then this year has only 52 weeks. + var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7; + if (jan1 != 4 && (jan1 != 3 || !isLeapYear(date.tm_year))) + val = 1; + } + return leadingNulls(val, 2); + }, + '%w': (date) => date.tm_wday, + '%W': (date) => { + var days = date.tm_yday + 7 - ((date.tm_wday + 6) % 7); + return leadingNulls(Math.floor(days / 7), 2); + }, + '%y': (date) => { + // Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year] + return (date.tm_year+1900).toString().substring(2); + }, + // Replaced by the year as a decimal number (for example, 1997). [ tm_year] + '%Y': (date) => date.tm_year+1900, + '%z': (date) => { + // Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ). + // For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich). + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + // convert from minutes into hhmm format (which means 60 minutes = 100 units) + off = (off / 60)*100 + (off % 60); + return (ahead ? '+' : '-') + String("0000" + off).slice(-4); + }, + '%Z': (date) => date.tm_zone, + '%%': () => '%' + }; + + // Replace %% with a pair of NULLs (which cannot occur in a C string), then + // re-inject them after processing. + pattern = pattern.replace(/%%/g, '\0\0') + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_2[rule](date)); + } + } + pattern = pattern.replace(/\0\0/g, '%') + + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + + writeArrayToMemory(bytes, s); + return bytes.length-1; + }; + + var _strftime_l = (s, maxsize, format, tm, loc) => { + return _strftime(s, maxsize, format, tm); // no locale support yet + }; + + + + + var getCFunc = (ident) => { + var func = Module['_' + ident]; // closure exported function + return func; + }; + + + + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + + + + + + /** + * @param {string|null=} returnType + * @param {Array=} argTypes + * @param {Arguments|Array=} args + * @param {Object=} opts + */ + var ccall = (ident, returnType, argTypes, args, opts) => { + // For fast lookup of conversion functions + var toC = { + 'string': (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { // null string + // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0' + ret = stringToUTF8OnStack(str); + } + return ret; + }, + 'array': (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + + function convertReturnValue(ret) { + if (returnType === 'string') { + + return UTF8ToString(ret); + } + if (returnType === 'boolean') return Boolean(ret); + return ret; + } + + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func(...cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + + ret = onDone(ret); + return ret; + }; + + + + /** + * @param {string=} returnType + * @param {Array=} argTypes + * @param {Object=} opts + */ + var cwrap = (ident, returnType, argTypes, opts) => { + // When the function takes numbers and returns a number, we can just return + // the original function + var numericArgs = !argTypes || argTypes.every((type) => type === 'number' || type === 'boolean'); + var numericRet = returnType !== 'string'; + if (numericRet && numericArgs && !opts) { + return getCFunc(ident); + } + return (...args) => ccall(ident, returnType, argTypes, args, opts); + }; + + + + + + + + + var uleb128Encode = (n, target) => { + if (n < 128) { + target.push(n); + } else { + target.push((n % 128) | 128, n >> 7); + } + }; + + var sigToWasmTypes = (sig) => { + var typeNames = { + 'i': 'i32', + 'j': 'i64', + 'f': 'f32', + 'd': 'f64', + 'e': 'externref', + 'p': 'i32', + }; + var type = { + parameters: [], + results: sig[0] == 'v' ? [] : [typeNames[sig[0]]] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return type; + }; + + var generateFuncType = (sig, target) => { + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + 'i': 0x7f, // i32 + 'p': 0x7f, // i32 + 'j': 0x7e, // i64 + 'f': 0x7d, // f32 + 'd': 0x7c, // f64 + 'e': 0x6f, // externref + }; + + // Parameters, length + signatures + target.push(0x60 /* form: func */); + uleb128Encode(sigParam.length, target); + for (var i = 0; i < sigParam.length; ++i) { + target.push(typeCodes[sigParam[i]]); + } + + // Return values, length + signatures + // With no multi-return in MVP, either 0 (void) or 1 (anything else) + if (sigRet == 'v') { + target.push(0x00); + } else { + target.push(0x01, typeCodes[sigRet]); + } + }; + var convertJsFunctionToWasm = (func, sig) => { + + // If the type reflection proposal is available, use the new + // "WebAssembly.Function" constructor. + // Otherwise, construct a minimal wasm module importing the JS function and + // re-exporting it. + if (typeof WebAssembly.Function == "function") { + return new WebAssembly.Function(sigToWasmTypes(sig), func); + } + + // The module is static, with the exception of the type section, which is + // generated based on the signature passed in. + var typeSectionBody = [ + 0x01, // count: 1 + ]; + generateFuncType(sig, typeSectionBody); + + // Rest of the module is static + var bytes = [ + 0x00, 0x61, 0x73, 0x6d, // magic ("\0asm") + 0x01, 0x00, 0x00, 0x00, // version: 1 + 0x01, // Type section code + ]; + // Write the overall length of the type section followed by the body + uleb128Encode(typeSectionBody.length, bytes); + bytes.push(...typeSectionBody); + + // The rest of the module is static + bytes.push( + 0x02, 0x07, // import section + // (import "e" "f" (func 0 (type 0))) + 0x01, 0x01, 0x65, 0x01, 0x66, 0x00, 0x00, + 0x07, 0x05, // export section + // (export "f" (func 0 (type 0))) + 0x01, 0x01, 0x66, 0x00, 0x00, + ); + + // We can compile this wasm module synchronously because it is very small. + // This accepts an import (at "e.f"), that it reroutes to an export (at "f") + var module = new WebAssembly.Module(new Uint8Array(bytes)); + var instance = new WebAssembly.Instance(module, { 'e': { 'f': func } }); + var wrappedFunc = instance.exports['f']; + return wrappedFunc; + }; + + var wasmTableMirror = []; + + var wasmTable; + var getWasmTableEntry = (funcPtr) => { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + return func; + }; + + var updateTableMap = (offset, count) => { + if (functionsInTableMap) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + // Ignore null values. + if (item) { + functionsInTableMap.set(item, i); + } + } + } + }; + + var functionsInTableMap; + + var getFunctionAddress = (func) => { + // First, create the map if this is the first use. + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + return functionsInTableMap.get(func) || 0; + }; + + + var freeTableIndexes = []; + + var getEmptyTableSlot = () => { + // Reuse a free index if there is one, otherwise grow. + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + // Grow the table + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw 'Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.'; + } + return wasmTable.length - 1; + }; + + + + var setWasmTableEntry = (idx, func) => { + wasmTable.set(idx, func); + // With ABORT_ON_WASM_EXCEPTIONS wasmTable.get is overridden to return wrapped + // functions so we need to call it here to retrieve the potential wrapper correctly + // instead of just storing 'func' directly into wasmTableMirror + wasmTableMirror[idx] = wasmTable.get(idx); + }; + + /** @param {string=} sig */ + var addFunction = (func, sig) => { + // Check if the function is already in the table, to ensure each function + // gets a unique index. + var rtn = getFunctionAddress(func); + if (rtn) { + return rtn; + } + + // It's not in the table, add it now. + + var ret = getEmptyTableSlot(); + + // Set the new value. + try { + // Attempting to call this with JS function will cause of table.set() to fail + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + + functionsInTableMap.set(func, ret); + + return ret; + }; + + var handleException = (e) => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == 'unwind') { + return EXITSTATUS; + } + quit_(1, e); + }; + + + + var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (runtimeExited || ABORT) { + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + + var runtimeKeepalivePop = () => { + runtimeKeepaliveCounter -= 1; + }; + /** @param {number=} timeout */ + var safeSetTimeout = (func, timeout) => { + runtimeKeepalivePush(); + return setTimeout(() => { + runtimeKeepalivePop(); + callUserCallback(func); + }, timeout); + }; + + + + + + + var FS_unlink = (path) => FS.unlink(path); + + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit();Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_unlink"] = FS.unlink;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createDevice"] = FS.createDevice;; +var GLctx;; +for (var i = 0; i < 32; ++i) tempFixedLengthArray.push(new Array(i));; +var miniTempWebGLFloatBuffersStorage = new Float32Array(288); + for (/**@suppress{duplicate}*/var i = 0; i < 288; ++i) { + miniTempWebGLFloatBuffers[i] = miniTempWebGLFloatBuffersStorage.subarray(0, i+1); + }; +var miniTempWebGLIntBuffersStorage = new Int32Array(288); + for (/**@suppress{duplicate}*/var i = 0; i < 288; ++i) { + miniTempWebGLIntBuffers[i] = miniTempWebGLIntBuffersStorage.subarray(0, i+1); + }; +DOTNET.setup({ wasmEnableSIMD: true,wasmEnableEH: true,enableAotProfiler: false, enableDevToolsProfiler: false, enableLogProfiler: false, enableEventPipe: false, runAOTCompilation: false, wasmEnableThreads: false, gitHash: "44525024595742ebe09023abe709df51de65009b", });; +var wasmImports = { + /** @export */ + __assert_fail: ___assert_fail, + /** @export */ + __syscall_connect: ___syscall_connect, + /** @export */ + __syscall_faccessat: ___syscall_faccessat, + /** @export */ + __syscall_fadvise64: ___syscall_fadvise64, + /** @export */ + __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ + __syscall_fstat64: ___syscall_fstat64, + /** @export */ + __syscall_fstatfs64: ___syscall_fstatfs64, + /** @export */ + __syscall_ftruncate64: ___syscall_ftruncate64, + /** @export */ + __syscall_getcwd: ___syscall_getcwd, + /** @export */ + __syscall_getdents64: ___syscall_getdents64, + /** @export */ + __syscall_ioctl: ___syscall_ioctl, + /** @export */ + __syscall_lstat64: ___syscall_lstat64, + /** @export */ + __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ + __syscall_openat: ___syscall_openat, + /** @export */ + __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ + __syscall_sendto: ___syscall_sendto, + /** @export */ + __syscall_socket: ___syscall_socket, + /** @export */ + __syscall_stat64: ___syscall_stat64, + /** @export */ + __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ + _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, + /** @export */ + _gmtime_js: __gmtime_js, + /** @export */ + _localtime_js: __localtime_js, + /** @export */ + _mmap_js: __mmap_js, + /** @export */ + _munmap_js: __munmap_js, + /** @export */ + _tzset_js: __tzset_js, + /** @export */ + abort: _abort, + /** @export */ + emscripten_date_now: _emscripten_date_now, + /** @export */ + emscripten_force_exit: _emscripten_force_exit, + /** @export */ + emscripten_get_heap_max: _emscripten_get_heap_max, + /** @export */ + emscripten_get_now: _emscripten_get_now, + /** @export */ + emscripten_get_now_res: _emscripten_get_now_res, + /** @export */ + emscripten_glActiveTexture: _emscripten_glActiveTexture, + /** @export */ + emscripten_glAttachShader: _emscripten_glAttachShader, + /** @export */ + emscripten_glBeginQuery: _emscripten_glBeginQuery, + /** @export */ + emscripten_glBeginQueryEXT: _emscripten_glBeginQueryEXT, + /** @export */ + emscripten_glBeginTransformFeedback: _emscripten_glBeginTransformFeedback, + /** @export */ + emscripten_glBindAttribLocation: _emscripten_glBindAttribLocation, + /** @export */ + emscripten_glBindBuffer: _emscripten_glBindBuffer, + /** @export */ + emscripten_glBindBufferBase: _emscripten_glBindBufferBase, + /** @export */ + emscripten_glBindBufferRange: _emscripten_glBindBufferRange, + /** @export */ + emscripten_glBindFramebuffer: _emscripten_glBindFramebuffer, + /** @export */ + emscripten_glBindRenderbuffer: _emscripten_glBindRenderbuffer, + /** @export */ + emscripten_glBindSampler: _emscripten_glBindSampler, + /** @export */ + emscripten_glBindTexture: _emscripten_glBindTexture, + /** @export */ + emscripten_glBindTransformFeedback: _emscripten_glBindTransformFeedback, + /** @export */ + emscripten_glBindVertexArray: _emscripten_glBindVertexArray, + /** @export */ + emscripten_glBindVertexArrayOES: _emscripten_glBindVertexArrayOES, + /** @export */ + emscripten_glBlendColor: _emscripten_glBlendColor, + /** @export */ + emscripten_glBlendEquation: _emscripten_glBlendEquation, + /** @export */ + emscripten_glBlendEquationSeparate: _emscripten_glBlendEquationSeparate, + /** @export */ + emscripten_glBlendFunc: _emscripten_glBlendFunc, + /** @export */ + emscripten_glBlendFuncSeparate: _emscripten_glBlendFuncSeparate, + /** @export */ + emscripten_glBlitFramebuffer: _emscripten_glBlitFramebuffer, + /** @export */ + emscripten_glBufferData: _emscripten_glBufferData, + /** @export */ + emscripten_glBufferSubData: _emscripten_glBufferSubData, + /** @export */ + emscripten_glCheckFramebufferStatus: _emscripten_glCheckFramebufferStatus, + /** @export */ + emscripten_glClear: _emscripten_glClear, + /** @export */ + emscripten_glClearBufferfi: _emscripten_glClearBufferfi, + /** @export */ + emscripten_glClearBufferfv: _emscripten_glClearBufferfv, + /** @export */ + emscripten_glClearBufferiv: _emscripten_glClearBufferiv, + /** @export */ + emscripten_glClearBufferuiv: _emscripten_glClearBufferuiv, + /** @export */ + emscripten_glClearColor: _emscripten_glClearColor, + /** @export */ + emscripten_glClearDepthf: _emscripten_glClearDepthf, + /** @export */ + emscripten_glClearStencil: _emscripten_glClearStencil, + /** @export */ + emscripten_glClientWaitSync: _emscripten_glClientWaitSync, + /** @export */ + emscripten_glColorMask: _emscripten_glColorMask, + /** @export */ + emscripten_glCompileShader: _emscripten_glCompileShader, + /** @export */ + emscripten_glCompressedTexImage2D: _emscripten_glCompressedTexImage2D, + /** @export */ + emscripten_glCompressedTexImage3D: _emscripten_glCompressedTexImage3D, + /** @export */ + emscripten_glCompressedTexSubImage2D: _emscripten_glCompressedTexSubImage2D, + /** @export */ + emscripten_glCompressedTexSubImage3D: _emscripten_glCompressedTexSubImage3D, + /** @export */ + emscripten_glCopyBufferSubData: _emscripten_glCopyBufferSubData, + /** @export */ + emscripten_glCopyTexImage2D: _emscripten_glCopyTexImage2D, + /** @export */ + emscripten_glCopyTexSubImage2D: _emscripten_glCopyTexSubImage2D, + /** @export */ + emscripten_glCopyTexSubImage3D: _emscripten_glCopyTexSubImage3D, + /** @export */ + emscripten_glCreateProgram: _emscripten_glCreateProgram, + /** @export */ + emscripten_glCreateShader: _emscripten_glCreateShader, + /** @export */ + emscripten_glCullFace: _emscripten_glCullFace, + /** @export */ + emscripten_glDeleteBuffers: _emscripten_glDeleteBuffers, + /** @export */ + emscripten_glDeleteFramebuffers: _emscripten_glDeleteFramebuffers, + /** @export */ + emscripten_glDeleteProgram: _emscripten_glDeleteProgram, + /** @export */ + emscripten_glDeleteQueries: _emscripten_glDeleteQueries, + /** @export */ + emscripten_glDeleteQueriesEXT: _emscripten_glDeleteQueriesEXT, + /** @export */ + emscripten_glDeleteRenderbuffers: _emscripten_glDeleteRenderbuffers, + /** @export */ + emscripten_glDeleteSamplers: _emscripten_glDeleteSamplers, + /** @export */ + emscripten_glDeleteShader: _emscripten_glDeleteShader, + /** @export */ + emscripten_glDeleteSync: _emscripten_glDeleteSync, + /** @export */ + emscripten_glDeleteTextures: _emscripten_glDeleteTextures, + /** @export */ + emscripten_glDeleteTransformFeedbacks: _emscripten_glDeleteTransformFeedbacks, + /** @export */ + emscripten_glDeleteVertexArrays: _emscripten_glDeleteVertexArrays, + /** @export */ + emscripten_glDeleteVertexArraysOES: _emscripten_glDeleteVertexArraysOES, + /** @export */ + emscripten_glDepthFunc: _emscripten_glDepthFunc, + /** @export */ + emscripten_glDepthMask: _emscripten_glDepthMask, + /** @export */ + emscripten_glDepthRangef: _emscripten_glDepthRangef, + /** @export */ + emscripten_glDetachShader: _emscripten_glDetachShader, + /** @export */ + emscripten_glDisable: _emscripten_glDisable, + /** @export */ + emscripten_glDisableVertexAttribArray: _emscripten_glDisableVertexAttribArray, + /** @export */ + emscripten_glDrawArrays: _emscripten_glDrawArrays, + /** @export */ + emscripten_glDrawArraysInstanced: _emscripten_glDrawArraysInstanced, + /** @export */ + emscripten_glDrawArraysInstancedANGLE: _emscripten_glDrawArraysInstancedANGLE, + /** @export */ + emscripten_glDrawArraysInstancedARB: _emscripten_glDrawArraysInstancedARB, + /** @export */ + emscripten_glDrawArraysInstancedEXT: _emscripten_glDrawArraysInstancedEXT, + /** @export */ + emscripten_glDrawArraysInstancedNV: _emscripten_glDrawArraysInstancedNV, + /** @export */ + emscripten_glDrawBuffers: _emscripten_glDrawBuffers, + /** @export */ + emscripten_glDrawBuffersEXT: _emscripten_glDrawBuffersEXT, + /** @export */ + emscripten_glDrawBuffersWEBGL: _emscripten_glDrawBuffersWEBGL, + /** @export */ + emscripten_glDrawElements: _emscripten_glDrawElements, + /** @export */ + emscripten_glDrawElementsInstanced: _emscripten_glDrawElementsInstanced, + /** @export */ + emscripten_glDrawElementsInstancedANGLE: _emscripten_glDrawElementsInstancedANGLE, + /** @export */ + emscripten_glDrawElementsInstancedARB: _emscripten_glDrawElementsInstancedARB, + /** @export */ + emscripten_glDrawElementsInstancedEXT: _emscripten_glDrawElementsInstancedEXT, + /** @export */ + emscripten_glDrawElementsInstancedNV: _emscripten_glDrawElementsInstancedNV, + /** @export */ + emscripten_glDrawRangeElements: _emscripten_glDrawRangeElements, + /** @export */ + emscripten_glEnable: _emscripten_glEnable, + /** @export */ + emscripten_glEnableVertexAttribArray: _emscripten_glEnableVertexAttribArray, + /** @export */ + emscripten_glEndQuery: _emscripten_glEndQuery, + /** @export */ + emscripten_glEndQueryEXT: _emscripten_glEndQueryEXT, + /** @export */ + emscripten_glEndTransformFeedback: _emscripten_glEndTransformFeedback, + /** @export */ + emscripten_glFenceSync: _emscripten_glFenceSync, + /** @export */ + emscripten_glFinish: _emscripten_glFinish, + /** @export */ + emscripten_glFlush: _emscripten_glFlush, + /** @export */ + emscripten_glFramebufferRenderbuffer: _emscripten_glFramebufferRenderbuffer, + /** @export */ + emscripten_glFramebufferTexture2D: _emscripten_glFramebufferTexture2D, + /** @export */ + emscripten_glFramebufferTextureLayer: _emscripten_glFramebufferTextureLayer, + /** @export */ + emscripten_glFrontFace: _emscripten_glFrontFace, + /** @export */ + emscripten_glGenBuffers: _emscripten_glGenBuffers, + /** @export */ + emscripten_glGenFramebuffers: _emscripten_glGenFramebuffers, + /** @export */ + emscripten_glGenQueries: _emscripten_glGenQueries, + /** @export */ + emscripten_glGenQueriesEXT: _emscripten_glGenQueriesEXT, + /** @export */ + emscripten_glGenRenderbuffers: _emscripten_glGenRenderbuffers, + /** @export */ + emscripten_glGenSamplers: _emscripten_glGenSamplers, + /** @export */ + emscripten_glGenTextures: _emscripten_glGenTextures, + /** @export */ + emscripten_glGenTransformFeedbacks: _emscripten_glGenTransformFeedbacks, + /** @export */ + emscripten_glGenVertexArrays: _emscripten_glGenVertexArrays, + /** @export */ + emscripten_glGenVertexArraysOES: _emscripten_glGenVertexArraysOES, + /** @export */ + emscripten_glGenerateMipmap: _emscripten_glGenerateMipmap, + /** @export */ + emscripten_glGetActiveAttrib: _emscripten_glGetActiveAttrib, + /** @export */ + emscripten_glGetActiveUniform: _emscripten_glGetActiveUniform, + /** @export */ + emscripten_glGetActiveUniformBlockName: _emscripten_glGetActiveUniformBlockName, + /** @export */ + emscripten_glGetActiveUniformBlockiv: _emscripten_glGetActiveUniformBlockiv, + /** @export */ + emscripten_glGetActiveUniformsiv: _emscripten_glGetActiveUniformsiv, + /** @export */ + emscripten_glGetAttachedShaders: _emscripten_glGetAttachedShaders, + /** @export */ + emscripten_glGetAttribLocation: _emscripten_glGetAttribLocation, + /** @export */ + emscripten_glGetBooleanv: _emscripten_glGetBooleanv, + /** @export */ + emscripten_glGetBufferParameteri64v: _emscripten_glGetBufferParameteri64v, + /** @export */ + emscripten_glGetBufferParameteriv: _emscripten_glGetBufferParameteriv, + /** @export */ + emscripten_glGetError: _emscripten_glGetError, + /** @export */ + emscripten_glGetFloatv: _emscripten_glGetFloatv, + /** @export */ + emscripten_glGetFragDataLocation: _emscripten_glGetFragDataLocation, + /** @export */ + emscripten_glGetFramebufferAttachmentParameteriv: _emscripten_glGetFramebufferAttachmentParameteriv, + /** @export */ + emscripten_glGetInteger64i_v: _emscripten_glGetInteger64i_v, + /** @export */ + emscripten_glGetInteger64v: _emscripten_glGetInteger64v, + /** @export */ + emscripten_glGetIntegeri_v: _emscripten_glGetIntegeri_v, + /** @export */ + emscripten_glGetIntegerv: _emscripten_glGetIntegerv, + /** @export */ + emscripten_glGetInternalformativ: _emscripten_glGetInternalformativ, + /** @export */ + emscripten_glGetProgramBinary: _emscripten_glGetProgramBinary, + /** @export */ + emscripten_glGetProgramInfoLog: _emscripten_glGetProgramInfoLog, + /** @export */ + emscripten_glGetProgramiv: _emscripten_glGetProgramiv, + /** @export */ + emscripten_glGetQueryObjecti64vEXT: _emscripten_glGetQueryObjecti64vEXT, + /** @export */ + emscripten_glGetQueryObjectivEXT: _emscripten_glGetQueryObjectivEXT, + /** @export */ + emscripten_glGetQueryObjectui64vEXT: _emscripten_glGetQueryObjectui64vEXT, + /** @export */ + emscripten_glGetQueryObjectuiv: _emscripten_glGetQueryObjectuiv, + /** @export */ + emscripten_glGetQueryObjectuivEXT: _emscripten_glGetQueryObjectuivEXT, + /** @export */ + emscripten_glGetQueryiv: _emscripten_glGetQueryiv, + /** @export */ + emscripten_glGetQueryivEXT: _emscripten_glGetQueryivEXT, + /** @export */ + emscripten_glGetRenderbufferParameteriv: _emscripten_glGetRenderbufferParameteriv, + /** @export */ + emscripten_glGetSamplerParameterfv: _emscripten_glGetSamplerParameterfv, + /** @export */ + emscripten_glGetSamplerParameteriv: _emscripten_glGetSamplerParameteriv, + /** @export */ + emscripten_glGetShaderInfoLog: _emscripten_glGetShaderInfoLog, + /** @export */ + emscripten_glGetShaderPrecisionFormat: _emscripten_glGetShaderPrecisionFormat, + /** @export */ + emscripten_glGetShaderSource: _emscripten_glGetShaderSource, + /** @export */ + emscripten_glGetShaderiv: _emscripten_glGetShaderiv, + /** @export */ + emscripten_glGetString: _emscripten_glGetString, + /** @export */ + emscripten_glGetStringi: _emscripten_glGetStringi, + /** @export */ + emscripten_glGetSynciv: _emscripten_glGetSynciv, + /** @export */ + emscripten_glGetTexParameterfv: _emscripten_glGetTexParameterfv, + /** @export */ + emscripten_glGetTexParameteriv: _emscripten_glGetTexParameteriv, + /** @export */ + emscripten_glGetTransformFeedbackVarying: _emscripten_glGetTransformFeedbackVarying, + /** @export */ + emscripten_glGetUniformBlockIndex: _emscripten_glGetUniformBlockIndex, + /** @export */ + emscripten_glGetUniformIndices: _emscripten_glGetUniformIndices, + /** @export */ + emscripten_glGetUniformLocation: _emscripten_glGetUniformLocation, + /** @export */ + emscripten_glGetUniformfv: _emscripten_glGetUniformfv, + /** @export */ + emscripten_glGetUniformiv: _emscripten_glGetUniformiv, + /** @export */ + emscripten_glGetUniformuiv: _emscripten_glGetUniformuiv, + /** @export */ + emscripten_glGetVertexAttribIiv: _emscripten_glGetVertexAttribIiv, + /** @export */ + emscripten_glGetVertexAttribIuiv: _emscripten_glGetVertexAttribIuiv, + /** @export */ + emscripten_glGetVertexAttribPointerv: _emscripten_glGetVertexAttribPointerv, + /** @export */ + emscripten_glGetVertexAttribfv: _emscripten_glGetVertexAttribfv, + /** @export */ + emscripten_glGetVertexAttribiv: _emscripten_glGetVertexAttribiv, + /** @export */ + emscripten_glHint: _emscripten_glHint, + /** @export */ + emscripten_glInvalidateFramebuffer: _emscripten_glInvalidateFramebuffer, + /** @export */ + emscripten_glInvalidateSubFramebuffer: _emscripten_glInvalidateSubFramebuffer, + /** @export */ + emscripten_glIsBuffer: _emscripten_glIsBuffer, + /** @export */ + emscripten_glIsEnabled: _emscripten_glIsEnabled, + /** @export */ + emscripten_glIsFramebuffer: _emscripten_glIsFramebuffer, + /** @export */ + emscripten_glIsProgram: _emscripten_glIsProgram, + /** @export */ + emscripten_glIsQuery: _emscripten_glIsQuery, + /** @export */ + emscripten_glIsQueryEXT: _emscripten_glIsQueryEXT, + /** @export */ + emscripten_glIsRenderbuffer: _emscripten_glIsRenderbuffer, + /** @export */ + emscripten_glIsSampler: _emscripten_glIsSampler, + /** @export */ + emscripten_glIsShader: _emscripten_glIsShader, + /** @export */ + emscripten_glIsSync: _emscripten_glIsSync, + /** @export */ + emscripten_glIsTexture: _emscripten_glIsTexture, + /** @export */ + emscripten_glIsTransformFeedback: _emscripten_glIsTransformFeedback, + /** @export */ + emscripten_glIsVertexArray: _emscripten_glIsVertexArray, + /** @export */ + emscripten_glIsVertexArrayOES: _emscripten_glIsVertexArrayOES, + /** @export */ + emscripten_glLineWidth: _emscripten_glLineWidth, + /** @export */ + emscripten_glLinkProgram: _emscripten_glLinkProgram, + /** @export */ + emscripten_glPauseTransformFeedback: _emscripten_glPauseTransformFeedback, + /** @export */ + emscripten_glPixelStorei: _emscripten_glPixelStorei, + /** @export */ + emscripten_glPolygonOffset: _emscripten_glPolygonOffset, + /** @export */ + emscripten_glProgramBinary: _emscripten_glProgramBinary, + /** @export */ + emscripten_glProgramParameteri: _emscripten_glProgramParameteri, + /** @export */ + emscripten_glQueryCounterEXT: _emscripten_glQueryCounterEXT, + /** @export */ + emscripten_glReadBuffer: _emscripten_glReadBuffer, + /** @export */ + emscripten_glReadPixels: _emscripten_glReadPixels, + /** @export */ + emscripten_glReleaseShaderCompiler: _emscripten_glReleaseShaderCompiler, + /** @export */ + emscripten_glRenderbufferStorage: _emscripten_glRenderbufferStorage, + /** @export */ + emscripten_glRenderbufferStorageMultisample: _emscripten_glRenderbufferStorageMultisample, + /** @export */ + emscripten_glResumeTransformFeedback: _emscripten_glResumeTransformFeedback, + /** @export */ + emscripten_glSampleCoverage: _emscripten_glSampleCoverage, + /** @export */ + emscripten_glSamplerParameterf: _emscripten_glSamplerParameterf, + /** @export */ + emscripten_glSamplerParameterfv: _emscripten_glSamplerParameterfv, + /** @export */ + emscripten_glSamplerParameteri: _emscripten_glSamplerParameteri, + /** @export */ + emscripten_glSamplerParameteriv: _emscripten_glSamplerParameteriv, + /** @export */ + emscripten_glScissor: _emscripten_glScissor, + /** @export */ + emscripten_glShaderBinary: _emscripten_glShaderBinary, + /** @export */ + emscripten_glShaderSource: _emscripten_glShaderSource, + /** @export */ + emscripten_glStencilFunc: _emscripten_glStencilFunc, + /** @export */ + emscripten_glStencilFuncSeparate: _emscripten_glStencilFuncSeparate, + /** @export */ + emscripten_glStencilMask: _emscripten_glStencilMask, + /** @export */ + emscripten_glStencilMaskSeparate: _emscripten_glStencilMaskSeparate, + /** @export */ + emscripten_glStencilOp: _emscripten_glStencilOp, + /** @export */ + emscripten_glStencilOpSeparate: _emscripten_glStencilOpSeparate, + /** @export */ + emscripten_glTexImage2D: _emscripten_glTexImage2D, + /** @export */ + emscripten_glTexImage3D: _emscripten_glTexImage3D, + /** @export */ + emscripten_glTexParameterf: _emscripten_glTexParameterf, + /** @export */ + emscripten_glTexParameterfv: _emscripten_glTexParameterfv, + /** @export */ + emscripten_glTexParameteri: _emscripten_glTexParameteri, + /** @export */ + emscripten_glTexParameteriv: _emscripten_glTexParameteriv, + /** @export */ + emscripten_glTexStorage2D: _emscripten_glTexStorage2D, + /** @export */ + emscripten_glTexStorage3D: _emscripten_glTexStorage3D, + /** @export */ + emscripten_glTexSubImage2D: _emscripten_glTexSubImage2D, + /** @export */ + emscripten_glTexSubImage3D: _emscripten_glTexSubImage3D, + /** @export */ + emscripten_glTransformFeedbackVaryings: _emscripten_glTransformFeedbackVaryings, + /** @export */ + emscripten_glUniform1f: _emscripten_glUniform1f, + /** @export */ + emscripten_glUniform1fv: _emscripten_glUniform1fv, + /** @export */ + emscripten_glUniform1i: _emscripten_glUniform1i, + /** @export */ + emscripten_glUniform1iv: _emscripten_glUniform1iv, + /** @export */ + emscripten_glUniform1ui: _emscripten_glUniform1ui, + /** @export */ + emscripten_glUniform1uiv: _emscripten_glUniform1uiv, + /** @export */ + emscripten_glUniform2f: _emscripten_glUniform2f, + /** @export */ + emscripten_glUniform2fv: _emscripten_glUniform2fv, + /** @export */ + emscripten_glUniform2i: _emscripten_glUniform2i, + /** @export */ + emscripten_glUniform2iv: _emscripten_glUniform2iv, + /** @export */ + emscripten_glUniform2ui: _emscripten_glUniform2ui, + /** @export */ + emscripten_glUniform2uiv: _emscripten_glUniform2uiv, + /** @export */ + emscripten_glUniform3f: _emscripten_glUniform3f, + /** @export */ + emscripten_glUniform3fv: _emscripten_glUniform3fv, + /** @export */ + emscripten_glUniform3i: _emscripten_glUniform3i, + /** @export */ + emscripten_glUniform3iv: _emscripten_glUniform3iv, + /** @export */ + emscripten_glUniform3ui: _emscripten_glUniform3ui, + /** @export */ + emscripten_glUniform3uiv: _emscripten_glUniform3uiv, + /** @export */ + emscripten_glUniform4f: _emscripten_glUniform4f, + /** @export */ + emscripten_glUniform4fv: _emscripten_glUniform4fv, + /** @export */ + emscripten_glUniform4i: _emscripten_glUniform4i, + /** @export */ + emscripten_glUniform4iv: _emscripten_glUniform4iv, + /** @export */ + emscripten_glUniform4ui: _emscripten_glUniform4ui, + /** @export */ + emscripten_glUniform4uiv: _emscripten_glUniform4uiv, + /** @export */ + emscripten_glUniformBlockBinding: _emscripten_glUniformBlockBinding, + /** @export */ + emscripten_glUniformMatrix2fv: _emscripten_glUniformMatrix2fv, + /** @export */ + emscripten_glUniformMatrix2x3fv: _emscripten_glUniformMatrix2x3fv, + /** @export */ + emscripten_glUniformMatrix2x4fv: _emscripten_glUniformMatrix2x4fv, + /** @export */ + emscripten_glUniformMatrix3fv: _emscripten_glUniformMatrix3fv, + /** @export */ + emscripten_glUniformMatrix3x2fv: _emscripten_glUniformMatrix3x2fv, + /** @export */ + emscripten_glUniformMatrix3x4fv: _emscripten_glUniformMatrix3x4fv, + /** @export */ + emscripten_glUniformMatrix4fv: _emscripten_glUniformMatrix4fv, + /** @export */ + emscripten_glUniformMatrix4x2fv: _emscripten_glUniformMatrix4x2fv, + /** @export */ + emscripten_glUniformMatrix4x3fv: _emscripten_glUniformMatrix4x3fv, + /** @export */ + emscripten_glUseProgram: _emscripten_glUseProgram, + /** @export */ + emscripten_glValidateProgram: _emscripten_glValidateProgram, + /** @export */ + emscripten_glVertexAttrib1f: _emscripten_glVertexAttrib1f, + /** @export */ + emscripten_glVertexAttrib1fv: _emscripten_glVertexAttrib1fv, + /** @export */ + emscripten_glVertexAttrib2f: _emscripten_glVertexAttrib2f, + /** @export */ + emscripten_glVertexAttrib2fv: _emscripten_glVertexAttrib2fv, + /** @export */ + emscripten_glVertexAttrib3f: _emscripten_glVertexAttrib3f, + /** @export */ + emscripten_glVertexAttrib3fv: _emscripten_glVertexAttrib3fv, + /** @export */ + emscripten_glVertexAttrib4f: _emscripten_glVertexAttrib4f, + /** @export */ + emscripten_glVertexAttrib4fv: _emscripten_glVertexAttrib4fv, + /** @export */ + emscripten_glVertexAttribDivisor: _emscripten_glVertexAttribDivisor, + /** @export */ + emscripten_glVertexAttribDivisorANGLE: _emscripten_glVertexAttribDivisorANGLE, + /** @export */ + emscripten_glVertexAttribDivisorARB: _emscripten_glVertexAttribDivisorARB, + /** @export */ + emscripten_glVertexAttribDivisorEXT: _emscripten_glVertexAttribDivisorEXT, + /** @export */ + emscripten_glVertexAttribDivisorNV: _emscripten_glVertexAttribDivisorNV, + /** @export */ + emscripten_glVertexAttribI4i: _emscripten_glVertexAttribI4i, + /** @export */ + emscripten_glVertexAttribI4iv: _emscripten_glVertexAttribI4iv, + /** @export */ + emscripten_glVertexAttribI4ui: _emscripten_glVertexAttribI4ui, + /** @export */ + emscripten_glVertexAttribI4uiv: _emscripten_glVertexAttribI4uiv, + /** @export */ + emscripten_glVertexAttribIPointer: _emscripten_glVertexAttribIPointer, + /** @export */ + emscripten_glVertexAttribPointer: _emscripten_glVertexAttribPointer, + /** @export */ + emscripten_glViewport: _emscripten_glViewport, + /** @export */ + emscripten_glWaitSync: _emscripten_glWaitSync, + /** @export */ + emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ + environ_get: _environ_get, + /** @export */ + environ_sizes_get: _environ_sizes_get, + /** @export */ + exit: _exit, + /** @export */ + fd_close: _fd_close, + /** @export */ + fd_pread: _fd_pread, + /** @export */ + fd_pwrite: _fd_pwrite, + /** @export */ + fd_read: _fd_read, + /** @export */ + fd_seek: _fd_seek, + /** @export */ + fd_sync: _fd_sync, + /** @export */ + fd_write: _fd_write, + /** @export */ + glActiveTexture: _glActiveTexture, + /** @export */ + glAttachShader: _glAttachShader, + /** @export */ + glBindAttribLocation: _glBindAttribLocation, + /** @export */ + glBindBuffer: _glBindBuffer, + /** @export */ + glBindFramebuffer: _glBindFramebuffer, + /** @export */ + glBindRenderbuffer: _glBindRenderbuffer, + /** @export */ + glBindSampler: _glBindSampler, + /** @export */ + glBindTexture: _glBindTexture, + /** @export */ + glBindVertexArray: _glBindVertexArray, + /** @export */ + glBindVertexArrayOES: _glBindVertexArrayOES, + /** @export */ + glBlendColor: _glBlendColor, + /** @export */ + glBlendEquation: _glBlendEquation, + /** @export */ + glBlendFunc: _glBlendFunc, + /** @export */ + glBlitFramebuffer: _glBlitFramebuffer, + /** @export */ + glBufferData: _glBufferData, + /** @export */ + glBufferSubData: _glBufferSubData, + /** @export */ + glCheckFramebufferStatus: _glCheckFramebufferStatus, + /** @export */ + glClear: _glClear, + /** @export */ + glClearColor: _glClearColor, + /** @export */ + glClearStencil: _glClearStencil, + /** @export */ + glClientWaitSync: _glClientWaitSync, + /** @export */ + glColorMask: _glColorMask, + /** @export */ + glCompileShader: _glCompileShader, + /** @export */ + glCompressedTexImage2D: _glCompressedTexImage2D, + /** @export */ + glCompressedTexSubImage2D: _glCompressedTexSubImage2D, + /** @export */ + glCopyBufferSubData: _glCopyBufferSubData, + /** @export */ + glCopyTexSubImage2D: _glCopyTexSubImage2D, + /** @export */ + glCreateProgram: _glCreateProgram, + /** @export */ + glCreateShader: _glCreateShader, + /** @export */ + glCullFace: _glCullFace, + /** @export */ + glDeleteBuffers: _glDeleteBuffers, + /** @export */ + glDeleteFramebuffers: _glDeleteFramebuffers, + /** @export */ + glDeleteProgram: _glDeleteProgram, + /** @export */ + glDeleteRenderbuffers: _glDeleteRenderbuffers, + /** @export */ + glDeleteSamplers: _glDeleteSamplers, + /** @export */ + glDeleteShader: _glDeleteShader, + /** @export */ + glDeleteSync: _glDeleteSync, + /** @export */ + glDeleteTextures: _glDeleteTextures, + /** @export */ + glDeleteVertexArrays: _glDeleteVertexArrays, + /** @export */ + glDeleteVertexArraysOES: _glDeleteVertexArraysOES, + /** @export */ + glDepthMask: _glDepthMask, + /** @export */ + glDisable: _glDisable, + /** @export */ + glDisableVertexAttribArray: _glDisableVertexAttribArray, + /** @export */ + glDrawArrays: _glDrawArrays, + /** @export */ + glDrawArraysInstanced: _glDrawArraysInstanced, + /** @export */ + glDrawArraysInstancedBaseInstanceWEBGL: _glDrawArraysInstancedBaseInstanceWEBGL, + /** @export */ + glDrawBuffers: _glDrawBuffers, + /** @export */ + glDrawElements: _glDrawElements, + /** @export */ + glDrawElementsInstanced: _glDrawElementsInstanced, + /** @export */ + glDrawElementsInstancedBaseVertexBaseInstanceWEBGL: _glDrawElementsInstancedBaseVertexBaseInstanceWEBGL, + /** @export */ + glDrawRangeElements: _glDrawRangeElements, + /** @export */ + glEnable: _glEnable, + /** @export */ + glEnableVertexAttribArray: _glEnableVertexAttribArray, + /** @export */ + glFenceSync: _glFenceSync, + /** @export */ + glFinish: _glFinish, + /** @export */ + glFlush: _glFlush, + /** @export */ + glFramebufferRenderbuffer: _glFramebufferRenderbuffer, + /** @export */ + glFramebufferTexture2D: _glFramebufferTexture2D, + /** @export */ + glFrontFace: _glFrontFace, + /** @export */ + glGenBuffers: _glGenBuffers, + /** @export */ + glGenFramebuffers: _glGenFramebuffers, + /** @export */ + glGenRenderbuffers: _glGenRenderbuffers, + /** @export */ + glGenSamplers: _glGenSamplers, + /** @export */ + glGenTextures: _glGenTextures, + /** @export */ + glGenVertexArrays: _glGenVertexArrays, + /** @export */ + glGenVertexArraysOES: _glGenVertexArraysOES, + /** @export */ + glGenerateMipmap: _glGenerateMipmap, + /** @export */ + glGetBufferParameteriv: _glGetBufferParameteriv, + /** @export */ + glGetError: _glGetError, + /** @export */ + glGetFloatv: _glGetFloatv, + /** @export */ + glGetFramebufferAttachmentParameteriv: _glGetFramebufferAttachmentParameteriv, + /** @export */ + glGetIntegerv: _glGetIntegerv, + /** @export */ + glGetProgramInfoLog: _glGetProgramInfoLog, + /** @export */ + glGetProgramiv: _glGetProgramiv, + /** @export */ + glGetRenderbufferParameteriv: _glGetRenderbufferParameteriv, + /** @export */ + glGetShaderInfoLog: _glGetShaderInfoLog, + /** @export */ + glGetShaderPrecisionFormat: _glGetShaderPrecisionFormat, + /** @export */ + glGetShaderiv: _glGetShaderiv, + /** @export */ + glGetString: _glGetString, + /** @export */ + glGetStringi: _glGetStringi, + /** @export */ + glGetUniformLocation: _glGetUniformLocation, + /** @export */ + glInvalidateFramebuffer: _glInvalidateFramebuffer, + /** @export */ + glInvalidateSubFramebuffer: _glInvalidateSubFramebuffer, + /** @export */ + glIsSync: _glIsSync, + /** @export */ + glIsTexture: _glIsTexture, + /** @export */ + glLineWidth: _glLineWidth, + /** @export */ + glLinkProgram: _glLinkProgram, + /** @export */ + glMultiDrawArraysInstancedBaseInstanceWEBGL: _glMultiDrawArraysInstancedBaseInstanceWEBGL, + /** @export */ + glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL: _glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL, + /** @export */ + glPixelStorei: _glPixelStorei, + /** @export */ + glReadBuffer: _glReadBuffer, + /** @export */ + glReadPixels: _glReadPixels, + /** @export */ + glRenderbufferStorage: _glRenderbufferStorage, + /** @export */ + glRenderbufferStorageMultisample: _glRenderbufferStorageMultisample, + /** @export */ + glSamplerParameterf: _glSamplerParameterf, + /** @export */ + glSamplerParameteri: _glSamplerParameteri, + /** @export */ + glSamplerParameteriv: _glSamplerParameteriv, + /** @export */ + glScissor: _glScissor, + /** @export */ + glShaderSource: _glShaderSource, + /** @export */ + glStencilFunc: _glStencilFunc, + /** @export */ + glStencilFuncSeparate: _glStencilFuncSeparate, + /** @export */ + glStencilMask: _glStencilMask, + /** @export */ + glStencilMaskSeparate: _glStencilMaskSeparate, + /** @export */ + glStencilOp: _glStencilOp, + /** @export */ + glStencilOpSeparate: _glStencilOpSeparate, + /** @export */ + glTexImage2D: _glTexImage2D, + /** @export */ + glTexParameterf: _glTexParameterf, + /** @export */ + glTexParameterfv: _glTexParameterfv, + /** @export */ + glTexParameteri: _glTexParameteri, + /** @export */ + glTexParameteriv: _glTexParameteriv, + /** @export */ + glTexStorage2D: _glTexStorage2D, + /** @export */ + glTexSubImage2D: _glTexSubImage2D, + /** @export */ + glUniform1f: _glUniform1f, + /** @export */ + glUniform1fv: _glUniform1fv, + /** @export */ + glUniform1i: _glUniform1i, + /** @export */ + glUniform1iv: _glUniform1iv, + /** @export */ + glUniform2f: _glUniform2f, + /** @export */ + glUniform2fv: _glUniform2fv, + /** @export */ + glUniform2i: _glUniform2i, + /** @export */ + glUniform2iv: _glUniform2iv, + /** @export */ + glUniform3f: _glUniform3f, + /** @export */ + glUniform3fv: _glUniform3fv, + /** @export */ + glUniform3i: _glUniform3i, + /** @export */ + glUniform3iv: _glUniform3iv, + /** @export */ + glUniform4f: _glUniform4f, + /** @export */ + glUniform4fv: _glUniform4fv, + /** @export */ + glUniform4i: _glUniform4i, + /** @export */ + glUniform4iv: _glUniform4iv, + /** @export */ + glUniformMatrix2fv: _glUniformMatrix2fv, + /** @export */ + glUniformMatrix3fv: _glUniformMatrix3fv, + /** @export */ + glUniformMatrix4fv: _glUniformMatrix4fv, + /** @export */ + glUseProgram: _glUseProgram, + /** @export */ + glVertexAttrib1f: _glVertexAttrib1f, + /** @export */ + glVertexAttrib2fv: _glVertexAttrib2fv, + /** @export */ + glVertexAttrib3fv: _glVertexAttrib3fv, + /** @export */ + glVertexAttrib4fv: _glVertexAttrib4fv, + /** @export */ + glVertexAttribDivisor: _glVertexAttribDivisor, + /** @export */ + glVertexAttribIPointer: _glVertexAttribIPointer, + /** @export */ + glVertexAttribPointer: _glVertexAttribPointer, + /** @export */ + glViewport: _glViewport, + /** @export */ + glWaitSync: _glWaitSync, + /** @export */ + mono_interp_flush_jitcall_queue: _mono_interp_flush_jitcall_queue, + /** @export */ + mono_interp_invoke_wasm_jit_call_trampoline: _mono_interp_invoke_wasm_jit_call_trampoline, + /** @export */ + mono_interp_jit_wasm_entry_trampoline: _mono_interp_jit_wasm_entry_trampoline, + /** @export */ + mono_interp_jit_wasm_jit_call_trampoline: _mono_interp_jit_wasm_jit_call_trampoline, + /** @export */ + mono_interp_record_interp_entry: _mono_interp_record_interp_entry, + /** @export */ + mono_interp_tier_prepare_jiterpreter: _mono_interp_tier_prepare_jiterpreter, + /** @export */ + mono_wasm_bind_js_import_ST: _mono_wasm_bind_js_import_ST, + /** @export */ + mono_wasm_browser_entropy: _mono_wasm_browser_entropy, + /** @export */ + mono_wasm_cancel_promise: _mono_wasm_cancel_promise, + /** @export */ + mono_wasm_console_clear: _mono_wasm_console_clear, + /** @export */ + mono_wasm_free_method_data: _mono_wasm_free_method_data, + /** @export */ + mono_wasm_get_locale_info: _mono_wasm_get_locale_info, + /** @export */ + mono_wasm_invoke_js_function: _mono_wasm_invoke_js_function, + /** @export */ + mono_wasm_invoke_jsimport_ST: _mono_wasm_invoke_jsimport_ST, + /** @export */ + mono_wasm_process_current_pid: _mono_wasm_process_current_pid, + /** @export */ + mono_wasm_release_cs_owned_object: _mono_wasm_release_cs_owned_object, + /** @export */ + mono_wasm_resolve_or_reject_promise: _mono_wasm_resolve_or_reject_promise, + /** @export */ + mono_wasm_schedule_timer: _mono_wasm_schedule_timer, + /** @export */ + mono_wasm_set_entrypoint_breakpoint: _mono_wasm_set_entrypoint_breakpoint, + /** @export */ + mono_wasm_trace_logger: _mono_wasm_trace_logger, + /** @export */ + schedule_background_exec: _schedule_background_exec, + /** @export */ + strftime: _strftime, + /** @export */ + strftime_l: _strftime_l +}; +var wasmExports = createWasm(); +var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); +var _free = Module['_free'] = (a0) => (_free = Module['_free'] = wasmExports['free'])(a0); +var _memset = Module['_memset'] = (a0, a1, a2) => (_memset = Module['_memset'] = wasmExports['memset'])(a0, a1, a2); +var _malloc = Module['_malloc'] = (a0) => (_malloc = Module['_malloc'] = wasmExports['malloc'])(a0); +var _tanf = Module['_tanf'] = (a0) => (_tanf = Module['_tanf'] = wasmExports['tanf'])(a0); +var _atanf = Module['_atanf'] = (a0) => (_atanf = Module['_atanf'] = wasmExports['atanf'])(a0); +var _sinf = Module['_sinf'] = (a0) => (_sinf = Module['_sinf'] = wasmExports['sinf'])(a0); +var _cosf = Module['_cosf'] = (a0) => (_cosf = Module['_cosf'] = wasmExports['cosf'])(a0); +var _mono_wasm_register_root = Module['_mono_wasm_register_root'] = (a0, a1, a2) => (_mono_wasm_register_root = Module['_mono_wasm_register_root'] = wasmExports['mono_wasm_register_root'])(a0, a1, a2); +var _mono_wasm_deregister_root = Module['_mono_wasm_deregister_root'] = (a0) => (_mono_wasm_deregister_root = Module['_mono_wasm_deregister_root'] = wasmExports['mono_wasm_deregister_root'])(a0); +var _mono_wasm_add_assembly = Module['_mono_wasm_add_assembly'] = (a0, a1, a2) => (_mono_wasm_add_assembly = Module['_mono_wasm_add_assembly'] = wasmExports['mono_wasm_add_assembly'])(a0, a1, a2); +var _mono_wasm_add_satellite_assembly = Module['_mono_wasm_add_satellite_assembly'] = (a0, a1, a2, a3) => (_mono_wasm_add_satellite_assembly = Module['_mono_wasm_add_satellite_assembly'] = wasmExports['mono_wasm_add_satellite_assembly'])(a0, a1, a2, a3); +var _mono_wasm_setenv = Module['_mono_wasm_setenv'] = (a0, a1) => (_mono_wasm_setenv = Module['_mono_wasm_setenv'] = wasmExports['mono_wasm_setenv'])(a0, a1); +var _mono_wasm_getenv = Module['_mono_wasm_getenv'] = (a0) => (_mono_wasm_getenv = Module['_mono_wasm_getenv'] = wasmExports['mono_wasm_getenv'])(a0); +var _mono_wasm_load_runtime = Module['_mono_wasm_load_runtime'] = (a0, a1, a2, a3) => (_mono_wasm_load_runtime = Module['_mono_wasm_load_runtime'] = wasmExports['mono_wasm_load_runtime'])(a0, a1, a2, a3); +var _mono_wasm_invoke_jsexport = Module['_mono_wasm_invoke_jsexport'] = (a0, a1) => (_mono_wasm_invoke_jsexport = Module['_mono_wasm_invoke_jsexport'] = wasmExports['mono_wasm_invoke_jsexport'])(a0, a1); +var _mono_wasm_string_from_utf16_ref = Module['_mono_wasm_string_from_utf16_ref'] = (a0, a1, a2) => (_mono_wasm_string_from_utf16_ref = Module['_mono_wasm_string_from_utf16_ref'] = wasmExports['mono_wasm_string_from_utf16_ref'])(a0, a1, a2); +var _mono_wasm_exec_regression = Module['_mono_wasm_exec_regression'] = (a0, a1) => (_mono_wasm_exec_regression = Module['_mono_wasm_exec_regression'] = wasmExports['mono_wasm_exec_regression'])(a0, a1); +var _mono_wasm_exit = Module['_mono_wasm_exit'] = (a0) => (_mono_wasm_exit = Module['_mono_wasm_exit'] = wasmExports['mono_wasm_exit'])(a0); +var _fflush = (a0) => (_fflush = wasmExports['fflush'])(a0); +var _mono_wasm_set_main_args = Module['_mono_wasm_set_main_args'] = (a0, a1) => (_mono_wasm_set_main_args = Module['_mono_wasm_set_main_args'] = wasmExports['mono_wasm_set_main_args'])(a0, a1); +var _mono_wasm_strdup = Module['_mono_wasm_strdup'] = (a0) => (_mono_wasm_strdup = Module['_mono_wasm_strdup'] = wasmExports['mono_wasm_strdup'])(a0); +var _mono_wasm_parse_runtime_options = Module['_mono_wasm_parse_runtime_options'] = (a0, a1) => (_mono_wasm_parse_runtime_options = Module['_mono_wasm_parse_runtime_options'] = wasmExports['mono_wasm_parse_runtime_options'])(a0, a1); +var _mono_wasm_intern_string_ref = Module['_mono_wasm_intern_string_ref'] = (a0) => (_mono_wasm_intern_string_ref = Module['_mono_wasm_intern_string_ref'] = wasmExports['mono_wasm_intern_string_ref'])(a0); +var _mono_wasm_string_get_data_ref = Module['_mono_wasm_string_get_data_ref'] = (a0, a1, a2, a3) => (_mono_wasm_string_get_data_ref = Module['_mono_wasm_string_get_data_ref'] = wasmExports['mono_wasm_string_get_data_ref'])(a0, a1, a2, a3); +var _mono_wasm_write_managed_pointer_unsafe = Module['_mono_wasm_write_managed_pointer_unsafe'] = (a0, a1) => (_mono_wasm_write_managed_pointer_unsafe = Module['_mono_wasm_write_managed_pointer_unsafe'] = wasmExports['mono_wasm_write_managed_pointer_unsafe'])(a0, a1); +var _mono_wasm_copy_managed_pointer = Module['_mono_wasm_copy_managed_pointer'] = (a0, a1) => (_mono_wasm_copy_managed_pointer = Module['_mono_wasm_copy_managed_pointer'] = wasmExports['mono_wasm_copy_managed_pointer'])(a0, a1); +var _mono_wasm_init_finalizer_thread = Module['_mono_wasm_init_finalizer_thread'] = () => (_mono_wasm_init_finalizer_thread = Module['_mono_wasm_init_finalizer_thread'] = wasmExports['mono_wasm_init_finalizer_thread'])(); +var _mono_wasm_i52_to_f64 = Module['_mono_wasm_i52_to_f64'] = (a0, a1) => (_mono_wasm_i52_to_f64 = Module['_mono_wasm_i52_to_f64'] = wasmExports['mono_wasm_i52_to_f64'])(a0, a1); +var _mono_wasm_u52_to_f64 = Module['_mono_wasm_u52_to_f64'] = (a0, a1) => (_mono_wasm_u52_to_f64 = Module['_mono_wasm_u52_to_f64'] = wasmExports['mono_wasm_u52_to_f64'])(a0, a1); +var _mono_wasm_f64_to_u52 = Module['_mono_wasm_f64_to_u52'] = (a0, a1) => (_mono_wasm_f64_to_u52 = Module['_mono_wasm_f64_to_u52'] = wasmExports['mono_wasm_f64_to_u52'])(a0, a1); +var _mono_wasm_f64_to_i52 = Module['_mono_wasm_f64_to_i52'] = (a0, a1) => (_mono_wasm_f64_to_i52 = Module['_mono_wasm_f64_to_i52'] = wasmExports['mono_wasm_f64_to_i52'])(a0, a1); +var _mono_wasm_method_get_full_name = Module['_mono_wasm_method_get_full_name'] = (a0) => (_mono_wasm_method_get_full_name = Module['_mono_wasm_method_get_full_name'] = wasmExports['mono_wasm_method_get_full_name'])(a0); +var _mono_wasm_method_get_name = Module['_mono_wasm_method_get_name'] = (a0) => (_mono_wasm_method_get_name = Module['_mono_wasm_method_get_name'] = wasmExports['mono_wasm_method_get_name'])(a0); +var _mono_wasm_method_get_name_ex = Module['_mono_wasm_method_get_name_ex'] = (a0) => (_mono_wasm_method_get_name_ex = Module['_mono_wasm_method_get_name_ex'] = wasmExports['mono_wasm_method_get_name_ex'])(a0); +var _mono_wasm_get_f32_unaligned = Module['_mono_wasm_get_f32_unaligned'] = (a0) => (_mono_wasm_get_f32_unaligned = Module['_mono_wasm_get_f32_unaligned'] = wasmExports['mono_wasm_get_f32_unaligned'])(a0); +var _mono_wasm_get_f64_unaligned = Module['_mono_wasm_get_f64_unaligned'] = (a0) => (_mono_wasm_get_f64_unaligned = Module['_mono_wasm_get_f64_unaligned'] = wasmExports['mono_wasm_get_f64_unaligned'])(a0); +var _mono_wasm_get_i32_unaligned = Module['_mono_wasm_get_i32_unaligned'] = (a0) => (_mono_wasm_get_i32_unaligned = Module['_mono_wasm_get_i32_unaligned'] = wasmExports['mono_wasm_get_i32_unaligned'])(a0); +var _mono_wasm_is_zero_page_reserved = Module['_mono_wasm_is_zero_page_reserved'] = () => (_mono_wasm_is_zero_page_reserved = Module['_mono_wasm_is_zero_page_reserved'] = wasmExports['mono_wasm_is_zero_page_reserved'])(); +var _mono_wasm_read_as_bool_or_null_unsafe = Module['_mono_wasm_read_as_bool_or_null_unsafe'] = (a0) => (_mono_wasm_read_as_bool_or_null_unsafe = Module['_mono_wasm_read_as_bool_or_null_unsafe'] = wasmExports['mono_wasm_read_as_bool_or_null_unsafe'])(a0); +var _mono_wasm_assembly_load = Module['_mono_wasm_assembly_load'] = (a0) => (_mono_wasm_assembly_load = Module['_mono_wasm_assembly_load'] = wasmExports['mono_wasm_assembly_load'])(a0); +var _mono_wasm_assembly_find_class = Module['_mono_wasm_assembly_find_class'] = (a0, a1, a2) => (_mono_wasm_assembly_find_class = Module['_mono_wasm_assembly_find_class'] = wasmExports['mono_wasm_assembly_find_class'])(a0, a1, a2); +var _mono_wasm_assembly_find_method = Module['_mono_wasm_assembly_find_method'] = (a0, a1, a2) => (_mono_wasm_assembly_find_method = Module['_mono_wasm_assembly_find_method'] = wasmExports['mono_wasm_assembly_find_method'])(a0, a1, a2); +var _mono_wasm_send_dbg_command_with_parms = Module['_mono_wasm_send_dbg_command_with_parms'] = (a0, a1, a2, a3, a4, a5, a6) => (_mono_wasm_send_dbg_command_with_parms = Module['_mono_wasm_send_dbg_command_with_parms'] = wasmExports['mono_wasm_send_dbg_command_with_parms'])(a0, a1, a2, a3, a4, a5, a6); +var _mono_wasm_send_dbg_command = Module['_mono_wasm_send_dbg_command'] = (a0, a1, a2, a3, a4) => (_mono_wasm_send_dbg_command = Module['_mono_wasm_send_dbg_command'] = wasmExports['mono_wasm_send_dbg_command'])(a0, a1, a2, a3, a4); +var _mono_jiterp_register_jit_call_thunk = Module['_mono_jiterp_register_jit_call_thunk'] = (a0, a1) => (_mono_jiterp_register_jit_call_thunk = Module['_mono_jiterp_register_jit_call_thunk'] = wasmExports['mono_jiterp_register_jit_call_thunk'])(a0, a1); +var _mono_jiterp_stackval_to_data = Module['_mono_jiterp_stackval_to_data'] = (a0, a1, a2) => (_mono_jiterp_stackval_to_data = Module['_mono_jiterp_stackval_to_data'] = wasmExports['mono_jiterp_stackval_to_data'])(a0, a1, a2); +var _mono_jiterp_stackval_from_data = Module['_mono_jiterp_stackval_from_data'] = (a0, a1, a2) => (_mono_jiterp_stackval_from_data = Module['_mono_jiterp_stackval_from_data'] = wasmExports['mono_jiterp_stackval_from_data'])(a0, a1, a2); +var _mono_jiterp_get_arg_offset = Module['_mono_jiterp_get_arg_offset'] = (a0, a1, a2) => (_mono_jiterp_get_arg_offset = Module['_mono_jiterp_get_arg_offset'] = wasmExports['mono_jiterp_get_arg_offset'])(a0, a1, a2); +var _mono_jiterp_overflow_check_i4 = Module['_mono_jiterp_overflow_check_i4'] = (a0, a1, a2) => (_mono_jiterp_overflow_check_i4 = Module['_mono_jiterp_overflow_check_i4'] = wasmExports['mono_jiterp_overflow_check_i4'])(a0, a1, a2); +var _mono_jiterp_overflow_check_u4 = Module['_mono_jiterp_overflow_check_u4'] = (a0, a1, a2) => (_mono_jiterp_overflow_check_u4 = Module['_mono_jiterp_overflow_check_u4'] = wasmExports['mono_jiterp_overflow_check_u4'])(a0, a1, a2); +var _mono_jiterp_ld_delegate_method_ptr = Module['_mono_jiterp_ld_delegate_method_ptr'] = (a0, a1) => (_mono_jiterp_ld_delegate_method_ptr = Module['_mono_jiterp_ld_delegate_method_ptr'] = wasmExports['mono_jiterp_ld_delegate_method_ptr'])(a0, a1); +var _mono_jiterp_interp_entry = Module['_mono_jiterp_interp_entry'] = (a0, a1) => (_mono_jiterp_interp_entry = Module['_mono_jiterp_interp_entry'] = wasmExports['mono_jiterp_interp_entry'])(a0, a1); +var _fmodf = Module['_fmodf'] = (a0, a1) => (_fmodf = Module['_fmodf'] = wasmExports['fmodf'])(a0, a1); +var _fmod = Module['_fmod'] = (a0, a1) => (_fmod = Module['_fmod'] = wasmExports['fmod'])(a0, a1); +var _asin = Module['_asin'] = (a0) => (_asin = Module['_asin'] = wasmExports['asin'])(a0); +var _asinh = Module['_asinh'] = (a0) => (_asinh = Module['_asinh'] = wasmExports['asinh'])(a0); +var _acos = Module['_acos'] = (a0) => (_acos = Module['_acos'] = wasmExports['acos'])(a0); +var _acosh = Module['_acosh'] = (a0) => (_acosh = Module['_acosh'] = wasmExports['acosh'])(a0); +var _atan = Module['_atan'] = (a0) => (_atan = Module['_atan'] = wasmExports['atan'])(a0); +var _atanh = Module['_atanh'] = (a0) => (_atanh = Module['_atanh'] = wasmExports['atanh'])(a0); +var _cos = Module['_cos'] = (a0) => (_cos = Module['_cos'] = wasmExports['cos'])(a0); +var _cbrt = Module['_cbrt'] = (a0) => (_cbrt = Module['_cbrt'] = wasmExports['cbrt'])(a0); +var _cosh = Module['_cosh'] = (a0) => (_cosh = Module['_cosh'] = wasmExports['cosh'])(a0); +var _exp = Module['_exp'] = (a0) => (_exp = Module['_exp'] = wasmExports['exp'])(a0); +var _log = Module['_log'] = (a0) => (_log = Module['_log'] = wasmExports['log'])(a0); +var _log2 = Module['_log2'] = (a0) => (_log2 = Module['_log2'] = wasmExports['log2'])(a0); +var _log10 = Module['_log10'] = (a0) => (_log10 = Module['_log10'] = wasmExports['log10'])(a0); +var _sin = Module['_sin'] = (a0) => (_sin = Module['_sin'] = wasmExports['sin'])(a0); +var _sinh = Module['_sinh'] = (a0) => (_sinh = Module['_sinh'] = wasmExports['sinh'])(a0); +var _tan = Module['_tan'] = (a0) => (_tan = Module['_tan'] = wasmExports['tan'])(a0); +var _tanh = Module['_tanh'] = (a0) => (_tanh = Module['_tanh'] = wasmExports['tanh'])(a0); +var _atan2 = Module['_atan2'] = (a0, a1) => (_atan2 = Module['_atan2'] = wasmExports['atan2'])(a0, a1); +var _pow = Module['_pow'] = (a0, a1) => (_pow = Module['_pow'] = wasmExports['pow'])(a0, a1); +var _fma = Module['_fma'] = (a0, a1, a2) => (_fma = Module['_fma'] = wasmExports['fma'])(a0, a1, a2); +var _asinf = Module['_asinf'] = (a0) => (_asinf = Module['_asinf'] = wasmExports['asinf'])(a0); +var _asinhf = Module['_asinhf'] = (a0) => (_asinhf = Module['_asinhf'] = wasmExports['asinhf'])(a0); +var _acosf = Module['_acosf'] = (a0) => (_acosf = Module['_acosf'] = wasmExports['acosf'])(a0); +var _acoshf = Module['_acoshf'] = (a0) => (_acoshf = Module['_acoshf'] = wasmExports['acoshf'])(a0); +var _atanhf = Module['_atanhf'] = (a0) => (_atanhf = Module['_atanhf'] = wasmExports['atanhf'])(a0); +var _cbrtf = Module['_cbrtf'] = (a0) => (_cbrtf = Module['_cbrtf'] = wasmExports['cbrtf'])(a0); +var _coshf = Module['_coshf'] = (a0) => (_coshf = Module['_coshf'] = wasmExports['coshf'])(a0); +var _expf = Module['_expf'] = (a0) => (_expf = Module['_expf'] = wasmExports['expf'])(a0); +var _logf = Module['_logf'] = (a0) => (_logf = Module['_logf'] = wasmExports['logf'])(a0); +var _log2f = Module['_log2f'] = (a0) => (_log2f = Module['_log2f'] = wasmExports['log2f'])(a0); +var _log10f = Module['_log10f'] = (a0) => (_log10f = Module['_log10f'] = wasmExports['log10f'])(a0); +var _sinhf = Module['_sinhf'] = (a0) => (_sinhf = Module['_sinhf'] = wasmExports['sinhf'])(a0); +var _tanhf = Module['_tanhf'] = (a0) => (_tanhf = Module['_tanhf'] = wasmExports['tanhf'])(a0); +var _atan2f = Module['_atan2f'] = (a0, a1) => (_atan2f = Module['_atan2f'] = wasmExports['atan2f'])(a0, a1); +var _powf = Module['_powf'] = (a0, a1) => (_powf = Module['_powf'] = wasmExports['powf'])(a0, a1); +var _fmaf = Module['_fmaf'] = (a0, a1, a2) => (_fmaf = Module['_fmaf'] = wasmExports['fmaf'])(a0, a1, a2); +var _mono_jiterp_get_polling_required_address = Module['_mono_jiterp_get_polling_required_address'] = () => (_mono_jiterp_get_polling_required_address = Module['_mono_jiterp_get_polling_required_address'] = wasmExports['mono_jiterp_get_polling_required_address'])(); +var _mono_jiterp_prof_enter = Module['_mono_jiterp_prof_enter'] = (a0, a1) => (_mono_jiterp_prof_enter = Module['_mono_jiterp_prof_enter'] = wasmExports['mono_jiterp_prof_enter'])(a0, a1); +var _mono_jiterp_prof_samplepoint = Module['_mono_jiterp_prof_samplepoint'] = (a0, a1) => (_mono_jiterp_prof_samplepoint = Module['_mono_jiterp_prof_samplepoint'] = wasmExports['mono_jiterp_prof_samplepoint'])(a0, a1); +var _mono_jiterp_prof_leave = Module['_mono_jiterp_prof_leave'] = (a0, a1) => (_mono_jiterp_prof_leave = Module['_mono_jiterp_prof_leave'] = wasmExports['mono_jiterp_prof_leave'])(a0, a1); +var _mono_jiterp_do_safepoint = Module['_mono_jiterp_do_safepoint'] = (a0, a1) => (_mono_jiterp_do_safepoint = Module['_mono_jiterp_do_safepoint'] = wasmExports['mono_jiterp_do_safepoint'])(a0, a1); +var _mono_jiterp_imethod_to_ftnptr = Module['_mono_jiterp_imethod_to_ftnptr'] = (a0) => (_mono_jiterp_imethod_to_ftnptr = Module['_mono_jiterp_imethod_to_ftnptr'] = wasmExports['mono_jiterp_imethod_to_ftnptr'])(a0); +var _mono_jiterp_enum_hasflag = Module['_mono_jiterp_enum_hasflag'] = (a0, a1, a2, a3) => (_mono_jiterp_enum_hasflag = Module['_mono_jiterp_enum_hasflag'] = wasmExports['mono_jiterp_enum_hasflag'])(a0, a1, a2, a3); +var _mono_jiterp_get_simd_intrinsic = Module['_mono_jiterp_get_simd_intrinsic'] = (a0, a1) => (_mono_jiterp_get_simd_intrinsic = Module['_mono_jiterp_get_simd_intrinsic'] = wasmExports['mono_jiterp_get_simd_intrinsic'])(a0, a1); +var _mono_jiterp_get_simd_opcode = Module['_mono_jiterp_get_simd_opcode'] = (a0, a1) => (_mono_jiterp_get_simd_opcode = Module['_mono_jiterp_get_simd_opcode'] = wasmExports['mono_jiterp_get_simd_opcode'])(a0, a1); +var _mono_jiterp_get_opcode_info = Module['_mono_jiterp_get_opcode_info'] = (a0, a1) => (_mono_jiterp_get_opcode_info = Module['_mono_jiterp_get_opcode_info'] = wasmExports['mono_jiterp_get_opcode_info'])(a0, a1); +var _mono_jiterp_placeholder_trace = Module['_mono_jiterp_placeholder_trace'] = (a0, a1, a2, a3) => (_mono_jiterp_placeholder_trace = Module['_mono_jiterp_placeholder_trace'] = wasmExports['mono_jiterp_placeholder_trace'])(a0, a1, a2, a3); +var _mono_jiterp_placeholder_jit_call = Module['_mono_jiterp_placeholder_jit_call'] = (a0, a1, a2, a3) => (_mono_jiterp_placeholder_jit_call = Module['_mono_jiterp_placeholder_jit_call'] = wasmExports['mono_jiterp_placeholder_jit_call'])(a0, a1, a2, a3); +var _mono_jiterp_get_interp_entry_func = Module['_mono_jiterp_get_interp_entry_func'] = (a0) => (_mono_jiterp_get_interp_entry_func = Module['_mono_jiterp_get_interp_entry_func'] = wasmExports['mono_jiterp_get_interp_entry_func'])(a0); +var _mono_jiterp_is_enabled = Module['_mono_jiterp_is_enabled'] = () => (_mono_jiterp_is_enabled = Module['_mono_jiterp_is_enabled'] = wasmExports['mono_jiterp_is_enabled'])(); +var _mono_jiterp_encode_leb64_ref = Module['_mono_jiterp_encode_leb64_ref'] = (a0, a1, a2) => (_mono_jiterp_encode_leb64_ref = Module['_mono_jiterp_encode_leb64_ref'] = wasmExports['mono_jiterp_encode_leb64_ref'])(a0, a1, a2); +var _mono_jiterp_encode_leb52 = Module['_mono_jiterp_encode_leb52'] = (a0, a1, a2) => (_mono_jiterp_encode_leb52 = Module['_mono_jiterp_encode_leb52'] = wasmExports['mono_jiterp_encode_leb52'])(a0, a1, a2); +var _mono_jiterp_encode_leb_signed_boundary = Module['_mono_jiterp_encode_leb_signed_boundary'] = (a0, a1, a2) => (_mono_jiterp_encode_leb_signed_boundary = Module['_mono_jiterp_encode_leb_signed_boundary'] = wasmExports['mono_jiterp_encode_leb_signed_boundary'])(a0, a1, a2); +var _mono_jiterp_increase_entry_count = Module['_mono_jiterp_increase_entry_count'] = (a0) => (_mono_jiterp_increase_entry_count = Module['_mono_jiterp_increase_entry_count'] = wasmExports['mono_jiterp_increase_entry_count'])(a0); +var _mono_jiterp_object_unbox = Module['_mono_jiterp_object_unbox'] = (a0) => (_mono_jiterp_object_unbox = Module['_mono_jiterp_object_unbox'] = wasmExports['mono_jiterp_object_unbox'])(a0); +var _mono_jiterp_type_is_byref = Module['_mono_jiterp_type_is_byref'] = (a0) => (_mono_jiterp_type_is_byref = Module['_mono_jiterp_type_is_byref'] = wasmExports['mono_jiterp_type_is_byref'])(a0); +var _mono_jiterp_value_copy = Module['_mono_jiterp_value_copy'] = (a0, a1, a2) => (_mono_jiterp_value_copy = Module['_mono_jiterp_value_copy'] = wasmExports['mono_jiterp_value_copy'])(a0, a1, a2); +var _mono_jiterp_try_newobj_inlined = Module['_mono_jiterp_try_newobj_inlined'] = (a0, a1) => (_mono_jiterp_try_newobj_inlined = Module['_mono_jiterp_try_newobj_inlined'] = wasmExports['mono_jiterp_try_newobj_inlined'])(a0, a1); +var _mono_jiterp_try_newstr = Module['_mono_jiterp_try_newstr'] = (a0, a1) => (_mono_jiterp_try_newstr = Module['_mono_jiterp_try_newstr'] = wasmExports['mono_jiterp_try_newstr'])(a0, a1); +var _mono_jiterp_try_newarr = Module['_mono_jiterp_try_newarr'] = (a0, a1, a2) => (_mono_jiterp_try_newarr = Module['_mono_jiterp_try_newarr'] = wasmExports['mono_jiterp_try_newarr'])(a0, a1, a2); +var _mono_jiterp_gettype_ref = Module['_mono_jiterp_gettype_ref'] = (a0, a1) => (_mono_jiterp_gettype_ref = Module['_mono_jiterp_gettype_ref'] = wasmExports['mono_jiterp_gettype_ref'])(a0, a1); +var _mono_jiterp_has_parent_fast = Module['_mono_jiterp_has_parent_fast'] = (a0, a1) => (_mono_jiterp_has_parent_fast = Module['_mono_jiterp_has_parent_fast'] = wasmExports['mono_jiterp_has_parent_fast'])(a0, a1); +var _mono_jiterp_implements_interface = Module['_mono_jiterp_implements_interface'] = (a0, a1) => (_mono_jiterp_implements_interface = Module['_mono_jiterp_implements_interface'] = wasmExports['mono_jiterp_implements_interface'])(a0, a1); +var _mono_jiterp_is_special_interface = Module['_mono_jiterp_is_special_interface'] = (a0) => (_mono_jiterp_is_special_interface = Module['_mono_jiterp_is_special_interface'] = wasmExports['mono_jiterp_is_special_interface'])(a0); +var _mono_jiterp_implements_special_interface = Module['_mono_jiterp_implements_special_interface'] = (a0, a1, a2) => (_mono_jiterp_implements_special_interface = Module['_mono_jiterp_implements_special_interface'] = wasmExports['mono_jiterp_implements_special_interface'])(a0, a1, a2); +var _mono_jiterp_cast_v2 = Module['_mono_jiterp_cast_v2'] = (a0, a1, a2, a3) => (_mono_jiterp_cast_v2 = Module['_mono_jiterp_cast_v2'] = wasmExports['mono_jiterp_cast_v2'])(a0, a1, a2, a3); +var _mono_jiterp_localloc = Module['_mono_jiterp_localloc'] = (a0, a1, a2) => (_mono_jiterp_localloc = Module['_mono_jiterp_localloc'] = wasmExports['mono_jiterp_localloc'])(a0, a1, a2); +var _mono_jiterp_ldtsflda = Module['_mono_jiterp_ldtsflda'] = (a0, a1) => (_mono_jiterp_ldtsflda = Module['_mono_jiterp_ldtsflda'] = wasmExports['mono_jiterp_ldtsflda'])(a0, a1); +var _mono_jiterp_box_ref = Module['_mono_jiterp_box_ref'] = (a0, a1, a2, a3) => (_mono_jiterp_box_ref = Module['_mono_jiterp_box_ref'] = wasmExports['mono_jiterp_box_ref'])(a0, a1, a2, a3); +var _mono_jiterp_conv = Module['_mono_jiterp_conv'] = (a0, a1, a2) => (_mono_jiterp_conv = Module['_mono_jiterp_conv'] = wasmExports['mono_jiterp_conv'])(a0, a1, a2); +var _mono_jiterp_relop_fp = Module['_mono_jiterp_relop_fp'] = (a0, a1, a2) => (_mono_jiterp_relop_fp = Module['_mono_jiterp_relop_fp'] = wasmExports['mono_jiterp_relop_fp'])(a0, a1, a2); +var _mono_jiterp_get_size_of_stackval = Module['_mono_jiterp_get_size_of_stackval'] = () => (_mono_jiterp_get_size_of_stackval = Module['_mono_jiterp_get_size_of_stackval'] = wasmExports['mono_jiterp_get_size_of_stackval'])(); +var _mono_jiterp_type_get_raw_value_size = Module['_mono_jiterp_type_get_raw_value_size'] = (a0) => (_mono_jiterp_type_get_raw_value_size = Module['_mono_jiterp_type_get_raw_value_size'] = wasmExports['mono_jiterp_type_get_raw_value_size'])(a0); +var _mono_jiterp_trace_bailout = Module['_mono_jiterp_trace_bailout'] = (a0) => (_mono_jiterp_trace_bailout = Module['_mono_jiterp_trace_bailout'] = wasmExports['mono_jiterp_trace_bailout'])(a0); +var _mono_jiterp_get_trace_bailout_count = Module['_mono_jiterp_get_trace_bailout_count'] = (a0) => (_mono_jiterp_get_trace_bailout_count = Module['_mono_jiterp_get_trace_bailout_count'] = wasmExports['mono_jiterp_get_trace_bailout_count'])(a0); +var _mono_jiterp_adjust_abort_count = Module['_mono_jiterp_adjust_abort_count'] = (a0, a1) => (_mono_jiterp_adjust_abort_count = Module['_mono_jiterp_adjust_abort_count'] = wasmExports['mono_jiterp_adjust_abort_count'])(a0, a1); +var _mono_jiterp_interp_entry_prologue = Module['_mono_jiterp_interp_entry_prologue'] = (a0, a1) => (_mono_jiterp_interp_entry_prologue = Module['_mono_jiterp_interp_entry_prologue'] = wasmExports['mono_jiterp_interp_entry_prologue'])(a0, a1); +var _mono_jiterp_get_opcode_value_table_entry = Module['_mono_jiterp_get_opcode_value_table_entry'] = (a0) => (_mono_jiterp_get_opcode_value_table_entry = Module['_mono_jiterp_get_opcode_value_table_entry'] = wasmExports['mono_jiterp_get_opcode_value_table_entry'])(a0); +var _mono_jiterp_get_trace_hit_count = Module['_mono_jiterp_get_trace_hit_count'] = (a0) => (_mono_jiterp_get_trace_hit_count = Module['_mono_jiterp_get_trace_hit_count'] = wasmExports['mono_jiterp_get_trace_hit_count'])(a0); +var _mono_jiterp_parse_option = Module['_mono_jiterp_parse_option'] = (a0) => (_mono_jiterp_parse_option = Module['_mono_jiterp_parse_option'] = wasmExports['mono_jiterp_parse_option'])(a0); +var _mono_jiterp_get_options_version = Module['_mono_jiterp_get_options_version'] = () => (_mono_jiterp_get_options_version = Module['_mono_jiterp_get_options_version'] = wasmExports['mono_jiterp_get_options_version'])(); +var _mono_jiterp_get_options_as_json = Module['_mono_jiterp_get_options_as_json'] = () => (_mono_jiterp_get_options_as_json = Module['_mono_jiterp_get_options_as_json'] = wasmExports['mono_jiterp_get_options_as_json'])(); +var _mono_jiterp_get_option_as_int = Module['_mono_jiterp_get_option_as_int'] = (a0) => (_mono_jiterp_get_option_as_int = Module['_mono_jiterp_get_option_as_int'] = wasmExports['mono_jiterp_get_option_as_int'])(a0); +var _mono_jiterp_object_has_component_size = Module['_mono_jiterp_object_has_component_size'] = (a0) => (_mono_jiterp_object_has_component_size = Module['_mono_jiterp_object_has_component_size'] = wasmExports['mono_jiterp_object_has_component_size'])(a0); +var _mono_jiterp_get_hashcode = Module['_mono_jiterp_get_hashcode'] = (a0) => (_mono_jiterp_get_hashcode = Module['_mono_jiterp_get_hashcode'] = wasmExports['mono_jiterp_get_hashcode'])(a0); +var _mono_jiterp_try_get_hashcode = Module['_mono_jiterp_try_get_hashcode'] = (a0) => (_mono_jiterp_try_get_hashcode = Module['_mono_jiterp_try_get_hashcode'] = wasmExports['mono_jiterp_try_get_hashcode'])(a0); +var _mono_jiterp_get_signature_has_this = Module['_mono_jiterp_get_signature_has_this'] = (a0) => (_mono_jiterp_get_signature_has_this = Module['_mono_jiterp_get_signature_has_this'] = wasmExports['mono_jiterp_get_signature_has_this'])(a0); +var _mono_jiterp_get_signature_return_type = Module['_mono_jiterp_get_signature_return_type'] = (a0) => (_mono_jiterp_get_signature_return_type = Module['_mono_jiterp_get_signature_return_type'] = wasmExports['mono_jiterp_get_signature_return_type'])(a0); +var _mono_jiterp_get_signature_param_count = Module['_mono_jiterp_get_signature_param_count'] = (a0) => (_mono_jiterp_get_signature_param_count = Module['_mono_jiterp_get_signature_param_count'] = wasmExports['mono_jiterp_get_signature_param_count'])(a0); +var _mono_jiterp_get_signature_params = Module['_mono_jiterp_get_signature_params'] = (a0) => (_mono_jiterp_get_signature_params = Module['_mono_jiterp_get_signature_params'] = wasmExports['mono_jiterp_get_signature_params'])(a0); +var _mono_jiterp_type_to_ldind = Module['_mono_jiterp_type_to_ldind'] = (a0) => (_mono_jiterp_type_to_ldind = Module['_mono_jiterp_type_to_ldind'] = wasmExports['mono_jiterp_type_to_ldind'])(a0); +var _mono_jiterp_type_to_stind = Module['_mono_jiterp_type_to_stind'] = (a0) => (_mono_jiterp_type_to_stind = Module['_mono_jiterp_type_to_stind'] = wasmExports['mono_jiterp_type_to_stind'])(a0); +var _mono_jiterp_get_array_rank = Module['_mono_jiterp_get_array_rank'] = (a0, a1) => (_mono_jiterp_get_array_rank = Module['_mono_jiterp_get_array_rank'] = wasmExports['mono_jiterp_get_array_rank'])(a0, a1); +var _mono_jiterp_get_array_element_size = Module['_mono_jiterp_get_array_element_size'] = (a0, a1) => (_mono_jiterp_get_array_element_size = Module['_mono_jiterp_get_array_element_size'] = wasmExports['mono_jiterp_get_array_element_size'])(a0, a1); +var _mono_jiterp_set_object_field = Module['_mono_jiterp_set_object_field'] = (a0, a1, a2, a3) => (_mono_jiterp_set_object_field = Module['_mono_jiterp_set_object_field'] = wasmExports['mono_jiterp_set_object_field'])(a0, a1, a2, a3); +var _mono_jiterp_debug_count = Module['_mono_jiterp_debug_count'] = () => (_mono_jiterp_debug_count = Module['_mono_jiterp_debug_count'] = wasmExports['mono_jiterp_debug_count'])(); +var _mono_jiterp_stelem_ref = Module['_mono_jiterp_stelem_ref'] = (a0, a1, a2) => (_mono_jiterp_stelem_ref = Module['_mono_jiterp_stelem_ref'] = wasmExports['mono_jiterp_stelem_ref'])(a0, a1, a2); +var _mono_jiterp_get_member_offset = Module['_mono_jiterp_get_member_offset'] = (a0) => (_mono_jiterp_get_member_offset = Module['_mono_jiterp_get_member_offset'] = wasmExports['mono_jiterp_get_member_offset'])(a0); +var _mono_jiterp_get_counter = Module['_mono_jiterp_get_counter'] = (a0) => (_mono_jiterp_get_counter = Module['_mono_jiterp_get_counter'] = wasmExports['mono_jiterp_get_counter'])(a0); +var _mono_jiterp_modify_counter = Module['_mono_jiterp_modify_counter'] = (a0, a1) => (_mono_jiterp_modify_counter = Module['_mono_jiterp_modify_counter'] = wasmExports['mono_jiterp_modify_counter'])(a0, a1); +var _mono_jiterp_write_number_unaligned = Module['_mono_jiterp_write_number_unaligned'] = (a0, a1, a2) => (_mono_jiterp_write_number_unaligned = Module['_mono_jiterp_write_number_unaligned'] = wasmExports['mono_jiterp_write_number_unaligned'])(a0, a1, a2); +var _mono_jiterp_get_rejected_trace_count = Module['_mono_jiterp_get_rejected_trace_count'] = () => (_mono_jiterp_get_rejected_trace_count = Module['_mono_jiterp_get_rejected_trace_count'] = wasmExports['mono_jiterp_get_rejected_trace_count'])(); +var _mono_jiterp_boost_back_branch_target = Module['_mono_jiterp_boost_back_branch_target'] = (a0) => (_mono_jiterp_boost_back_branch_target = Module['_mono_jiterp_boost_back_branch_target'] = wasmExports['mono_jiterp_boost_back_branch_target'])(a0); +var _mono_jiterp_is_imethod_var_address_taken = Module['_mono_jiterp_is_imethod_var_address_taken'] = (a0, a1) => (_mono_jiterp_is_imethod_var_address_taken = Module['_mono_jiterp_is_imethod_var_address_taken'] = wasmExports['mono_jiterp_is_imethod_var_address_taken'])(a0, a1); +var _mono_jiterp_initialize_table = Module['_mono_jiterp_initialize_table'] = (a0, a1, a2) => (_mono_jiterp_initialize_table = Module['_mono_jiterp_initialize_table'] = wasmExports['mono_jiterp_initialize_table'])(a0, a1, a2); +var _mono_jiterp_allocate_table_entry = Module['_mono_jiterp_allocate_table_entry'] = (a0) => (_mono_jiterp_allocate_table_entry = Module['_mono_jiterp_allocate_table_entry'] = wasmExports['mono_jiterp_allocate_table_entry'])(a0); +var _mono_jiterp_tlqueue_next = Module['_mono_jiterp_tlqueue_next'] = (a0) => (_mono_jiterp_tlqueue_next = Module['_mono_jiterp_tlqueue_next'] = wasmExports['mono_jiterp_tlqueue_next'])(a0); +var _mono_jiterp_tlqueue_add = Module['_mono_jiterp_tlqueue_add'] = (a0, a1) => (_mono_jiterp_tlqueue_add = Module['_mono_jiterp_tlqueue_add'] = wasmExports['mono_jiterp_tlqueue_add'])(a0, a1); +var _mono_jiterp_tlqueue_clear = Module['_mono_jiterp_tlqueue_clear'] = (a0) => (_mono_jiterp_tlqueue_clear = Module['_mono_jiterp_tlqueue_clear'] = wasmExports['mono_jiterp_tlqueue_clear'])(a0); +var _mono_interp_pgo_load_table = Module['_mono_interp_pgo_load_table'] = (a0, a1) => (_mono_interp_pgo_load_table = Module['_mono_interp_pgo_load_table'] = wasmExports['mono_interp_pgo_load_table'])(a0, a1); +var _mono_interp_pgo_save_table = Module['_mono_interp_pgo_save_table'] = (a0, a1) => (_mono_interp_pgo_save_table = Module['_mono_interp_pgo_save_table'] = wasmExports['mono_interp_pgo_save_table'])(a0, a1); +var _mono_llvm_cpp_catch_exception = Module['_mono_llvm_cpp_catch_exception'] = (a0, a1, a2) => (_mono_llvm_cpp_catch_exception = Module['_mono_llvm_cpp_catch_exception'] = wasmExports['mono_llvm_cpp_catch_exception'])(a0, a1, a2); +var _mono_jiterp_begin_catch = Module['_mono_jiterp_begin_catch'] = (a0) => (_mono_jiterp_begin_catch = Module['_mono_jiterp_begin_catch'] = wasmExports['mono_jiterp_begin_catch'])(a0); +var _mono_jiterp_end_catch = Module['_mono_jiterp_end_catch'] = () => (_mono_jiterp_end_catch = Module['_mono_jiterp_end_catch'] = wasmExports['mono_jiterp_end_catch'])(); +var _sbrk = Module['_sbrk'] = (a0) => (_sbrk = Module['_sbrk'] = wasmExports['sbrk'])(a0); +var _posix_memalign = Module['_posix_memalign'] = (a0, a1, a2) => (_posix_memalign = Module['_posix_memalign'] = wasmExports['posix_memalign'])(a0, a1, a2); +var _mono_background_exec = Module['_mono_background_exec'] = () => (_mono_background_exec = Module['_mono_background_exec'] = wasmExports['mono_background_exec'])(); +var _mono_wasm_ds_exec = Module['_mono_wasm_ds_exec'] = () => (_mono_wasm_ds_exec = Module['_mono_wasm_ds_exec'] = wasmExports['mono_wasm_ds_exec'])(); +var _mono_wasm_gc_lock = Module['_mono_wasm_gc_lock'] = () => (_mono_wasm_gc_lock = Module['_mono_wasm_gc_lock'] = wasmExports['mono_wasm_gc_lock'])(); +var _mono_wasm_gc_unlock = Module['_mono_wasm_gc_unlock'] = () => (_mono_wasm_gc_unlock = Module['_mono_wasm_gc_unlock'] = wasmExports['mono_wasm_gc_unlock'])(); +var _mono_print_method_from_ip = Module['_mono_print_method_from_ip'] = (a0) => (_mono_print_method_from_ip = Module['_mono_print_method_from_ip'] = wasmExports['mono_print_method_from_ip'])(a0); +var _mono_wasm_execute_timer = Module['_mono_wasm_execute_timer'] = () => (_mono_wasm_execute_timer = Module['_mono_wasm_execute_timer'] = wasmExports['mono_wasm_execute_timer'])(); +var _mono_wasm_load_icu_data = Module['_mono_wasm_load_icu_data'] = (a0) => (_mono_wasm_load_icu_data = Module['_mono_wasm_load_icu_data'] = wasmExports['mono_wasm_load_icu_data'])(a0); +var ___funcs_on_exit = () => (___funcs_on_exit = wasmExports['__funcs_on_exit'])(); +var _htons = Module['_htons'] = (a0) => (_htons = Module['_htons'] = wasmExports['htons'])(a0); +var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports['emscripten_builtin_memalign'])(a0, a1); +var _ntohs = Module['_ntohs'] = (a0) => (_ntohs = Module['_ntohs'] = wasmExports['ntohs'])(a0); +var _memalign = Module['_memalign'] = (a0, a1) => (_memalign = Module['_memalign'] = wasmExports['memalign'])(a0, a1); +var ___trap = () => (___trap = wasmExports['__trap'])(); +var stackSave = Module['stackSave'] = () => (stackSave = Module['stackSave'] = wasmExports['stackSave'])(); +var stackRestore = Module['stackRestore'] = (a0) => (stackRestore = Module['stackRestore'] = wasmExports['stackRestore'])(a0); +var stackAlloc = Module['stackAlloc'] = (a0) => (stackAlloc = Module['stackAlloc'] = wasmExports['stackAlloc'])(a0); + + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === + +Module['addRunDependency'] = addRunDependency; +Module['removeRunDependency'] = removeRunDependency; +Module['FS_createPath'] = FS.createPath; +Module['FS_createLazyFile'] = FS.createLazyFile; +Module['FS_createDevice'] = FS.createDevice; +Module['out'] = out; +Module['err'] = err; +Module['abort'] = abort; +Module['wasmExports'] = wasmExports; +Module['runtimeKeepalivePush'] = runtimeKeepalivePush; +Module['runtimeKeepalivePop'] = runtimeKeepalivePop; +Module['maybeExit'] = maybeExit; +Module['ccall'] = ccall; +Module['cwrap'] = cwrap; +Module['addFunction'] = addFunction; +Module['setValue'] = setValue; +Module['getValue'] = getValue; +Module['UTF8ArrayToString'] = UTF8ArrayToString; +Module['UTF8ToString'] = UTF8ToString; +Module['stringToUTF8Array'] = stringToUTF8Array; +Module['lengthBytesUTF8'] = lengthBytesUTF8; +Module['safeSetTimeout'] = safeSetTimeout; +Module['FS_createPreloadedFile'] = FS.createPreloadedFile; +Module['FS'] = FS; +Module['FS_createDataFile'] = FS.createDataFile; +Module['FS_unlink'] = FS.unlink; +Module['GL'] = GL; + + +var calledRun; + +dependenciesFulfilled = function runCaller() { + // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled +}; + +function run() { + + if (runDependencies > 0) { + return; + } + + preRun(); + + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + return; + } + + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + if (calledRun) return; + calledRun = true; + Module['calledRun'] = true; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized'](); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(function() { + setTimeout(function() { + Module['setStatus'](''); + }, 1); + doRun(); + }, 1); + } else + { + doRun(); + } +} + +if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } +} + +run(); + +// end include: postamble.js + + + + return moduleArg.ready +} +); +})(); +export default createDotnetRuntime; +var fetch = fetch || undefined; var require = require || undefined; var __dirname = __dirname || ''; var _nativeModuleLoaded = false; diff --git a/_framework/dotnet.native.7bi0derspt.js.br b/_framework/dotnet.native.7bi0derspt.js.br new file mode 100644 index 0000000..c13cdb9 Binary files /dev/null and b/_framework/dotnet.native.7bi0derspt.js.br differ diff --git a/_framework/dotnet.native.7bi0derspt.js.gz b/_framework/dotnet.native.7bi0derspt.js.gz new file mode 100644 index 0000000..48ad562 Binary files /dev/null and b/_framework/dotnet.native.7bi0derspt.js.gz differ diff --git a/_framework/dotnet.runtime.2tx45g8lli.js b/_framework/dotnet.runtime.2tx45g8lli.js new file mode 100755 index 0000000..82ac034 --- /dev/null +++ b/_framework/dotnet.runtime.2tx45g8lli.js @@ -0,0 +1,4 @@ +//! Licensed to the .NET Foundation under one or more agreements. +//! The .NET Foundation licenses this file to you under the MIT license. +var e="10.0.2",t="Release",n=!1;const r=[[!0,"mono_wasm_register_root","number",["number","number","string"]],[!0,"mono_wasm_deregister_root",null,["number"]],[!0,"mono_wasm_string_get_data_ref",null,["number","number","number","number"]],[!0,"mono_wasm_set_is_debugger_attached","void",["bool"]],[!0,"mono_wasm_send_dbg_command","bool",["number","number","number","number","number"]],[!0,"mono_wasm_send_dbg_command_with_parms","bool",["number","number","number","number","number","number","string"]],[!0,"mono_wasm_setenv",null,["string","string"]],[!0,"mono_wasm_parse_runtime_options",null,["number","number"]],[!0,"mono_wasm_strdup","number",["string"]],[!0,"mono_background_exec",null,[]],[!0,"mono_wasm_ds_exec",null,[]],[!0,"mono_wasm_execute_timer",null,[]],[!0,"mono_wasm_load_icu_data","number",["number"]],[!1,"mono_wasm_add_assembly","number",["string","number","number"]],[!0,"mono_wasm_add_satellite_assembly","void",["string","string","number","number"]],[!1,"mono_wasm_load_runtime",null,["number","number","number","number"]],[!0,"mono_wasm_change_debugger_log_level","void",["number"]],[!0,"mono_wasm_assembly_load","number",["string"]],[!0,"mono_wasm_assembly_find_class","number",["number","string","string"]],[!0,"mono_wasm_assembly_find_method","number",["number","string","number"]],[!0,"mono_wasm_string_from_utf16_ref","void",["number","number","number"]],[!0,"mono_wasm_intern_string_ref","void",["number"]],[!1,"mono_wasm_exit","void",["number"]],[!0,"mono_wasm_getenv","number",["string"]],[!0,"mono_wasm_set_main_args","void",["number","number"]],[()=>!ct.emscriptenBuildOptions.enableAotProfiler,"mono_wasm_profiler_init_aot","void",["string"]],[()=>!ct.emscriptenBuildOptions.enableDevToolsProfiler,"mono_wasm_profiler_init_browser_devtools","void",["string"]],[()=>!ct.emscriptenBuildOptions.enableLogProfiler,"mono_wasm_profiler_init_log","void",["string"]],[!1,"mono_wasm_exec_regression","number",["number","string"]],[!1,"mono_wasm_invoke_jsexport","void",["number","number"]],[!0,"mono_wasm_write_managed_pointer_unsafe","void",["number","number"]],[!0,"mono_wasm_copy_managed_pointer","void",["number","number"]],[!0,"mono_wasm_i52_to_f64","number",["number","number"]],[!0,"mono_wasm_u52_to_f64","number",["number","number"]],[!0,"mono_wasm_f64_to_i52","number",["number","number"]],[!0,"mono_wasm_f64_to_u52","number",["number","number"]],[!0,"mono_wasm_method_get_name","number",["number"]],[!0,"mono_wasm_method_get_name_ex","number",["number"]],[!0,"mono_wasm_method_get_full_name","number",["number"]],[!0,"mono_wasm_gc_lock","void",[]],[!0,"mono_wasm_gc_unlock","void",[]],[!0,"mono_wasm_get_i32_unaligned","number",["number"]],[!0,"mono_wasm_get_f32_unaligned","number",["number"]],[!0,"mono_wasm_get_f64_unaligned","number",["number"]],[!0,"mono_wasm_read_as_bool_or_null_unsafe","number",["number"]],[!0,"mono_jiterp_trace_bailout","void",["number"]],[!0,"mono_jiterp_get_trace_bailout_count","number",["number"]],[!0,"mono_jiterp_value_copy","void",["number","number","number"]],[!0,"mono_jiterp_get_member_offset","number",["number"]],[!0,"mono_jiterp_encode_leb52","number",["number","number","number"]],[!0,"mono_jiterp_encode_leb64_ref","number",["number","number","number"]],[!0,"mono_jiterp_encode_leb_signed_boundary","number",["number","number","number"]],[!0,"mono_jiterp_write_number_unaligned","void",["number","number","number"]],[!0,"mono_jiterp_type_is_byref","number",["number"]],[!0,"mono_jiterp_get_size_of_stackval","number",[]],[!0,"mono_jiterp_parse_option","number",["string"]],[!0,"mono_jiterp_get_options_as_json","number",[]],[!0,"mono_jiterp_get_option_as_int","number",["string"]],[!0,"mono_jiterp_get_options_version","number",[]],[!0,"mono_jiterp_adjust_abort_count","number",["number","number"]],[!0,"mono_jiterp_register_jit_call_thunk","void",["number","number"]],[!0,"mono_jiterp_type_get_raw_value_size","number",["number"]],[!0,"mono_jiterp_get_signature_has_this","number",["number"]],[!0,"mono_jiterp_get_signature_return_type","number",["number"]],[!0,"mono_jiterp_get_signature_param_count","number",["number"]],[!0,"mono_jiterp_get_signature_params","number",["number"]],[!0,"mono_jiterp_type_to_ldind","number",["number"]],[!0,"mono_jiterp_type_to_stind","number",["number"]],[!0,"mono_jiterp_imethod_to_ftnptr","number",["number"]],[!0,"mono_jiterp_debug_count","number",[]],[!0,"mono_jiterp_get_trace_hit_count","number",["number"]],[!0,"mono_jiterp_get_polling_required_address","number",[]],[!0,"mono_jiterp_get_rejected_trace_count","number",[]],[!0,"mono_jiterp_boost_back_branch_target","void",["number"]],[!0,"mono_jiterp_is_imethod_var_address_taken","number",["number","number"]],[!0,"mono_jiterp_get_opcode_value_table_entry","number",["number"]],[!0,"mono_jiterp_get_simd_intrinsic","number",["number","number"]],[!0,"mono_jiterp_get_simd_opcode","number",["number","number"]],[!0,"mono_jiterp_get_arg_offset","number",["number","number","number"]],[!0,"mono_jiterp_get_opcode_info","number",["number","number"]],[!0,"mono_wasm_is_zero_page_reserved","number",[]],[!0,"mono_jiterp_is_special_interface","number",["number"]],[!0,"mono_jiterp_initialize_table","void",["number","number","number"]],[!0,"mono_jiterp_allocate_table_entry","number",["number"]],[!0,"mono_jiterp_get_interp_entry_func","number",["number"]],[!0,"mono_jiterp_get_counter","number",["number"]],[!0,"mono_jiterp_modify_counter","number",["number","number"]],[!0,"mono_jiterp_tlqueue_next","number",["number"]],[!0,"mono_jiterp_tlqueue_add","number",["number","number"]],[!0,"mono_jiterp_tlqueue_clear","void",["number"]],[!0,"mono_jiterp_begin_catch","void",["number"]],[!0,"mono_jiterp_end_catch","void",[]],[!0,"mono_interp_pgo_load_table","number",["number","number"]],[!0,"mono_interp_pgo_save_table","number",["number","number"]],[()=>!ct.emscriptenBuildOptions.enableEventPipe&&!ct.emscriptenBuildOptions.enableDevToolsProfiler,"mono_jiterp_prof_enter","void",["number","number"]],[()=>!ct.emscriptenBuildOptions.enableEventPipe&&!ct.emscriptenBuildOptions.enableDevToolsProfiler,"mono_jiterp_prof_samplepoint","void",["number","number"]],[()=>!ct.emscriptenBuildOptions.enableEventPipe&&!ct.emscriptenBuildOptions.enableDevToolsProfiler,"mono_jiterp_prof_leave","void",["number","number"]]],o={},s=o,a=o,i=["void","number",null];function c(e,t,n,r){let o=void 0===r&&i.indexOf(t)>=0&&(!n||n.every((e=>i.indexOf(e)>=0)))&&Ke.wasmExports?Ke.wasmExports[e]:void 0;if(o&&n&&o.length!==n.length&&(He(`argument count mismatch for cwrap ${e}`),o=void 0),"function"!=typeof o&&(o=Ke.cwrap(e,t,n,r)),"function"!=typeof o)throw new Error(`cwrap ${e} not found or not a function`);return o}const l=0,p=0,u=0,d=BigInt("9223372036854775807"),f=BigInt("-9223372036854775808");function _(e){return Ke._malloc(e)>>>0}function m(e){Ke._free(e)}function h(e,t,n){if(!Number.isSafeInteger(e))throw new Error(`Assert failed: Value is not an integer: ${e} (${typeof e})`);if(!(e>=t&&e<=n))throw new Error(`Assert failed: Overflow: value ${e} is out of ${t} ${n} range`)}function g(e,t){K().fill(0,e,e+t)}function b(e,t){const n=!!t;"number"==typeof t&&h(t,0,1),Ke.HEAP32[e>>>2]=n?1:0}function y(e,t){const n=!!t;"number"==typeof t&&h(t,0,1),Ke.HEAPU8[e]=n?1:0}function w(e,t){h(t,0,255),Ke.HEAPU8[e]=t}function k(e,t){h(t,0,65535),Ke.HEAPU16[e>>>1]=t}function S(e,t){h(t,0,4294967295),Ke.HEAPU32[e>>>2]=t}function v(e,t){h(t,-128,127),Ke.HEAP8[e]=t}function U(e,t){h(t,-32768,32767),Ke.HEAP16[e>>>1]=t}function T(e,t){h(t,-2147483648,2147483647),Ke.HEAP32[e>>>2]=t}function E(e){if(0!==e)switch(e){case 1:throw new Error("value was not an integer");case 2:throw new Error("value out of range");default:throw new Error("unknown internal error")}}function x(e,t){if(!Number.isSafeInteger(t))throw new Error(`Assert failed: Value is not a safe integer: ${t} (${typeof t})`);E(o.mono_wasm_f64_to_i52(e,t))}function I(e,t){if(!Number.isSafeInteger(t))throw new Error(`Assert failed: Value is not a safe integer: ${t} (${typeof t})`);if(!(t>=0))throw new Error("Assert failed: Can't convert negative Number into UInt64");E(o.mono_wasm_f64_to_u52(e,t))}function A(e,t){if("bigint"!=typeof t)throw new Error(`Assert failed: Value is not an bigint: ${t} (${typeof t})`);if(!(t>=f&&t<=d))throw new Error(`Assert failed: Overflow: value ${t} is out of ${f} ${d} range`);Ke.HEAP64[e>>>3]=t}function j(e,t){if("number"!=typeof t)throw new Error(`Assert failed: Value is not a Number: ${t} (${typeof t})`);Ke.HEAPF32[e>>>2]=t}function $(e,t){if("number"!=typeof t)throw new Error(`Assert failed: Value is not a Number: ${t} (${typeof t})`);Ke.HEAPF64[e>>>3]=t}let L=!0;function R(e){const t=Ke.HEAPU32[e>>>2];return t>1&&L&&(L=!1,We(`getB32: value at ${e} is not a boolean, but a number: ${t}`)),!!t}function B(e){return!!Ke.HEAPU8[e]}function N(e){return Ke.HEAPU8[e]}function O(e){return Ke.HEAPU16[e>>>1]}function C(e){return Ke.HEAPU32[e>>>2]}function D(e,t){return e[t>>>2]}function F(e){return o.mono_wasm_get_i32_unaligned(e)}function P(e){return o.mono_wasm_get_i32_unaligned(e)>>>0}function M(e){return Ke.HEAP8[e]}function z(e){return Ke.HEAP16[e>>>1]}function V(e){return Ke.HEAP32[e>>>2]}function W(e){const t=o.mono_wasm_i52_to_f64(e,ct._i52_error_scratch_buffer);return E(V(ct._i52_error_scratch_buffer)),t}function H(e){const t=o.mono_wasm_u52_to_f64(e,ct._i52_error_scratch_buffer);return E(V(ct._i52_error_scratch_buffer)),t}function q(e){return Ke.HEAP64[e>>>3]}function G(e){return Ke.HEAPF32[e>>>2]}function J(e){return Ke.HEAPF64[e>>>3]}function X(){return Ke.HEAP8}function Q(){return Ke.HEAP16}function Y(){return Ke.HEAP32}function Z(){return Ke.HEAP64}function K(){return Ke.HEAPU8}function ee(){return Ke.HEAPU16}function te(){return Ke.HEAPU32}function ne(){return Ke.HEAPF32}function re(){return Ke.HEAPF64}function oe(e,t){return e>>>t}let se=!1;function ae(){if(se)throw new Error("GC is already locked");se=!0}function ie(){if(!se)throw new Error("GC is not locked");se=!1}const ce=8192;let le=null,pe=null,ue=0;const de=[],fe=[];function _e(e,t){if(e<=0)throw new Error("capacity >= 1");const n=4*(e|=0),r=_(n);if(r%4!=0)throw new Error("Malloc returned an unaligned offset");return g(r,n),new me(r,e,!0,t)}class me{constructor(e,t,n,r){const s=4*t;this.__offset=e,this.__offset32=e>>>2,this.__count=t,this.length=t,this.__handle=o.mono_wasm_register_root(e,s,r||"noname"),this.__ownsAllocation=n}_throw_index_out_of_range(){throw new Error("index out of range")}_check_in_range(e){(e>=this.__count||e<0)&&this._throw_index_out_of_range()}get_address(e){return this._check_in_range(e),this.__offset+4*e}get_address_32(e){return this._check_in_range(e),this.__offset32+e}get(e){this._check_in_range(e);const t=this.get_address_32(e);return te()[t]}set(e,t){const n=this.get_address(e);return o.mono_wasm_write_managed_pointer_unsafe(n,t),t}copy_value_from_address(e,t){const n=this.get_address(e);o.mono_wasm_copy_managed_pointer(n,t)}_unsafe_get(e){return te()[this.__offset32+e]}_unsafe_set(e,t){const n=this.__offset+e;o.mono_wasm_write_managed_pointer_unsafe(n,t)}clear(){this.__offset&&g(this.__offset,4*this.__count)}release(){this.__offset&&this.__ownsAllocation&&(o.mono_wasm_deregister_root(this.__offset),g(this.__offset,4*this.__count),m(this.__offset)),this.__handle=this.__offset=this.__count=this.__offset32=0}toString(){return`[root buffer @${this.get_address(0)}, size ${this.__count} ]`}}class he{constructor(e,t){this.__buffer=e,this.__index=t}get_address(){return this.__buffer.get_address(this.__index)}get_address_32(){return this.__buffer.get_address_32(this.__index)}get address(){return this.__buffer.get_address(this.__index)}get(){return this.__buffer._unsafe_get(this.__index)}set(e){const t=this.__buffer.get_address(this.__index);return o.mono_wasm_write_managed_pointer_unsafe(t,e),e}copy_from(e){const t=e.address,n=this.address;o.mono_wasm_copy_managed_pointer(n,t)}copy_to(e){const t=this.address,n=e.address;o.mono_wasm_copy_managed_pointer(n,t)}copy_from_address(e){const t=this.address;o.mono_wasm_copy_managed_pointer(t,e)}copy_to_address(e){const t=this.address;o.mono_wasm_copy_managed_pointer(e,t)}get value(){return this.get()}set value(e){this.set(e)}valueOf(){throw new Error("Implicit conversion of roots to pointers is no longer supported. Use .value or .address as appropriate")}clear(){const e=this.__buffer.get_address_32(this.__index);te()[e]=0}release(){if(!this.__buffer)throw new Error("No buffer");var e;de.length>128?(void 0!==(e=this.__index)&&(le.set(e,0),pe[ue]=e,ue++),this.__buffer=null,this.__index=0):(this.set(0),de.push(this))}toString(){return`[root @${this.address}]`}}class ge{constructor(e){this.__external_address=0,this.__external_address_32=0,this._set_address(e)}_set_address(e){this.__external_address=e,this.__external_address_32=e>>>2}get address(){return this.__external_address}get_address(){return this.__external_address}get_address_32(){return this.__external_address_32}get(){return te()[this.__external_address_32]}set(e){return o.mono_wasm_write_managed_pointer_unsafe(this.__external_address,e),e}copy_from(e){const t=e.address,n=this.__external_address;o.mono_wasm_copy_managed_pointer(n,t)}copy_to(e){const t=this.__external_address,n=e.address;o.mono_wasm_copy_managed_pointer(n,t)}copy_from_address(e){const t=this.__external_address;o.mono_wasm_copy_managed_pointer(t,e)}copy_to_address(e){const t=this.__external_address;o.mono_wasm_copy_managed_pointer(e,t)}get value(){return this.get()}set value(e){this.set(e)}valueOf(){throw new Error("Implicit conversion of roots to pointers is no longer supported. Use .value or .address as appropriate")}clear(){te()[this.__external_address>>>2]=0}release(){fe.length<128&&fe.push(this)}toString(){return`[external root @${this.address}]`}}const be=new Map,ye="";let we;const ke=new Map;let Se,ve,Ue,Te,Ee,xe=0,Ie=null,Ae=0;function je(e){if(void 0===Te){const t=Ke.lengthBytesUTF8(e),n=new Uint8Array(t);return Ke.stringToUTF8Array(e,n,0,t),n}return Te.encode(e)}function $e(e){const t=Ke.lengthBytesUTF8(e)+1,n=_(t),r=K().subarray(n,n+t);return Ke.stringToUTF8Array(e,r,0,t),r[t-1]=0,n}function Le(e){const t=K();return function(e,t,n){const r=t+n;let o=t;for(;e[o]&&!(o>=r);)++o;if(o-t<=16)return Ke.UTF8ArrayToString(e,t,n);if(void 0===Ue)return Ke.UTF8ArrayToString(e,t,n);const s=Fe(e,t,o);return Ue.decode(s)}(t,e,t.length-e)}function Re(e,t){if(Se){const n=Fe(K(),e,t);return Se.decode(n)}return function(e,t){let n="";const r=ee();for(let o=e;o>>1];n+=String.fromCharCode(e)}return n}(e,t)}function Be(e,t,n){const r=ee(),o=n.length;for(let c=0;c>>1]=i,!((e+=2)>=t));c++);var s,a,i}function Ne(e){const t=2*(e.length+1),n=_(t);return g(n,2*e.length),Be(n,n+t,e),n}function Oe(e){if(e.value===p)return null;const t=we+0,n=we+4,r=we+8;let s;o.mono_wasm_string_get_data_ref(e.address,t,n,r);const a=te(),i=D(a,n),c=D(a,t),l=D(a,r);if(l&&(s=ke.get(e.value)),void 0===s&&(i&&c?(s=Re(c,c+i),l&&ke.set(e.value,s)):s=ye),void 0===s)throw new Error(`internal error when decoding string at location ${e.value}`);return s}function Ce(e,t){let n;if("symbol"==typeof e?(n=e.description,"string"!=typeof n&&(n=Symbol.keyFor(e)),"string"!=typeof n&&(n="")):"string"==typeof e&&(n=e),"string"!=typeof n)throw new Error(`Argument to stringToInternedMonoStringRoot must be a string but was ${e}`);if(0===n.length&&xe)return void t.set(xe);const r=be.get(n);r?t.set(r):(De(n,t),function(e,t,n){if(!t.value)throw new Error("null pointer passed to _store_string_in_intern_table");Ae>=8192&&(Ie=null),Ie||(Ie=_e(8192,"interned strings"),Ae=0);const r=Ie,s=Ae++;if(o.mono_wasm_intern_string_ref(t.address),!t.value)throw new Error("mono_wasm_intern_string_ref produced a null pointer");be.set(e,t.value),ke.set(t.value,e),0!==e.length||xe||(xe=t.value),r.copy_value_from_address(s,t.address)}(n,t))}function De(e,t){const n=2*(e.length+1),r=_(n);Be(r,r+n,e),o.mono_wasm_string_from_utf16_ref(r,e.length,t.address),m(r)}function Fe(e,t,n){return e.buffer,e.subarray(t,n)}function Pe(e){if(e===p)return null;Ee.value=e;const t=Oe(Ee);return Ee.value=p,t}let Me="MONO_WASM: ";function ze(e){if(ct.diagnosticTracing){const t="function"==typeof e?e():e;console.debug(Me+t)}}function Ve(e,...t){console.info(Me+e,...t)}function We(e,...t){console.warn(Me+e,...t)}function He(e,...t){if(t&&t.length>0&&t[0]&&"object"==typeof t[0]){if(t[0].silent)return;if(t[0].toString)return void console.error(Me+e,t[0].toString())}console.error(Me+e,...t)}const qe=new Map;let Ge;const Je=[];function Xe(e){try{if(Ye(),0==qe.size)return e;const t=e;for(let n=0;n{const n=t.find((e=>"object"==typeof e&&void 0!==e.replaceSection));if(void 0===n)return e;const r=n.funcNum,o=n.replaceSection,s=qe.get(Number(r));return void 0===s?e:e.replace(o,`${s} (${o})`)}));if(r!==t)return r}return t}catch(t){return console.debug(`failed to symbolicate: ${t}`),e}}function Qe(e){let t;return t="string"==typeof e?e:null==e||void 0===e.stack?(new Error).stack+"":e.stack+"",Xe(t)}function Ye(){if(!Ge)return;Je.push(/at (?[^:()]+:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)((?![^)a-fA-F\d])|$)/),Je.push(/(?:WASM \[[\da-zA-Z]+\], (?function #(?[\d]+) \(''\)))/),Je.push(/(?[a-z]+:\/\/[^ )]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/),Je.push(/(?<[^ >]+>[.:]wasm-function\[(?[0-9]+)\])/);const e=Ge;Ge=void 0;try{e.split(/[\r\n]/).forEach((e=>{const t=e.split(/:/);t.length<2||(t[1]=t.splice(1).join(":"),qe.set(Number(t[0]),t[1]))})),lt.diagnosticTracing&&ze(`Loaded ${qe.size} symbols`)}catch(e){We(`Failed to load symbol map: ${e}`)}}function Ze(){return Ye(),[...qe.values()]}let Ke,et;const tt="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,nt="function"==typeof importScripts,rt=nt&&"undefined"!=typeof dotnetSidecar,ot=nt&&!rt,st="object"==typeof window||nt&&!tt,at=!st&&!tt;let it=null,ct=null,lt=null,pt=null,ut=!1;function dt(e,t){ct.emscriptenBuildOptions=t,e.isPThread,ct.quit=e.quit_,ct.ExitStatus=e.ExitStatus,ct.getMemory=e.getMemory,ct.getWasmIndirectFunctionTable=e.getWasmIndirectFunctionTable,ct.updateMemoryViews=e.updateMemoryViews}function ft(e){if(ut)throw new Error("Runtime module already loaded");ut=!0,Ke=e.module,et=e.internal,ct=e.runtimeHelpers,lt=e.loaderHelpers,pt=e.diagnosticHelpers,it=e.api;const t={gitHash:"44525024595742ebe09023abe709df51de65009b",coreAssetsInMemory:_t(),allAssetsInMemory:_t(),dotnetReady:_t(),afterInstantiateWasm:_t(),beforePreInit:_t(),afterPreInit:_t(),afterPreRun:_t(),beforeOnRuntimeInitialized:_t(),afterMonoStarted:_t(),afterDeputyReady:_t(),afterIOStarted:_t(),afterOnRuntimeInitialized:_t(),afterPostRun:_t(),nativeAbort:e=>{throw e||new Error("abort")},nativeExit:e=>{throw new Error("exit:"+e)}};Object.assign(ct,t),Object.assign(e.module.config,{}),Object.assign(e.api,{Module:e.module,...e.module}),Object.assign(e.api,{INTERNAL:e.internal})}function _t(e,t){return lt.createPromiseController(e,t)}function mt(e,t){if(e)return;const n="Assert failed: "+("function"==typeof t?t():t),r=new Error(n);He(n,r),ct.nativeAbort(r)}function ht(e,t,n){const r=function(e,t,n){let r,o=0;r=e.length-o;const s={read:function(){if(o>=r)return null;const t=e[o];return o+=1,t}};return Object.defineProperty(s,"eof",{get:function(){return o>=r},configurable:!0,enumerable:!0}),s}(e);let o="",s=0,a=0,i=0,c=0,l=0,p=0;for(;s=r.read(),a=r.read(),i=r.read(),null!==s;)null===a&&(a=0,l+=1),null===i&&(i=0,l+=1),p=s<<16|a<<8|i,c=(16777215&p)>>18,o+=gt[c],c=(262143&p)>>12,o+=gt[c],l<2&&(c=(4095&p)>>6,o+=gt[c]),2===l?o+="==":1===l?o+="=":(c=63&p,o+=gt[c]);return o}const gt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],bt=new Map;bt.remove=function(e){const t=this.get(e);return this.delete(e),t};let yt,wt,kt,St={},vt=0,Ut=-1;function mono_wasm_fire_debugger_agent_message_with_data_to_pause(e){console.assert(!0,`mono_wasm_fire_debugger_agent_message_with_data ${e}`);debugger}function Tt(e){e.length>Ut&&(yt&&m(yt),Ut=Math.max(e.length,Ut,256),yt=_(Ut));const t=atob(e),n=K();for(let e=0;ee.value)),e;if(void 0===t.dimensionsDetails||1===t.dimensionsDetails.length)return e=t.items.map((e=>e.value)),e}const n={};return Object.keys(t).forEach((e=>{const r=t[e];void 0!==r.get?Object.defineProperty(n,r.name,{get:()=>xt(r.get.id,r.get.commandSet,r.get.command,r.get.buffer),set:function(e){return Et(r.set.id,r.set.commandSet,r.set.command,r.set.buffer,r.set.length,r.set.valtype,e),!0}}):void 0!==r.set?Object.defineProperty(n,r.name,{get:()=>r.value,set:function(e){return Et(r.set.id,r.set.commandSet,r.set.command,r.set.buffer,r.set.length,r.set.valtype,e),!0}}):n[r.name]=r.value})),n}(t,n);const o=null!=e.arguments?e.arguments.map((e=>JSON.stringify(e.value))):[],s=`const fn = ${e.functionDeclaration}; return fn.apply(proxy, [${o}]);`,a=new Function("proxy",s)(r);if(void 0===a)return{type:"undefined"};if(Object(a)!==a)return"object"==typeof a&&null==a?{type:typeof a,subtype:`${a}`,value:null}:{type:typeof a,description:`${a}`,value:`${a}`};if(e.returnByValue&&null==a.subtype)return{type:"object",value:a};if(Object.getPrototypeOf(a)==Array.prototype){const e=Ot(a);return{type:"object",subtype:"array",className:"Array",description:`Array(${a.length})`,objectId:e}}return void 0!==a.value||void 0!==a.subtype?a:a==r?{type:"object",className:"Object",description:"Object",objectId:t}:{type:"object",className:"Object",description:"Object",objectId:Ot(a)}}function Nt(e,t={}){return function(e,t){if(!(e in St))throw new Error(`Could not find any object with id ${e}`);const n=St[e],r=Object.getOwnPropertyDescriptors(n);t.accessorPropertiesOnly&&Object.keys(r).forEach((e=>{void 0===r[e].get&&Reflect.deleteProperty(r,e)}));const o=[];return Object.keys(r).forEach((e=>{let t;const n=r[e];t="object"==typeof n.value?Object.assign({name:e},n):void 0!==n.value?{name:e,value:Object.assign({type:typeof n.value,description:""+n.value},n)}:void 0!==n.get?{name:e,get:{className:"Function",description:`get ${e} () {}`,type:"function"}}:{name:e,value:{type:"symbol",value:"",description:""}},o.push(t)})),{__value_as_json_string__:JSON.stringify(o)}}(`dotnet:cfo_res:${e}`,t)}function Ot(e){const t="dotnet:cfo_res:"+vt++;return St[t]=e,t}function Ct(e){e in St&&delete St[e]}let Dt=!1;function Ft(){if(Dt)return globalThis.performance.now()}function Pt(e,t,n){if(Dt&&e){const r=st?{start:e}:{startTime:e},o=n?`${t}${n} `:t;globalThis.performance.measure(o,r)}}const Mt=new Map;function zt(e,t,n){if(0===t||1===t||2===t||26===t)return;let r,o,s,a;o=to(Cn(e)),s=to(Dn(e)),a=to(Fn(e));const i=On(e);r=Vt(i),19===t&&(t=i);const c=Vt(t),l=Cn(e),p=n*In;return e=>c(e+p,l,r,o,s,a)}function Vt(e){if(0===e||1===e)return;const t=vn.get(e);return t&&"function"==typeof t||mt(!1,`ERR41: Unknown converter for type ${e}. ${Kr}`),t}function Wt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),B(e)}(e)}function Ht(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),N(e)}(e)}function qt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),O(e)}(e)}function Gt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),z(e)}(e)}function Jt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),V(e)}(e)}function Xt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),J(e)}(e)}function Qt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),q(e)}(e)}function Yt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),G(e)}(e)}function Zt(e){return 0==zn(e)?null:function(e){return e||mt(!1,"Null arg"),J(e)}(e)}function Kt(e){return 0==zn(e)?null:Hn(e)}function en(){return null}function tn(e){return 0===zn(e)?null:function(e){e||mt(!1,"Null arg");const t=J(e);return new Date(t)}(e)}function nn(e,t,n,r,o,s){if(0===zn(e))return null;const a=Zn(e);let i=qr(a);return null==i&&(i=(e,t,i)=>function(e,t,n,r,o,s,a,i){lt.assert_runtime_running();const c=Ke.stackSave();try{const c=$n(6),l=Ln(c,2);if(Wn(l,14),Kn(l,e),s&&s(Ln(c,3),t),a&&a(Ln(c,4),n),i&&i(Ln(c,5),r),kn(yn.CallDelegate,c),o)return o(Ln(c,1))}finally{lt.is_runtime_running()&&Ke.stackRestore(c)}}(a,e,t,i,n,r,o,s),i.dispose=()=>{i.isDisposed||(i.isDisposed=!0,Vr(i,a))},i.isDisposed=!1,zr(i,a)),i}class rn{constructor(e,t){this.promise=e,this.resolve_or_reject=t}}function on(e,t,n){const r=zn(e);30==r&&mt(!1,"Unexpected Task type: TaskPreCreated");const o=cn(e,r,n);if(!1!==o)return o;const s=Qn(e),a=ln(n);return function(e,t){hr(),xr[0-t]=e,Object.isExtensible(e)&&(e[Cr]=t)}(a,s),a.promise}function sn(e,t,n){const r=ln(n);return Yn(e,Pr(r)),Wn(e,30),r.promise}function an(e,t,n){const r=Ln(e,1),o=zn(r);if(30===o)return n;Mr(Pr(n));const s=cn(r,o,t);return!1===s&&mt(!1,`Expected synchronous result, got: ${o}`),s}function cn(e,t,n){if(0===t)return null;if(29===t)return Promise.reject(un(e));if(28===t){const t=Vn(e);if(1===t)return Promise.resolve();Wn(e,t),n||(n=vn.get(t)),n||mt(!1,`Unknown sub_converter for type ${t}. ${Kr}`);const r=n(e);return Promise.resolve(r)}return!1}function ln(e){const{promise:t,promise_control:n}=lt.createPromiseController();return new rn(t,((t,r,o)=>{if(29===t){const e=un(o);n.reject(e)}else if(28===t){const t=zn(o);if(1===t)n.resolve(void 0);else{e||(e=vn.get(t)),e||mt(!1,`Unknown sub_converter for type ${t}. ${Kr}`);const r=e(o);n.resolve(r)}}else mt(!1,`Unexpected type ${t}`);Mr(r)}))}function pn(e){if(0==zn(e))return null;{const t=er(e);try{return Oe(t)}finally{t.release()}}}function un(e){const t=zn(e);if(0==t)return null;if(27==t)return Fr(Qn(e));const n=Zn(e);let r=qr(n);if(null==r){const t=pn(e);r=new ManagedError(t),zr(r,n)}return r}function dn(e){if(0==zn(e))return null;const t=Qn(e),n=Fr(t);return void 0===n&&mt(!1,`JS object JSHandle ${t} was not found`),n}function fn(e){const t=zn(e);if(0==t)return null;if(13==t)return Fr(Qn(e));if(21==t)return mn(e,Vn(e));if(14==t){const t=Zn(e);if(t===u)return null;let n=qr(t);return n||(n=new ManagedObject,zr(n,t)),n}const n=vn.get(t);return n||mt(!1,`Unknown converter for type ${t}. ${Kr}`),n(e)}function _n(e,t){return t||mt(!1,"Expected valid element_type parameter"),mn(e,t)}function mn(e,t){if(0==zn(e))return null;-1==rr(t)&&mt(!1,`Element type ${t} not supported`);const n=Hn(e),r=tr(e);let s=null;if(15==t){s=new Array(r);for(let e=0;e0?(t=fe.pop(),t._set_address(e)):t=new ge(e),t}(e)}function tr(e){return e||mt(!1,"Null arg"),V(e+8)}function nr(e,t){e||mt(!1,"Null arg"),T(e+8,t)}class ManagedObject{dispose(){Vr(this,u)}get isDisposed(){return this[Or]===u}toString(){return`CsObject(gc_handle: ${this[Or]})`}}class ManagedError extends Error{constructor(e){super(e),this.superStack=Object.getOwnPropertyDescriptor(this,"stack"),Object.defineProperty(this,"stack",{get:this.getManageStack})}getSuperStack(){if(this.superStack){if(void 0!==this.superStack.value)return this.superStack.value;if(void 0!==this.superStack.get)return this.superStack.get.call(this)}return super.stack}getManageStack(){if(this.managed_stack)return this.managed_stack;if(!lt.is_runtime_running())return this.managed_stack="... omitted managed stack trace.\n"+this.getSuperStack(),this.managed_stack;{const e=this[Or];if(e!==u){const t=function(e){lt.assert_runtime_running();const t=Ke.stackSave();try{const t=$n(3),n=Ln(t,2);return Wn(n,16),Kn(n,e),kn(yn.GetManagedStackTrace,t),pn(Ln(t,1))}finally{lt.is_runtime_running()&&Ke.stackRestore(t)}}(e);if(t)return this.managed_stack=t+"\n"+this.getSuperStack(),this.managed_stack}}return this.getSuperStack()}dispose(){Vr(this,u)}get isDisposed(){return this[Or]===u}}function rr(e){return 4==e?1:7==e?4:8==e||10==e?8:15==e||14==e||13==e?In:-1}class or{constructor(e,t,n){this._pointer=e,this._length=t,this._viewType=n}_unsafe_create_view(){const e=0==this._viewType?new Uint8Array(K().buffer,this._pointer,this._length):1==this._viewType?new Int32Array(Y().buffer,this._pointer,this._length):2==this._viewType?new Float64Array(re().buffer,this._pointer,this._length):null;if(!e)throw new Error("NotImplementedException");return e}set(e,t){if(this.isDisposed)throw new Error("Assert failed: ObjectDisposedException");const n=this._unsafe_create_view();if(!e||!n||e.constructor!==n.constructor)throw new Error(`Assert failed: Expected ${n.constructor}`);n.set(e,t)}copyTo(e,t){if(this.isDisposed)throw new Error("Assert failed: ObjectDisposedException");const n=this._unsafe_create_view();if(!e||!n||e.constructor!==n.constructor)throw new Error(`Assert failed: Expected ${n.constructor}`);const r=n.subarray(t);e.set(r)}slice(e,t){if(this.isDisposed)throw new Error("Assert failed: ObjectDisposedException");return this._unsafe_create_view().slice(e,t)}get length(){if(this.isDisposed)throw new Error("Assert failed: ObjectDisposedException");return this._length}get byteLength(){if(this.isDisposed)throw new Error("Assert failed: ObjectDisposedException");return 0==this._viewType?this._length:1==this._viewType?this._length<<2:2==this._viewType?this._length<<3:0}}class Span extends or{constructor(e,t,n){super(e,t,n),this.is_disposed=!1}dispose(){this.is_disposed=!0}get isDisposed(){return this.is_disposed}}class ArraySegment extends or{constructor(e,t,n){super(e,t,n)}dispose(){Vr(this,u)}get isDisposed(){return this[Or]===u}}const sr=[null];function ar(e){const t=e.args_count,r=e.arg_marshalers,o=e.res_converter,s=e.arg_cleanup,a=e.has_cleanup,i=e.fn,c=e.fqn;return e=null,function(l){const p=Ft();try{n&&e.isDisposed;const c=new Array(t);for(let e=0;e{const o=await n;return r&&(_r.set(e,o),lt.diagnosticTracing&&ze(`imported ES6 module '${e}' from '${t}'`)),o}))}function hr(){lt.assert_runtime_running(),ct.mono_wasm_bindings_is_ready||mt(!1,"The runtime must be initialized.")}function gr(e){e()}const br="function"==typeof globalThis.WeakRef;function yr(e){return br?new WeakRef(e):function(e){return{deref:()=>e,dispose:()=>{e=null}}}(e)}function wr(e,t,n,r,o,s,a){const i=`[${t}] ${n}.${r}:${o}`,c=Ft();lt.diagnosticTracing&&ze(`Binding [JSExport] ${n}.${r}:${o} from ${t} assembly`);const l=Mn(a);2!==l&&mt(!1,`Signature version ${l} mismatch.`);const p=Pn(a),u=new Array(p);for(let e=0;e0}function Nr(e){return e<-1}Ur&&(Tr=new globalThis.FinalizationRegistry(Hr));const Or=Symbol.for("wasm js_owned_gc_handle"),Cr=Symbol.for("wasm cs_owned_js_handle"),Dr=Symbol.for("wasm do_not_force_dispose");function Fr(e){return Br(e)?Er[e]:Rr(e)?xr[0-e]:null}function Pr(e){if(hr(),e[Cr])return e[Cr];const t=Ir.length?Ir.pop():Ar++;return Er[t]=e,Object.isExtensible(e)&&("function"==typeof e&&Object.prototype.hasOwnProperty.call(e,"prototype")||(e[Cr]=t)),t}function Mr(e){let t;Br(e)?(t=Er[e],Er[e]=void 0,Ir.push(e)):Rr(e)&&(t=xr[0-e],xr[0-e]=void 0),null==t&&mt(!1,"ObjectDisposedException"),void 0!==t[Cr]&&(t[Cr]=void 0)}function zr(e,t){hr(),e[Or]=t,Ur&&Tr.register(e,t,e);const n=yr(e);jr.set(t,n)}function Vr(e,t,r){var o;hr(),e&&(t=e[Or],e[Or]=u,Ur&&Tr.unregister(e)),t!==u&&jr.delete(t)&&!r&<.is_runtime_running()&&!Gr&&function(e){e||mt(!1,"Must be valid gc_handle"),lt.assert_runtime_running();const t=Ke.stackSave();try{const t=$n(3),r=Ln(t,2);Wn(r,14),Kn(r,e),n&&!Nr(e)&&bn.isUI||kn(yn.ReleaseJSOwnedObjectByGCHandle,t)}finally{lt.is_runtime_running()&&Ke.stackRestore(t)}}(t),Nr(t)&&(o=t,$r.push(o))}function Wr(e){const t=e[Or];if(t==u)throw new Error("Assert failed: ObjectDisposedException");return t}function Hr(e){lt.is_runtime_running()&&Vr(null,e)}function qr(e){if(!e)return null;const t=jr.get(e);return t?t.deref():null}let Gr=!1;function Jr(e,t){let n=!1,r=!1;Gr=!0;let o=0,s=0,a=0,i=0;const c=[...jr.keys()];for(const e of c){const r=jr.get(e),o=r&&r.deref();if(Ur&&o&&Tr.unregister(o),o){const s="boolean"==typeof o[Dr]&&o[Dr];if(t&&We(`Proxy of C# ${typeof o} with GCHandle ${e} was still alive. ${s?"keeping":"disposing"}.`),s)n=!0;else{const t=lt.getPromiseController(o);t&&t.reject(new Error("WebWorker which is origin of the Task is being terminated.")),"function"==typeof o.dispose&&o.dispose(),o[Or]===e&&(o[Or]=u),!br&&r&&r.dispose(),a++}}}n||(jr.clear(),Ur&&(Tr=new globalThis.FinalizationRegistry(Hr)));const l=(e,n)=>{const o=n[e],s=o&&"boolean"==typeof o[Dr]&&o[Dr];if(s||(n[e]=void 0),o)if(t&&We(`Proxy of JS ${typeof o} with JSHandle ${e} was still alive. ${s?"keeping":"disposing"}.`),s)r=!0;else{const t=lt.getPromiseController(o);t&&t.reject(new Error("WebWorker which is origin of the Task is being terminated.")),"function"==typeof o.dispose&&o.dispose(),o[Cr]===e&&(o[Cr]=void 0),i++}};for(let e=0;en.resolve(e))).catch((e=>n.reject(e))),t}const Yr=Symbol.for("wasm promise_holder");class Zr extends ManagedObject{constructor(e,t,n,r){super(),this.promise=e,this.gc_handle=t,this.promiseHolderPtr=n,this.res_converter=r,this.isResolved=!1,this.isPosted=!1,this.isPostponed=!1,this.data=null,this.reason=void 0}setIsResolving(){return!0}resolve(e){lt.is_runtime_running()?(this.isResolved&&mt(!1,"resolve could be called only once"),this.isDisposed&&mt(!1,"resolve is already disposed."),this.isResolved=!0,this.complete_task_wrapper(e,null)):lt.diagnosticTracing&&ze("This promise resolution can't be propagated to managed code, mono runtime already exited.")}reject(e){lt.is_runtime_running()?(e||(e=new Error),this.isResolved&&mt(!1,"reject could be called only once"),this.isDisposed&&mt(!1,"resolve is already disposed."),e[Yr],this.isResolved=!0,this.complete_task_wrapper(null,e)):lt.diagnosticTracing&&ze("This promise rejection can't be propagated to managed code, mono runtime already exited.")}cancel(){if(lt.is_runtime_running())if(this.isResolved&&mt(!1,"cancel could be called only once"),this.isDisposed&&mt(!1,"resolve is already disposed."),this.isPostponed)this.isResolved=!0,void 0!==this.reason?this.complete_task_wrapper(null,this.reason):this.complete_task_wrapper(this.data,null);else{const e=this.promise;lt.assertIsControllablePromise(e);const t=lt.getPromiseController(e),n=new Error("OperationCanceledException");n[Yr]=this,t.reject(n)}else lt.diagnosticTracing&&ze("This promise cancelation can't be propagated to managed code, mono runtime already exited.")}complete_task_wrapper(e,t){try{this.isPosted&&mt(!1,"Promise is already posted to managed."),this.isPosted=!0,Vr(this,this.gc_handle,!0),function(e,t,n,r){lt.assert_runtime_running();const o=Ke.stackSave();try{const o=$n(5),s=Ln(o,2);Wn(s,14),Kn(s,e);const a=Ln(o,3);if(t)wo(a,t);else{Wn(a,0);const e=Ln(o,4);r||mt(!1,"res_converter missing"),r(e,n)}wn(ct.ioThreadTID,yn.CompleteTask,o)}finally{lt.is_runtime_running()&&Ke.stackRestore(o)}}(this.gc_handle,t,e,this.res_converter||So)}catch(e){try{lt.mono_exit(1,e)}catch(e){}}}}const Kr="For more information see https://aka.ms/dotnet-wasm-jsinterop";function eo(e,t,n){if(0===t||1===t||2===t||26===t)return;let r,o,s,a;o=Vt(Cn(e)),s=Vt(Dn(e)),a=Vt(Fn(e));const i=On(e);r=to(i),19===t&&(t=i);const c=to(t),l=Cn(e),p=n*In;return(e,t)=>{c(e+p,t,l,r,o,s,a)}}function to(e){if(0===e||1===e)return;const t=Un.get(e);return t&&"function"==typeof t||mt(!1,`ERR30: Unknown converter for type ${e}`),t}function no(e,t){null==t?Wn(e,0):(Wn(e,3),qn(e,t))}function ro(e,t){null==t?Wn(e,0):(Wn(e,4),function(e,t){e||mt(!1,"Null arg"),w(e,t)}(e,t))}function oo(e,t){null==t?Wn(e,0):(Wn(e,5),function(e,t){e||mt(!1,"Null arg"),k(e,t)}(e,t))}function so(e,t){null==t?Wn(e,0):(Wn(e,6),function(e,t){e||mt(!1,"Null arg"),U(e,t)}(e,t))}function ao(e,t){null==t?Wn(e,0):(Wn(e,7),function(e,t){e||mt(!1,"Null arg"),T(e,t)}(e,t))}function io(e,t){null==t?Wn(e,0):(Wn(e,8),function(e,t){if(e||mt(!1,"Null arg"),!Number.isSafeInteger(t))throw new Error(`Assert failed: Value is not an integer: ${t} (${typeof t})`);$(e,t)}(e,t))}function co(e,t){null==t?Wn(e,0):(Wn(e,9),function(e,t){e||mt(!1,"Null arg"),A(e,t)}(e,t))}function lo(e,t){null==t?Wn(e,0):(Wn(e,10),Xn(e,t))}function po(e,t){null==t?Wn(e,0):(Wn(e,11),function(e,t){e||mt(!1,"Null arg"),j(e,t)}(e,t))}function uo(e,t){null==t?Wn(e,0):(Wn(e,12),Gn(e,t))}function fo(e,t){if(null==t)Wn(e,0);else{if(!(t instanceof Date))throw new Error("Assert failed: Value is not a Date");Wn(e,17),Jn(e,t)}}function _o(e,t){if(null==t)Wn(e,0);else{if(!(t instanceof Date))throw new Error("Assert failed: Value is not a Date");Wn(e,18),Jn(e,t)}}function mo(e,t){if(null==t)Wn(e,0);else{if(Wn(e,15),"string"!=typeof t)throw new Error("Assert failed: Value is not a String");ho(e,t)}}function ho(e,t){{const n=er(e);try{!function(e,t){if(t.clear(),null!==e)if("symbol"==typeof e)Ce(e,t);else{if("string"!=typeof e)throw new Error("Expected string argument, got "+typeof e);if(0===e.length)Ce(e,t);else{if(e.length<=256){const n=be.get(e);if(n)return void t.set(n)}De(e,t)}}}(t,n)}finally{n.release()}}}function go(e){Wn(e,0)}function bo(e,t,r,o,s,a,i){if(null==t)return void Wn(e,0);if(!(t&&t instanceof Function))throw new Error("Assert failed: Value is not a Function");const c=function(e){const r=Ln(e,0),l=Ln(e,1),p=Ln(e,2),u=Ln(e,3),d=Ln(e,4),f=ct.isPendingSynchronousCall;try{let e,r,f;n&&c.isDisposed,s&&(e=s(p)),a&&(r=a(u)),i&&(f=i(d)),ct.isPendingSynchronousCall=!0;const _=t(e,r,f);o&&o(l,_)}catch(e){wo(r,e)}finally{ct.isPendingSynchronousCall=f}};c[En]=!0,c.isDisposed=!1,c.dispose=()=>{c.isDisposed=!0},Yn(e,Pr(c)),Wn(e,25)}function yo(e,t,n,r){const o=30==zn(e);if(null==t)return void Wn(e,0);if(!Xr(t))throw new Error("Assert failed: Value is not a Promise");const s=o?Zn(e):$r.length?$r.pop():Lr--;o||(Kn(e,s),Wn(e,20));const a=new Zr(t,s,0,r);zr(a,s),t.then((e=>a.resolve(e)),(e=>a.reject(e)))}function wo(e,t){if(null==t)Wn(e,0);else if(t instanceof ManagedError)Wn(e,16),Kn(e,Wr(t));else{if("object"!=typeof t&&"string"!=typeof t)throw new Error("Assert failed: Value is not an Error "+typeof t);Wn(e,27),ho(e,t.toString());const n=t[Cr];Yn(e,n||Pr(t))}}function ko(e,t){if(null==t)Wn(e,0);else{if(void 0!==t[Or])throw new Error(`Assert failed: JSObject proxy of ManagedObject proxy is not supported. ${Kr}`);if("function"!=typeof t&&"object"!=typeof t)throw new Error(`Assert failed: JSObject proxy of ${typeof t} is not supported`);Wn(e,13),Yn(e,Pr(t))}}function So(e,t){if(null==t)Wn(e,0);else{const n=t[Or],r=typeof t;if(void 0===n)if("string"===r||"symbol"===r)Wn(e,15),ho(e,t);else if("number"===r)Wn(e,10),Xn(e,t);else{if("bigint"===r)throw new Error("NotImplementedException: bigint");if("boolean"===r)Wn(e,3),qn(e,t);else if(t instanceof Date)Wn(e,17),Jn(e,t);else if(t instanceof Error)wo(e,t);else if(t instanceof Uint8Array)Uo(e,t,4);else if(t instanceof Float64Array)Uo(e,t,10);else if(t instanceof Int32Array)Uo(e,t,7);else if(Array.isArray(t))Uo(e,t,14);else{if(t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array)throw new Error("NotImplementedException: TypedArray");if(Xr(t))yo(e,t);else{if(t instanceof Span)throw new Error("NotImplementedException: Span");if("object"!=r)throw new Error(`JSObject proxy is not supported for ${r} ${t}`);{const n=Pr(t);Wn(e,13),Yn(e,n)}}}}else{if(Wr(t),t instanceof ArraySegment)throw new Error("NotImplementedException: ArraySegment. "+Kr);if(t instanceof ManagedError)Wn(e,16),Kn(e,n);else{if(!(t instanceof ManagedObject))throw new Error("NotImplementedException "+r+". "+Kr);Wn(e,14),Kn(e,n)}}}}function vo(e,t,n){n||mt(!1,"Expected valid element_type parameter"),Uo(e,t,n)}function Uo(e,t,n){if(null==t)Wn(e,0);else{const r=rr(n);-1==r&&mt(!1,`Element type ${n} not supported`);const s=t.length,a=r*s,i=_(a);if(15==n){if(!Array.isArray(t))throw new Error("Assert failed: Value is not an Array");g(i,a),o.mono_wasm_register_root(i,a,"marshal_array_to_cs");for(let e=0;e{e&&"AbortError"!==e&&"AbortError"!==e.name&&ze("http muted: "+e)}))}function No(e){try{e.isAborted||(e.streamWriter&&(Bo(e.streamWriter.abort()),e.isAborted=!0),e.streamReader&&(Bo(e.streamReader.cancel()),e.isAborted=!0)),e.isAborted||e.abortController.signal.aborted||e.abortController.abort("AbortError")}catch(e){}}function Oo(e,t,n){n>0||mt(!1,"expected bufferLength > 0");const r=new Span(t,n,0).slice();return Qr((async()=>{e.streamWriter||mt(!1,"expected streamWriter"),e.responsePromise||mt(!1,"expected fetch promise");try{await e.streamWriter.ready,await e.streamWriter.write(r)}catch(e){throw new Error("BrowserHttpWriteStream.Rejected")}}))}function Co(e){return e||mt(!1,"expected controller"),Qr((async()=>{e.streamWriter||mt(!1,"expected streamWriter"),e.responsePromise||mt(!1,"expected fetch promise");try{await e.streamWriter.ready,await e.streamWriter.close()}catch(e){throw new Error("BrowserHttpWriteStream.Rejected")}}))}function Do(e,t,n,r,o,s){const a=new TransformStream;return e.streamWriter=a.writable.getWriter(),Bo(e.streamWriter.closed),Bo(e.streamWriter.ready),Po(e,t,n,r,o,s,a.readable)}function Fo(e,t,n,r,o,s,a,i){return Po(e,t,n,r,o,s,new Span(a,i,0).slice())}function Po(e,t,n,r,o,s,a){jo(),hr(),t&&"string"==typeof t||mt(!1,"expected url string"),n&&r&&Array.isArray(n)&&Array.isArray(r)&&n.length===r.length||mt(!1,"expected headerNames and headerValues arrays"),o&&s&&Array.isArray(o)&&Array.isArray(s)&&o.length===s.length||mt(!1,"expected headerNames and headerValues arrays");const i=new Headers;for(let e=0;elt.fetch_like(t,c).then((t=>(e.response=t,null))))),e.responsePromise.then((()=>{if(e.response||mt(!1,"expected response"),e.responseHeaderNames=[],e.responseHeaderValues=[],e.response.headers&&e.response.headers.entries){const t=e.response.headers.entries();for(const n of t)e.responseHeaderNames.push(n[0]),e.responseHeaderValues.push(n[1])}})).catch((()=>{})),e.responsePromise}function Mo(e){var t;return null===(t=e.response)||void 0===t?void 0:t.type}function zo(e){var t,n;return null!==(n=null===(t=e.response)||void 0===t?void 0:t.status)&&void 0!==n?n:0}function Vo(e){return e.responseHeaderNames||mt(!1,"expected responseHeaderNames"),e.responseHeaderNames}function Wo(e){return e.responseHeaderValues||mt(!1,"expected responseHeaderValues"),e.responseHeaderValues}function Ho(e){return Qr((async()=>{const t=await e.response.arrayBuffer();return e.responseBuffer=t,e.currentBufferOffset=0,t.byteLength}))}function qo(e,t){if(e||mt(!1,"expected controller"),e.responseBuffer||mt(!1,"expected resoved arrayBuffer"),null==e.currentBufferOffset&&mt(!1,"expected currentBufferOffset"),e.currentBufferOffset==e.responseBuffer.byteLength)return 0;const n=new Uint8Array(e.responseBuffer,e.currentBufferOffset);t.set(n,0);const r=Math.min(t.byteLength,n.byteLength);return e.currentBufferOffset+=r,r}function Go(e,t,n){const r=new Span(t,n,0);return Qr((async()=>{if(await e.responsePromise,e.response||mt(!1,"expected response"),!e.response.body)return 0;if(e.streamReader||(e.streamReader=e.response.body.getReader(),Bo(e.streamReader.closed)),e.currentStreamReaderChunk&&void 0!==e.currentBufferOffset||(e.currentStreamReaderChunk=await e.streamReader.read(),e.currentBufferOffset=0),e.currentStreamReaderChunk.done){if(e.isAborted)throw new Error("OperationCanceledException");return 0}const t=e.currentStreamReaderChunk.value.byteLength-e.currentBufferOffset;t>0||mt(!1,"expected remaining_source to be greater than 0");const n=Math.min(t,r.byteLength),o=e.currentStreamReaderChunk.value.subarray(e.currentBufferOffset,e.currentBufferOffset+n);return r.set(o,0),e.currentBufferOffset+=n,t==n&&(e.currentStreamReaderChunk=void 0),n}))}let Jo,Xo,Qo=0;function Yo(){if(!lt.isChromium)return;const e=(new Date).valueOf(),t=e+36e4;for(let n=Math.max(e+1e3,Qo);n=this.queue.length&&(this.queue=this.queue.slice(this.offset),this.offset=0),e}peek(){return this.queue.length>0?this.queue[this.offset]:void 0}drain(e){for(;this.getLength();)e(this.dequeue())}}const ts=Symbol.for("wasm ws_pending_send_buffer"),ns=Symbol.for("wasm ws_pending_send_buffer_offset"),rs=Symbol.for("wasm ws_pending_send_buffer_type"),os=Symbol.for("wasm ws_pending_receive_event_queue"),ss=Symbol.for("wasm ws_pending_receive_promise_queue"),as=Symbol.for("wasm ws_pending_open_promise"),is=Symbol.for("wasm wasm_ws_pending_open_promise_used"),cs=Symbol.for("wasm wasm_ws_pending_error"),ls=Symbol.for("wasm ws_pending_close_promises"),ps=Symbol.for("wasm ws_pending_send_promises"),us=Symbol.for("wasm ws_is_aborted"),ds=Symbol.for("wasm wasm_ws_close_sent"),fs=Symbol.for("wasm wasm_ws_close_received"),_s=Symbol.for("wasm ws_receive_status_ptr"),ms=65536,hs=new Uint8Array;function gs(e){var t,n;return e.readyState!=WebSocket.CLOSED?null!==(t=e.readyState)&&void 0!==t?t:-1:0==e[os].getLength()?null!==(n=e.readyState)&&void 0!==n?n:-1:e[ds]?WebSocket.CLOSING:WebSocket.OPEN}function bs(e,t,n){let r;!function(){if(at)throw new Error("WebSockets are not supported in shell JS engine.");if("function"!=typeof globalThis.WebSocket)throw new Error(tt?"Please install `ws` npm package to enable networking support. See also https://aka.ms/dotnet-wasm-features":"This browser doesn't support WebSocket API. Please use a modern browser. See also https://aka.ms/dotnet-wasm-features")}(),hr(),e&&"string"==typeof e||mt(!1,"ERR12: Invalid uri "+typeof e);try{r=new globalThis.WebSocket(e,t||void 0)}catch(e){throw We("WebSocket error in ws_wasm_create: "+e.toString()),e}const{promise_control:o}=_t();r[os]=new es,r[ss]=new es,r[as]=o,r[ps]=[],r[ls]=[],r[_s]=n,r.binaryType="arraybuffer";const s=()=>{try{if(r[us])return;if(!lt.is_runtime_running())return;o.resolve(r),Yo()}catch(e){We("failed to propagate WebSocket open event: "+e.toString())}},a=e=>{try{if(r[us])return;if(!lt.is_runtime_running())return;!function(e,t){const n=e[os],r=e[ss];if("string"==typeof t.data)n.enqueue({type:0,data:je(t.data),offset:0});else{if("ArrayBuffer"!==t.data.constructor.name)throw new Error("ERR19: WebSocket receive expected ArrayBuffer");n.enqueue({type:1,data:new Uint8Array(t.data),offset:0})}if(r.getLength()&&n.getLength()>1)throw new Error("ERR21: Invalid WS state");for(;r.getLength()&&n.getLength();){const t=r.dequeue();Ts(e,n,t.buffer_ptr,t.buffer_length),t.resolve()}Yo()}(r,e),Yo()}catch(e){We("failed to propagate WebSocket message event: "+e.toString())}},i=e=>{try{if(r.removeEventListener("message",a),r[us])return;if(!lt.is_runtime_running())return;r[fs]=!0,r.close_status=e.code,r.close_status_description=e.reason,r[is]&&o.reject(new Error(e.reason));for(const e of r[ls])e.resolve();Ke.safeSetTimeout((()=>{r[ss].drain((e=>{T(n,0),T(n+4,2),T(n+8,1),e.resolve()}))}),0)}catch(e){We("failed to propagate WebSocket close event: "+e.toString())}},c=e=>{try{if(r[us])return;if(!lt.is_runtime_running())return;r.removeEventListener("message",a);const t=e.message?"WebSocket error: "+e.message:"WebSocket error";We(t),r[cs]=t,Us(r,new Error(t))}catch(e){We("failed to propagate WebSocket error event: "+e.toString())}};return r.addEventListener("message",a),r.addEventListener("open",s,{once:!0}),r.addEventListener("close",i,{once:!0}),r.addEventListener("error",c,{once:!0}),r.dispose=()=>{r.removeEventListener("message",a),r.removeEventListener("open",s),r.removeEventListener("close",i),r.removeEventListener("error",c),vs(r)},r}function ys(e){if(e||mt(!1,"ERR17: expected ws instance"),e[cs])return Es(e[cs]);const t=e[as];return e[is]=!0,t.promise}function ws(e,t,n,r,o){if(e||mt(!1,"ERR17: expected ws instance"),e[cs])return Es(e[cs]);if(e[us]||e[ds])return Es("InvalidState: The WebSocket is not connected.");if(e.readyState==WebSocket.CLOSED)return null;const s=function(e,t,n,r){let o=e[ts],s=0;const a=t.byteLength;if(o){if(s=e[ns],n=e[rs],0!==a){if(s+a>o.length){const n=new Uint8Array(1.5*(s+a+50));n.set(o,0),n.subarray(s).set(t),e[ts]=o=n}else o.subarray(s).set(t);s+=a,e[ns]=s}}else r?0!==a&&(o=t,s=a):(0!==a&&(o=t.slice(),s=a,e[ns]=s,e[ts]=o),e[rs]=n);return r?0==s||null==o?hs:0===n?function(e){return void 0===ve?Ke.UTF8ArrayToString(e,0,e.byteLength):ve.decode(e)}(Fe(o,0,s)):o.subarray(0,s):null}(e,new Uint8Array(K().buffer,t,n),r,o);return o&&s?function(e,t){if(e.send(t),e[ts]=null,e.bufferedAmount{try{if(0===e.bufferedAmount)r.resolve();else{const t=e.readyState;if(t!=WebSocket.OPEN&&t!=WebSocket.CLOSING)r.reject(new Error(`InvalidState: ${t} The WebSocket is not connected.`));else if(!r.isDone)return globalThis.setTimeout(a,s),void(s=Math.min(1.5*s,1e3))}const t=o.indexOf(r);t>-1&&o.splice(t,1)}catch(e){We("WebSocket error in web_socket_send_and_wait: "+e.toString()),r.reject(e)}};return globalThis.setTimeout(a,0),n}(e,s):null}function ks(e,t,n){if(e||mt(!1,"ERR18: expected ws instance"),e[cs])return Es(e[cs]);if(e[us]){const t=e[_s];return T(t,0),T(t+4,2),T(t+8,1),null}const r=e[os],o=e[ss];if(r.getLength())return 0!=o.getLength()&&mt(!1,"ERR20: Invalid WS state"),Ts(e,r,t,n),null;if(e[fs]){const t=e[_s];return T(t,0),T(t+4,2),T(t+8,1),null}const{promise:s,promise_control:a}=_t(),i=a;return i.buffer_ptr=t,i.buffer_length=n,o.enqueue(i),s}function Ss(e,t,n,r){if(e||mt(!1,"ERR19: expected ws instance"),e[us]||e[ds]||e.readyState==WebSocket.CLOSED)return null;if(e[cs])return Es(e[cs]);if(e[ds]=!0,r){const{promise:r,promise_control:o}=_t();return e[ls].push(o),"string"==typeof n?e.close(t,n):e.close(t),r}return"string"==typeof n?e.close(t,n):e.close(t),null}function vs(e){if(e||mt(!1,"ERR18: expected ws instance"),!e[us]&&!e[ds]){e[us]=!0,Us(e,new Error("OperationCanceledException"));try{e.close(1e3,"Connection was aborted.")}catch(e){We("WebSocket error in ws_wasm_abort: "+e.toString())}}}function Us(e,t){const n=e[as],r=e[is];n&&r&&n.reject(t);for(const n of e[ls])n.reject(t);for(const n of e[ps])n.reject(t);e[ss].drain((e=>{e.reject(t)}))}function Ts(e,t,n,r){const o=t.peek(),s=Math.min(r,o.data.length-o.offset);if(s>0){const e=o.data.subarray(o.offset,o.offset+s);new Uint8Array(K().buffer,n,r).set(e,0),o.offset+=s}const a=o.data.length===o.offset?1:0;a&&t.dequeue();const i=e[_s];T(i,s),T(i+4,o.type),T(i+8,a)}function Es(e){return function(e){const{promise:t,promise_control:n}=_t();return e.then((e=>n.resolve(e))).catch((e=>n.reject(e))),t}(Promise.reject(new Error(e)))}function xs(e,t,n){lt.diagnosticTracing&&ze(`Loaded:${e.name} as ${e.behavior} size ${n.length} from ${t}`);const r=Ft(),s="string"==typeof e.virtualPath?e.virtualPath:e.name;let a=null;switch(e.behavior){case"dotnetwasm":case"js-module-threads":case"js-module-diagnostics":case"symbols":break;case"resource":case"assembly":case"pdb":lt._loaded_files.push({url:t,file:s});case"heap":case"icu":a=function(e){const t=e.length+16;let n=Ke._sbrk(t);if(n<=0){if(n=Ke._sbrk(t),n<=0)throw He(`sbrk failed to allocate ${t} bytes, and failed upon retry.`),new Error("Out of memory");We(`sbrk failed to allocate ${t} bytes, but succeeded upon retry!`)}return new Uint8Array(K().buffer,n,e.length).set(e),n}(n);break;case"vfs":{const e=s.lastIndexOf("/");let t=e>0?s.substring(0,e):null,r=e>0?s.substring(e+1):s;r.startsWith("/")&&(r=r.substring(1)),t?(t.startsWith("/")||(t="/"+t),ze(`Creating directory '${t}'`),Ke.FS_createPath("/",t,!0,!0)):t="/",lt.diagnosticTracing&&ze(`Creating file '${r}' in directory '${t}'`),Ke.FS_createDataFile(t,r,n,!0,!0,!0);break}default:throw new Error(`Unrecognized asset behavior:${e.behavior}, for asset ${e.name}`)}if("assembly"===e.behavior){if(!o.mono_wasm_add_assembly(s,a,n.length)){const e=lt._loaded_files.findIndex((e=>e.file==s));lt._loaded_files.splice(e,1)}}else"pdb"===e.behavior?o.mono_wasm_add_assembly(s,a,n.length):"icu"===e.behavior?function(e){if(!o.mono_wasm_load_icu_data(e))throw new Error("Failed to load ICU data")}(a):"resource"===e.behavior&&o.mono_wasm_add_satellite_assembly(s,e.culture||"",a,n.length);Pt(r,"mono.instantiateAsset:",e.name),++lt.actual_instantiated_assets_count}async function Is(e){try{const n=await e.pendingDownloadInternal.response;t=await n.text(),Ge&&mt(!1,"Another symbol map was already loaded"),Ge=t,lt.diagnosticTracing&&ze(`Deferred loading of ${t.length}ch symbol map`)}catch(t){Ve(`Error loading symbol file ${e.name}: ${JSON.stringify(t)}`)}var t}function As(){return lt.loadedFiles}const js={};function $s(e){let t=js[e];if("string"!=typeof t){const n=o.mono_jiterp_get_opcode_info(e,0);js[e]=t=Le(n)}return t}const Ls=2,Rs=64,Bs=64,Ns=-2147483648,Os={};class Cs{constructor(e){this.locals=new Map,this.permanentFunctionTypeCount=0,this.permanentFunctionTypes={},this.permanentFunctionTypesByShape={},this.permanentFunctionTypesByIndex={},this.functionTypesByIndex={},this.permanentImportedFunctionCount=0,this.permanentImportedFunctions={},this.nextImportIndex=0,this.functions=[],this.estimatedExportBytes=0,this.frame=0,this.traceBuf=[],this.branchTargets=new Set,this.constantSlots=[],this.backBranchOffsets=[],this.callHandlerReturnAddresses=[],this.nextConstantSlot=0,this.backBranchTraceLevel=0,this.compressImportNames=!1,this.lockImports=!1,this._assignParameterIndices=e=>{let t=0;for(const n in e)this.locals.set(n,t),t++;return t},this.stack=[new Ds],this.clear(e),this.cfg=new Fs(this),this.defineType("__cpp_exception",{ptr:127},64,!0)}clear(e){if(this.options=fa(),this.options.maxModuleSize>=24576)throw new Error(`blobBuilderCapacity 24576 is not large enough for jiterpreter-max-module-size of ${this.options.maxModuleSize}`);this.stackSize=1,this.inSection=!1,this.inFunction=!1,this.lockImports=!1,this.locals.clear(),this.functionTypeCount=this.permanentFunctionTypeCount,this.functionTypes=Object.create(this.permanentFunctionTypes),this.functionTypesByShape=Object.create(this.permanentFunctionTypesByShape),this.functionTypesByIndex=Object.create(this.permanentFunctionTypesByIndex),this.nextImportIndex=0,this.importedFunctionCount=0,this.importedFunctions=Object.create(this.permanentImportedFunctions);for(const e in this.importedFunctions)this.importedFunctions[e].index=void 0;this.functions.length=0,this.estimatedExportBytes=0,this.argumentCount=0,this.current.clear(),this.traceBuf.length=0,this.branchTargets.clear(),this.activeBlocks=0,this.nextConstantSlot=0,this.constantSlots.length=this.options.useConstants?e:0;for(let e=0;e=this.stack.length&&this.stack.push(new Ds),this.current.clear()}_pop(e){if(this.stackSize<=1)throw new Error("Stack empty");const t=this.current;return this.stackSize--,e?(this.appendULeb(t.size),t.copyTo(this.current),null):t.getArrayView(!1).slice(0,t.size)}setImportFunction(e,t){const n=this.importedFunctions[e];if(!n)throw new Error("No import named "+e);n.func=t}getExceptionTag(){const e=Ke.wasmExports.__cpp_exception;return void 0!==e&&(e instanceof WebAssembly.Tag||mt(!1,`expected __cpp_exception export from dotnet.wasm to be WebAssembly.Tag but was ${e}`)),e}getWasmImports(){const e=ct.getMemory();e instanceof WebAssembly.Memory||mt(!1,`expected heap import to be WebAssembly.Memory but was ${e}`);const t=this.getExceptionTag(),n={c:this.getConstants(),m:{h:e}};t&&(n.x={e:t});const r=this.getImportsToEmit();for(let e=0;e>>0||e>255)throw new Error(`Byte out of range: ${e}`);return this.current.appendU8(e)}appendSimd(e,t){return this.current.appendU8(253),0|e||0===e&&!0===t||mt(!1,"Expected non-v128_load simd opcode or allowLoad==true"),this.current.appendULeb(e)}appendAtomic(e,t){return this.current.appendU8(254),0|e||0===e&&!0===t||mt(!1,"Expected non-notify atomic opcode or allowNotify==true"),this.current.appendU8(e)}appendU32(e){return this.current.appendU32(e)}appendF32(e){return this.current.appendF32(e)}appendF64(e){return this.current.appendF64(e)}appendBoundaryValue(e,t){return this.current.appendBoundaryValue(e,t)}appendULeb(e){return this.current.appendULeb(e)}appendLeb(e){return this.current.appendLeb(e)}appendLebRef(e,t){return this.current.appendLebRef(e,t)}appendBytes(e){return this.current.appendBytes(e)}appendName(e){return this.current.appendName(e)}ret(e){this.ip_const(e),this.appendU8(15)}i32_const(e){this.appendU8(65),this.appendLeb(e)}ptr_const(e){let t=this.options.useConstants?this.constantSlots.indexOf(e):-1;this.options.useConstants&&t<0&&this.nextConstantSlot=0?(this.appendU8(35),this.appendLeb(t)):this.i32_const(e)}ip_const(e){this.appendU8(65),this.appendLeb(e-this.base)}i52_const(e){this.appendU8(66),this.appendLeb(e)}v128_const(e){if(0===e)this.local("v128_zero");else{if("object"!=typeof e)throw new Error("Expected v128_const arg to be 0 or a Uint8Array");{16!==e.byteLength&&mt(!1,"Expected v128_const arg to be 16 bytes in size");let t=!0;for(let n=0;n<16;n++)0!==e[n]&&(t=!1);t?this.local("v128_zero"):(this.appendSimd(12),this.appendBytes(e))}}}defineType(e,t,n,r){if(this.functionTypes[e])throw new Error(`Function type ${e} already defined`);if(r&&this.functionTypeCount>this.permanentFunctionTypeCount)throw new Error("New permanent function types cannot be defined after non-permanent ones");let o="";for(const e in t)o+=t[e]+",";o+=n;let s=this.functionTypesByShape[o];"number"!=typeof s&&(s=this.functionTypeCount++,r?(this.permanentFunctionTypeCount++,this.permanentFunctionTypesByShape[o]=s,this.permanentFunctionTypesByIndex[s]=[t,Object.values(t).length,n]):(this.functionTypesByShape[o]=s,this.functionTypesByIndex[s]=[t,Object.values(t).length,n]));const a=[s,t,n,`(${JSON.stringify(t)}) -> ${n}`,r];return r?this.permanentFunctionTypes[e]=a:this.functionTypes[e]=a,s}generateTypeSection(){this.beginSection(1),this.appendULeb(this.functionTypeCount);for(let e=0;ee.index-t.index)),e}_generateImportSection(e){const t=this.getImportsToEmit();if(this.lockImports=!0,!1!==e)throw new Error("function table imports are disabled");const n=void 0!==this.getExceptionTag();this.beginSection(2),this.appendULeb(1+(n?1:0)+t.length+this.constantSlots.length+(!1!==e?1:0));for(let e=0;e0)throw new Error("New permanent imports cannot be defined after any indexes have been assigned");const s=this.functionTypes[n];if(!s)throw new Error("No function type named "+n);if(r&&!s[4])throw new Error("A permanent import must have a permanent function type");const a=s[0],i=r?this.permanentImportedFunctions:this.importedFunctions;if("number"==typeof o&&(o=qs().get(o)),"function"!=typeof o&&void 0!==o)throw new Error(`Value passed for imported function ${t} was not a function or valid function pointer or undefined`);return i[t]={index:void 0,typeIndex:a,module:e,name:t,func:o}}markImportAsUsed(e){const t=this.importedFunctions[e];if(!t)throw new Error("No imported function named "+e);"number"!=typeof t.index&&(t.index=this.importedFunctionCount++)}getTypeIndex(e){const t=this.functionTypes[e];if(!t)throw new Error("No type named "+e);return t[0]}defineFunction(e,t){const n={index:this.functions.length,name:e.name,typeName:e.type,typeIndex:this.getTypeIndex(e.type),export:e.export,locals:e.locals,generator:t,error:null,blob:null};return this.functions.push(n),n.export&&(this.estimatedExportBytes+=n.name.length+8),n}emitImportsAndFunctions(e){let t=0;for(let e=0;e0)throw new Error(`${this.activeBlocks} unclosed block(s) at end of function`);const t=this._pop(e);return this.inFunction=!1,t}block(e,t){const n=this.appendU8(t||2);return e?this.appendU8(e):this.appendU8(64),this.activeBlocks++,n}endBlock(){if(this.activeBlocks<=0)throw new Error("No blocks active");this.activeBlocks--,this.appendU8(11)}arg(e,t){const n="string"==typeof e?this.locals.has(e)?this.locals.get(e):void 0:e;if("number"!=typeof n)throw new Error("No local named "+e);t&&this.appendU8(t),this.appendULeb(n)}local(e,t){const n="string"==typeof e?this.locals.has(e)?this.locals.get(e):void 0:e+this.argumentCount;if("number"!=typeof n)throw new Error("No local named "+e);t?this.appendU8(t):this.appendU8(32),this.appendULeb(n)}appendMemarg(e,t){this.appendULeb(t),this.appendULeb(e)}lea(e,t){"string"==typeof e?this.local(e):this.i32_const(e),this.i32_const(t),this.appendU8(106)}getArrayView(e,t){if(!0!==t&&this.stackSize>1)throw new Error("Jiterpreter block stack not empty");return this.stack[0].getArrayView(e)}getConstants(){const e={};for(let t=0;t=this.capacity)throw new Error("Buffer full");const t=this.size;return K()[this.buffer+this.size++]=e,t}appendU32(e){const t=this.size;return o.mono_jiterp_write_number_unaligned(this.buffer+this.size,e,0),this.size+=4,t}appendI32(e){const t=this.size;return o.mono_jiterp_write_number_unaligned(this.buffer+this.size,e,1),this.size+=4,t}appendF32(e){const t=this.size;return o.mono_jiterp_write_number_unaligned(this.buffer+this.size,e,2),this.size+=4,t}appendF64(e){const t=this.size;return o.mono_jiterp_write_number_unaligned(this.buffer+this.size,e,3),this.size+=8,t}appendBoundaryValue(e,t){if(this.size+8>=this.capacity)throw new Error("Buffer full");const n=o.mono_jiterp_encode_leb_signed_boundary(this.buffer+this.size,e,t);if(n<1)throw new Error(`Failed to encode ${e} bit boundary value with sign ${t}`);return this.size+=n,n}appendULeb(e){if("number"!=typeof e&&mt(!1,`appendULeb expected number but got ${e}`),e>=0||mt(!1,"cannot pass negative value to appendULeb"),e<127){if(this.size+1>=this.capacity)throw new Error("Buffer full");return this.appendU8(e),1}if(this.size+8>=this.capacity)throw new Error("Buffer full");const t=o.mono_jiterp_encode_leb52(this.buffer+this.size,e,0);if(t<1)throw new Error(`Failed to encode value '${e}' as unsigned leb`);return this.size+=t,t}appendLeb(e){if("number"!=typeof e&&mt(!1,`appendLeb expected number but got ${e}`),this.size+8>=this.capacity)throw new Error("Buffer full");const t=o.mono_jiterp_encode_leb52(this.buffer+this.size,e,1);if(t<1)throw new Error(`Failed to encode value '${e}' as signed leb`);return this.size+=t,t}appendLebRef(e,t){if(this.size+8>=this.capacity)throw new Error("Buffer full");const n=o.mono_jiterp_encode_leb64_ref(this.buffer+this.size,e,t?1:0);if(n<1)throw new Error("Failed to encode value as leb");return this.size+=n,n}copyTo(e,t){if("number"!=typeof t&&(t=this.size),e.size+t>=e.capacity)throw new Error("Destination buffer full");K().copyWithin(e.buffer+e.size,this.buffer,this.buffer+t),e.size+=t}appendBytes(e,t){const n=this.size,r=K(),o="number"!=typeof t?e.length:t;if(this.size+o>=this.capacity)throw new Error("Buffer full");return e.buffer===r.buffer?(r.copyWithin(this.buffer+n,e.byteOffset,e.byteOffset+o),this.size+=o):("number"==typeof t&&(e=new Uint8Array(e.buffer,e.byteOffset,t)),this.getArrayView(!0).set(e,this.size),this.size+=e.length),n}appendName(e){let t=e.length,n=1===e.length?e.charCodeAt(0):-1;if(n>127&&(n=-1),t&&n<0)if(this.encoder)t=this.encoder.encodeInto(e,this.textBuf).written||0;else for(let n=0;n127)throw new Error("Out of range character and no TextEncoder available");this.textBuf[n]=t}this.appendULeb(t),n>=0?this.appendU8(n):t>1&&this.appendBytes(this.textBuf,t)}getArrayView(e){return new Uint8Array(K().buffer,this.buffer,e?this.capacity:this.size)}}class Fs{constructor(e){this.segments=[],this.backBranchTargets=null,this.lastSegmentEnd=0,this.overheadBytes=0,this.blockStack=[],this.backDispatchOffsets=[],this.dispatchTable=new Map,this.observedBackBranchTargets=new Set,this.trace=0,this.builder=e}initialize(e,t,n){this.segments.length=0,this.blockStack.length=0,this.startOfBody=e,this.backBranchTargets=t,this.base=this.builder.base,this.ip=this.lastSegmentStartIp=this.firstOpcodeIp=this.builder.base,this.lastSegmentEnd=0,this.overheadBytes=10,this.dispatchTable.clear(),this.observedBackBranchTargets.clear(),this.trace=n,this.backDispatchOffsets.length=0}entry(e){this.entryIp=e;const t=o.mono_jiterp_get_opcode_info(676,1);return this.firstOpcodeIp=e+2*t,this.appendBlob(),1!==this.segments.length&&mt(!1,"expected 1 segment"),"blob"!==this.segments[0].type&&mt(!1,"expected blob"),this.entryBlob=this.segments[0],this.segments.length=0,this.overheadBytes+=9,this.backBranchTargets&&(this.overheadBytes+=20,this.overheadBytes+=this.backBranchTargets.length),this.firstOpcodeIp}appendBlob(){this.builder.current.size!==this.lastSegmentEnd&&(this.segments.push({type:"blob",ip:this.lastSegmentStartIp,start:this.lastSegmentEnd,length:this.builder.current.size-this.lastSegmentEnd}),this.lastSegmentStartIp=this.ip,this.lastSegmentEnd=this.builder.current.size,this.overheadBytes+=2)}startBranchBlock(e,t){this.appendBlob(),this.segments.push({type:"branch-block-header",ip:e,isBackBranchTarget:t}),this.overheadBytes+=1}branch(e,t,n){t&&this.observedBackBranchTargets.add(e),this.appendBlob(),this.segments.push({type:"branch",from:this.ip,target:e,isBackward:t,branchType:n}),this.overheadBytes+=4,t&&(this.overheadBytes+=4)}jumpTable(e,t){this.appendBlob(),this.segments.push({type:"jump-table",from:this.ip,targets:e,fallthrough:t}),this.overheadBytes+=4,this.overheadBytes+=e.length,this.overheadBytes+=24}emitBlob(e,t){const n=t.subarray(e.start,e.start+e.length);this.builder.appendBytes(n)}generate(){this.appendBlob();const e=this.builder.endFunction(!1);this.builder._push(),this.builder.base=this.base,this.emitBlob(this.entryBlob,e),this.backBranchTargets&&this.builder.block(64,3);for(let e=0;ee-t));for(let e=0;e0&&Ve("No back branch targets were reachable after filtering");else if(1===this.backDispatchOffsets.length)this.trace>0&&(this.backDispatchOffsets[0]===this.entryIp?Ve(`Exactly one back dispatch offset and it was the entry point 0x${this.entryIp.toString(16)}`):Ve(`Exactly one back dispatch offset and it was 0x${this.backDispatchOffsets[0].toString(16)}`)),this.builder.local("disp"),this.builder.appendU8(13),this.builder.appendULeb(this.blockStack.indexOf(this.backDispatchOffsets[0]));else{this.trace>0&&Ve(`${this.backDispatchOffsets.length} back branch offsets after filtering.`),this.builder.block(64),this.builder.block(64),this.builder.local("disp"),this.builder.appendU8(14),this.builder.appendULeb(this.backDispatchOffsets.length+1),this.builder.appendULeb(1);for(let e=0;e0&&this.blockStack.push(0)}this.trace>1&&Ve(`blockStack=${this.blockStack}`);for(let t=0;t=0?(da(13,1),this.builder.appendULeb(n+e)):(da(14,1),this.trace>0&&Ve(`Switch target ${t} not found in block stack ${this.blockStack}`),this.builder.appendULeb(0))}const t=this.blockStack.indexOf(n.fallthrough);t>=0?(da(13,1),this.builder.appendULeb(t+e)):(da(14,1),this.trace>0&&Ve(`Switch fallthrough ${n.fallthrough} not found in block stack ${this.blockStack}`),this.builder.appendULeb(0)),this.builder.appendU8(0);break}case"branch":{const e=n.isBackward?0:n.target;let t,r=this.blockStack.indexOf(e),o=!1;if(n.isBackward&&(this.dispatchTable.has(n.target)?(t=this.dispatchTable.get(n.target),this.trace>1&&Ve(`backward br from ${n.from.toString(16)} to ${n.target.toString(16)}: disp=${t}`),o=!0):(this.trace>0&&Ve(`br from ${n.from.toString(16)} to ${n.target.toString(16)} failed: back branch target not in dispatch table`),r=-1)),r>=0||o){let e=0;switch(n.branchType){case 2:this.builder,n.from,void 0!==t&&(this.builder.i32_const(t),this.builder.local("disp",33)),this.builder.appendU8(12);break;case 3:this.builder.block(64,4),this.builder,n.from,void 0!==t&&(this.builder.i32_const(t),this.builder.local("disp",33)),this.builder.appendU8(12),e=1;break;case 0:void 0!==t&&(this.builder.i32_const(t),this.builder.local("disp",33)),this.builder.appendU8(12);break;case 1:void 0!==t?(this.builder.block(64,4),this.builder.i32_const(t),this.builder.local("disp",33),e=1,this.builder.appendU8(12)):this.builder.appendU8(13);break;default:throw new Error("Unimplemented branch type")}this.builder.appendULeb(e+r),e&&this.builder.endBlock(),this.trace>1&&Ve(`br from ${n.from.toString(16)} to ${n.target.toString(16)} breaking out ${e+r+1} level(s)`)}else{if(this.trace>0){const e=this.base;n.target>=e&&n.target1&&Ve(`br from ${n.from.toString(16)} to ${n.target.toString(16)} failed (outside of trace 0x${e.toString(16)} - 0x${this.exitIp.toString(16)})`)}const e=1===n.branchType||3===n.branchType;e&&this.builder.block(64,4),Ws(this.builder,n.target,4),e&&this.builder.endBlock()}break}default:throw new Error("unreachable")}}return this.backBranchTargets&&(this.blockStack.length<=1||mt(!1,"expected one or zero entries in the block stack at the end"),this.blockStack.length&&this.blockStack.shift(),this.builder.endBlock()),0!==this.blockStack.length&&mt(!1,`expected block stack to be empty at end of function but it was ${this.blockStack}`),this.builder.ip_const(this.exitIp),this.builder.appendU8(15),this.builder.appendU8(11),this.builder._pop(!1)}}let Ps;const Ms={},zs=globalThis.performance&&globalThis.performance.now?globalThis.performance.now.bind(globalThis.performance):Date.now;function Vs(e,t,n){let r;switch(n){case 633:r="prof_enter";break;case 634:r="prof_samplepoint";break;case 635:case 636:r="prof_leave";break;default:throw new Error(`Unimplemented profiler event ${n}`)}e.local("frame"),e.i32_const(t),e.callImport(r)}function Ws(e,t,n){e.ip_const(t),e.options.countBailouts&&(e.i32_const(e.traceIndex),e.i32_const(n),e.callImport("bailout")),e.appendU8(15)}function Hs(e,t,n,r){e.local("cinfo"),e.block(64,4),e.local("cinfo"),e.local("disp"),e.appendU8(54),e.appendMemarg(ea(19),0),n<=e.options.monitoringLongDistance+2&&(e.local("cinfo"),e.i32_const(n),e.appendU8(54),e.appendMemarg(ea(20),0)),e.endBlock(),e.ip_const(t),e.options.countBailouts&&(e.i32_const(e.traceIndex),e.i32_const(r),e.callImport("bailout")),e.appendU8(15)}function qs(){if(Ps||(Ps=ct.getWasmIndirectFunctionTable()),!Ps)throw new Error("Module did not export the indirect function table");return Ps}function Gs(e,t){t||mt(!1,"Attempting to set null function into table");const n=o.mono_jiterp_allocate_table_entry(e);return n>0&&qs().set(n,t),n}function Js(e,t,n,r,o){if(r<=0)return o&&e.appendU8(26),!0;if(r>=Rs)return!1;const s=o?"memop_dest":"pLocals";o&&e.local(s,33);let a=o?0:t;if(e.options.enableSimd){const t=16;for(;r>=t;)e.local(s),e.v128_const(0),e.appendSimd(11),e.appendMemarg(a,0),a+=t,r-=t}for(;r>=8;)e.local(s),e.i52_const(0),e.appendU8(55),e.appendMemarg(a,0),a+=8,r-=8;for(;r>=1;){e.local(s),e.i32_const(0);let t=r%4;switch(t){case 0:t=4,e.appendU8(54);break;case 1:e.appendU8(58);break;case 3:case 2:t=2,e.appendU8(59)}e.appendMemarg(a,0),a+=t,r-=t}return!0}function Xs(e,t,n){Js(e,0,0,n,!0)||(e.i32_const(t),e.i32_const(n),e.appendU8(252),e.appendU8(11),e.appendU8(0))}function Qs(e,t,n,r,o,s,a){if(r<=0)return o&&(e.appendU8(26),e.appendU8(26)),!0;if(r>=Bs)return!1;o?(s=s||"memop_dest",a=a||"memop_src",e.local(a,33),e.local(s,33)):s&&a||(s=a="pLocals");let i=o?0:t,c=o?0:n;if(e.options.enableSimd){const t=16;for(;r>=t;)e.local(s),e.local(a),e.appendSimd(0,!0),e.appendMemarg(c,0),e.appendSimd(11),e.appendMemarg(i,0),i+=t,c+=t,r-=t}for(;r>=8;)e.local(s),e.local(a),e.appendU8(41),e.appendMemarg(c,0),e.appendU8(55),e.appendMemarg(i,0),i+=8,c+=8,r-=8;for(;r>=1;){let t,n,o=r%4;switch(o){case 0:o=4,t=40,n=54;break;default:case 1:o=1,t=44,n=58;break;case 3:case 2:o=2,t=46,n=59}e.local(s),e.local(a),e.appendU8(t),e.appendMemarg(c,0),e.appendU8(n),e.appendMemarg(i,0),c+=o,i+=o,r-=o}return!0}function Ys(e,t){return Qs(e,0,0,t,!0)||(e.i32_const(t),e.appendU8(252),e.appendU8(10),e.appendU8(0),e.appendU8(0)),!0}function Zs(){const e=da(5,1);e>=Ls&&(Ve(`Disabling jiterpreter after ${e} failures`),pa({enableTraces:!1,enableInterpEntry:!1,enableJitCall:!1}))}const Ks={};function ea(e){const t=Ks[e];return void 0===t?Ks[e]=o.mono_jiterp_get_member_offset(e):t}function ta(e){const t=Ke.wasmExports[e];if("function"!=typeof t)throw new Error(`raw cwrap ${e} not found`);return t}const na={};function ra(e){let t=na[e];return"number"!=typeof t&&(t=na[e]=o.mono_jiterp_get_opcode_value_table_entry(e)),t}function oa(e,t){return[e,e,t]}let sa;function aa(){if(!o.mono_wasm_is_zero_page_reserved())return!1;if(!0===sa)return!1;const e=te();for(let t=0;t<8;t++)if(0!==e[t])return!1===sa&&He(`Zero page optimizations are enabled but garbage appeared in memory at address ${4*t}: ${e[t]}`),sa=!0,!1;return sa=!1,!0}const ia={enableTraces:"jiterpreter-traces-enabled",enableInterpEntry:"jiterpreter-interp-entry-enabled",enableJitCall:"jiterpreter-jit-call-enabled",enableBackwardBranches:"jiterpreter-backward-branch-entries-enabled",enableCallResume:"jiterpreter-call-resume-enabled",enableWasmEh:"jiterpreter-wasm-eh-enabled",enableSimd:"jiterpreter-simd-enabled",enableAtomics:"jiterpreter-atomics-enabled",zeroPageOptimization:"jiterpreter-zero-page-optimization",cprop:"jiterpreter-constant-propagation",enableStats:"jiterpreter-stats-enabled",disableHeuristic:"jiterpreter-disable-heuristic",estimateHeat:"jiterpreter-estimate-heat",countBailouts:"jiterpreter-count-bailouts",dumpTraces:"jiterpreter-dump-traces",useConstants:"jiterpreter-use-constants",eliminateNullChecks:"jiterpreter-eliminate-null-checks",noExitBackwardBranches:"jiterpreter-backward-branches-enabled",directJitCalls:"jiterpreter-direct-jit-calls",minimumTraceValue:"jiterpreter-minimum-trace-value",minimumTraceHitCount:"jiterpreter-minimum-trace-hit-count",monitoringPeriod:"jiterpreter-trace-monitoring-period",monitoringShortDistance:"jiterpreter-trace-monitoring-short-distance",monitoringLongDistance:"jiterpreter-trace-monitoring-long-distance",monitoringMaxAveragePenalty:"jiterpreter-trace-monitoring-max-average-penalty",backBranchBoost:"jiterpreter-back-branch-boost",jitCallHitCount:"jiterpreter-jit-call-hit-count",jitCallFlushThreshold:"jiterpreter-jit-call-queue-flush-threshold",interpEntryHitCount:"jiterpreter-interp-entry-hit-count",interpEntryFlushThreshold:"jiterpreter-interp-entry-queue-flush-threshold",wasmBytesLimit:"jiterpreter-wasm-bytes-limit",tableSize:"jiterpreter-table-size",aotTableSize:"jiterpreter-aot-table-size",maxModuleSize:"jiterpreter-max-module-size",maxSwitchSize:"jiterpreter-max-switch-size"};let ca=-1,la={};function pa(e){for(const t in e){const n=ia[t];if(!n){He(`Unrecognized jiterpreter option: ${t}`);continue}const r=e[t];"boolean"==typeof r?o.mono_jiterp_parse_option((r?"--":"--no-")+n):"number"==typeof r?o.mono_jiterp_parse_option(`--${n}=${r}`):He(`Jiterpreter option must be a boolean or a number but was ${typeof r} '${r}'`)}}function ua(e){return o.mono_jiterp_get_counter(e)}function da(e,t){return o.mono_jiterp_modify_counter(e,t)}function fa(){const e=o.mono_jiterp_get_options_version();return e!==ca&&(function(){la={};for(const e in ia){const t=o.mono_jiterp_get_option_as_int(ia[e]);t!==Ns?la[e]=t:Ve(`Failed to retrieve value of option ${ia[e]}`)}}(),ca=e),la}function _a(e,t,n,r){const s=qs(),a=t,i=a+n-1;return i= ${s.length}`),s.set(a,r),o.mono_jiterp_initialize_table(e,a,i),t+n}let ma=!1;const ha=["Unknown","InterpreterTiering","NullCheck","VtableNotInitialized","Branch","BackwardBranch","ConditionalBranch","ConditionalBackwardBranch","ComplexBranch","ArrayLoadFailed","ArrayStoreFailed","StringOperationFailed","DivideByZero","Overflow","Return","Call","Throw","AllocFailed","SpanOperationFailed","CastFailed","SafepointBranchTaken","UnboxFailed","CallDelegate","Debugging","Icall","UnexpectedRetIp","LeaveCheck","SwitchSize","SwitchTarget"],ga={2:["V128_I1_NEGATION","V128_I2_NEGATION","V128_I4_NEGATION","V128_ONES_COMPLEMENT","V128_U2_WIDEN_LOWER","V128_U2_WIDEN_UPPER","V128_I1_CREATE_SCALAR","V128_I2_CREATE_SCALAR","V128_I4_CREATE_SCALAR","V128_I8_CREATE_SCALAR","V128_I1_EXTRACT_MSB","V128_I2_EXTRACT_MSB","V128_I4_EXTRACT_MSB","V128_I8_EXTRACT_MSB","V128_I1_CREATE","V128_I2_CREATE","V128_I4_CREATE","V128_I8_CREATE","SplatX1","SplatX2","SplatX4","SplatX8","NegateD1","NegateD2","NegateD4","NegateD8","NegateR4","NegateR8","SqrtR4","SqrtR8","CeilingR4","CeilingR8","FloorR4","FloorR8","TruncateR4","TruncateR8","RoundToNearestR4","RoundToNearestR8","NotANY","AnyTrueANY","AllTrueD1","AllTrueD2","AllTrueD4","AllTrueD8","PopCountU1","BitmaskD1","BitmaskD2","BitmaskD4","BitmaskD8","AddPairwiseWideningI1","AddPairwiseWideningU1","AddPairwiseWideningI2","AddPairwiseWideningU2","AbsI1","AbsI2","AbsI4","AbsI8","AbsR4","AbsR8","ConvertToSingleI4","ConvertToSingleU4","ConvertToSingleR8","ConvertToDoubleLowerI4","ConvertToDoubleLowerU4","ConvertToDoubleLowerR4","ConvertToInt32SaturateR4","ConvertToUInt32SaturateR4","ConvertToInt32SaturateR8","ConvertToUInt32SaturateR8","SignExtendWideningLowerD1","SignExtendWideningLowerD2","SignExtendWideningLowerD4","SignExtendWideningUpperD1","SignExtendWideningUpperD2","SignExtendWideningUpperD4","ZeroExtendWideningLowerD1","ZeroExtendWideningLowerD2","ZeroExtendWideningLowerD4","ZeroExtendWideningUpperD1","ZeroExtendWideningUpperD2","ZeroExtendWideningUpperD4","LoadVector128ANY","LoadScalarVector128X4","LoadScalarVector128X8","LoadScalarAndSplatVector128X1","LoadScalarAndSplatVector128X2","LoadScalarAndSplatVector128X4","LoadScalarAndSplatVector128X8","LoadWideningVector128I1","LoadWideningVector128U1","LoadWideningVector128I2","LoadWideningVector128U2","LoadWideningVector128I4","LoadWideningVector128U4"],3:["V128_I1_ADD","V128_I2_ADD","V128_I4_ADD","V128_R4_ADD","V128_I1_SUB","V128_I2_SUB","V128_I4_SUB","V128_R4_SUB","V128_BITWISE_AND","V128_BITWISE_OR","V128_BITWISE_EQUALITY","V128_BITWISE_INEQUALITY","V128_R4_FLOAT_EQUALITY","V128_R8_FLOAT_EQUALITY","V128_EXCLUSIVE_OR","V128_I1_MULTIPLY","V128_I2_MULTIPLY","V128_I4_MULTIPLY","V128_R4_MULTIPLY","V128_R4_DIVISION","V128_I1_LEFT_SHIFT","V128_I2_LEFT_SHIFT","V128_I4_LEFT_SHIFT","V128_I8_LEFT_SHIFT","V128_I1_RIGHT_SHIFT","V128_I2_RIGHT_SHIFT","V128_I4_RIGHT_SHIFT","V128_I1_URIGHT_SHIFT","V128_I2_URIGHT_SHIFT","V128_I4_URIGHT_SHIFT","V128_I8_URIGHT_SHIFT","V128_U1_NARROW","V128_U1_GREATER_THAN","V128_I1_LESS_THAN","V128_U1_LESS_THAN","V128_I2_LESS_THAN","V128_I1_EQUALS","V128_I2_EQUALS","V128_I4_EQUALS","V128_R4_EQUALS","V128_I8_EQUALS","V128_I1_EQUALS_ANY","V128_I2_EQUALS_ANY","V128_I4_EQUALS_ANY","V128_I8_EQUALS_ANY","V128_AND_NOT","V128_U2_LESS_THAN_EQUAL","V128_I1_SHUFFLE","V128_I2_SHUFFLE","V128_I4_SHUFFLE","V128_I8_SHUFFLE","ExtractScalarI1","ExtractScalarU1","ExtractScalarI2","ExtractScalarU2","ExtractScalarD4","ExtractScalarD8","ExtractScalarR4","ExtractScalarR8","SwizzleD1","AddD1","AddD2","AddD4","AddD8","AddR4","AddR8","SubtractD1","SubtractD2","SubtractD4","SubtractD8","SubtractR4","SubtractR8","MultiplyD2","MultiplyD4","MultiplyD8","MultiplyR4","MultiplyR8","DivideR4","DivideR8","DotI2","ShiftLeftD1","ShiftLeftD2","ShiftLeftD4","ShiftLeftD8","ShiftRightArithmeticD1","ShiftRightArithmeticD2","ShiftRightArithmeticD4","ShiftRightArithmeticD8","ShiftRightLogicalD1","ShiftRightLogicalD2","ShiftRightLogicalD4","ShiftRightLogicalD8","AndANY","AndNotANY","OrANY","XorANY","CompareEqualD1","CompareEqualD2","CompareEqualD4","CompareEqualD8","CompareEqualR4","CompareEqualR8","CompareNotEqualD1","CompareNotEqualD2","CompareNotEqualD4","CompareNotEqualD8","CompareNotEqualR4","CompareNotEqualR8","CompareLessThanI1","CompareLessThanU1","CompareLessThanI2","CompareLessThanU2","CompareLessThanI4","CompareLessThanU4","CompareLessThanI8","CompareLessThanR4","CompareLessThanR8","CompareLessThanOrEqualI1","CompareLessThanOrEqualU1","CompareLessThanOrEqualI2","CompareLessThanOrEqualU2","CompareLessThanOrEqualI4","CompareLessThanOrEqualU4","CompareLessThanOrEqualI8","CompareLessThanOrEqualR4","CompareLessThanOrEqualR8","CompareGreaterThanI1","CompareGreaterThanU1","CompareGreaterThanI2","CompareGreaterThanU2","CompareGreaterThanI4","CompareGreaterThanU4","CompareGreaterThanI8","CompareGreaterThanR4","CompareGreaterThanR8","CompareGreaterThanOrEqualI1","CompareGreaterThanOrEqualU1","CompareGreaterThanOrEqualI2","CompareGreaterThanOrEqualU2","CompareGreaterThanOrEqualI4","CompareGreaterThanOrEqualU4","CompareGreaterThanOrEqualI8","CompareGreaterThanOrEqualR4","CompareGreaterThanOrEqualR8","ConvertNarrowingSaturateSignedI2","ConvertNarrowingSaturateSignedI4","ConvertNarrowingSaturateUnsignedI2","ConvertNarrowingSaturateUnsignedI4","MultiplyWideningLowerI1","MultiplyWideningLowerI2","MultiplyWideningLowerI4","MultiplyWideningLowerU1","MultiplyWideningLowerU2","MultiplyWideningLowerU4","MultiplyWideningUpperI1","MultiplyWideningUpperI2","MultiplyWideningUpperI4","MultiplyWideningUpperU1","MultiplyWideningUpperU2","MultiplyWideningUpperU4","AddSaturateI1","AddSaturateU1","AddSaturateI2","AddSaturateU2","SubtractSaturateI1","SubtractSaturateU1","SubtractSaturateI2","SubtractSaturateU2","MultiplyRoundedSaturateQ15I2","MinI1","MinI2","MinI4","MinU1","MinU2","MinU4","MaxI1","MaxI2","MaxI4","MaxU1","MaxU2","MaxU4","AverageRoundedU1","AverageRoundedU2","MinR4","MinR8","MaxR4","MaxR8","PseudoMinR4","PseudoMinR8","PseudoMaxR4","PseudoMaxR8","StoreANY"],4:["V128_CONDITIONAL_SELECT","ReplaceScalarD1","ReplaceScalarD2","ReplaceScalarD4","ReplaceScalarD8","ReplaceScalarR4","ReplaceScalarR8","ShuffleD1","BitwiseSelectANY","LoadScalarAndInsertX1","LoadScalarAndInsertX2","LoadScalarAndInsertX4","LoadScalarAndInsertX8","StoreSelectedScalarX1","StoreSelectedScalarX2","StoreSelectedScalarX4","StoreSelectedScalarX8"]},ba={13:[65,0],14:[65,1]},ya={456:168,462:174,457:170,463:176},wa={508:[69,40,54],428:[106,40,54],430:[107,40,54],432:[107,40,54],436:[115,40,54],429:[124,41,55],431:[125,41,55],433:[125,41,55],437:[133,41,55],511:[106,40,54],515:[108,40,54],513:[124,41,55],517:[126,41,55],434:[140,42,56],435:[154,43,57],464:[178,40,56],467:[183,40,57],438:[184,40,57],465:[180,41,56],468:[185,41,57],439:[186,41,57],469:[187,42,57],466:[182,43,56],460:[1,52,55],461:[1,53,55],444:[113,40,54],452:[113,40,54],440:[117,40,54],448:[117,40,54],445:[113,41,54],453:[113,41,54],441:[117,41,54],449:[117,41,54],525:[116,40,54],526:[134,41,55],527:[117,40,54],528:[135,41,55],523:[118,40,54],524:[136,41,55],640:[119,40,54],641:[137,41,55],642:[120,40,54],643:[138,41,55],644:[103,40,54],646:[104,40,54],648:[105,40,54],645:[121,41,55],647:[122,41,55],649:[123,41,55],512:[106,40,54],516:[108,40,54],514:[124,41,55],518:[126,41,55],519:[113,40,54],520:[113,40,54],521:[114,40,54],522:[114,40,54]},ka={394:187,395:1,398:187,399:1,402:187,403:1,406:187,407:1,412:187,413:1,416:187,417:1,426:187,427:1,420:187,421:1,65536:187,65537:187,65535:187,65539:1,65540:1,65538:1},Sa={344:[106,40,54],362:[106,40,54],364:[106,40,54],348:[107,40,54],352:[108,40,54],366:[108,40,54],368:[108,40,54],356:[109,40,54],360:[110,40,54],380:[111,40,54],384:[112,40,54],374:[113,40,54],376:[114,40,54],378:[115,40,54],388:[116,40,54],390:[117,40,54],386:[118,40,54],345:[124,41,55],349:[125,41,55],353:[126,41,55],357:[127,41,55],381:[129,41,55],361:[128,41,55],385:[130,41,55],375:[131,41,55],377:[132,41,55],379:[133,41,55],389:[134,41,55],391:[135,41,55],387:[136,41,55],346:[146,42,56],350:[147,42,56],354:[148,42,56],358:[149,42,56],347:[160,43,57],351:[161,43,57],355:[162,43,57],359:[163,43,57],392:[70,40,54],396:[71,40,54],414:[72,40,54],400:[74,40,54],418:[76,40,54],404:[78,40,54],424:[73,40,54],410:[75,40,54],422:[77,40,54],408:[79,40,54],393:[81,41,54],397:[82,41,54],415:[83,41,54],401:[85,41,54],419:[87,41,54],405:[89,41,54],425:[84,41,54],411:[86,41,54],423:[88,41,54],409:[90,41,54]},va={187:392,207:396,195:400,215:410,199:414,223:424,191:404,211:408,203:418,219:422,231:[392,!1,!0],241:[396,!1,!0],235:[400,!1,!0],245:[410,!1,!0],237:[414,!1,!0],249:[424,!1,!0],233:[404,!1,!0],243:[408,!1,!0],239:[418,!1,!0],247:[422,!1,!0],251:[392,65,!0],261:[396,65,!0],255:[400,65,!0],265:[410,65,!0],257:[414,65,!0],269:[424,65,!0],253:[404,65,!0],263:[408,65,!0],259:[418,65,!0],267:[422,65,!0],188:393,208:397,196:401,216:411,200:415,224:425,192:405,212:409,204:419,220:423,252:[393,66,!0],256:[401,66,!0],266:[411,66,!0],258:[415,66,!0],270:[425,66,!0],254:[405,66,!0],264:[409,66,!0],260:[419,66,!0],268:[423,66,!0],189:394,209:65535,197:402,217:412,201:416,225:426,193:406,213:65536,205:420,221:65537,190:395,210:65538,198:403,218:413,202:417,226:427,194:407,214:65539,206:421,222:65540},Ua={599:[!0,!1,159],626:[!0,!0,145],586:[!0,!1,155],613:[!0,!0,141],592:[!0,!1,156],619:[!0,!0,142],603:[!0,!1,153],630:[!0,!0,139],581:[!0,!1,"acos"],608:[!0,!0,"acosf"],582:[!0,!1,"acosh"],609:[!0,!0,"acoshf"],587:[!0,!1,"cos"],614:[!0,!0,"cosf"],579:[!0,!1,"asin"],606:[!0,!0,"asinf"],580:[!0,!1,"asinh"],607:[!0,!0,"asinhf"],598:[!0,!1,"sin"],625:[!0,!0,"sinf"],583:[!0,!1,"atan"],610:[!0,!0,"atanf"],584:[!0,!1,"atanh"],611:[!0,!0,"atanhf"],601:[!0,!1,"tan"],628:[!0,!0,"tanf"],588:[!0,!1,"cbrt"],615:[!0,!0,"cbrtf"],590:[!0,!1,"exp"],617:[!0,!0,"expf"],593:[!0,!1,"log"],620:[!0,!0,"logf"],594:[!0,!1,"log2"],621:[!0,!0,"log2f"],595:[!0,!1,"log10"],622:[!0,!0,"log10f"],604:[!1,!1,164],631:[!1,!0,150],605:[!1,!1,165],632:[!1,!0,151],585:[!1,!1,"atan2"],612:[!1,!0,"atan2f"],596:[!1,!1,"pow"],623:[!1,!0,"powf"],383:[!1,!1,"fmod"],382:[!1,!0,"fmodf"]},Ta={560:[67,0,0],561:[67,192,0],562:[68,0,1],563:[68,193,1],564:[65,0,2],565:[66,0,3]},Ea={566:[74,0,0],567:[74,192,0],568:[75,0,1],569:[75,193,1],570:[72,0,2],571:[73,0,3]},xa={653:1,654:2,655:4,656:8},Ia={653:44,654:46,655:40,656:41},Aa={653:58,654:59,655:54,656:55},ja=new Set([20,21,22,23,24,25,26,27,28,29,30,80,81,82,83,84,85,86,87,88,89,90,91]),$a={51:[16,54],52:[16,54],53:[8,54],54:[8,54],55:[4,54],57:[4,56],56:[2,55],58:[2,57]},La={1:[16,40],2:[8,40],3:[4,40],5:[4,42],4:[2,41],6:[2,43]},Ra=new Set([81,84,85,86,87,82,83,88,89,90,91,92,93]),Ba={13:[16],14:[8],15:[4],16:[2]},Na={10:100,11:132,12:164,13:196,45:100,46:132,47:164,48:196},Oa={6:[44,23],7:[46,26],8:[40,28],9:[41,30]};function Ca(e,t){return O(e+2*t)}function Da(e,t){return z(e+2*t)}function Fa(e,t){return P(e+2*t)}function Pa(e,t){return F(e+2*t)}function Ma(e){return P(e+ea(4))}function za(e,t){const n=P(Ma(e)+ea(5));return P(n+t*gc)}function Va(e,t){const n=P(Ma(e)+ea(12));return P(n+t*gc)}function Wa(e,t,n){if(!n)return!1;for(let r=0;r=40||mt(!1,`Expected load opcode but got ${n}`),e.appendU8(n),void 0!==r)e.appendULeb(r);else if(253===n)throw new Error("PREFIX_simd ldloc without a simdOpcode");const o=ti(t,n,r);e.appendMemarg(t,o)}function oi(e,t,n,r){n>=54||mt(!1,`Expected store opcode but got ${n}`),e.appendU8(n),void 0!==r&&e.appendULeb(r);const o=ti(t,n,r);e.appendMemarg(t,o),Za(t),void 0!==r&&Za(t+8)}function si(e,t,n){n>0&&Ka(t,n),e.lea("pLocals",t)}function ai(e,t,n,r){Ka(t,r),Js(e,t,0,r,!1)||(si(e,t,r),Xs(e,n,r))}function ii(e,t,n,r){if(Ka(t,r),Qs(e,t,n,r,!1))return!0;si(e,t,r),si(e,n,0),Ys(e,r)}function ci(e,t){return 0!==o.mono_jiterp_is_imethod_var_address_taken(Ma(e.frame),t)}function li(e,t,n,r){if(e.allowNullCheckOptimization&&Xa.has(t)&&!ci(e,t))return da(7,1),void(Qa===t?r&&e.local("cknull_ptr"):(ri(e,t,40),e.local("cknull_ptr",r?34:33),Qa=t));ri(e,t,40),e.local("cknull_ptr",34),e.appendU8(69),e.block(64,4),Ws(e,n,2),e.endBlock(),r&&e.local("cknull_ptr"),e.allowNullCheckOptimization&&!ci(e,t)?(Xa.set(t,n),Qa=t):Qa=-1}function pi(e,t,n){let r,s=54;const a=ba[n];if(a)e.local("pLocals"),e.appendU8(a[0]),r=a[1],e.appendLeb(r);else switch(n){case 15:e.local("pLocals"),r=Da(t,2),e.i32_const(r);break;case 16:e.local("pLocals"),r=Pa(t,2),e.i32_const(r);break;case 17:e.local("pLocals"),e.i52_const(0),s=55;break;case 19:e.local("pLocals"),e.appendU8(66),e.appendLebRef(t+4,!0),s=55;break;case 18:e.local("pLocals"),e.i52_const(Da(t,2)),s=55;break;case 20:e.local("pLocals"),e.appendU8(67),e.appendF32(function(e,t){return n=e+2*t,o.mono_wasm_get_f32_unaligned(n);var n}(t,2)),s=56;break;case 21:e.local("pLocals"),e.appendU8(68),e.appendF64(function(e,t){return n=e+2*t,o.mono_wasm_get_f64_unaligned(n);var n}(t,2)),s=57;break;default:return!1}e.appendU8(s);const i=Ca(t,1);return e.appendMemarg(i,2),Za(i),"number"==typeof r?Ha.set(i,{type:"i32",value:r}):Ha.delete(i),!0}function ui(e,t,n){let r=40,o=54;switch(n){case 74:r=44;break;case 75:r=45;break;case 76:r=46;break;case 77:r=47;break;case 78:r=45,o=58;break;case 79:r=47,o=59;break;case 80:break;case 81:r=41,o=55;break;case 82:{const n=Ca(t,3);return ii(e,Ca(t,1),Ca(t,2),n),!0}case 83:return ii(e,Ca(t,1),Ca(t,2),8),ii(e,Ca(t,3),Ca(t,4),8),!0;case 84:return ii(e,Ca(t,1),Ca(t,2),8),ii(e,Ca(t,3),Ca(t,4),8),ii(e,Ca(t,5),Ca(t,6),8),!0;case 85:return ii(e,Ca(t,1),Ca(t,2),8),ii(e,Ca(t,3),Ca(t,4),8),ii(e,Ca(t,5),Ca(t,6),8),ii(e,Ca(t,7),Ca(t,8),8),!0;default:return!1}return e.local("pLocals"),ri(e,Ca(t,2),r),oi(e,Ca(t,1),o),!0}function di(e,t,n,r){const o=r>=23&&r<=36||r>=50&&r<=60,s=Ca(n,o?2:1),a=Ca(n,3),i=Ca(n,o?1:2),c=e.allowNullCheckOptimization&&Xa.has(s)&&!ci(e,s);36!==r&&45!==r&&li(e,s,n,!1);let l=54,p=40;switch(r){case 23:p=44;break;case 24:p=45;break;case 25:p=46;break;case 26:p=47;break;case 31:case 41:case 27:break;case 43:case 29:p=42,l=56;break;case 44:case 30:p=43,l=57;break;case 37:case 38:l=58;break;case 39:case 40:l=59;break;case 28:case 42:p=41,l=55;break;case 45:return c||e.block(),e.local("pLocals"),e.i32_const(a),e.i32_const(s),e.i32_const(i),e.callImport("stfld_o"),c?(e.appendU8(26),da(7,1)):(e.appendU8(13),e.appendULeb(0),Ws(e,n,2),e.endBlock()),!0;case 32:{const t=Ca(n,4);return si(e,i,t),e.local("cknull_ptr"),0!==a&&(e.i32_const(a),e.appendU8(106)),Ys(e,t),!0}case 46:{const r=za(t,Ca(n,4));return e.local("cknull_ptr"),0!==a&&(e.i32_const(a),e.appendU8(106)),si(e,i,0),e.ptr_const(r),e.callImport("value_copy"),!0}case 47:{const t=Ca(n,4);return e.local("cknull_ptr"),0!==a&&(e.i32_const(a),e.appendU8(106)),si(e,i,0),Ys(e,t),!0}case 36:case 35:return e.local("pLocals"),ri(e,s,40),0!==a&&(e.i32_const(a),e.appendU8(106)),oi(e,i,l),!0;default:return!1}return o&&e.local("pLocals"),e.local("cknull_ptr"),o?(e.appendU8(p),e.appendMemarg(a,0),oi(e,i,l),!0):(ri(e,i,p),e.appendU8(l),e.appendMemarg(a,0),!0)}function fi(e,t,n,r){const o=r>=23&&r<=36||r>=50&&r<=60,s=Ca(n,1),a=za(t,Ca(n,2)),i=za(t,Ca(n,3));!function(e,t,n){e.block(),e.ptr_const(t),e.appendU8(45),e.appendMemarg(ea(0),0),e.appendU8(13),e.appendULeb(0),Ws(e,n,3),e.endBlock()}(e,a,n);let c=54,l=40;switch(r){case 50:l=44;break;case 51:l=45;break;case 52:l=46;break;case 53:l=47;break;case 58:case 65:case 54:break;case 67:case 56:l=42,c=56;break;case 68:case 57:l=43,c=57;break;case 61:case 62:c=58;break;case 63:case 64:c=59;break;case 55:case 66:l=41,c=55;break;case 69:return e.ptr_const(i),si(e,s,0),e.callImport("copy_ptr"),!0;case 59:{const t=Ca(n,4);return si(e,s,t),e.ptr_const(i),Ys(e,t),!0}case 72:return e.local("pLocals"),e.ptr_const(i),oi(e,s,c),!0;default:return!1}return o?(e.local("pLocals"),e.ptr_const(i),e.appendU8(l),e.appendMemarg(0,0),oi(e,s,c),!0):(e.ptr_const(i),ri(e,s,l),e.appendU8(c),e.appendMemarg(0,0),!0)}function _i(e,t,n){let r,o,s,a,i="math_lhs32",c="math_rhs32",l=!1;const p=ka[n];if(p){e.local("pLocals");const r=1==p;return ri(e,Ca(t,2),r?43:42),r||e.appendU8(p),ri(e,Ca(t,3),r?43:42),r||e.appendU8(p),e.i32_const(n),e.callImport("relop_fp"),oi(e,Ca(t,1),54),!0}switch(n){case 382:case 383:return wi(e,t,n);default:if(a=Sa[n],!a)return!1;a.length>3?(r=a[1],o=a[2],s=a[3]):(r=o=a[1],s=a[2])}switch(n){case 356:case 357:case 360:case 361:case 380:case 381:case 384:case 385:{const s=361===n||385===n||357===n||381===n;i=s?"math_lhs64":"math_lhs32",c=s?"math_rhs64":"math_rhs32",e.block(),ri(e,Ca(t,2),r),e.local(i,33),ri(e,Ca(t,3),o),e.local(c,34),l=!0,s&&(e.appendU8(80),e.appendU8(69)),e.appendU8(13),e.appendULeb(0),Ws(e,t,12),e.endBlock(),356!==n&&380!==n&&357!==n&&381!==n||(e.block(),e.local(c),s?e.i52_const(-1):e.i32_const(-1),e.appendU8(s?82:71),e.appendU8(13),e.appendULeb(0),e.local(i),e.appendU8(s?66:65),e.appendBoundaryValue(s?64:32,-1),e.appendU8(s?82:71),e.appendU8(13),e.appendULeb(0),Ws(e,t,13),e.endBlock());break}case 362:case 364:case 366:case 368:ri(e,Ca(t,2),r),e.local(i,34),ri(e,Ca(t,3),o),e.local(c,34),e.i32_const(n),e.callImport(364===n||368===n?"ckovr_u4":"ckovr_i4"),e.block(64,4),Ws(e,t,13),e.endBlock(),l=!0}return e.local("pLocals"),l?(e.local(i),e.local(c)):(ri(e,Ca(t,2),r),ri(e,Ca(t,3),o)),e.appendU8(a[0]),oi(e,Ca(t,1),s),!0}function mi(e,t,n){const r=wa[n];if(!r)return!1;const o=r[1],s=r[2];switch((n<472||n>507)&&e.local("pLocals"),n){case 428:case 430:ri(e,Ca(t,2),o),e.i32_const(1);break;case 432:e.i32_const(0),ri(e,Ca(t,2),o);break;case 436:ri(e,Ca(t,2),o),e.i32_const(-1);break;case 444:case 445:ri(e,Ca(t,2),o),41===o&&e.appendU8(167),e.i32_const(255);break;case 452:case 453:ri(e,Ca(t,2),o),41===o&&e.appendU8(167),e.i32_const(65535);break;case 440:case 441:ri(e,Ca(t,2),o),41===o&&e.appendU8(167),e.i32_const(24),e.appendU8(116),e.i32_const(24);break;case 448:case 449:ri(e,Ca(t,2),o),41===o&&e.appendU8(167),e.i32_const(16),e.appendU8(116),e.i32_const(16);break;case 429:case 431:ri(e,Ca(t,2),o),e.i52_const(1);break;case 433:e.i52_const(0),ri(e,Ca(t,2),o);break;case 437:ri(e,Ca(t,2),o),e.i52_const(-1);break;case 511:case 515:case 519:case 521:case 525:case 527:case 523:case 640:case 642:ri(e,Ca(t,2),o),e.i32_const(Da(t,3));break;case 512:case 516:case 520:case 522:ri(e,Ca(t,2),o),e.i32_const(Pa(t,3));break;case 513:case 517:case 526:case 528:case 524:case 641:case 643:ri(e,Ca(t,2),o),e.i52_const(Da(t,3));break;case 514:case 518:ri(e,Ca(t,2),o),e.i52_const(Pa(t,3));break;default:ri(e,Ca(t,2),o)}return 1!==r[0]&&e.appendU8(r[0]),oi(e,Ca(t,1),s),!0}function hi(e,t,n,r){const o=133===r?t+6:t+8,s=Va(n,O(o-2));e.local("pLocals"),e.ptr_const(o),e.appendU8(54),e.appendMemarg(s,0),e.callHandlerReturnAddresses.push(o)}function gi(e,t){const n=o.mono_jiterp_get_opcode_info(t,4),r=e+2+2*o.mono_jiterp_get_opcode_info(t,2);let s;switch(n){case 7:s=F(r);break;case 8:s=z(r);break;case 17:s=z(r+2);break;default:return}return s}function bi(e,t,n,r){const s=r>=227&&r<=270,a=gi(t,r);if("number"!=typeof a)return!1;switch(r){case 132:case 133:case 128:case 129:{const s=132===r||133===r,i=t+2*a;return a<=0?e.backBranchOffsets.indexOf(i)>=0?(e.backBranchTraceLevel>1&&Ve(`0x${t.toString(16)} performing backward branch to 0x${i.toString(16)}`),s&&hi(e,t,n,r),e.cfg.branch(i,!0,0),da(9,1),!0):(i1||e.cfg.trace>1)&&Ve(`0x${t.toString(16)} ${$s(r)} target 0x${i.toString(16)} before start of trace`):(e.backBranchTraceLevel>0||e.cfg.trace>0)&&Ve(`0x${t.toString(16)} ${$s(r)} target 0x${i.toString(16)} not found in list `+e.backBranchOffsets.map((e=>"0x"+e.toString(16))).join(", ")),o.mono_jiterp_boost_back_branch_target(i),Ws(e,i,5),da(10,1),!0):(e.branchTargets.add(i),s&&hi(e,t,n,r),e.cfg.branch(i,!1,0),!0)}case 145:case 143:case 229:case 227:case 146:case 144:{const n=146===r||144===r;ri(e,Ca(t,1),n?41:40),143===r||227===r?e.appendU8(69):144===r?e.appendU8(80):146===r&&(e.appendU8(80),e.appendU8(69));break}default:if(void 0===va[r])throw new Error(`Unsupported relop branch opcode: ${$s(r)}`);if(4!==o.mono_jiterp_get_opcode_info(r,1))throw new Error(`Unsupported long branch opcode: ${$s(r)}`)}const i=t+2*a;return a<0?e.backBranchOffsets.indexOf(i)>=0?(e.backBranchTraceLevel>1&&Ve(`0x${t.toString(16)} performing conditional backward branch to 0x${i.toString(16)}`),e.cfg.branch(i,!0,s?3:1),da(9,1)):(i1||e.cfg.trace>1)&&Ve(`0x${t.toString(16)} ${$s(r)} target 0x${i.toString(16)} before start of trace`):(e.backBranchTraceLevel>0||e.cfg.trace>0)&&Ve(`0x${t.toString(16)} ${$s(r)} target 0x${i.toString(16)} not found in list `+e.backBranchOffsets.map((e=>"0x"+e.toString(16))).join(", ")),o.mono_jiterp_boost_back_branch_target(i),e.block(64,4),Ws(e,i,5),e.endBlock(),da(10,1)):(e.branchTargets.add(i),e.cfg.branch(i,!1,s?3:1)),!0}function yi(e,t,n,r){const o=va[r];if(!o)return!1;const s=Array.isArray(o)?o[0]:o,a=Sa[s],i=ka[s];if(!a&&!i)return!1;const c=a?a[1]:1===i?43:42;return ri(e,Ca(t,1),c),a||1===i||e.appendU8(i),Array.isArray(o)&&o[1]?(e.appendU8(o[1]),e.appendLeb(Da(t,2))):ri(e,Ca(t,2),c),a||1==i||e.appendU8(i),a?e.appendU8(a[0]):(e.i32_const(s),e.callImport("relop_fp")),bi(e,t,n,r)}function wi(e,t,n){let r,o,s,a;const i=Ca(t,1),c=Ca(t,2),l=Ca(t,3),p=Ua[n];if(!p)return!1;if(r=p[0],o=p[1],"string"==typeof p[2]?s=p[2]:a=p[2],e.local("pLocals"),r){if(ri(e,c,o?42:43),a)e.appendU8(a);else{if(!s)throw new Error("internal error");e.callImport(s)}return oi(e,i,o?56:57),!0}if(ri(e,c,o?42:43),ri(e,l,o?42:43),a)e.appendU8(a);else{if(!s)throw new Error("internal error");e.callImport(s)}return oi(e,i,o?56:57),!0}function ki(e,t,n){const r=n>=87&&n<=112,o=n>=107&&n<=112,s=n>=95&&n<=106||n>=120&&n<=127||o,a=n>=101&&n<=106||n>=124&&n<=127||o;let i,c,l=-1,p=0,u=1;o?(i=Ca(t,1),c=Ca(t,2),l=Ca(t,3),p=Da(t,4),u=Da(t,5)):s?a?r?(i=Ca(t,1),c=Ca(t,2),p=Da(t,3)):(i=Ca(t,2),c=Ca(t,1),p=Da(t,3)):r?(i=Ca(t,1),c=Ca(t,2),l=Ca(t,3)):(i=Ca(t,3),c=Ca(t,1),l=Ca(t,2)):r?(c=Ca(t,2),i=Ca(t,1)):(c=Ca(t,1),i=Ca(t,2));let d,f=54;switch(n){case 87:case 95:case 101:case 107:d=44;break;case 88:case 96:case 102:case 108:d=45;break;case 89:case 97:case 103:case 109:d=46;break;case 90:case 98:case 104:case 110:d=47;break;case 113:case 120:case 124:d=40,f=58;break;case 114:case 121:case 125:d=40,f=59;break;case 91:case 99:case 105:case 111:case 115:case 122:case 126:case 119:d=40;break;case 93:case 117:d=42,f=56;break;case 94:case 118:d=43,f=57;break;case 92:case 100:case 106:case 112:case 116:case 123:case 127:d=41,f=55;break;default:return!1}const _=ni(e,c,40,!0,!0);return _||li(e,c,t,!1),r?(e.local("pLocals"),_?mt(ni(e,c,40,!1,!0),"Unknown jiterpreter cprop failure"):e.local("cknull_ptr"),o?(ri(e,l,40),0!==p&&(e.i32_const(p),e.appendU8(106),p=0),1!==u&&(e.i32_const(u),e.appendU8(108)),e.appendU8(106)):s&&l>=0?(ri(e,l,40),e.appendU8(106)):p<0&&(e.i32_const(p),e.appendU8(106),p=0),e.appendU8(d),e.appendMemarg(p,0),oi(e,i,f)):119===n?(_?mt(ni(e,c,40,!1,!0),"Unknown jiterpreter cprop failure"):e.local("cknull_ptr"),si(e,i,0),e.callImport("copy_ptr")):(_?mt(ni(e,c,40,!1,!0),"Unknown jiterpreter cprop failure"):e.local("cknull_ptr"),s&&l>=0?(ri(e,l,40),e.appendU8(106)):p<0&&(e.i32_const(p),e.appendU8(106),p=0),ri(e,i,d),e.appendU8(f),e.appendMemarg(p,0)),!0}function Si(e,t,n,r,o){e.block(),ri(e,r,40),e.local("index",34);let s="cknull_ptr";e.options.zeroPageOptimization&&aa()?(da(8,1),ri(e,n,40),s="src_ptr",e.local(s,34)):li(e,n,t,!0),e.appendU8(40),e.appendMemarg(ea(9),2),e.appendU8(73),e.appendU8(13),e.appendULeb(0),Ws(e,t,9),e.endBlock(),e.local(s),e.i32_const(ea(1)),e.appendU8(106),e.local("index"),1!=o&&(e.i32_const(o),e.appendU8(108)),e.appendU8(106)}function vi(e,t,n,r){const o=r<=328&&r>=315||341===r,s=Ca(n,o?2:1),a=Ca(n,o?1:3),i=Ca(n,o?3:2);let c,l,p=54;switch(r){case 341:return e.local("pLocals"),li(e,s,n,!0),e.appendU8(40),e.appendMemarg(ea(9),2),oi(e,a,54),!0;case 326:return e.local("pLocals"),l=Ca(n,4),Si(e,n,s,i,l),oi(e,a,54),!0;case 337:return e.block(),ri(e,Ca(n,1),40),ri(e,Ca(n,2),40),ri(e,Ca(n,3),40),e.callImport("stelemr_tc"),e.appendU8(13),e.appendULeb(0),Ws(e,n,10),e.endBlock(),!0;case 340:return Si(e,n,s,i,4),si(e,a,0),e.callImport("copy_ptr"),!0;case 324:case 320:case 319:case 333:l=4,c=40;break;case 315:l=1,c=44;break;case 316:l=1,c=45;break;case 330:case 329:l=1,c=40,p=58;break;case 317:l=2,c=46;break;case 318:l=2,c=47;break;case 332:case 331:l=2,c=40,p=59;break;case 322:case 335:l=4,c=42,p=56;break;case 321:case 334:l=8,c=41,p=55;break;case 323:case 336:l=8,c=43,p=57;break;case 325:{const t=Ca(n,4);return e.local("pLocals"),e.i32_const(Ca(n,1)),e.appendU8(106),Si(e,n,s,i,t),Ys(e,t),Ka(Ca(n,1),t),!0}case 338:{const r=Ca(n,5),o=za(t,Ca(n,4));return Si(e,n,s,i,r),si(e,a,0),e.ptr_const(o),e.callImport("value_copy"),!0}case 339:{const t=Ca(n,5);return Si(e,n,s,i,t),si(e,a,0),Ys(e,t),!0}default:return!1}return o?(e.local("pLocals"),Si(e,n,s,i,l),e.appendU8(c),e.appendMemarg(0,0),oi(e,a,p)):(Si(e,n,s,i,l),ri(e,a,c),e.appendU8(p),e.appendMemarg(0,0)),!0}function Ui(e,t,n){const r=`${t}_${n.toString(16)}`;return"object"!=typeof e.importedFunctions[r]&&e.defineImportedFunction("s",r,t,!1,n),r}function Ti(e,t,n,r,s,a){if(e.options.enableSimd&&ct.featureWasmSimd)switch(s){case 2:if(function(e,t,n){const r=o.mono_jiterp_get_simd_opcode(1,n),s=Na[n];if(s)return xi(e,t),e.appendSimd(s),oi(e,Ca(t,1),54),!0;if(r>=0)return Ra.has(n)?(e.local("pLocals"),ri(e,Ca(t,2),40),e.appendSimd(r,!0),e.appendMemarg(0,0),Ei(e,t)):(xi(e,t),e.appendSimd(r),Ei(e,t)),!0;switch(n){case 6:case 7:case 8:case 9:{const r=Oa[n];return e.local("pLocals"),e.v128_const(0),ri(e,Ca(t,2),r[0]),e.appendSimd(r[1]),e.appendU8(0),oi(e,Ca(t,1),253,11),!0}case 14:return xi(e,t,7),Ei(e,t),!0;case 15:return xi(e,t,8),Ei(e,t),!0;case 16:return xi(e,t,9),Ei(e,t),!0;case 17:return xi(e,t,10),Ei(e,t),!0;default:return!1}}(e,t,a))return!0;break;case 3:if(function(e,t,n){const r=o.mono_jiterp_get_simd_opcode(2,n);if(r>=0){const o=ja.has(n),s=$a[n];if(o)e.local("pLocals"),ri(e,Ca(t,2),253,0),ri(e,Ca(t,3),40),e.appendSimd(r),Ei(e,t);else if(Array.isArray(s)){const n=Ga(e,Ca(t,3)),o=s[0];if("number"!=typeof n)return He(`${e.functions[0].name}: Non-constant lane index passed to ExtractScalar`),!1;if(n>=o||n<0)return He(`${e.functions[0].name}: ExtractScalar index ${n} out of range (0 - ${o-1})`),!1;e.local("pLocals"),ri(e,Ca(t,2),253,0),e.appendSimd(r),e.appendU8(n),oi(e,Ca(t,1),s[1])}else Ii(e,t),e.appendSimd(r),Ei(e,t);return!0}switch(n){case 191:return ri(e,Ca(t,2),40),ri(e,Ca(t,3),253,0),e.appendSimd(11),e.appendMemarg(0,0),!0;case 10:case 11:return Ii(e,t),e.appendSimd(214),e.appendSimd(195),11===n&&e.appendU8(69),oi(e,Ca(t,1),54),!0;case 12:case 13:{const r=13===n,o=r?71:65;return e.local("pLocals"),ri(e,Ca(t,2),253,0),e.local("math_lhs128",34),ri(e,Ca(t,3),253,0),e.local("math_rhs128",34),e.appendSimd(o),e.local("math_lhs128"),e.local("math_lhs128"),e.appendSimd(o),e.local("math_rhs128"),e.local("math_rhs128"),e.appendSimd(o),e.appendSimd(80),e.appendSimd(77),e.appendSimd(80),e.appendSimd(r?195:163),oi(e,Ca(t,1),54),!0}case 47:{const n=Ca(t,3),r=Ga(e,n);return e.local("pLocals"),ri(e,Ca(t,2),253,0),"object"==typeof r?(e.appendSimd(12),e.appendBytes(r)):ri(e,n,253,0),e.appendSimd(14),Ei(e,t),!0}case 48:case 49:return function(e,t,n){const r=16/n,o=Ca(t,3),s=Ga(e,o);if(2!==r&&4!==r&&mt(!1,"Unsupported shuffle element size"),e.local("pLocals"),ri(e,Ca(t,2),253,0),"object"==typeof s){const t=new Uint8Array(bc),o=2===r?new Uint16Array(s.buffer,s.byteOffset,n):new Uint32Array(s.buffer,s.byteOffset,n);for(let e=0,s=0;e=0){const o=La[n],s=Ba[n];if(Array.isArray(o)){const n=o[0],s=Ga(e,Ca(t,3));if("number"!=typeof s)return He(`${e.functions[0].name}: Non-constant lane index passed to ReplaceScalar`),!1;if(s>=n||s<0)return He(`${e.functions[0].name}: ReplaceScalar index ${s} out of range (0 - ${n-1})`),!1;e.local("pLocals"),ri(e,Ca(t,2),253,0),ri(e,Ca(t,4),o[1]),e.appendSimd(r),e.appendU8(s),Ei(e,t)}else if(Array.isArray(s)){const n=s[0],o=Ga(e,Ca(t,4));if("number"!=typeof o)return He(`${e.functions[0].name}: Non-constant lane index passed to store method`),!1;if(o>=n||o<0)return He(`${e.functions[0].name}: Store lane ${o} out of range (0 - ${n-1})`),!1;ri(e,Ca(t,2),40),ri(e,Ca(t,3),253,0),e.appendSimd(r),e.appendMemarg(0,0),e.appendU8(o)}else!function(e,t){e.local("pLocals"),ri(e,Ca(t,2),253,0),ri(e,Ca(t,3),253,0),ri(e,Ca(t,4),253,0)}(e,t),e.appendSimd(r),Ei(e,t);return!0}switch(n){case 0:return e.local("pLocals"),ri(e,Ca(t,3),253,0),ri(e,Ca(t,4),253,0),ri(e,Ca(t,2),253,0),e.appendSimd(82),Ei(e,t),!0;case 7:{const n=Ga(e,Ca(t,4));if("object"!=typeof n)return He(`${e.functions[0].name}: Non-constant indices passed to PackedSimd.Shuffle`),!1;for(let t=0;t<32;t++){const r=n[t];if(r<0||r>31)return He(`${e.functions[0].name}: Shuffle lane index #${t} (${r}) out of range (0 - 31)`),!1}return e.local("pLocals"),ri(e,Ca(t,2),253,0),ri(e,Ca(t,3),253,0),e.appendSimd(13),e.appendBytes(n),Ei(e,t),!0}default:return!1}}(e,t,a))return!0}switch(n){case 652:if(e.options.enableSimd&&ct.featureWasmSimd){e.local("pLocals");const n=K().slice(t+4,t+4+bc);e.v128_const(n),Ei(e,t),Ha.set(Ca(t,1),{type:"v128",value:n})}else si(e,Ca(t,1),bc),e.ptr_const(t+4),Ys(e,bc);return!0;case 653:case 654:case 655:case 656:{const r=xa[n],o=bc/r,s=Ca(t,1),a=Ca(t,2),i=Ia[n],c=Aa[n];for(let t=0;t2;return e.local("pLocals"),li(e,Ca(t,2),t,!0),ri(e,Ca(t,3),n?41:40),e.appendAtomic(r[0],!1),e.appendMemarg(0,r[2]),0!==r[1]&&e.appendU8(r[1]),oi(e,Ca(t,1),n?55:54),!0}const o=Ea[n];if(o){const n=o[2]>2;return e.local("pLocals"),li(e,Ca(t,2),t,!0),ri(e,Ca(t,4),n?41:40),ri(e,Ca(t,3),n?41:40),e.appendAtomic(o[0],!1),e.appendMemarg(0,o[2]),0!==o[1]&&e.appendU8(o[1]),oi(e,Ca(t,1),n?55:54),!0}return!1}function ji(e,t,n){const r=Ja(t,271),o=function(e){271!==O(e)&&mt(!1,"decodeSwitch called on a non-switch");const t=Fa(e,2),n=[];for(let r=0;re.options.maxSwitchSize)s=!0;else for(const n of o)n>t&&e.branchTargets.add(n);if(s)return da(14,o.length),Ws(e,t,27),!0;const a=t+2*r;return e.branchTargets.add(a),e.block(),ri(e,Ca(t,1),40),e.cfg.jumpTable(o,a),e.endBlock(),Hs(e,t,n,28),!0}const $i=64;let Li,Ri,Bi,Ni=0;const Oi={};function Ci(){return Ri||(Ri=[oa("interp_entry_prologue",ta("mono_jiterp_interp_entry_prologue")),oa("interp_entry",ta("mono_jiterp_interp_entry")),oa("unbox",ta("mono_jiterp_object_unbox")),oa("stackval_from_data",ta("mono_jiterp_stackval_from_data"))],Ri)}let Di,Fi=class{constructor(e,t,n,r,o,s,a,i){this.imethod=e,this.method=t,this.argumentCount=n,this.unbox=o,this.hasThisReference=s,this.hasReturnValue=a,this.paramTypes=new Array(n);for(let e=0;ee&&(n=n.substring(n.length-e,n.length)),n=`${this.imethod.toString(16)}_${n}`}else n=`${this.imethod.toString(16)}_${this.hasThisReference?"i":"s"}${this.hasReturnValue?"_r":""}_${this.argumentCount}`;this.traceName=n}finally{e&&m(e)}}getTraceName(){return this.traceName||this.generateName(),this.traceName||"unknown"}getName(){return this.name||this.generateName(),this.name||"unknown"}};function Pi(){const e=[];let t=0;for(;0!=(t=o.mono_jiterp_tlqueue_next(1));){const n=Oi[t];n?e.push(n):Ve(`Failed to find corresponding info for method ptr ${t} from jit queue!`)}if(!e.length)return;const n=4*e.length+1;let r=Li;if(r?r.clear(n):(Li=r=new Cs(n),r.defineType("unbox",{pMonoObject:127},127,!0),r.defineType("interp_entry_prologue",{pData:127,this_arg:127},127,!0),r.defineType("interp_entry",{pData:127,res:127},64,!0),r.defineType("stackval_from_data",{type:127,result:127,value:127},64,!0)),r.options.wasmBytesLimit<=ua(6))return;const s=zs();let a=0,i=!0,c=!1;try{r.appendU32(1836278016),r.appendU32(1);for(let t=0;tec[o.mono_jiterp_type_to_ldind(e)])),this.enableDirect=fa().directJitCalls&&!this.noWrapper&&this.wasmNativeReturnType&&(0===this.wasmNativeSignature.length||this.wasmNativeSignature.every((e=>e))),this.enableDirect&&(this.target=this.addr);let c=this.target.toString(16);const l=Gi++;this.name=`${this.enableDirect?"jcp":"jcw"}_${c}_${l.toString(16)}`}}function Zi(e){let t=Ji[e];return t||(e>=Ji.length&&(Ji.length=e+1),qi||(qi=qs()),Ji[e]=t=qi.get(e)),t}function Ki(){const e=[];let t=0;for(;0!=(t=o.mono_jiterp_tlqueue_next(0));){const n=Qi[t];if(n)for(let t=0;t0){o.mono_jiterp_register_jit_call_thunk(n.cinfo,r);for(let e=0;e0&&(kc.push(["trace_eip","trace_eip",Ic]),kc.push(["trace_args","trace_eip",Ac])),(ct.emscriptenBuildOptions.enableEventPipe||ct.emscriptenBuildOptions.enableDevToolsProfiler)&&(kc.push(oa("prof_enter",ta("mono_jiterp_prof_enter"))),kc.push(oa("prof_samplepoint",ta("mono_jiterp_prof_samplepoint"))),kc.push(oa("prof_leave",ta("mono_jiterp_prof_leave"))));const e=(e,t)=>{for(let n=0;n>>0,ac.operand2=t>>>0}function jc(e,t,n,r){if("number"==typeof r)o.mono_jiterp_adjust_abort_count(r,1),r=$s(r);else{let e=mc[r];"number"!=typeof e?e=1:e++,mc[r]=e}hc[e].abortReason=r}function $c(e){if(!ct.runtimeReady)return;if(ic||(ic=fa()),!ic.enableStats)return;const t=ua(9),n=ua(10),r=ua(7),s=ua(8),a=ua(3),i=ua(4),c=ua(2),l=ua(1),p=ua(0),u=ua(6),d=ua(11),f=ua(12),_=ua(13),m=ua(14),h=t/(t+n)*100,g=o.mono_jiterp_get_rejected_trace_count(),b=ic.eliminateNullChecks?r.toString():"off",y=ic.zeroPageOptimization?s.toString()+(aa()?"":" (disabled)"):"off",w=ic.enableBackwardBranches?`emitted: ${t}, failed: ${n} (${h.toFixed(1)}%)`:": off",k=a?ic.directJitCalls?`direct jit calls: ${i} (${(i/a*100).toFixed(1)}%)`:"direct jit calls: off":"";if(Ve(`// jitted ${u}b; ${l} traces (${(l/p*100).toFixed(1)}%) (${g} rejected); ${a} jit_calls; ${c} interp_entries`),Ve(`// cknulls pruned: ${b}, fused: ${y}; back-brs ${w}; switch tgts ${_}/${m+_}; ${k}`),Ve(`// time: ${0|d}ms generating, ${0|f}ms compiling wasm.`),!e){if(ic.countBailouts){const e=Object.values(hc);e.sort(((e,t)=>(t.bailoutCount||0)-(e.bailoutCount||0)));for(let e=0;et.hitCount-e.hitCount)),Ve("// hottest failed traces:");for(let e=0,n=0;e=0)){if(t[e].abortReason){if(t[e].abortReason.startsWith("mono_icall_")||t[e].abortReason.startsWith("ret."))continue;switch(t[e].abortReason){case"trace-too-small":case"trace-too-big":case"call":case"callvirt.fast":case"calli.nat.fast":case"calli.nat":case"call.delegate":case"newobj":case"newobj_vt":case"newobj_slow":case"switch":case"rethrow":case"end-of-body":case"ret":case"intrins_marvin_block":case"intrins_ascii_chars_to_uppercase":continue}}n++,Ve(`${t[e].name} @${t[e].ip} (${t[e].hitCount} hits) ${t[e].abortReason}`)}const n=[];for(const t in e)n.push([t,e[t]]);n.sort(((e,t)=>t[1]-e[1])),Ve("// heat:");for(let e=0;e0?mc[t]=n:delete mc[t]}const e=Object.keys(mc);e.sort(((e,t)=>mc[t]-mc[e]));for(let t=0;te.toString(16).padStart(2,"0"))).join("")}`}async function Cc(e){const t=lt.config.resources.lazyAssembly;if(!t)throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");let n=e;e.endsWith(".dll")?n=e.substring(0,e.length-4):e.endsWith(".wasm")&&(n=e.substring(0,e.length-5));const r=n+".dll",o=n+".wasm";let s=null;for(let e=0;eObject.prototype.hasOwnProperty.call(t,e))).map((e=>{const n=[];for(let r=0;re.concat(t)),new Array).map((async e=>{const t=await e;!function(e){lt.assert_runtime_running();const t=Ke.stackSave();try{const t=$n(3),n=Ln(t,2);Wn(n,21),vo(n,e,4),kn(yn.LoadSatelliteAssembly,t)}finally{lt.is_runtime_running()&&Ke.stackRestore(t)}}(new Uint8Array(t))})))}function Fc(e){if(e===l)return null;const t=o.mono_wasm_read_as_bool_or_null_unsafe(e);return 0!==t&&(1===t||null)}function Pc(e){if(e)try{(e=e.toLocaleLowerCase().replace("_","-")).startsWith("zh-")&&(e=e.replace("-chs","-Hans").replace("-cht","-Hant"));const t=Intl.getCanonicalLocales(e);return t.length>0?t[0]:void 0}catch(e){return}}const Mc=[function(e){Xo&&(globalThis.clearTimeout(Xo),Xo=void 0),Xo=Ke.safeSetTimeout(mono_wasm_schedule_timer_tick,e)},function(e,t,n,r,o){if(!0!==ct.mono_wasm_runtime_is_ready)return;const s=K(),a=0!==e?Le(e).concat(".dll"):"",i=ht(new Uint8Array(s.buffer,t,n));let c;r&&(c=ht(new Uint8Array(s.buffer,r,o))),Lt({eventName:"AssemblyLoaded",assembly_name:a,assembly_b64:i,pdb_b64:c})},function(e,t){const n=Le(t);et.logging&&"function"==typeof et.logging.debugger&&et.logging.debugger(e,n)},function(e,t,n,r){const o={res_ok:e,res:{id:t,value:ht(new Uint8Array(K().buffer,n,r))}};bt.has(t)&&We(`Adding an id (${t}) that already exists in commands_received`),bt.set(t,o)},function mono_wasm_fire_debugger_agent_message_with_data(e,t){mono_wasm_fire_debugger_agent_message_with_data_to_pause(ht(new Uint8Array(K().buffer,e,t)))},mono_wasm_fire_debugger_agent_message_with_data_to_pause,function(){Jo||(Jo=Ke.safeSetTimeout(Ko,0))},function(e,t,n,r,s,a,i,c){if(n||mt(!1,"expected instruction pointer"),ic||(ic=fa()),!ic.enableTraces)return 1;if(ic.wasmBytesLimit<=ua(6))return 1;if(cc)return 1;let l,p=hc[r];if(p||(hc[r]=p=new dc(n,r,i)),da(0,1),ic.estimateHeat||pc.length>0||p.isVerbose){const e=o.mono_wasm_method_get_full_name(t);l=Le(e),m(e)}const u=Le(o.mono_wasm_method_get_name(t));p.name=l||u;let d=ic.noExitBackwardBranches?function(e,t,n){const r=t+n,o=[],s=(e-t)/2;for(;e=s&&o.push(r)}switch(r){case 132:case 133:o.push(n+a)}}e+=2*a}return o.length<=0?null:new Uint16Array(o)}(n,s,a):null;if(d&&n!==s){const e=(n-s)/2;let t=!1;for(let n=0;n=e){t=!0;break}t||(d=null)}const f=function(e,t,n,r,s,a,i,c,l){let p=wc;p?p.clear(8):(wc=p=new Cs(8),function(e){e.defineType("trace",{frame:127,pLocals:127,cinfo:127,ip:127},127,!0),e.defineType("bailout",{retval:127,base:127,reason:127},127,!0),e.defineType("copy_ptr",{dest:127,src:127},64,!0),e.defineType("value_copy",{dest:127,src:127,klass:127},64,!0),e.defineType("entry",{imethod:127},127,!0),e.defineType("strlen",{ppString:127,pResult:127},127,!0),e.defineType("getchr",{ppString:127,pIndex:127,pResult:127},127,!0),e.defineType("getspan",{destination:127,span:127,index:127,element_size:127},127,!0),e.defineType("overflow_check_i4",{lhs:127,rhs:127,opcode:127},127,!0),e.defineType("mathop_d_d",{value:124},124,!0),e.defineType("mathop_dd_d",{lhs:124,rhs:124},124,!0),e.defineType("mathop_f_f",{value:125},125,!0),e.defineType("mathop_ff_f",{lhs:125,rhs:125},125,!0),e.defineType("fmaf",{x:125,y:125,z:125},125,!0),e.defineType("fma",{x:124,y:124,z:124},124,!0),e.defineType("trace_eip",{traceId:127,eip:127},64,!0),e.defineType("newobj_i",{ppDestination:127,vtable:127},127,!0),e.defineType("newstr",{ppDestination:127,length:127},127,!0),e.defineType("newarr",{ppDestination:127,vtable:127,length:127},127,!0),e.defineType("localloc",{destination:127,len:127,frame:127},64,!0),e.defineType("ld_del_ptr",{ppDestination:127,ppSource:127},64,!0),e.defineType("ldtsflda",{ppDestination:127,offset:127},64,!0),e.defineType("gettype",{destination:127,source:127},127,!0),e.defineType("castv2",{destination:127,source:127,klass:127,opcode:127},127,!0),e.defineType("hasparent",{klass:127,parent:127},127,!0),e.defineType("imp_iface",{vtable:127,klass:127},127,!0),e.defineType("imp_iface_s",{obj:127,vtable:127,klass:127},127,!0),e.defineType("box",{vtable:127,destination:127,source:127,vt:127},64,!0),e.defineType("conv",{destination:127,source:127,opcode:127},127,!0),e.defineType("relop_fp",{lhs:124,rhs:124,opcode:127},127,!0),e.defineType("safepoint",{frame:127,ip:127},64,!0),e.defineType("prof_enter",{frame:127,ip:127},64,!0),e.defineType("prof_samplepoint",{frame:127,ip:127},64,!0),e.defineType("prof_leave",{frame:127,ip:127},64,!0),e.defineType("hashcode",{ppObj:127},127,!0),e.defineType("try_hash",{ppObj:127},127,!0),e.defineType("hascsize",{ppObj:127},127,!0),e.defineType("hasflag",{klass:127,dest:127,sp1:127,sp2:127},64,!0),e.defineType("array_rank",{destination:127,source:127},127,!0),e.defineType("stfld_o",{locals:127,fieldOffsetBytes:127,targetLocalOffsetBytes:127,sourceLocalOffsetBytes:127},127,!0),e.defineType("notnull",{ptr:127,expected:127,traceIp:127,ip:127},64,!0),e.defineType("stelemr",{o:127,aindex:127,ref:127},127,!0),e.defineType("simd_p_p",{arg0:127,arg1:127},64,!0),e.defineType("simd_p_pp",{arg0:127,arg1:127,arg2:127},64,!0),e.defineType("simd_p_ppp",{arg0:127,arg1:127,arg2:127,arg3:127},64,!0);const t=xc();for(let n=0;ni.indexOf(e)>=0))>=0;b&&!i&&mt(!1,"Expected methodFullName if trace is instrumented");const y=b?_c++:0;b&&(Ve(`instrumenting: ${i}`),fc[y]=new uc(i)),p.compressImportNames=!b;try{p.appendU32(1836278016),p.appendU32(1),p.generateTypeSection();const t={disp:127,cknull_ptr:127,dest_ptr:127,src_ptr:127,memop_dest:127,memop_src:127,index:127,count:127,math_lhs32:127,math_rhs32:127,math_lhs64:126,math_rhs64:126,temp_f32:125,temp_f64:124};p.options.enableSimd&&(t.v128_zero=123,t.math_lhs128=123,t.math_rhs128=123);let s=!0,i=0;if(p.defineFunction({type:"trace",name:d,export:!0,locals:t},(()=>{switch(p.base=n,p.traceIndex=a,p.frame=e,O(n)){case 674:case 675:case 677:case 676:break;default:throw new Error(`Expected *ip to be a jiterpreter opcode but it was ${O(n)}`)}return p.cfg.initialize(r,c,b?1:0),i=function(e,t,n,r,s,a,i,c){let l=!0,p=!1,u=!1,d=!1,f=0,_=0,m=0;Ya(),a.backBranchTraceLevel=i?2:0;let h=a.cfg.entry(n);for(;n&&n;){if(a.cfg.ip=n,n>=s){jc(a.traceIndex,0,0,"end-of-body"),i&&Ve(`instrumented trace ${t} exited at end of body @${n.toString(16)}`);break}const g=a.options.maxModuleSize-300-a.bytesGeneratedSoFar-a.cfg.overheadBytes;if(a.size>=g){jc(a.traceIndex,0,0,"trace-too-big"),i&&Ve(`instrumented trace ${t} exited because of size limit at @${n.toString(16)} (spaceLeft=${g}b)`);break}let b=O(n);const y=o.mono_jiterp_get_opcode_info(b,2),w=o.mono_jiterp_get_opcode_info(b,3),k=Ja(n,b),S=b>=657&&b<=659,v=S?b-657+2:0,U=S?Ca(n,1+v):0;b>=0&&b<691||mt(!1,`invalid opcode ${b}`);const T=S?ga[v][U]:$s(b),E=n,x=a.options.noExitBackwardBranches&&Wa(n,r,c),I=a.branchTargets.has(n),A=x||I||l&&c,j=m+_+a.branchTargets.size;let $=!1,L=ra(b);switch(x&&(a.backBranchTraceLevel>1&&Ve(`${t} recording back branch target 0x${n.toString(16)}`),a.backBranchOffsets.push(n)),A&&(u=!1,d=!1,ei(a,n,x),p=!0,Ya(),m=0),L<-1&&p&&(L=-2===L?2:0),l=!1,271===b||(lc.indexOf(b)>=0?(Ws(a,n,23),b=678):u&&(b=678)),b){case 271:ji(a,n,j)||(n=0);break;case 678:u&&(d||a.appendU8(0),d=!0);break;case 313:case 314:ai(a,Ca(n,1),0,Ca(n,2));break;case 312:si(a,Ca(n,1),0),ri(a,Ca(n,2),40),a.local("frame"),a.callImport("localloc");break;case 285:ri(a,Ca(n,1),40),a.i32_const(0),ri(a,Ca(n,2),40),a.appendU8(252),a.appendU8(11),a.appendU8(0);break;case 286:ri(a,Ca(n,1),40),Xs(a,0,Ca(n,2));break;case 310:{const e=Ca(n,3),t=Ca(n,2),r=Ca(n,1),o=Ga(a,e);0!==o&&("number"!=typeof o?(ri(a,e,40),a.local("count",34),a.block(64,4)):(a.i32_const(o),a.local("count",33)),ri(a,r,40),a.local("dest_ptr",34),a.appendU8(69),ri(a,t,40),a.local("src_ptr",34),a.appendU8(69),a.appendU8(114),a.block(64,4),Ws(a,n,2),a.endBlock(),"number"==typeof o&&Qs(a,0,0,o,!1,"dest_ptr","src_ptr")||(a.local("dest_ptr"),a.local("src_ptr"),a.local("count"),a.appendU8(252),a.appendU8(10),a.appendU8(0),a.appendU8(0)),"number"!=typeof o&&a.endBlock());break}case 311:{const e=Ca(n,3),t=Ca(n,2);li(a,Ca(n,1),n,!0),ri(a,t,40),ri(a,e,40),a.appendU8(252),a.appendU8(11),a.appendU8(0);break}case 143:case 145:case 227:case 229:case 144:case 146:case 129:case 132:case 133:bi(a,n,e,b)?p=!0:n=0;break;case 538:{const e=Ca(n,2),t=Ca(n,1);e!==t?(a.local("pLocals"),li(a,e,n,!0),oi(a,t,54)):li(a,e,n,!1),a.allowNullCheckOptimization&&Xa.set(t,n),$=!0;break}case 638:case 639:{const t=P(e+ea(4));a.ptr_const(t),a.callImport("entry"),a.block(64,4),Ws(a,n,1),a.endBlock();break}case 676:L=0;break;case 138:break;case 86:{a.local("pLocals");const e=Ca(n,2),r=ci(a,e),o=Ca(n,1),s=Ca(n,3);r||He(`${t}: Expected local ${e} to have address taken flag`),si(a,e,s),oi(a,o,54),Ha.set(o,{type:"ldloca",offset:e}),$=!0;break}case 272:case 300:case 301:case 556:{a.local("pLocals");let t=za(e,Ca(n,2));300===b&&(t=o.mono_jiterp_imethod_to_ftnptr(t)),a.ptr_const(t),oi(a,Ca(n,1),54);break}case 305:{const t=za(e,Ca(n,3));ri(a,Ca(n,1),40),ri(a,Ca(n,2),40),a.ptr_const(t),a.callImport("value_copy");break}case 306:{const e=Ca(n,3);ri(a,Ca(n,1),40),ri(a,Ca(n,2),40),Ys(a,e);break}case 307:{const e=Ca(n,3);si(a,Ca(n,1),e),li(a,Ca(n,2),n,!0),Ys(a,e);break}case 308:{const t=za(e,Ca(n,3));ri(a,Ca(n,1),40),si(a,Ca(n,2),0),a.ptr_const(t),a.callImport("value_copy");break}case 309:{const e=Ca(n,3);ri(a,Ca(n,1),40),si(a,Ca(n,2),0),Ys(a,e);break}case 540:a.local("pLocals"),li(a,Ca(n,2),n,!0),a.appendU8(40),a.appendMemarg(ea(2),2),oi(a,Ca(n,1),54);break;case 539:{a.block(),ri(a,Ca(n,3),40),a.local("index",34);let e="cknull_ptr";a.options.zeroPageOptimization&&aa()?(da(8,1),ri(a,Ca(n,2),40),e="src_ptr",a.local(e,34)):li(a,Ca(n,2),n,!0),a.appendU8(40),a.appendMemarg(ea(2),2),a.appendU8(72),a.local("index"),a.i32_const(0),a.appendU8(78),a.appendU8(113),a.appendU8(13),a.appendULeb(0),Ws(a,n,11),a.endBlock(),a.local("pLocals"),a.local("index"),a.i32_const(2),a.appendU8(108),a.local(e),a.appendU8(106),a.appendU8(47),a.appendMemarg(ea(3),1),oi(a,Ca(n,1),54);break}case 342:case 343:{const e=Da(n,4);a.block(),ri(a,Ca(n,3),40),a.local("index",34);let t="cknull_ptr";342===b?li(a,Ca(n,2),n,!0):(si(a,Ca(n,2),0),t="src_ptr",a.local(t,34)),a.appendU8(40),a.appendMemarg(ea(7),2),a.appendU8(73),a.local("index"),a.i32_const(0),a.appendU8(78),a.appendU8(113),a.appendU8(13),a.appendULeb(0),Ws(a,n,18),a.endBlock(),a.local("pLocals"),a.local(t),a.appendU8(40),a.appendMemarg(ea(8),2),a.local("index"),a.i32_const(e),a.appendU8(108),a.appendU8(106),oi(a,Ca(n,1),54);break}case 664:a.block(),ri(a,Ca(n,3),40),a.local("count",34),a.i32_const(0),a.appendU8(78),a.appendU8(13),a.appendULeb(0),Ws(a,n,18),a.endBlock(),si(a,Ca(n,1),16),a.local("dest_ptr",34),ri(a,Ca(n,2),40),a.appendU8(54),a.appendMemarg(0,0),a.local("dest_ptr"),a.local("count"),a.appendU8(54),a.appendMemarg(4,0);break;case 577:si(a,Ca(n,1),4),si(a,Ca(n,2),4),a.callImport("ld_del_ptr");break;case 73:si(a,Ca(n,1),4),a.ptr_const(Pa(n,2)),a.callImport("ldtsflda");break;case 663:a.block(),si(a,Ca(n,1),4),si(a,Ca(n,2),0),a.callImport("gettype"),a.appendU8(13),a.appendULeb(0),Ws(a,n,2),a.endBlock();break;case 660:{const t=za(e,Ca(n,4));a.ptr_const(t),si(a,Ca(n,1),4),si(a,Ca(n,2),0),si(a,Ca(n,3),0),a.callImport("hasflag");break}case 669:{const e=ea(1);a.local("pLocals"),li(a,Ca(n,2),n,!0),a.i32_const(e),a.appendU8(106),oi(a,Ca(n,1),54);break}case 661:a.local("pLocals"),si(a,Ca(n,2),0),a.callImport("hashcode"),oi(a,Ca(n,1),54);break;case 662:a.local("pLocals"),si(a,Ca(n,2),0),a.callImport("try_hash"),oi(a,Ca(n,1),54);break;case 665:a.local("pLocals"),si(a,Ca(n,2),0),a.callImport("hascsize"),oi(a,Ca(n,1),54);break;case 670:a.local("pLocals"),ri(a,Ca(n,2),40),a.local("math_lhs32",34),ri(a,Ca(n,3),40),a.appendU8(115),a.i32_const(2),a.appendU8(116),a.local("math_rhs32",33),a.local("math_lhs32"),a.i32_const(327685),a.appendU8(106),a.i32_const(10485920),a.appendU8(114),a.i32_const(1703962),a.appendU8(106),a.i32_const(-8388737),a.appendU8(114),a.local("math_rhs32"),a.appendU8(113),a.appendU8(69),oi(a,Ca(n,1),54);break;case 541:case 542:a.block(),si(a,Ca(n,1),4),si(a,Ca(n,2),0),a.callImport(541===b?"array_rank":"a_elesize"),a.appendU8(13),a.appendULeb(0),Ws(a,n,2),a.endBlock();break;case 289:case 290:{const t=za(e,Ca(n,3)),r=o.mono_jiterp_is_special_interface(t),s=289===b,i=Ca(n,1);if(!t){jc(a.traceIndex,0,0,"null-klass"),n=0;continue}a.block(),a.options.zeroPageOptimization&&aa()?(ri(a,Ca(n,2),40),a.local("dest_ptr",34),da(8,1)):(a.block(),ri(a,Ca(n,2),40),a.local("dest_ptr",34),a.appendU8(13),a.appendULeb(0),a.local("pLocals"),a.i32_const(0),oi(a,i,54),a.appendU8(12),a.appendULeb(1),a.endBlock(),a.local("dest_ptr")),r&&a.local("dest_ptr"),a.appendU8(40),a.appendMemarg(ea(14),0),a.ptr_const(t),a.callImport(r?"imp_iface_s":"imp_iface"),s&&(a.local("dest_ptr"),a.appendU8(69),a.appendU8(114)),a.block(64,4),a.local("pLocals"),a.local("dest_ptr"),oi(a,i,54),a.appendU8(5),s?Ws(a,n,19):(a.local("pLocals"),a.i32_const(0),oi(a,i,54)),a.endBlock(),a.endBlock();break}case 291:case 292:case 287:case 288:{const t=za(e,Ca(n,3)),r=291===b||292===b,o=287===b||291===b,s=Ca(n,1);if(!t){jc(a.traceIndex,0,0,"null-klass"),n=0;continue}a.block(),a.options.zeroPageOptimization&&aa()?(ri(a,Ca(n,2),40),a.local("dest_ptr",34),da(8,1)):(a.block(),ri(a,Ca(n,2),40),a.local("dest_ptr",34),a.appendU8(13),a.appendULeb(0),a.local("pLocals"),a.i32_const(0),oi(a,s,54),a.appendU8(12),a.appendULeb(1),a.endBlock(),a.local("dest_ptr")),a.appendU8(40),a.appendMemarg(ea(14),0),a.appendU8(40),a.appendMemarg(ea(15),0),r&&a.local("src_ptr",34),a.i32_const(t),a.appendU8(70),a.block(64,4),a.local("pLocals"),a.local("dest_ptr"),oi(a,s,54),a.appendU8(5),r?(a.local("src_ptr"),a.ptr_const(t),a.callImport("hasparent"),o&&(a.local("dest_ptr"),a.appendU8(69),a.appendU8(114)),a.block(64,4),a.local("pLocals"),a.local("dest_ptr"),oi(a,s,54),a.appendU8(5),o?Ws(a,n,19):(a.local("pLocals"),a.i32_const(0),oi(a,s,54)),a.endBlock()):(si(a,Ca(n,1),4),a.local("dest_ptr"),a.ptr_const(t),a.i32_const(b),a.callImport("castv2"),a.appendU8(69),a.block(64,4),Ws(a,n,19),a.endBlock()),a.endBlock(),a.endBlock();break}case 295:case 296:a.ptr_const(za(e,Ca(n,3))),si(a,Ca(n,1),4),si(a,Ca(n,2),0),a.i32_const(296===b?1:0),a.callImport("box");break;case 299:{const t=za(e,Ca(n,3)),r=ea(17),o=Ca(n,1),s=P(t+r);if(!t||!s){jc(a.traceIndex,0,0,"null-klass"),n=0;continue}a.options.zeroPageOptimization&&aa()?(ri(a,Ca(n,2),40),a.local("dest_ptr",34),da(8,1)):(li(a,Ca(n,2),n,!0),a.local("dest_ptr",34)),a.appendU8(40),a.appendMemarg(ea(14),0),a.appendU8(40),a.appendMemarg(ea(15),0),a.local("src_ptr",34),a.appendU8(40),a.appendMemarg(r,0),a.i32_const(s),a.appendU8(70),a.local("src_ptr"),a.appendU8(45),a.appendMemarg(ea(16),0),a.appendU8(69),a.appendU8(113),a.block(64,4),a.local("pLocals"),a.local("dest_ptr"),a.i32_const(ea(18)),a.appendU8(106),oi(a,o,54),a.appendU8(5),Ws(a,n,21),a.endBlock();break}case 294:a.block(),si(a,Ca(n,1),4),ri(a,Ca(n,2),40),a.callImport("newstr"),a.appendU8(13),a.appendULeb(0),Ws(a,n,17),a.endBlock();break;case 293:{a.block(),si(a,Ca(n,1),4);const t=za(e,Ca(n,3));a.i32_const(t),ri(a,Ca(n,2),40),a.callImport("newarr"),a.appendU8(13),a.appendULeb(0),Ws(a,n,17),a.endBlock();break}case 283:a.block(),si(a,Ca(n,1),4),a.ptr_const(za(e,Ca(n,2))),a.callImport("newobj_i"),a.appendU8(13),a.appendULeb(0),Ws(a,n,17),a.endBlock();break;case 282:case 284:case 544:case 543:p?(Hs(a,n,j,15),u=!0,L=0):n=0;break;case 546:case 547:case 548:case 549:case 545:p?(Hs(a,n,j,545==b?22:15),u=!0):n=0;break;case 137:case 134:Ws(a,n,16),u=!0;break;case 130:case 131:Ws(a,n,26),u=!0;break;case 136:if(a.callHandlerReturnAddresses.length>0&&a.callHandlerReturnAddresses.length<=3){const t=Va(e,Ca(n,1));a.local("pLocals"),a.appendU8(40),a.appendMemarg(t,0),a.local("index",33);for(let e=0;e=3&&b<=12||b>=509&&b<=510?p||a.options.countBailouts?(Ws(a,n,14),u=!0):n=0:b>=13&&b<=21?pi(a,n,b)?$=!0:n=0:b>=74&&b<=85?ui(a,n,b)||(n=0):b>=344&&b<=427?_i(a,n,b)||(n=0):wa[b]?mi(a,n,b)||(n=0):va[b]?yi(a,n,e,b)?p=!0:n=0:b>=23&&b<=49?di(a,e,n,b)||(n=0):b>=50&&b<=73?fi(a,e,n,b)||(n=0):b>=87&&b<=127?ki(a,n,b)||(n=0):b>=579&&b<=632?wi(a,n,b)||(n=0):b>=315&&b<=341?vi(a,e,n,b)||(n=0):b>=227&&b<=270?a.branchTargets.size>0?(Hs(a,n,j,8),u=!0):n=0:b>=652&&b<=659?(a.containsSimd=!0,Ti(a,n,b,T,v,U)?$=!0:n=0):b>=559&&b<=571?(a.containsAtomics=!0,Ai(a,n,b)||(n=0)):0===L||(n=0)}if(n){if(!$){const e=n+2;for(let t=0;t0&&(e+=" -> ");for(let n=0;n0&&(p?m++:_++,f+=L),(n+=2*k)<=s&&(h=n)}else i&&Ve(`instrumented trace ${t} aborted for opcode ${T} @${E.toString(16)}`),jc(a.traceIndex,0,0,b)}for(;a.activeBlocks>0;)a.endBlock();return a.cfg.exitIp=h,a.containsSimd&&(f+=10240),f}(e,d,n,r,u,p,y,c),s=i>=ic.minimumTraceValue,p.cfg.generate()})),p.emitImportsAndFunctions(!1),!s)return g&&"end-of-body"===g.abortReason&&(g.abortReason="trace-too-small"),0;_=zs();const f=p.getArrayView();if(da(6,f.length),f.length>=p.options.maxModuleSize)return We(`Jiterpreter generated too much code (${f.length} bytes) for trace ${d}. Please report this issue.`),0;const h=new WebAssembly.Module(f),w=p.getWasmImports(),k=new WebAssembly.Instance(h,w).exports[d];let S;m=!1,l?(qs().set(l,k),S=l):(S=Gs(0,k),0===S&&(cc=!0));const v=ua(1);return p.options.enableStats&&v&&v%500==0&&$c(!0),S}catch(e){h=!0,m=!1;let t=p.containsSimd?" (simd)":"";return p.containsAtomics&&(t+=" (atomics)"),He(`${i||d}${t} code generation failed: ${e} ${e.stack}`),Zs(),0}finally{const e=zs();if(_?(da(11,_-f),da(12,e-_)):da(11,e-f),h||!m&&ic.dumpTraces||b){if(h||ic.dumpTraces||b)for(let e=0;e0;)p.endBlock();p.inSection&&p.endSection()}catch(e){}const n=p.getArrayView(!1,!0);for(let r=0;r=4?Pi():Ni>0||"function"==typeof globalThis.setTimeout&&(Ni=globalThis.setTimeout((()=>{Ni=0,Pi()}),10))}},function(e,t,n,r,o,s,a,i){if(n>16)return 0;const c=new Fi(e,t,n,r,o,s,a,i);Bi||(Bi=qs());const l=Bi.get(i),p=(s?a?29:20:a?11:2)+n;return c.result=Gs(p,l),Oi[e]=c,c.result},function(e,t,n,r,s){const a=P(n+0),i=Xi[a];if(i)return void(i.result>0?o.mono_jiterp_register_jit_call_thunk(n,i.result):(i.queue.push(n),i.queue.length>12&&Ki()));const c=new Yi(e,t,n,r,0!==s);Xi[a]=c;const l=o.mono_jiterp_tlqueue_add(0,e);let p=Qi[e];p||(p=Qi[e]=[]),p.push(c),l>=6&&Ki()},function(e,t,n,r,s){const a=Zi(e);try{a(t,n,r,s)}catch(e){const t=Ke.wasmExports.__cpp_exception,n=t instanceof WebAssembly.Tag;if(n&&!(e instanceof WebAssembly.Exception&&e.is(t)))throw e;if(i=s,Ke.HEAPU32[i>>>2]=1,n){const n=e.getArg(t,0);o.mono_jiterp_begin_catch(n),o.mono_jiterp_end_catch()}else{if("number"!=typeof e)throw e;o.mono_jiterp_begin_catch(e),o.mono_jiterp_end_catch()}}var i},Ki,function(e,t,n){ct.emscriptenBuildOptions.enableDevToolsProfiler&&function(e){Mt.delete(e)}(e),delete hc[n],function(e){delete Oi[e]}(t),function(e){const t=Qi[e];if(t){for(let e=0;e",a=!!r,i=e?Le(e):"",c=o,l=t?Le(t):"",p=`[MONO] ${s}`;if(et.logging&&"function"==typeof et.logging.trace)et.logging.trace(i,l,p,a,c);else switch(l){case"critical":case"error":{const e=p+"\n"+(new Error).stack;lt.exitReason||(lt.exitReason=e),console.error(Qe(e))}break;case"warning":console.warn(p);break;case"message":default:console.log(p);break;case"info":console.info(p);break;case"debug":console.debug(p)}},function(e){wt=lt.config.mainAssemblyName+".dll",kt=e,console.assert(!0,`Adding an entrypoint breakpoint ${wt} at method token ${kt}`);debugger},function(e,t){if(!globalThis.crypto||!globalThis.crypto.getRandomValues)return-1;const n=K(),r=n.subarray(e,e+t),o=(n.buffer,!1),s=o?new Uint8Array(t):r;for(let e=0;e{e&&e.dispose()},u=!0)}const d=Bn(e,1),f=Nn(d),_=eo(d,f,1),m=26==f,h=20==f||30==f,g={fn:i,fqn:s+":"+o,args_count:c,arg_marshalers:l,res_converter:_,has_cleanup:u,arg_cleanup:p,is_discard_no_wait:m,is_async:h,isDisposed:!1};let b;b=h||m||u?ar(g):0!=c||_?1!=c||_?1==c&&_?function(e){const t=e.fn,r=e.arg_marshalers[0],o=e.res_converter,s=e.fqn;return e=null,function(a){const i=Ft();try{n&&e.isDisposed;const s=r(a),i=t(s);o(a,i)}catch(e){wo(a,e)}finally{Pt(i,"mono.callCsFunction:",s)}}}(g):2==c&&_?function(e){const t=e.fn,r=e.arg_marshalers[0],o=e.arg_marshalers[1],s=e.res_converter,a=e.fqn;return e=null,function(i){const c=Ft();try{n&&e.isDisposed;const a=r(i),c=o(i),l=t(a,c);s(i,l)}catch(e){wo(i,e)}finally{Pt(c,"mono.callCsFunction:",a)}}}(g):ar(g):function(e){const t=e.fn,r=e.arg_marshalers[0],o=e.fqn;return e=null,function(s){const a=Ft();try{n&&e.isDisposed;const o=r(s);t(o)}catch(e){wo(s,e)}finally{Pt(a,"mono.callCsFunction:",o)}}}(g):function(e){const t=e.fn,r=e.fqn;return e=null,function(o){const s=Ft();try{n&&e.isDisposed,t()}catch(e){wo(o,e)}finally{Pt(s,"mono.callCsFunction:",r)}}}(g);let y=b;y[xn]=g,sr[a]=y,Pt(t,"mono.bindJsFunction:",o)}(e),0}catch(e){return Ne(function(e){let t="unknown exception";if(e){t=e.toString();const n=e.stack;n&&(n.startsWith(t)?t=n:t+="\n"+n),t=Xe(t)}return t}(e))}},function(e,t){!function(e,t){lt.assert_runtime_running();const n=Fr(e);n&&"function"==typeof n&&n[En]||mt(!1,`Bound function handle expected ${e}`),n(t=oe(t,0))}(e,t)},function(e,t){lt.assert_runtime_running(),t=oe(t,0);const n=sr[e];n||mt(!1,`Imported function handle expected ${e}`),n(t)},function(e){gr((()=>function(e){if(!lt.is_runtime_running())return void(lt.diagnosticTracing&&ze("This promise resolution/rejection can't be propagated to managed code, mono runtime already exited."));const t=Ln(e=oe(e,0),0),r=n;try{lt.assert_runtime_running();const n=Ln(e,1),o=Ln(e,2),s=Ln(e,3),a=zn(o),i=Qn(o),c=Fr(i);c||mt(!1,`Cannot find Promise for JSHandle ${i}`),c.resolve_or_reject(a,i,s),r||(Wn(n,1),Wn(t,0))}catch(e){wo(t,e)}}(e)))},function(e){gr((()=>function(e){if(!lt.is_runtime_running())return void(lt.diagnosticTracing&&ze("This promise can't be canceled, mono runtime already exited."));const t=qr(e);t||mt(!1,`Expected Promise for GCHandle ${e}`),t.cancel()}(e)))},function(e,t,n,r,o,s,a){try{const i=Re(n,n+2*r),c=Pc(i);if(!c&&i)return Be(o,o+2*i.length,i),T(a,i.length),0;const l=Pc(Re(e,e+2*t));if(!c||!l)throw new Error(`Locale or culture name is null or empty. localeName=${c}, cultureName=${l}`);const p=c.split("-");let u,d;try{const e=p.length>1?p.pop():void 0;d=e?new Intl.DisplayNames([l],{type:"region"}).of(e):void 0;const t=p.join("-");u=new Intl.DisplayNames([l],{type:"language"}).of(t)}catch(e){if(!(e instanceof RangeError))throw e;try{u=new Intl.DisplayNames([l],{type:"language"}).of(c)}catch(e){if(e instanceof RangeError&&i)return Be(o,o+2*i.length,i),T(a,i.length),0;throw e}}const f={LanguageName:u,RegionName:d},_=Object.values(f).join("##");if(!_)throw new Error(`Locale info for locale=${c} is null or empty.`);if(_.length>s)throw new Error(`Locale info for locale=${c} exceeds length of ${s}.`);return Be(o,o+2*_.length,_),T(a,_.length),0}catch(e){return T(a,-1),Ne(e.toString())}},function(e){return pt.ds_rt_websocket_create(e)},function(e,t,n){return pt.ds_rt_websocket_send(e,t,n)},function(e){return pt.ds_rt_websocket_poll(e)},function(e,t,n){return pt.ds_rt_websocket_recv(e,t,n)},function(e){return pt.ds_rt_websocket_close(e)}];async function zc(e,t){try{const n=await Vc(e,t);return lt.mono_exit(n),n}catch(e){try{lt.mono_exit(1,e)}catch(e){}return e&&"number"==typeof e.status?e.status:1}}async function Vc(e,t){null!=e&&""!==e||(e=lt.config.mainAssemblyName)||mt(!1,"Null or empty config.mainAssemblyName"),null==t&&(t=ct.config.applicationArguments),null==t&&(t=tt?(await import(/*! webpackIgnore: true */"process")).argv.slice(2):[]),function(e,t){const n=t.length+1,r=_(4*n);let s=0;Ke.setValue(r+4*s,o.mono_wasm_strdup(e),"i32"),s+=1;for(let e=0;e{const t=setInterval((()=>{1==ct.waitForDebugger&&(clearInterval(t),e())}),100)})));try{return Ke.runtimeKeepalivePush(),await new Promise((e=>globalThis.setTimeout(e,0))),await function(e,t,n){lt.assert_runtime_running();const r=Ke.stackSave();try{const r=$n(5),o=Ln(r,1),s=Ln(r,2),a=Ln(r,3),i=Ln(r,4);uo(s,$e(e)),Uo(a,t&&!t.length?void 0:t,15),no(i,n);let c=sn(o,0,Jt);return wn(ct.managedThreadTID,yn.CallEntrypoint,r),c=an(r,Jt,c),null==c&&(c=Promise.resolve(0)),c[Dr]=!0,c}finally{lt.is_runtime_running()&&Ke.stackRestore(r)}}(e,t,1==ct.waitForDebugger)}finally{Ke.runtimeKeepalivePop()}}function Wc(e){ct.runtimeReady&&(ct.runtimeReady=!1,o.mono_wasm_exit(e))}function Hc(e){if(lt.exitReason=e,ct.runtimeReady){ct.runtimeReady=!1;const t=Qe(e);Ke.abort(t)}throw e}var qc,Gc;const Jc=2147483647&(null!==(Gc=null===(qc=globalThis.performance)||void 0===qc?void 0:qc.timeOrigin)&&void 0!==Gc?Gc:Date.now());function Xc(){return Jc}async function Qc(e){e.out||(e.out=console.log.bind(console)),e.err||(e.err=console.error.bind(console)),e.print||(e.print=e.out),e.printErr||(e.printErr=e.err),lt.out=e.print,lt.err=e.printErr,await async function(){var e;if(tt){if(globalThis.performance===Io){const{performance:e}=et.require("perf_hooks");globalThis.performance=e}if(et.process=await import(/*! webpackIgnore: true */"process"),globalThis.crypto||(globalThis.crypto={}),!globalThis.crypto.getRandomValues){let e;try{e=et.require("node:crypto")}catch(e){}e?e.webcrypto?globalThis.crypto=e.webcrypto:e.randomBytes&&(globalThis.crypto.getRandomValues=t=>{t&&t.set(e.randomBytes(t.length))}):globalThis.crypto.getRandomValues=()=>{throw new Error("Using node without crypto support. To enable current operation, either provide polyfill for 'globalThis.crypto.getRandomValues' or enable 'node:crypto' module.")}}}ct.subtle=null===(e=globalThis.crypto)||void 0===e?void 0:e.subtle}()}function Yc(e){const t=Ft();e.locateFile||(e.locateFile=e.__locateFile=e=>lt.scriptDirectory+e),e.mainScriptUrlOrBlob=lt.scriptUrl;const s=e.instantiateWasm,i=e.preInit?"function"==typeof e.preInit?[e.preInit]:e.preInit:[],l=e.preRun?"function"==typeof e.preRun?[e.preRun]:e.preRun:[],p=e.postRun?"function"==typeof e.postRun?[e.postRun]:e.postRun:[],u=e.onRuntimeInitialized?e.onRuntimeInitialized:()=>{};e.instantiateWasm=(e,t)=>function(e,t,n){const r=Ft();if(n){const o=n(e,((e,n)=>{Pt(r,"mono.instantiateWasm"),ct.afterInstantiateWasm.promise_control.resolve(),t(e,n)}));return o}return async function(e,t){try{await lt.afterConfigLoaded,lt.diagnosticTracing&&ze("instantiate_wasm_module"),await ct.beforePreInit.promise,Ke.addRunDependency("instantiate_wasm_module"),await async function(){const e=lt.simd(),t=lt.relaxedSimd(),n=lt.exceptions();ct.featureWasmSimd=await e,ct.featureWasmRelaxedSimd=await t,ct.featureWasmEh=await n,ct.emscriptenBuildOptions.wasmEnableSIMD&&(ct.featureWasmSimd||mt(!1,"This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://aka.ms/dotnet-wasm-features")),ct.emscriptenBuildOptions.wasmEnableEH&&(ct.featureWasmEh||mt(!1,"This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"))}(),function(e){const t=e.env||e.a;if(!t)return void We("WARNING: Neither imports.env or imports.a were present when instantiating the wasm module. This likely indicates an emscripten configuration issue.");const n=new Array(Mc.length);for(const e in t){const r=t[e];if("function"==typeof r&&-1!==r.toString().indexOf("runtime_idx"))try{const{runtime_idx:t}=r();if(void 0!==n[t])throw new Error(`Duplicate runtime_idx ${t}`);n[t]=e}catch(e){}}for(const[e,r]of Mc.entries()){const o=n[e];if(void 0!==o){if("function"!=typeof t[o])throw new Error(`Expected ${o} to be a function`);t[o]=r}}}(e);const n=await lt.wasmCompilePromise.promise;t(await WebAssembly.instantiate(n,e),n),lt.diagnosticTracing&&ze("instantiate_wasm_module done"),ct.afterInstantiateWasm.promise_control.resolve()}catch(e){throw He("instantiate_wasm_module() failed",e),lt.mono_exit(1,e),e}Ke.removeRunDependency("instantiate_wasm_module")}(e,t),[]}(e,t,s),e.preInit=[()=>function(e){Ke.addRunDependency("mono_pre_init");const t=Ft();try{Ke.addRunDependency("mono_wasm_pre_init_essential"),lt.diagnosticTracing&&ze("mono_wasm_pre_init_essential"),lt.gitHash!==ct.gitHash&&We(`The version of dotnet.runtime.js ${ct.gitHash} is different from the version of dotnet.js ${lt.gitHash}!`),lt.gitHash!==ct.emscriptenBuildOptions.gitHash&&We(`The version of dotnet.native.js ${ct.emscriptenBuildOptions.gitHash} is different from the version of dotnet.js ${lt.gitHash}!`),n!==ct.emscriptenBuildOptions.wasmEnableThreads&&We(`The threads of dotnet.native.js ${ct.emscriptenBuildOptions.wasmEnableThreads} is different from the version of dotnet.runtime.js ${n}!`),function(){const e=[...r];for(const t of e){const e=o,[n,r,s,a,i]=t,l="function"==typeof n;if(!0===n||l)e[r]=function(...t){!l||!n()||mt(!1,`cwrap ${r} should not be called when binding was skipped`);const o=c(r,s,a,i);return e[r]=o,o(...t)};else{const t=c(r,s,a,i);e[r]=t}}}(),s=et,Object.assign(s,{mono_wasm_exit:o.mono_wasm_exit,mono_wasm_profiler_init_aot:a.mono_wasm_profiler_init_aot,mono_wasm_profiler_init_browser_devtools:a.mono_wasm_profiler_init_browser_devtools,mono_wasm_exec_regression:o.mono_wasm_exec_regression,mono_wasm_print_thread_dump:void 0}),Ke.removeRunDependency("mono_wasm_pre_init_essential"),lt.diagnosticTracing&&ze("preInit"),ct.beforePreInit.promise_control.resolve(),e.forEach((e=>e(Ke)))}catch(e){throw He("user preInint() failed",e),lt.mono_exit(1,e),e}var s;(async()=>{try{await async function(){lt.diagnosticTracing&&ze("mono_wasm_pre_init_essential_async"),Ke.addRunDependency("mono_wasm_pre_init_essential_async"),Ke.removeRunDependency("mono_wasm_pre_init_essential_async")}(),Pt(t,"mono.preInit")}catch(e){throw lt.mono_exit(1,e),e}ct.afterPreInit.promise_control.resolve(),Ke.removeRunDependency("mono_pre_init")})()}(i)],e.preRun=[()=>async function(e){Ke.addRunDependency("mono_pre_run_async");try{await ct.afterInstantiateWasm.promise,await ct.afterPreInit.promise,lt.diagnosticTracing&&ze("preRunAsync");const t=Ft();e.map((e=>e(Ke))),Pt(t,"mono.preRun")}catch(e){throw He("preRunAsync() failed",e),lt.mono_exit(1,e),e}ct.afterPreRun.promise_control.resolve(),Ke.removeRunDependency("mono_pre_run_async")}(l)],e.onRuntimeInitialized=()=>async function(e){try{await ct.afterPreRun.promise,lt.diagnosticTracing&&ze("onRuntimeInitialized"),ct.nativeExit=Wc,ct.nativeAbort=Hc;const t=Ft();if(ct.beforeOnRuntimeInitialized.promise_control.resolve(),await ct.coreAssetsInMemory.promise,ct.config.virtualWorkingDirectory){const e=Ke.FS,t=ct.config.virtualWorkingDirectory;try{const n=e.stat(t);n?n&&e.isDir(n.mode)||mt(!1,`FS.chdir: ${t} is not a directory`):Ke.FS_createPath("/",t,!0,!0)}catch(e){Ke.FS_createPath("/",t,!0,!0)}e.chdir(t)}ct.config.interpreterPgo&&setTimeout(Kc,1e3*(ct.config.interpreterPgoSaveDelay||15)),Ke.runtimeKeepalivePush(),n||await async function(){try{const t=Ft(),n=ct.config.environmentVariables||{};lt.diagnosticTracing&&ze("Initializing mono runtime");for(const e in n){const t=n[e];if("string"!=typeof t)throw new Error(`Expected environment variable '${e}' to be a string but it was ${typeof t}: '${t}'`);Zc(e,t)}if(ct.config.runtimeOptions&&function(e){if(!Array.isArray(e))throw new Error("Expected runtimeOptions to be an array of strings");const t=_(4*e.length);let n=0;for(let r=0;raot; in your project file."),null==e&&(e={}),"writeAt"in e||(e.writeAt="System.Runtime.InteropServices.JavaScript.JavaScriptExports::StopProfile"),"sendTo"in e||(e.sendTo="Interop/Runtime::DumpAotProfileData");const t="aot:write-at-method="+e.writeAt+",send-to-method="+e.sendTo;a.mono_wasm_profiler_init_aot(t)}(ct.config.aotProfilerOptions||{}):ct.emscriptenBuildOptions.enableDevToolsProfiler?function(){ct.emscriptenBuildOptions.enableDevToolsProfiler||mt(!1,"DevTools profiler is not enabled, please use browser:callspec=N:Sample in your project file."),Dt=globalThis.performance&&"function"==typeof globalThis.performance.measure;const e=`${ct.config.environmentVariables.DOTNET_WasmPerformanceInstrumentation||"callspec=all"}`;a.mono_wasm_profiler_init_browser_devtools(e)}():ct.emscriptenBuildOptions.enableLogProfiler&&(e=ct.config.logProfilerOptions||{},ct.emscriptenBuildOptions.enableLogProfiler||mt(!1,"Log profiler is not enabled, please use log; in your project file."),e.takeHeapshot||mt(!1,"Log profiler is not enabled, the takeHeapshot method must be defined in LogProfilerOptions.takeHeapshot"),e.configuration||(e.configuration="log:alloc,output=output.mlpd"),e.takeHeapshot?a.mono_wasm_profiler_init_log(`${e.configuration},take-heapshot-method=${e.takeHeapshot}`):a.mono_wasm_profiler_init_log(e.configuration));!function(){var e,t,n,r;lt.diagnosticTracing&&ze("mono_wasm_load_runtime");try{const s=Ft();let a=ct.config.debugLevel;null==a&&(a=0,ct.config.debugLevel&&(a=0+a)),lt.isDebuggingSupported()&&(ct.config.resources.corePdb||ct.config.resources.pdb)||(a=0);const i=new Map;if(null===(t=null===(e=ct.config.runtimeConfig)||void 0===e?void 0:e.runtimeOptions)||void 0===t?void 0:t.configProperties)for(const[e,t]of Object.entries(null===(r=null===(n=ct.config.runtimeConfig)||void 0===n?void 0:n.runtimeOptions)||void 0===r?void 0:r.configProperties))i.set(e,""+t);i.set("APP_CONTEXT_BASE_DIRECTORY","/"),i.set("RUNTIME_IDENTIFIER","browser-wasm");const c=i.size,l=[],p=_(4*i.size),u=_(4*i.size);l.push(p),l.push(u);let d=0;for(const[e,t]of i.entries()){const n=$e(e),r=$e(t);S(p+4*d,n),S(u+4*d,r),d++,l.push(n),l.push(r)}o.mono_wasm_load_runtime(a,c,p,u);for(const e of l)Ke._free(e);Pt(s,"mono.loadRuntime")}catch(e){throw He("mono_wasm_load_runtime () failed",e),lt.mono_exit(1,e),e}}(),function(){if(ma)return;ma=!0;const e=fa(),t=e.tableSize,n=ct.emscriptenBuildOptions.runAOTCompilation?e.tableSize:1,r=ct.emscriptenBuildOptions.runAOTCompilation?e.aotTableSize:1,s=t+n+36*r+1,a=qs();let i=a.length;const c=performance.now();a.grow(s);const l=performance.now();e.enableStats&&Ve(`Allocated ${s} function table entries for jiterpreter, bringing total table size to ${a.length}`),i=_a(0,i,t,ta("mono_jiterp_placeholder_trace")),i=_a(1,i,n,ta("mono_jiterp_placeholder_jit_call"));for(let e=2;e<=37;e++)i=_a(e,i,r,a.get(o.mono_jiterp_get_interp_entry_func(e)));const p=performance.now();e.enableStats&&Ve(`Growing wasm function table took ${l-c}. Filling table took ${p-l}.`)}(),function(){if(!ct.mono_wasm_bindings_is_ready){lt.diagnosticTracing&&ze("bindings_init"),ct.mono_wasm_bindings_is_ready=!0;try{const e=Ft();we||("undefined"!=typeof TextDecoder&&(Se=new TextDecoder("utf-16le"),ve=new TextDecoder("utf-8",{fatal:!1}),Ue=new TextDecoder("utf-8"),Te=new TextEncoder),we=_(12)),Ee||(Ee=function(e){let t;if(de.length>0)t=de.pop();else{const e=function(){if(null==le||!pe){le=_e(ce,"js roots"),pe=new Int32Array(ce),ue=ce;for(let e=0;elt.loadedFiles.push(e.url))),lt.diagnosticTracing&&ze("all assets are loaded in wasm memory"))}(),tl.registerRuntime(it),ct.mono_wasm_runtime_is_ready||function mono_wasm_runtime_ready(){if(et.mono_wasm_runtime_is_ready=ct.mono_wasm_runtime_is_ready=!0,vt=0,St={},Ut=-1,globalThis.dotnetDebugger)debugger}();try{e(Ke)}catch(e){throw He("user callback onRuntimeInitialized() failed",e),e}await async function(){lt.diagnosticTracing&&ze("mono_wasm_after_user_runtime_initialized");try{if(Ke.onDotnetReady)try{await Ke.onDotnetReady()}catch(e){throw He("onDotnetReady () failed",e),e}}catch(e){throw He("mono_wasm_after_user_runtime_initialized () failed",e),e}}(),Pt(t,"mono.onRuntimeInitialized")}catch(e){throw Ke.runtimeKeepalivePop(),He("onRuntimeInitializedAsync() failed",e),lt.mono_exit(1,e),e}ct.afterOnRuntimeInitialized.promise_control.resolve()}(u),e.postRun=[()=>async function(e){try{await ct.afterOnRuntimeInitialized.promise,lt.diagnosticTracing&&ze("postRunAsync");const t=Ft();Ke.FS_createPath("/","usr",!0,!0),Ke.FS_createPath("/","usr/share",!0,!0),e.map((e=>e(Ke))),Pt(t,"mono.postRun")}catch(e){throw He("postRunAsync() failed",e),lt.mono_exit(1,e),e}ct.afterPostRun.promise_control.resolve()}(p)],e.ready.then((async()=>{await ct.afterPostRun.promise,Pt(t,"mono.emscriptenStartup"),ct.dotnetReady.promise_control.resolve(it)})).catch((e=>{ct.dotnetReady.promise_control.reject(e)})),e.ready=ct.dotnetReady.promise}function Zc(e,t){o.mono_wasm_setenv(e,t)}async function Kc(){void 0!==lt.exitCode&&0!==lt.exitCode||await Rc()}async function el(e){}let tl;function nl(r){const o=Ke,a=r,i=globalThis;Object.assign(a.internal,{mono_wasm_exit:e=>{Ke.err("early exit "+e)},forceDisposeProxies:Jr,mono_wasm_dump_threads:void 0,logging:void 0,mono_wasm_stringify_as_error_with_stack:Qe,mono_wasm_get_loaded_files:As,mono_wasm_send_dbg_command_with_parms:Et,mono_wasm_send_dbg_command:xt,mono_wasm_get_dbg_command_info:It,mono_wasm_get_details:Nt,mono_wasm_release_object:Ct,mono_wasm_call_function_on:Bt,mono_wasm_debugger_resume:At,mono_wasm_detach_debugger:jt,mono_wasm_raise_debug_event:Lt,mono_wasm_change_debugger_log_level:$t,mono_wasm_debugger_attached:Rt,mono_wasm_runtime_is_ready:ct.mono_wasm_runtime_is_ready,mono_wasm_get_func_id_to_name_mappings:Ze,get_property:lr,set_property:cr,has_property:pr,get_typeof_property:ur,get_global_this:dr,get_dotnet_instance:()=>it,dynamic_import:mr,mono_wasm_bind_cs_function:wr,ws_wasm_create:bs,ws_wasm_open:ys,ws_wasm_send:ws,ws_wasm_receive:ks,ws_wasm_close:Ss,ws_wasm_abort:vs,ws_get_state:gs,http_wasm_supports_streaming_request:$o,http_wasm_supports_streaming_response:Lo,http_wasm_create_controller:Ro,http_wasm_get_response_type:Mo,http_wasm_get_response_status:zo,http_wasm_abort:No,http_wasm_transform_stream_write:Oo,http_wasm_transform_stream_close:Co,http_wasm_fetch:Po,http_wasm_fetch_stream:Do,http_wasm_fetch_bytes:Fo,http_wasm_get_response_header_names:Vo,http_wasm_get_response_header_values:Wo,http_wasm_get_response_bytes:qo,http_wasm_get_response_length:Ho,http_wasm_get_streamed_response_bytes:Go,jiterpreter_dump_stats:$c,jiterpreter_apply_options:pa,jiterpreter_get_options:fa,interp_pgo_load_data:Bc,interp_pgo_save_data:Rc,mono_wasm_gc_lock:ae,mono_wasm_gc_unlock:ie,monoObjectAsBoolOrNullUnsafe:Fc,monoStringToStringUnsafe:Pe,loadLazyAssembly:Cc,loadSatelliteAssemblies:Dc});const c={stringify_as_error_with_stack:Qe,instantiate_symbols_asset:Is,instantiate_asset:xs,jiterpreter_dump_stats:$c,forceDisposeProxies:Jr,utf8ToString:Le,mono_wasm_process_current_pid:Xc,mono_background_exec:()=>s.mono_background_exec(),mono_wasm_ds_exec:()=>s.mono_wasm_ds_exec()};Object.assign(ct,c);const l={runMain:Vc,runMainAndExit:zc,exit:lt.mono_exit,setEnvironmentVariable:Zc,getAssemblyExports:vr,setModuleImports:ir,getConfig:()=>ct.config,invokeLibraryInitializers:lt.invokeLibraryInitializers,setHeapB32:b,setHeapB8:y,setHeapU8:w,setHeapU16:k,setHeapU32:S,setHeapI8:v,setHeapI16:U,setHeapI32:T,setHeapI52:x,setHeapU52:I,setHeapI64Big:A,setHeapF32:j,setHeapF64:$,getHeapB32:R,getHeapB8:B,getHeapU8:N,getHeapU16:O,getHeapU32:C,getHeapI8:M,getHeapI16:z,getHeapI32:V,getHeapI52:W,getHeapU52:H,getHeapI64Big:q,getHeapF32:G,getHeapF64:J,localHeapViewU8:K,localHeapViewU16:ee,localHeapViewU32:te,localHeapViewI8:X,localHeapViewI16:Q,localHeapViewI32:Y,localHeapViewI64Big:Z,localHeapViewF32:ne,localHeapViewF64:re,collectCpuSamples:null,collectMetrics:null,collectGcDump:null,connectDSRouter:null};return Object.assign(it,{INTERNAL:a.internal,Module:o,runtimeBuildInfo:{productVersion:e,gitHash:ct.gitHash,buildConfiguration:t,wasmEnableThreads:n,wasmEnableSIMD:!0,wasmEnableExceptionHandling:!0},...l}),i.getDotnetRuntime?tl=i.getDotnetRuntime.__list:(i.getDotnetRuntime=e=>i.getDotnetRuntime.__list.getRuntime(e),i.getDotnetRuntime.__list=tl=new rl),it}class rl{constructor(){this.list={}}registerRuntime(e){return void 0===e.runtimeId&&(e.runtimeId=Object.keys(this.list).length),this.list[e.runtimeId]=yr(e),lt.config.runtimeId=e.runtimeId,e.runtimeId}getRuntime(e){const t=this.list[e];return t?t.deref():void 0}}export{Yc as configureEmscriptenStartup,Qc as configureRuntimeStartup,el as configureWorkerStartup,nl as initializeExports,Ao as initializeReplacements,dt as passEmscriptenInternals,tl as runtimeList,ft as setRuntimeGlobals}; +//# sourceMappingURL=dotnet.runtime.js.map diff --git a/_framework/dotnet.runtime.2tx45g8lli.js.br b/_framework/dotnet.runtime.2tx45g8lli.js.br new file mode 100644 index 0000000..4af6fc3 Binary files /dev/null and b/_framework/dotnet.runtime.2tx45g8lli.js.br differ diff --git a/_framework/dotnet.runtime.2tx45g8lli.js.gz b/_framework/dotnet.runtime.2tx45g8lli.js.gz new file mode 100644 index 0000000..7df8498 Binary files /dev/null and b/_framework/dotnet.runtime.2tx45g8lli.js.gz differ diff --git a/_framework/icudt_CJK.tjcz0u77k5.dat b/_framework/icudt_CJK.tjcz0u77k5.dat new file mode 100755 index 0000000..118a60d Binary files /dev/null and b/_framework/icudt_CJK.tjcz0u77k5.dat differ diff --git a/_framework/icudt_CJK.tjcz0u77k5.dat.br b/_framework/icudt_CJK.tjcz0u77k5.dat.br new file mode 100644 index 0000000..8c76517 Binary files /dev/null and b/_framework/icudt_CJK.tjcz0u77k5.dat.br differ diff --git a/_framework/icudt_CJK.tjcz0u77k5.dat.gz b/_framework/icudt_CJK.tjcz0u77k5.dat.gz new file mode 100644 index 0000000..8d50c88 Binary files /dev/null and b/_framework/icudt_CJK.tjcz0u77k5.dat.gz differ diff --git a/_framework/icudt_EFIGS.tptq2av103.dat b/_framework/icudt_EFIGS.tptq2av103.dat new file mode 100755 index 0000000..e4c1c91 Binary files /dev/null and b/_framework/icudt_EFIGS.tptq2av103.dat differ diff --git a/_framework/icudt_EFIGS.tptq2av103.dat.br b/_framework/icudt_EFIGS.tptq2av103.dat.br new file mode 100644 index 0000000..d8755b4 Binary files /dev/null and b/_framework/icudt_EFIGS.tptq2av103.dat.br differ diff --git a/_framework/icudt_EFIGS.tptq2av103.dat.gz b/_framework/icudt_EFIGS.tptq2av103.dat.gz new file mode 100644 index 0000000..edc6716 Binary files /dev/null and b/_framework/icudt_EFIGS.tptq2av103.dat.gz differ diff --git a/_framework/icudt_no_CJK.lfu7j35m59.dat b/_framework/icudt_no_CJK.lfu7j35m59.dat new file mode 100755 index 0000000..87b08e0 Binary files /dev/null and b/_framework/icudt_no_CJK.lfu7j35m59.dat differ diff --git a/_framework/icudt_no_CJK.lfu7j35m59.dat.br b/_framework/icudt_no_CJK.lfu7j35m59.dat.br new file mode 100644 index 0000000..3acc4ee Binary files /dev/null and b/_framework/icudt_no_CJK.lfu7j35m59.dat.br differ diff --git a/_framework/icudt_no_CJK.lfu7j35m59.dat.gz b/_framework/icudt_no_CJK.lfu7j35m59.dat.gz new file mode 100644 index 0000000..6b797ef Binary files /dev/null and b/_framework/icudt_no_CJK.lfu7j35m59.dat.gz differ diff --git a/_framework/storage.js b/_framework/storage.js new file mode 100755 index 0000000..b32b9e3 --- /dev/null +++ b/_framework/storage.js @@ -0,0 +1,2 @@ +var Pe=Object.defineProperty;var ze=(l,e,t)=>e in l?Pe(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var g=(l,e)=>()=>(l&&(e=l(l=0)),e);var B=(l,e)=>{for(var t in e)Pe(l,t,{get:e[t],enumerable:!0})};var S=(l,e,t)=>(ze(l,typeof e!="symbol"?e+"":e,t),t);var qe,R,Z=g(()=>{qe={ReadableStream:globalThis.ReadableStream,WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},R=qe});var te={};B(te,{FileHandle:()=>O,FolderHandle:()=>N,Sink:()=>ee,default:()=>$e});var _,Ge,f,Ke,E,Te,Ve,de,kr,Xe,ee,O,N,Ye,$e,re=g(()=>{U();Z();({File:_,Blob:Ge,DOMException:f}=R),{INVALID:Ke,GONE:E,MISMATCH:Te,MOD_ERR:Ve,SYNTAX:de,SECURITY:kr,DISALLOWED:Xe}=I,ee=class{constructor(e,t){this.fileHandle=e,this.file=t,this.size=t.size,this.position=0}write(e){let t=this.file;if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.position=e.position,this.size=0){if(this.size=0){t=e.sizet.size&&(this.position=t.size),this.file=t;return}else throw new f(...de("truncate requires a size argument"))}e=new Ge([e]);let r=this.file,i=r.slice(0,this.position),n=r.slice(this.position+e.size),s=this.position-i.size;s<0&&(s=0),r=new _([i,new Uint8Array(s),e,n],r.name),this.size=r.size,this.position+=e.size,this.file=r}close(){if(this.fileHandle._deleted)throw new f(...E);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}},O=class{constructor(e="",t=new _([],e),r=!0){this._file=t,this.name=e,this.kind="file",this._deleted=!1,this.writable=r,this.readable=!0}async getFile(){if(this._deleted)throw new f(...E);return this._file}async createWritable(e){if(!this.writable)throw new f(...Xe);if(this._deleted)throw new f(...E);let t=e.keepExistingData?await this.getFile():new _([],this.name);return new ee(this,t)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}},N=class{constructor(e,t=!0){this.name=e,this.kind="directory",this._deleted=!1,this._entries={},this.writable=t,this.readable=!0}async*entries(){if(this._deleted)throw new f(...E);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,t){if(this._deleted)throw new f(...E);let r=this._entries[e];if(r){if(r instanceof O)throw new f(...Te);return r}else{if(t.create)return this._entries[e]=new N(e);throw new f(...E)}}async getFileHandle(e,t){let r=this._entries[e],i=r instanceof O;if(r&&i)return r;if(r&&!i)throw new f(...Te);if(!r&&!t.create)throw new f(...E);if(!r&&t.create)return this._entries[e]=new O(e)}async removeEntry(e,t){let r=this._entries[e];if(!r)throw new f(...E);await r._destroy(t.recursive),delete this._entries[e]}async _destroy(e){for(let t of Object.values(this._entries)){if(!e)throw new f(...Ve);await t._destroy(e)}this._entries={},this._deleted=!0}},Ye=new N(""),$e=()=>Ye});var ue={};B(ue,{FileHandle:()=>V,FolderHandle:()=>x,default:()=>Qe});var Je,ie,V,x,Qe,pe=g(()=>{U();({DISALLOWED:Je}=I),ie=class{constructor(e,t){this.writer=e,this.fileEntry=t}async write(e){if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.writer.seek(e.position),this.writer.position!==e.position&&(await new Promise((t,r)=>{this.writer.onwriteend=t,this.writer.onerror=r,this.writer.truncate(e.position)}),this.writer.seek(e.position))),!("data"in e))throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. write requires a data argument","SyntaxError");e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.writer.seek(e.position),this.writer.position!==e.position)throw new DOMException("seeking position failed","InvalidStateError");return}else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. seek requires a position argument","SyntaxError");else if(e.type==="truncate")return new Promise(t=>{if(Number.isInteger(e.size)&&e.size>=0)this.writer.onwriteend=r=>t(),this.writer.truncate(e.size);else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. truncate requires a size argument","SyntaxError")})}await new Promise((t,r)=>{this.writer.onwriteend=t,this.writer.onerror=r,this.writer.write(new Blob([e]))})}close(){return new Promise(this.fileEntry.file.bind(this.fileEntry))}},V=class{constructor(e,t=!0){this.file=e,this.kind="file",this.writable=t,this.readable=!0}get name(){return this.file.name}isSameEntry(e){return this.file.toURL()===e.file.toURL()}getFile(){return new Promise(this.file.file.bind(this.file))}createWritable(e){if(!this.writable)throw new DOMException(...Je);return new Promise((t,r)=>this.file.createWriter(i=>{e.keepExistingData===!1?(i.onwriteend=n=>t(new ie(i,this.file)),i.truncate(0)):t(new ie(i,this.file))},r))}},x=class{constructor(e,t=!0){this.dir=e,this.writable=t,this.readable=!0,this.kind="directory",this.name=e.name}isSameEntry(e){return this.dir.fullPath===e.dir.fullPath}async*entries(){let e=this.dir.createReader(),t=await new Promise(e.readEntries.bind(e));for(let r of t)yield[r.name,r.isFile?new V(r,this.writable):new x(r,this.writable)]}getDirectoryHandle(e,t){return new Promise((r,i)=>{this.dir.getDirectory(e,t,n=>{r(new x(n))},i)})}getFileHandle(e,t){return new Promise((r,i)=>this.dir.getFile(e,t,n=>r(new V(n)),i))}async removeEntry(e,t){let r=await this.getDirectoryHandle(e,{create:!1}).catch(i=>i.name==="TypeMismatchError"?this.getFileHandle(e,{create:!1}):i);if(r instanceof Error)throw r;return new Promise((i,n)=>{r instanceof x?t.recursive?r.dir.removeRecursively(()=>i(),n):r.dir.remove(()=>i(),n):r.file&&r.file.remove(()=>i(),n)})}},Qe=(l={})=>new Promise((e,t)=>window.webkitRequestFileSystem(l._persistent,0,r=>e(new x(r.root)),t))});var P,Ze,ne,X,ae=g(()=>{P=Symbol("adapter"),ne=class{constructor(e){S(this,Ze);S(this,"name");S(this,"kind");this.kind=e.kind,this.name=e.name,this[P]=e}async queryPermission({mode:e="read"}={}){let t=this[P];if(t.queryPermission)return t.queryPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){let t=this[P];if(t.requestPermission)return t.requestPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[P].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[P]?!1:this[P].isSameEntry(e[P])}};Ze=P;Object.defineProperty(ne.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});X=ne});var et,k,me,fe=g(()=>{Z();({WritableStream:et}=R),k=class extends et{constructor(...e){super(...e),Object.setPrototypeOf(this,k.prototype),this._closed=!1}close(){this._closed=!0;let e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));let t=this.getWriter(),r=t.write(e);return t.releaseLock(),r}};Object.defineProperty(k.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(k.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});me=k});var L={};B(L,{FileSystemFileHandle:()=>j,default:()=>De});var se,tt,j,De,C=g(()=>{ae();fe();se=Symbol("adapter"),j=class extends X{constructor(t){super(t);S(this,tt);this[se]=t}async createWritable(t={}){return new me(await this[se].createWritable(t))}async getFile(){return this[se].getFile()}};tt=se;Object.defineProperty(j.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(j.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});De=j});var oe={};B(oe,{FileSystemDirectoryHandle:()=>w,default:()=>He});var T,rt,w,He,Y=g(()=>{ae();T=Symbol("adapter"),w=class extends X{constructor(t){super(t);S(this,rt);this[T]=t}async getDirectoryHandle(t,r={}){if(t==="")throw new TypeError("Name can't be an empty string.");if(t==="."||t===".."||t.includes("/"))throw new TypeError("Name contains invalid characters.");r.create=!!r.create;let i=await this[T].getDirectoryHandle(t,r);return new w(i)}async*entries(){let{FileSystemFileHandle:t}=await Promise.resolve().then(()=>(C(),L));for await(let[r,i]of this[T].entries())yield[i.name,i.kind==="file"?new t(i):new w(i)]}async*getEntries(){let{FileSystemFileHandle:t}=await Promise.resolve().then(()=>(C(),L));console.warn("deprecated, use .entries() instead");for await(let r of this[T].entries())yield r.kind==="file"?new t(r):new w(r)}async getFileHandle(t,r={}){let{FileSystemFileHandle:i}=await Promise.resolve().then(()=>(C(),L));if(t==="")throw new TypeError("Name can't be an empty string.");if(t==="."||t===".."||t.includes("/"))throw new TypeError("Name contains invalid characters.");r.create=!!r.create;let n=await this[T].getFileHandle(t,r);return new i(n)}async removeEntry(t,r={}){if(t==="")throw new TypeError("Name can't be an empty string.");if(t==="."||t===".."||t.includes("/"))throw new TypeError("Name contains invalid characters.");return r.recursive=!!r.recursive,this[T].removeEntry(t,r)}async resolve(t){if(await t.isSameEntry(this))return[];let r=[{handle:this,path:[]}];for(;r.length;){let{handle:i,path:n}=r.pop();for await(let s of i.values()){if(await s.isSameEntry(t))return[...n,s.name];s.kind==="directory"&&r.push({handle:s,path:[...n,s.name]})}}return null}async*keys(){for await(let[t]of this[T].entries())yield t}async*values(){for await(let[t,r]of this)yield r}[(rt=T,Symbol.asyncIterator)](){return this.entries()}};Object.defineProperty(w.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(w.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});He=w});var be={};B(be,{config:()=>it,errors:()=>I,fromDataTransfer:()=>nt,getDirHandlesFromInput:()=>at,getFileHandlesFromInput:()=>st});async function nt(l){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");let[e,t,r]=await Promise.all([Promise.resolve().then(()=>(re(),te)),Promise.resolve().then(()=>(pe(),ue)),Promise.resolve().then(()=>(Y(),oe))]),i=new e.FolderHandle("",!1);return i._entries=l.map(n=>n.isFile?new t.FileHandle(n,!1):new t.FolderHandle(n,!1)),new r.FileSystemDirectoryHandle(i)}async function at(l){let{FolderHandle:e,FileHandle:t}=await Promise.resolve().then(()=>(re(),te)),{FileSystemDirectoryHandle:r}=await Promise.resolve().then(()=>(Y(),oe)),i=Array.from(l.files),n=i[0].webkitRelativePath.split("/",1)[0],s=new e(n,!1);return i.forEach(o=>{let a=o.webkitRelativePath.split("/");a.shift();let c=a.pop(),u=a.reduce((p,b)=>(p._entries[b]||(p._entries[b]=new e(b,!1)),p._entries[b]),s);u._entries[c]=new t(o.name,o,!1)}),new r(s)}async function st(l){let{FileHandle:e}=await Promise.resolve().then(()=>(re(),te)),{FileSystemFileHandle:t}=await Promise.resolve().then(()=>(C(),L));return Array.from(l.files).map(r=>new t(new e(r.name,r,!1)))}var I,it,U=g(()=>{I={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:l=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${l}`,"SyntaxError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},it={writable:globalThis.WritableStream}});var Be={};B(Be,{FileHandle:()=>we});var ke,Le,dt,Me,ut,pt,we,mt,ft,bt,yt,ht,ge,ve,Ae=g(()=>{U();Z();({WritableStream:ke,TransformStream:Le,DOMException:dt,Blob:Me}=R),{GONE:ut}=I,pt=/constructor/i.test(window.HTMLElement)||window.safari||window.WebKitPoint,we=class{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new dt(...ut)}async isSameEntry(e){return this===e}async createWritable(e={}){var s;let t=await((s=navigator.serviceWorker)==null?void 0:s.getRegistration()),r=document.createElement("a"),i=new Le,n=i.writable;if(r.download=this.name,pt||!t){let o=[];i.readable.pipeTo(new ke({write(a){o.push(new Me([a]))},close(){let a=new Me(o,{type:"application/octet-stream; charset=utf-8"});o=[],r.href=URL.createObjectURL(a),r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e4)}}))}else{let{writable:o,readablePort:a}=new ve(ke),c=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),u={"content-disposition":"attachment; filename*=UTF-8''"+c,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},p=setTimeout(()=>t.active.postMessage(0),1e4);i.readable.pipeThrough(new Le({transform(y,M){if(y instanceof Uint8Array)return M.enqueue(y);let $=new Response(y).body.getReader(),q=gt=>$.read().then(xe=>xe.done?0:q(M.enqueue(xe.value)));return q()}})).pipeTo(o).finally(()=>{clearInterval(p)}),t.active.postMessage({url:t.scope+c,headers:u,readablePort:a},[a]);let b=document.createElement("iframe");b.hidden=!0,b.src=t.scope+c,document.body.appendChild(b)}return n.getWriter()}},mt=0,ft=0,bt=1,yt=1,ht=2,ge=class{constructor(e){e.onmessage=t=>this._onMessage(t.data),this._port=e,this._resetReady()}start(e){return this._controller=e,this._readyPromise}write(e){let t={type:mt,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:ht}),this._port.close()}abort(e){this._port.postMessage({type:yt,reason:e}),this._port.close()}_onMessage(e){e.type===ft&&this._resolveReady(),e.type===bt&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}},ve=class{constructor(e){let t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new ge(t.port2))}}});var le=class{constructor(e){this.database=e}openStore(e,t){return this.database.transaction(e,t).objectStore(e)}async put(e,t,r){let i=this.openStore(e,"readwrite");return await new Promise((n,s)=>{let o=i.put(t,r);o.onsuccess=()=>{n(o.result)},o.onerror=()=>{s(o.error)}})}get(e,t){let r=this.openStore(e,"readonly");return new Promise((i,n)=>{let s=r.get(t);s.onsuccess=()=>{i(s.result)},s.onerror=()=>{n(s.error)}})}async delete(e,t){let r=this.openStore(e,"readwrite");return await new Promise((i,n)=>{let s=r.delete(t);s.onsuccess=()=>{i()},s.onerror=()=>{n(s.error)}})}close(){this.database.close()}},ce=class{constructor(e,t){this.databaseName=e;this.objectStores=t}async connect(){let e=window.indexedDB.open(this.databaseName,1);return e.onupgradeneeded=t=>{let r=t.target.result;this.objectStores.forEach(i=>{r.createObjectStore(i)})},await new Promise((t,r)=>{e.onsuccess=i=>{t(new le(i.target.result))},e.onerror=i=>{r(i.target.error)}})}},A="fileBookmarks",G=new ce("AvaloniaDb",[A]);var J=class{static getCaretCoordinates(e,t,r){var p,b;if(!Ce)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");let i=(p=r==null?void 0:r.debug)!=null?p:!1;if(i){let y=document.querySelector("#input-textarea-caret-position-mirror-div");y&&((b=y.parentNode)==null||b.removeChild(y))}let n=document.createElement("div");n.id="input-textarea-caret-position-mirror-div",document.body.appendChild(n);let s=n.style,o=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,a=e.nodeName==="INPUT";s.whiteSpace="pre-wrap",a||(s.wordWrap="break-word"),s.position="absolute",i||(s.visibility="hidden"),Re.forEach(y=>{if(a&&y==="lineHeight")if(o.boxSizing==="border-box"){let M=parseInt(o.height),$=parseInt(o.paddingTop)+parseInt(o.paddingBottom)+parseInt(o.borderTopWidth)+parseInt(o.borderBottomWidth),q=$+parseInt(o.lineHeight);M>q?s.lineHeight=`${M-$}px`:M===q?s.lineHeight=o.lineHeight:s.lineHeight="0"}else s.lineHeight=o.height;else s[y]=o[y]}),_e?e.scrollHeight>parseInt(o.height)&&(s.overflowY="scroll"):s.overflow="hidden",n.textContent=e.value.substring(0,t),a&&(n.textContent=n.textContent.replace(/\s/g,"\xA0"));let c=document.createElement("span");c.textContent=e.value.substring(t)||".",n.appendChild(c);let u={top:c.offsetTop+parseInt(o.borderTopWidth),left:c.offsetLeft+parseInt(o.borderLeftWidth),height:parseInt(o.lineHeight)};return i?c.style.backgroundColor="#aaa":document.body.removeChild(n),u}},Re=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],Ce=typeof window!="undefined",_e=Ce&&window.mozInnerScreenX!=null;var d=class{static get InputHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.InputHelper}static get DomHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.DomHelper}static get TimerHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.TimerHelper}static get CanvasHelper(){var e;return(e=this.resolvedExports)==null?void 0:e.Avalonia.Browser.Interop.CanvasHelper}};async function Oe(){let l=await globalThis.getDotnetRuntime(0);if(l!=null)return d.resolvedExports=await l.getAssemblyExports("Avalonia.Browser.dll"),d.resolvedExports}d.exportsPromise=Oe();var Q=class{static initializeBackgroundHandlers(){this.clipboardState===0&&(globalThis.document.addEventListener("paste",e=>{if(this.clipboardState!==2||!this.resolveClipboard)return;let t=this.getDataTransferItems(e.clipboardData);this.resolveClipboard(t.map(r=>({type:"dataTransferItem",value:r})))}),this.clipboardState=1)}static getDataTransferItems(e){let t=e==null?void 0:e.items;return t==null?[]:Array.from(t)}static isClipboardFormatSupported(e){return ClipboardItem.supports?ClipboardItem.supports(e):e==="text/plain"||e==="text/html"||e==="image/png"}static createWriteableClipboardSource(){return{items:[]}}static createWriteableClipboardItem(e){let t={data:{}};return e.items.push(t),t}static addStringToWriteableClipboardItem(e,t,r){e.data[t]=r}static addBytesToWriteableClipboardItem(e,t,r){let i=r.slice(0,r.byteLength);e.data[t]=new Blob([i],{type:t})}static async readClipboard(e){let t=e.navigator.clipboard;if(t.read)return(await t.read()).map(i=>({type:"clipboardItem",value:i}));if(t.readText)return[{type:"string",value:await t.readText()}];try{return await new Promise((r,i)=>{this.clipboardState=2,this.resolveClipboard=r,this.rejectClipboard=i})}finally{this.clipboardState=1,this.resolveClipboard=void 0,this.rejectClipboard=void 0}}static async writeClipboard(e,t){var i;let r=(i=t==null?void 0:t.items)!=null?i:[];if(r.length===0){await e.navigator.clipboard.writeText("");return}return e.navigator.clipboard.write?await e.navigator.clipboard.write(r.map(n=>new ClipboardItem(n.data))):await this.writeFirstText(e,r)}static async writeFirstText(e,t){for(let r of t)for(let i in r.data){if(!i.startsWith("text/"))continue;let n=r.data[i];typeof n!="string"&&(n=""),await e.navigator.clipboard.writeText(n);return}}static getReadableDataItemFormats(e){switch(e.type){case"clipboardItem":return e.value.types;case"dataTransferItem":switch(e.value.kind){case"string":return[e.value.type];case"file":return["Files"];default:return[]}case"string":return["text/plain"];default:return[]}}static async tryGetReadableDataItemValueAsync(e,t){switch(e.type){case"clipboardItem":{let i=e.value;if(!i.types.includes(t))return null;let n=await i.getType(t);return t.startsWith("text/")?{type:"string",value:await n.text()}:{type:"bytes",value:await this.getBlobBytes(n)}}case"dataTransferItem":{let i=e.value;switch(i.kind){case"string":{if(t!==i.type)return null;let n=await new Promise(s=>i.getAsString(o=>s(o)));return{type:"string",value:n}}case"file":{if(t!=="Files")return null;let n=i.getAsFile();return n==null?null:{type:"file",value:m.createFromFile(n)}}default:return null}}case"string":return t.startsWith("text/")?{type:"string",value:e.value}:{type:"bytes",value:await this.getBlobBytes(new Blob([e.value]))};default:return null}}static tryGetReadableDataItemValue(e,t){if(e.type!=="dataTransferItem")return null;let i=e.value;switch(i.kind){case"string":{if(t!==i.type)return null;let n="";return i.getAsString(function(s){n=s}),{type:"string",value:n}}case"file":{if(t!=="Files")return null;let n=i.getAsFile();return n==null?null:{type:"file",value:m.createFromFile(n)}}default:return null}}static async getBlobBytes(e){return e.bytes?await e.bytes():new Uint8Array(await e.arrayBuffer())}static subscribeInputEvents(e,t){let r=this.subscribeKeyEvents(e,t),i=this.subscribePointerEvents(e,t),n=this.subscribeTextEvents(e,t),s=this.subscribeDropEvents(e,t),o=this.subscribeKeyboardGeometryChange(e,t);return()=>{r(),i(),n(),s(),o()}}static subscribeKeyEvents(e,t){let r=n=>{d.InputHelper.OnKeyDown(t,n.code,n.key,this.getModifiers(n)).then(s=>{(!s||this.clipboardState!==2)&&n.preventDefault()})};e.addEventListener("keydown",r);let i=n=>{d.InputHelper.OnKeyUp(t,n.code,n.key,this.getModifiers(n)).then(s=>{s||n.preventDefault()}),this.rejectClipboard&&this.rejectClipboard()};return e.addEventListener("keyup",i),()=>{e.removeEventListener("keydown",r),e.removeEventListener("keyup",i)}}static subscribeTextEvents(e,t){let r=o=>{d.InputHelper.OnCompositionStart(t)};e.addEventListener("compositionstart",r);let i=o=>{let a=o.getTargetRanges(),c=-1,u=-1;a.length>0&&(c=a[0].startOffset,u=a[0].endOffset),o.inputType==="insertCompositionText"&&(c=2,u=c+2),d.InputHelper.OnBeforeInput(t,o.inputType,c,u)};e.addEventListener("beforeinput",i);let n=o=>{d.InputHelper.OnCompositionUpdate(t,o.data)};e.addEventListener("compositionupdate",n);let s=o=>{d.InputHelper.OnCompositionEnd(t,o.data),o.preventDefault()};return e.addEventListener("compositionend",s),()=>{e.removeEventListener("compositionstart",r),e.removeEventListener("compositionupdate",n),e.removeEventListener("compositionend",s)}}static subscribePointerEvents(e,t){let r=a=>{d.InputHelper.OnPointerMove(t,a.pointerType,a.pointerId,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a),a),a.preventDefault()},i=a=>{d.InputHelper.OnPointerDown(t,a.pointerType,a.pointerId,a.button,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a)),a.preventDefault()},n=a=>{d.InputHelper.OnPointerUp(t,a.pointerType,a.pointerId,a.button,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a)),a.preventDefault()},s=a=>{d.InputHelper.OnPointerCancel(t,a.pointerType,a.pointerId,a.offsetX,a.offsetY,a.pressure,a.tiltX,a.tiltY,a.twist,this.getModifiers(a))},o=a=>{d.InputHelper.OnWheel(t,a.offsetX,a.offsetY,a.deltaX,a.deltaY,this.getModifiers(a)),a.preventDefault()};return e.addEventListener("pointermove",r),e.addEventListener("pointerdown",i),e.addEventListener("pointerup",n),e.addEventListener("wheel",o),e.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerover",r),e.removeEventListener("pointerdown",i),e.removeEventListener("pointerup",n),e.removeEventListener("pointercancel",s),e.removeEventListener("wheel",o)}}static subscribeDropEvents(e,t){let r=n=>{let s=n.dataTransfer;if(s==null)return;let o=this.getDataTransferItems(s).map(a=>({type:"dataTransferItem",value:a}));d.InputHelper.OnDragDrop(t,n.type,n.offsetX,n.offsetY,this.getModifiers(n),s,o)},i=n=>{n.preventDefault(),r(n)};return e.addEventListener("dragover",i),e.addEventListener("dragenter",r),e.addEventListener("dragleave",r),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",i),e.removeEventListener("dragenter",r),e.removeEventListener("dragleave",r),e.removeEventListener("drop",i)}}static getCoalescedEvents(e){return e.getCoalescedEvents().flatMap(t=>[t.offsetX,t.offsetY,t.pressure,t.tiltX,t.tiltY,t.twist])}static subscribeKeyboardGeometryChange(e,t){if("virtualKeyboard"in navigator){let r=i=>{let n=e.getBoundingClientRect(),s=i.target.boundingRect;d.InputHelper.OnKeyboardGeometryChange(t,s.x-n.x,s.y-n.y,s.width,s.height)};return navigator.virtualKeyboard.addEventListener("geometrychange",r),()=>{navigator.virtualKeyboard.removeEventListener("geometrychange",r)}}return()=>{}}static clearInput(e){e.value=""}static focusElement(e){e.focus()}static setCursor(e,t){t==="default"?e.style.removeProperty("cursor"):e.style.cursor=t}static setBounds(e,t,r,i,n,s){e.style.left=t.toFixed(0)+"px",e.style.top=r.toFixed(0)+"px";let{left:o,top:a}=J.getCaretCoordinates(e,s);e.style.left=(t-o).toFixed(0)+"px",e.style.top=(r-a).toFixed(0)+"px"}static hide(e){e.style.display="none"}static show(e){e.style.display="block"}static setSurroundingText(e,t,r,i){!e||(e.value=t,e.setSelectionRange(r,i),e.style.width="20px",e.style.width=`${e.scrollWidth}px`)}static getModifiers(e){let t=0;e.ctrlKey&&(t|=2),e.altKey&&(t|=1),e.shiftKey&&(t|=4),e.metaKey&&(t|=8);let r=e.buttons;return r&&(r&1&&(t|=16),r&2&&(t|=e.type==="pen"?2048:32),r&4&&(t|=64),r&8&&(t|=128),r&16&&(t|=256),r&32&&(t|=1024)),t}static setPointerCapture(e,t){e.setPointerCapture(t)}static releasePointerCapture(e,t){e.hasPointerCapture(t)&&e.releasePointerCapture(t)}};Q.clipboardState=0;var D=class{static hasNativeFilePicker(){return"showSaveFilePicker"in globalThis}static isMobile(){var n;let e=(n=globalThis.navigator)==null?void 0:n.userAgentData;if(e)return e.mobile;let t=navigator.userAgent,r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,i=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i;return r.test(t)||i.test(t.substr(0,4))}static isTv(){return navigator.userAgent.includes("SmartTV")}};var H=class{constructor(e,t){this.canvas=e;this.renderTargetType=t}static setSize(e,t,r){e.canvas.width=t,e.canvas.height=r}};function Ue(){var t,r,i,n;let l=globalThis,e=(r=l.Module)!=null?r:(t=l.getDotnetRuntime(0))==null?void 0:t.Module;return(n=(i=e==null?void 0:e.GL)!=null?i:l.AvaloniaGL)!=null?n:l.SkiaSharpGL}var v=class extends H{constructor(t,r){var o,a;if(v._gl==null&&(v._gl=Ue()),!v._gl)throw new Error("Module.GL object wasn't initialized, WebGL can't be used.");let i={alpha:!0,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!0,majorVersion:r===2?1:2,minorVersion:0,enableExtensionsByDefault:1,explicitSwapControl:0},n=r===2?t.getContext("webgl",i):t.getContext("webgl2",i);if(!n)throw new Error("HTMLCanvasElement.getContext returned null.");let s=v._gl.registerContext(n,i);n.gl_handle=s;super(t,"webgl");this.canvas=t;this.contextHandle=s,this.fboId=(a=(o=n.getParameter(n.FRAMEBUFFER_BINDING))==null?void 0:o.id)!=null?a:0,this.stencil=n.getParameter(n.STENCIL_BITS),this.sample=n.getParameter(n.SAMPLES),this.depth=n.getParameter(n.DEPTH_BITS),this.attrs=i}static getCurrentContext(){var t,r,i;return(i=(r=(t=v._gl)==null?void 0:t.currentContext)==null?void 0:r.handle)!=null?i:0}static makeContextCurrent(t){if(v._gl==null)return!1;let r=v._gl.makeContextCurrent(t);return t===0||r}},W=v;W._gl=null;var z=class extends H{constructor(t){let r=t.getContext("2d",{alpha:!0});if(!r)throw new Error("HTMLCanvasElement.getContext(2d) returned null.");super(t,"software");this.context=r,this.runtime=globalThis.getDotnetRuntime(0)}putPixelData(t,r,i,n){var c;let s=(c=this.runtime)==null?void 0:c.localHeapViewU8(),o;if(s!=null&&s.buffer){if(o=new Uint8ClampedArray(s.buffer,t,r),this.canvas instanceof OffscreenCanvas){let u=new ArrayBuffer(o.byteLength),p=new Uint8ClampedArray(u);p.set(o),o=p}}else throw new Error("Unable to access .NET memory");let a=new ImageData(o,i,n);this.context.putImageData(a,0,0)}static staticPutPixelData(t,r,i,n,s){t.putPixelData(r,i,n,s)}};var h=class{static create(e,t,r){var n,s;let i=h.nextId++;if(e===0)h.registry[i]={canvas:t},h.targets[i]=h.createRenderTarget(t,r);else{let o=globalThis,a=(s=o.Module)!=null?s:(n=o.getDotnetRuntime(0))==null?void 0:n.Module,c=a==null?void 0:a.PThread;if(c==null)throw new Error("Unable to access emscripten PThread api");let u=c.pthreads[e];if(u==null)throw new Error(`Unable get pthread with id ${e}`);let p;if(u.postMessage!=null?p=u:p=u.worker,p==null)throw new Error(`Unable get Worker for pthread ${e}`);let b=t.transferControlToOffscreen();p.postMessage({avaloniaCmd:"registerCanvas",canvas:b,modes:r,id:i},[b]),h.registry[i]={canvas:t,worker:p}}return i}static initializeWorker(){let e=self.onmessage;self.onmessage=t=>{let r=t;r.data.avaloniaCmd==="registerCanvas"?h.targets[r.data.id]=h.createRenderTarget(r.data.canvas,r.data.modes):r.data.avaloniaCmd==="unregisterCanvas"?delete h.targets[r.data.id]:e!=null&&e.call(self,t)}}static getRenderTarget(e){return h.targets[e]}static createRenderTarget(e,t){for(let r of t)try{return r===1?new z(e):new W(e,r)}catch(i){let n="";i instanceof Error&&(n=": "+i.message),console.error(`Failed to create render target for mode ${r} ${n}`)}return new z(e)}},F=h;F.targets={},F.registry={},F.nextId=1;var m=class{constructor(e,t,r,i){this.handle=e;this.file=t;this.bookmarkId=r;this.wellKnownType=i}get name(){var e;return this.handle?this.handle.name:this.file?this.file.name:(e=this.wellKnownType)!=null?e:""}get kind(){return this.handle?this.handle.kind:this.file?"file":"directory"}static createFromHandle(e,t){return new m(e,void 0,t,void 0)}static createFromFile(e){return new m(void 0,e,void 0,void 0)}static createWellKnownDirectory(e){return new m(void 0,void 0,void 0,e)}static async openRead(e){if(e.file)return e.file;if(!e.handle||e.kind!=="file")throw new Error("StorageItem is not a file");return await e.verityPermissions("read"),await e.handle.getFile()}static async openWrite(e){if(!e.handle||e.kind!=="file")throw new Error("StorageItem is not a writeable file");return await e.verityPermissions("readwrite"),await e.handle.createWritable({keepExistingData:!0})}static async getProperties(e){try{let t=e.handle&&"getFile"in e.handle?await e.handle.getFile():e.file;return t?{Size:t.size,LastModified:t.lastModified,Type:t.type}:null}catch{return null}}static getItemsIterator(e){return e.kind!=="directory"||!e.handle?null:e.handle.entries()}static async createFile(e,t){if(e.kind!=="directory"||!e.handle)throw new TypeError("Unable to create item in the requested directory");return await e.verityPermissions("readwrite"),await e.handle.getFileHandle(t,{create:!0})}static async getFile(e,t){return e.kind!=="directory"||!e.handle?null:(await e.verityPermissions("read"),await e.handle.getFileHandle(t))}static async createFolder(e,t){if(e.kind!=="directory"||!e.handle)throw new TypeError("Unable to create item in the requested directory");return await e.verityPermissions("readwrite"),await e.handle.getDirectoryHandle(t,{create:!0})}static async getFolder(e,t){return e.kind!=="directory"||!e.handle?null:(await e.verityPermissions("read"),await e.handle.getDirectoryHandle(t))}static async deleteAsync(e){return e.handle?(await e.verityPermissions("readwrite"),await e.handle.remove({recursive:!0})):null}static async moveAsync(e,t){if(!e.handle)return null;if(t.kind!=="directory"||!t.handle)throw new TypeError("Unable to move item to the requested directory");return await e.verityPermissions("readwrite"),await e.handle.move(t)}async verityPermissions(e){if(!!this.handle&&!!D.hasNativeFilePicker()&&await this.handle.queryPermission({mode:e})!=="granted"&&await this.handle.requestPermission({mode:e})==="denied")throw new Error("Permissions denied")}static async saveBookmark(e){if(e.bookmarkId)return e.bookmarkId;if(!e.handle||!D.hasNativeFilePicker())return null;let t=await G.connect();try{return await t.put(A,e.handle,e.generateBookmarkId())}finally{t.close()}}static async deleteBookmark(e){if(!e.bookmarkId||!D.hasNativeFilePicker())return;let t=await G.connect();try{await t.delete(A,e.bookmarkId)}finally{t.close()}}generateBookmarkId(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}},K=class{constructor(e){this.items=e}static itemsArray(e){return e.items}static filesToItemsArray(e){if(!e)return[];let t=[];for(let r=0;r(U(),be));return await new Promise(r=>{e.addEventListener("change",r),e.click()}),t.then(r=>r.getDirHandlesFromInput(e))}var ye=ot;var lt={accepts:[]},Ie=globalThis.showOpenFilePicker;async function ct(l={}){let e={...lt,...l};if(Ie&&!l._preferPolyfill)return Ie(e);let t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(i=>[...(i.extensions||[]).map(n=>"."+n),...i.mimeTypes||[]]).flat().join(","),t.style.position="fixed",t.style.top="-100000px",t.style.left="-100000px",document.body.appendChild(t);let r=Promise.resolve().then(()=>(U(),be));return await new Promise(i=>{t.addEventListener("change",i),t.click()}),r.then(i=>i.getFileHandlesFromInput(t))}var he=ct;var We=globalThis.showSaveFilePicker;async function wt(l={}){if(We&&!l._preferPolyfill)return We(l);l._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),l.suggestedName=l._name);let{FileSystemFileHandle:e}=await Promise.resolve().then(()=>(C(),L)),{FileHandle:t}=await Promise.resolve().then(()=>(Ae(),Be));return new e(new t(l.suggestedName))}var Se=wt;globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){let l=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:r},{FileSystemFileHandle:i}]=await Promise.all([Promise.resolve().then(()=>(pe(),ue)),Promise.resolve().then(()=>(Y(),oe)),Promise.resolve().then(()=>(C(),L))]);return l.isFile?new i(new e(l,!1)):new r(new t(l,!1))});Y();C();ae();fe();var Ee=class{static async selectFolderDialog(e,t){var n,s;let r={startIn:(s=(n=e==null?void 0:e.wellKnownType)!=null?n:e==null?void 0:e.handle)!=null?s:void 0,_preferPolyfill:t},i=await ye(r);return m.createFromHandle(i)}static async openFileDialog(e,t,r,i,n){var a,c;let s={startIn:(c=(a=e==null?void 0:e.wellKnownType)!=null?a:e==null?void 0:e.handle)!=null?c:void 0,multiple:t,excludeAcceptAllOption:i,types:r!=null?r:void 0,_preferPolyfill:n},o=await he(s);return new K(o.map(u=>m.createFromHandle(u)))}static async saveFileDialog(e,t,r,i,n){var a,c;let s={startIn:(c=(a=e==null?void 0:e.wellKnownType)!=null?a:e==null?void 0:e.handle)!=null?c:void 0,suggestedName:t!=null?t:void 0,excludeAcceptAllOption:i,types:r!=null?r:void 0,_preferPolyfill:n},o=await Se(s);return m.createFromHandle(o)}static async openBookmark(e){let t=await G.connect();try{let r=await t.get(A,e);return r&&m.createFromHandle(r,e)}finally{t.close()}}static createAcceptType(e,t,r){let i={};return t.forEach(n=>{i[n]=r!=null?r:[]}),{description:e,accept:i}}};export{m as StorageItem,K as StorageItems,Ee as StorageProvider}; +//# sourceMappingURL=storage.js.map diff --git a/_framework/storage.js.br b/_framework/storage.js.br new file mode 100644 index 0000000..15f35ce Binary files /dev/null and b/_framework/storage.js.br differ diff --git a/_framework/storage.js.gz b/_framework/storage.js.gz new file mode 100644 index 0000000..64b9080 Binary files /dev/null and b/_framework/storage.js.gz differ diff --git a/_framework/storage.js.map b/_framework/storage.js.map new file mode 100755 index 0000000..bd78303 --- /dev/null +++ b/_framework/storage.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../webapp/node_modules/native-file-system-adapter/src/config.js", "../webapp/node_modules/native-file-system-adapter/src/adapters/memory.js", "../webapp/node_modules/native-file-system-adapter/src/adapters/sandbox.js", "../webapp/node_modules/native-file-system-adapter/src/FileSystemHandle.js", "../webapp/node_modules/native-file-system-adapter/src/FileSystemWritableFileStream.js", "../webapp/node_modules/native-file-system-adapter/src/FileSystemFileHandle.js", "../webapp/node_modules/native-file-system-adapter/src/FileSystemDirectoryHandle.js", "../webapp/node_modules/native-file-system-adapter/src/util.js", "../webapp/node_modules/native-file-system-adapter/src/adapters/downloader.js", "../webapp/modules/storage/indexedDb.ts", "../webapp/modules/avalonia/caretHelper.ts", "../webapp/modules/avalonia/jsExports.ts", "../webapp/modules/avalonia/input.ts", "../webapp/modules/avalonia/caniuse.ts", "../webapp/modules/avalonia/rendering/webRenderTarget.ts", "../webapp/modules/avalonia/rendering/webGlRenderTarget.ts", "../webapp/modules/avalonia/rendering/softwareRenderTarget.ts", "../webapp/modules/avalonia/rendering/webRenderTargetRegistry.ts", "../webapp/modules/storage/storageItem.ts", "../webapp/node_modules/native-file-system-adapter/src/showDirectoryPicker.js", "../webapp/node_modules/native-file-system-adapter/src/showOpenFilePicker.js", "../webapp/node_modules/native-file-system-adapter/src/showSaveFilePicker.js", "../webapp/node_modules/native-file-system-adapter/src/getOriginPrivateDirectory.js", "../webapp/node_modules/native-file-system-adapter/src/es6.js", "../webapp/modules/storage/storageProvider.ts"], + "sourcesContent": ["const config = {\n ReadableStream: globalThis.ReadableStream,\n WritableStream: globalThis.WritableStream,\n TransformStream: globalThis.TransformStream,\n DOMException: globalThis.DOMException,\n Blob: globalThis.Blob,\n File: globalThis.File,\n}\n\nexport default config\n", "import { errors } from '../util.js'\nimport config from '../config.js'\n\nconst { File, Blob, DOMException } = config\nconst { INVALID, GONE, MISMATCH, MOD_ERR, SYNTAX, SECURITY, DISALLOWED } = errors\n\nexport class Sink {\n\n /**\n * @param {FileHandle} fileHandle\n * @param {File} file\n */\n constructor (fileHandle, file) {\n this.fileHandle = fileHandle\n this.file = file\n this.size = file.size\n this.position = 0\n }\n\n write (chunk) {\n let file = this.file\n\n if (typeof chunk === 'object') {\n if (chunk.type === 'write') {\n if (Number.isInteger(chunk.position) && chunk.position >= 0) {\n this.position = chunk.position\n if (this.size < chunk.position) {\n this.file = new File(\n [this.file, new ArrayBuffer(chunk.position - this.size)],\n this.file.name,\n this.file\n )\n }\n }\n if (!('data' in chunk)) {\n throw new DOMException(...SYNTAX('write requires a data argument'))\n }\n chunk = chunk.data\n } else if (chunk.type === 'seek') {\n if (Number.isInteger(chunk.position) && chunk.position >= 0) {\n if (this.size < chunk.position) {\n throw new DOMException(...INVALID)\n }\n this.position = chunk.position\n return\n } else {\n throw new DOMException(...SYNTAX('seek requires a position argument'))\n }\n } else if (chunk.type === 'truncate') {\n if (Number.isInteger(chunk.size) && chunk.size >= 0) {\n file = chunk.size < this.size\n ? new File([file.slice(0, chunk.size)], file.name, file)\n : new File([file, new Uint8Array(chunk.size - this.size)], file.name)\n\n this.size = file.size\n if (this.position > file.size) {\n this.position = file.size\n }\n this.file = file\n return\n } else {\n throw new DOMException(...SYNTAX('truncate requires a size argument'))\n }\n }\n }\n\n chunk = new Blob([chunk])\n\n let blob = this.file\n // Calc the head and tail fragments\n const head = blob.slice(0, this.position)\n const tail = blob.slice(this.position + chunk.size)\n\n // Calc the padding\n let padding = this.position - head.size\n if (padding < 0) {\n padding = 0\n }\n blob = new File([\n head,\n new Uint8Array(padding),\n chunk,\n tail\n ], blob.name)\n\n this.size = blob.size\n this.position += chunk.size\n\n this.file = blob\n }\n close () {\n if (this.fileHandle._deleted) throw new DOMException(...GONE)\n this.fileHandle._file = this.file\n this.file =\n this.position =\n this.size = null\n if (this.fileHandle.onclose) {\n this.fileHandle.onclose(this.fileHandle)\n }\n }\n}\n\nexport class FileHandle {\n constructor (name = '', file = new File([], name), writable = true) {\n this._file = file\n this.name = name\n this.kind = 'file'\n this._deleted = false\n this.writable = writable\n this.readable = true\n }\n\n async getFile () {\n if (this._deleted) throw new DOMException(...GONE)\n return this._file\n }\n\n async createWritable (opts) {\n if (!this.writable) throw new DOMException(...DISALLOWED)\n if (this._deleted) throw new DOMException(...GONE)\n\n const file = opts.keepExistingData\n ? await this.getFile()\n : new File([], this.name)\n\n return new Sink(this, file)\n }\n\n async isSameEntry (other) {\n return this === other\n }\n\n async _destroy () {\n this._deleted = true\n this._file = null\n }\n}\n\nexport class FolderHandle {\n\n /** @param {string} name */\n constructor (name, writable = true) {\n this.name = name\n this.kind = 'directory'\n this._deleted = false\n /** @type {Object.} */\n this._entries = {}\n this.writable = writable\n this.readable = true\n }\n\n /** @returns {AsyncGenerator<[string, FileHandle | FolderHandle]>} */\n async * entries () {\n if (this._deleted) throw new DOMException(...GONE)\n yield* Object.entries(this._entries)\n }\n\n async isSameEntry (other) {\n return this === other\n }\n\n /**\n * @param {string} name\n * @param {{ create: boolean; }} opts\n */\n async getDirectoryHandle (name, opts) {\n if (this._deleted) throw new DOMException(...GONE)\n const entry = this._entries[name]\n if (entry) { // entry exist\n if (entry instanceof FileHandle) {\n throw new DOMException(...MISMATCH)\n } else {\n return entry\n }\n } else {\n if (opts.create) {\n return (this._entries[name] = new FolderHandle(name))\n } else {\n throw new DOMException(...GONE)\n }\n }\n }\n\n /**\n * @param {string} name\n * @param {{ create: boolean; }} opts\n */\n async getFileHandle (name, opts) {\n const entry = this._entries[name]\n const isFile = entry instanceof FileHandle\n if (entry && isFile) return entry\n if (entry && !isFile) throw new DOMException(...MISMATCH)\n if (!entry && !opts.create) throw new DOMException(...GONE)\n if (!entry && opts.create) {\n return (this._entries[name] = new FileHandle(name))\n }\n }\n\n async removeEntry (name, opts) {\n const entry = this._entries[name]\n if (!entry) throw new DOMException(...GONE)\n await entry._destroy(opts.recursive)\n delete this._entries[name]\n }\n\n async _destroy (recursive) {\n for (let x of Object.values(this._entries)) {\n if (!recursive) throw new DOMException(...MOD_ERR)\n await x._destroy(recursive)\n }\n this._entries = {}\n this._deleted = true\n }\n}\n\nconst fs = new FolderHandle('')\n\nexport default () => fs\n", "/* global Blob, DOMException */\n\nimport { errors } from '../util.js'\n\nconst { DISALLOWED } = errors\n\nclass Sink {\n /**\n * @param {FileWriter} writer\n * @param {FileEntry} fileEntry\n */\n constructor (writer, fileEntry) {\n this.writer = writer\n this.fileEntry = fileEntry\n }\n\n /**\n * @param {BlobPart | Object} chunk\n */\n async write (chunk) {\n if (typeof chunk === 'object') {\n if (chunk.type === 'write') {\n if (Number.isInteger(chunk.position) && chunk.position >= 0) {\n this.writer.seek(chunk.position)\n if (this.writer.position !== chunk.position) {\n await new Promise((resolve, reject) => {\n this.writer.onwriteend = resolve\n this.writer.onerror = reject\n this.writer.truncate(chunk.position)\n })\n this.writer.seek(chunk.position)\n }\n }\n if (!('data' in chunk)) {\n throw new DOMException('Failed to execute \\'write\\' on \\'UnderlyingSinkBase\\': Invalid params passed. write requires a data argument', 'SyntaxError')\n }\n chunk = chunk.data\n } else if (chunk.type === 'seek') {\n if (Number.isInteger(chunk.position) && chunk.position >= 0) {\n this.writer.seek(chunk.position)\n if (this.writer.position !== chunk.position) {\n throw new DOMException('seeking position failed', 'InvalidStateError')\n }\n return\n } else {\n throw new DOMException('Failed to execute \\'write\\' on \\'UnderlyingSinkBase\\': Invalid params passed. seek requires a position argument', 'SyntaxError')\n }\n } else if (chunk.type === 'truncate') {\n return new Promise(resolve => {\n if (Number.isInteger(chunk.size) && chunk.size >= 0) {\n this.writer.onwriteend = evt => resolve()\n this.writer.truncate(chunk.size)\n } else {\n throw new DOMException('Failed to execute \\'write\\' on \\'UnderlyingSinkBase\\': Invalid params passed. truncate requires a size argument', 'SyntaxError')\n }\n })\n }\n }\n await new Promise((resolve, reject) => {\n this.writer.onwriteend = resolve\n this.writer.onerror = reject\n this.writer.write(new Blob([chunk]))\n })\n }\n\n close () {\n return new Promise(this.fileEntry.file.bind(this.fileEntry))\n }\n}\n\nexport class FileHandle {\n /** @param {FileEntry} file */\n constructor (file, writable = true) {\n this.file = file\n this.kind = 'file'\n this.writable = writable\n this.readable = true\n }\n\n get name () {\n return this.file.name\n }\n\n /**\n * @param {{ file: { toURL: () => string; }; }} other\n */\n isSameEntry (other) {\n return this.file.toURL() === other.file.toURL()\n }\n\n /** @return {Promise} */\n getFile () {\n return new Promise(this.file.file.bind(this.file))\n }\n\n /** @return {Promise} */\n createWritable (opts) {\n if (!this.writable) throw new DOMException(...DISALLOWED)\n\n return new Promise((resolve, reject) =>\n this.file.createWriter(fileWriter => {\n if (opts.keepExistingData === false) {\n fileWriter.onwriteend = evt => resolve(new Sink(fileWriter, this.file))\n fileWriter.truncate(0)\n } else {\n resolve(new Sink(fileWriter, this.file))\n }\n }, reject)\n )\n }\n}\n\nexport class FolderHandle {\n /** @param {DirectoryEntry} dir */\n constructor (dir, writable = true) {\n this.dir = dir\n this.writable = writable\n this.readable = true\n this.kind = 'directory'\n this.name = dir.name\n }\n\n /** @param {FolderHandle} other */\n isSameEntry (other) {\n return this.dir.fullPath === other.dir.fullPath\n }\n\n /** @returns {AsyncGenerator<[string, FileHandle | FolderHandle]>} */\n async * entries () {\n const reader = this.dir.createReader()\n const entries = await new Promise(reader.readEntries.bind(reader))\n for (const x of entries) {\n yield [x.name, x.isFile ? new FileHandle(x, this.writable) : new FolderHandle(x, this.writable)]\n }\n }\n\n /**\n * @param {string} name\n * @param {{ create: boolean; }} opts\n * @returns {Promise}\n */\n getDirectoryHandle (name, opts) {\n return new Promise((resolve, reject) => {\n this.dir.getDirectory(name, opts, dir => {\n resolve(new FolderHandle(dir))\n }, reject)\n })\n }\n\n /**\n * @param {string} name\n * @param {{ create: boolean; }} opts\n * @returns {Promise}\n */\n getFileHandle (name, opts) {\n return new Promise((resolve, reject) =>\n this.dir.getFile(name, opts, file => resolve(new FileHandle(file)), reject)\n )\n }\n\n /**\n * @param {string} name\n * @param {{ recursive: boolean; }} opts\n */\n async removeEntry (name, opts) {\n /** @type {Error|FolderHandle|FileHandle} */\n const entry = await this.getDirectoryHandle(name, { create: false }).catch(err =>\n err.name === 'TypeMismatchError' ? this.getFileHandle(name, { create: false }) : err\n )\n\n if (entry instanceof Error) throw entry\n\n return new Promise((resolve, reject) => {\n if (entry instanceof FolderHandle) {\n opts.recursive\n ? entry.dir.removeRecursively(() => resolve(), reject)\n : entry.dir.remove(() => resolve(), reject)\n } else if (entry.file) {\n entry.file.remove(() => resolve(), reject)\n }\n })\n }\n}\n\nexport default (opts = {}) => new Promise((resolve, reject) =>\n window.webkitRequestFileSystem(\n opts._persistent, 0,\n e => resolve(new FolderHandle(e.root)),\n reject\n )\n)\n", "const kAdapter = Symbol('adapter')\n\nclass FileSystemHandle {\n /** @type {FileSystemHandle} */\n [kAdapter]\n\n /** @type {string} */\n name\n /** @type {('file'|'directory')} */\n kind\n\n /** @param {FileSystemHandle & {writable}} adapter */\n constructor (adapter) {\n this.kind = adapter.kind\n this.name = adapter.name\n this[kAdapter] = adapter\n }\n\n async queryPermission ({mode = 'read'} = {}) {\n const handle = this[kAdapter]\n\n if (handle.queryPermission) {\n return handle.queryPermission({mode})\n }\n\n if (mode === 'read') {\n return 'granted'\n } else if (mode === 'readwrite') {\n return handle.writable ? 'granted' : 'denied'\n } else {\n throw new TypeError(`Mode ${mode} must be 'read' or 'readwrite'`)\n }\n }\n\n async requestPermission ({mode = 'read'} = {}) {\n const handle = this[kAdapter]\n if (handle.requestPermission) {\n return handle.requestPermission({mode})\n }\n\n if (mode === 'read') {\n return 'granted'\n } else if (mode === 'readwrite') {\n return handle.writable ? 'granted' : 'denied'\n } else {\n throw new TypeError(`Mode ${mode} must be 'read' or 'readwrite'`)\n }\n }\n\n /**\n * Attempts to remove the entry represented by handle from the underlying file system.\n *\n * @param {object} options\n * @param {boolean} [options.recursive=false]\n */\n async remove (options = {}) {\n await this[kAdapter].remove(options)\n }\n\n /**\n * @param {FileSystemHandle} other\n */\n async isSameEntry (other) {\n if (this === other) return true\n if (\n (!other) ||\n (typeof other !== 'object') ||\n (this.kind !== other.kind) ||\n (!other[kAdapter])\n ) return false\n return this[kAdapter].isSameEntry(other[kAdapter])\n }\n}\n\nObject.defineProperty(FileSystemHandle.prototype, Symbol.toStringTag, {\n value: 'FileSystemHandle',\n writable: false,\n enumerable: false,\n configurable: true\n})\n\nexport default FileSystemHandle\nexport { FileSystemHandle }\n", "import config from './config.js'\n\nconst { WritableStream } = config\n\nclass FileSystemWritableFileStream extends WritableStream {\n constructor (...args) {\n super(...args)\n\n // Stupid Safari hack to extend native classes\n // https://bugs.webkit.org/show_bug.cgi?id=226201\n Object.setPrototypeOf(this, FileSystemWritableFileStream.prototype)\n\n /** @private */\n this._closed = false\n }\n\n close () {\n this._closed = true\n const w = this.getWriter()\n const p = w.close()\n w.releaseLock()\n return p\n // return super.close ? super.close() : this.getWriter().close()\n }\n\n /** @param {number} position */\n seek (position) {\n return this.write({ type: 'seek', position })\n }\n\n /** @param {number} size */\n truncate (size) {\n return this.write({ type: 'truncate', size })\n }\n\n write (data) {\n if (this._closed) {\n return Promise.reject(new TypeError('Cannot write to a CLOSED writable stream'))\n }\n\n const writer = this.getWriter()\n const p = writer.write(data)\n writer.releaseLock()\n return p\n }\n}\n\nObject.defineProperty(FileSystemWritableFileStream.prototype, Symbol.toStringTag, {\n value: 'FileSystemWritableFileStream',\n writable: false,\n enumerable: false,\n configurable: true\n})\n\nObject.defineProperties(FileSystemWritableFileStream.prototype, {\n close: { enumerable: true },\n seek: { enumerable: true },\n truncate: { enumerable: true },\n write: { enumerable: true }\n})\n\nexport default FileSystemWritableFileStream\nexport { FileSystemWritableFileStream }\n", "import FileSystemHandle from './FileSystemHandle.js'\nimport FileSystemWritableFileStream from './FileSystemWritableFileStream.js'\n\nconst kAdapter = Symbol('adapter')\n\nclass FileSystemFileHandle extends FileSystemHandle {\n /** @type {FileSystemFileHandle} */\n [kAdapter]\n\n constructor (adapter) {\n super(adapter)\n this[kAdapter] = adapter\n }\n\n /**\n * @param {Object} [options={}]\n * @param {boolean} [options.keepExistingData]\n * @returns {Promise}\n */\n async createWritable (options = {}) {\n return new FileSystemWritableFileStream(\n await this[kAdapter].createWritable(options)\n )\n }\n\n /**\n * @returns {Promise}\n */\n async getFile () {\n return this[kAdapter].getFile()\n }\n}\n\nObject.defineProperty(FileSystemFileHandle.prototype, Symbol.toStringTag, {\n value: 'FileSystemFileHandle',\n writable: false,\n enumerable: false,\n configurable: true\n})\n\nObject.defineProperties(FileSystemFileHandle.prototype, {\n createWritable: { enumerable: true },\n getFile: { enumerable: true }\n})\n\nexport default FileSystemFileHandle\nexport { FileSystemFileHandle }\n", "import FileSystemHandle from './FileSystemHandle.js'\n\nconst kAdapter = Symbol('adapter')\n\nclass FileSystemDirectoryHandle extends FileSystemHandle {\n /** @type {FileSystemDirectoryHandle} */\n [kAdapter]\n\n constructor (adapter) {\n super(adapter)\n this[kAdapter] = adapter\n }\n\n /**\n * @param {string} name Name of the directory\n * @param {object} [options]\n * @param {boolean} [options.create] create the directory if don't exist\n * @returns {Promise}\n */\n async getDirectoryHandle (name, options = {}) {\n if (name === '') {\n throw new TypeError(`Name can't be an empty string.`)\n }\n if (name === '.' || name === '..' || name.includes('/')) {\n throw new TypeError(`Name contains invalid characters.`)\n }\n options.create = !!options.create\n const handle = await this[kAdapter].getDirectoryHandle(name, options)\n return new FileSystemDirectoryHandle(handle)\n }\n\n /** @returns {AsyncGenerator<[string, FileSystemHandle | FileSystemDirectoryHandle]>} */\n async * entries () {\n const {FileSystemFileHandle} = await import('./FileSystemFileHandle.js')\n\n for await (const [_, entry] of this[kAdapter].entries())\n yield [entry.name, entry.kind === 'file'\n ? new FileSystemFileHandle(entry)\n : new FileSystemDirectoryHandle(entry)]\n }\n\n /** @deprecated use .entries() instead */\n async * getEntries() {\n const {FileSystemFileHandle} = await import('./FileSystemFileHandle.js')\n console.warn('deprecated, use .entries() instead')\n for await (let entry of this[kAdapter].entries())\n yield entry.kind === 'file'\n ? new FileSystemFileHandle(entry)\n : new FileSystemDirectoryHandle(entry)\n }\n\n /**\n * @param {string} name Name of the file\n * @param {object} [options]\n * @param {boolean} [options.create] create the file if don't exist\n */\n async getFileHandle (name, options = {}) {\n const {FileSystemFileHandle} = await import('./FileSystemFileHandle.js')\n if (name === '') throw new TypeError(`Name can't be an empty string.`)\n if (name === '.' || name === '..' || name.includes('/')) {\n throw new TypeError(`Name contains invalid characters.`)\n }\n options.create = !!options.create\n const handle = await this[kAdapter].getFileHandle(name, options)\n return new FileSystemFileHandle(handle)\n }\n\n /**\n * @param {string} name\n * @param {object} [options]\n * @param {boolean} [options.recursive]\n */\n async removeEntry (name, options = {}) {\n if (name === '') {\n throw new TypeError(`Name can't be an empty string.`)\n }\n if (name === '.' || name === '..' || name.includes('/')) {\n throw new TypeError(`Name contains invalid characters.`)\n }\n options.recursive = !!options.recursive // cuz node's fs.rm require boolean\n return this[kAdapter].removeEntry(name, options)\n }\n\n async resolve (possibleDescendant) {\n if (await possibleDescendant.isSameEntry(this)) {\n return []\n }\n\n const openSet = [{ handle: this, path: [] }]\n\n while (openSet.length) {\n let { handle: current, path } = openSet.pop()\n for await (const entry of current.values()) {\n if (await entry.isSameEntry(possibleDescendant)) {\n return [...path, entry.name]\n }\n if (entry.kind === 'directory') {\n openSet.push({ handle: entry, path: [...path, entry.name] })\n }\n }\n }\n\n return null\n }\n\n async * keys () {\n for await (const [name] of this[kAdapter].entries())\n yield name\n }\n\n async * values () {\n for await (const [_, entry] of this)\n yield entry\n }\n\n [Symbol.asyncIterator]() {\n return this.entries()\n }\n}\n\nObject.defineProperty(FileSystemDirectoryHandle.prototype, Symbol.toStringTag, {\n\tvalue: 'FileSystemDirectoryHandle',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n})\n\nObject.defineProperties(FileSystemDirectoryHandle.prototype, {\n\tgetDirectoryHandle: { enumerable: true },\n\tentries: { enumerable: true },\n\tgetFileHandle: { enumerable: true },\n\tremoveEntry: { enumerable: true }\n})\n\nexport default FileSystemDirectoryHandle\nexport { FileSystemDirectoryHandle }\n", "export const errors = {\n INVALID: ['seeking position failed.', 'InvalidStateError'],\n GONE: ['A requested file or directory could not be found at the time an operation was processed.', 'NotFoundError'],\n MISMATCH: ['The path supplied exists, but was not an entry of requested type.', 'TypeMismatchError'],\n MOD_ERR: ['The object can not be modified in this way.', 'InvalidModificationError'],\n SYNTAX: m => [`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${m}`, 'SyntaxError'],\n SECURITY: ['It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.', 'SecurityError'],\n DISALLOWED: ['The request is not allowed by the user agent or the platform in the current context.', 'NotAllowedError']\n}\n\nexport const config = {\n writable: globalThis.WritableStream\n}\n\nexport async function fromDataTransfer (entries) {\n console.warn('deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead')\n const [memory, sandbox, fs] = await Promise.all([\n import('./adapters/memory.js'),\n import('./adapters/sandbox.js'),\n import('./FileSystemDirectoryHandle.js')\n ])\n\n const folder = new memory.FolderHandle('', false)\n folder._entries = entries.map(entry => entry.isFile\n ? new sandbox.FileHandle(entry, false)\n : new sandbox.FolderHandle(entry, false)\n )\n\n return new fs.FileSystemDirectoryHandle(folder)\n}\n\nexport async function getDirHandlesFromInput (input) {\n const { FolderHandle, FileHandle } = await import('./adapters/memory.js')\n const { FileSystemDirectoryHandle } = await import('./FileSystemDirectoryHandle.js')\n\n const files = Array.from(input.files)\n const rootName = files[0].webkitRelativePath.split('/', 1)[0]\n const root = new FolderHandle(rootName, false)\n\n files.forEach(file => {\n const path = file.webkitRelativePath.split('/')\n path.shift()\n const name = path.pop()\n\n const dir = path.reduce((dir, path) => {\n if (!dir._entries[path]) dir._entries[path] = new FolderHandle(path, false)\n return dir._entries[path]\n }, root)\n\n dir._entries[name] = new FileHandle(file.name, file, false)\n })\n\n return new FileSystemDirectoryHandle(root)\n}\n\nexport async function getFileHandlesFromInput (input) {\n const { FileHandle } = await import('./adapters/memory.js')\n const { FileSystemFileHandle } = await import('./FileSystemFileHandle.js')\n\n return Array.from(input.files).map(file =>\n new FileSystemFileHandle(new FileHandle(file.name, file, false))\n )\n}\n", "import { errors } from '../util.js'\nimport config from '../config.js'\n\nconst {\n WritableStream,\n TransformStream,\n DOMException,\n Blob\n} = config\n\nconst { GONE } = errors\n// @ts-ignore\nconst isSafari = /constructor/i.test(window.HTMLElement) || window.safari || window.WebKitPoint\n\nexport class FileHandle {\n constructor (name = 'unkown') {\n this.name = name\n this.kind = 'file'\n }\n\n async getFile () {\n throw new DOMException(...GONE)\n }\n\n async isSameEntry(other) {\n return this === other\n }\n\n /**\n * @param {object} [options={}]\n */\n async createWritable (options = {}) {\n const sw = await navigator.serviceWorker?.getRegistration()\n const link = document.createElement('a')\n const ts = new TransformStream()\n const sink = ts.writable\n\n link.download = this.name\n\n if (isSafari || !sw) {\n /** @type {Blob[]} */\n let chunks = []\n ts.readable.pipeTo(new WritableStream({\n write (chunk) {\n chunks.push(new Blob([chunk]))\n },\n close () {\n const blob = new Blob(chunks, { type: 'application/octet-stream; charset=utf-8' })\n chunks = []\n link.href = URL.createObjectURL(blob)\n link.click()\n setTimeout(() => URL.revokeObjectURL(link.href), 10000)\n }\n }))\n } else {\n const { writable, readablePort } = new RemoteWritableStream(WritableStream)\n // Make filename RFC5987 compatible\n const fileName = encodeURIComponent(this.name).replace(/['()]/g, escape).replace(/\\*/g, '%2A')\n const headers = {\n 'content-disposition': \"attachment; filename*=UTF-8''\" + fileName,\n 'content-type': 'application/octet-stream; charset=utf-8',\n ...(options.size ? { 'content-length': options.size } : {})\n }\n\n const keepAlive = setTimeout(() => sw.active.postMessage(0), 10000)\n\n ts.readable.pipeThrough(new TransformStream({\n transform (chunk, ctrl) {\n if (chunk instanceof Uint8Array) return ctrl.enqueue(chunk)\n const reader = new Response(chunk).body.getReader()\n const pump = _ => reader.read().then(e => e.done ? 0 : pump(ctrl.enqueue(e.value)))\n return pump()\n }\n })).pipeTo(writable).finally(() => {\n clearInterval(keepAlive)\n })\n\n // Transfer the stream to service worker\n sw.active.postMessage({\n url: sw.scope + fileName,\n headers,\n readablePort\n }, [readablePort])\n\n // Trigger the download with a hidden iframe\n const iframe = document.createElement('iframe')\n iframe.hidden = true\n iframe.src = sw.scope + fileName\n document.body.appendChild(iframe)\n }\n\n return sink.getWriter()\n }\n}\n\nconst WRITE = 0\nconst PULL = 0\nconst ERROR = 1\nconst ABORT = 1\nconst CLOSE = 2\n\nclass MessagePortSink {\n /** @param {MessagePort} port */\n constructor (port) {\n port.onmessage = event => this._onMessage(event.data)\n this._port = port\n this._resetReady()\n }\n\n start (controller) {\n this._controller = controller\n // Apply initial backpressure\n return this._readyPromise\n }\n\n write (chunk) {\n const message = { type: WRITE, chunk }\n\n // Send chunk\n this._port.postMessage(message, [chunk.buffer])\n\n // Assume backpressure after every write, until sender pulls\n this._resetReady()\n\n // Apply backpressure\n return this._readyPromise\n }\n\n close () {\n this._port.postMessage({ type: CLOSE })\n this._port.close()\n }\n\n abort (reason) {\n this._port.postMessage({ type: ABORT, reason })\n this._port.close()\n }\n\n _onMessage (message) {\n if (message.type === PULL) this._resolveReady()\n if (message.type === ERROR) this._onError(message.reason)\n }\n\n _onError (reason) {\n this._controller.error(reason)\n this._rejectReady(reason)\n this._port.close()\n }\n\n _resetReady () {\n this._readyPromise = new Promise((resolve, reject) => {\n this._readyResolve = resolve\n this._readyReject = reject\n })\n this._readyPending = true\n }\n\n _resolveReady () {\n this._readyResolve()\n this._readyPending = false\n }\n\n _rejectReady (reason) {\n if (!this._readyPending) this._resetReady()\n this._readyPromise.catch(() => {})\n this._readyReject(reason)\n this._readyPending = false\n }\n}\n\nclass RemoteWritableStream {\n constructor (WritableStream) {\n const channel = new MessageChannel()\n this.readablePort = channel.port1\n this.writable = new WritableStream(\n new MessagePortSink(channel.port2)\n )\n }\n}\n", "class InnerDbConnection {\r\n constructor(private readonly database: IDBDatabase) { }\r\n\r\n private openStore(store: string, mode: IDBTransactionMode): IDBObjectStore {\r\n const tx = this.database.transaction(store, mode);\r\n return tx.objectStore(store);\r\n }\r\n\r\n public async put(store: string, obj: any, key?: IDBValidKey): Promise {\r\n const os = this.openStore(store, \"readwrite\");\r\n\r\n return await new Promise((resolve, reject) => {\r\n const response = os.put(obj, key);\r\n response.onsuccess = () => {\r\n resolve(response.result);\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public get(store: string, key: IDBValidKey): any {\r\n const os = this.openStore(store, \"readonly\");\r\n\r\n return new Promise((resolve, reject) => {\r\n const response = os.get(key);\r\n response.onsuccess = () => {\r\n resolve(response.result);\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public async delete(store: string, key: IDBValidKey): Promise {\r\n const os = this.openStore(store, \"readwrite\");\r\n\r\n return await new Promise((resolve, reject) => {\r\n const response = os.delete(key);\r\n response.onsuccess = () => {\r\n resolve();\r\n };\r\n response.onerror = () => {\r\n reject(response.error);\r\n };\r\n });\r\n }\r\n\r\n public close() {\r\n this.database.close();\r\n }\r\n}\r\n\r\nclass IndexedDbWrapper {\r\n constructor(private readonly databaseName: string, private readonly objectStores: [string]) {\r\n }\r\n\r\n public async connect(): Promise {\r\n const conn = window.indexedDB.open(this.databaseName, 1);\r\n\r\n conn.onupgradeneeded = event => {\r\n const db = (event.target as IDBRequest).result;\r\n this.objectStores.forEach(store => {\r\n db.createObjectStore(store);\r\n });\r\n };\r\n\r\n return await new Promise((resolve, reject) => {\r\n conn.onsuccess = event => {\r\n resolve(new InnerDbConnection((event.target as IDBRequest).result));\r\n };\r\n conn.onerror = event => {\r\n reject((event.target as IDBRequest).error);\r\n };\r\n });\r\n }\r\n}\r\n\r\nexport const fileBookmarksStore: string = \"fileBookmarks\";\r\nexport const avaloniaDb = new IndexedDbWrapper(\"AvaloniaDb\", [\r\n fileBookmarksStore\r\n]);\r\n", "// Based on https://github.com/component/textarea-caret-position/blob/master/index.js\r\nexport class CaretHelper {\r\n public static getCaretCoordinates(\r\n element: HTMLInputElement | HTMLTextAreaElement,\r\n position: number,\r\n options?: { debug: boolean }\r\n ) {\r\n if (!isBrowser) {\r\n throw new Error(\r\n \"textarea-caret-position#getCaretCoordinates should only be called in a browser\"\r\n );\r\n }\r\n\r\n const debug = options?.debug ?? false;\r\n if (debug) {\r\n const el = document.querySelector(\r\n \"#input-textarea-caret-position-mirror-div\"\r\n );\r\n if (el) el.parentNode?.removeChild(el);\r\n }\r\n\r\n // The mirror div will replicate the textarea's style\r\n const div = document.createElement(\"div\");\r\n div.id = \"input-textarea-caret-position-mirror-div\";\r\n document.body.appendChild(div);\r\n\r\n const style = div.style;\r\n const computed = window.getComputedStyle\r\n ? window.getComputedStyle(element)\r\n : ((element as any).currentStyle as CSSStyleDeclaration); // currentStyle for IE < 9\r\n const isInput = element.nodeName === \"INPUT\";\r\n\r\n // Default textarea styles\r\n style.whiteSpace = \"pre-wrap\";\r\n if (!isInput) style.wordWrap = \"break-word\"; // only for textarea-s\r\n\r\n // Position off-screen\r\n style.position = \"absolute\"; // required to return coordinates properly\r\n if (!debug) style.visibility = \"hidden\"; // not 'display: none' because we want rendering\r\n\r\n // Transfer the element's properties to the div\r\n properties.forEach((prop: string) => {\r\n if (isInput && prop === \"lineHeight\") {\r\n // Special case for s because text is rendered centered and line height may be != height\r\n if (computed.boxSizing === \"border-box\") {\r\n const height = parseInt(computed.height);\r\n const outerHeight =\r\n parseInt(computed.paddingTop) +\r\n parseInt(computed.paddingBottom) +\r\n parseInt(computed.borderTopWidth) +\r\n parseInt(computed.borderBottomWidth);\r\n const targetHeight = outerHeight + parseInt(computed.lineHeight);\r\n if (height > targetHeight) {\r\n style.lineHeight = `${height - outerHeight}px`;\r\n } else if (height === targetHeight) {\r\n style.lineHeight = computed.lineHeight;\r\n } else {\r\n style.lineHeight = \"0\";\r\n }\r\n } else {\r\n style.lineHeight = computed.height;\r\n }\r\n } else {\r\n (style as any)[prop] = (computed as any)[prop];\r\n }\r\n });\r\n\r\n if (isFirefox) {\r\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\r\n if (element.scrollHeight > parseInt(computed.height)) {\r\n style.overflowY = \"scroll\";\r\n }\r\n } else {\r\n style.overflow = \"hidden\"; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\r\n }\r\n\r\n div.textContent = element.value.substring(0, position);\r\n // The second special handling for input type=\"text\" vs textarea:\r\n // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\r\n if (isInput) div.textContent = div.textContent.replace(/\\s/g, \"\\u00a0\");\r\n\r\n const span = document.createElement(\"span\");\r\n // Wrapping must be replicated *exactly*, including when a long word gets\r\n // onto the next line, with whitespace at the end of the line before (#7).\r\n // The *only* reliable way to do that is to copy the *entire* rest of the\r\n // textarea's content into the created at the caret position.\r\n // For inputs, just '.' would be enough, but no need to bother.\r\n span.textContent = element.value.substring(position) || \".\"; // || because a completely empty faux span doesn't render at all\r\n div.appendChild(span);\r\n\r\n const coordinates = {\r\n top: span.offsetTop + parseInt(computed.borderTopWidth),\r\n left: span.offsetLeft + parseInt(computed.borderLeftWidth),\r\n height: parseInt(computed.lineHeight)\r\n };\r\n\r\n if (debug) {\r\n span.style.backgroundColor = \"#aaa\";\r\n } else {\r\n document.body.removeChild(div);\r\n }\r\n\r\n return coordinates;\r\n }\r\n}\r\n\r\nconst properties = [\r\n \"direction\", // RTL support\r\n \"boxSizing\",\r\n \"width\", // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\r\n \"height\",\r\n \"overflowX\",\r\n \"overflowY\", // copy the scrollbar for IE\r\n\r\n \"borderTopWidth\",\r\n \"borderRightWidth\",\r\n \"borderBottomWidth\",\r\n \"borderLeftWidth\",\r\n \"borderStyle\",\r\n\r\n \"paddingTop\",\r\n \"paddingRight\",\r\n \"paddingBottom\",\r\n \"paddingLeft\",\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\r\n \"fontStyle\",\r\n \"fontVariant\",\r\n \"fontWeight\",\r\n \"fontStretch\",\r\n \"fontSize\",\r\n \"fontSizeAdjust\",\r\n \"lineHeight\",\r\n \"fontFamily\",\r\n\r\n \"textAlign\",\r\n \"textTransform\",\r\n \"textIndent\",\r\n \"textDecoration\", // might not make a difference, but better be safe\r\n\r\n \"letterSpacing\",\r\n \"wordSpacing\",\r\n\r\n \"tabSize\",\r\n \"MozTabSize\"\r\n];\r\n\r\nconst isBrowser = typeof window !== \"undefined\";\r\nconst isFirefox = isBrowser && (window as any).mozInnerScreenX != null;\r\n", "export class JsExports {\r\n public static resolvedExports?: any;\r\n public static exportsPromise: Promise;\r\n\r\n public static get InputHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.InputHelper;\r\n }\r\n\r\n public static get DomHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.DomHelper;\r\n }\r\n\r\n public static get TimerHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.TimerHelper;\r\n }\r\n\r\n public static get CanvasHelper(): any {\r\n return this.resolvedExports?.Avalonia.Browser.Interop.CanvasHelper;\r\n }\r\n}\r\nasync function resolveExports (): Promise {\r\n const runtimeApi = await globalThis.getDotnetRuntime(0);\r\n if (runtimeApi == null) { return; }\r\n JsExports.resolvedExports = await runtimeApi.getAssemblyExports(\"Avalonia.Browser.dll\");\r\n return JsExports.resolvedExports;\r\n}\r\n\r\nJsExports.exportsPromise = resolveExports();\r\n", "import { CaretHelper } from \"./caretHelper\";\r\nimport { JsExports } from \"./jsExports\";\r\nimport { IMemoryView } from \"../../types/dotnet\";\r\nimport { StorageItem } from \"../storage/storageItem\";\r\n\r\nenum RawInputModifiers {\r\n None = 0,\r\n Alt = 1,\r\n Control = 2,\r\n Shift = 4,\r\n Meta = 8,\r\n\r\n LeftMouseButton = 16,\r\n RightMouseButton = 32,\r\n MiddleMouseButton = 64,\r\n XButton1MouseButton = 128,\r\n XButton2MouseButton = 256,\r\n KeyboardMask = Alt | Control | Shift | Meta,\r\n\r\n PenInverted = 512,\r\n PenEraser = 1024,\r\n PenBarrelButton = 2048\r\n}\r\n\r\n/*\r\n* This is a hack to handle older Firefox (before v127 from June 2024) clipboard events in a more convenient way for framework users.\r\n* In the browser, events go in order KeyDown -> Paste -> KeyUp.\r\n* On KeyDown we trigger Avalonia handlers, which might execute readClipboard.\r\n* When readClipboard was executed, we mark ClipboardState as Pending and setup clipboard promise,\r\n* which will un-handle KeyDown event, basically allowing browser to pass a Paste event properly.\r\n* On actual Paste event we execute promise callbacks, resuming async operation, and returning pasted text to the app.\r\n* Note #1, on every KeyUp event we will reset all the state and reject pending promises if any, as this event it expected to come after Paste.\r\n* Note #2, whole this code will be executed only on older browsers where clipboard.read/readText is not available.\r\n* Note #3, with all of these hacks Clipboard.ReadText will still work only on actual \"paste\" gesture initiated by user.\r\n* */\r\nenum ClipboardState {\r\n None,\r\n Ready,\r\n Pending\r\n}\r\n\r\ninterface WriteableClipboardItem {\r\n data: Record;\r\n}\r\n\r\ninterface WriteableClipboardSource {\r\n items: WriteableClipboardItem[];\r\n}\r\n\r\ntype ReadableDataItem = {\r\n type: \"clipboardItem\";\r\n value: ClipboardItem;\r\n} | {\r\n type: \"dataTransferItem\";\r\n value: DataTransferItem;\r\n} | {\r\n type: \"string\";\r\n value: string;\r\n};\r\n\r\ntype ReadableDataValue = {\r\n type: \"string\";\r\n value: string;\r\n} | {\r\n type: \"bytes\";\r\n value: Uint8Array;\r\n} | {\r\n type: \"file\";\r\n value: StorageItem;\r\n};\r\n\r\nexport class InputHelper {\r\n static clipboardState: ClipboardState = ClipboardState.None;\r\n static resolveClipboard?: (value: readonly ReadableDataItem[]) => void;\r\n static rejectClipboard?: (reason?: any) => void;\r\n\r\n public static initializeBackgroundHandlers() {\r\n if (this.clipboardState !== ClipboardState.None) {\r\n return;\r\n }\r\n\r\n globalThis.document.addEventListener(\"paste\", args => {\r\n if (this.clipboardState !== ClipboardState.Pending || !this.resolveClipboard) {\r\n return;\r\n }\r\n\r\n const items = this.getDataTransferItems(args.clipboardData);\r\n this.resolveClipboard(items.map((item) => ({ type: \"dataTransferItem\", value: item })));\r\n });\r\n this.clipboardState = ClipboardState.Ready;\r\n }\r\n\r\n private static getDataTransferItems(dataTransfer?: DataTransfer | null): DataTransferItem[] {\r\n const dataTransferList = dataTransfer?.items;\r\n return dataTransferList == null ? [] : Array.from(dataTransferList);\r\n }\r\n\r\n public static isClipboardFormatSupported(format: string): boolean {\r\n if (ClipboardItem.supports) {\r\n return ClipboardItem.supports(format);\r\n }\r\n\r\n return format === \"text/plain\" || format === \"text/html\" || format === \"image/png\";\r\n }\r\n\r\n public static createWriteableClipboardSource(): WriteableClipboardSource {\r\n return { items: [] };\r\n }\r\n\r\n public static createWriteableClipboardItem(source: WriteableClipboardSource): WriteableClipboardItem {\r\n const item = { data: {} };\r\n source.items.push(item);\r\n return item;\r\n }\r\n\r\n public static addStringToWriteableClipboardItem(item: WriteableClipboardItem, format: string, value: string) {\r\n item.data[format] = value;\r\n }\r\n\r\n public static addBytesToWriteableClipboardItem(item: WriteableClipboardItem, format: string, value: IMemoryView) {\r\n const bytes = value.slice(0, value.byteLength);\r\n item.data[format] = new Blob([bytes], { type: format });\r\n }\r\n\r\n public static async readClipboard(window: Window): Promise {\r\n const clipboard = window.navigator.clipboard;\r\n\r\n if (clipboard.read) {\r\n const clipboardItems = await clipboard.read();\r\n return clipboardItems.map((item) => ({ type: \"clipboardItem\", value: item }));\r\n } else if (clipboard.readText) {\r\n const item: ReadableDataItem = {\r\n type: \"string\",\r\n value: await clipboard.readText()\r\n };\r\n return [item];\r\n } else {\r\n try {\r\n return await new Promise((resolve, reject) => {\r\n this.clipboardState = ClipboardState.Pending;\r\n this.resolveClipboard = resolve;\r\n this.rejectClipboard = reject;\r\n });\r\n } finally {\r\n this.clipboardState = ClipboardState.Ready;\r\n this.resolveClipboard = undefined;\r\n this.rejectClipboard = undefined;\r\n }\r\n }\r\n }\r\n\r\n public static async writeClipboard(window: Window, source?: WriteableClipboardSource | null): Promise {\r\n const items = source?.items ?? [];\r\n if (items.length === 0) {\r\n await window.navigator.clipboard.writeText(\"\");\r\n return;\r\n }\r\n\r\n return window.navigator.clipboard.write\r\n ? await window.navigator.clipboard.write(items.map(item => new ClipboardItem(item.data)))\r\n : await this.writeFirstText(window, items);\r\n }\r\n\r\n private static async writeFirstText(window: Window, items: WriteableClipboardItem[]): Promise {\r\n for (const item of items) {\r\n for (const format in item.data) {\r\n if (!format.startsWith(\"text/\")) {\r\n continue;\r\n }\r\n\r\n let value = item.data[format];\r\n if (typeof value !== \"string\") {\r\n value = \"\";\r\n }\r\n\r\n await window.navigator.clipboard.writeText(value);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n public static getReadableDataItemFormats(item: ReadableDataItem): readonly string[] {\r\n /* eslint-disable indent */\r\n switch (item.type) {\r\n case \"clipboardItem\":\r\n return item.value.types;\r\n case \"dataTransferItem\":\r\n switch (item.value.kind) {\r\n case \"string\":\r\n return [item.value.type];\r\n case \"file\":\r\n return [\"Files\"];\r\n default:\r\n return [];\r\n }\r\n case \"string\":\r\n return [\"text/plain\"];\r\n default:\r\n return [];\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n // Asynchronous, used to read the clipboard.\r\n public static async tryGetReadableDataItemValueAsync(item: ReadableDataItem, format: string): Promise {\r\n const type = item.type;\r\n\r\n /* eslint-disable indent */\r\n switch (type) {\r\n case \"clipboardItem\": {\r\n const clipboardItem = item.value;\r\n if (!clipboardItem.types.includes(format)) {\r\n return null;\r\n }\r\n\r\n const blob = await clipboardItem.getType(format);\r\n\r\n return format.startsWith(\"text/\")\r\n ? { type: \"string\", value: await blob.text() }\r\n : { type: \"bytes\", value: await this.getBlobBytes(blob) };\r\n }\r\n\r\n case \"dataTransferItem\": {\r\n const dataTransferItem = item.value;\r\n\r\n switch (dataTransferItem.kind) {\r\n case \"string\": {\r\n if (format !== dataTransferItem.type) {\r\n return null;\r\n }\r\n\r\n const stringValue = await new Promise((resolve) => dataTransferItem.getAsString((str) => resolve(str)));\r\n return { type: \"string\", value: stringValue };\r\n }\r\n\r\n case \"file\": {\r\n if (format !== \"Files\") {\r\n return null;\r\n }\r\n\r\n const file = dataTransferItem.getAsFile();\r\n return file == null ? null : { type: \"file\", value: StorageItem.createFromFile(file) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n case \"string\": {\r\n return format.startsWith(\"text/\")\r\n ? { type: \"string\", value: item.value }\r\n : { type: \"bytes\", value: await this.getBlobBytes(new Blob([item.value])) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n // Synchronous, used only to read a drag-and-drop item.\r\n public static tryGetReadableDataItemValue(item: ReadableDataItem, format: string): ReadableDataValue | null {\r\n const type = item.type;\r\n\r\n if (type !== \"dataTransferItem\") {\r\n return null;\r\n }\r\n\r\n const dataTransferItem = item.value;\r\n\r\n /* eslint-disable indent */\r\n switch (dataTransferItem.kind) {\r\n case \"string\": {\r\n if (format !== dataTransferItem.type) {\r\n return null;\r\n }\r\n\r\n let stringValue = \"\";\r\n dataTransferItem.getAsString(function (str) { stringValue = str; });\r\n return { type: \"string\", value: stringValue };\r\n }\r\n\r\n case \"file\": {\r\n if (format !== \"Files\") {\r\n return null;\r\n }\r\n\r\n const file = dataTransferItem.getAsFile();\r\n return file == null ? null : { type: \"file\", value: StorageItem.createFromFile(file) };\r\n }\r\n\r\n default:\r\n return null;\r\n }\r\n /* eslint-enable indent */\r\n }\r\n\r\n private static async getBlobBytes(blob: Blob): Promise {\r\n return blob.bytes\r\n ? await blob.bytes()\r\n : new Uint8Array(await blob.arrayBuffer());\r\n }\r\n\r\n public static subscribeInputEvents(element: HTMLInputElement, topLevelId: number) {\r\n const keySub = this.subscribeKeyEvents(element, topLevelId);\r\n const pointerSub = this.subscribePointerEvents(element, topLevelId);\r\n const textSub = this.subscribeTextEvents(element, topLevelId);\r\n const dndSub = this.subscribeDropEvents(element, topLevelId);\r\n const paneSub = this.subscribeKeyboardGeometryChange(element, topLevelId);\r\n\r\n return () => {\r\n keySub();\r\n pointerSub();\r\n textSub();\r\n dndSub();\r\n paneSub();\r\n };\r\n }\r\n\r\n public static subscribeKeyEvents(element: HTMLInputElement, topLevelId: number) {\r\n const keyDownHandler = (args: KeyboardEvent) => {\r\n JsExports.InputHelper.OnKeyDown(topLevelId, args.code, args.key, this.getModifiers(args))\r\n .then((handled: boolean) => {\r\n if (!handled || this.clipboardState !== ClipboardState.Pending) {\r\n args.preventDefault();\r\n }\r\n });\r\n };\r\n element.addEventListener(\"keydown\", keyDownHandler);\r\n\r\n const keyUpHandler = (args: KeyboardEvent) => {\r\n JsExports.InputHelper.OnKeyUp(topLevelId, args.code, args.key, this.getModifiers(args))\r\n .then((handled: boolean) => {\r\n if (!handled) {\r\n args.preventDefault();\r\n }\r\n });\r\n\r\n if (this.rejectClipboard) {\r\n this.rejectClipboard();\r\n }\r\n };\r\n\r\n element.addEventListener(\"keyup\", keyUpHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"keydown\", keyDownHandler);\r\n element.removeEventListener(\"keyup\", keyUpHandler);\r\n };\r\n }\r\n\r\n public static subscribeTextEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number) {\r\n const compositionStartHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionStart(topLevelId);\r\n };\r\n element.addEventListener(\"compositionstart\", compositionStartHandler);\r\n\r\n const beforeInputHandler = (args: InputEvent) => {\r\n const ranges = args.getTargetRanges();\r\n let start = -1;\r\n let end = -1;\r\n if (ranges.length > 0) {\r\n start = ranges[0].startOffset;\r\n end = ranges[0].endOffset;\r\n }\r\n\r\n if (args.inputType === \"insertCompositionText\") {\r\n start = 2;\r\n end = start + 2;\r\n }\r\n\r\n JsExports.InputHelper.OnBeforeInput(topLevelId, args.inputType, start, end);\r\n };\r\n element.addEventListener(\"beforeinput\", beforeInputHandler);\r\n\r\n const compositionUpdateHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionUpdate(topLevelId, args.data);\r\n };\r\n element.addEventListener(\"compositionupdate\", compositionUpdateHandler);\r\n\r\n const compositionEndHandler = (args: CompositionEvent) => {\r\n JsExports.InputHelper.OnCompositionEnd(topLevelId, args.data);\r\n args.preventDefault();\r\n };\r\n element.addEventListener(\"compositionend\", compositionEndHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"compositionstart\", compositionStartHandler);\r\n element.removeEventListener(\"compositionupdate\", compositionUpdateHandler);\r\n element.removeEventListener(\"compositionend\", compositionEndHandler);\r\n };\r\n }\r\n\r\n public static subscribePointerEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number\r\n ) {\r\n const pointerMoveHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerMove(\r\n topLevelId, args.pointerType, args.pointerId, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args), args);\r\n args.preventDefault();\r\n };\r\n\r\n const pointerDownHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerDown(\r\n topLevelId, args.pointerType, args.pointerId, args.button, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n const pointerUpHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerUp(\r\n topLevelId, args.pointerType, args.pointerId, args.button, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n const pointerCancelHandler = (args: PointerEvent) => {\r\n JsExports.InputHelper.OnPointerCancel(\r\n topLevelId, args.pointerType, args.pointerId, args.offsetX, args.offsetY,\r\n args.pressure, args.tiltX, args.tiltY, args.twist, this.getModifiers(args));\r\n };\r\n\r\n const wheelHandler = (args: WheelEvent) => {\r\n JsExports.InputHelper.OnWheel(\r\n topLevelId, args.offsetX, args.offsetY, args.deltaX, args.deltaY, this.getModifiers(args));\r\n args.preventDefault();\r\n };\r\n\r\n element.addEventListener(\"pointermove\", pointerMoveHandler);\r\n element.addEventListener(\"pointerdown\", pointerDownHandler);\r\n element.addEventListener(\"pointerup\", pointerUpHandler);\r\n element.addEventListener(\"wheel\", wheelHandler);\r\n element.addEventListener(\"pointercancel\", pointerCancelHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"pointerover\", pointerMoveHandler);\r\n element.removeEventListener(\"pointerdown\", pointerDownHandler);\r\n element.removeEventListener(\"pointerup\", pointerUpHandler);\r\n element.removeEventListener(\"pointercancel\", pointerCancelHandler);\r\n element.removeEventListener(\"wheel\", wheelHandler);\r\n };\r\n }\r\n\r\n public static subscribeDropEvents(\r\n element: HTMLInputElement,\r\n topLevelId: number\r\n ) {\r\n const handler = (args: DragEvent) => {\r\n const dataTransfer = args.dataTransfer;\r\n if (dataTransfer == null) {\r\n return;\r\n }\r\n\r\n const items: ReadableDataItem[] =\r\n this.getDataTransferItems(dataTransfer).map((item) => ({ type: \"dataTransferItem\", value: item }));\r\n\r\n JsExports.InputHelper.OnDragDrop(topLevelId, args.type, args.offsetX, args.offsetY, this.getModifiers(args), dataTransfer, items);\r\n };\r\n const overAndDropHandler = (args: DragEvent) => {\r\n args.preventDefault();\r\n handler(args);\r\n };\r\n element.addEventListener(\"dragover\", overAndDropHandler);\r\n element.addEventListener(\"dragenter\", handler);\r\n element.addEventListener(\"dragleave\", handler);\r\n element.addEventListener(\"drop\", overAndDropHandler);\r\n\r\n return () => {\r\n element.removeEventListener(\"dragover\", overAndDropHandler);\r\n element.removeEventListener(\"dragenter\", handler);\r\n element.removeEventListener(\"dragleave\", handler);\r\n element.removeEventListener(\"drop\", overAndDropHandler);\r\n };\r\n }\r\n\r\n public static getCoalescedEvents(pointerEvent: PointerEvent): number[] {\r\n return pointerEvent.getCoalescedEvents()\r\n .flatMap(e => [e.offsetX, e.offsetY, e.pressure, e.tiltX, e.tiltY, e.twist]);\r\n }\r\n\r\n public static subscribeKeyboardGeometryChange(\r\n element: HTMLInputElement,\r\n topLevelId: number) {\r\n if (\"virtualKeyboard\" in navigator) {\r\n // (navigator as any).virtualKeyboard.overlaysContent = true;\r\n const listener = (event: any) => {\r\n const elementRect = element.getBoundingClientRect();\r\n const keyboardRect = event.target.boundingRect as DOMRect;\r\n\r\n JsExports.InputHelper.OnKeyboardGeometryChange(\r\n topLevelId,\r\n keyboardRect.x - elementRect.x,\r\n keyboardRect.y - elementRect.y,\r\n keyboardRect.width,\r\n keyboardRect.height);\r\n };\r\n (navigator as any).virtualKeyboard.addEventListener(\"geometrychange\", listener);\r\n return () => {\r\n (navigator as any).virtualKeyboard.removeEventListener(\"geometrychange\", listener);\r\n };\r\n }\r\n\r\n return () => {};\r\n }\r\n\r\n public static clearInput(inputElement: HTMLInputElement) {\r\n inputElement.value = \"\";\r\n }\r\n\r\n public static focusElement(inputElement: HTMLElement) {\r\n inputElement.focus();\r\n }\r\n\r\n public static setCursor(inputElement: HTMLInputElement, kind: string) {\r\n if (kind === \"default\") {\r\n inputElement.style.removeProperty(\"cursor\");\r\n } else {\r\n inputElement.style.cursor = kind;\r\n }\r\n }\r\n\r\n public static setBounds(inputElement: HTMLInputElement, x: number, y: number, caretWidth: number, caretHeight: number, caret: number) {\r\n inputElement.style.left = (x).toFixed(0) + \"px\";\r\n inputElement.style.top = (y).toFixed(0) + \"px\";\r\n\r\n const { left, top } = CaretHelper.getCaretCoordinates(inputElement, caret);\r\n\r\n inputElement.style.left = (x - left).toFixed(0) + \"px\";\r\n inputElement.style.top = (y - top).toFixed(0) + \"px\";\r\n }\r\n\r\n public static hide(inputElement: HTMLInputElement) {\r\n inputElement.style.display = \"none\";\r\n }\r\n\r\n public static show(inputElement: HTMLInputElement) {\r\n inputElement.style.display = \"block\";\r\n }\r\n\r\n public static setSurroundingText(inputElement: HTMLInputElement, text: string, start: number, end: number) {\r\n if (!inputElement) {\r\n return;\r\n }\r\n\r\n inputElement.value = text;\r\n inputElement.setSelectionRange(start, end);\r\n inputElement.style.width = \"20px\";\r\n inputElement.style.width = `${inputElement.scrollWidth}px`;\r\n }\r\n\r\n private static getModifiers(args: KeyboardEvent | PointerEvent | WheelEvent | DragEvent): number {\r\n let modifiers = RawInputModifiers.None;\r\n\r\n if (args.ctrlKey) { modifiers |= RawInputModifiers.Control; }\r\n if (args.altKey) { modifiers |= RawInputModifiers.Alt; }\r\n if (args.shiftKey) { modifiers |= RawInputModifiers.Shift; }\r\n if (args.metaKey) { modifiers |= RawInputModifiers.Meta; }\r\n\r\n const buttons = (args as PointerEvent).buttons;\r\n if (buttons) {\r\n if (buttons & 1) { modifiers |= RawInputModifiers.LeftMouseButton; }\r\n if (buttons & 2) { modifiers |= (args.type === \"pen\" ? RawInputModifiers.PenBarrelButton : RawInputModifiers.RightMouseButton); }\r\n if (buttons & 4) { modifiers |= RawInputModifiers.MiddleMouseButton; }\r\n if (buttons & 8) { modifiers |= RawInputModifiers.XButton1MouseButton; }\r\n if (buttons & 16) { modifiers |= RawInputModifiers.XButton2MouseButton; }\r\n if (buttons & 32) { modifiers |= RawInputModifiers.PenEraser; }\r\n }\r\n\r\n return modifiers;\r\n }\r\n\r\n public static setPointerCapture(containerElement: HTMLInputElement, pointerId: number): void {\r\n containerElement.setPointerCapture(pointerId);\r\n }\r\n\r\n public static releasePointerCapture(containerElement: HTMLInputElement, pointerId: number): void {\r\n if (containerElement.hasPointerCapture(pointerId)) {\r\n containerElement.releasePointerCapture(pointerId);\r\n }\r\n }\r\n}\r\n", "export class Caniuse {\r\n public static hasNativeFilePicker(): boolean {\r\n return \"showSaveFilePicker\" in globalThis;\r\n }\r\n\r\n public static isMobile(): boolean {\r\n const userAgentData = (globalThis.navigator as any)?.userAgentData;\r\n if (userAgentData) {\r\n return userAgentData.mobile;\r\n }\r\n\r\n const userAgent = navigator.userAgent;\r\n const regex1 = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i;\r\n const regex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i;\r\n return regex1.test(userAgent) || regex2.test(userAgent.substr(0, 4));\r\n }\r\n\r\n public static isTv(): boolean {\r\n return navigator.userAgent.includes(\"SmartTV\");\r\n }\r\n}\r\n", "export class WebRenderTarget {\r\n renderTargetType: string;\r\n constructor(protected canvas: HTMLCanvasElement | OffscreenCanvas, type: string) {\r\n this.renderTargetType = type;\r\n }\r\n\r\n static setSize(target: WebRenderTarget, w: number, h: number) {\r\n target.canvas.width = w;\r\n target.canvas.height = h;\r\n }\r\n}\r\n", "import { BrowserRenderingMode } from \"./renderingMode\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\ninterface EmscriptenGlContext {\r\n handle: number;\r\n}\r\n\r\ninterface EmscriptenGL {\r\n registerContext: (ctx: WebGLRenderingContext, attrs: WebGLContextAttributes) => number;\r\n currentContext?: EmscriptenGlContext;\r\n makeContextCurrent: (handle: number) => boolean;\r\n}\r\n\r\nfunction getGL(): EmscriptenGL {\r\n const self = globalThis as any;\r\n const module = self.Module ?? self.getDotnetRuntime(0)?.Module;\r\n return (module?.GL ?? self.AvaloniaGL ?? self.SkiaSharpGL) as EmscriptenGL;\r\n}\r\n\r\nexport class WebGlRenderTarget extends WebRenderTarget {\r\n public contextHandle?: number;\r\n public attrs: WebGLContextAttributes;\r\n public fboId?: number;\r\n public stencil?: number;\r\n public sample?: number;\r\n public depth?: number;\r\n private static _gl: EmscriptenGL | null = null;\r\n\r\n constructor(public canvas: HTMLCanvasElement | OffscreenCanvas, mode: BrowserRenderingMode) {\r\n // Skia only understands WebGL context wrapped in Emscripten.\r\n if (WebGlRenderTarget._gl == null) { WebGlRenderTarget._gl = getGL(); }\r\n if (!WebGlRenderTarget._gl) {\r\n throw new Error(\"Module.GL object wasn't initialized, WebGL can't be used.\");\r\n }\r\n\r\n const attrs: WebGLContextAttributes | any =\r\n {\r\n alpha: true,\r\n depth: true,\r\n stencil: true,\r\n antialias: false,\r\n premultipliedAlpha: true,\r\n preserveDrawingBuffer: false,\r\n // only supported on older browsers, which is perfect as we want to fallback to 2d there.\r\n failIfMajorPerformanceCaveat: true,\r\n // attrs used by Emscripten:\r\n majorVersion: mode === BrowserRenderingMode.WebGL1 ? 1 : 2,\r\n minorVersion: 0,\r\n enableExtensionsByDefault: 1,\r\n explicitSwapControl: 0\r\n };\r\n\r\n const context = (mode === BrowserRenderingMode.WebGL1\r\n ? canvas.getContext(\"webgl\", attrs)\r\n : canvas.getContext(\"webgl2\", attrs)) as WebGLRenderingContext;\r\n if (!context) {\r\n throw new Error(\"HTMLCanvasElement.getContext returned null.\");\r\n }\r\n\r\n const handle = WebGlRenderTarget._gl.registerContext(context, attrs);\r\n (context as any).gl_handle = handle;\r\n super(canvas, \"webgl\");\r\n\r\n this.contextHandle = handle;\r\n this.fboId = context.getParameter(context.FRAMEBUFFER_BINDING)?.id ?? 0;\r\n this.stencil = context.getParameter(context.STENCIL_BITS);\r\n this.sample = context.getParameter(context.SAMPLES);\r\n this.depth = context.getParameter(context.DEPTH_BITS);\r\n this.attrs = attrs;\r\n }\r\n\r\n public static getCurrentContext(): number {\r\n return WebGlRenderTarget._gl?.currentContext?.handle ?? 0;\r\n }\r\n\r\n public static makeContextCurrent(handle: number): boolean {\r\n if (WebGlRenderTarget._gl == null) { return false; }\r\n const ret = WebGlRenderTarget._gl.makeContextCurrent(handle);\r\n return handle === 0 || ret;\r\n }\r\n}\r\n", "import { RuntimeAPI } from \"../../../types/dotnet\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\n\r\nexport class SoftwareRenderTarget extends WebRenderTarget {\r\n private readonly runtime: RuntimeAPI | undefined;\r\n private readonly context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\r\n constructor(canvas: HTMLCanvasElement | OffscreenCanvas) {\r\n const context = canvas.getContext(\"2d\", {\r\n alpha: true\r\n });\r\n if (!context) {\r\n throw new Error(\"HTMLCanvasElement.getContext(2d) returned null.\");\r\n }\r\n\r\n super(canvas, \"software\");\r\n this.context = context;\r\n\r\n this.runtime = globalThis.getDotnetRuntime(0);\r\n }\r\n\r\n public putPixelData(pointer: number, length: number, width: number, height: number): void {\r\n const heap8 = this.runtime?.localHeapViewU8();\r\n\r\n let clampedBuffer: Uint8ClampedArray;\r\n if (heap8?.buffer) {\r\n clampedBuffer = new Uint8ClampedArray(heap8.buffer, pointer, length);\r\n\r\n // Need to make a copy if using MT, ImageData can't consume shared arrays\r\n if (this.canvas instanceof OffscreenCanvas) {\r\n const dstArrayBuffer = new ArrayBuffer(clampedBuffer.byteLength);\r\n const copy = new Uint8ClampedArray(dstArrayBuffer);\r\n copy.set(clampedBuffer);\r\n clampedBuffer = copy;\r\n }\r\n } else throw new Error(\"Unable to access .NET memory\");\r\n\r\n const imageData = new ImageData(clampedBuffer, width, height);\r\n (this.context).putImageData(imageData, 0, 0);\r\n }\r\n\r\n public static staticPutPixelData(target: SoftwareRenderTarget, pointer: number, length: number, width: number, height: number): void {\r\n target.putPixelData(pointer, length, width, height);\r\n }\r\n}\r\n", "import { BrowserRenderingMode } from \"./renderingMode\";\r\nimport { WebGlRenderTarget } from \"./webGlRenderTarget\";\r\nimport { WebRenderTarget } from \"./webRenderTarget\";\r\nimport { SoftwareRenderTarget } from \"./softwareRenderTarget\";\r\n\r\nexport class WebRenderTargetRegistry {\r\n private static targets: { [id: number]: (WebRenderTarget) } = {};\r\n private static registry: { [id: number]: ({\r\n canvas: HTMLCanvasElement;\r\n worker?: Worker;\r\n }); } = {};\r\n\r\n private static nextId = 1;\r\n\r\n static create(pthreadId: number, canvas: HTMLCanvasElement, preferredModes: BrowserRenderingMode[]): number {\r\n const id = WebRenderTargetRegistry.nextId++;\r\n if (pthreadId === 0) {\r\n WebRenderTargetRegistry.registry[id] = {\r\n canvas\r\n };\r\n WebRenderTargetRegistry.targets[id] = WebRenderTargetRegistry.createRenderTarget(canvas, preferredModes);\r\n } else {\r\n const self = globalThis as any;\r\n const module = self.Module ?? self.getDotnetRuntime(0)?.Module;\r\n const pthreads = module?.PThread;\r\n if (pthreads == null) { throw new Error(\"Unable to access emscripten PThread api\"); }\r\n const pthread = pthreads.pthreads[pthreadId];\r\n if (pthread == null) { throw new Error(`Unable get pthread with id ${pthreadId}`); }\r\n let worker: Worker | undefined;\r\n if (pthread.postMessage != null) { worker = pthread as Worker; } else { worker = pthread.worker; }\r\n\r\n if (worker == null) { throw new Error(`Unable get Worker for pthread ${pthreadId}`); }\r\n const offscreen = canvas.transferControlToOffscreen();\r\n worker.postMessage({\r\n avaloniaCmd: \"registerCanvas\",\r\n canvas: offscreen,\r\n modes: preferredModes,\r\n id\r\n }, [offscreen]);\r\n WebRenderTargetRegistry.registry[id] = {\r\n canvas,\r\n worker\r\n };\r\n }\r\n return id;\r\n }\r\n\r\n static initializeWorker() {\r\n const oldHandler = self.onmessage;\r\n self.onmessage = ev => {\r\n const msg = ev;\r\n if (msg.data.avaloniaCmd === \"registerCanvas\") {\r\n WebRenderTargetRegistry.targets[msg.data.id] = WebRenderTargetRegistry.createRenderTarget(msg.data.canvas, msg.data.modes);\r\n } else if (msg.data.avaloniaCmd === \"unregisterCanvas\") {\r\n /* eslint-disable */\r\n // Our keys are _always_ numbers and are safe to delete\r\n delete WebRenderTargetRegistry.targets[msg.data.id];\r\n /* eslint-enable */\r\n } else if (oldHandler != null) { oldHandler.call(self, ev); }\r\n };\r\n }\r\n\r\n static getRenderTarget(id: number): WebRenderTarget | undefined {\r\n return WebRenderTargetRegistry.targets[id];\r\n }\r\n\r\n private static createRenderTarget(canvas: HTMLCanvasElement | OffscreenCanvas, modes: BrowserRenderingMode[]): WebRenderTarget {\r\n for (const mode of modes) {\r\n try {\r\n if (mode === BrowserRenderingMode.Software2D) { return new SoftwareRenderTarget(canvas); }\r\n return new WebGlRenderTarget(canvas, mode);\r\n } catch (e) {\r\n let message = \"\";\r\n if (e instanceof Error) { message = \": \" + e.message; }\r\n console.error(`Failed to create render target for mode ${mode} ${message}`);\r\n }\r\n }\r\n // Still try software as a fallback\r\n return new SoftwareRenderTarget(canvas);\r\n }\r\n}\r\n", "import { avaloniaDb, fileBookmarksStore } from \"./indexedDb\";\r\nimport { FileSystemFileHandle, FileSystemDirectoryHandle, FileSystemWritableFileStream } from \"native-file-system-adapter\";\r\nimport { Caniuse } from \"../avalonia\";\r\n\r\nexport class StorageItem {\r\n private constructor(\r\n public handle?: FileSystemFileHandle | FileSystemDirectoryHandle,\r\n private readonly file?: File,\r\n private readonly bookmarkId?: string,\r\n public wellKnownType?: WellKnownDirectory\r\n ) {\r\n }\r\n\r\n public get name(): string {\r\n if (this.handle) {\r\n return this.handle.name;\r\n }\r\n if (this.file) {\r\n return this.file.name;\r\n }\r\n return this.wellKnownType ?? \"\";\r\n }\r\n\r\n public get kind(): \"file\" | \"directory\" {\r\n if (this.handle) {\r\n return this.handle.kind;\r\n }\r\n if (this.file) {\r\n return \"file\";\r\n }\r\n return \"directory\";\r\n }\r\n\r\n public static createFromHandle(handle: FileSystemFileHandle | FileSystemDirectoryHandle, bookmarkId?: string) {\r\n return new StorageItem(handle, undefined, bookmarkId, undefined);\r\n }\r\n\r\n public static createFromFile(file: File) {\r\n return new StorageItem(undefined, file, undefined, undefined);\r\n }\r\n\r\n public static createWellKnownDirectory(type: WellKnownDirectory) {\r\n return new StorageItem(undefined, undefined, undefined, type);\r\n }\r\n\r\n public static async openRead(item: StorageItem): Promise {\r\n if (item.file) {\r\n return item.file;\r\n }\r\n\r\n if (!item.handle || item.kind !== \"file\") {\r\n throw new Error(\"StorageItem is not a file\");\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n const file = await (item.handle as FileSystemFileHandle).getFile();\r\n return file;\r\n }\r\n\r\n public static async openWrite(item: StorageItem): Promise {\r\n if (!item.handle || item.kind !== \"file\") {\r\n throw new Error(\"StorageItem is not a writeable file\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await (item.handle as FileSystemFileHandle).createWritable({ keepExistingData: true });\r\n }\r\n\r\n public static async getProperties(item: StorageItem): Promise<{ Size: number; LastModified: number; Type: string } | null> {\r\n // getFile can fail with an exception depending if we use polyfill with a save file dialog or not.\r\n try {\r\n const file = item.handle && \"getFile\" in item.handle\r\n ? await item.handle.getFile()\r\n : item.file;\r\n\r\n if (!file) {\r\n return null;\r\n }\r\n\r\n return {\r\n Size: file.size,\r\n LastModified: file.lastModified,\r\n Type: file.type\r\n };\r\n } catch {\r\n return null;\r\n }\r\n }\r\n\r\n public static getItemsIterator(item: StorageItem): any | null {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n return (item.handle as any).entries();\r\n }\r\n\r\n public static async createFile(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n throw new TypeError(\"Unable to create item in the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).getFileHandle(name, { create: true }) as Promise);\r\n }\r\n\r\n public static async getFile(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n return await ((item.handle as any).getFileHandle(name) as Promise);\r\n }\r\n\r\n public static async createFolder(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n throw new TypeError(\"Unable to create item in the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).getDirectoryHandle(name, { create: true }) as Promise);\r\n }\r\n\r\n public static async getFolder(item: StorageItem, name: string): Promise {\r\n if (item.kind !== \"directory\" || !item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"read\");\r\n\r\n return await ((item.handle as any).getDirectoryHandle(name) as Promise);\r\n }\r\n\r\n public static async deleteAsync(item: StorageItem): Promise {\r\n if (!item.handle) {\r\n return null;\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).remove({ recursive: true }) as Promise);\r\n }\r\n\r\n public static async moveAsync(item: StorageItem, destination: StorageItem): Promise {\r\n if (!item.handle) {\r\n return null;\r\n }\r\n if (destination.kind !== \"directory\" || !destination.handle) {\r\n throw new TypeError(\"Unable to move item to the requested directory\");\r\n }\r\n\r\n await item.verityPermissions(\"readwrite\");\r\n\r\n return await ((item.handle as any).move(destination /*, newName */) as Promise);\r\n }\r\n\r\n private async verityPermissions(mode: \"read\" | \"readwrite\"): Promise {\r\n if (!this.handle) {\r\n return;\r\n }\r\n\r\n // If we are using polyfill, let it decide permissions by itself, we can't request anything in this case.\r\n if (!Caniuse.hasNativeFilePicker()) {\r\n return;\r\n }\r\n\r\n if (await this.handle.queryPermission({ mode }) === \"granted\") {\r\n return;\r\n }\r\n\r\n if (await this.handle.requestPermission({ mode }) === \"denied\") {\r\n throw new Error(\"Permissions denied\");\r\n }\r\n }\r\n\r\n public static async saveBookmark(item: StorageItem): Promise {\r\n // If file was previously bookmarked, just return old one.\r\n if (item.bookmarkId) {\r\n return item.bookmarkId;\r\n }\r\n\r\n // Bookmarks are not supported with polyfill.\r\n if (!item.handle || !Caniuse.hasNativeFilePicker()) {\r\n return null;\r\n }\r\n\r\n const connection = await avaloniaDb.connect();\r\n try {\r\n const key = await connection.put(fileBookmarksStore, item.handle, item.generateBookmarkId());\r\n return key as string;\r\n } finally {\r\n connection.close();\r\n }\r\n }\r\n\r\n public static async deleteBookmark(item: StorageItem): Promise {\r\n if (!item.bookmarkId || !Caniuse.hasNativeFilePicker()) {\r\n return;\r\n }\r\n\r\n const connection = await avaloniaDb.connect();\r\n try {\r\n await connection.delete(fileBookmarksStore, item.bookmarkId);\r\n } finally {\r\n connection.close();\r\n }\r\n }\r\n\r\n private generateBookmarkId(): string {\r\n return Date.now().toString(36) + Math.random().toString(36).substring(2);\r\n }\r\n}\r\n\r\nexport class StorageItems {\r\n constructor(private readonly items: StorageItem[]) { }\r\n\r\n public static itemsArray(instance: StorageItems): StorageItem[] {\r\n return instance.items;\r\n }\r\n\r\n public static filesToItemsArray(files: File[]): StorageItem[] {\r\n if (!files) {\r\n return [];\r\n }\r\n\r\n const retItems = [];\r\n for (let i = 0; i < files.length; i++) {\r\n retItems[i] = StorageItem.createFromFile(files[i]);\r\n }\r\n return retItems;\r\n }\r\n}\r\n", "/** @typedef {import('./FileSystemDirectoryHandle.js').default} FileSystemDirectoryHandle */\n\nconst native = globalThis.showDirectoryPicker\n\n/**\n * @param {Object} [options]\n * @param {boolean} [options._preferPolyfill] If you rather want to use the polyfill instead of the native\n * @returns {Promise}\n */\nasync function showDirectoryPicker (options = {}) {\n if (native && !options._preferPolyfill) {\n return native(options)\n }\n\n const input = document.createElement('input')\n input.type = 'file'\n\n // Even with this check, the browser may support the attribute, but not the functionality (e.g. iOS Safari)\n if (!('webkitdirectory' in input)) {\n throw new Error(`HTMLInputElement.webkitdirectory is not supported`)\n }\n\n // See https://stackoverflow.com/questions/47664777/javascript-file-input-onchange-not-working-ios-safari-only\n input.style.position = 'fixed'\n input.style.top = '-100000px'\n input.style.left = '-100000px'\n document.body.appendChild(input)\n\n input.webkitdirectory = true\n\n // Lazy load while the user is choosing the directory\n const p = import('./util.js')\n\n await new Promise(resolve => {\n input.addEventListener('change', resolve)\n input.click()\n })\n\n return p.then(mod => mod.getDirHandlesFromInput(input))\n}\n\nexport default showDirectoryPicker\nexport { showDirectoryPicker }\n", "/** @typedef {import('./FileSystemFileHandle.js').default} FileSystemFileHandle */\n\nconst def = { accepts: [] }\nconst native = globalThis.showOpenFilePicker\n\n/**\n * @param {Object} [options]\n * @param {boolean} [options.multiple] If you want to allow more than one file\n * @param {boolean} [options.excludeAcceptAllOption=false] Prevent user for selecting any\n * @param {Object[]} [options.accepts] Files you want to accept\n * @param {boolean} [options._preferPolyfill] If you rather want to use the polyfill instead of the native\n * @returns {Promise}\n */\nasync function showOpenFilePicker (options = {}) {\n const opts = { ...def, ...options }\n\n if (native && !options._preferPolyfill) {\n return native(opts)\n }\n\n const input = document.createElement('input')\n input.type = 'file'\n input.multiple = opts.multiple\n input.accept = (opts.accepts || [])\n .map(e => [\n ...(e.extensions || []).map(e => '.' + e),\n ...e.mimeTypes || []]\n )\n .flat()\n .join(',')\n\n // See https://stackoverflow.com/questions/47664777/javascript-file-input-onchange-not-working-ios-safari-only\n input.style.position = 'fixed'\n input.style.top = '-100000px'\n input.style.left = '-100000px'\n document.body.appendChild(input)\n\n // Lazy load while the user is choosing the directory\n const p = import('./util.js')\n\n await new Promise(resolve => {\n input.addEventListener('change', resolve)\n input.click()\n })\n\n return p.then(m => m.getFileHandlesFromInput(input))\n}\n\nexport default showOpenFilePicker\nexport { showOpenFilePicker }\n", "/** @typedef {import('./FileSystemFileHandle.js').default} FileSystemFileHandle */\n\nconst native = globalThis.showSaveFilePicker\n\n/**\n * @param {Object} [options]\n * @param {boolean} [options.excludeAcceptAllOption=false] Prevent user for selecting any\n * @param {Object[]} [options.types] Files you want to accept\n * @param {string} [options.suggestedName] the name to fall back to when using polyfill\n * @param {string} [options._name] the name to fall back to when using polyfill\n * @param {boolean} [options._preferPolyfill] If you rather want to use the polyfill instead of the native\n * @return {Promise}\n */\nasync function showSaveFilePicker (options = {}) {\n if (native && !options._preferPolyfill) {\n return native(options)\n }\n\n if (options._name) {\n console.warn('deprecated _name, spec now have `suggestedName`')\n options.suggestedName = options._name\n }\n\n const { FileSystemFileHandle } = await import('./FileSystemFileHandle.js')\n const { FileHandle } = await import('./adapters/downloader.js')\n return new FileSystemFileHandle(new FileHandle(options.suggestedName))\n}\n\nexport default showSaveFilePicker\nexport { showSaveFilePicker }\n", "/** @typedef {import('./FileSystemDirectoryHandle.js').default} FileSystemDirectoryHandle */\n\nif (globalThis.DataTransferItem && !DataTransferItem.prototype.getAsFileSystemHandle) {\n DataTransferItem.prototype.getAsFileSystemHandle = async function () {\n const entry = this.webkitGetAsEntry()\n const [\n { FileHandle, FolderHandle },\n { FileSystemDirectoryHandle },\n { FileSystemFileHandle }\n ] = await Promise.all([\n import('./adapters/sandbox.js'),\n import('./FileSystemDirectoryHandle.js'),\n import('./FileSystemFileHandle.js')\n ])\n\n return entry.isFile\n ? new FileSystemFileHandle(new FileHandle(entry, false))\n : new FileSystemDirectoryHandle(new FolderHandle(entry, false))\n }\n}\n\n/**\n * @param {object=} driver\n * @return {Promise}\n */\nasync function getOriginPrivateDirectory (driver, options = {}) {\n if (!driver) {\n return globalThis.navigator?.storage?.getDirectory() || globalThis.getOriginPrivateDirectory()\n }\n const {FileSystemDirectoryHandle} = await import('./FileSystemDirectoryHandle.js')\n const module = await driver\n const sandbox = await (module.default\n ? module.default(options)\n : module(options)\n )\n return new FileSystemDirectoryHandle(sandbox)\n}\n\nexport default getOriginPrivateDirectory\n", "import showDirectoryPicker from './showDirectoryPicker.js'\nimport showOpenFilePicker from './showOpenFilePicker.js'\nimport showSaveFilePicker from './showSaveFilePicker.js'\nimport getOriginPrivateDirectory from './getOriginPrivateDirectory.js'\nimport FileSystemDirectoryHandle from './FileSystemDirectoryHandle.js'\nimport FileSystemFileHandle from './FileSystemFileHandle.js'\nimport FileSystemHandle from './FileSystemHandle.js'\nimport FileSystemWritableFileStream from './FileSystemWritableFileStream.js'\n\nexport {\n FileSystemDirectoryHandle,\n FileSystemFileHandle,\n FileSystemHandle,\n FileSystemWritableFileStream,\n getOriginPrivateDirectory,\n showDirectoryPicker,\n showOpenFilePicker,\n showSaveFilePicker\n}\n", "import { avaloniaDb, fileBookmarksStore } from \"./indexedDb\";\r\nimport { StorageItem, StorageItems } from \"./storageItem\";\r\nimport { showOpenFilePicker, showDirectoryPicker, showSaveFilePicker, FileSystemFileHandle } from \"native-file-system-adapter\";\r\n\r\ndeclare global {\r\n type WellKnownDirectory = \"desktop\" | \"documents\" | \"downloads\" | \"music\" | \"pictures\" | \"videos\";\r\n interface FilePickerAcceptType {\r\n description?: string | undefined;\r\n accept: Record;\r\n }\r\n}\r\n\r\nexport class StorageProvider {\r\n public static async selectFolderDialog(\r\n startIn: StorageItem | null,\r\n preferPolyfill: boolean): Promise {\r\n // 'Picker' API doesn't accept \"null\" as a parameter, so it should be set to undefined.\r\n const options = {\r\n startIn: (startIn?.wellKnownType ?? startIn?.handle ?? undefined),\r\n _preferPolyfill: preferPolyfill\r\n };\r\n\r\n const handle = await showDirectoryPicker(options as any);\r\n return StorageItem.createFromHandle(handle);\r\n }\r\n\r\n public static async openFileDialog(\r\n startIn: StorageItem | null, multiple: boolean,\r\n types: FilePickerAcceptType[] | null, excludeAcceptAllOption: boolean,\r\n preferPolyfill: boolean): Promise {\r\n const options = {\r\n startIn: (startIn?.wellKnownType ?? startIn?.handle ?? undefined),\r\n multiple,\r\n excludeAcceptAllOption,\r\n types: (types ?? undefined),\r\n _preferPolyfill: preferPolyfill\r\n };\r\n\r\n const handles = await showOpenFilePicker(options);\r\n return new StorageItems(handles.map((handle: FileSystemFileHandle) => StorageItem.createFromHandle(handle)));\r\n }\r\n\r\n public static async saveFileDialog(\r\n startIn: StorageItem | null, suggestedName: string | null,\r\n types: FilePickerAcceptType[] | null, excludeAcceptAllOption: boolean,\r\n preferPolyfill: boolean): Promise {\r\n const options = {\r\n startIn: (startIn?.wellKnownType ?? startIn?.handle ?? undefined),\r\n suggestedName: (suggestedName ?? undefined),\r\n excludeAcceptAllOption,\r\n types: (types ?? undefined),\r\n _preferPolyfill: preferPolyfill\r\n };\r\n\r\n const handle = await showSaveFilePicker(options);\r\n return StorageItem.createFromHandle(handle);\r\n }\r\n\r\n public static async openBookmark(key: string): Promise {\r\n const connection = await avaloniaDb.connect();\r\n try {\r\n const handle = await connection.get(fileBookmarksStore, key);\r\n return handle && StorageItem.createFromHandle(handle, key);\r\n } finally {\r\n connection.close();\r\n }\r\n }\r\n\r\n public static createAcceptType(description: string, mimeTypes: string[], extensions: string[] | undefined): FilePickerAcceptType {\r\n const accept: Record = {};\r\n mimeTypes.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Handle", "FolderHandle", "Sink", "memory_default", "File", "Blob", "DOMException", "INVALID", "GONE", "MISMATCH", "MOD_ERR", "SYNTAX", "SECURITY", "DISALLOWED", "fs", "init_memory", "__esmMin", "init_util", "init_config", "config_default", "errors", "fileHandle", "file", "chunk", "blob", "head", "tail", "padding", "name", "writable", "opts", "other", "entry", "isFile", "recursive", "x", "sandbox_exports", "__export", "FileHandle", "FolderHandle", "sandbox_default", "DISALLOWED", "Sink", "init_sandbox", "__esmMin", "init_util", "errors", "writer", "fileEntry", "chunk", "resolve", "reject", "evt", "file", "writable", "other", "opts", "fileWriter", "dir", "reader", "entries", "x", "name", "entry", "err", "e", "kAdapter", "_a", "FileSystemHandle", "FileSystemHandle_default", "init_FileSystemHandle", "__esmMin", "adapter", "__publicField", "mode", "handle", "options", "other", "WritableStream", "FileSystemWritableFileStream", "FileSystemWritableFileStream_default", "init_FileSystemWritableFileStream", "__esmMin", "init_config", "config_default", "args", "w", "p", "position", "size", "data", "writer", "FileSystemFileHandle_exports", "__export", "FileSystemFileHandle", "FileSystemFileHandle_default", "kAdapter", "_a", "init_FileSystemFileHandle", "__esmMin", "init_FileSystemHandle", "init_FileSystemWritableFileStream", "FileSystemHandle_default", "adapter", "__publicField", "options", "FileSystemWritableFileStream_default", "FileSystemDirectoryHandle_exports", "__export", "FileSystemDirectoryHandle", "FileSystemDirectoryHandle_default", "kAdapter", "_a", "init_FileSystemDirectoryHandle", "__esmMin", "init_FileSystemHandle", "FileSystemHandle_default", "adapter", "__publicField", "name", "options", "handle", "FileSystemFileHandle", "_", "entry", "possibleDescendant", "openSet", "current", "path", "util_exports", "__export", "config", "errors", "fromDataTransfer", "getDirHandlesFromInput", "getFileHandlesFromInput", "entries", "memory", "sandbox", "fs", "folder", "entry", "input", "FolderHandle", "FileHandle", "FileSystemDirectoryHandle", "files", "rootName", "root", "file", "path", "name", "dir", "FileSystemFileHandle", "init_util", "__esmMin", "m", "downloader_exports", "__export", "FileHandle", "WritableStream", "TransformStream", "DOMException", "Blob", "GONE", "isSafari", "WRITE", "PULL", "ERROR", "ABORT", "CLOSE", "MessagePortSink", "RemoteWritableStream", "init_downloader", "__esmMin", "init_util", "init_config", "config_default", "errors", "name", "other", "options", "_a", "sw", "link", "ts", "sink", "chunks", "chunk", "blob", "writable", "readablePort", "fileName", "headers", "keepAlive", "ctrl", "reader", "pump", "_", "e", "iframe", "port", "event", "controller", "message", "reason", "resolve", "reject", "channel", "InnerDbConnection", "database", "store", "mode", "obj", "key", "os", "resolve", "reject", "response", "IndexedDbWrapper", "databaseName", "objectStores", "conn", "event", "db", "fileBookmarksStore", "avaloniaDb", "CaretHelper", "element", "position", "options", "_a", "_b", "isBrowser", "debug", "el", "div", "style", "computed", "isInput", "properties", "prop", "height", "outerHeight", "targetHeight", "isFirefox", "span", "coordinates", "JsExports", "_a", "resolveExports", "runtimeApi", "InputHelper", "args", "items", "item", "dataTransfer", "dataTransferList", "format", "source", "value", "bytes", "window", "clipboard", "resolve", "reject", "_a", "clipboardItem", "blob", "dataTransferItem", "stringValue", "str", "file", "StorageItem", "element", "topLevelId", "keySub", "pointerSub", "textSub", "dndSub", "paneSub", "keyDownHandler", "JsExports", "handled", "keyUpHandler", "compositionStartHandler", "beforeInputHandler", "ranges", "start", "end", "compositionUpdateHandler", "compositionEndHandler", "pointerMoveHandler", "pointerDownHandler", "pointerUpHandler", "pointerCancelHandler", "wheelHandler", "handler", "overAndDropHandler", "pointerEvent", "e", "listener", "event", "elementRect", "keyboardRect", "inputElement", "kind", "x", "y", "caretWidth", "caretHeight", "caret", "left", "top", "CaretHelper", "text", "modifiers", "buttons", "containerElement", "pointerId", "Caniuse", "_a", "userAgentData", "userAgent", "regex1", "regex2", "WebRenderTarget", "canvas", "type", "target", "w", "h", "getGL", "_a", "_b", "_c", "_d", "self", "module", "_WebGlRenderTarget", "WebRenderTarget", "canvas", "mode", "attrs", "context", "handle", "ret", "WebGlRenderTarget", "SoftwareRenderTarget", "WebRenderTarget", "canvas", "context", "pointer", "length", "width", "height", "_a", "heap8", "clampedBuffer", "dstArrayBuffer", "copy", "imageData", "target", "_WebRenderTargetRegistry", "pthreadId", "canvas", "preferredModes", "_a", "_b", "id", "self", "module", "pthreads", "pthread", "worker", "offscreen", "oldHandler", "ev", "msg", "modes", "mode", "SoftwareRenderTarget", "WebGlRenderTarget", "e", "message", "WebRenderTargetRegistry", "StorageItem", "handle", "file", "bookmarkId", "wellKnownType", "_a", "type", "item", "name", "destination", "mode", "Caniuse", "connection", "avaloniaDb", "fileBookmarksStore", "StorageItems", "items", "instance", "files", "retItems", "i", "native", "showDirectoryPicker", "options", "input", "p", "resolve", "mod", "showDirectoryPicker_default", "def", "native", "showOpenFilePicker", "options", "opts", "input", "e", "p", "resolve", "m", "showOpenFilePicker_default", "native", "showSaveFilePicker", "options", "FileSystemFileHandle", "FileHandle", "showSaveFilePicker_default", "entry", "FileHandle", "FolderHandle", "FileSystemDirectoryHandle", "FileSystemFileHandle", "init_FileSystemDirectoryHandle", "init_FileSystemFileHandle", "init_FileSystemHandle", "init_FileSystemWritableFileStream", "StorageProvider", "startIn", "preferPolyfill", "_a", "_b", "options", "handle", "showDirectoryPicker_default", "StorageItem", "multiple", "types", "excludeAcceptAllOption", "handles", "showOpenFilePicker_default", "StorageItems", "suggestedName", "showSaveFilePicker_default", "key", "connection", "avaloniaDb", "fileBookmarksStore", "description", "mimeTypes", "extensions", "accept", "a"] +} diff --git a/_framework/storage.js.map.br b/_framework/storage.js.map.br new file mode 100644 index 0000000..762223c Binary files /dev/null and b/_framework/storage.js.map.br differ diff --git a/_framework/storage.js.map.gz b/_framework/storage.js.map.gz new file mode 100644 index 0000000..f4a808b Binary files /dev/null and b/_framework/storage.js.map.gz differ diff --git a/_framework/sw.js b/_framework/sw.js new file mode 100755 index 0000000..ba35405 --- /dev/null +++ b/_framework/sw.js @@ -0,0 +1,2 @@ +var r=class{constructor(e){this.port=e;this.port.onmessage=a=>this.onMessage(a.data)}start(e){this.controller=e}cancel(e){this.port.postMessage({type:1,reason:e.message}),this.port.close()}onMessage(e){!this.controller||(e.type===0&&(this.controller.enqueue(e.chunk),this.port.postMessage({type:0})),e.type===1&&(this.controller.error(e.reason),this.port.close()),e.type===2&&(this.controller.close(),this.port.close()))}};self.addEventListener("install",()=>{self.skipWaiting()});self.addEventListener("activate",t=>{t.waitUntil(self.clients.claim())});self.map=new Map;globalThis.addEventListener("message",t=>{let e=t.data;e.url&&e.readablePort&&(e.rs=new ReadableStream(new r(t.data.readablePort),new CountQueuingStrategy({highWaterMark:4})),self.map.set(e.url,e))});globalThis.addEventListener("fetch",t=>{let e=t.request.url,a=self.map,s=a.get(e);if(!s)return null;a.delete(e),t.respondWith(new Response(s.rs,{headers:s.headers}))}); +//# sourceMappingURL=sw.js.map diff --git a/_framework/sw.js.br b/_framework/sw.js.br new file mode 100644 index 0000000..57195f2 --- /dev/null +++ b/_framework/sw.js.br @@ -0,0 +1,4 @@ + We%G0z%sƏ?$' +ɽ?cuO˲-.}*(8'#+.^\slC-RŔT{p+NJz+K21Lb| +ObӘ(Re1K;p[ _MCW|`i7Qo +۶:A{ :3֘itƵ/vcӮ۲L:3WC,O]ɵ/f8-»S?x ^ {f. 9@q8č,NC&7%_̑l#*b/|ΛWw畐hZp@J x+ʇ5jqV4GuP؀%kJ;Cv\KJ޸ +J5==iZ \ No newline at end of file diff --git a/_framework/sw.js.gz b/_framework/sw.js.gz new file mode 100644 index 0000000..430b93c Binary files /dev/null and b/_framework/sw.js.gz differ diff --git a/_framework/sw.js.map b/_framework/sw.js.map new file mode 100755 index 0000000..dd3e663 --- /dev/null +++ b/_framework/sw.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../webapp/modules/sw.ts"], + "sourcesContent": ["const WRITE = 0;\r\nconst PULL = 0;\r\nconst ERROR = 1;\r\nconst ABORT = 1;\r\nconst CLOSE = 2;\r\n\r\nclass MessagePortSource implements UnderlyingSource {\r\n private controller?: ReadableStreamController;\r\n\r\n constructor (private readonly port: MessagePort) {\r\n this.port.onmessage = evt => this.onMessage(evt.data);\r\n }\r\n\r\n start (controller: ReadableStreamController) {\r\n this.controller = controller;\r\n }\r\n\r\n cancel (reason: Error) {\r\n // Firefox can notify a cancel event, chrome can't\r\n // https://bugs.chromium.org/p/chromium/issues/detail?id=638494\r\n this.port.postMessage({ type: ERROR, reason: reason.message });\r\n this.port.close();\r\n }\r\n\r\n onMessage (message: { type: number; chunk: Uint8Array; reason: any }) {\r\n // enqueue() will call pull() if needed when there's no backpressure\r\n if (!this.controller) {\r\n return;\r\n }\r\n if (message.type === WRITE) {\r\n this.controller.enqueue(message.chunk);\r\n this.port.postMessage({ type: PULL });\r\n }\r\n if (message.type === ABORT) {\r\n this.controller.error(message.reason);\r\n this.port.close();\r\n }\r\n if (message.type === CLOSE) {\r\n this.controller.close();\r\n this.port.close();\r\n }\r\n }\r\n}\r\n\r\nself.addEventListener(\"install\", () => {\r\n (self as any).skipWaiting();\r\n});\r\n\r\nself.addEventListener(\"activate\", event /* ExtendableEvent */ => {\r\n (event as any).waitUntil((self as any).clients.claim());\r\n});\r\n\r\n(self as any).map = new Map();\r\n\r\n// This should be called once per download\r\n// Each event has a dataChannel that the data will be piped through\r\nglobalThis.addEventListener(\"message\", evt => {\r\n const data = evt.data;\r\n if (data.url && data.readablePort) {\r\n data.rs = new ReadableStream(\r\n new MessagePortSource(evt.data.readablePort),\r\n new CountQueuingStrategy({ highWaterMark: 4 })\r\n );\r\n const map = (self as any).map;\r\n map.set(data.url, data);\r\n }\r\n});\r\n\r\nglobalThis.addEventListener(\"fetch\", evt => {\r\n const url = (evt as any).request.url;\r\n const map = (self as any).map;\r\n const data = map.get(url);\r\n if (!data) return null;\r\n map.delete(url);\r\n (evt as any).respondWith(new Response(data.rs, {\r\n headers: data.headers\r\n }));\r\n});\r\n\r\nexport {};\r\n"], + "mappings": "AAMA,IAAMA,EAAN,KAAoD,CAGhD,YAA8BC,EAAmB,CAAnB,UAAAA,EAC1B,KAAK,KAAK,UAAYC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essagePortSource", "port", "evt", "controller", "reason", "message", "event", "data", "url", "map"] +} diff --git a/_framework/sw.js.map.br b/_framework/sw.js.map.br new file mode 100644 index 0000000..a27f315 Binary files /dev/null and b/_framework/sw.js.map.br differ diff --git a/_framework/sw.js.map.gz b/_framework/sw.js.map.gz new file mode 100644 index 0000000..5848117 Binary files /dev/null and b/_framework/sw.js.map.gz differ diff --git a/app.css b/app.css new file mode 100644 index 0000000..1d6f754 --- /dev/null +++ b/app.css @@ -0,0 +1,58 @@ +/* HTML styles for the splash screen */ +.avalonia-splash { + position: absolute; + height: 100%; + width: 100%; + background: white; + font-family: 'Outfit', sans-serif; + justify-content: center; + align-items: center; + display: flex; + pointer-events: none; +} + +/* Light theme styles */ +@media (prefers-color-scheme: light) { + .avalonia-splash { + background: white; + } + + .avalonia-splash h2 { + color: #1b2a4e; + } + + .avalonia-splash a { + color: #0D6EFD; + } +} + +@media (prefers-color-scheme: dark) { + .avalonia-splash { + background: #1b2a4e; + } + + .avalonia-splash h2 { + color: white; + } + + .avalonia-splash a { + color: white; + } +} + +.avalonia-splash h2 { + font-weight: 400; + font-size: 1.5rem; +} + +.avalonia-splash a { + text-decoration: none; + font-size: 2.5rem; + display: block; +} + +.avalonia-splash.splash-close { + transition: opacity 200ms, display 200ms; + display: none; + opacity: 0; +} diff --git a/app.css.br b/app.css.br new file mode 100644 index 0000000..d163947 Binary files /dev/null and b/app.css.br differ diff --git a/app.css.gz b/app.css.gz new file mode 100644 index 0000000..71737dc Binary files /dev/null and b/app.css.gz differ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..9639c72 Binary files /dev/null and b/favicon.ico differ diff --git a/favicon.ico.br b/favicon.ico.br new file mode 100644 index 0000000..9a903f4 Binary files /dev/null and b/favicon.ico.br differ diff --git a/favicon.ico.gz b/favicon.ico.gz new file mode 100644 index 0000000..bb974db Binary files /dev/null and b/favicon.ico.gz differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..c295e05 --- /dev/null +++ b/index.html @@ -0,0 +1,37 @@ + + + + + Semi.Avalonia.Demo.Web + + + + + + + +
+
+

+ Powered by + + + + + + + + + + + + + + +

+
+
+ + + + diff --git a/index.html.br b/index.html.br new file mode 100644 index 0000000..9b0acd6 Binary files /dev/null and b/index.html.br differ diff --git a/index.html.gz b/index.html.gz new file mode 100644 index 0000000..7bd0c5a Binary files /dev/null and b/index.html.gz differ diff --git a/main.js b/main.js new file mode 100644 index 0000000..d9dec01 --- /dev/null +++ b/main.js @@ -0,0 +1,13 @@ +import { dotnet } from './_framework/dotnet.js' + +const is_browser = typeof window != "undefined"; +if (!is_browser) throw new Error(`Expected to be running in a browser`); + +const dotnetRuntime = await dotnet + .withDiagnosticTracing(false) + .withApplicationArgumentsFromQuery() + .create(); + +const config = dotnetRuntime.getConfig(); + +await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]); diff --git a/main.js.br b/main.js.br new file mode 100644 index 0000000..9377c98 Binary files /dev/null and b/main.js.br differ diff --git a/main.js.gz b/main.js.gz new file mode 100644 index 0000000..d5429af Binary files /dev/null and b/main.js.gz differ