barkoder-wasm-ocr 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +0 -205
- package/README.md +8 -9
- package/barkoder-umd.js +32 -629
- package/barkoder.wasm +0 -0
- package/package.json +1 -1
package/barkoder-umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof module!=='undefined'&&module.exports){
|
|
1
|
+
(async function(name,context,definition){window.has_SIMD=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]));if(typeof window!=='undefined'&&typeof define=='function'&&define.amd){define(definition)}
|
|
2
|
+
if(typeof module!=='undefined'&&module.exports){module.exports=definition()}else{context[name]=await definition()}})('BarkoderSDK',this,function(){class DOM_elements{static container=document.getElementById('barkoder-container');static cameraPreview=document.createElement('div');static preview=document.createElement('video');static overlay=document.createElement('canvas');static readyToUse_RO=false;static resizeObserver=new ResizeObserver(()=>{if(DOM_elements.readyToUse_RO)
|
|
3
3
|
{Bridge.resizeHandler();}});static flash=document.createElement('div');static zoom=document.createElement('div');static close=document.createElement('div');static cameraPicker=document.createElement('div');static cameraPickerUI=document.createElement('div');static cameraPickerUI_style=document.createElement('style');static buttonsProperties={flash_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9mZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4Ig0KCSB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDggNDg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOm5vbmU7c3Ryb2tlOiNGRjMzNDc7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9DQo8L3N0eWxlPg0KPGcgaWQ9ImJ0bl9iZyI+DQoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTgsMWgzMmMzLjksMCw3LDMuMSw3LDd2MzJjMCwzLjktMy4xLDctNyw3SDhjLTMuOSwwLTctMy4xLTctN1Y4QzEsNC4xLDQuMSwxLDgsMXoiLz4NCjwvZz4NCjxwYXRoIGlkPSJQYXRoXzMxIiBjbGFzcz0ic3QxIiBkPSJNMTgsMTFoMTNsLTQuNSw5SDMxbC05LjEsMTYuOFYyNi41SDE4VjExeiBNMjAuNiwxMy41djEwLjRoMy45djMuNWwyLjYtNC43aC00LjlsNC42LTkuMQ0KCUwyMC42LDEzLjV6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9uIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Qzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iUGF0aF8zNCIgY2xhc3M9InN0MSIgZD0iTTE4LDExdjE0LjJoMy45djExLjZMMzEsMjEuM2gtNS4yTDMxLDExSDE4eiIvPg0KPC9zdmc+DQo='],zoom_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb24iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCINCgkgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojRkYzMzQ3O3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lam9pbjpyb3VuZDt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDFoMzJjMy45LDAsNywzLjEsNyw3djMyYzAsMy45LTMuMSw3LTcsN0g4Yy0zLjksMC03LTMuMS03LTdWOEMxLDQuMSw0LjEsMSw4LDF6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNSwwLjYsMC41LDEuNS0wLjEsMlMzNC4xLDM2LjEsMzMuNiwzNS42TDMzLjYsMzUuNnogTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjgNCglzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0yMS42LDI3LjRjLTAuMy0wLjMtMC40LTAuNi0wLjQtMVYyNGgtMi40DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRzMC42LTEuNCwxLjQtMS40bDAsMGgyLjR2LTIuNGMwLTAuOCwwLjYtMS40LDEuNC0xLjVTMjQsMTgsMjQsMTguOHYwLjF2Mi40aDIuNGMwLjgsMCwxLjQsMC42LDEuNCwxLjQNCglzLTAuNiwxLjQtMS40LDEuNGwwLDBIMjR2Mi40YzAsMC44LTAuNiwxLjQtMS40LDEuNEMyMi4yLDI3LjgsMjEuOSwyNy43LDIxLjYsMjcuNEwyMS42LDI3LjR6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb2ZmIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Nzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNiwwLjUsMC42LDEuNCwwLjEsMmMtMC41LDAuNi0xLjQsMC42LTIsMC4xQzMzLjYsMzUuNywzMy42LDM1LjYsMzMuNiwzNS42TDMzLjYsMzUuNnoNCgkgTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjhzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0xOC44LDI0DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRjMC0wLjgsMC42LTEuNCwxLjQtMS40YzAsMCwwLDAsMCwwaDcuNmMwLjgsMCwxLjQsMC42LDEuNCwxLjRjMCwwLjgtMC42LDEuNC0xLjQsMS40YzAsMCwwLDAsMCwwSDE4Ljh6Ii8+DQo8L3N2Zz4NCg=='],close_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWNsb3NlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9DQoJLnN0MXtmaWxsOm5vbmU7fQ0KPC9zdHlsZT4NCjxwYXRoIGlkPSJQYXRoXzMwIiBjbGFzcz0ic3QwIiBkPSJNMjIsNGwtMi0ybC04LDhMNCwyTDIsNGw4LDhsLTgsOGwyLDJsOC04bDgsOGwyLTJsLTgtOEwyMiw0eiIvPg0KPHJlY3QgaWQ9IlJlY3RhbmdsZV8zOCIgeT0iMCIgY2xhc3M9InN0MSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+DQo8L3N2Zz4NCg=='],cameraPicker_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSwgLmNscy0yIHsKICAgICAgICBmaWxsOiAjRkZGRkZGOwogICAgICAgIHN0cm9rZS13aWR0aDogMHB4OwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGwtcnVsZTogZXZlbm9kZDsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTUsMjIuNzVoLTZjLTUuNDMsMC03Ljc1LTIuMzItNy43NS03Ljc1di02QzEuMjUsMy41NywzLjU3LDEuMjUsOSwxLjI1aDZjNS40MywwLDcuNzUsMi4zMiw3Ljc1LDcuNzV2NmMwLDUuNDMtMi4zMiw3Ljc1LTcuNzUsNy43NVpNOSwyLjc1Yy00LjYxLDAtNi4yNSwxLjY0LTYuMjUsNi4yNXY2YzAsNC42MSwxLjY0LDYuMjUsNi4yNSw2LjI1aDZjNC42MSwwLDYuMjUtMS42NCw2LjI1LTYuMjV2LTZjMC00LjYxLTEuNjQtNi4yNS02LjI1LTYuMjVoLTZaIi8+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTgsNi41Yy0uMTMsMC0uMjYtLjAzLS4zOC0uMDgtLjEyLS4wNS0uMjMtLjEyLS4zMy0uMjEtLjA5LS4xLS4xNy0uMjEtLjIyLS4zMy0uMDUtLjEyLS4wNy0uMjUtLjA3LS4zOHMuMDItLjI2LjA3LS4zOGMuMDYtLjEzLjEzLS4yMy4yMi0uMzMuMDUtLjA0LjEtLjA5LjE1LS4xMi4wNi0uMDQuMTItLjA3LjE4LS4wOS4wNi0uMDMuMTItLjA1LjE5LS4wNi4zMi0uMDcuNjYuMDQuOS4yNy4wOS4xLjE2LjIuMjEuMzMuMDUuMTIuMDguMjUuMDguMzhzLS4wMy4yNi0uMDguMzgtLjEyLjIzLS4yMS4zM2MtLjEuMDktLjIxLjE2LS4zMy4yMS0uMTIuMDUtLjI1LjA4LS4zOC4wOFoiLz4KICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Im0xNS4wNSwxMC4yN2MtLjc1LTEtMS43NC0xLjc0LTMuMy0xLjc4LTEuODEsMC0zLjI1LDEuNDUtMy4yNSwzLjI1LDAsLjQxLS4zNC43NS0uNzUuNzVzLS43NS0uMzQtLjc1LS43NWMwLTQuMjQsNC45Ny02LjEsOC0zLjY1LS4xMi0xLjA2LDEuNDYtMS4yLDEuNS0uMTN2MmMuMDIuNy0uOTEsMS0xLjMyLjQ5bC0uMTMtLjE4Wm0tNi4xOSwzLjljMS44MSwyLjk0LDUuOTQsMi4xNSw2LjE0LTEuNDMsMC0uNDEuMzQtLjc1Ljc1LS43NXMuNzUuMzQuNzUuNzVjLjA4LDMuODYtNC42OSw2LjIyLTcuNTYsMy43LjA3LDEuMDMtMS40NywxLjExLTEuNS4wN3YtMmMtLjAyLS43Mi45OC0xLjAyLDEuMzYtLjQzbC4wNS4wOGgwWiIvPgo8L3N2Zz4='],showFlash:true,showZoom:true,showClose:true,showCameraPicker:true};static previewProperties={x:0,y:0,width:100,height:100,orientation:0};static initialized=false;static initialized_dom=false;static cameraPreview_init(){this.cameraPreview.id="cameraPreview";this.cameraPreview.className="cameraPreview-div";this.cameraPreview.style.position="relative";this.cameraPreview.style.margin="0";this.cameraPreview.style.padding="0";this.cameraPreview.style.outline="0";this.cameraPreview.style.fontSize="100%";this.cameraPreview.style.verticalAlign="baseline";this.cameraPreview.style.background="0 0 black";this.cameraPreview.style.left=""+this.previewProperties.x+"%";this.cameraPreview.style.top=""+this.previewProperties.y+"%";this.cameraPreview.style.width=""+this.previewProperties.width+"%";this.cameraPreview.style.height=""+this.previewProperties.height+"%";this.cameraPreview.style.overflow="hidden";this.cameraPreview.style.zIndex="9999999";this.preview.id="preview";this.preview.className="cameraPreview-video";this.preview.playsInline=true;this.overlay.id="overlay";this.overlay.className="cameraPreview-canvas";this.overlay.style.position="relative";this.overlay.style.top="0%";this.overlay.style.left="0px";this.overlay.style.backgroundColor="transparent";this.overlay.style.zIndex="99999999";};static flash_init(handler){this.flash.id="flash-button";if(!this.buttonsProperties.showFlash)this.flash.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.flash_icons[0];this.flash.appendChild(img);this.flash.style.position="absolute";this.flash.style.cssFloat="none";this.flash.style.top="2px";this.flash.style.left="2px";this.flash.style.width="48px";this.flash.style.height="48px";this.flash.style.zIndex="999999999";this.flash.addEventListener('click',handler,false);};static zoom_init(handler){this.zoom.id="zoom-button";if(!this.buttonsProperties.showZoom)this.zoom.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.zoom_icons[0];this.zoom.appendChild(img);this.zoom.style.position="absolute";this.zoom.style.cssFloat="none";this.zoom.style.top="2px";this.zoom.style.right="2px";this.zoom.style.width="48px";this.zoom.style.height="48px";this.zoom.style.zIndex="999999999";this.zoom.addEventListener('click',handler,false);};static close_init(handler){this.close.id="close-button";if(!this.buttonsProperties.showClose)this.close.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.close_icons[0];this.close.appendChild(img);this.close.style.position="absolute";this.close.style.cssFloat="none";this.close.style.right="2px";this.close.style.width="24px";this.close.style.height="24px";this.close.style.zIndex="999999999";this.close.addEventListener('click',handler,false);};static cameraPicker_init(handler){this.cameraPicker.id="cameraPicker-button";if(!this.buttonsProperties.showCameraPicker)this.cameraPicker.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.cameraPicker_icons[0];this.cameraPicker.appendChild(img);this.cameraPicker.style.position="absolute";this.cameraPicker.style.cssFloat="none";this.cameraPicker.style.left="2px";this.cameraPicker.style.width="48px";this.cameraPicker.style.height="48px";this.cameraPicker.style.zIndex="999999999";this.cameraPicker.addEventListener('click',handler,false);};static cameraPickerUI_init(handler){this.cameraPickerUI.id="cameraPickerUI";this.cameraPickerUI_style.id="cameraPickerUI_style";this.cameraPickerUI.style.position="absolute";this.cameraPickerUI.style.cssFloat="none";this.cameraPickerUI.style.top="20%";this.cameraPickerUI.style.left="20%";this.cameraPickerUI.style.width="60%";this.cameraPickerUI.style.maxWidth="90%";this.cameraPickerUI.style.background="transparent";this.cameraPickerUI.style.borderRadius="5px";this.cameraPickerUI.style.zIndex="999999999";};static cameraPickerUI_update(cameras,currentCameraID){let camerasCount=cameras.length;let input_elements=[];let label_elements=[];let elements_IDs=[];let desiredCameraLabels=["back","0","triple"];let tripleCameraPicked=false;for(let i=0;i<camerasCount;i++)
|
|
4
4
|
{let id=`c${i}`;elements_IDs.push(id);let input=document.createElement('input');input.id=id;input.name="rd";input.type="radio";input.style.display="none";input.dataset.value=cameras[i].id;input.dataset.label=cameras[i].label;input.onclick=JS_media.changeCamera;if(currentCameraID!=""){if(JS_media.hasTripleCamera){if((Decoder.startCounter==2)&&JS_media.highFocusDistance){let cameraLabel=cameras[i].label;if(cameraLabel.toLowerCase().includes(desiredCameraLabels[2].toLowerCase()))
|
|
5
5
|
{input.checked=true;Barkoder.setCameraId(cameras[i].id);tripleCameraPicked=true;JS_media.correct_zoom_on_ios=true;}}
|
|
@@ -28,7 +28,7 @@ videoTrack.applyConstraints({advanced:[{zoom:zoomLevels[zoomLevel]}]}).catch(e=>
|
|
|
28
28
|
let cameraScannerProperties=Decoder.cameraScanner;cameraScannerProperties.config.result_callback({type:"error",error:{name:error.name,message:error.message??"",}});};static capabilitiesHandler(){if(typeof this.videoTrack.getCapabilities!='function')return;const capabilities=this.videoTrack.getCapabilities();this.hardware_capabilities_ranges_videoTrack=capabilities;Common.debugMessage("JS_media","videoCapabilities",true);Common.debugMessage("",this.hardware_capabilities_ranges_videoTrack,true);let w=this.hardware_capabilities_ranges_videoTrack.width.max;let h=this.hardware_capabilities_ranges_videoTrack.height.max;let f=this.hardware_capabilities_ranges_videoTrack.focusDistance?.min;let z_min=(capabilities.zoom)?capabilities.zoom.min:"no zoom";let z_max=(capabilities.zoom)?capabilities.zoom.max:"no zoom";if(typeof f=='number')
|
|
29
29
|
{if(!JS_media.initial){f=f.toFixed(2);}else
|
|
30
30
|
{if(f>=0.20)JS_media.highFocusDistance=true;}}else{if(!JS_media.initial){}}
|
|
31
|
-
Common.flashProxy.supported=
|
|
31
|
+
let flash_support=(capabilities.torch!==undefined)?capabilities.torch:false;Common.flashProxy.supported=flash_support;this.flash.ready=flash_support;if(capabilities.zoom)this.zoom.supported=true;else{DOM_elements.zoom.style.display="none";return;}
|
|
32
32
|
let min=capabilities.zoom.min;let max=min*4;let step=capabilities.zoom.step;let mid=min*2;if(JS_media.correct_zoom_on_ios)
|
|
33
33
|
{min*=2;mid*=2;max*=2;max=(max>capabilities.zoom.max)?capabilities.zoom.max:max;}
|
|
34
34
|
this.zoom.levels=[min,mid,max];this.zoom.ready=true;Common.debugMessage("capabilitiesHandler","this.zoom.levels",true);Common.debugMessage("",this.zoom.levels,true);Common.debugMessage("old max",capabilities.zoom.max,true);let zoomLevel=this.zoom.level;let zoomLevels=this.zoom.levels;let videoTrack=this.videoTrack;videoTrack.applyConstraints({advanced:[{zoom:zoomLevels[zoomLevel]}]}).catch(e=>console.log(e));};static async getCameras(){let args=arguments;let internalUsage=((typeof args[0]=='string')&&(args[0]=="internal"));async function requestPermission()
|
|
@@ -54,7 +54,7 @@ context.hardwareCameraResolution.width=context.runtime_settings_videoTrack.width
|
|
|
54
54
|
{let initial_s=JS_media.initial;context.videoStreamData_handler_wrapper=function(){videoStreamData_handler(initial_s);};video.addEventListener('loadeddata',context.videoStreamData_handler_wrapper);}
|
|
55
55
|
Common.debugMessage("JS_media","in getUserMedia after videoStreamData_handler is added as EL for loadeddata",true);video.srcObject=context.mediaStream;video.onloadedmetadata=function(e){this.muted=true;Common.debugMessage("JS_media","in getUserMedia in onloadedmetadata handler before play",true);this.play().catch(function(e){Common.debugMessage("JS_media","video",false);Common.debugMessage("",this,false);Common.debugMessage("JS_media","play error",false);Common.debugMessage("",e,false);});context.applyFlash(false);Common.debugMessage("JS_media","in getUserMedia in onloadedmetadata handler after play",true);let decoder_timeout=Decoder.cameraScanner.config.timeout;if(decoder_timeout!=0)
|
|
56
56
|
context.scanner_timeout=setTimeout(async function(){DOM_elements.stopPreview();Barkoder.events.dispatchTimeoutEvent();},decoder_timeout*1000);};}).catch(function(e){JS_media.handleError(e);});};}
|
|
57
|
-
class Bridge{static initialized=false;static initialized_ctx=false;static hideDuringResize=false;static numberOfSupportedDecoders=
|
|
57
|
+
class Bridge{static initialized=false;static initialized_ctx=false;static hideDuringResize=false;static numberOfSupportedDecoders=39;static enabledDecoders=0;static untouchedROIArray=[];static viewfinder={x:0,y:0,width:0,height:0,orientation:0};static untouchedROIUnion={x:0,y:0,width:100,height:100};static is_portrait=false;static viewfinderAppearance={overlay:{roiVisible:true,lineWidth:1.5,lineColor:"#ff3347"}};static cameraResolution_values=[[640,480],[1280,720],[1920,1080]];static orientationType={"landscape-primary":0,"portrait-primary":1,"landscape-secondary":2};static screenOrientation=(typeof screen.orientation=='undefined')?'undefined':screen.orientation;static rotate(ROI,to_orientation){if(to_orientation<0||to_orientation>2)return ROI;let x1=ROI.x;let y1=ROI.y;let w1=ROI.width;let h1=ROI.height;let from_orientation=this.viewfinder.orientation;let rotate=[[{x:x1,y:y1,width:w1,height:h1},{x:y1,y:(100-x1-w1),width:h1,height:w1},{x:(100-x1-w1),y:(100-y1-h1),width:w1,height:h1}],[{x:(100-y1-h1),y:x1,width:h1,height:w1},{x:x1,y:y1,width:w1,height:h1},{x:y1,y:(100-x1-w1),width:h1,height:w1}],[{x:(100-x1-w1),y:(100-y1-h1),width:w1,height:h1},{x:(100-y1-h1),y:(100-x1-w1),width:h1,height:w1},{x:x1,y:y1,width:w1,height:h1}]];return rotate[from_orientation][to_orientation];};static scale(ROI,viewfinderScale,scaleHeight){if(viewfinderScale<0.01||viewfinderScale>1.0||scaleHeight<0||scaleHeight>1)return ROI;var x1=ROI.x;var y1=ROI.y;var w1=ROI.width;var h1=ROI.height;var cropScaleP=(1-viewfinderScale)*100;var scale_and_center=[{x:((cropScaleP/2)+(x1*viewfinderScale)),y:y1,width:(w1*viewfinderScale),height:h1},{x:x1,y:((cropScaleP/2)+(y1*viewfinderScale)),width:w1,height:(h1*viewfinderScale)}];return scale_and_center[scaleHeight];};static calculateROI(cameraPreview_AR_is_higher_than_camera_AR,croppedCameraAreaScale)
|
|
58
58
|
{let is_portrait=this.is_portrait;let viewfinderAreaScale=(1-croppedCameraAreaScale);let widthIndex=(is_portrait)?1:0;let heightIndex=(is_portrait)?0:1;if((!is_portrait&&cameraPreview_AR_is_higher_than_camera_AR)||(is_portrait&&!cameraPreview_AR_is_higher_than_camera_AR))
|
|
59
59
|
{let roi;for(let i=0;i<this.numberOfSupportedDecoders;i++){roi=this.rotate(this.untouchedROIArray[i],this.viewfinder.orientation);roi=this.scale(roi,viewfinderAreaScale,heightIndex);Connector.setRegionOfInterest(roi.x,roi.y,roi.width,roi.height);}}
|
|
60
60
|
else
|
|
@@ -87,7 +87,10 @@ class RefreshPreview{static useRecursiveRefresh=true;static properties={previous
|
|
|
87
87
|
if(refreshDuration>refreshFinish){Common.debugMessage("RefreshPreview",`cleared recursiveRefresh at ${refreshDuration}ms because it passed the limit of ${refreshFinish}ms`,true);clearInterval(recursiveRefresh);}
|
|
88
88
|
if(resizeEventCount>resizeEventCount_at){Common.debugMessage("RefreshPreview",`cleared recursiveRefresh at ${refreshDuration}ms because more resize events (and subsequent resizeHandler calls) were already done i.e. ${resizeEventCount} > ${resizeEventCount_at}`,true);clearInterval(recursiveRefresh);}
|
|
89
89
|
var current_valuesForResize=RefreshPreview.getValuesForResize();if(RefreshPreview.checkSameValuesForResize())return;Common.debugMessage("RefreshPreview",`recursiveRefresh[${resizeEventCount_at}] at ${refreshDuration}ms`,true);RP_properties.previousValues=JSON.parse(JSON.stringify(current_valuesForResize));Bridge.orientationChangeHandler();Bridge.resizeHandler();},refreshRate);};}
|
|
90
|
-
class
|
|
90
|
+
class AudioHandler{static webAudio_supported=('AudioContext'in window||'webkitAudioContext'in window);static webAudio_initialized=false;static AudioContext=null;static context=null;static gainNode=null;static beepBuffer=undefined;static async webAudio_audio_init(){window.fetch(AudioHandler.Beep.dataURI).then(response=>response.arrayBuffer()).then(arrayBuffer=>AudioHandler.context.decodeAudioData(arrayBuffer,audioBuffer=>{AudioHandler.beepBuffer=audioBuffer;},error=>console.error(error)));};static webAudio_audio_play(audioBuffer){var source=AudioHandler.context.createBufferSource();source.buffer=audioBuffer;source.connect(AudioHandler.context.destination);source.start();};static webAudio_unlock(){Common.debugMessage("AudioHandler","Try to unlock the audio context.",true);var buffer=AudioHandler.context.createBuffer(1,1,22050);var source=AudioHandler.context.createBufferSource();source.buffer=buffer;source.connect(AudioHandler.context.destination);source.start?source.start(0):source.noteOn(0);};static async webAudio_init(){if(AudioHandler.webAudio_supported&&!AudioHandler.webAudio_initialized){AudioHandler.AudioContext=window.AudioContext||window.webkitAudioContext;AudioHandler.context=new AudioHandler.AudioContext();AudioHandler.gainNode=AudioHandler.context.createGain();AudioHandler.gainNode.gain.value=1;await AudioHandler.webAudio_audio_init();AudioHandler.webAudio_unlock();AudioHandler.webAudio_initialized=true;}};static Beep={dataURI:"data:audio/mpeg;base64,SUQzBAAAAAACelRYWFgAAAAYAAADY29tbWVudABTeW5jIFRvbmUgMWtIegBURFJDAAAADAAAAzIwMjEtMDMtMDgAVElUMgAAABAAAANTeW5jIHRvbmUgMWtIegBUWFhYAAAAGgAAA3RpbWVfcmVmZXJlbmNlADE3MjcwNzg0MABUWFhYAAAASQAAA3VtaWQAMHg2RTk1MDRENDQxQkU0NTI3QTU1RTBBMEY5NTVEMTBCNzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAFRQRTEAAAALAAADSGVhZHBoYXplAFRDT1AAAAALAAADSGVhZHBoYXplAFRYWFgAAAAQAAADSUVORwBIZWFkcGhhemUAVENPTgAAAAkAAAN1dGlsaXR5AFRYWFgAAAAuAAADSUtFWQBzeW5jLCB0b25lLCAxaw0KSHosIGJlZXAsIGJsaXAsIGxlYWQgaW4AVFNTRQAAAA4AAANMYXZmNjEuNy4xMDAAAAAAAAAAAAAAAP/7VMAAAAAAAAAAAAAAAAAAAAAAAFhpbmcAAAAPAAAAAwAABaAAmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////////////////////////////////////////AAAAAExhdmM2MS4xOQAAAAAAAAAAAAAAACQDxgAAAAAAAAWgRR0hsgAAAAAAAAAAAAAAAAAAAP/7xMQAAAvQMUR08YAp8xkoPz0wgAq0k71er0PQ9Rq+PAiMZfxJwc4KsJGQs62cQiAAAgA7MPH/8AR+Hz/Z//+Dv/Qf/+kM//P/MPDAAz5A//zDAAAEaD///8AAAAPDw8PSAAAZ78w8PDAAAABAeHh4ekABTQAAAFcCgBgFgwKBgMAAC8xgAgDLRBgF/CwB6YCYDAqGKNBLDrr75lgNMwQQHDARACJjU5grAb8DFsDtEBcAgHhaCLOFBA3hDkRgcXMTJFRCws4e+MqTRFiLGJMmJ4vJfIqRUyJ4mjH/8ipFTIixeMS7//l0yLxsJQl/h1WXAAAACJ/AAAAcBBMxJkzIUVTBUAXME4GUDA+mAcD2YjAwZimQdmUeNgYjYNBAAGYAACIcBCqYDoFjZW8V4nmdq9oZabrhwAAAARt9ogAAgAhBks2YCYGr3EoDJhJAJmB8EIYOgHBgxhqmLqLmYWm3ZhrFYGOQD4RAVAwBMHAfoBDjCPnmtj4AdAVAQQwwAIAGATh4J9zYHo9YAoCMJQ/xviHlzZ47yJrUNPmmhbYaaF2eRIafVakFvOtzgPHlMQH7+9HjBEpl5T33ilMvIgDPkBIGFh/lw+Iz4YWOB/8QODGGBIcTgh+Xg/y59STQDQDEfCijgJg6FAEAQABoEslDHeEwAgL6V2jB1AGMuppMwFAKQsAy2FlJlnClGHYB0YGwGoKAYlk2BoM6gpAwbNAGAUmTQJBEBgcgYABgFgKKGBuJ8MdAwGDROgWjBkELDeBhkDgPAgDQVDVwAQODIpDhCwgsMb8L4hjgm4LIw+ANsFyitSHDnDLGP4ywfQPxE/CkxPoegXS6k6qX8pkHKpEyaJ0vECSRRMVJJI/5RJhIg5cIgUiWJUrIoqdL//k2Tv/7hMTXgAioPx/95gAimRcivrzwBJFC+VzxXLxMl4pIkU9aKNSX//uT6BIFIqlkvE2iXC+bFo2KxZMigiRRMrsWjI1KJwzM2J/2qt+wqkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7ZMT/AB91vTf56qIAAAA0g4AABKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg==",audio:null,audio_initialized:false,audio_init:()=>{AudioHandler.Beep.audio=new Audio(AudioHandler.Beep.dataURI);AudioHandler.Beep.audio.volume=0;AudioHandler.Beep.audio.muted=true;AudioHandler.Beep.audio.play();AudioHandler.Beep.audio_initialized=true;}};static mainInit(){if(AudioHandler.webAudio_supported){Common.debugMessage("AudioHandler","AudioContext is supported.",true);AudioHandler.webAudio_init();}
|
|
91
|
+
else{Common.debugMessage("AudioHandler","AudioContext is not supported, using Audio as fallback.",true);AudioHandler.Beep.audio_init();}};static playBeep(){if(AudioHandler.webAudio_supported&&AudioHandler.webAudio_initialized){AudioHandler.webAudio_audio_play(AudioHandler.beepBuffer);}
|
|
92
|
+
else{AudioHandler.Beep.audio.volume=1;AudioHandler.Beep.audio.muted=false;AudioHandler.Beep.audio.pause();AudioHandler.Beep.audio.currentTime=0;AudioHandler.Beep.audio.play();}};}
|
|
93
|
+
class Decoder{static cameraScanner={config:{timeout:60,dps_limit:28,continuous:false,result_beep:true,result_image:true,result_image_barcode:true,result_callback:(r)=>console.log(r)},overlay:{locationShow:true,locationShowTime:400,locationLineWidth:1.5,locationLineColor:"rgba(0, 255, 0, 1.0)"},runningState:{active:false,paused:false}};static locationClear=null;static frameCounter=0;static frame_canvasFrame=document.createElement('canvas');static initialized_ctx=false;static ctx=null;static async decoder(video,locationHandler){const dps_limit=this.cameraScanner.config.dps_limit;const frameInterval=1000/this.cameraScanner.config.dps_limit;let decodeCount=0;let startTime=performance.now();let videoWidth=video.videoWidth;let videoHeight=video.videoHeight;window.BarkoderSDK_frameDecoding=false;window.BarkoderSDK_currentFrame=Decoder.frameCounter;Decoder.initialized_ctx=false;var frameScanning=setInterval(async function(){let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;const paused=cameraScannerProperties.runningState.paused;const continuous=cameraScannerProperties.config.continuous;const result_callback=cameraScannerProperties.config.result_callback;Common.debugMessage("frameScanning",`active is ${active}`,false);Decoder.frameCounter++;if(!active){let ref_type=typeof frameScanning;Common.debugMessage("frameScanning",`ref is ${ref_type}`,false);Common.debugMessage("",frameScanning,false);clearInterval(frameScanning);Common.debugMessage("frameScanning",`ref is now ${ref_type}`,false);Common.debugMessage("",frameScanning,false);return;}
|
|
91
94
|
if(paused)return;decodeCount++;videoWidth=video.videoWidth;videoHeight=video.videoHeight;if(videoWidth==0||videoHeight==0){return;}
|
|
92
95
|
let canvasFrame=Decoder.frame_canvasFrame;canvasFrame.width=videoWidth;canvasFrame.height=videoHeight;if(!Decoder.initialized_ctx){Decoder.ctx=canvasFrame.getContext("2d",{willReadFrequently:true});Decoder.initialized_ctx=true;}
|
|
93
96
|
let ctx=Decoder.ctx;ctx.drawImage(video,0,0,videoWidth,videoHeight);let imgData=ctx.getImageData(0,0,canvasFrame.width,canvasFrame.height);if(false)
|
|
@@ -100,10 +103,13 @@ Common.debugMessage("Decoder","dps("+Math.round(dps)+"), frame "+decodeCount,tru
|
|
|
100
103
|
else
|
|
101
104
|
{window.BarkoderSDK_frameDecoding=false;cameraScannerProperties.runningState.paused=true;let result=BKResult;if(cameraScannerProperties.config.result_image)
|
|
102
105
|
result.capturedFrame=imgData;if(result!=null&&result.resultsCount>1&&result.results[0].location!=null)
|
|
103
|
-
{let multiple_locations=result.results.map(r=>r.location);Decoder.locationOverlay(multiple_locations,canvasFrame.width,canvasFrame.height,frameInterval);
|
|
106
|
+
{let multiple_locations=result.results.map(r=>r.location);Decoder.locationOverlay(multiple_locations,canvasFrame.width,canvasFrame.height,frameInterval);for(let i=0;i<result.resultsCount;i++){let location=result.results[i].location;let minX=Math.min(location.p1.x,location.p2.x,location.p3.x,location.p4.x);let maxX=Math.max(location.p1.x,location.p2.x,location.p3.x,location.p4.x);let minY=Math.min(location.p1.y,location.p2.y,location.p3.y,location.p4.y);let maxY=Math.max(location.p1.y,location.p2.y,location.p3.y,location.p4.y);let width=maxX-minX;let height=maxY-minY;let barcodeImgData=ctx.getImageData(minX,minY,width,height);if(cameraScannerProperties.config.result_image_barcode)
|
|
107
|
+
result.results[0].capturedBarcode=barcodeImgData;}}
|
|
104
108
|
else
|
|
105
|
-
if(result!=null&&result.location!=null)
|
|
106
|
-
|
|
109
|
+
if(result!=null&&result.location!=null){Decoder.locationOverlay(result.location,canvasFrame.width,canvasFrame.height,frameInterval);let location=result.location;let minX=Math.min(location.p1.x,location.p2.x,location.p3.x,location.p4.x);let maxX=Math.max(location.p1.x,location.p2.x,location.p3.x,location.p4.x);let minY=Math.min(location.p1.y,location.p2.y,location.p3.y,location.p4.y);let maxY=Math.max(location.p1.y,location.p2.y,location.p3.y,location.p4.y);let width=maxX-minX;let height=maxY-minY;let barcodeImgData=ctx.getImageData(minX,minY,width,height);if(cameraScannerProperties.config.result_image_barcode)
|
|
110
|
+
result.capturedBarcode=barcodeImgData;}
|
|
111
|
+
if(result!=null&&result.resultsCount>=1&&cameraScannerProperties.config.result_beep)
|
|
112
|
+
AudioHandler.playBeep();if(continuous)
|
|
107
113
|
{cameraScannerProperties.runningState.paused=true;if(typeof result_callback=='function')result_callback(BKResult);else Common.debugMessage("Decoder","result: "+BKResult.textualData,true);}
|
|
108
114
|
else
|
|
109
115
|
{cameraScannerProperties.runningState.paused=true;video.pause();let overlayProperties=Decoder.cameraScanner.overlay;await Common.wait(overlayProperties.locationShowTime+100);DOM_elements.stopPreview();cameraScannerProperties.runningState.paused=false;if(typeof result_callback=='function')result_callback(BKResult);else Common.debugMessage("Decoder","result: "+BKResult.textualData,true);}}},frameInterval);};static async locationOverlay(locations,frameWidth,frameHeight,frameInterval){let preview=DOM_elements.preview;let canvasOverlay=DOM_elements.overlay;let viewfinder=Bridge.viewfinder;Common.debugMessage("context","locationOverlay",false);Common.debugMessage("",this,false);let multidraw=false;if(typeof locations[0]=='object')multidraw=true;let overlayProperties=this.cameraScanner.overlay;if(!overlayProperties.locationShow)return;let ctx=Bridge.ctx;if(this.locationClear!=null)clearTimeout(this.locationClear);Bridge.resizeOverlay();await Common.wait(10);Common.debugMessage("Decoder->Location","result.locationPoints:",true);Common.debugMessage("",locations,true);ctx.lineWidth=overlayProperties.locationLineWidth;ctx.strokeStyle=overlayProperties.locationLineColor;let window_actualWidth=preview.offsetWidth;let window_actualHeight=preview.offsetHeight;let translate_x=(preview.offsetWidth-canvasOverlay.width)/2;let translate_y=(preview.offsetHeight-canvasOverlay.height)/2;let scale_x=window_actualWidth/frameWidth;let scale_y=window_actualHeight/frameHeight;if(!multidraw){let x_points=[locations.p1.x,locations.p2.x,locations.p3.x,locations.p4.x].map(x=>(x*scale_x)-translate_x);let y_points=[locations.p1.y,locations.p2.y,locations.p3.y,locations.p4.y].map(y=>(y*scale_y)-translate_y);let x1=x_points[0];let y1=y_points[0];let x2=x_points[1];let y2=y_points[1];let x3=x_points[2];let y3=y_points[2];let x4=x_points[3];let y4=y_points[3];ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.lineTo(x1,y1);ctx.stroke();}else{let drawCount=locations.length;for(let i=0;i<drawCount;i++)
|
|
@@ -111,17 +117,17 @@ else
|
|
|
111
117
|
let continuous=Decoder.cameraScanner.config.continuous;let locationBorderTime=(frameInterval>overlayProperties.locationShowTime)?overlayProperties.locationShowTime:frameInterval;if(!continuous)locationBorderTime=overlayProperties.locationShowTime;this.locationClear=setTimeout(async function(){Bridge.resizeOverlay();await Common.wait(10);},locationBorderTime);};static async videoStreamData_handler(initial_s){if(!initial_s)Barkoder.events.dispatchStartEvent();Common.debugMessage("Decoder","start of videoStreamData_handler",true);Bridge.init_ROIs();Common.debugMessage("Decoder","after init_ROIs()",true);await Common.wait(1);DOM_elements.showElements();Bridge.orientationChangeHandler();window.addEventListener('visibilitychange',Bridge.visibilityChangeHandler,false);if(Bridge.screenOrientation=='undefined')window.addEventListener('resize',Bridge.orientationChangeHandler,false);else screen.orientation.addEventListener('change',Bridge.orientationChangeHandler);window.addEventListener('resize',Bridge.resizeHandler,false);if(DOM_elements.container!=null)DOM_elements.resizeObserver.observe(DOM_elements.container);if(RefreshPreview.useRecursiveRefresh)RefreshPreview.clearProperties();if(RefreshPreview.useRecursiveRefresh)var currentValues=RefreshPreview.getValuesForResize();Bridge.resizePreview();if(RefreshPreview.useRecursiveRefresh)RefreshPreview.properties.previousValues=JSON.parse(JSON.stringify(currentValues));DOM_elements.readyToUse_RO=true;Decoder.decoder(DOM_elements.preview);Common.debugMessage("Decoder->start->startCamera","Scanner start completed.",true);};static startCounter=0;static async start(callback){let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;if(active)return 1;cameraScannerProperties.runningState.active=true;Decoder.startCounter++;cameraScannerProperties.config.result_callback=(typeof callback=='function')?callback:(r)=>console.log(r);Common.debugMessage("start","at start() 1",true);let context=DOM_elements;context.container=document.getElementById('barkoder-container');var container_exists=(context.container!=undefined&&context.container!=null&&typeof context.container==='object'&&context.container.tagName==='DIV');if(!container_exists){Common.debugMessage("start",`Container does not exist, aborting start.`,1);return-1;}
|
|
112
118
|
if(context.container.offsetWidth==0||context.container.offsetHeight==0)
|
|
113
119
|
{Common.debugMessage("start",`Container width or height is 0, setting half the window size (${window.innerWidth / 2}x${window.innerHeight / 2}px) as fallback size.`,1);context.container.style.cssText=`width: ${window.innerWidth / 2}px; height: ${window.innerHeight / 2}px;`;}
|
|
114
|
-
try{DOM_elements.createPreview();Common.debugMessage("start","after createPreview()",true);Common.debugMessage("Decoder","this.videoStreamData_handler",false);Common.debugMessage("",this.videoStreamData_handler,false);Common.debugMessage("",this,false);await Common.wait(200);await JS_media.populateCameraPicker("");JS_media.startCamera(DOM_elements.preview,this.videoStreamData_handler,function(){});Common.debugMessage("start","after startCamera()",true);}catch(error){Common.debugMessage("start","error in start-try",true);Common.debugMessage("",error,true);}
|
|
120
|
+
try{AudioHandler.mainInit();DOM_elements.createPreview();Common.debugMessage("start","after createPreview()",true);Common.debugMessage("Decoder","this.videoStreamData_handler",false);Common.debugMessage("",this.videoStreamData_handler,false);Common.debugMessage("",this,false);await Common.wait(200);await JS_media.populateCameraPicker("");JS_media.startCamera(DOM_elements.preview,this.videoStreamData_handler,function(){});Common.debugMessage("start","after startCamera()",true);}catch(error){Common.debugMessage("start","error in start-try",true);Common.debugMessage("",error,true);}
|
|
115
121
|
return 0;};}
|
|
116
122
|
class Common{static wait=ms=>new Promise(resolve=>setTimeout(resolve,ms));static flashProxy=new Proxy(JS_media.flash,{set:function(target,key,value){Common.debugMessage("flashProxy",`flash.${key} set to ${value}`,true);target[key]=value;if(key=='state'&&typeof value=='boolean'){DOM_elements.flash.getElementsByTagName('img')[0].src=DOM_elements.buttonsProperties.flash_icons[Number(value)];}
|
|
117
123
|
else if(key=='supported'&&typeof value=='boolean')DOM_elements.flash.style.display=(value)?"initial":"none";return true;}});static zoomProxy=new Proxy(JS_media.zoom,{set:function(target,key,value){Common.debugMessage("flashProxy",`zoom.${key} set to ${value}`,true);target[key]=value;if(key=='level'&&typeof value=='number'){let icon_i=(value==0||value==1)?0:1;DOM_elements.zoom.getElementsByTagName('img')[0].src=DOM_elements.buttonsProperties.zoom_icons[icon_i];}
|
|
118
124
|
else if(key=='supported'&&typeof value=='boolean')DOM_elements.zoom.style.display=(value)?"initial":"none";return true;}});static debugMessage(tag,message,log){if(typeof log=='boolean'&&log){return;if(tag=='')console.log(message);else console.log('['+tag+'] '+message);}
|
|
119
125
|
else if(typeof log=='number'&&log==1){if(tag=='')console.log(message);else console.log('['+tag+'] '+message);}};}
|
|
120
|
-
const ToggleTemplate=Object.freeze({Disable:0,Enable:1});const copyObject=(object)=>JSON.parse(JSON.stringify(object));class Constants{static DecodingSpeed=Object.freeze({Fast:0,Normal:1,Slow:2,Rigorous:3});static Decoders=Object.freeze({Aztec:0,AztecCompact:1,QR:2,QRMicro:3,Code128:4,Code93:5,Code39:6,Codabar:7,Code11:8,Msi:9,UpcA:10,UpcE:11,UpcE1:12,Ean13:13,Ean8:14,PDF417:15,PDF417Micro:16,Datamatrix:17,Code25:18,Interleaved25:19,ITF14:20,IATA25:21,Matrix25:22,Datalogic25:23,COOP25:24,Code32:25,Telepen:26,Dotcode:27});static Code11ChecksumType=Object.freeze({disabled:0,single:1,double:2});static Code39ChecksumType=Object.freeze({disabled:0,enabled:1});static MsiChecksumType=Object.freeze({disabled:0,mod10:1,mod11:2,mod1010:3,mod1110:4,mod11IBM:5,mod1110IBM:6});static UpcEanDeblur=Object.freeze(copyObject(ToggleTemplate));static MulticodeCachingEnabled=Object.freeze(copyObject(ToggleTemplate));static EnableMisshaped1D=Object.freeze(copyObject(ToggleTemplate));static EnableVINRestrictions=Object.freeze(copyObject(ToggleTemplate));static Formatting=Object.freeze({Disabled:0,Automatic:1,GS1:2,AAMVA:3});static EncodingCharacterSet=Object.freeze({None:0,ISO_8859_2:1,ISO_8859_5:2,Shift_JIS:3,US_ASCII:4,UTF_8:5,UTF_16:6,windows_1251:7,windows_1256:8});static CameraResolution=Object.freeze({HD:0,FHD:1});}
|
|
126
|
+
const ToggleTemplate=Object.freeze({Disable:0,Enable:1});const copyObject=(object)=>JSON.parse(JSON.stringify(object));class Constants{static DecodingSpeed=Object.freeze({Fast:0,Normal:1,Slow:2,Rigorous:3});static Decoders=Object.freeze({Aztec:0,AztecCompact:1,QR:2,QRMicro:3,Code128:4,Code93:5,Code39:6,Codabar:7,Code11:8,Msi:9,UpcA:10,UpcE:11,UpcE1:12,Ean13:13,Ean8:14,PDF417:15,PDF417Micro:16,Datamatrix:17,Code25:18,Interleaved25:19,ITF14:20,IATA25:21,Matrix25:22,Datalogic25:23,COOP25:24,Code32:25,Telepen:26,Dotcode:27});static Code11ChecksumType=Object.freeze({disabled:0,single:1,double:2});static Code39ChecksumType=Object.freeze({disabled:0,enabled:1});static MsiChecksumType=Object.freeze({disabled:0,mod10:1,mod11:2,mod1010:3,mod1110:4,mod11IBM:5,mod1110IBM:6});static UpcEanDeblur=Object.freeze(copyObject(ToggleTemplate));static MulticodeCachingEnabled=Object.freeze(copyObject(ToggleTemplate));static EnableMisshaped1D=Object.freeze(copyObject(ToggleTemplate));static EnableVINRestrictions=Object.freeze(copyObject(ToggleTemplate));static EnableComposite=Object.freeze(copyObject(ToggleTemplate));static Formatting=Object.freeze({Disabled:0,Automatic:1,GS1:2,AAMVA:3,SADL:4});static EncodingCharacterSet=Object.freeze({None:0,ISO_8859_2:1,ISO_8859_5:2,Shift_JIS:3,US_ASCII:4,UTF_8:5,UTF_16:6,windows_1251:7,windows_1256:8,BINARY:9});static CameraResolution=Object.freeze({HD:0,FHD:1});}
|
|
121
127
|
let ConfigTypes={};{ConfigTypes.BarkoderConfig=class BarkoderConfig{closeSessionOnResultEnabled;barkoderResolution;decoder;constructor(config){Object.assign(this,config);}
|
|
122
128
|
toJsonString(){let configAsJson={"closeSessionOnResultEnabled":this.closeSessionOnResultEnabled,"barkoderResolution":this.barkoderResolution,"decoder":this.decoder?.toMap()};return JSON.stringify(configAsJson);}}
|
|
123
|
-
ConfigTypes.DekoderConfig=class DekoderConfig{aztec;aztecCompact;qr;qrMicro;code128;code93;code39;codabar;code11;msi;upcA;upcE;upcE1;ean13;ean8;pdf417;pdf417Micro;datamatrix;code25;interleaved25;itf14;iata25;matrix25;datalogic25;coop25;code32;telepen;dotcode;general;constructor(config){Object.assign(this,config);}
|
|
124
|
-
toMap(){const map={'Aztec':this.aztec?.toMap(),'Aztec Compact':this.aztecCompact?.toMap(),'QR':this.qr?.toMap(),'QR Micro':this.qrMicro?.toMap(),'Code 128':this.code128?.toMap(),'Code 93':this.code93?.toMap(),'Code 39':this.code39?.toMap(),'Codabar':this.codabar?.toMap(),'Code 11':this.code11?.toMap(),'MSI':this.msi?.toMap(),'Upc-A':this.upcA?.toMap(),'Upc-E':this.upcE?.toMap(),'Upc-E1':this.upcE1?.toMap(),'Ean-13':this.ean13?.toMap(),'Ean-8':this.ean8?.toMap(),'PDF 417':this.pdf417?.toMap(),'PDF 417 Micro':this.pdf417Micro?.toMap(),'Datamatrix':this.datamatrix?.toMap(),'Code 25':this.code25?.toMap(),'Interleaved 2 of 5':this.interleaved25?.toMap(),'ITF 14':this.itf14?.toMap(),'IATA 25':this.iata25?.toMap(),'Matrix 25':this.matrix25?.toMap(),'Datalogic 25':this.datalogic25?.toMap(),'COOP 25':this.coop25?.toMap(),'Code 32':this.code32?.toMap(),'Telepen':this.telepen?.toMap(),'Dotcode':this.dotcode?.toMap(),'general':this.general?.toMap()}
|
|
129
|
+
ConfigTypes.DekoderConfig=class DekoderConfig{aztec;aztecCompact;qr;qrMicro;code128;code93;code39;codabar;code11;msi;upcA;upcE;upcE1;ean13;ean8;pdf417;pdf417Micro;datamatrix;code25;interleaved25;itf14;iata25;matrix25;datalogic25;coop25;code32;telepen;dotcode;databar14;databarLimited;databarExpanded;postalIMB;postnet;planet;australianPost;royalMail;kix;japanesePost;general;constructor(config){Object.assign(this,config);}
|
|
130
|
+
toMap(){const map={'Aztec':this.aztec?.toMap(),'Aztec Compact':this.aztecCompact?.toMap(),'QR':this.qr?.toMap(),'QR Micro':this.qrMicro?.toMap(),'Code 128':this.code128?.toMap(),'Code 93':this.code93?.toMap(),'Code 39':this.code39?.toMap(),'Codabar':this.codabar?.toMap(),'Code 11':this.code11?.toMap(),'MSI':this.msi?.toMap(),'Upc-A':this.upcA?.toMap(),'Upc-E':this.upcE?.toMap(),'Upc-E1':this.upcE1?.toMap(),'Ean-13':this.ean13?.toMap(),'Ean-8':this.ean8?.toMap(),'PDF 417':this.pdf417?.toMap(),'PDF 417 Micro':this.pdf417Micro?.toMap(),'Datamatrix':this.datamatrix?.toMap(),'Code 25':this.code25?.toMap(),'Interleaved 2 of 5':this.interleaved25?.toMap(),'ITF 14':this.itf14?.toMap(),'IATA 25':this.iata25?.toMap(),'Matrix 25':this.matrix25?.toMap(),'Datalogic 25':this.datalogic25?.toMap(),'COOP 25':this.coop25?.toMap(),'Code 32':this.code32?.toMap(),'Telepen':this.telepen?.toMap(),'Dotcode':this.dotcode?.toMap(),'Databar 14':this.databar14?.toMap(),'Databar Limited':this.databarLimited?.toMap(),'Databar Expanded':this.databarExpanded?.toMap(),'Postal IMB':this.postalIMB?.toMap(),'Postnet':this.postnet?.toMap(),'Planet':this.planet?.toMap(),'Australian Post':this.australianPost?.toMap(),'Royal Mail':this.royalMail?.toMap(),'KIX':this.kix?.toMap(),'Japanese Post':this.japanesePost?.toMap(),'general':this.general?.toMap()}
|
|
125
131
|
return map;}}
|
|
126
132
|
ConfigTypes.BarcodeConfig=class BarcodeConfig{enabled;constructor(config){Object.assign(this,config);}
|
|
127
133
|
toMap(){const map={"enabled":this.enabled}
|
|
@@ -150,657 +156,54 @@ ConfigTypes.GeneralSettings=class GeneralSettings{decodingSpeed;roiX;roiY;roiWid
|
|
|
150
156
|
toMap(){let map={"decodingSpeed":this.decodingSpeed,"roi_x":this.roiX,"roi_y":this.roiY,"roi_w":this.roiWidth,"roi_h":this.roiHeight,"formattingType":this.formattingType,"encodingCharacterSet":this.encodingCharacterSet,"upcEanDeblur":this.upcEanDeblur,"enableMisshaped1D":this.enableMisshaped1D}
|
|
151
157
|
return map;}
|
|
152
158
|
setROI(x,y,width,height){if(typeof x!="number")throw new Error('Parameter x is not a number!');if(typeof y!="number")throw new Error('Parameter y is not a number!');if(typeof width!="number")throw new Error('Parameter width is not a number!');if(typeof height!="number")throw new Error('Parameter height is not a number!');this.roiX=x;this.roiY=y;this.roiWidth=width;this.roiHeight=height;}}}
|
|
153
|
-
class Connector{static moduleLoaded=false;static cache={ROI:{x:0,y:0,width:100,height:100}};static isInRange(value,low,high){return((value>=low)&&(value<=high));};static storeROI(x,y,w,h){if(!Connector.isInRange(x,0,100))return-1;if(!Connector.isInRange(y,0,100))return-1;if(!Connector.isInRange(w,0,100))return-1;if(!Connector.isInRange(h,0,100))return-1;this.cache.ROI.x=x;this.cache.ROI.y=y;this.cache.ROI.width=w;this.cache.ROI.height=h;return 0;};static initialize=null;static getVersion=null;static getRegionOfInterest=null;static setRegionOfInterest=null;static setDecodingSpeed=null;static setEnabledDecoders=null;static setEnabledDecodersPro=null;static setUpcEanDeblur=null;static setSpecificConfig=null;static setLengthRange=null;static setFormatting=null;static setDuplicatesDelayMs=null;static setEncodingCharacterSet=null;static setMulticodeCachingEnabled=null;static setMulticodeCachingDuration=null;static setEnableMisshaped1D=null;static setEnableVINRestrictions=null;static getDecodingSpeed=null;static getUpcEanDeblur=null;static getFormatting=null;static getDuplicatesDelayMs=null;static getEnableMisshaped1D=null;static getEnableVINRestrictions=null;static getEncodingCharacterSet=null;static getSpecificConfig=null;static getBarcodeTypeEnabled=null;static setBarcodeTypeEnabled=null;static getLengthRange=null;static getMulticodeCachingEnabled=null;static getMulticodeCachingDuration=null;static templateData=null;static templateMode="all";static decoderGroup={normal:0,normalPlusLength:1,normalPlusChecksum:2,other:3};static settingGroup={checksumType:0,expandToUPCA:1,dpmMode:2,multiPartMerge:3};static templateModes=["all","pdf_optimized","qr","retail_1d","industrial_1d","all_2d","dpm","vin","dotcode"];static templateLinker={decoder:[{name:"Aztec",number:0,group:this.decoderGroup.normal},{name:"Aztec Compact",number:1,group:this.decoderGroup.normal},{name:"QR",number:2,group:this.decoderGroup.normal},{name:"QR Micro",number:3,group:this.decoderGroup.normal},{name:"Upc-A",number:10,group:this.decoderGroup.normal},{name:"Upc-E",number:11,group:this.decoderGroup.normal},{name:"Ean-13",number:13,group:this.decoderGroup.normal},{name:"Ean-8",number:14,group:this.decoderGroup.normal},{name:"PDF 417",number:15,group:this.decoderGroup.normal},{name:"PDF 417 Micro",number:16,group:this.decoderGroup.normal},{name:"ITF 14",number:20,group:this.decoderGroup.normal},{name:"Dotcode",number:27,group:this.decoderGroup.normal},{name:"Code 128",number:4,group:this.decoderGroup.normalPlusLength},{name:"Code 93",number:5,group:this.decoderGroup.normalPlusLength},{name:"Code 32",number:25,group:this.decoderGroup.normalPlusLength},{name:"Telepen",number:26,group:this.decoderGroup.normalPlusLength},{name:"Codabar",number:7,group:this.decoderGroup.normalPlusLength},{name:"Code 11",number:8,group:this.decoderGroup.normalPlusChecksum},{name:"MSI",number:9,group:this.decoderGroup.normalPlusChecksum},{name:"Code 25",number:18,group:this.decoderGroup.normalPlusChecksum},{name:"Interleaved 2 of 5",number:19,group:this.decoderGroup.normalPlusChecksum},{name:"IATA 25",number:21,group:this.decoderGroup.normalPlusChecksum},{name:"Matrix 25",number:22,group:this.decoderGroup.normalPlusChecksum},{name:"COOP 25",number:24,group:this.decoderGroup.normalPlusChecksum},{name:"Code 39",number:6,group:this.decoderGroup.normalPlusChecksum},{name:"Datamatrix",number:17,group:this.decoderGroup.other}]};static applyTemplate(templateFile,templateMode){templateMode=(Connector.templateModes.includes(templateMode))?templateMode:Connector.templateMode;Common.debugMessage("Connector","templateMode: "+templateMode,true);fetch(templateFile).then(function(res){return res.json()}).then(function(data){Connector.templateData=data;let decoder=data[templateMode].decoder;let general=decoder.general;let totalDecoders=Connector.templateLinker.decoder.length;let decodersToEnable=
|
|
159
|
+
class Connector{static moduleLoaded=false;static cache={ROI:{x:0,y:0,width:100,height:100}};static isInRange(value,low,high){return((value>=low)&&(value<=high));};static storeROI(x,y,w,h){if(!Connector.isInRange(x,0,100))return-1;if(!Connector.isInRange(y,0,100))return-1;if(!Connector.isInRange(w,0,100))return-1;if(!Connector.isInRange(h,0,100))return-1;this.cache.ROI.x=x;this.cache.ROI.y=y;this.cache.ROI.width=w;this.cache.ROI.height=h;return 0;};static initialize=null;static getVersion=null;static getRegionOfInterest=null;static setRegionOfInterest=null;static setDecodingSpeed=null;static setEnabledDecoders=null;static setEnabledDecodersPro=null;static setUpcEanDeblur=null;static setSpecificConfig=null;static setLengthRange=null;static setFormatting=null;static setDuplicatesDelayMs=null;static setEncodingCharacterSet=null;static setMulticodeCachingEnabled=null;static setMulticodeCachingDuration=null;static setEnableMisshaped1D=null;static setEnableVINRestrictions=null;static setEnableComposite=null;static getDecodingSpeed=null;static getUpcEanDeblur=null;static getFormatting=null;static getDuplicatesDelayMs=null;static getEnableMisshaped1D=null;static getEnableVINRestrictions=null;static getEncodingCharacterSet=null;static getSpecificConfig=null;static getBarcodeTypeEnabled=null;static setBarcodeTypeEnabled=null;static getLengthRange=null;static getMulticodeCachingEnabled=null;static getMulticodeCachingDuration=null;static templateData=null;static templateMode="all";static decoderGroup={normal:0,normalPlusLength:1,normalPlusChecksum:2,other:3};static settingGroup={checksumType:0,expandToUPCA:1,dpmMode:2,multiPartMerge:3};static templateModes=["all","pdf_optimized","qr","retail_1d","industrial_1d","all_2d","dpm","vin","dotcode","all_1d","composite"];static templateLinker={decoder:[{name:"Aztec",number:0,group:this.decoderGroup.normal},{name:"Aztec Compact",number:1,group:this.decoderGroup.normal},{name:"QR",number:2,group:this.decoderGroup.normal},{name:"QR Micro",number:3,group:this.decoderGroup.normal},{name:"Upc-A",number:10,group:this.decoderGroup.normal},{name:"Upc-E",number:11,group:this.decoderGroup.normal},{name:"Ean-13",number:13,group:this.decoderGroup.normal},{name:"Ean-8",number:14,group:this.decoderGroup.normal},{name:"PDF 417",number:15,group:this.decoderGroup.normal},{name:"PDF 417 Micro",number:16,group:this.decoderGroup.normal},{name:"ITF 14",number:20,group:this.decoderGroup.normal},{name:"Dotcode",number:27,group:this.decoderGroup.normal},{name:"Databar 14",number:29,group:this.decoderGroup.normal},{name:"Databar Limited",number:30,group:this.decoderGroup.normal},{name:"Databar Expanded",number:31,group:this.decoderGroup.normal},{name:"Postal IMB",number:32,group:this.decoderGroup.normal},{name:"Postnet",number:33,group:this.decoderGroup.normal},{name:"Planet",number:34,group:this.decoderGroup.normal},{name:"Australian Post",number:35,group:this.decoderGroup.normal},{name:"Royal Mail",number:36,group:this.decoderGroup.normal},{name:"KIX",number:37,group:this.decoderGroup.normal},{name:"Japanese Post",number:38,group:this.decoderGroup.normal},{name:"Code 128",number:4,group:this.decoderGroup.normalPlusLength},{name:"Code 93",number:5,group:this.decoderGroup.normalPlusLength},{name:"Code 32",number:25,group:this.decoderGroup.normalPlusLength},{name:"Telepen",number:26,group:this.decoderGroup.normalPlusLength},{name:"Codabar",number:7,group:this.decoderGroup.normalPlusLength},{name:"Code 11",number:8,group:this.decoderGroup.normalPlusChecksum},{name:"MSI",number:9,group:this.decoderGroup.normalPlusChecksum},{name:"Code 25",number:18,group:this.decoderGroup.normalPlusChecksum},{name:"Interleaved 2 of 5",number:19,group:this.decoderGroup.normalPlusChecksum},{name:"IATA 25",number:21,group:this.decoderGroup.normalPlusChecksum},{name:"Matrix 25",number:22,group:this.decoderGroup.normalPlusChecksum},{name:"COOP 25",number:24,group:this.decoderGroup.normalPlusChecksum},{name:"Code 39",number:6,group:this.decoderGroup.normalPlusChecksum},{name:"Datamatrix",number:17,group:this.decoderGroup.other}]};static applyTemplate(templateFile,templateMode){templateMode=(Connector.templateModes.includes(templateMode))?templateMode:Connector.templateMode;Common.debugMessage("Connector","templateMode: "+templateMode,true);fetch(templateFile).then(function(res){return res.json()}).then(function(data){Connector.templateData=data;let decoder=data[templateMode].decoder;let general=decoder.general;let totalDecoders=Connector.templateLinker.decoder.length;let decodersToEnable=0n;for(let i=0;i<totalDecoders;i++)
|
|
154
160
|
{let decoderName=Connector.templateLinker.decoder[i].name;let decoderNumber=Connector.templateLinker.decoder[i].number;let decoderGroup=Connector.templateLinker.decoder[i].group;Common.debugMessage("Connector",decoderName+" i: "+i,false);Common.debugMessage("",decoder[decoderName],false);if(typeof decoder[decoderName]=='object')
|
|
155
|
-
{Common.debugMessage("Connector","decoderName: "+decoderName,false);if(decoder[decoderName].enabled)decodersToEnable+=
|
|
161
|
+
{Common.debugMessage("Connector","decoderName: "+decoderName,false);if(decoder[decoderName].enabled)decodersToEnable+=(2n**BigInt(decoderNumber));if(decoderGroup==Connector.decoderGroup.normalPlusLength)
|
|
156
162
|
{Connector.setLengthRange(decoderNumber,decoder[decoderName].minimumLength,decoder[decoderName].maximumLength);}
|
|
157
163
|
else if(decoderGroup==Connector.decoderGroup.normalPlusChecksum)
|
|
158
164
|
{Connector.setLengthRange(decoderNumber,decoder[decoderName].minimumLength,decoder[decoderName].maximumLength);Connector.setSpecificConfig(decoderNumber,decoder[decoderName].checksum,Connector.settingGroup.checksumType);}
|
|
159
165
|
else if(decoderGroup==Connector.decoderGroup.other)
|
|
160
166
|
{Connector.setSpecificConfig(decoderNumber,decoder[decoderName].dpmMode,Connector.settingGroup.dpmMode);}}}
|
|
161
|
-
Common.debugMessage("Connector","decodersToEnable: "+decodersToEnable,true);Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decodersToEnable;Connector.setDecodingSpeed(general.decodingSpeed);Connector.setDuplicatesDelayMs(general.duplicatesDelayMs);Connector.setEnableMisshaped1D(general.enableMisshaped1D);Connector.setEnableVINRestrictions(general.enableVINRestrictions);Connector.setEncodingCharacterSet(general.encodingCharacterSet);Connector.setFormatting(general.formattingType);Connector.setMulticodeCachingDuration(general.multicodeCachingDuration);Connector.setMulticodeCachingEnabled(general.multicodeCachingEnabled);let closeSessionOnResultEnabled=data[templateMode].closeSessionOnResultEnabled;Barkoder.setContinuous(!closeSessionOnResultEnabled);Barkoder.setRegionOfInterest(general.roi_x,general.roi_y,general.roi_w,general.roi_h);Connector.setUpcEanDeblur(general.upcEanDeblur);Common.debugMessage("Connector",templateFile+" applied successfully",true);}).catch((error)=>{console.log('Failed to fetch '+templateFile+' -> error',error);});};static scanImage_getDownscaleFactor(width,height,maxDimension){let downscaleFactor=1;let downscaleByWidth=false;let downscaleByHeight=false;if(width>maxDimension)downscaleByWidth=true;if(height>maxDimension)downscaleByHeight=true;if((!downscaleByWidth)&&(!downscaleByHeight))return downscaleFactor;let biggerImageDimension=(width>height)?width:height;downscaleFactor=Math.floor((biggerImageDimension/3000))+1;return downscaleFactor;};static scanFrame_native(imageData,result_callback,caller_id){let data=imageData.data;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let BKResult_json;let DEBUG_CODE=caller_id;BKResult_json=Module.cwrap("api_BKDecodeImageMemory","string",["number","number","number","number"])(dataPtr,imageData.width,imageData.height,DEBUG_CODE);let BKResult=JSON.parse(BKResult_json);Module._free(BKResult_json);Module._free(dataPtr);dataPtr=null;return BKResult;};static img_canvasFrame=document.createElement('canvas');static img_imageFrame=document.createElement('img');static scanImage=function(imageURI,result_callback){if(typeof imageURI!='string')return Promise.resolve(false);let canvasFrame=Connector.img_canvasFrame;let imageFrame=Connector.img_imageFrame;let use_callback=(typeof result_callback=='function');return new Promise((resolve)=>{imageFrame.onload=function(){let imageWidth=imageFrame.width;let imageHeight=imageFrame.height;let downscaleFactor=Connector.scanImage_getDownscaleFactor(imageWidth,imageHeight,3000);if(downscaleFactor>1){imageWidth/=downscaleFactor;imageHeight/=downscaleFactor;}
|
|
167
|
+
Common.debugMessage("Connector","decodersToEnable: "+decodersToEnable,true);let Res=Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decodersToEnable;Connector.setDecodingSpeed(general.decodingSpeed);Connector.setDuplicatesDelayMs(general.duplicatesDelayMs);Connector.setEnableMisshaped1D(general.enableMisshaped1D);Connector.setEnableVINRestrictions(general.enableVINRestrictions);if(typeof general.enableComposite=='number')Connector.setEnableComposite(general.enableComposite);Connector.setEncodingCharacterSet(general.encodingCharacterSet);Connector.setFormatting(general.formattingType);Connector.setMulticodeCachingDuration(general.multicodeCachingDuration);Connector.setMulticodeCachingEnabled(general.multicodeCachingEnabled);let closeSessionOnResultEnabled=data[templateMode].closeSessionOnResultEnabled;Barkoder.setContinuous(!closeSessionOnResultEnabled);Barkoder.setRegionOfInterest(general.roi_x,general.roi_y,general.roi_w,general.roi_h);Connector.setUpcEanDeblur(general.upcEanDeblur);Common.debugMessage("Connector",templateFile+" applied successfully",true);}).catch((error)=>{console.log('Failed to fetch '+templateFile+' -> error',error);});};static scanImage_getDownscaleFactor(width,height,maxDimension){let downscaleFactor=1;let downscaleByWidth=false;let downscaleByHeight=false;if(width>maxDimension)downscaleByWidth=true;if(height>maxDimension)downscaleByHeight=true;if((!downscaleByWidth)&&(!downscaleByHeight))return downscaleFactor;let biggerImageDimension=(width>height)?width:height;downscaleFactor=Math.floor((biggerImageDimension/3000))+1;return downscaleFactor;};static scanFrame_native(imageData,result_callback,caller_id){let data=imageData.data;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let BKResult_json;let DEBUG_CODE=caller_id;BKResult_json=Module.cwrap("api_BKDecodeImageMemory","string",["number","number","number","number"])(dataPtr,imageData.width,imageData.height,DEBUG_CODE);let BKResult=JSON.parse(BKResult_json);Module._free(BKResult_json);Module._free(dataPtr);dataPtr=null;return BKResult;};static img_canvasFrame=document.createElement('canvas');static img_imageFrame=document.createElement('img');static scanImage=function(imageURI,result_callback){if(typeof imageURI!='string')return Promise.resolve(false);let canvasFrame=Connector.img_canvasFrame;let imageFrame=Connector.img_imageFrame;let use_callback=(typeof result_callback=='function');return new Promise((resolve)=>{imageFrame.onload=function(){let imageWidth=imageFrame.width;let imageHeight=imageFrame.height;let downscaleFactor=Connector.scanImage_getDownscaleFactor(imageWidth,imageHeight,3000);if(downscaleFactor>1){imageWidth/=downscaleFactor;imageHeight/=downscaleFactor;}
|
|
162
168
|
canvasFrame.width=imageWidth;canvasFrame.height=imageHeight;var ctx=canvasFrame.getContext('2d');ctx.fillStyle="rgba(255, 255, 255, 1.0)";ctx.fillRect(0,0,canvasFrame.width,canvasFrame.height);ctx.drawImage(imageFrame,0,0,imageWidth,imageHeight);var imageData=ctx.getImageData(0,0,canvasFrame.width,canvasFrame.height);let BKResult=Connector.scanFrame_native(imageData,result_callback,0);window.BarkoderSDK_frameDecoding=false;ctx.clearRect(0,0,canvasFrame.width,canvasFrame.height);canvasFrame.width=0;canvasFrame.height=0;if(Bridge.enabledDecoders==0)
|
|
163
169
|
{BKResult["error"]={name:"NoEnabledSymbologies",message:"There are no enabled symbologies. The scanner is not scanning for any barcodes."};}
|
|
164
170
|
if(downscaleFactor>1){let resultsCount=BKResult.resultsCount;if(resultsCount==1){BKResult.location.p1.x*=downscaleFactor;BKResult.location.p1.y*=downscaleFactor;BKResult.location.p2.x*=downscaleFactor;BKResult.location.p2.y*=downscaleFactor;BKResult.location.p3.x*=downscaleFactor;BKResult.location.p3.y*=downscaleFactor;BKResult.location.p4.x*=downscaleFactor;BKResult.location.p4.y*=downscaleFactor;}else if(resultsCount>1){for(let i=0;i<resultsCount;i++)
|
|
165
171
|
{BKResult.results[i].location.p1.x*=downscaleFactor;BKResult.results[i].location.p1.y*=downscaleFactor;BKResult.results[i].location.p2.x*=downscaleFactor;BKResult.results[i].location.p2.y*=downscaleFactor;BKResult.results[i].location.p3.x*=downscaleFactor;BKResult.results[i].location.p3.y*=downscaleFactor;BKResult.results[i].location.p4.x*=downscaleFactor;BKResult.results[i].location.p4.y*=downscaleFactor;}}}
|
|
166
172
|
if(use_callback){result_callback(BKResult);resolve(true);}
|
|
167
173
|
else resolve(BKResult);};imageFrame.onerror=(e)=>{Common.debugMessage("scanImage",e.type,true);resolve(false);};imageFrame.src=imageURI;});};static scannerEvent=new CustomEvent("scannerReady",{detail:"Scanner is ready."});}
|
|
168
|
-
var Module={preRun:[],postRun:[()=>Common.debugMessage("Module","The main() function is done.",true),async()=>{if(Connector.moduleLoaded)return;if(typeof Module._free=="undefined")Module._free=Module.cwrap("aux_freeMemory",null,["number"]);if(typeof Module._malloc=="undefined")Module._malloc=Module.cwrap("aux_allocMemory",null,["number"]);Connector.initialize=Module.cwrap("initialize","number",["number"]);Connector.getVersion=Module.cwrap("inf_BKgetVersion","string",[]);Connector.getRegionOfInterest=Module.cwrap("cfg_BKGetRegionOfInterest","string",[]);Connector.setRegionOfInterest=Module.cwrap("cfg_BKSetRegionOfInterest",undefined,["number","number","number","number"]);Connector.setDecodingSpeed=Module.cwrap("cfg_BKSetDecodingSpeed","number",["number"]);Connector.setEnabledDecoders=Module.cwrap("cfg_BKSetEnabledDecoders","number",["number","number"]);Connector.setEnabledDecodersPro=Module.cwrap("cfg_BKSetEnabledDecodersPro","number",["number"]);Connector.setUpcEanDeblur=Module.cwrap("cfg_BKSetUpcEanDeblur","number",["number"]);Connector.setSpecificConfig=Module.cwrap("cfg_BKSetSpecificConfig","number",["number","number"]);Connector.setLengthRange=Module.cwrap("cfg_BKSetLengthRange","number",["number","number","number"]);Connector.setFormatting=Module.cwrap("cfg_BKSetFormatting","number",["number"]);Connector.setDuplicatesDelayMs=Module.cwrap("cfg_BKSetDuplicatesDelayMs","number",["number"]);Connector.setEncodingCharacterSet=Module.cwrap("cfg_BKSetEncodingCharacterSet","number",["number"]);Connector.setMulticodeCachingEnabled=Module.cwrap("cfg_BKSetMulticodeCachingEnabled","number",["number"]);Connector.setMulticodeCachingDuration=Module.cwrap("cfg_BKSetMulticodeCachingDuration","number",["number"]);Connector.setMaximumResultsCount=Module.cwrap("cfg_BKSetMaximumResultsCount","number",["number"]);Connector.setEnableMisshaped1D=Module.cwrap("cfg_BKSetEnableMisshaped1D","number",["number"]);Connector.setEnableVINRestrictions=Module.cwrap("cfg_BKSetEnableVINRestrictions","number",["number"]);Connector.getDecodingSpeed=Module.cwrap("cfg_BKReturnDecodingSpeed","number",[]);Connector.getUpcEanDeblur=Module.cwrap("cfg_BKReturnUpcEanDeblur","number",[]);Connector.getFormatting=Module.cwrap("cfg_BKReturnFormatting","number",[]);Connector.getDuplicatesDelayMs=Module.cwrap("cfg_BKReturnDuplicatesDelayMs","number",[]);Connector.getMaximumResultsCount=Module.cwrap("cfg_BKGetMaximumResultsCount","number",[]);Connector.getEnableMisshaped1D=Module.cwrap("cfg_BKReturnEnableMisshaped1D","number",[]);Connector.getEnableVINRestrictions=Module.cwrap("cfg_BKReturnEnableVINRestrictions","number",[]);Connector.getEncodingCharacterSet=Module.cwrap("cfg_BKReturnEncodingCharacterSet","number",[]);Connector.getSpecificConfig=Module.cwrap("cfg_BKReturnSpecificConfig","number",["number"]);Connector.getBarcodeTypeEnabled=Module.cwrap("cfg_BKReturnBarcodeTypeEnabled","number",["number"]);Connector.setBarcodeTypeEnabled=Module.cwrap("cfg_BKSetBarcodeTypeEnabled","number",["number","number"]);Connector.getLengthRange=Module.cwrap("cfg_BKReturnLengthRange","number",["number"]);Connector.getMulticodeCachingEnabled=Module.cwrap("cfg_BKReturnMulticodeCachingEnabled","number",[]);Connector.getMulticodeCachingDuration=Module.cwrap("cfg_BKReturnMulticodeCachingDuration","number",[]);for(const key of Object.getOwnPropertyNames(Connector)){const old=Connector[key];Common.debugMessage("postRun","Connector."+key+" accessed",false);Common.debugMessage("postRun",typeof old+" type",false);if(typeof old=='function'&&key.startsWith('get')){Common.debugMessage("postRun","Connector."+key+" is about to be overridden",true);Connector[key]=function(...args){return JSON.parse(old.call(this,...args));};}}
|
|
174
|
+
var Module={preRun:[],postRun:[()=>Common.debugMessage("Module","The main() function is done.",true),async()=>{if(Connector.moduleLoaded)return;if(typeof Module._free=="undefined")Module._free=Module.cwrap("aux_freeMemory",null,["number"]);if(typeof Module._malloc=="undefined")Module._malloc=Module.cwrap("aux_allocMemory",null,["number"]);Connector.initialize=Module.cwrap("initialize","number",["number"]);Connector.getVersion=Module.cwrap("inf_BKgetVersion","string",[]);Connector.getRegionOfInterest=Module.cwrap("cfg_BKGetRegionOfInterest","string",[]);Connector.setRegionOfInterest=Module.cwrap("cfg_BKSetRegionOfInterest",undefined,["number","number","number","number"]);Connector.setDecodingSpeed=Module.cwrap("cfg_BKSetDecodingSpeed","number",["number"]);Connector.setEnabledDecoders=Module.cwrap("cfg_BKSetEnabledDecoders","number",["number","number"]);Connector.setEnabledDecodersPro=Module.cwrap("cfg_BKSetEnabledDecodersPro","number",["number"]);Connector.setUpcEanDeblur=Module.cwrap("cfg_BKSetUpcEanDeblur","number",["number"]);Connector.setSpecificConfig=Module.cwrap("cfg_BKSetSpecificConfig","number",["number","number"]);Connector.setLengthRange=Module.cwrap("cfg_BKSetLengthRange","number",["number","number","number"]);Connector.setFormatting=Module.cwrap("cfg_BKSetFormatting","number",["number"]);Connector.setDuplicatesDelayMs=Module.cwrap("cfg_BKSetDuplicatesDelayMs","number",["number"]);Connector.setEncodingCharacterSet=Module.cwrap("cfg_BKSetEncodingCharacterSet","number",["number"]);Connector.setMulticodeCachingEnabled=Module.cwrap("cfg_BKSetMulticodeCachingEnabled","number",["number"]);Connector.setMulticodeCachingDuration=Module.cwrap("cfg_BKSetMulticodeCachingDuration","number",["number"]);Connector.setMaximumResultsCount=Module.cwrap("cfg_BKSetMaximumResultsCount","number",["number"]);Connector.setEnableMisshaped1D=Module.cwrap("cfg_BKSetEnableMisshaped1D","number",["number"]);Connector.setEnableVINRestrictions=Module.cwrap("cfg_BKSetEnableVINRestrictions","number",["number"]);Connector.setEnableComposite=Module.cwrap("cfg_BKSetEnableComposite","number",["number"]);Connector.getDecodingSpeed=Module.cwrap("cfg_BKReturnDecodingSpeed","number",[]);Connector.getUpcEanDeblur=Module.cwrap("cfg_BKReturnUpcEanDeblur","number",[]);Connector.getFormatting=Module.cwrap("cfg_BKReturnFormatting","number",[]);Connector.getDuplicatesDelayMs=Module.cwrap("cfg_BKReturnDuplicatesDelayMs","number",[]);Connector.getMaximumResultsCount=Module.cwrap("cfg_BKGetMaximumResultsCount","number",[]);Connector.getEnableMisshaped1D=Module.cwrap("cfg_BKReturnEnableMisshaped1D","number",[]);Connector.getEnableVINRestrictions=Module.cwrap("cfg_BKReturnEnableVINRestrictions","number",[]);Connector.getEnableComposite=Module.cwrap("cfg_BKReturnEnableComposite","number",[]);Connector.getEncodingCharacterSet=Module.cwrap("cfg_BKReturnEncodingCharacterSet","number",[]);Connector.getSpecificConfig=Module.cwrap("cfg_BKReturnSpecificConfig","number",["number"]);Connector.getBarcodeTypeEnabled=Module.cwrap("cfg_BKReturnBarcodeTypeEnabled","number",["number"]);Connector.setBarcodeTypeEnabled=Module.cwrap("cfg_BKSetBarcodeTypeEnabled","number",["number","number"]);Connector.getLengthRange=Module.cwrap("cfg_BKReturnLengthRange","number",["number"]);Connector.getMulticodeCachingEnabled=Module.cwrap("cfg_BKReturnMulticodeCachingEnabled","number",[]);Connector.getMulticodeCachingDuration=Module.cwrap("cfg_BKReturnMulticodeCachingDuration","number",[]);for(const key of Object.getOwnPropertyNames(Connector)){const old=Connector[key];Common.debugMessage("postRun","Connector."+key+" accessed",false);Common.debugMessage("postRun",typeof old+" type",false);if(typeof old=='function'&&key.startsWith('get')){Common.debugMessage("postRun","Connector."+key+" is about to be overridden",true);Connector[key]=function(...args){return JSON.parse(old.call(this,...args));};}}
|
|
169
175
|
var timeCounter=0;if(typeof window.BarkoderSDK_callback1D=='undefined')window.BarkoderSDK_callback1D=false;while(!window.BarkoderSDK_callback1D){await Common.wait(20);timeCounter+=20;}
|
|
170
|
-
window.BarkoderSDK_callback1D=undefined;Common.debugMessage("Init",`Stage 1 took ${timeCounter}ms`,true);Connector.moduleLoaded=true;setTimeout(()=>{document.dispatchEvent(Connector.scannerEvent)},40);}],print:function(text){Common.debugMessage("Module",text,1);}};if(has_SIMD)
|
|
171
|
-
{if(true)
|
|
172
|
-
{var Module=typeof Module!='undefined'?Module:{};var ENVIRONMENT_IS_WEB=typeof window=='object';var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!='undefined';var ENVIRONMENT_IS_NODE=typeof process=='object'&&typeof process.versions=='object'&&typeof process.versions.node=='string'&&process.type!='renderer';var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}
|
|
173
|
-
var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram='./this.program';var quit_=(status,toThrow)=>{throw toThrow;};var scriptDirectory='';function locateFile(path){if(Module['locateFile']){return Module['locateFile'](path,scriptDirectory);}
|
|
174
|
-
return scriptDirectory+path;}
|
|
175
|
-
var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){if(typeof process=='undefined'||!process.release||process.release.name!=='node')throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');var nodeVersion=process.versions.node;var numericVersion=nodeVersion.split('.').slice(0,3);numericVersion=(numericVersion[0]*10000)+(numericVersion[1]*100)+(numericVersion[2].split('-')[0]*1);var minVersion=160000;if(numericVersion<160000){throw new Error('This emscripten-generated code requires node v16.0.0 (detected v'+nodeVersion+')');}
|
|
176
|
-
var fs=require('fs');var nodePath=require('path');scriptDirectory=__dirname+'/';readBinary=(filename)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);assert(Buffer.isBuffer(ret));return ret;};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:'utf8');assert(binary?Buffer.isBuffer(ret):typeof ret=='string');return ret;};if(!Module['thisProgram']&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,'/');}
|
|
177
|
-
arguments_=process.argv.slice(2);if(typeof module!='undefined'){module['exports']=Module;}
|
|
178
|
-
quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow;};}else
|
|
179
|
-
if(ENVIRONMENT_IS_SHELL){if((typeof process=='object'&&typeof require==='function')||typeof window=='object'||typeof WorkerGlobalScope!='undefined')throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');}else
|
|
180
|
-
if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href;}else if(typeof document!='undefined'&&document.currentScript){scriptDirectory=document.currentScript.src;}
|
|
181
|
-
if(scriptDirectory.startsWith('blob:')){scriptDirectory='';}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,'').lastIndexOf('/')+1);}
|
|
182
|
-
if(!(typeof window=='object'||typeof WorkerGlobalScope!='undefined'))throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');{if(ENVIRONMENT_IS_WORKER){readBinary=(url)=>{var xhr=new XMLHttpRequest();xhr.open('GET',url,false);xhr.responseType='arraybuffer';xhr.send(null);return new Uint8Array((xhr.response));};}
|
|
183
|
-
readAsync=async(url)=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest();xhr.open('GET',url,true);xhr.responseType='arraybuffer';xhr.onload=()=>{if(xhr.status==200||(xhr.status==0&&xhr.response)){resolve(xhr.response);return;}
|
|
184
|
-
reject(xhr.status);};xhr.onerror=reject;xhr.send(null);});}
|
|
185
|
-
var response=await fetch(url,{credentials:'same-origin'});if(response.ok){return response.arrayBuffer();}
|
|
186
|
-
throw new Error(response.status+' : '+response.url);};}}else
|
|
187
|
-
{throw new Error('environment detection error');}
|
|
188
|
-
var out=Module['print']||console.log.bind(console);var err=Module['printErr']||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module['arguments'])arguments_=Module['arguments'];legacyModuleProp('arguments','arguments_');if(Module['thisProgram'])thisProgram=Module['thisProgram'];legacyModuleProp('thisProgram','thisProgram');assert(typeof Module['memoryInitializerPrefixURL']=='undefined','Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');assert(typeof Module['pthreadMainPrefixURL']=='undefined','Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');assert(typeof Module['cdInitializerPrefixURL']=='undefined','Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');assert(typeof Module['filePackagePrefixURL']=='undefined','Module.filePackagePrefixURL option was removed, use Module.locateFile instead');assert(typeof Module['read']=='undefined','Module.read option was removed');assert(typeof Module['readAsync']=='undefined','Module.readAsync option was removed (modify readAsync in JS)');assert(typeof Module['readBinary']=='undefined','Module.readBinary option was removed (modify readBinary in JS)');assert(typeof Module['setWindowTitle']=='undefined','Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');assert(typeof Module['TOTAL_MEMORY']=='undefined','Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');legacyModuleProp('asm','wasmExports');legacyModuleProp('readAsync','readAsync');legacyModuleProp('readBinary','readBinary');legacyModuleProp('setWindowTitle','setWindowTitle');var IDBFS='IDBFS is no longer included by default; build with -lidbfs.js';var PROXYFS='PROXYFS is no longer included by default; build with -lproxyfs.js';var WORKERFS='WORKERFS is no longer included by default; build with -lworkerfs.js';var FETCHFS='FETCHFS is no longer included by default; build with -lfetchfs.js';var ICASEFS='ICASEFS is no longer included by default; build with -licasefs.js';var JSFILEFS='JSFILEFS is no longer included by default; build with -ljsfilefs.js';var OPFS='OPFS is no longer included by default; build with -lopfs.js';var NODEFS='NODEFS is no longer included by default; build with -lnodefs.js';assert(!ENVIRONMENT_IS_SHELL,'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');var wasmBinary=Module['wasmBinary'];legacyModuleProp('wasmBinary','wasmBinary');if(typeof WebAssembly!='object'){err('no native wasm support detected');}
|
|
189
|
-
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);}
|
|
190
|
-
var decoded=atob(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i);}
|
|
191
|
-
return bytes;}
|
|
192
|
-
function tryParseAsDataURI(filename){if(!isDataURI(filename)){return;}
|
|
193
|
-
return intArrayFromBase64(filename.slice(dataURIPrefix.length));}
|
|
194
|
-
var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort('Assertion failed'+(text?': '+text:''));}}
|
|
195
|
-
var HEAP,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;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);}
|
|
196
|
-
assert(!Module['STACK_SIZE'],'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
|
|
197
|
-
assert(typeof Int32Array!='undefined'&&typeof Float64Array!=='undefined'&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,'JS engine does not provide full typed array support');assert(!Module['wasmMemory'],'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');assert(!Module['INITIAL_MEMORY'],'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);if(max==0){max+=4;}
|
|
198
|
-
HEAPU32[((max)>>2)]=0x02135467;HEAPU32[(((max)+(4))>>2)]=0x89BACDFE;HEAPU32[((0)>>2)]=1668509029;}
|
|
199
|
-
function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();if(max==0){max+=4;}
|
|
200
|
-
var cookie1=HEAPU32[((max)>>2)];var cookie2=HEAPU32[(((max)+(4))>>2)];if(cookie1!=0x02135467||cookie2!=0x89BACDFE){abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);}
|
|
201
|
-
if(HEAPU32[((0)>>2)]!=0x63736d65){abort('Runtime error: The application has corrupted its heap memory area (address zero)!');}}
|
|
202
|
-
var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module['preRun']){if(typeof Module['preRun']=='function')Module['preRun']=[Module['preRun']];while(Module['preRun'].length){addOnPreRun(Module['preRun'].shift());}}
|
|
203
|
-
callRuntimeCallbacks(__ATPRERUN__);}
|
|
204
|
-
function initRuntime(){assert(!runtimeInitialized);runtimeInitialized=true;checkStackCookie();if(!Module['noFSInit']&&!FS.initialized)
|
|
205
|
-
FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__);}
|
|
206
|
-
function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__);}
|
|
207
|
-
function postRun(){checkStackCookie();if(Module['postRun']){if(typeof Module['postRun']=='function')Module['postRun']=[Module['postRun']];while(Module['postRun'].length){addOnPostRun(Module['postRun'].shift());}}
|
|
208
|
-
callRuntimeCallbacks(__ATPOSTRUN__);}
|
|
209
|
-
function addOnPreRun(cb){__ATPRERUN__.unshift(cb);}
|
|
210
|
-
function addOnInit(cb){__ATINIT__.unshift(cb);}
|
|
211
|
-
function addOnPreMain(cb){__ATMAIN__.unshift(cb);}
|
|
212
|
-
function addOnExit(cb){}
|
|
213
|
-
function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb);}
|
|
214
|
-
assert(Math.imul,'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');assert(Math.fround,'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');assert(Math.clz32,'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');assert(Math.trunc,'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');var runDependencies=0;var dependenciesFulfilled=null;var runDependencyTracking={};var runDependencyWatcher=null;function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random();}}
|
|
215
|
-
function addRunDependency(id){runDependencies++;Module['monitorRunDependencies']?.(runDependencies);if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!='undefined'){runDependencyWatcher=setInterval(()=>{if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return;}
|
|
216
|
-
var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err('still waiting on run dependencies:');}
|
|
217
|
-
err(`dependency: ${dep}`);}
|
|
218
|
-
if(shown){err('(end of list)');}},10000);}}else{err('warning: run dependency added without ID');}}
|
|
219
|
-
function removeRunDependency(id){runDependencies--;Module['monitorRunDependencies']?.(runDependencies);if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id];}else{err('warning: run dependency removed without ID');}
|
|
220
|
-
if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null;}
|
|
221
|
-
if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}}
|
|
222
|
-
function abort(what){Module['onAbort']?.(what);what='Aborted('+what+')';err(what);ABORT=true;var e=new WebAssembly.RuntimeError(what);throw e;}
|
|
223
|
-
var dataURIPrefix='data:application/octet-stream;base64,';var isDataURI=(filename)=>filename.startsWith(dataURIPrefix);var isFileURI=(filename)=>filename.startsWith('file://');function createExportWrapper(name,nargs){return(...args)=>{assert(runtimeInitialized,`native function \`${name}\` called before runtime initialization`);var f=wasmExports[name];assert(f,`exported native function \`${name}\` not found`);assert(args.length<=nargs,`native function \`${name}\` called with ${args.length} args but expects ${nargs}`);return f(...args);};}
|
|
224
|
-
class EmscriptenEH extends Error{}
|
|
225
|
-
class EmscriptenSjLj extends EmscriptenEH{}
|
|
226
|
-
class CppException extends EmscriptenEH{constructor(excPtr){super(excPtr);this.excPtr=excPtr;const excInfo=getExceptionMessage(excPtr);this.name=excInfo[0];this.message=excInfo[1];}}
|
|
227
|
-
function findWasmBinary(){var f='barkoder.wasm';if(!isDataURI(f)){return locateFile(f);}
|
|
228
|
-
return f;}
|
|
229
|
-
var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary);}
|
|
230
|
-
if(readBinary){return readBinary(file);}
|
|
231
|
-
throw'both async and sync fetching of the wasm failed';}
|
|
232
|
-
async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response);}catch{}}
|
|
233
|
-
return getBinarySync(binaryFile);}
|
|
234
|
-
async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance;}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);if(isFileURI(wasmBinaryFile)){err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);}
|
|
235
|
-
abort(reason);}}
|
|
236
|
-
async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=='function'&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=='function'){try{var response=fetch(binaryFile,{credentials:'same-origin'});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult;}catch(reason){err(`wasm streaming compile failed: ${reason}`);err('falling back to ArrayBuffer instantiation');};}
|
|
237
|
-
return instantiateArrayBuffer(binaryFile,imports);}
|
|
238
|
-
function getWasmImports(){return{'env':wasmImports,'wasi_snapshot_preview1':wasmImports,}}
|
|
239
|
-
async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports['memory'];assert(wasmMemory,'memory not found in wasm exports');updateMemoryViews();wasmTable=wasmExports['__indirect_function_table'];assert(wasmTable,'table not found in wasm exports');addOnInit(wasmExports['__wasm_call_ctors']);removeRunDependency('wasm-instantiate');return wasmExports;}
|
|
240
|
-
addRunDependency('wasm-instantiate');var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');trueModule=null;receiveInstance(result['instance']);}
|
|
241
|
-
var info=getWasmImports();if(Module['instantiateWasm']){try{return Module['instantiateWasm'](info,receiveInstance);}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false;}}
|
|
242
|
-
wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);receiveInstantiationResult(result);return result;}
|
|
243
|
-
var tempDouble;var tempI64;(()=>{var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=0x6373;if(h8[0]!==0x73||h8[1]!==0x63)throw'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';})();if(Module['ENVIRONMENT']){throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');}
|
|
244
|
-
function legacyModuleProp(prop,newName,incoming=true){if(!Object.getOwnPropertyDescriptor(Module,prop)){Object.defineProperty(Module,prop,{configurable:true,get(){let extra=incoming?' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)':'';abort(`\`Module.${prop}\` has been replaced by \`${newName}\``+extra);}});}}
|
|
245
|
-
function ignoredModuleProp(prop){if(Object.getOwnPropertyDescriptor(Module,prop)){abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);}}
|
|
246
|
-
function isExportedByForceFilesystem(name){return name==='FS_createPath'||name==='FS_createDataFile'||name==='FS_createPreloadedFile'||name==='FS_unlink'||name==='addRunDependency'||name==='FS_createLazyFile'||name==='FS_createDevice'||name==='removeRunDependency';}
|
|
247
|
-
function hookGlobalSymbolAccess(sym,func){if(typeof globalThis!='undefined'&&!Object.getOwnPropertyDescriptor(globalThis,sym)){Object.defineProperty(globalThis,sym,{configurable:true,get(){func();return undefined;}});}}
|
|
248
|
-
function missingGlobal(sym,msg){hookGlobalSymbolAccess(sym,()=>{warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);});}
|
|
249
|
-
missingGlobal('buffer','Please use HEAP8.buffer or wasmMemory.buffer');missingGlobal('asm','Please use wasmExports instead');function missingLibrarySymbol(sym){hookGlobalSymbolAccess(sym,()=>{var msg=`\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;var librarySymbol=sym;if(!librarySymbol.startsWith('_')){librarySymbol='$'+sym;}
|
|
250
|
-
msg+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;if(isExportedByForceFilesystem(sym)){msg+='. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';}
|
|
251
|
-
warnOnce(msg);});unexportedRuntimeSymbol(sym);}
|
|
252
|
-
function unexportedRuntimeSymbol(sym){if(!Object.getOwnPropertyDescriptor(Module,sym)){Object.defineProperty(Module,sym,{configurable:true,get(){var msg=`'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;if(isExportedByForceFilesystem(sym)){msg+='. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';}
|
|
253
|
-
abort(msg);}});}}
|
|
254
|
-
function dbg(...args){console.warn(...args);}
|
|
255
|
-
var ASM_CONSTS={15535056:()=>{window.BarkoderSDK_callback2D=true;},15535094:()=>{window.BarkoderSDK_callback3D=true;},15535132:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1);},15535187:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1);},15535242:()=>{window.BarkoderSDK_callback1D=true;},15535280:($0)=>{window.BarkoderSDK_frameDecoding=true;window.BarkoderSDK_currentFrame=$0;},15535363:($0,$1,$2,$3,$4)=>{if(typeof Module=='undefined'||!Module.MountedFiles){return 1;}let fileName=UTF8ToString(Number($0>>>0));if(fileName.startsWith('./')){fileName=fileName.substring(2);}const fileData=Module.MountedFiles.get(fileName);if(!fileData){return 2;}const offset=Number($1>>>0);const length=Number($2>>>0);const dataIdOrBuffer=Number($3>>>0);const loadType=$4;if(offset+length>fileData.byteLength){return 3;}try{const data=fileData.subarray(offset,offset+length);switch(loadType){case 0:HEAPU8.set(data,dataIdOrBuffer);break;case 1:Module.jsepUploadExternalBuffer(dataIdOrBuffer,data);break;default:return 4;}return 0;}catch{return 4;}},15536078:()=>{return(typeof wasmOffsetConverter!=='undefined');}};function HaveOffsetConverter(){return typeof wasmOffsetConverter!=='undefined';}
|
|
256
|
-
class ExitStatus{name='ExitStatus';constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status;}}
|
|
257
|
-
var callRuntimeCallbacks=(callbacks)=>{while(callbacks.length>0){callbacks.shift()(Module);}};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':abort('to do getValue(i64) use WASM_BIGINT');case'float':return HEAPF32[((ptr)>>2)];case'double':return HEAPF64[((ptr)>>3)];case'*':return HEAPU32[((ptr)>>2)];default:abort(`invalid type for getValue: ${type}`);}}
|
|
258
|
-
var noExitRuntime=Module['noExitRuntime']||true;var ptrToString=(ptr)=>{assert(typeof ptr==='number');ptr>>>=0;return'0x'+ptr.toString(16).padStart(8,'0');};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':abort('to do setValue(i64) use WASM_BIGINT');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}`);}}
|
|
259
|
-
var stackRestore=(val)=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var warnOnce=(text)=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text='warning: '+text;err(text);}};var UTF8Decoder=typeof TextDecoder!='undefined'?new TextDecoder():undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));}
|
|
260
|
-
var str='';while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&0x80)){str+=String.fromCharCode(u0);continue;}
|
|
261
|
-
var u1=heapOrArray[idx++]&63;if((u0&0xE0)==0xC0){str+=String.fromCharCode(((u0&31)<<6)|u1);continue;}
|
|
262
|
-
var u2=heapOrArray[idx++]&63;if((u0&0xF0)==0xE0){u0=((u0&15)<<12)|(u1<<6)|u2;}else{if((u0&0xF8)!=0xF0)warnOnce('Invalid UTF-8 leading byte '+ptrToString(u0)+' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');u0=((u0&7)<<18)|(u1<<12)|(u2<<6)|(heapOrArray[idx++]&63);}
|
|
263
|
-
if(u0<0x10000){str+=String.fromCharCode(u0);}else{var ch=u0-0x10000;str+=String.fromCharCode(0xD800|(ch>>10),0xDC00|(ch&0x3FF));}}
|
|
264
|
-
return str;};var UTF8ToString=(ptr,maxBytesToRead)=>{assert(typeof ptr=='number',`UTF8ToString expects a number (got ${typeof ptr})`);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 exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=(ptr)=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--;}
|
|
265
|
-
info.set_rethrown(false);exceptionCaught.push(info);___cxa_increment_exception_refcount(ptr);return ___cxa_get_exception_ptr(ptr);};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);assert(exceptionCaught.length>0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0;};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;}
|
|
266
|
-
set_type(type){HEAPU32[(((this.ptr)+(4))>>2)]=type;}
|
|
267
|
-
get_type(){return HEAPU32[(((this.ptr)+(4))>>2)];}
|
|
268
|
-
set_destructor(destructor){HEAPU32[(((this.ptr)+(8))>>2)]=destructor;}
|
|
269
|
-
get_destructor(){return HEAPU32[(((this.ptr)+(8))>>2)];}
|
|
270
|
-
set_caught(caught){caught=caught?1:0;HEAP8[(this.ptr)+(12)]=caught;}
|
|
271
|
-
get_caught(){return HEAP8[(this.ptr)+(12)]!=0;}
|
|
272
|
-
set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[(this.ptr)+(13)]=rethrown;}
|
|
273
|
-
get_rethrown(){return HEAP8[(this.ptr)+(13)]!=0;}
|
|
274
|
-
init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);}
|
|
275
|
-
set_adjusted_ptr(adjustedPtr){HEAPU32[(((this.ptr)+(16))>>2)]=adjustedPtr;}
|
|
276
|
-
get_adjusted_ptr(){return HEAPU32[(((this.ptr)+(16))>>2)];}}
|
|
277
|
-
var ___resumeException=(ptr)=>{if(!exceptionLast){exceptionLast=new CppException(ptr);}
|
|
278
|
-
throw exceptionLast;};var setTempRet0=(val)=>__emscripten_tempret_set(val);var findMatchingCatch=(args)=>{var thrown=exceptionLast?.excPtr;if(!thrown){setTempRet0(0);return 0;}
|
|
279
|
-
var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown;}
|
|
280
|
-
for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break;}
|
|
281
|
-
var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown;}}
|
|
282
|
-
setTempRet0(thrownType);return thrown;};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=(arg0)=>findMatchingCatch([arg0]);var ___cxa_rethrow=()=>{var info=exceptionCaught.pop();if(!info){abort('no exception to throw');}
|
|
283
|
-
var ptr=info.excPtr;if(!info.get_rethrown()){exceptionCaught.push(info);info.set_rethrown(true);info.set_caught(false);uncaughtExceptionCount++;}
|
|
284
|
-
exceptionLast=new CppException(ptr);throw exceptionLast;};var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=new CppException(ptr);uncaughtExceptionCount++;throw exceptionLast;};var ___cxa_uncaught_exceptions=()=>uncaughtExceptionCount;var syscallGetVarargI=()=>{assert(SYSCALLS.varargs!=undefined);var ret=HEAP32[((+SYSCALLS.varargs)>>2)];SYSCALLS.varargs+=4;return ret;};var syscallGetVarargP=syscallGetVarargI;var PATH={isAbs:(path)=>path.charAt(0)==='/',splitPath:(filename)=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1);},normalizeArray:(parts,allowAboveRoot)=>{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--;}}
|
|
285
|
-
if(allowAboveRoot){for(;up;up--){parts.unshift('..');}}
|
|
286
|
-
return parts;},normalize:(path)=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==='/';path=PATH.normalizeArray(path.split('/').filter((p)=>!!p),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}
|
|
287
|
-
if(path&&trailingSlash){path+='/';}
|
|
288
|
-
return(isAbsolute?'/':'')+path;},dirname:(path)=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return'.';}
|
|
289
|
-
if(dir){dir=dir.substr(0,dir.length-1);}
|
|
290
|
-
return root+dir;},basename:(path)=>{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 initRandomFill=()=>{if(typeof crypto=='object'&&typeof crypto['getRandomValues']=='function'){return(view)=>crypto.getRandomValues(view);}else
|
|
291
|
-
if(ENVIRONMENT_IS_NODE){try{var crypto_module=require('crypto');var randomFillSync=crypto_module['randomFillSync'];if(randomFillSync){return(view)=>crypto_module['randomFillSync'](view);}
|
|
292
|
-
var randomBytes=crypto_module['randomBytes'];return(view)=>(view.set(randomBytes(view.byteLength)),view);}catch(e){}}
|
|
293
|
-
abort('no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };');};var randomFill=(view)=>{return(randomFill=initRandomFill())(view);};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();if(typeof path!='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){return'';}
|
|
294
|
-
resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=PATH.isAbs(path);}
|
|
295
|
-
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;}
|
|
296
|
-
var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=='')break;}
|
|
297
|
-
if(start>end)return[];return arr.slice(start,end-start+1);}
|
|
298
|
-
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;}}
|
|
299
|
-
var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push('..');}
|
|
300
|
-
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){var c=str.charCodeAt(i);if(c<=0x7F){len++;}else if(c<=0x7FF){len+=2;}else if(c>=0xD800&&c<=0xDFFF){len+=4;++i;}else{len+=3;}}
|
|
301
|
-
return len;};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{assert(typeof str==='string',`stringToUTF8Array expects a string (got ${typeof str})`);if(!(maxBytesToWrite>0))
|
|
302
|
-
return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=0xD800&&u<=0xDFFF){var u1=str.charCodeAt(++i);u=0x10000+((u&0x3FF)<<10)|(u1&0x3FF);}
|
|
303
|
-
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;if(u>0x10FFFF)warnOnce('Invalid Unicode code point '+ptrToString(u)+' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');heap[outIdx++]=0xF0|(u>>18);heap[outIdx++]=0x80|((u>>12)&63);heap[outIdx++]=0x80|((u>>6)&63);heap[outIdx++]=0x80|(u&63);}}
|
|
304
|
-
heap[outIdx]=0;return outIdx-startIdx;};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;}
|
|
305
|
-
var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE);}catch(e){if(e.toString().includes('EOF'))bytesRead=0;else throw e;}
|
|
306
|
-
if(bytesRead>0){result=buf.slice(0,bytesRead).toString('utf-8');}}else
|
|
307
|
-
if(typeof window!='undefined'&&typeof window.prompt=='function'){result=window.prompt('Input: ');if(result!==null){result+='\n';}}else
|
|
308
|
-
{}
|
|
309
|
-
if(!result){return null;}
|
|
310
|
-
FS_stdin_getChar_buffer=intArrayFromString(result,true);}
|
|
311
|
-
return FS_stdin_getChar_buffer.shift();};var TTY={ttys:[],init(){},shutdown(){},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);}
|
|
312
|
-
stream.tty=tty;stream.seekable=false;},close(stream){stream.tty.ops.fsync(stream.tty);},fsync(stream){stream.tty.ops.fsync(stream.tty);},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60);}
|
|
313
|
-
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);}
|
|
314
|
-
if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6);}
|
|
315
|
-
if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result;}
|
|
316
|
-
if(bytesRead){stream.node.atime=Date.now();}
|
|
317
|
-
return bytesRead;},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60);}
|
|
318
|
-
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);}
|
|
319
|
-
if(length){stream.node.mtime=stream.node.ctime=Date.now();}
|
|
320
|
-
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));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output));tty.output=[];}},ioctl_tcgets(tty){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){return 0;},ioctl_tiocgwinsz(tty){return[24,80];},},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output));tty.output=[];}},},};var zeroMemory=(address,size)=>{HEAPU8.fill(0,address,address+size);};var alignMemory=(size,alignment)=>{assert(alignment,"alignment argument is required");return Math.ceil(size/alignment)*alignment;};var mmapAlloc=(size)=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr;};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,'/',16895,0);},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63);}
|
|
321
|
-
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;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;}
|
|
322
|
-
node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime;}
|
|
323
|
-
return node;},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents);},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;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);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));}
|
|
324
|
-
node.usedBytes=newSize;}},node_ops:{getattr(node){var attr={};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;}
|
|
325
|
-
attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr;},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]){node[key]=attr[key];}}
|
|
326
|
-
if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size);}},lookup(parent,name){throw new FS.ErrnoError(44);},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev);},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}
|
|
327
|
-
if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55);}}
|
|
328
|
-
FS.hashRemoveNode(new_node);}
|
|
329
|
-
delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now();},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55);}
|
|
330
|
-
delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},readdir(node){return['.','..',...Object.keys(node.contents)];},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,0o777|40960,0);node.link=oldpath;return node;},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28);}
|
|
331
|
-
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);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset);}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i];}
|
|
332
|
-
return size;},write(stream,buffer,offset,length,position,canOwn){assert(!(buffer instanceof ArrayBuffer));if(buffer.buffer===HEAP8.buffer){canOwn=false;}
|
|
333
|
-
if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){assert(position===0,'canOwn must imply no weird position inside the file');node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length;}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length;}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length;}}
|
|
334
|
-
MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position);}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i];}}
|
|
335
|
-
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;}}
|
|
336
|
-
if(position<0){throw new FS.ErrnoError(28);}
|
|
337
|
-
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);}
|
|
338
|
-
var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset;}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48);}
|
|
339
|
-
if(contents){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);}}
|
|
340
|
-
HEAP8.set(contents,ptr);}}
|
|
341
|
-
return{ptr,allocated};},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0;},},};var asyncLoad=async(url)=>{var arrayBuffer=await readAsync(url);assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);return new Uint8Array(arrayBuffer);};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)=>{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)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn);}
|
|
342
|
-
onload?.();removeRunDependency(dep);}
|
|
343
|
-
if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep);})){return;}
|
|
344
|
-
finish(byteArray);}
|
|
345
|
-
addRunDependency(dep);if(typeof url=='string'){asyncLoad(url).then(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}`);}
|
|
346
|
-
return flags;};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode;};var strError=(errno)=>UTF8ToString(_strerror(errno));var ERRNO_CODES={'EPERM':63,'ENOENT':44,'ESRCH':71,'EINTR':27,'EIO':29,'ENXIO':60,'E2BIG':1,'ENOEXEC':45,'EBADF':8,'ECHILD':12,'EAGAIN':6,'EWOULDBLOCK':6,'ENOMEM':48,'EACCES':2,'EFAULT':21,'ENOTBLK':105,'EBUSY':10,'EEXIST':20,'EXDEV':75,'ENODEV':43,'ENOTDIR':54,'EISDIR':31,'EINVAL':28,'ENFILE':41,'EMFILE':33,'ENOTTY':59,'ETXTBSY':74,'EFBIG':22,'ENOSPC':51,'ESPIPE':70,'EROFS':69,'EMLINK':34,'EPIPE':64,'EDOM':18,'ERANGE':68,'ENOMSG':49,'EIDRM':24,'ECHRNG':106,'EL2NSYNC':156,'EL3HLT':107,'EL3RST':108,'ELNRNG':109,'EUNATCH':110,'ENOCSI':111,'EL2HLT':112,'EDEADLK':16,'ENOLCK':46,'EBADE':113,'EBADR':114,'EXFULL':115,'ENOANO':104,'EBADRQC':103,'EBADSLT':102,'EDEADLOCK':16,'EBFONT':101,'ENOSTR':100,'ENODATA':116,'ETIME':117,'ENOSR':118,'ENONET':119,'ENOPKG':120,'EREMOTE':121,'ENOLINK':47,'EADV':122,'ESRMNT':123,'ECOMM':124,'EPROTO':65,'EMULTIHOP':36,'EDOTDOT':125,'EBADMSG':9,'ENOTUNIQ':126,'EBADFD':127,'EREMCHG':128,'ELIBACC':129,'ELIBBAD':130,'ELIBSCN':131,'ELIBMAX':132,'ELIBEXEC':133,'ENOSYS':52,'ENOTEMPTY':55,'ENAMETOOLONG':37,'ELOOP':32,'EOPNOTSUPP':138,'EPFNOSUPPORT':139,'ECONNRESET':15,'ENOBUFS':42,'EAFNOSUPPORT':5,'EPROTOTYPE':67,'ENOTSOCK':57,'ENOPROTOOPT':50,'ESHUTDOWN':140,'ECONNREFUSED':14,'EADDRINUSE':3,'ECONNABORTED':13,'ENETUNREACH':40,'ENETDOWN':38,'ETIMEDOUT':73,'EHOSTDOWN':142,'EHOSTUNREACH':23,'EINPROGRESS':26,'EALREADY':7,'EDESTADDRREQ':17,'EMSGSIZE':35,'EPROTONOSUPPORT':66,'ESOCKTNOSUPPORT':137,'EADDRNOTAVAIL':4,'ENETRESET':39,'EISCONN':30,'ENOTCONN':53,'ETOOMANYREFS':141,'EUSERS':136,'EDQUOT':19,'ESTALE':72,'ENOTSUP':138,'ENOMEDIUM':148,'EILSEQ':25,'EOVERFLOW':61,'ECANCELED':11,'ENOTRECOVERABLE':56,'EOWNERDEAD':62,'ESTRPIPE':135,};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class extends Error{name='ErrnoError';constructor(errno){super(runtimeInitialized?strError(errno):'');this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break;}}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node;}
|
|
347
|
-
set object(val){this.node=val;}
|
|
348
|
-
get isRead(){return(this.flags&2097155)!==1;}
|
|
349
|
-
get isWrite(){return(this.flags&2097155)!==0;}
|
|
350
|
-
get isAppend(){return(this.flags&1024);}
|
|
351
|
-
get flags(){return this.shared.flags;}
|
|
352
|
-
set flags(val){this.shared.flags=val;}
|
|
353
|
-
get position(){return this.shared.position;}
|
|
354
|
-
set position(val){this.shared.position=val;}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this;}
|
|
355
|
-
this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now();}
|
|
356
|
-
get read(){return(this.mode&this.readMode)===this.readMode;}
|
|
357
|
-
set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode;}
|
|
358
|
-
get write(){return(this.mode&this.writeMode)===this.writeMode;}
|
|
359
|
-
set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode;}
|
|
360
|
-
get isFolder(){return FS.isDir(this.mode);}
|
|
361
|
-
get isDevice(){return FS.isChrdev(this.mode);}},lookupPath(path,opts={}){if(!path)return{path:'',node:null};opts.follow_mount??=true
|
|
362
|
-
if(!PATH.isAbs(path)){path=FS.cwd()+'/'+path;}
|
|
363
|
-
linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split('/').filter((p)=>!!p&&(p!=='.'));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){break;}
|
|
364
|
-
if(parts[i]==='..'){current_path=PATH.dirname(current_path);current=current.parent;continue;}
|
|
365
|
-
current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i]);}catch(e){if((e?.errno===44)&&islast&&opts.noent_okay){return{path:current_path};}
|
|
366
|
-
throw e;}
|
|
367
|
-
if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root;}
|
|
368
|
-
if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52);}
|
|
369
|
-
var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+'/'+link;}
|
|
370
|
-
path=link+'/'+parts.slice(i+1).join('/');continue linkloop;}}
|
|
371
|
-
return{path:current_path,node:current};}
|
|
372
|
-
throw new FS.ErrnoError(32);},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;}
|
|
373
|
-
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;}
|
|
374
|
-
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;}
|
|
375
|
-
current=current.name_next;}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
376
|
-
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;}}
|
|
377
|
-
return FS.lookup(parent,name);},createNode(parent,name,mode,rdev){assert(typeof parent=='object')
|
|
378
|
-
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';}
|
|
379
|
-
return perms;},nodePermissions(node,perms){if(FS.ignorePermissions){return 0;}
|
|
380
|
-
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;}
|
|
381
|
-
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){if(!FS.isDir(dir.mode)){return 54;}
|
|
382
|
-
try{var node=FS.lookupNode(dir,name);return 20;}catch(e){}
|
|
383
|
-
return FS.nodePermissions(dir,'wx');},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name);}catch(e){return e.errno;}
|
|
384
|
-
var errCode=FS.nodePermissions(dir,'wx');if(errCode){return errCode;}
|
|
385
|
-
if(isdir){if(!FS.isDir(node.mode)){return 54;}
|
|
386
|
-
if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10;}}else{if(FS.isDir(node.mode)){return 31;}}
|
|
387
|
-
return 0;},mayOpen(node,flags){if(!node){return 44;}
|
|
388
|
-
if(FS.isLink(node.mode)){return 32;}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=='r'||(flags&512)){return 31;}}
|
|
389
|
-
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;}}
|
|
390
|
-
throw new FS.ErrnoError(33);},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8);}
|
|
391
|
-
return stream;},getStream:(fd)=>FS.streams[fd],createStream(stream,fd=-1){assert(fd>=-1);stream=Object.assign(new FS.FSStream(),stream);if(fd==-1){fd=FS.nextfd();}
|
|
392
|
-
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);stream.stream_ops=device.stream_ops;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);}
|
|
393
|
-
return mounts;},syncfs(populate,callback){if(typeof populate=='function'){callback=populate;populate=false;}
|
|
394
|
-
FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);}
|
|
395
|
-
var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(errCode);}
|
|
396
|
-
function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode);}
|
|
397
|
-
return;}
|
|
398
|
-
if(++completed>=mounts.length){doCallback(null);}};mounts.forEach((mount)=>{if(!mount.type.syncfs){return done(null);}
|
|
399
|
-
mount.type.syncfs(mount,populate,done);});},mount(type,opts,mountpoint){if(typeof type=='string'){throw type;}
|
|
400
|
-
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;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}
|
|
401
|
-
if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}}
|
|
402
|
-
var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot;}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount);}}
|
|
403
|
-
return mountRoot;},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28);}
|
|
404
|
-
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);}
|
|
405
|
-
current=next;}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);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);}
|
|
406
|
-
var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
407
|
-
if(!parent.node_ops.mknod){throw new FS.ErrnoError(63);}
|
|
408
|
-
return parent.node_ops.mknod(parent,name,mode,dev);},statfs(path){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255,};var parent=FS.lookupPath(path,{follow:true}).node;if(parent?.node_ops.statfs){Object.assign(rtn,parent.node_ops.statfs(parent.mount.opts.root));}
|
|
409
|
-
return rtn;},create(path,mode=0o666){mode&=4095;mode|=32768;return FS.mknod(path,mode,0);},mkdir(path,mode=0o777){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=0o666;}
|
|
410
|
-
mode|=8192;return FS.mknod(path,mode,dev);},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44);}
|
|
411
|
-
var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}
|
|
412
|
-
var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
413
|
-
if(!parent.node_ops.symlink){throw new FS.ErrnoError(63);}
|
|
414
|
-
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);var lookup,old_dir,new_dir;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);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75);}
|
|
415
|
-
var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=='.'){throw new FS.ErrnoError(28);}
|
|
416
|
-
relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=='.'){throw new FS.ErrnoError(55);}
|
|
417
|
-
var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}
|
|
418
|
-
if(old_node===new_node){return;}
|
|
419
|
-
var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
420
|
-
errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
421
|
-
if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63);}
|
|
422
|
-
if(FS.isMountpoint(old_node)||(new_node&&FS.isMountpoint(new_node))){throw new FS.ErrnoError(10);}
|
|
423
|
-
if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,'w');if(errCode){throw new FS.ErrnoError(errCode);}}
|
|
424
|
-
FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir;}catch(e){throw e;}finally{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);}
|
|
425
|
-
if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63);}
|
|
426
|
-
if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}
|
|
427
|
-
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);}
|
|
428
|
-
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);}
|
|
429
|
-
var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode);}
|
|
430
|
-
if(!parent.node_ops.unlink){throw new FS.ErrnoError(63);}
|
|
431
|
-
if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}
|
|
432
|
-
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);}
|
|
433
|
-
if(!link.node_ops.readlink){throw new FS.ErrnoError(28);}
|
|
434
|
-
return 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);}
|
|
435
|
-
if(!node.node_ops.getattr){throw new FS.ErrnoError(63);}
|
|
436
|
-
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;}
|
|
437
|
-
if(!node.node_ops.setattr){throw new FS.ErrnoError(63);}
|
|
438
|
-
node.node_ops.setattr(node,{mode:(mode&4095)|(node.mode&~4095),ctime: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;}
|
|
439
|
-
if(!node.node_ops.setattr){throw new FS.ErrnoError(63);}
|
|
440
|
-
node.node_ops.setattr(node,{timestamp:Date.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);}
|
|
441
|
-
var node;if(typeof path=='string'){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;}else{node=path;}
|
|
442
|
-
if(!node.node_ops.setattr){throw new FS.ErrnoError(63);}
|
|
443
|
-
if(FS.isDir(node.mode)){throw new FS.ErrnoError(31);}
|
|
444
|
-
if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28);}
|
|
445
|
-
var errCode=FS.nodePermissions(node,'w');if(errCode){throw new FS.ErrnoError(errCode);}
|
|
446
|
-
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);}
|
|
447
|
-
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,{atime:atime,mtime:mtime});},open(path,flags,mode=0o666){if(path===""){throw new FS.ErrnoError(44);}
|
|
448
|
-
flags=typeof flags=='string'?FS_modeStringToFlags(flags):flags;if((flags&64)){mode=(mode&4095)|32768;}else{mode=0;}
|
|
449
|
-
var node;if(typeof path=='object'){node=path;}else{var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path;}
|
|
450
|
-
var created=false;if((flags&64)){if(node){if((flags&128)){throw new FS.ErrnoError(20);}}else{node=FS.mknod(path,mode,0);created=true;}}
|
|
451
|
-
if(!node){throw new FS.ErrnoError(44);}
|
|
452
|
-
if(FS.isChrdev(node.mode)){flags&=~512;}
|
|
453
|
-
if((flags&65536)&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}
|
|
454
|
-
if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode);}}
|
|
455
|
-
if((flags&512)&&!created){FS.truncate(node,0);}
|
|
456
|
-
flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream);}
|
|
457
|
-
if(Module['logReadFiles']&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1;}}
|
|
458
|
-
return stream;},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}
|
|
459
|
-
if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream);}}catch(e){throw e;}finally{FS.closeStream(stream.fd);}
|
|
460
|
-
stream.fd=null;},isClosed(stream){return stream.fd===null;},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}
|
|
461
|
-
if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70);}
|
|
462
|
-
if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28);}
|
|
463
|
-
stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position;},read(stream,buffer,offset,length,position){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28);}
|
|
464
|
-
if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}
|
|
465
|
-
if((stream.flags&2097155)===1){throw new FS.ErrnoError(8);}
|
|
466
|
-
if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}
|
|
467
|
-
if(!stream.stream_ops.read){throw new FS.ErrnoError(28);}
|
|
468
|
-
var seeking=typeof position!='undefined';if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}
|
|
469
|
-
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){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28);}
|
|
470
|
-
if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}
|
|
471
|
-
if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}
|
|
472
|
-
if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}
|
|
473
|
-
if(!stream.stream_ops.write){throw new FS.ErrnoError(28);}
|
|
474
|
-
if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2);}
|
|
475
|
-
var seeking=typeof position!='undefined';if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}
|
|
476
|
-
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);}
|
|
477
|
-
if(offset<0||length<=0){throw new FS.ErrnoError(28);}
|
|
478
|
-
if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}
|
|
479
|
-
if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43);}
|
|
480
|
-
if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138);}
|
|
481
|
-
stream.stream_ops.allocate(stream,offset,length);},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2);}
|
|
482
|
-
if((stream.flags&2097155)===1){throw new FS.ErrnoError(2);}
|
|
483
|
-
if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43);}
|
|
484
|
-
if(!length){throw new FS.ErrnoError(28);}
|
|
485
|
-
return stream.stream_ops.mmap(stream,length,position,prot,flags);},msync(stream,buffer,offset,length,mmapFlags){assert(offset>=0);if(!stream.stream_ops.msync){return 0;}
|
|
486
|
-
return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags);},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59);}
|
|
487
|
-
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}"`);}
|
|
488
|
-
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);}else if(opts.encoding==='binary'){ret=buf;}
|
|
489
|
-
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');}
|
|
490
|
-
FS.close(stream);},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44);}
|
|
491
|
-
if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54);}
|
|
492
|
-
var errCode=FS.nodePermissions(lookup.node,'x');if(errCode){throw new FS.ErrnoError(errCode);}
|
|
493
|
-
FS.currentPath=lookup.path;},createDefaultDirectories(){FS.mkdir('/tmp');FS.mkdir('/home');FS.mkdir('/home/web_user');},createDefaultDevices(){FS.mkdir('/dev');FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0,});FS.mkdev('/dev/null',FS.makedev(1,3));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));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength;}
|
|
494
|
-
return randomBuffer[--randomLeft];};FS.createDevice('/dev','random',randomByte);FS.createDevice('/dev','urandom',randomByte);FS.mkdir('/dev/shm');FS.mkdir('/dev/shm/tmp');},createSpecialDirectories(){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',16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek,};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},id:fd+1,};ret.parent=ret;return ret;},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString());}};return node;}},{},'/proc/self/fd');},createStandardStreams(input,output,error){if(input){FS.createDevice('/dev','stdin',input);}else{FS.symlink('/dev/tty','/dev/stdin');}
|
|
495
|
-
if(output){FS.createDevice('/dev','stdout',null,output);}else{FS.symlink('/dev/tty','/dev/stdout');}
|
|
496
|
-
if(error){FS.createDevice('/dev','stderr',null,error);}else{FS.symlink('/dev/tty1','/dev/stderr');}
|
|
497
|
-
var stdin=FS.open('/dev/stdin',0);var stdout=FS.open('/dev/stdout',1);var stderr=FS.open('/dev/stderr',1);assert(stdin.fd===0,`invalid handle for stdin (${stdin.fd})`);assert(stdout.fd===1,`invalid handle for stdout (${stdout.fd})`);assert(stderr.fd===2,`invalid handle for stderr (${stderr.fd})`);},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},'/');FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={'MEMFS':MEMFS,};},init(input,output,error){assert(!FS.initialized,'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)');FS.initialized=true;input??=Module['stdin'];output??=Module['stdout'];error??=Module['stderr'];FS.createStandardStreams(input,output,error);},quit(){FS.initialized=false;_fflush(0);for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue;}
|
|
498
|
-
FS.close(stream);}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null;}
|
|
499
|
-
return ret.object;},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path;}catch(e){}
|
|
500
|
-
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){}
|
|
501
|
-
parent=current;}
|
|
502
|
-
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;}
|
|
503
|
-
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;}
|
|
504
|
-
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);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false;},close(stream){if(output?.buffer?.length){output(10);}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input();}catch(e){throw new FS.ErrnoError(29);}
|
|
505
|
-
if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6);}
|
|
506
|
-
if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result;}
|
|
507
|
-
if(bytesRead){stream.node.atime=Date.now();}
|
|
508
|
-
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);}}
|
|
509
|
-
if(length){stream.node.mtime=stream.node.ctime=Date.now();}
|
|
510
|
-
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{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length;}catch(e){throw new FS.ErrnoError(29);}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined;}
|
|
511
|
-
var chunkOffset=idx%this.chunkSize;var chunkNum=(idx/this.chunkSize)|0;return this.getter(chunkNum)[chunkOffset];}
|
|
512
|
-
setDataGetter(getter){this.getter=getter;}
|
|
513
|
-
cacheLength(){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;if(!hasByteServing)chunkSize=datalength;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!");var xhr=new XMLHttpRequest();xhr.open('GET',url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType='arraybuffer';if(xhr.overrideMimeType){xhr.overrideMimeType('text/plain; charset=x-user-defined');}
|
|
514
|
-
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((xhr.response||[]));}
|
|
515
|
-
return intArrayFromString(xhr.responseText||'',true);};var lazyArray=this;lazyArray.setDataGetter((chunkNum)=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=='undefined'){lazyArray.chunks[chunkNum]=doXHR(start,end);}
|
|
516
|
-
if(typeof lazyArray.chunks[chunkNum]=='undefined')throw new Error('doXHR failed!');return lazyArray.chunks[chunkNum];});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed");}
|
|
517
|
-
this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true;}
|
|
518
|
-
get length(){if(!this.lengthKnown){this.cacheLength();}
|
|
519
|
-
return this._length;}
|
|
520
|
-
get chunkSize(){if(!this.lengthKnown){this.cacheLength();}
|
|
521
|
-
return this._chunkSize;}}
|
|
522
|
-
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};}
|
|
523
|
-
var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents;}else if(properties.url){node.contents=null;node.url=properties.url;}
|
|
524
|
-
Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length;}}});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)
|
|
525
|
-
return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i);}}
|
|
526
|
-
return size;}
|
|
527
|
-
stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48);}
|
|
528
|
-
writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true};};node.stream_ops=stream_ops;return node;},absolutePath(){abort('FS.absolutePath has been removed; use PATH_FS.resolve instead');},createFolder(){abort('FS.createFolder has been removed; use FS.mkdir instead');},createLink(){abort('FS.createLink has been removed; use FS.symlink instead');},joinPath(){abort('FS.joinPath has been removed; use PATH.join instead');},mmapAlloc(){abort('FS.mmapAlloc has been replaced by the top level function mmapAlloc');},standardizePath(){abort('FS.standardizePath has been removed; use PATH.normalize instead');},};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path;}
|
|
529
|
-
var dir;if(dirfd===-100){dir=FS.cwd();}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path;}
|
|
530
|
-
if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44);;}
|
|
531
|
-
return dir;}
|
|
532
|
-
return 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;(tempI64=[stat.size>>>0,(tempDouble=stat.size,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((buf)+(24))>>2)]=tempI64[0],HEAP32[(((buf)+(28))>>2)]=tempI64[1]);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();(tempI64=[Math.floor(atime/1000)>>>0,(tempDouble=Math.floor(atime/1000),(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((buf)+(40))>>2)]=tempI64[0],HEAP32[(((buf)+(44))>>2)]=tempI64[1]);HEAPU32[(((buf)+(48))>>2)]=(atime%1000)*1000*1000;(tempI64=[Math.floor(mtime/1000)>>>0,(tempDouble=Math.floor(mtime/1000),(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((buf)+(56))>>2)]=tempI64[0],HEAP32[(((buf)+(60))>>2)]=tempI64[1]);HEAPU32[(((buf)+(64))>>2)]=(mtime%1000)*1000*1000;(tempI64=[Math.floor(ctime/1000)>>>0,(tempDouble=Math.floor(ctime/1000),(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((buf)+(72))>>2)]=tempI64[0],HEAP32[(((buf)+(76))>>2)]=tempI64[1]);HEAPU32[(((buf)+(80))>>2)]=(ctime%1000)*1000*1000;(tempI64=[stat.ino>>>0,(tempDouble=stat.ino,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((buf)+(88))>>2)]=tempI64[0],HEAP32[(((buf)+(92))>>2)]=tempI64[1]);return 0;},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}
|
|
533
|
-
if(flags&2){return 0;}
|
|
534
|
-
var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags);},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream;},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret;},};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28;}
|
|
535
|
-
while(FS.streams[arg]){arg++;}
|
|
536
|
-
var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd;}
|
|
537
|
-
case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0;}
|
|
538
|
-
case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[(((arg)+(offset))>>1)]=2;return 0;}
|
|
539
|
-
case 13:case 14:return 0;}
|
|
540
|
-
return-28;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
541
|
-
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;}}
|
|
542
|
-
var stringToUTF8=(str,outPtr,maxBytesToWrite)=>{assert(typeof maxBytesToWrite=='number','stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');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;}}
|
|
543
|
-
function ___syscall_getdents64(fd,dirp,count){try{var stream=SYSCALLS.getStreamFromFD(fd)
|
|
544
|
-
stream.getdents||=FS.readdir(stream.path);var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size))
|
|
545
|
-
for(var idx=startIdx;idx<endIdx;idx++){var id;var type;var name=stream.getdents[idx];if(name==='.'){id=stream.node.id;type=4;}
|
|
546
|
-
else if(name==='..'){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4;}
|
|
547
|
-
else{var child;try{child=FS.lookupNode(stream.node,name);}catch(e){if(e?.errno===28){continue;}
|
|
548
|
-
throw e;}
|
|
549
|
-
id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8;}
|
|
550
|
-
assert(id);(tempI64=[id>>>0,(tempDouble=id,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[((dirp+pos)>>2)]=tempI64[0],HEAP32[(((dirp+pos)+(4))>>2)]=tempI64[1]);(tempI64=[(idx+1)*struct_size>>>0,(tempDouble=(idx+1)*struct_size,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[(((dirp+pos)+(8))>>2)]=tempI64[0],HEAP32[(((dirp+pos)+(12))>>2)]=tempI64[1]);HEAP16[(((dirp+pos)+(16))>>1)]=280;HEAP8[(dirp+pos)+(18)]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size;}
|
|
551
|
-
FS.llseek(stream,idx*struct_size,0);return pos;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
552
|
-
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;}
|
|
553
|
-
case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();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;}
|
|
554
|
-
return 0;}
|
|
555
|
-
return 0;}
|
|
556
|
-
case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0;}
|
|
557
|
-
case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();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=[]
|
|
558
|
-
for(var i=0;i<32;i++){c_cc.push(HEAP8[(argp+i)+(17)]);}
|
|
559
|
-
return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc});}
|
|
560
|
-
return 0;}
|
|
561
|
-
case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[((argp)>>2)]=0;return 0;}
|
|
562
|
-
case 21520:{if(!stream.tty)return-59;return-28;}
|
|
563
|
-
case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp);}
|
|
564
|
-
case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[((argp)>>1)]=winsize[0];HEAP16[(((argp)+(2))>>1)]=winsize[1];}
|
|
565
|
-
return 0;}
|
|
566
|
-
case 21524:{if(!stream.tty)return-59;return 0;}
|
|
567
|
-
case 21515:{if(!stream.tty)return-59;return 0;}
|
|
568
|
-
default:return-28;}}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
569
|
-
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;}}
|
|
570
|
-
function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
571
|
-
function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&(~6400);assert(!flags,`unknown flags in __syscall_newfstatat: ${flags}`);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;}}
|
|
572
|
-
function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
573
|
-
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);HEAP8[buf+len]=endChar;return len;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
574
|
-
function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
575
|
-
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;}}
|
|
576
|
-
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');}
|
|
577
|
-
return 0;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return-e.errno;}}
|
|
578
|
-
var __abort_js=()=>abort('native code called abort()');var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i);}
|
|
579
|
-
embind_charCodes=codes;};var embind_charCodes;var readLatin1String=(ptr)=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]];}
|
|
580
|
-
return ret;};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=(message)=>{throw new BindingError(message);};var InternalError;var throwInternalError=(message)=>{throw new InternalError(message);};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach((type)=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError('Mismatched type converter count');}
|
|
581
|
-
for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i]);}}
|
|
582
|
-
var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt];}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[];}
|
|
583
|
-
awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters);}});}});if(0===unregisteredTypes.length){onComplete(typeConverters);}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`);}
|
|
584
|
-
if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return;}else{throwBindingError(`Cannot register type '${name}' twice`);}}
|
|
585
|
-
registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach((cb)=>cb());}}
|
|
586
|
-
function registerType(rawType,registeredInstance,options={}){if(registeredInstance.argPackAdvance===undefined){throw new TypeError('registerType registeredInstance requires argPackAdvance');}
|
|
587
|
-
return sharedRegisterType(rawType,registeredInstance,options);}
|
|
588
|
-
var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,'fromWireType':function(wt){return!!wt;},'toWireType':function(destructors,o){return o?trueValue:falseValue;},argPackAdvance:GenericWireTypeSize,'readValueFromPointer':function(pointer){return this['fromWireType'](HEAPU8[pointer]);},destructorFunction:null,});};var emval_freelist=[];var emval_handles=[];var __emval_decref=(handle)=>{if(handle>9&&0===--emval_handles[handle+1]){assert(emval_handles[handle]!==undefined,`Decref for unallocated handle.`);emval_handles[handle]=undefined;emval_freelist.push(handle);}};var count_emval_handles=()=>{return emval_handles.length/2-5-emval_freelist.length;};var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1,);assert(emval_handles.length===5*2);Module['count_emval_handles']=count_emval_handles;};var Emval={toValue:(handle)=>{if(!handle){throwBindingError('Cannot use deleted val. handle = '+handle);}
|
|
589
|
-
assert(handle===2||emval_handles[handle]!==undefined&&handle%2===0,`invalid handle: ${handle}`);return emval_handles[handle];},toHandle:(value)=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle;}}},};function readPointer(pointer){return this['fromWireType'](HEAPU32[((pointer)>>2)]);}
|
|
590
|
-
var EmValType={name:'emscripten::val','fromWireType':(handle)=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv;},'toWireType':(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,'readValueFromPointer':readPointer,destructorFunction:null,};var __embind_register_emval=(rawType)=>registerType(rawType,EmValType);var embindRepr=(v)=>{if(v===null){return'null';}
|
|
591
|
-
var t=typeof v;if(t==='object'||t==='array'||t==='function'){return v.toString();}else{return''+v;}};var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this['fromWireType'](HEAPF32[((pointer)>>2)]);};case 8:return function(pointer){return this['fromWireType'](HEAPF64[((pointer)>>3)]);};default:throw new TypeError(`invalid float width (${width}): ${name}`);}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,'fromWireType':(value)=>value,'toWireType':(destructors,value)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`);}
|
|
592
|
-
return value;},argPackAdvance:GenericWireTypeSize,'readValueFromPointer':floatReadValueFromPointer(name,size),destructorFunction:null,});};var createNamedFunction=(name,body)=>Object.defineProperty(body,'name',{value:name});var runDestructors=(destructors)=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr);}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true;}}
|
|
593
|
-
return false;}
|
|
594
|
-
function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`);}
|
|
595
|
-
var dummy=createNamedFunction(constructor.name||'unknownFunctionName',function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return(r instanceof Object)?r:obj;}
|
|
596
|
-
function checkArgCount(numArgs,minArgs,maxArgs,humanName,throwBindingError){if(numArgs<minArgs||numArgs>maxArgs){var argCountMessage=minArgs==maxArgs?minArgs:`${minArgs} to ${maxArgs}`;throwBindingError(`function ${humanName} called with ${numArgs} arguments, expected ${argCountMessage}`);}}
|
|
597
|
-
function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=['fn'];if(isClassMethodFunc){argsListWired.push('thisWired');}
|
|
598
|
-
for(var i=0;i<argCount;++i){argsList.push(`arg${i}`)
|
|
599
|
-
argsListWired.push(`arg${i}Wired`)}
|
|
600
|
-
argsList=argsList.join(',')
|
|
601
|
-
argsListWired=argsListWired.join(',')
|
|
602
|
-
var invokerFnBody=`return function (${argsList}) {\n`;invokerFnBody+="checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);\n";if(needsDestructorStack){invokerFnBody+="var destructors = [];\n";}
|
|
603
|
-
var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = classParam['toWireType'](${dtorStack}, this);\n`;}
|
|
604
|
-
for(var i=0;i<argCount;++i){invokerFnBody+=`var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});\n`;args1.push(`argType${i}`);}
|
|
605
|
-
invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;var returnVal=returns?"rv":"";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n";}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=(i===1?"thisWired":("arg"+(i-2)+"Wired"));if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`);}}}
|
|
606
|
-
if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\n"+"return ret;\n";}else{}
|
|
607
|
-
invokerFnBody+="}\n";args1.push('checkArgCount','minArgs','maxArgs');invokerFnBody=`if (arguments.length !== ${args1.length}){ throw new Error(humanName + "Expected ${args1.length} closure arguments " + arguments.length + " given."); }\n${invokerFnBody}`;return[args1,invokerFnBody];}
|
|
608
|
-
function getRequiredArgCount(argTypes){var requiredArgCount=argTypes.length-2;for(var i=argTypes.length-1;i>=2;--i){if(!argTypes[i].optional){break;}
|
|
609
|
-
requiredArgCount--;}
|
|
610
|
-
return requiredArgCount;}
|
|
611
|
-
function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");}
|
|
612
|
-
assert(!isAsync,'Async bindings are only supported with JSPI.');var isClassMethodFunc=(argTypes[1]!==null&&classType!==null);var needsDestructorStack=usesDestructorStack(argTypes);var returns=(argTypes[0].name!=="void");var expectedArgCount=argCount-2;var minArgs=getRequiredArgCount(argTypes);var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2]);}
|
|
613
|
-
if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction);}}}
|
|
614
|
-
closureArgs.push(checkArgCount,minArgs,expectedArgCount);let[args,invokerFnBody]=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);args.push(invokerFnBody);var invokerFn=newFunc(Function,args)(...closureArgs);return createNamedFunction(humanName,invokerFn);}
|
|
615
|
-
var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`);}
|
|
616
|
-
return proto[methodName].overloadTable[args.length].apply(this,args);};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc;}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||(undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments])){throwBindingError(`Cannot register public name '${name}' twice`);}
|
|
617
|
-
ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`);}
|
|
618
|
-
Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[(((firstElement)+(i*4))>>2)]);}
|
|
619
|
-
return array;};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError('Replacing nonexistent public symbol');}
|
|
620
|
-
if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};var dynCallLegacy=(sig,ptr,args)=>{sig=sig.replace(/p/g,'i')
|
|
621
|
-
assert(('dynCall_'+sig)in Module,`bad function pointer type - dynCall function not found for sig '${sig}'`);if(args?.length){assert(args.length===sig.substring(1).replace(/j/g,'--').length);}else{assert(sig.length==1);}
|
|
622
|
-
var f=Module['dynCall_'+sig];return f(ptr,...args);};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);}
|
|
623
|
-
assert(wasmTable.get(funcPtr)==func,'JavaScript-side Wasm function table mirror is out of date!');return func;};var dynCall=(sig,ptr,args=[])=>{if(sig.includes('j')){return dynCallLegacy(sig,ptr,args);}
|
|
624
|
-
assert(getWasmTableEntry(ptr),`missing table entry in dynCall: ${ptr}`);var rtn=getWasmTableEntry(ptr)(...args);return rtn;};var getDynCaller=(sig,ptr)=>{assert(sig.includes('j')||sig.includes('p'),'getDynCaller should only be called with i64 sigs')
|
|
625
|
-
return(...args)=>dynCall(sig,ptr,args);};var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes('j')){return getDynCaller(signature,rawFunction);}
|
|
626
|
-
return getWasmTableEntry(rawFunction);}
|
|
627
|
-
var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`);}
|
|
628
|
-
return fp;};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=(new Error(message)).stack;if(stack!==undefined){this.stack=this.toString()+'\n'+
|
|
629
|
-
stack.replace(/^Error(:[^\n]*)?\n/,'');}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name;}else{return`${this.name}: ${this.message}`;}};return errorClass;};var UnboundTypeError;var getTypeName=(type)=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv;};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return;}
|
|
630
|
-
if(registeredTypes[type]){return;}
|
|
631
|
-
if(typeDependencies[type]){typeDependencies[type].forEach(visit);return;}
|
|
632
|
-
unboundTypes.push(type);seen[type]=true;}
|
|
633
|
-
types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([', ']));};var getFunctionName=(signature)=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){assert(signature[signature.length-1]==")","Parentheses for argument names should match.");return signature.substr(0,argsIndex);}else{return signature;}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes);},argCount-1);whenDependentTypesAreResolved([],argTypes,(argTypes)=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[];});};var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?(pointer)=>HEAP8[pointer]:(pointer)=>HEAPU8[pointer];case 2:return signed?(pointer)=>HEAP16[((pointer)>>1)]:(pointer)=>HEAPU16[((pointer)>>1)]
|
|
634
|
-
case 4:return signed?(pointer)=>HEAP32[((pointer)>>2)]:(pointer)=>HEAPU32[((pointer)>>2)]
|
|
635
|
-
default:throw new TypeError(`invalid integer width (${width}): ${name}`);}};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295;}
|
|
636
|
-
var fromWireType=(value)=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=(value)=>(value<<bitshift)>>>bitshift;}
|
|
637
|
-
var isUnsignedType=(name.includes('unsigned'));var checkAssertions=(value,toTypeName)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${toTypeName}`);}
|
|
638
|
-
if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`);}}
|
|
639
|
-
var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0;}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value;}}
|
|
640
|
-
registerType(primitiveType,{name,'fromWireType':fromWireType,'toWireType':toWireType,argPackAdvance:GenericWireTypeSize,'readValueFromPointer':integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null,});};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[((handle)>>2)];var data=HEAPU32[(((handle)+(4))>>2)];return new TA(HEAP8.buffer,data,size);}
|
|
641
|
-
name=readLatin1String(name);registerType(rawType,{name,'fromWireType':decodeMemoryView,argPackAdvance:GenericWireTypeSize,'readValueFromPointer':decodeMemoryView,},{ignoreDuplicateRegistrations:true,});};var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=true;registerType(rawType,{name,'fromWireType'(value){var length=HEAPU32[((value)>>2)];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}
|
|
642
|
-
decodeStartPtr=currentBytePtr+1;}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i]);}
|
|
643
|
-
str=a.join('');}
|
|
644
|
-
_free(value);return str;},'toWireType'(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value);}
|
|
645
|
-
var length;var valueIsOfTypeString=(typeof value=='string');if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError('Cannot pass non-string to std::string');}
|
|
646
|
-
if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value);}else{length=value.length;}
|
|
647
|
-
var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[((base)>>2)]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1);}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError('String has UTF-16 code units that do not fit in 8 bits');}
|
|
648
|
-
HEAPU8[ptr+i]=charCode;}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i];}}}
|
|
649
|
-
if(destructors!==null){destructors.push(_free,base);}
|
|
650
|
-
return base;},argPackAdvance:GenericWireTypeSize,'readValueFromPointer':readPointer,destructorFunction(ptr){_free(ptr);},});};var UTF16Decoder=typeof TextDecoder!='undefined'?new TextDecoder('utf-16le'):undefined;;var UTF16ToString=(ptr,maxBytesToRead)=>{assert(ptr%2==0,'Pointer passed to UTF16ToString must be aligned to two bytes!');var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)
|
|
651
|
-
return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str='';for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[(((ptr)+(i*2))>>1)];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit);}
|
|
652
|
-
return str;};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%2==0,'Pointer passed to stringToUTF16 must be aligned to two bytes!');assert(typeof maxBytesToWrite=='number','stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');maxBytesToWrite??=0x7FFFFFFF;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=(maxBytesToWrite<str.length*2)?(maxBytesToWrite/2):str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[((outPtr)>>1)]=codeUnit;outPtr+=2;}
|
|
653
|
-
HEAP16[((outPtr)>>1)]=0;return outPtr-startPtr;};var lengthBytesUTF16=(str)=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{assert(ptr%4==0,'Pointer passed to UTF32ToString must be aligned to four bytes!');var i=0;var str='';while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[(((ptr)+(i*4))>>2)];if(utf32==0)break;++i;if(utf32>=0x10000){var ch=utf32-0x10000;str+=String.fromCharCode(0xD800|(ch>>10),0xDC00|(ch&0x3FF));}else{str+=String.fromCharCode(utf32);}}
|
|
654
|
-
return str;};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%4==0,'Pointer passed to stringToUTF32 must be aligned to four bytes!');assert(typeof maxBytesToWrite=='number','stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');maxBytesToWrite??=0x7FFFFFFF;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=0xD800&&codeUnit<=0xDFFF){var trailSurrogate=str.charCodeAt(++i);codeUnit=0x10000+((codeUnit&0x3FF)<<10)|(trailSurrogate&0x3FF);}
|
|
655
|
-
HEAP32[((outPtr)>>2)]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break;}
|
|
656
|
-
HEAP32[((outPtr)>>2)]=0;return outPtr-startPtr;};var lengthBytesUTF32=(str)=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=0xD800&&codeUnit<=0xDFFF)++i;len+=4;}
|
|
657
|
-
return len;};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=(pointer)=>HEAPU16[((pointer)>>1)];}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=(pointer)=>HEAPU32[((pointer)>>2)];}
|
|
658
|
-
registerType(rawType,{name,'fromWireType':(value)=>{var length=HEAPU32[((value)>>2)];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}
|
|
659
|
-
decodeStartPtr=currentBytePtr+charSize;}}
|
|
660
|
-
_free(value);return str;},'toWireType':(destructors,value)=>{if(!(typeof value=='string')){throwBindingError(`Cannot pass non-string to C++ string type ${name}`);}
|
|
661
|
-
var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[((ptr)>>2)]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr);}
|
|
662
|
-
return ptr;},argPackAdvance:GenericWireTypeSize,'readValueFromPointer':readPointer,destructorFunction(ptr){_free(ptr);}});};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,'fromWireType':()=>undefined,'toWireType':(destructors,o)=>undefined,});};var __emscripten_fs_load_embedded_files=(ptr)=>{do{var name_addr=HEAPU32[((ptr)>>2)];ptr+=4;var len=HEAPU32[((ptr)>>2)];ptr+=4;var content=HEAPU32[((ptr)>>2)];ptr+=4;var name=UTF8ToString(name_addr)
|
|
663
|
-
FS.createPath('/',PATH.dirname(name),true,true);FS.createDataFile(name,null,HEAP8.subarray(content,content+len),true,true,true);}while(HEAPU32[((ptr)>>2)]);};var __emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`);}
|
|
664
|
-
return impl;};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType['toWireType'](destructors,handle);if(destructors.length){HEAPU32[((destructorsRef)>>2)]=Emval.toHandle(destructors);}
|
|
665
|
-
return result;};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,'emval::as');return emval_returnValue(returnType,destructorsRef,handle);};var emval_methodCallers=[];var __emval_call=(caller,handle,destructorsRef,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args);};var emval_symbols={};var getStringOrSymbol=(address)=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address);}
|
|
666
|
-
return symbol;};var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args);};var emval_get_global=()=>{if(typeof globalThis=='object'){return globalThis;}
|
|
667
|
-
return(function(){return Function;})()('return this')();};var __emval_get_global=(name)=>{if(name===0){return Emval.toHandle(emval_get_global());}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name]);}};var emval_addMethodCaller=(caller)=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id;};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[(((argTypes)+(i*4))>>2)],"parameter "+i);}
|
|
668
|
-
return a;};var reflectConstruct=Reflect.construct;var __emval_get_method_caller=(argCount,argTypes,kind)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody=`return function (obj, func, destructorsRef, args) {\n`;var offset=0;var argsList=[];if(kind===0){argsList.push("obj");}
|
|
669
|
-
var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=` var arg${i} = argType${i}.readValueFromPointer(args${offset ? "+" + offset : ""});\n`;offset+=types[i].argPackAdvance;}
|
|
670
|
-
var invoker=kind===1?'new func':'func.call';functionBody+=` var rv = ${invoker}(${argsList.join(", ")});\n`;if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n";}
|
|
671
|
-
functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params)(...args);var functionName=`methodCaller<(${types.map(t => t.name).join(', ')}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction));};var __emval_get_module_property=(name)=>{name=getStringOrSymbol(name);return Emval.toHandle(Module[name]);};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key]);};var __emval_incref=(handle)=>{if(handle>9){emval_handles[handle+1]+=1;}};var __emval_new_cstring=(v)=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=(handle)=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle);};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value;};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,'_emval_take_value');var v=type['readValueFromPointer'](arg);return Emval.toHandle(v);};var convertI32PairToI53Checked=(lo,hi)=>{assert(lo==(lo>>>0)||lo==(lo|0));assert(hi===(hi|0));return((hi+0x200000)>>>0<0x400001-!!lo)?(lo>>>0)+hi*4294967296:NaN;};function __gmtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);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;;}
|
|
672
|
-
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;return yday;};function __localtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);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);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;;}
|
|
673
|
-
var _setTempRet0=setTempRet0;var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[(((tmPtr)+(20))>>2)]+1900,HEAP32[(((tmPtr)+(16))>>2)],HEAP32[(((tmPtr)+(12))>>2)],HEAP32[(((tmPtr)+(8))>>2)],HEAP32[(((tmPtr)+(4))>>2)],HEAP32[((tmPtr)>>2)],0);var dst=HEAP32[(((tmPtr)+(32))>>2)];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[(((tmPtr)+(32))>>2)]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset);}else if((dst>0)!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*60000);}
|
|
674
|
-
HEAP32[(((tmPtr)+(24))>>2)]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[(((tmPtr)+(28))>>2)]=yday;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.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1;}
|
|
675
|
-
return timeMs/1000;})();return(setTempRet0((tempDouble=ret,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)),ret>>>0);};function __mmap_js(len,prot,flags,fd,offset_low,offset_high,allocated,addr){var offset=convertI32PairToI53Checked(offset_low,offset_high);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;};}
|
|
676
|
-
function __munmap_js(addr,len,prot,flags,fd,offset_low,offset_high){var offset=convertI32PairToI53Checked(offset_low,offset_high);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;};}
|
|
677
|
-
var __tzset_js=(timezone,daylight,std_name,dst_name)=>{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();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[((timezone)>>2)]=stdTimezoneOffset*60;HEAP32[((daylight)>>2)]=Number(winterOffset!=summerOffset);var extractZone=(timezoneOffset)=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset)
|
|
678
|
-
var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`;}
|
|
679
|
-
var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);assert(winterName);assert(summerName);assert(lengthBytesUTF8(winterName)<=16,`timezone name truncated to fit in TZNAME_MAX (${winterName})`);assert(lengthBytesUTF8(summerName)<=16,`timezone name truncated to fit in TZNAME_MAX (${summerName})`);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17);}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17);}};var _emscripten_get_now=()=>performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=(clock_id)=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision_low,ignored_precision_high,ptime){var ignored_precision=convertI32PairToI53Checked(ignored_precision_low,ignored_precision_high);if(!checkWasiClock(clk_id)){return 28;}
|
|
680
|
-
var now;if(clk_id===0){now=_emscripten_date_now();}else if(nowIsMonotonic){now=_emscripten_get_now();}else{return 52;}
|
|
681
|
-
var nsec=Math.round(now*1000*1000);(tempI64=[nsec>>>0,(tempDouble=nsec,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[((ptime)>>2)]=tempI64[0],HEAP32[(((ptime)+(4))>>2)]=tempI64[1]);return 0;;}
|
|
682
|
-
var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{assert(Array.isArray(readEmAsmArgsArray));assert(buf%16==0);readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var chr=String.fromCharCode(ch);var validChars=['d','f','i','p'];assert(validChars.includes(chr),`Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);var wide=(ch!=105);wide&=(ch!=112);buf+=wide&&(buf%8)?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[((buf)>>2)]:ch==105?HEAP32[((buf)>>2)]:HEAPF64[((buf)>>3)]);buf+=wide?8:4;}
|
|
683
|
-
return readEmAsmArgsArray;};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);assert(ASM_CONSTS.hasOwnProperty(code),`No EM_ASM constant found at address ${code}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);return ASM_CONSTS[code](...args);};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>{return runEmAsmFunction(code,sigPtr,argbuf);};var _emscripten_errn=(str,len)=>err(UTF8ToString(str,len));var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var _emscripten_pc_get_function=(pc)=>{abort('Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER');return 0;};var growMemory=(size)=>{var b=wasmMemory.buffer;var pages=((size-b.byteLength+65535)/65536)|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1;}catch(e){err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`);}};var _emscripten_resize_heap=(requestedSize)=>{var oldSize=HEAPU8.length;requestedSize>>>=0;assert(requestedSize>oldSize);var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);return false;}
|
|
684
|
-
for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+0.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true;}}
|
|
685
|
-
err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);return false;};var _emscripten_run_script=(ptr)=>{eval(UTF8ToString(ptr));};var convertFrameToPC=(frame)=>{abort('Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER');return 0;};var UNWIND_CACHE={};var saveInUnwindCache=(callstack)=>{callstack.forEach((frame)=>{var pc=convertFrameToPC(frame);if(pc){UNWIND_CACHE[pc]=frame;}});};var jsStackTrace=()=>new Error().stack.toString();var _emscripten_stack_snapshot=()=>{var callstack=jsStackTrace().split('\n');if(callstack[0]=='Error'){callstack.shift();}
|
|
686
|
-
saveInUnwindCache(callstack);UNWIND_CACHE.last_addr=convertFrameToPC(callstack[3]);UNWIND_CACHE.last_stack=callstack;return UNWIND_CACHE.last_addr;};var _emscripten_stack_unwind_buffer=(addr,buffer,count)=>{var stack;if(UNWIND_CACHE.last_addr==addr){stack=UNWIND_CACHE.last_stack;}else{stack=jsStackTrace().split('\n');if(stack[0]=='Error'){stack.shift();}
|
|
687
|
-
saveInUnwindCache(stack);}
|
|
688
|
-
var offset=3;while(stack[offset]&&convertFrameToPC(stack[offset])!=addr){++offset;}
|
|
689
|
-
for(var i=0;i<count&&stack[i+offset];++i){HEAP32[(((buffer)+(i*4))>>2)]=convertFrameToPC(stack[i+offset]);}
|
|
690
|
-
return i;};var ENV={};var getExecutableName=()=>thisProgram||'./this.program';var getEnvStrings=()=>{if(!getEnvStrings.strings){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()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x];}
|
|
691
|
-
var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`);}
|
|
692
|
-
getEnvStrings.strings=strings;}
|
|
693
|
-
return getEnvStrings.strings;};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){assert(str.charCodeAt(i)===(str.charCodeAt(i)&0xff));HEAP8[buffer++]=str.charCodeAt(i);}
|
|
694
|
-
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;};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=(code)=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module['onExit']?.(code);ABORT=true;}
|
|
695
|
-
quit_(code,new ExitStatus(code));};var exitJS=(status,implicit)=>{EXITSTATUS=status;checkUnflushedContent();if(keepRuntimeAlive()&&!implicit){var msg=`program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;err(msg);}
|
|
696
|
-
_proc_exit(status);};var _exit=exitJS;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;}}
|
|
697
|
-
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;if(typeof offset!='undefined'){offset+=curr;}}
|
|
698
|
-
return ret;};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;}}
|
|
699
|
-
function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);(tempI64=[stream.position>>>0,(tempDouble=stream.position,(+(Math.abs(tempDouble)))>=1.0?(tempDouble>0.0?(+(Math.floor((tempDouble)/4294967296.0)))>>>0:(~~((+(Math.ceil((tempDouble- +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0):0)],HEAP32[((newOffset)>>2)]=tempI64[0],HEAP32[(((newOffset)+(4))>>2)]=tempI64[1]);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0;}catch(e){if(typeof FS=='undefined'||!(e.name==='ErrnoError'))throw e;return e.errno;};}
|
|
700
|
-
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(curr<len){break;}
|
|
701
|
-
if(typeof offset!='undefined'){offset+=curr;}}
|
|
702
|
-
return ret;};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;}}
|
|
703
|
-
var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}
|
|
704
|
-
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()){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{newDate.setDate(newDate.getDate()+days);return newDate;}}
|
|
705
|
-
return newDate;};var jstoi_q=(str)=>parseInt(str);var _strptime=(buf,format,tm)=>{var pattern=UTF8ToString(format);var SPECIAL_CHARS='\\!@#$^&*()+=-[]/{}|:<>?,.';for(var i=0,ii=SPECIAL_CHARS.length;i<ii;++i){pattern=pattern.replace(new RegExp('\\'+SPECIAL_CHARS[i],'g'),'\\'+SPECIAL_CHARS[i]);}
|
|
706
|
-
var EQUIVALENT_MATCHERS={'A':'%a','B':'%b','c':'%a %b %d %H:%M:%S %Y','D':'%m\\/%d\\/%y','e':'%d','F':'%Y-%m-%d','h':'%b','R':'%H\\:%M','r':'%I\\:%M\\:%S\\s%p','T':'%H\\:%M\\:%S','x':'%m\\/%d\\/(?:%y|%Y)','X':'%H\\:%M\\:%S'};var DATE_PATTERNS={'a':'(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)','b':'(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)','C':'\\d\\d','d':'0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31','H':'\\d(?!\\d)|[0,1]\\d|20|21|22|23','I':'\\d(?!\\d)|0\\d|10|11|12','j':'00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d','m':'0[1-9]|[1-9](?!\\d)|10|11|12','M':'0\\d|\\d(?!\\d)|[1-5]\\d','n':' ','p':'AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.','S':'0\\d|\\d(?!\\d)|[1-5]\\d|60','U':'0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53','W':'0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53','w':'[0-6]','y':'\\d\\d','Y':'\\d\\d\\d\\d','t':' ','z':'Z|(?:[\\+\\-]\\d\\d:?(?:\\d\\d)?)'};var MONTH_NUMBERS={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11};var DAY_NUMBERS_SUN_FIRST={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};var DAY_NUMBERS_MON_FIRST={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};var capture=[];var pattern_out=pattern.replace(/%(.)/g,(m,c)=>EQUIVALENT_MATCHERS[c]||m).replace(/%(.)/g,(_,c)=>{let pat=DATE_PATTERNS[c];if(pat){capture.push(c);return`(${pat})`;}else{return c;}}).replace(/\s+/g,'\\s*');var matches=new RegExp('^'+pattern_out,"i").exec(UTF8ToString(buf))
|
|
707
|
-
function initDate(){function fixup(value,min,max){return(typeof value!='number'||isNaN(value))?min:(value>=min?(value<=max?value:max):min);};return{year:fixup(HEAP32[(((tm)+(20))>>2)]+1900,1970,9999),month:fixup(HEAP32[(((tm)+(16))>>2)],0,11),day:fixup(HEAP32[(((tm)+(12))>>2)],1,31),hour:fixup(HEAP32[(((tm)+(8))>>2)],0,23),min:fixup(HEAP32[(((tm)+(4))>>2)],0,59),sec:fixup(HEAP32[((tm)>>2)],0,59),gmtoff:0};};if(matches){var date=initDate();var value;var getMatch=(symbol)=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1];}
|
|
708
|
-
return;};if((value=getMatch('S'))){date.sec=jstoi_q(value);}
|
|
709
|
-
if((value=getMatch('M'))){date.min=jstoi_q(value);}
|
|
710
|
-
if((value=getMatch('H'))){date.hour=jstoi_q(value);}else if((value=getMatch('I'))){var hour=jstoi_q(value);if((value=getMatch('p'))){hour+=value.toUpperCase()[0]==='P'?12:0;}
|
|
711
|
-
date.hour=hour;}
|
|
712
|
-
if((value=getMatch('Y'))){date.year=jstoi_q(value);}else if((value=getMatch('y'))){var year=jstoi_q(value);if((value=getMatch('C'))){year+=jstoi_q(value)*100;}else{year+=year<69?2000:1900;}
|
|
713
|
-
date.year=year;}
|
|
714
|
-
if((value=getMatch('m'))){date.month=jstoi_q(value)-1;}else if((value=getMatch('b'))){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0;}
|
|
715
|
-
if((value=getMatch('d'))){date.day=jstoi_q(value);}else if((value=getMatch('j'))){var day=jstoi_q(value);var leapYear=isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=arraySum(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth;}}}else if((value=getMatch('a'))){var weekDay=value.substring(0,3).toUpperCase();if((value=getMatch('U'))){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1));}else{endDate=addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1));}
|
|
716
|
-
date.day=endDate.getDate();date.month=endDate.getMonth();}else if((value=getMatch('W'))){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1));}else{endDate=addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1));}
|
|
717
|
-
date.day=endDate.getDate();date.month=endDate.getMonth();}}
|
|
718
|
-
if((value=getMatch('z'))){if(value.toLowerCase()==='z'){date.gmtoff=0;}else{var match=value.match(/^((?:\-|\+)\d\d):?(\d\d)?/);date.gmtoff=match[1]*3600;if(match[2]){date.gmtoff+=date.gmtoff>0?match[2]*60:-match[2]*60}}}
|
|
719
|
-
var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[((tm)>>2)]=fullDate.getSeconds();HEAP32[(((tm)+(4))>>2)]=fullDate.getMinutes();HEAP32[(((tm)+(8))>>2)]=fullDate.getHours();HEAP32[(((tm)+(12))>>2)]=fullDate.getDate();HEAP32[(((tm)+(16))>>2)]=fullDate.getMonth();HEAP32[(((tm)+(20))>>2)]=fullDate.getFullYear()-1900;HEAP32[(((tm)+(24))>>2)]=fullDate.getDay();HEAP32[(((tm)+(28))>>2)]=arraySum(isLeapYear(fullDate.getFullYear())?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[(((tm)+(32))>>2)]=0;HEAP32[(((tm)+(36))>>2)]=date.gmtoff;return buf+intArrayFromString(matches[0]).length-1;}
|
|
720
|
-
return 0;};var handleException=(e)=>{if(e instanceof ExitStatus||e=='unwind'){return EXITSTATUS;}
|
|
721
|
-
checkStackCookie();if(e instanceof WebAssembly.RuntimeError){if(_emscripten_stack_get_current()<=0){err('Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 5242880)');}}
|
|
722
|
-
quit_(1,e);};var stackAlloc=(sz)=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=(str)=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret;};var getCFunc=(ident)=>{var func=Module['_'+ident];assert(func,'Cannot call unknown function '+ident+', make sure it is exported');return func;};var writeArrayToMemory=(array,buffer)=>{assert(array.length>=0,'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
723
|
-
HEAP8.set(array,buffer);};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={'string':(str)=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str);}
|
|
724
|
-
return ret;},'array':(arr)=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret;}};function convertReturnValue(ret){if(returnType==='string'){return UTF8ToString(ret);}
|
|
725
|
-
if(returnType==='boolean')return Boolean(ret);return ret;}
|
|
726
|
-
var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!=='array','Return type should not be "array".');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];}}}
|
|
727
|
-
var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret);}
|
|
728
|
-
ret=onDone(ret);return ret;};var cwrap=(ident,returnType,argTypes,opts)=>{return(...args)=>ccall(ident,returnType,argTypes,args,opts);};var FS_createPath=FS.createPath;var FS_unlink=(path)=>FS.unlink(path);var FS_createLazyFile=FS.createLazyFile;var FS_createDevice=FS.createDevice;var incrementExceptionRefcount=(ptr)=>___cxa_increment_exception_refcount(ptr);Module['incrementExceptionRefcount']=incrementExceptionRefcount;var decrementExceptionRefcount=(ptr)=>___cxa_decrement_exception_refcount(ptr);Module['decrementExceptionRefcount']=decrementExceptionRefcount;var getExceptionMessageCommon=(ptr)=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[((type_addr_addr)>>2)];var message_addr=HEAPU32[((message_addr_addr)>>2)];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr);}
|
|
729
|
-
stackRestore(sp);return[type,message];};var getExceptionMessage=(ptr)=>getExceptionMessageCommon(ptr);Module['getExceptionMessage']=getExceptionMessage;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();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;;embind_init_charCodes();BindingError=Module['BindingError']=class BindingError extends Error{constructor(message){super(message);this.name='BindingError';}};InternalError=Module['InternalError']=class InternalError extends Error{constructor(message){super(message);this.name='InternalError';}};init_emval();;UnboundTypeError=Module['UnboundTypeError']=extendError(Error,'UnboundTypeError');;function checkIncomingModuleAPI(){ignoredModuleProp('fetchSettings');}
|
|
730
|
-
var wasmImports={HaveOffsetConverter,__assert_fail:___assert_fail,__cxa_begin_catch:___cxa_begin_catch,__cxa_end_catch:___cxa_end_catch,__cxa_find_matching_catch_2:___cxa_find_matching_catch_2,__cxa_find_matching_catch_3:___cxa_find_matching_catch_3,__cxa_rethrow:___cxa_rethrow,__cxa_throw:___cxa_throw,__cxa_uncaught_exceptions:___cxa_uncaught_exceptions,__resumeException:___resumeException,__syscall_fcntl64:___syscall_fcntl64,__syscall_fstat64:___syscall_fstat64,__syscall_getcwd:___syscall_getcwd,__syscall_getdents64:___syscall_getdents64,__syscall_ioctl:___syscall_ioctl,__syscall_lstat64:___syscall_lstat64,__syscall_mkdirat:___syscall_mkdirat,__syscall_newfstatat:___syscall_newfstatat,__syscall_openat:___syscall_openat,__syscall_readlinkat:___syscall_readlinkat,__syscall_rmdir:___syscall_rmdir,__syscall_stat64:___syscall_stat64,__syscall_unlinkat:___syscall_unlinkat,_abort_js:__abort_js,_embind_register_bigint:__embind_register_bigint,_embind_register_bool:__embind_register_bool,_embind_register_emval:__embind_register_emval,_embind_register_float:__embind_register_float,_embind_register_function:__embind_register_function,_embind_register_integer:__embind_register_integer,_embind_register_memory_view:__embind_register_memory_view,_embind_register_std_string:__embind_register_std_string,_embind_register_std_wstring:__embind_register_std_wstring,_embind_register_void:__embind_register_void,_emscripten_fs_load_embedded_files:__emscripten_fs_load_embedded_files,_emscripten_memcpy_js:__emscripten_memcpy_js,_emval_as:__emval_as,_emval_call:__emval_call,_emval_call_method:__emval_call_method,_emval_decref:__emval_decref,_emval_get_global:__emval_get_global,_emval_get_method_caller:__emval_get_method_caller,_emval_get_module_property:__emval_get_module_property,_emval_get_property:__emval_get_property,_emval_incref:__emval_incref,_emval_new_cstring:__emval_new_cstring,_emval_run_destructors:__emval_run_destructors,_emval_set_property:__emval_set_property,_emval_take_value:__emval_take_value,_gmtime_js:__gmtime_js,_localtime_js:__localtime_js,_mktime_js:__mktime_js,_mmap_js:__mmap_js,_munmap_js:__munmap_js,_tzset_js:__tzset_js,clock_time_get:_clock_time_get,emscripten_asm_const_int:_emscripten_asm_const_int,emscripten_date_now:_emscripten_date_now,emscripten_errn:_emscripten_errn,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_pc_get_function:_emscripten_pc_get_function,emscripten_resize_heap:_emscripten_resize_heap,emscripten_run_script:_emscripten_run_script,emscripten_stack_snapshot:_emscripten_stack_snapshot,emscripten_stack_unwind_buffer:_emscripten_stack_unwind_buffer,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,fd_close:_fd_close,fd_read:_fd_read,fd_seek:_fd_seek,fd_write:_fd_write,invoke_diii,invoke_fiii,invoke_i,invoke_ii,invoke_iii,invoke_iiii,invoke_iiiii,invoke_iiiiid,invoke_iiiiii,invoke_iiiiiii,invoke_iiiiiiii,invoke_iiiiiiiiiii,invoke_iiiiiiiiiiii,invoke_iiiiiiiiiiiii,invoke_iiiiij,invoke_j,invoke_ji,invoke_jiiii,invoke_v,invoke_vi,invoke_vii,invoke_viif,invoke_viii,invoke_viiii,invoke_viiiiii,invoke_viiiiiii,invoke_viiiiiiiiii,invoke_viiiiiiiiiiiiiii,invoke_viijii,proc_exit:_proc_exit,strptime:_strptime};var wasmExports;createWasm();var ___wasm_call_ctors=createExportWrapper('__wasm_call_ctors',0);var _malloc=createExportWrapper('malloc',1);var _main=Module['_main']=createExportWrapper('__main_argc_argv',2);var _aux_freeMemory=Module['_aux_freeMemory']=createExportWrapper('aux_freeMemory',1);var _free=createExportWrapper('free',1);var _aux_allocMemory=Module['_aux_allocMemory']=createExportWrapper('aux_allocMemory',1);var _setCode1DChecksum=Module['_setCode1DChecksum']=createExportWrapper('setCode1DChecksum',3);var _initialize=Module['_initialize']=createExportWrapper('initialize',1);var _inf_BKgetVersion=Module['_inf_BKgetVersion']=createExportWrapper('inf_BKgetVersion',0);var _cfg_BKSetRegionOfInterest=Module['_cfg_BKSetRegionOfInterest']=createExportWrapper('cfg_BKSetRegionOfInterest',4);var _cfg_BKGetRegionOfInterest=Module['_cfg_BKGetRegionOfInterest']=createExportWrapper('cfg_BKGetRegionOfInterest',0);var _cfg_BKSetDecodingSpeed=Module['_cfg_BKSetDecodingSpeed']=createExportWrapper('cfg_BKSetDecodingSpeed',1);var _cfg_BKSetEnabledDecoders=Module['_cfg_BKSetEnabledDecoders']=createExportWrapper('cfg_BKSetEnabledDecoders',2);var _cfg_BKSetEnabledDecodersPro=Module['_cfg_BKSetEnabledDecodersPro']=createExportWrapper('cfg_BKSetEnabledDecodersPro',1);var _cfg_BKSetUpcEanDeblur=Module['_cfg_BKSetUpcEanDeblur']=createExportWrapper('cfg_BKSetUpcEanDeblur',1);var _cfg_BKSetLengthRange=Module['_cfg_BKSetLengthRange']=createExportWrapper('cfg_BKSetLengthRange',3);var _cfg_BKSetSpecificConfig=Module['_cfg_BKSetSpecificConfig']=createExportWrapper('cfg_BKSetSpecificConfig',3);var _cfg_BKSetFormatting=Module['_cfg_BKSetFormatting']=createExportWrapper('cfg_BKSetFormatting',1);var _cfg_BKSetDuplicatesDelayMs=Module['_cfg_BKSetDuplicatesDelayMs']=createExportWrapper('cfg_BKSetDuplicatesDelayMs',1);var _cfg_BKSetEncodingCharacterSet=Module['_cfg_BKSetEncodingCharacterSet']=createExportWrapper('cfg_BKSetEncodingCharacterSet',1);var _cfg_BKSetMulticodeCachingEnabled=Module['_cfg_BKSetMulticodeCachingEnabled']=createExportWrapper('cfg_BKSetMulticodeCachingEnabled',1);var _cfg_BKSetMulticodeCachingDuration=Module['_cfg_BKSetMulticodeCachingDuration']=createExportWrapper('cfg_BKSetMulticodeCachingDuration',1);var _cfg_BKSetMaximumResultsCount=Module['_cfg_BKSetMaximumResultsCount']=createExportWrapper('cfg_BKSetMaximumResultsCount',1);var _cfg_BKSetEnableMisshaped1D=Module['_cfg_BKSetEnableMisshaped1D']=createExportWrapper('cfg_BKSetEnableMisshaped1D',1);var _cfg_BKSetEnableVINRestrictions=Module['_cfg_BKSetEnableVINRestrictions']=createExportWrapper('cfg_BKSetEnableVINRestrictions',1);var _cfg_BKReturnDecodingSpeed=Module['_cfg_BKReturnDecodingSpeed']=createExportWrapper('cfg_BKReturnDecodingSpeed',0);var _cfg_BKReturnUpcEanDeblur=Module['_cfg_BKReturnUpcEanDeblur']=createExportWrapper('cfg_BKReturnUpcEanDeblur',0);var _cfg_BKReturnFormatting=Module['_cfg_BKReturnFormatting']=createExportWrapper('cfg_BKReturnFormatting',0);var _cfg_BKReturnDuplicatesDelayMs=Module['_cfg_BKReturnDuplicatesDelayMs']=createExportWrapper('cfg_BKReturnDuplicatesDelayMs',0);var _cfg_BKReturnEncodingCharacterSet=Module['_cfg_BKReturnEncodingCharacterSet']=createExportWrapper('cfg_BKReturnEncodingCharacterSet',0);var _cfg_BKReturnSpecificConfig=Module['_cfg_BKReturnSpecificConfig']=createExportWrapper('cfg_BKReturnSpecificConfig',2);var _cfg_BKReturnBarcodeTypeEnabled=Module['_cfg_BKReturnBarcodeTypeEnabled']=createExportWrapper('cfg_BKReturnBarcodeTypeEnabled',1);var _cfg_BKSetBarcodeTypeEnabled=Module['_cfg_BKSetBarcodeTypeEnabled']=createExportWrapper('cfg_BKSetBarcodeTypeEnabled',2);var _cfg_BKReturnLengthRange=Module['_cfg_BKReturnLengthRange']=createExportWrapper('cfg_BKReturnLengthRange',1);var _cfg_BKReturnMulticodeCachingEnabled=Module['_cfg_BKReturnMulticodeCachingEnabled']=createExportWrapper('cfg_BKReturnMulticodeCachingEnabled',0);var _cfg_BKReturnMulticodeCachingDuration=Module['_cfg_BKReturnMulticodeCachingDuration']=createExportWrapper('cfg_BKReturnMulticodeCachingDuration',0);var _cfg_BKGetMaximumResultsCount=Module['_cfg_BKGetMaximumResultsCount']=createExportWrapper('cfg_BKGetMaximumResultsCount',0);var _cfg_BKReturnEnableMisshaped1D=Module['_cfg_BKReturnEnableMisshaped1D']=createExportWrapper('cfg_BKReturnEnableMisshaped1D',0);var _cfg_BKReturnEnableVINRestrictions=Module['_cfg_BKReturnEnableVINRestrictions']=createExportWrapper('cfg_BKReturnEnableVINRestrictions',0);var _api_BKDecodeImageMemory=Module['_api_BKDecodeImageMemory']=createExportWrapper('api_BKDecodeImageMemory',4);var _fflush=createExportWrapper('fflush',1);var _strerror=createExportWrapper('strerror',1);var ___getTypeName=createExportWrapper('__getTypeName',1);var _emscripten_builtin_memalign=createExportWrapper('emscripten_builtin_memalign',2);var _setThrew=createExportWrapper('setThrew',2);var __emscripten_tempret_set=createExportWrapper('_emscripten_tempret_set',1);var _emscripten_stack_init=()=>(_emscripten_stack_init=wasmExports['emscripten_stack_init'])();var _emscripten_stack_get_free=()=>(_emscripten_stack_get_free=wasmExports['emscripten_stack_get_free'])();var _emscripten_stack_get_base=()=>(_emscripten_stack_get_base=wasmExports['emscripten_stack_get_base'])();var _emscripten_stack_get_end=()=>(_emscripten_stack_get_end=wasmExports['emscripten_stack_get_end'])();var __emscripten_stack_restore=(a0)=>(__emscripten_stack_restore=wasmExports['_emscripten_stack_restore'])(a0);var __emscripten_stack_alloc=(a0)=>(__emscripten_stack_alloc=wasmExports['_emscripten_stack_alloc'])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports['emscripten_stack_get_current'])();var ___cxa_decrement_exception_refcount=createExportWrapper('__cxa_decrement_exception_refcount',1);var ___cxa_increment_exception_refcount=createExportWrapper('__cxa_increment_exception_refcount',1);var ___cxa_free_exception=createExportWrapper('__cxa_free_exception',1);var ___get_exception_message=createExportWrapper('__get_exception_message',3);var ___cxa_can_catch=createExportWrapper('__cxa_can_catch',3);var ___cxa_get_exception_ptr=createExportWrapper('__cxa_get_exception_ptr',1);var dynCall_jiji=Module['dynCall_jiji']=createExportWrapper('dynCall_jiji',5);var dynCall_j=Module['dynCall_j']=createExportWrapper('dynCall_j',1);var dynCall_ji=Module['dynCall_ji']=createExportWrapper('dynCall_ji',2);var dynCall_viijii=Module['dynCall_viijii']=createExportWrapper('dynCall_viijii',7);var dynCall_iiiiij=Module['dynCall_iiiiij']=createExportWrapper('dynCall_iiiiij',7);var dynCall_jiiii=Module['dynCall_jiiii']=createExportWrapper('dynCall_jiiii',5);var dynCall_iiiiijj=Module['dynCall_iiiiijj']=createExportWrapper('dynCall_iiiiijj',9);var dynCall_iiiiiijj=Module['dynCall_iiiiiijj']=createExportWrapper('dynCall_iiiiiijj',10);var dynCall_viijj=Module['dynCall_viijj']=createExportWrapper('dynCall_viijj',7);var dynCall_jjjjjjj=Module['dynCall_jjjjjjj']=createExportWrapper('dynCall_jjjjjjj',13);var dynCall_jjjjjj=Module['dynCall_jjjjjj']=createExportWrapper('dynCall_jjjjjj',11);var dynCall_iijjii=Module['dynCall_iijjii']=createExportWrapper('dynCall_iijjii',8);var dynCall_jijii=Module['dynCall_jijii']=createExportWrapper('dynCall_jijii',6);var dynCall_vijii=Module['dynCall_vijii']=createExportWrapper('dynCall_vijii',6);var dynCall_jij=Module['dynCall_jij']=createExportWrapper('dynCall_jij',4);var dynCall_iij=Module['dynCall_iij']=createExportWrapper('dynCall_iij',4);var dynCall_viji=Module['dynCall_viji']=createExportWrapper('dynCall_viji',5);var dynCall_iiij=Module['dynCall_iiij']=createExportWrapper('dynCall_iiij',5);var dynCall_vij=Module['dynCall_vij']=createExportWrapper('dynCall_vij',4);var dynCall_viiijii=Module['dynCall_viiijii']=createExportWrapper('dynCall_viiijii',8);var dynCall_viijiiiiiiiiii=Module['dynCall_viijiiiiiiiiii']=createExportWrapper('dynCall_viijiiiiiiiiii',15);var dynCall_viiij=Module['dynCall_viiij']=createExportWrapper('dynCall_viiij',6);var dynCall_jii=Module['dynCall_jii']=createExportWrapper('dynCall_jii',3);var dynCall_jfi=Module['dynCall_jfi']=createExportWrapper('dynCall_jfi',3);var ___emscripten_embedded_file_data=Module['___emscripten_embedded_file_data']=15056736;function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
731
|
-
function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
732
|
-
function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
733
|
-
function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
734
|
-
function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
735
|
-
function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)();}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
736
|
-
function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
737
|
-
function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
738
|
-
function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
739
|
-
function invoke_iiiiid(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
740
|
-
function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
741
|
-
function invoke_iiiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
742
|
-
function invoke_iiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
743
|
-
function invoke_iiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
744
|
-
function invoke_iiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
745
|
-
function invoke_fiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
746
|
-
function invoke_diii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
747
|
-
function invoke_i(index){var sp=stackSave();try{return getWasmTableEntry(index)();}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
748
|
-
function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
749
|
-
function invoke_iiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
750
|
-
function invoke_viiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
751
|
-
function invoke_viiiiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
752
|
-
function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
753
|
-
function invoke_viif(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
754
|
-
function invoke_j(index){var sp=stackSave();try{return dynCall_j(index);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
755
|
-
function invoke_ji(index,a1){var sp=stackSave();try{return dynCall_ji(index,a1);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
756
|
-
function invoke_viijii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{dynCall_viijii(index,a1,a2,a3,a4,a5,a6);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
757
|
-
function invoke_iiiiij(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return dynCall_iiiiij(index,a1,a2,a3,a4,a5,a6);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
758
|
-
function invoke_jiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return dynCall_jiiii(index,a1,a2,a3,a4);}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);}}
|
|
759
|
-
Module['addRunDependency']=addRunDependency;Module['removeRunDependency']=removeRunDependency;Module['ccall']=ccall;Module['cwrap']=cwrap;Module['FS_createPreloadedFile']=FS_createPreloadedFile;Module['FS_unlink']=FS_unlink;Module['FS_createPath']=FS_createPath;Module['FS_createDevice']=FS_createDevice;Module['FS_createDataFile']=FS_createDataFile;Module['FS_createLazyFile']=FS_createLazyFile;var missingLibrarySymbols=['writeI53ToI64','writeI53ToI64Clamped','writeI53ToI64Signaling','writeI53ToU64Clamped','writeI53ToU64Signaling','readI53FromI64','readI53FromU64','convertI32PairToI53','convertU32PairToI53','getTempRet0','inetPton4','inetNtop4','inetPton6','inetNtop6','readSockaddr','writeSockaddr','emscriptenLog','runMainThreadEmAsm','listenOnce','autoResumeAudioContext','runtimeKeepalivePush','runtimeKeepalivePop','callUserCallback','maybeExit','asmjsMangle','HandleAllocator','getNativeTypeSize','STACK_SIZE','STACK_ALIGN','POINTER_SIZE','ASSERTIONS','uleb128Encode','sigToWasmTypes','generateFuncType','convertJsFunctionToWasm','getEmptyTableSlot','updateTableMap','getFunctionAddress','addFunction','removeFunction','reallyNegative','unSign','strLen','reSign','formatString','intArrayToString','AsciiToString','stringToNewUTF8','registerKeyEventCallback','maybeCStringToJsString','findEventTarget','getBoundingClientRect','fillMouseEventData','registerMouseEventCallback','registerWheelEventCallback','registerUiEventCallback','registerFocusEventCallback','fillDeviceOrientationEventData','registerDeviceOrientationEventCallback','fillDeviceMotionEventData','registerDeviceMotionEventCallback','screenOrientation','fillOrientationChangeEventData','registerOrientationChangeEventCallback','fillFullscreenChangeEventData','registerFullscreenChangeEventCallback','JSEvents_requestFullscreen','JSEvents_resizeCanvasForFullscreen','registerRestoreOldStyle','hideEverythingExceptGivenElement','restoreHiddenElements','setLetterbox','softFullscreenResizeWebGLRenderTarget','doRequestFullscreen','fillPointerlockChangeEventData','registerPointerlockChangeEventCallback','registerPointerlockErrorEventCallback','requestPointerLock','fillVisibilityChangeEventData','registerVisibilityChangeEventCallback','registerTouchEventCallback','fillGamepadEventData','registerGamepadEventCallback','registerBeforeUnloadEventCallback','fillBatteryEventData','battery','registerBatteryEventCallback','setCanvasElementSize','getCanvasElementSize','getCallstack','convertPCtoSourceLocation','wasiRightsToMuslOFlags','wasiOFlagsToMuslOFlags','safeSetTimeout','setImmediateWrapped','safeRequestAnimationFrame','clearImmediateWrapped','polyfillSetImmediate','registerPostMainLoop','registerPreMainLoop','getPromise','makePromise','idsToPromises','makePromiseCallback','Browser_asyncPrepareDataCounter','getSocketFromFD','getSocketAddress','FS_mkdirTree','_setNetworkCallback','heapObjectForWebGLType','toTypedArrayIndex','webgl_enable_ANGLE_instanced_arrays','webgl_enable_OES_vertex_array_object','webgl_enable_WEBGL_draw_buffers','webgl_enable_WEBGL_multi_draw','webgl_enable_EXT_polygon_offset_clamp','webgl_enable_EXT_clip_control','webgl_enable_WEBGL_polygon_mode','emscriptenWebGLGet','computeUnpackAlignedImageSize','colorChannelsInGlTextureFormat','emscriptenWebGLGetTexPixelData','emscriptenWebGLGetUniform','webglGetUniformLocation','webglPrepareUniformLocationsBeforeFirstUse','webglGetLeftBracePos','emscriptenWebGLGetVertexAttrib','__glGetActiveAttribOrUniform','writeGLArray','registerWebGlEventCallback','runAndAbortIfError','ALLOC_NORMAL','ALLOC_STACK','allocate','writeStringToMemory','writeAsciiToMemory','setErrNo','demangle','stackTrace','getFunctionArgsName','createJsInvokerSignature','getBasestPointer','registerInheritedInstance','unregisterInheritedInstance','getInheritedInstance','getInheritedInstanceCount','getLiveInheritedInstances','enumReadValueFromPointer','genericPointerToWireType','constNoSmartPtrRawPointerToWireType','nonConstNoSmartPtrRawPointerToWireType','init_RegisteredPointer','RegisteredPointer','RegisteredPointer_fromWireType','runDestructor','releaseClassHandle','detachFinalizer','attachFinalizer','makeClassHandle','init_ClassHandle','ClassHandle','throwInstanceAlreadyDeleted','flushPendingDeletes','setDelayFunction','RegisteredClass','shallowCopyInternalPointer','downcastPointer','upcastPointer','validateThis','char_0','char_9','makeLegalFunctionName',];missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
760
|
-
var unexportedSymbols=['run','addOnPreRun','addOnInit','addOnPreMain','addOnExit','addOnPostRun','out','err','callMain','abort','wasmMemory','wasmExports','writeStackCookie','checkStackCookie','convertI32PairToI53Checked','stackSave','stackRestore','stackAlloc','setTempRet0','ptrToString','zeroMemory','exitJS','getHeapMax','growMemory','ENV','ERRNO_CODES','strError','DNS','Protocols','Sockets','timers','warnOnce','readEmAsmArgsArray','readEmAsmArgs','runEmAsmFunction','jstoi_q','jstoi_s','getExecutableName','dynCallLegacy','getDynCaller','dynCall','handleException','keepRuntimeAlive','asyncLoad','alignMemory','mmapAlloc','wasmTable','noExitRuntime','getCFunc','freeTableIndexes','functionsInTableMap','setValue','getValue','PATH','PATH_FS','UTF8Decoder','UTF8ArrayToString','UTF8ToString','stringToUTF8Array','stringToUTF8','lengthBytesUTF8','intArrayFromString','stringToAscii','UTF16Decoder','UTF16ToString','stringToUTF16','lengthBytesUTF16','UTF32ToString','stringToUTF32','lengthBytesUTF32','stringToUTF8OnStack','writeArrayToMemory','JSEvents','specialHTMLTargets','findCanvasEventTarget','currentFullscreenStrategy','restoreOldWindowedStyle','jsStackTrace','UNWIND_CACHE','ExitStatus','getEnvStrings','checkWasiClock','doReadv','doWritev','initRandomFill','randomFill','promiseMap','uncaughtExceptionCount','exceptionLast','exceptionCaught','ExceptionInfo','findMatchingCatch','getExceptionMessageCommon','incrementExceptionRefcount','decrementExceptionRefcount','getExceptionMessage','Browser','getPreloadedImageData__data','wget','MONTH_DAYS_REGULAR','MONTH_DAYS_LEAP','MONTH_DAYS_REGULAR_CUMULATIVE','MONTH_DAYS_LEAP_CUMULATIVE','isLeapYear','ydayFromDate','arraySum','addDays','SYSCALLS','preloadPlugins','FS_modeStringToFlags','FS_getMode','FS_stdin_getChar_buffer','FS_stdin_getChar','FS_readFile','FS','MEMFS','TTY','PIPEFS','SOCKFS','tempFixedLengthArray','miniTempWebGLFloatBuffers','miniTempWebGLIntBuffers','GL','AL','GLUT','EGL','GLEW','IDBStore','SDL','SDL_gfx','allocateUTF8','allocateUTF8OnStack','print','printErr','InternalError','BindingError','throwInternalError','throwBindingError','registeredTypes','awaitingDependencies','typeDependencies','tupleRegistrations','structRegistrations','sharedRegisterType','whenDependentTypesAreResolved','embind_charCodes','embind_init_charCodes','readLatin1String','getTypeName','getFunctionName','heap32VectorToArray','requireRegisteredType','usesDestructorStack','checkArgCount','getRequiredArgCount','createJsInvoker','UnboundTypeError','PureVirtualError','GenericWireTypeSize','EmValType','EmValOptionalType','throwUnboundTypeError','ensureOverloadTable','exposePublicSymbol','replacePublicSymbol','extendError','createNamedFunction','embindRepr','registeredInstances','registeredPointers','registerType','integerReadValueFromPointer','floatReadValueFromPointer','readPointer','runDestructors','newFunc','craftInvokerFunction','embind__requireFunction','finalizationRegistry','detachFinalizer_deps','deletionQueue','delayFunction','emval_freelist','emval_handles','emval_symbols','init_emval','count_emval_handles','getStringOrSymbol','Emval','emval_get_global','emval_returnValue','emval_lookupTypes','emval_methodCallers','emval_addMethodCaller','reflectConstruct',];unexportedSymbols.forEach(unexportedRuntimeSymbol);var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller;};function callMain(args=[]){assert(runDependencies==0,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');assert(__ATPRERUN__.length==0,'cannot call main when preRun functions remain to be called');var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach((arg)=>{HEAPU32[((argv_ptr)>>2)]=stringToUTF8OnStack(arg);argv_ptr+=4;});HEAPU32[((argv_ptr)>>2)]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret;}
|
|
761
|
-
catch(e){return handleException(e);}}
|
|
762
|
-
function stackCheckInit(){_emscripten_stack_init();writeStackCookie();}
|
|
763
|
-
function run(args=arguments_){if(runDependencies>0){return;}
|
|
764
|
-
stackCheckInit();preRun();if(runDependencies>0){return;}
|
|
765
|
-
function doRun(){if(calledRun)return;calledRun=true;Module['calledRun']=true;if(ABORT)return;initRuntime();preMain();Module['onRuntimeInitialized']?.();if(shouldRunNow)callMain(args);postRun();}
|
|
766
|
-
if(Module['setStatus']){Module['setStatus']('Running...');setTimeout(()=>{setTimeout(()=>Module['setStatus'](''),1);doRun();},1);}else
|
|
767
|
-
{doRun();}
|
|
768
|
-
checkStackCookie();}
|
|
769
|
-
function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=(x)=>{has=true;}
|
|
770
|
-
try{_fflush(0);['stdout','stderr'].forEach((name)=>{var info=FS.analyzePath('/dev/'+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty?.output?.length){has=true;}});}catch(e){}
|
|
771
|
-
out=oldOut;err=oldErr;if(has){warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.');}}
|
|
772
|
-
if(Module['preInit']){if(typeof Module['preInit']=='function')Module['preInit']=[Module['preInit']];while(Module['preInit'].length>0){Module['preInit'].pop()();}}
|
|
773
|
-
var shouldRunNow=true;if(Module['noInitialRun'])shouldRunNow=false;run();}}else{var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);var ret=fs.readFileSync(filename);return ret};readAsync=(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return new Promise((resolve,reject)=>{fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)reject(err);else resolve(binary?data.buffer:data)})})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}return fetch(url,{credentials:"same-origin"}).then(response=>{if(response.ok){return response.arrayBuffer()}return Promise.reject(new Error(response.status+" : "+response.url))})}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;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)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=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;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}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 addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;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()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function findWasmBinary(){var f="barkoder_nosimd.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;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(!wasmBinary){return readAsync(binaryFile).then(response=>new Uint8Array(response),()=>getBinarySync(binaryFile))}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>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)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function getWasmImports(){return{a:wasmImports}}function createWasm(){var info=getWasmImports();function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["N"];updateMemoryViews();wasmTable=wasmExports["Aa"];addOnInit(wasmExports["O"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}wasmBinaryFile??=findWasmBinary();instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult);return{}}var tempDouble;var ASM_CONSTS={193140:()=>{window.BarkoderSDK_callback1D=true},193178:$0=>{window.BarkoderSDK_frameDecoding=true;window.BarkoderSDK_currentFrame=$0},193261:()=>{window.BarkoderSDK_callback2D=true},193299:()=>{window.BarkoderSDK_callback3D=true},193337:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},193392:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)}};function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>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"])};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var __abort_js=()=>{abort("")};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){return sharedRegisterType(rawType,registeredInstance,options)}var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=undefined;emval_freelist.push(handle)}};var count_emval_handles=()=>emval_handles.length/2-5-emval_freelist.length;var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1);Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>value,argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,body)=>Object.defineProperty(body,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`)}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired")}for(var i=0;i<argCount;++i){argsList.push(`arg${i}`);argsListWired.push(`arg${i}Wired`)}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody=`return function (${argsList}) {\n`;if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = classParam['toWireType'](${dtorStack}, this);\n`}for(var i=0;i<argCount;++i){invokerFnBody+=`var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});\n`;args1.push(`argType${i}`)}invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`)}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";return[args1,invokerFnBody]}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2])}if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction)}}}let[args,invokerFnBody]=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);args.push(invokerFnBody);var invokerFn=newFunc(Function,args)(...closureArgs);return createNamedFunction(humanName,invokerFn)}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var dynCallLegacy=(sig,ptr,args)=>{sig=sig.replace(/p/g,"i");var f=Module["dynCall_"+sig];return f(ptr,...args)};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 dynCall=(sig,ptr,args=[])=>{if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}var rtn=getWasmTableEntry(ptr)(...args);return rtn};var getDynCaller=(sig,ptr)=>(...args)=>dynCall(sig,ptr,args);var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){return signature.substr(0,argsIndex)}else{return signature}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name,fromWireType,toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i])}str=a.join("")}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i]}}}if(destructors!==null){destructors.push(_free,base)}return base},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=pointer=>HEAPU16[pointer>>1]}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=pointer=>HEAPU32[pointer>>2]}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var nowIsMonotonic=1;var __emscripten_get_now_is_monotonic=()=>nowIsMonotonic;var __emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle)};var emval_methodCallers=[];var __emval_call=(caller,handle,destructorsRef,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i)}return a};var reflectConstruct=Reflect.construct;var __emval_get_method_caller=(argCount,argTypes,kind)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody=`return function (obj, func, destructorsRef, args) {\n`;var offset=0;var argsList=[];if(kind===0){argsList.push("obj")}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=` var arg${i} = argType${i}.readValueFromPointer(args${offset?"+"+offset:""});\n`;offset+=types[i].argPackAdvance}var invoker=kind===1?"new func":"func.call";functionBody+=` var rv = ${invoker}(${argsList.join(", ")});\n`;if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n"}functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params)(...args);var functionName=`methodCaller<(${types.map(t=>t.name).join(", ")}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction))};var __emval_get_module_property=name=>{name=getStringOrSymbol(name);return Emval.toHandle(Module[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)};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;return yday};var setTempRet0=val=>__emscripten_tempret_set(val);var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;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.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1}return timeMs/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{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();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var _emscripten_date_now=()=>Date.now();var _emscripten_get_now=()=>performance.now();var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var _emscripten_run_script=ptr=>{eval(UTF8ToString(ptr))};var _fd_close=fd=>52;function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}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()){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{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var jstoi_q=str=>parseInt(str);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 _strptime=(buf,format,tm)=>{var pattern=UTF8ToString(format);var SPECIAL_CHARS="\\!@#$^&*()+=-[]/{}|:<>?,.";for(var i=0,ii=SPECIAL_CHARS.length;i<ii;++i){pattern=pattern.replace(new RegExp("\\"+SPECIAL_CHARS[i],"g"),"\\"+SPECIAL_CHARS[i])}var EQUIVALENT_MATCHERS={A:"%a",B:"%b",c:"%a %b %d %H:%M:%S %Y",D:"%m\\/%d\\/%y",e:"%d",F:"%Y-%m-%d",h:"%b",R:"%H\\:%M",r:"%I\\:%M\\:%S\\s%p",T:"%H\\:%M\\:%S",x:"%m\\/%d\\/(?:%y|%Y)",X:"%H\\:%M\\:%S"};var DATE_PATTERNS={a:"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)",b:"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)",C:"\\d\\d",d:"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31",H:"\\d(?!\\d)|[0,1]\\d|20|21|22|23",I:"\\d(?!\\d)|0\\d|10|11|12",j:"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d",m:"0[1-9]|[1-9](?!\\d)|10|11|12",M:"0\\d|\\d(?!\\d)|[1-5]\\d",n:" ",p:"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.",S:"0\\d|\\d(?!\\d)|[1-5]\\d|60",U:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",W:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",w:"[0-6]",y:"\\d\\d",Y:"\\d\\d\\d\\d",t:" ",z:"Z|(?:[\\+\\-]\\d\\d:?(?:\\d\\d)?)"};var MONTH_NUMBERS={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11};var DAY_NUMBERS_SUN_FIRST={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};var DAY_NUMBERS_MON_FIRST={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};var capture=[];var pattern_out=pattern.replace(/%(.)/g,(m,c)=>EQUIVALENT_MATCHERS[c]||m).replace(/%(.)/g,(_,c)=>{let pat=DATE_PATTERNS[c];if(pat){capture.push(c);return`(${pat})`}else{return c}}).replace(/\s+/g,"\\s*");var matches=new RegExp("^"+pattern_out,"i").exec(UTF8ToString(buf));function initDate(){function fixup(value,min,max){return typeof value!="number"||isNaN(value)?min:value>=min?value<=max?value:max:min}return{year:fixup(HEAP32[tm+20>>2]+1900,1970,9999),month:fixup(HEAP32[tm+16>>2],0,11),day:fixup(HEAP32[tm+12>>2],1,31),hour:fixup(HEAP32[tm+8>>2],0,23),min:fixup(HEAP32[tm+4>>2],0,59),sec:fixup(HEAP32[tm>>2],0,59),gmtoff:0}}if(matches){var date=initDate();var value;var getMatch=symbol=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1]}return};if(value=getMatch("S")){date.sec=jstoi_q(value)}if(value=getMatch("M")){date.min=jstoi_q(value)}if(value=getMatch("H")){date.hour=jstoi_q(value)}else if(value=getMatch("I")){var hour=jstoi_q(value);if(value=getMatch("p")){hour+=value.toUpperCase()[0]==="P"?12:0}date.hour=hour}if(value=getMatch("Y")){date.year=jstoi_q(value)}else if(value=getMatch("y")){var year=jstoi_q(value);if(value=getMatch("C")){year+=jstoi_q(value)*100}else{year+=year<69?2e3:1900}date.year=year}if(value=getMatch("m")){date.month=jstoi_q(value)-1}else if(value=getMatch("b")){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0}if(value=getMatch("d")){date.day=jstoi_q(value)}else if(value=getMatch("j")){var day=jstoi_q(value);var leapYear=isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=arraySum(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth}}}else if(value=getMatch("a")){var weekDay=value.substring(0,3).toUpperCase();if(value=getMatch("U")){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}else if(value=getMatch("W")){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}}if(value=getMatch("z")){if(value.toLowerCase()==="z"){date.gmtoff=0}else{var match=value.match(/^((?:\-|\+)\d\d):?(\d\d)?/);date.gmtoff=match[1]*3600;if(match[2]){date.gmtoff+=date.gmtoff>0?match[2]*60:-match[2]*60}}}var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[tm>>2]=fullDate.getSeconds();HEAP32[tm+4>>2]=fullDate.getMinutes();HEAP32[tm+8>>2]=fullDate.getHours();HEAP32[tm+12>>2]=fullDate.getDate();HEAP32[tm+16>>2]=fullDate.getMonth();HEAP32[tm+20>>2]=fullDate.getFullYear()-1900;HEAP32[tm+24>>2]=fullDate.getDay();HEAP32[tm+28>>2]=arraySum(isLeapYear(fullDate.getFullYear())?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[tm+32>>2]=0;HEAP32[tm+36>>2]=date.gmtoff;return buf+intArrayFromString(matches[0]).length-1}return 0};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))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==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};var cwrap=(ident,returnType,argTypes,opts)=>{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)};embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");var wasmImports={a:___assert_fail,d:___cxa_throw,D:__abort_js,C:__embind_register_bigint,K:__embind_register_bool,J:__embind_register_emval,u:__embind_register_float,m:__embind_register_function,h:__embind_register_integer,c:__embind_register_memory_view,t:__embind_register_std_string,q:__embind_register_std_wstring,L:__embind_register_void,H:__emscripten_get_now_is_monotonic,I:__emscripten_memcpy_js,o:__emval_as,r:__emval_call,i:__emval_call_method,b:__emval_decref,f:__emval_get_global,g:__emval_get_method_caller,y:__emval_get_module_property,v:__emval_get_property,z:__emval_incref,n:__emval_new_cstring,e:__emval_run_destructors,x:__emval_set_property,k:__emval_take_value,B:__mktime_js,G:__tzset_js,j:_emscripten_asm_const_int,l:_emscripten_date_now,p:_emscripten_get_now,E:_emscripten_resize_heap,M:_emscripten_run_script,F:_fd_close,A:_fd_seek,s:_fd_write,w:_strptime};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["O"])();var _main=Module["_main"]=(a0,a1)=>(_main=Module["_main"]=wasmExports["P"])(a0,a1);var _aux_freeMemory=Module["_aux_freeMemory"]=a0=>(_aux_freeMemory=Module["_aux_freeMemory"]=wasmExports["Q"])(a0);var _free=a0=>(_free=wasmExports["R"])(a0);var _aux_allocMemory=Module["_aux_allocMemory"]=a0=>(_aux_allocMemory=Module["_aux_allocMemory"]=wasmExports["S"])(a0);var _malloc=a0=>(_malloc=wasmExports["T"])(a0);var _setCode1DChecksum=Module["_setCode1DChecksum"]=(a0,a1,a2)=>(_setCode1DChecksum=Module["_setCode1DChecksum"]=wasmExports["U"])(a0,a1,a2);var _initialize=Module["_initialize"]=a0=>(_initialize=Module["_initialize"]=wasmExports["V"])(a0);var _inf_BKgetVersion=Module["_inf_BKgetVersion"]=()=>(_inf_BKgetVersion=Module["_inf_BKgetVersion"]=wasmExports["W"])();var _cfg_BKSetRegionOfInterest=Module["_cfg_BKSetRegionOfInterest"]=(a0,a1,a2,a3)=>(_cfg_BKSetRegionOfInterest=Module["_cfg_BKSetRegionOfInterest"]=wasmExports["X"])(a0,a1,a2,a3);var _cfg_BKGetRegionOfInterest=Module["_cfg_BKGetRegionOfInterest"]=()=>(_cfg_BKGetRegionOfInterest=Module["_cfg_BKGetRegionOfInterest"]=wasmExports["Y"])();var _cfg_BKSetDecodingSpeed=Module["_cfg_BKSetDecodingSpeed"]=a0=>(_cfg_BKSetDecodingSpeed=Module["_cfg_BKSetDecodingSpeed"]=wasmExports["Z"])(a0);var _cfg_BKSetEnabledDecoders=Module["_cfg_BKSetEnabledDecoders"]=(a0,a1)=>(_cfg_BKSetEnabledDecoders=Module["_cfg_BKSetEnabledDecoders"]=wasmExports["_"])(a0,a1);var _cfg_BKSetEnabledDecodersPro=Module["_cfg_BKSetEnabledDecodersPro"]=a0=>(_cfg_BKSetEnabledDecodersPro=Module["_cfg_BKSetEnabledDecodersPro"]=wasmExports["$"])(a0);var _cfg_BKSetUpcEanDeblur=Module["_cfg_BKSetUpcEanDeblur"]=a0=>(_cfg_BKSetUpcEanDeblur=Module["_cfg_BKSetUpcEanDeblur"]=wasmExports["aa"])(a0);var _cfg_BKSetLengthRange=Module["_cfg_BKSetLengthRange"]=(a0,a1,a2)=>(_cfg_BKSetLengthRange=Module["_cfg_BKSetLengthRange"]=wasmExports["ba"])(a0,a1,a2);var _cfg_BKSetSpecificConfig=Module["_cfg_BKSetSpecificConfig"]=(a0,a1)=>(_cfg_BKSetSpecificConfig=Module["_cfg_BKSetSpecificConfig"]=wasmExports["ca"])(a0,a1);var _cfg_BKSetFormatting=Module["_cfg_BKSetFormatting"]=a0=>(_cfg_BKSetFormatting=Module["_cfg_BKSetFormatting"]=wasmExports["da"])(a0);var _cfg_BKSetDuplicatesDelayMs=Module["_cfg_BKSetDuplicatesDelayMs"]=a0=>(_cfg_BKSetDuplicatesDelayMs=Module["_cfg_BKSetDuplicatesDelayMs"]=wasmExports["ea"])(a0);var _cfg_BKSetEncodingCharacterSet=Module["_cfg_BKSetEncodingCharacterSet"]=a0=>(_cfg_BKSetEncodingCharacterSet=Module["_cfg_BKSetEncodingCharacterSet"]=wasmExports["fa"])(a0);var _cfg_BKSetMulticodeCachingEnabled=Module["_cfg_BKSetMulticodeCachingEnabled"]=a0=>(_cfg_BKSetMulticodeCachingEnabled=Module["_cfg_BKSetMulticodeCachingEnabled"]=wasmExports["ga"])(a0);var _cfg_BKSetMulticodeCachingDuration=Module["_cfg_BKSetMulticodeCachingDuration"]=a0=>(_cfg_BKSetMulticodeCachingDuration=Module["_cfg_BKSetMulticodeCachingDuration"]=wasmExports["ha"])(a0);var _cfg_BKSetMaximumResultsCount=Module["_cfg_BKSetMaximumResultsCount"]=a0=>(_cfg_BKSetMaximumResultsCount=Module["_cfg_BKSetMaximumResultsCount"]=wasmExports["ia"])(a0);var _cfg_BKSetEnableMisshaped1D=Module["_cfg_BKSetEnableMisshaped1D"]=a0=>(_cfg_BKSetEnableMisshaped1D=Module["_cfg_BKSetEnableMisshaped1D"]=wasmExports["ja"])(a0);var _cfg_BKSetEnableVINRestrictions=Module["_cfg_BKSetEnableVINRestrictions"]=a0=>(_cfg_BKSetEnableVINRestrictions=Module["_cfg_BKSetEnableVINRestrictions"]=wasmExports["ka"])(a0);var _cfg_BKReturnDecodingSpeed=Module["_cfg_BKReturnDecodingSpeed"]=()=>(_cfg_BKReturnDecodingSpeed=Module["_cfg_BKReturnDecodingSpeed"]=wasmExports["la"])();var _cfg_BKReturnUpcEanDeblur=Module["_cfg_BKReturnUpcEanDeblur"]=()=>(_cfg_BKReturnUpcEanDeblur=Module["_cfg_BKReturnUpcEanDeblur"]=wasmExports["ma"])();var _cfg_BKReturnFormatting=Module["_cfg_BKReturnFormatting"]=()=>(_cfg_BKReturnFormatting=Module["_cfg_BKReturnFormatting"]=wasmExports["na"])();var _cfg_BKReturnDuplicatesDelayMs=Module["_cfg_BKReturnDuplicatesDelayMs"]=()=>(_cfg_BKReturnDuplicatesDelayMs=Module["_cfg_BKReturnDuplicatesDelayMs"]=wasmExports["oa"])();var _cfg_BKReturnEncodingCharacterSet=Module["_cfg_BKReturnEncodingCharacterSet"]=()=>(_cfg_BKReturnEncodingCharacterSet=Module["_cfg_BKReturnEncodingCharacterSet"]=wasmExports["pa"])();var _cfg_BKReturnSpecificConfig=Module["_cfg_BKReturnSpecificConfig"]=a0=>(_cfg_BKReturnSpecificConfig=Module["_cfg_BKReturnSpecificConfig"]=wasmExports["qa"])(a0);var _cfg_BKReturnBarcodeTypeEnabled=Module["_cfg_BKReturnBarcodeTypeEnabled"]=a0=>(_cfg_BKReturnBarcodeTypeEnabled=Module["_cfg_BKReturnBarcodeTypeEnabled"]=wasmExports["ra"])(a0);var _cfg_BKSetBarcodeTypeEnabled=Module["_cfg_BKSetBarcodeTypeEnabled"]=(a0,a1)=>(_cfg_BKSetBarcodeTypeEnabled=Module["_cfg_BKSetBarcodeTypeEnabled"]=wasmExports["sa"])(a0,a1);var _cfg_BKReturnLengthRange=Module["_cfg_BKReturnLengthRange"]=a0=>(_cfg_BKReturnLengthRange=Module["_cfg_BKReturnLengthRange"]=wasmExports["ta"])(a0);var _cfg_BKReturnMulticodeCachingEnabled=Module["_cfg_BKReturnMulticodeCachingEnabled"]=()=>(_cfg_BKReturnMulticodeCachingEnabled=Module["_cfg_BKReturnMulticodeCachingEnabled"]=wasmExports["ua"])();var _cfg_BKReturnMulticodeCachingDuration=Module["_cfg_BKReturnMulticodeCachingDuration"]=()=>(_cfg_BKReturnMulticodeCachingDuration=Module["_cfg_BKReturnMulticodeCachingDuration"]=wasmExports["va"])();var _cfg_BKGetMaximumResultsCount=Module["_cfg_BKGetMaximumResultsCount"]=()=>(_cfg_BKGetMaximumResultsCount=Module["_cfg_BKGetMaximumResultsCount"]=wasmExports["wa"])();var _cfg_BKReturnEnableMisshaped1D=Module["_cfg_BKReturnEnableMisshaped1D"]=()=>(_cfg_BKReturnEnableMisshaped1D=Module["_cfg_BKReturnEnableMisshaped1D"]=wasmExports["xa"])();var _cfg_BKReturnEnableVINRestrictions=Module["_cfg_BKReturnEnableVINRestrictions"]=()=>(_cfg_BKReturnEnableVINRestrictions=Module["_cfg_BKReturnEnableVINRestrictions"]=wasmExports["ya"])();var _api_BKDecodeImageMemory=Module["_api_BKDecodeImageMemory"]=(a0,a1,a2,a3)=>(_api_BKDecodeImageMemory=Module["_api_BKDecodeImageMemory"]=wasmExports["za"])(a0,a1,a2,a3);var ___getTypeName=a0=>(___getTypeName=wasmExports["Ba"])(a0);var __emscripten_tempret_set=a0=>(__emscripten_tempret_set=wasmExports["Ca"])(a0);var __emscripten_stack_restore=a0=>(__emscripten_stack_restore=wasmExports["Da"])(a0);var __emscripten_stack_alloc=a0=>(__emscripten_stack_alloc=wasmExports["Ea"])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports["Fa"])();var dynCall_jiji=Module["dynCall_jiji"]=(a0,a1,a2,a3,a4)=>(dynCall_jiji=Module["dynCall_jiji"]=wasmExports["Ga"])(a0,a1,a2,a3,a4);Module["ccall"]=ccall;Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args=[]){var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(arg=>{HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args=arguments_){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();Module["onRuntimeInitialized"]?.();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>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()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();}
|
|
176
|
+
window.BarkoderSDK_callback1D=undefined;Common.debugMessage("Init",`Stage 1 took ${timeCounter}ms`,true);Connector.moduleLoaded=true;setTimeout(()=>{document.dispatchEvent(Connector.scannerEvent)},40);}],print:function(text){Common.debugMessage("Module",text,1);}};if(has_SIMD){var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){if(typeof process=="undefined"||!process.release||process.release.name!=="node")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var nodeVersion=process.versions.node;var numericVersion=nodeVersion.split(".").slice(0,3);numericVersion=numericVersion[0]*1e4+numericVersion[1]*100+numericVersion[2].split("-")[0]*1;if(numericVersion<16e4){throw new Error("This emscripten-generated code requires node v16.0.0 (detected v"+nodeVersion+")")}var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);assert(Buffer.isBuffer(ret));return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");assert(binary?Buffer.isBuffer(ret):typeof ret=="string");return ret};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_SHELL){if(typeof process=="object"&&typeof require==="function"||typeof window=="object"||typeof WorkerGlobalScope!="undefined")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}if(!(typeof window=="object"||typeof WorkerGlobalScope!="undefined"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{throw new Error("environment detection error")}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module["arguments"])arguments_=Module["arguments"];legacyModuleProp("arguments","arguments_");if(Module["thisProgram"])thisProgram=Module["thisProgram"];legacyModuleProp("thisProgram","thisProgram");assert(typeof Module["memoryInitializerPrefixURL"]=="undefined","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["pthreadMainPrefixURL"]=="undefined","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["cdInitializerPrefixURL"]=="undefined","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["filePackagePrefixURL"]=="undefined","Module.filePackagePrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["read"]=="undefined","Module.read option was removed");assert(typeof Module["readAsync"]=="undefined","Module.readAsync option was removed (modify readAsync in JS)");assert(typeof Module["readBinary"]=="undefined","Module.readBinary option was removed (modify readBinary in JS)");assert(typeof Module["setWindowTitle"]=="undefined","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");assert(typeof Module["TOTAL_MEMORY"]=="undefined","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");legacyModuleProp("asm","wasmExports");legacyModuleProp("readAsync","readAsync");legacyModuleProp("readBinary","readBinary");legacyModuleProp("setWindowTitle","setWindowTitle");assert(!ENVIRONMENT_IS_SHELL,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var wasmBinary=Module["wasmBinary"];legacyModuleProp("wasmBinary","wasmBinary");if(typeof WebAssembly!="object"){err("no native wasm support detected")}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}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed"+(text?": "+text:""))}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;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)}assert(!Module["STACK_SIZE"],"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");assert(typeof Int32Array!="undefined"&&typeof Float64Array!=="undefined"&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,"JS engine does not provide full typed array support");assert(!Module["wasmMemory"],"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally");assert(!Module["INITIAL_MEMORY"],"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);if(max==0){max+=4}HEAPU32[max>>2]=34821223;HEAPU32[max+4>>2]=2310721022;HEAPU32[0>>2]=1668509029}function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();if(max==0){max+=4}var cookie1=HEAPU32[max>>2];var cookie2=HEAPU32[max+4>>2];if(cookie1!=34821223||cookie2!=2310721022){abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`)}if(HEAPU32[0>>2]!=1668509029){abort("Runtime error: The application has corrupted its heap memory area (address zero)!")}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=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(){assert(!runtimeInitialized);runtimeInitialized=true;checkStackCookie();if(!Module["noFSInit"]&&!FS.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();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 addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}assert(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var runDependencies=0;var dependenciesFulfilled=null;var runDependencyTracking={};var runDependencyWatcher=null;function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!="undefined"){runDependencyWatcher=setInterval(()=>{if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err("still waiting on run dependencies:")}err(`dependency: ${dep}`)}if(shown){err("(end of list)")}},1e4)}}else{err("warning: run dependency added without ID")}}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{err("warning: run dependency removed without ID")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function createExportWrapper(name,nargs){return(...args)=>{assert(runtimeInitialized,`native function \`${name}\` called before runtime initialization`);var f=wasmExports[name];assert(f,`exported native function \`${name}\` not found`);assert(args.length<=nargs,`native function \`${name}\` called with ${args.length} args but expects ${nargs}`);return f(...args)}}class EmscriptenEH extends Error{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super(excPtr);this.excPtr=excPtr;const excInfo=getExceptionMessage(excPtr);this.name=excInfo[0];this.message=excInfo[1]}}function findWasmBinary(){var f="barkoder.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;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"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);if(isFileURI(wasmBinaryFile)){err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`)}abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["memory"];assert(wasmMemory,"memory not found in wasm exports");updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];assert(wasmTable,"table not found in wasm exports");addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");trueModule=null;receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);receiveInstantiationResult(result);return result}(()=>{var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=25459;if(h8[0]!==115||h8[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();if(Module["ENVIRONMENT"]){throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)")}function legacyModuleProp(prop,newName,incoming=true){if(!Object.getOwnPropertyDescriptor(Module,prop)){Object.defineProperty(Module,prop,{configurable:true,get(){let extra=incoming?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":"";abort(`\`Module.${prop}\` has been replaced by \`${newName}\``+extra)}})}}function ignoredModuleProp(prop){if(Object.getOwnPropertyDescriptor(Module,prop)){abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`)}}function isExportedByForceFilesystem(name){return name==="FS_createPath"||name==="FS_createDataFile"||name==="FS_createPreloadedFile"||name==="FS_unlink"||name==="addRunDependency"||name==="FS_createLazyFile"||name==="FS_createDevice"||name==="removeRunDependency"}function hookGlobalSymbolAccess(sym,func){if(typeof globalThis!="undefined"&&!Object.getOwnPropertyDescriptor(globalThis,sym)){Object.defineProperty(globalThis,sym,{configurable:true,get(){func();return undefined}})}}function missingGlobal(sym,msg){hookGlobalSymbolAccess(sym,()=>{warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`)})}missingGlobal("buffer","Please use HEAP8.buffer or wasmMemory.buffer");missingGlobal("asm","Please use wasmExports instead");function missingLibrarySymbol(sym){hookGlobalSymbolAccess(sym,()=>{var msg=`\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;var librarySymbol=sym;if(!librarySymbol.startsWith("_")){librarySymbol="$"+sym}msg+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}warnOnce(msg)});unexportedRuntimeSymbol(sym)}function unexportedRuntimeSymbol(sym){if(!Object.getOwnPropertyDescriptor(Module,sym)){Object.defineProperty(Module,sym,{configurable:true,get(){var msg=`'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}abort(msg)}})}}var ASM_CONSTS={3516632:()=>{window.BarkoderSDK_callback2D=true},3516670:()=>{window.BarkoderSDK_callback3D=true},3516708:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},3516763:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},3516818:()=>{window.BarkoderSDK_callback1D=true},3516856:$0=>{window.BarkoderSDK_frameDecoding=true;window.BarkoderSDK_currentFrame=$0},3516939:($0,$1,$2,$3,$4)=>{if(typeof Module=="undefined"||!Module.MountedFiles){return 1}let fileName=UTF8ToString(Number($0>>>0));if(fileName.startsWith("./")){fileName=fileName.substring(2)}const fileData=Module.MountedFiles.get(fileName);if(!fileData){return 2}const offset=Number($1>>>0);const length=Number($2>>>0);const dataIdOrBuffer=Number($3>>>0);const loadType=$4;if(offset+length>fileData.byteLength){return 3}try{const data=fileData.subarray(offset,offset+length);switch(loadType){case 0:HEAPU8.set(data,dataIdOrBuffer);break;case 1:Module.jsepUploadExternalBuffer(dataIdOrBuffer,data);break;default:return 4}return 0}catch{return 4}}};class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var ptrToString=ptr=>{assert(typeof ptr==="number");ptr>>>=0;return"0x"+ptr.toString(16).padStart(8,"0")};var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{if((u0&248)!=240)warnOnce("Invalid UTF-8 leading byte "+ptrToString(u0)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!");u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>{assert(typeof ptr=="number",`UTF8ToString expects a number (got ${typeof ptr})`);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 exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);___cxa_increment_exception_refcount(ptr);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);assert(exceptionCaught.length>0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=new CppException(ptr)}throw exceptionLast};var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast?.excPtr;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_rethrow=()=>{var info=exceptionCaught.pop();if(!info){abort("no exception to throw")}var ptr=info.excPtr;if(!info.get_rethrown()){exceptionCaught.push(info);info.set_rethrown(true);info.set_caught(false);uncaughtExceptionCount++}exceptionLast=new CppException(ptr);throw exceptionLast};var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=new CppException(ptr);uncaughtExceptionCount++;throw exceptionLast};var ___cxa_uncaught_exceptions=()=>uncaughtExceptionCount;var syscallGetVarargI=()=>{assert(SYSCALLS.varargs!=undefined);var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{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(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";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){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{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 initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")};var randomFill=view=>(randomFill=initRandomFill())(view);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();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}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){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{assert(typeof str==="string",`stringToUTF8Array expects a string (got ${typeof str})`);if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>1114111)warnOnce("Invalid Unicode code point "+ptrToString(u)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};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){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],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){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){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.atime=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.mtime=stream.node.ctime=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));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var zeroMemory=(address,size)=>{HEAPU8.fill(0,address,address+size)};var alignMemory=(size,alignment)=>{assert(alignment,"alignment argument is required");return Math.ceil(size/alignment)*alignment};var mmapAlloc=size=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){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;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.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};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.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw new FS.ErrnoError(44)},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=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.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|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);assert(size>=0);if(size>8&&contents.subarray){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){assert(!(buffer instanceof ArrayBuffer));if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){assert(position===0,"canOwn must imply no weird position inside the file");node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}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;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){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)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);return new Uint8Array(arrayBuffer)};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)=>{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)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${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).then(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 strError=errno=>UTF8ToString(_strerror(errno));var ERRNO_CODES={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class extends Error{name="ErrnoError";constructor(errno){super(runtimeInitialized?strError(errno):"");this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{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{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}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={}){if(!path)return{path:"",node:null};opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p&&p!==".");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){break}if(parts[i]===".."){current_path=PATH.dirname(current_path);current=current.parent;continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},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}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){assert(typeof parent=="object");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}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){if(!FS.isDir(dir.mode)){return 54}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"||flags&512){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){assert(fd>=-1);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);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,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){assert(FS.syncFSRequests>0);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)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){if(typeof type=="string"){throw type}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;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:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;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)}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}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);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)},statfs(path){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};var parent=FS.lookupPath(path,{follow:true}).node;if(parent?.node_ops.statfs){Object.assign(rtn,parent.node_ops.statfs(parent.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){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}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);var lookup,old_dir,new_dir;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);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}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(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{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){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 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,ctime: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()})},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,{atime,mtime})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){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;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){assert(offset>=0);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){assert(offset>=0);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){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){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)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){assert(offset>=0);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)}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(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));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));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);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){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",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};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},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1);assert(stdin.fd===0,`invalid handle for stdin (${stdin.fd})`);assert(stdout.fd===1,`invalid handle for stdout (${stdout.fd})`);assert(stderr.fd===2,`invalid handle for stderr (${stderr.fd})`)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){assert(!FS.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;_fflush(0);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){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){}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}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);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){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.atime=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.mtime=stream.node.ctime=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{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];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(){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;if(!hasByteServing)chunkSize=datalength;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!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);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(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);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){chunkSize=datalength=1;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}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});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);assert(size>=0);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};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},absolutePath(){abort("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){abort("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){abort("FS.createLink has been removed; use FS.symlink instead")},joinPath(){abort("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){abort("FS.standardizePath has been removed; use PATH.normalize instead")}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return 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 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/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;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){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();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;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}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}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>{assert(typeof maxBytesToWrite=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");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 startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size));for(var idx=startIdx;idx<endIdx;idx++){var id;var type;var name=stream.getdents[idx];if(name==="."){id=stream.node.id;type=4}else if(name===".."){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4}else{var child;try{child=FS.lookupNode(stream.node,name)}catch(e){if(e?.errno===28){continue}throw e}id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8}assert(id);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}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=syscallGetVarargP();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}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();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}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}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_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0}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;assert(!flags,`unknown flags in __syscall_newfstatat: ${flags}`);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?syscallGetVarargI():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);HEAP8[buf+len]=endChar;return len}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}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 __abort_js=()=>abort("native code called abort()");var embindRepr=v=>{if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){if(registeredInstance.argPackAdvance===undefined){throw new TypeError("registerType registeredInstance requires argPackAdvance")}return sharedRegisterType(rawType,registeredInstance,options)}var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);var isUnsignedType=name.indexOf("u")!=-1;if(isUnsignedType){maxRange=(1n<<64n)-1n}registerType(primitiveType,{name,fromWireType:value=>value,toWireType:function(destructors,value){if(typeof value!="bigint"&&typeof value!="number"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${this.name}`)}if(typeof value=="number"){value=BigInt(value)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){assert(emval_handles[handle]!==undefined,`Decref for unallocated handle.`);emval_handles[handle]=undefined;emval_freelist.push(handle)}};var count_emval_handles=()=>emval_handles.length/2-5-emval_freelist.length;var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1);assert(emval_handles.length===5*2);Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}assert(handle===2||emval_handles[handle]!==undefined&&handle%2===0,`invalid handle: ${handle}`);return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,body)=>Object.defineProperty(body,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`)}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function checkArgCount(numArgs,minArgs,maxArgs,humanName,throwBindingError){if(numArgs<minArgs||numArgs>maxArgs){var argCountMessage=minArgs==maxArgs?minArgs:`${minArgs} to ${maxArgs}`;throwBindingError(`function ${humanName} called with ${numArgs} arguments, expected ${argCountMessage}`)}}function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired")}for(var i=0;i<argCount;++i){argsList.push(`arg${i}`);argsListWired.push(`arg${i}Wired`)}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody=`return function (${argsList}) {\n`;invokerFnBody+="checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);\n";if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = classParam['toWireType'](${dtorStack}, this);\n`}for(var i=0;i<argCount;++i){invokerFnBody+=`var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});\n`;args1.push(`argType${i}`)}invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`)}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";args1.push("checkArgCount","minArgs","maxArgs");invokerFnBody=`if (arguments.length !== ${args1.length}){ throw new Error(humanName + "Expected ${args1.length} closure arguments " + arguments.length + " given."); }\n${invokerFnBody}`;return[args1,invokerFnBody]}function getRequiredArgCount(argTypes){var requiredArgCount=argTypes.length-2;for(var i=argTypes.length-1;i>=2;--i){if(!argTypes[i].optional){break}requiredArgCount--}return requiredArgCount}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}assert(!isAsync,"Async bindings are only supported with JSPI.");var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var expectedArgCount=argCount-2;var minArgs=getRequiredArgCount(argTypes);var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2])}if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction)}}}closureArgs.push(checkArgCount,minArgs,expectedArgCount);let[args,invokerFnBody]=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);args.push(invokerFnBody);var invokerFn=newFunc(Function,args)(...closureArgs);return createNamedFunction(humanName,invokerFn)}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){assert(signature[signature.length-1]==")","Parentheses for argument names should match.");return signature.substr(0,argsIndex)}else{return signature}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${toTypeName}`)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name,fromWireType,toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i])}str=a.join("")}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i]}}}if(destructors!==null){destructors.push(_free,base)}return base},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{assert(ptr%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{assert(ptr%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=pointer=>HEAPU16[pointer>>1]}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=pointer=>HEAPU32[pointer>>2]}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var __emscripten_fs_load_embedded_files=ptr=>{do{var name_addr=HEAPU32[ptr>>2];ptr+=4;var len=HEAPU32[ptr>>2];ptr+=4;var content=HEAPU32[ptr>>2];ptr+=4;var name=UTF8ToString(name_addr);FS.createPath("/",PATH.dirname(name),true,true);FS.createDataFile(name,null,HEAP8.subarray(content,content+len),true,true,true)}while(HEAPU32[ptr>>2])};var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle)};var emval_methodCallers=[];var __emval_call=(caller,handle,destructorsRef,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i)}return a};var reflectConstruct=Reflect.construct;var __emval_get_method_caller=(argCount,argTypes,kind)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody=`return function (obj, func, destructorsRef, args) {\n`;var offset=0;var argsList=[];if(kind===0){argsList.push("obj")}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=` var arg${i} = argType${i}.readValueFromPointer(args${offset?"+"+offset:""});\n`;offset+=types[i].argPackAdvance}var invoker=kind===1?"new func":"func.call";functionBody+=` var rv = ${invoker}(${argsList.join(", ")});\n`;if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n"}functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params)(...args);var functionName=`methodCaller<(${types.map(t=>t.name).join(", ")}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction))};var __emval_get_module_property=name=>{name=getStringOrSymbol(name);return Emval.toHandle(Module[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)};var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function __gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);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)/(1e3*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;return yday};function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);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);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}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;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.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1}return timeMs/1e3})();return BigInt(ret)};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)=>{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();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);assert(winterName);assert(summerName);assert(lengthBytesUTF8(winterName)<=16,`timezone name truncated to fit in TZNAME_MAX (${winterName})`);assert(lengthBytesUTF8(summerName)<=16,`timezone name truncated to fit in TZNAME_MAX (${summerName})`);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_get_now=()=>performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{assert(Array.isArray(readEmAsmArgsArray));assert(buf%16==0);readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var chr=String.fromCharCode(ch);var validChars=["d","f","i","p"];validChars.push("j");assert(validChars.includes(chr),`Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);assert(ASM_CONSTS.hasOwnProperty(code),`No EM_ASM constant found at address ${code}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`)}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;assert(requestedSize>oldSize);var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);return false};var _emscripten_run_script=ptr=>{eval(UTF8ToString(ptr))};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){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()};for(var x in ENV){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){assert(str.charCodeAt(i)===(str.charCodeAt(i)&255));HEAP8[buffer++]=str.charCodeAt(i)}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};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))};var exitJS=(status,implicit)=>{EXITSTATUS=status;checkUnflushedContent();if(keepRuntimeAlive()&&!implicit){var msg=`program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;err(msg)}_proc_exit(status)};var _exit=exitJS;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}}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;if(typeof offset!="undefined"){offset+=curr}}return ret};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;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}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(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};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 arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}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()){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{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var jstoi_q=str=>parseInt(str);var _strptime=(buf,format,tm)=>{var pattern=UTF8ToString(format);var SPECIAL_CHARS="\\!@#$^&*()+=-[]/{}|:<>?,.";for(var i=0,ii=SPECIAL_CHARS.length;i<ii;++i){pattern=pattern.replace(new RegExp("\\"+SPECIAL_CHARS[i],"g"),"\\"+SPECIAL_CHARS[i])}var EQUIVALENT_MATCHERS={A:"%a",B:"%b",c:"%a %b %d %H:%M:%S %Y",D:"%m\\/%d\\/%y",e:"%d",F:"%Y-%m-%d",h:"%b",R:"%H\\:%M",r:"%I\\:%M\\:%S\\s%p",T:"%H\\:%M\\:%S",x:"%m\\/%d\\/(?:%y|%Y)",X:"%H\\:%M\\:%S"};var DATE_PATTERNS={a:"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)",b:"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)",C:"\\d\\d",d:"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31",H:"\\d(?!\\d)|[0,1]\\d|20|21|22|23",I:"\\d(?!\\d)|0\\d|10|11|12",j:"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d",m:"0[1-9]|[1-9](?!\\d)|10|11|12",M:"0\\d|\\d(?!\\d)|[1-5]\\d",n:" ",p:"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.",S:"0\\d|\\d(?!\\d)|[1-5]\\d|60",U:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",W:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",w:"[0-6]",y:"\\d\\d",Y:"\\d\\d\\d\\d",t:" ",z:"Z|(?:[\\+\\-]\\d\\d:?(?:\\d\\d)?)"};var MONTH_NUMBERS={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11};var DAY_NUMBERS_SUN_FIRST={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};var DAY_NUMBERS_MON_FIRST={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};var capture=[];var pattern_out=pattern.replace(/%(.)/g,(m,c)=>EQUIVALENT_MATCHERS[c]||m).replace(/%(.)/g,(_,c)=>{let pat=DATE_PATTERNS[c];if(pat){capture.push(c);return`(${pat})`}else{return c}}).replace(/\s+/g,"\\s*");var matches=new RegExp("^"+pattern_out,"i").exec(UTF8ToString(buf));function initDate(){function fixup(value,min,max){return typeof value!="number"||isNaN(value)?min:value>=min?value<=max?value:max:min}return{year:fixup(HEAP32[tm+20>>2]+1900,1970,9999),month:fixup(HEAP32[tm+16>>2],0,11),day:fixup(HEAP32[tm+12>>2],1,31),hour:fixup(HEAP32[tm+8>>2],0,23),min:fixup(HEAP32[tm+4>>2],0,59),sec:fixup(HEAP32[tm>>2],0,59),gmtoff:0}}if(matches){var date=initDate();var value;var getMatch=symbol=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1]}return};if(value=getMatch("S")){date.sec=jstoi_q(value)}if(value=getMatch("M")){date.min=jstoi_q(value)}if(value=getMatch("H")){date.hour=jstoi_q(value)}else if(value=getMatch("I")){var hour=jstoi_q(value);if(value=getMatch("p")){hour+=value.toUpperCase()[0]==="P"?12:0}date.hour=hour}if(value=getMatch("Y")){date.year=jstoi_q(value)}else if(value=getMatch("y")){var year=jstoi_q(value);if(value=getMatch("C")){year+=jstoi_q(value)*100}else{year+=year<69?2e3:1900}date.year=year}if(value=getMatch("m")){date.month=jstoi_q(value)-1}else if(value=getMatch("b")){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0}if(value=getMatch("d")){date.day=jstoi_q(value)}else if(value=getMatch("j")){var day=jstoi_q(value);var leapYear=isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=arraySum(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth}}}else if(value=getMatch("a")){var weekDay=value.substring(0,3).toUpperCase();if(value=getMatch("U")){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}else if(value=getMatch("W")){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}}if(value=getMatch("z")){if(value.toLowerCase()==="z"){date.gmtoff=0}else{var match=value.match(/^((?:\-|\+)\d\d):?(\d\d)?/);date.gmtoff=match[1]*3600;if(match[2]){date.gmtoff+=date.gmtoff>0?match[2]*60:-match[2]*60}}}var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[tm>>2]=fullDate.getSeconds();HEAP32[tm+4>>2]=fullDate.getMinutes();HEAP32[tm+8>>2]=fullDate.getHours();HEAP32[tm+12>>2]=fullDate.getDate();HEAP32[tm+16>>2]=fullDate.getMonth();HEAP32[tm+20>>2]=fullDate.getFullYear()-1900;HEAP32[tm+24>>2]=fullDate.getDay();HEAP32[tm+28>>2]=arraySum(isLeapYear(fullDate.getFullYear())?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[tm+32>>2]=0;HEAP32[tm+36>>2]=date.gmtoff;return buf+intArrayFromString(matches[0]).length-1}return 0};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}checkStackCookie();if(e instanceof WebAssembly.RuntimeError){if(_emscripten_stack_get_current()<=0){err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 5242880)")}}quit_(1,e)};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func};var writeArrayToMemory=(array,buffer)=>{assert(array.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)");HEAP8.set(array,buffer)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==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;assert(returnType!=="array",'Return type should not be "array".');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};var cwrap=(ident,returnType,argTypes,opts)=>(...args)=>ccall(ident,returnType,argTypes,args,opts);var FS_createPath=FS.createPath;var FS_unlink=path=>FS.unlink(path);var FS_createLazyFile=FS.createLazyFile;var FS_createDevice=FS.createDevice;var incrementExceptionRefcount=ptr=>___cxa_increment_exception_refcount(ptr);Module["incrementExceptionRefcount"]=incrementExceptionRefcount;var decrementExceptionRefcount=ptr=>___cxa_decrement_exception_refcount(ptr);Module["decrementExceptionRefcount"]=decrementExceptionRefcount;var getExceptionMessageCommon=ptr=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[type_addr_addr>>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}stackRestore(sp);return[type,message]};var getExceptionMessage=ptr=>getExceptionMessageCommon(ptr);Module["getExceptionMessage"]=getExceptionMessage;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();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;embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");function checkIncomingModuleAPI(){ignoredModuleProp("fetchSettings")}var wasmImports={__assert_fail:___assert_fail,__cxa_begin_catch:___cxa_begin_catch,__cxa_end_catch:___cxa_end_catch,__cxa_find_matching_catch_2:___cxa_find_matching_catch_2,__cxa_find_matching_catch_3:___cxa_find_matching_catch_3,__cxa_rethrow:___cxa_rethrow,__cxa_throw:___cxa_throw,__cxa_uncaught_exceptions:___cxa_uncaught_exceptions,__resumeException:___resumeException,__syscall_fcntl64:___syscall_fcntl64,__syscall_fstat64:___syscall_fstat64,__syscall_getcwd:___syscall_getcwd,__syscall_getdents64:___syscall_getdents64,__syscall_ioctl:___syscall_ioctl,__syscall_lstat64:___syscall_lstat64,__syscall_mkdirat:___syscall_mkdirat,__syscall_newfstatat:___syscall_newfstatat,__syscall_openat:___syscall_openat,__syscall_readlinkat:___syscall_readlinkat,__syscall_rmdir:___syscall_rmdir,__syscall_stat64:___syscall_stat64,__syscall_unlinkat:___syscall_unlinkat,_abort_js:__abort_js,_embind_register_bigint:__embind_register_bigint,_embind_register_bool:__embind_register_bool,_embind_register_emval:__embind_register_emval,_embind_register_float:__embind_register_float,_embind_register_function:__embind_register_function,_embind_register_integer:__embind_register_integer,_embind_register_memory_view:__embind_register_memory_view,_embind_register_std_string:__embind_register_std_string,_embind_register_std_wstring:__embind_register_std_wstring,_embind_register_void:__embind_register_void,_emscripten_fs_load_embedded_files:__emscripten_fs_load_embedded_files,_emval_as:__emval_as,_emval_call:__emval_call,_emval_call_method:__emval_call_method,_emval_decref:__emval_decref,_emval_get_global:__emval_get_global,_emval_get_method_caller:__emval_get_method_caller,_emval_get_module_property:__emval_get_module_property,_emval_get_property:__emval_get_property,_emval_incref:__emval_incref,_emval_new_cstring:__emval_new_cstring,_emval_run_destructors:__emval_run_destructors,_emval_set_property:__emval_set_property,_emval_take_value:__emval_take_value,_gmtime_js:__gmtime_js,_localtime_js:__localtime_js,_mktime_js:__mktime_js,_mmap_js:__mmap_js,_munmap_js:__munmap_js,_tzset_js:__tzset_js,clock_time_get:_clock_time_get,emscripten_asm_const_int:_emscripten_asm_const_int,emscripten_date_now:_emscripten_date_now,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,emscripten_run_script:_emscripten_run_script,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,fd_close:_fd_close,fd_read:_fd_read,fd_seek:_fd_seek,fd_write:_fd_write,invoke_diii,invoke_fiii,invoke_i,invoke_ii,invoke_iii,invoke_iiii,invoke_iiiii,invoke_iiiiid,invoke_iiiiii,invoke_iiiiiii,invoke_iiiiiiii,invoke_iiiiiiiiiii,invoke_iiiiiiiiiiii,invoke_iiiiiiiiiiiii,invoke_iiiiij,invoke_j,invoke_ji,invoke_jiiii,invoke_v,invoke_vi,invoke_vii,invoke_viif,invoke_viii,invoke_viiii,invoke_viiiiiii,invoke_viiiiiiiiii,invoke_viiiiiiiiiiiiiii,invoke_viijii,strptime:_strptime};var wasmExports;createWasm();var ___wasm_call_ctors=createExportWrapper("__wasm_call_ctors",0);var _malloc=createExportWrapper("malloc",1);var _main=Module["_main"]=createExportWrapper("__main_argc_argv",2);var _aux_freeMemory=Module["_aux_freeMemory"]=createExportWrapper("aux_freeMemory",1);var _free=createExportWrapper("free",1);var _aux_allocMemory=Module["_aux_allocMemory"]=createExportWrapper("aux_allocMemory",1);var _setCode1DChecksum=Module["_setCode1DChecksum"]=createExportWrapper("setCode1DChecksum",3);var _initialize=Module["_initialize"]=createExportWrapper("initialize",1);var _inf_BKgetVersion=Module["_inf_BKgetVersion"]=createExportWrapper("inf_BKgetVersion",0);var _cfg_BKSetRegionOfInterest=Module["_cfg_BKSetRegionOfInterest"]=createExportWrapper("cfg_BKSetRegionOfInterest",4);var _cfg_BKGetRegionOfInterest=Module["_cfg_BKGetRegionOfInterest"]=createExportWrapper("cfg_BKGetRegionOfInterest",0);var _cfg_BKSetDecodingSpeed=Module["_cfg_BKSetDecodingSpeed"]=createExportWrapper("cfg_BKSetDecodingSpeed",1);var _cfg_BKSetEnabledDecoders=Module["_cfg_BKSetEnabledDecoders"]=createExportWrapper("cfg_BKSetEnabledDecoders",2);var _cfg_BKSetEnabledDecodersPro=Module["_cfg_BKSetEnabledDecodersPro"]=createExportWrapper("cfg_BKSetEnabledDecodersPro",1);var _cfg_BKSetUpcEanDeblur=Module["_cfg_BKSetUpcEanDeblur"]=createExportWrapper("cfg_BKSetUpcEanDeblur",1);var _cfg_BKSetLengthRange=Module["_cfg_BKSetLengthRange"]=createExportWrapper("cfg_BKSetLengthRange",3);var _cfg_BKSetSpecificConfig=Module["_cfg_BKSetSpecificConfig"]=createExportWrapper("cfg_BKSetSpecificConfig",3);var _cfg_BKSetFormatting=Module["_cfg_BKSetFormatting"]=createExportWrapper("cfg_BKSetFormatting",1);var _cfg_BKSetDuplicatesDelayMs=Module["_cfg_BKSetDuplicatesDelayMs"]=createExportWrapper("cfg_BKSetDuplicatesDelayMs",1);var _cfg_BKSetEncodingCharacterSet=Module["_cfg_BKSetEncodingCharacterSet"]=createExportWrapper("cfg_BKSetEncodingCharacterSet",1);var _cfg_BKSetMulticodeCachingEnabled=Module["_cfg_BKSetMulticodeCachingEnabled"]=createExportWrapper("cfg_BKSetMulticodeCachingEnabled",1);var _cfg_BKSetMulticodeCachingDuration=Module["_cfg_BKSetMulticodeCachingDuration"]=createExportWrapper("cfg_BKSetMulticodeCachingDuration",1);var _cfg_BKSetMaximumResultsCount=Module["_cfg_BKSetMaximumResultsCount"]=createExportWrapper("cfg_BKSetMaximumResultsCount",1);var _cfg_BKSetEnableMisshaped1D=Module["_cfg_BKSetEnableMisshaped1D"]=createExportWrapper("cfg_BKSetEnableMisshaped1D",1);var _cfg_BKSetEnableVINRestrictions=Module["_cfg_BKSetEnableVINRestrictions"]=createExportWrapper("cfg_BKSetEnableVINRestrictions",1);var _cfg_BKSetEnableComposite=Module["_cfg_BKSetEnableComposite"]=createExportWrapper("cfg_BKSetEnableComposite",1);var _cfg_BKReturnDecodingSpeed=Module["_cfg_BKReturnDecodingSpeed"]=createExportWrapper("cfg_BKReturnDecodingSpeed",0);var _cfg_BKReturnUpcEanDeblur=Module["_cfg_BKReturnUpcEanDeblur"]=createExportWrapper("cfg_BKReturnUpcEanDeblur",0);var _cfg_BKReturnFormatting=Module["_cfg_BKReturnFormatting"]=createExportWrapper("cfg_BKReturnFormatting",0);var _cfg_BKReturnDuplicatesDelayMs=Module["_cfg_BKReturnDuplicatesDelayMs"]=createExportWrapper("cfg_BKReturnDuplicatesDelayMs",0);var _cfg_BKReturnEncodingCharacterSet=Module["_cfg_BKReturnEncodingCharacterSet"]=createExportWrapper("cfg_BKReturnEncodingCharacterSet",0);var _cfg_BKReturnSpecificConfig=Module["_cfg_BKReturnSpecificConfig"]=createExportWrapper("cfg_BKReturnSpecificConfig",2);var _cfg_BKReturnBarcodeTypeEnabled=Module["_cfg_BKReturnBarcodeTypeEnabled"]=createExportWrapper("cfg_BKReturnBarcodeTypeEnabled",1);var _cfg_BKSetBarcodeTypeEnabled=Module["_cfg_BKSetBarcodeTypeEnabled"]=createExportWrapper("cfg_BKSetBarcodeTypeEnabled",2);var _cfg_BKReturnLengthRange=Module["_cfg_BKReturnLengthRange"]=createExportWrapper("cfg_BKReturnLengthRange",1);var _cfg_BKReturnMulticodeCachingEnabled=Module["_cfg_BKReturnMulticodeCachingEnabled"]=createExportWrapper("cfg_BKReturnMulticodeCachingEnabled",0);var _cfg_BKReturnMulticodeCachingDuration=Module["_cfg_BKReturnMulticodeCachingDuration"]=createExportWrapper("cfg_BKReturnMulticodeCachingDuration",0);var _cfg_BKGetMaximumResultsCount=Module["_cfg_BKGetMaximumResultsCount"]=createExportWrapper("cfg_BKGetMaximumResultsCount",0);var _cfg_BKReturnEnableMisshaped1D=Module["_cfg_BKReturnEnableMisshaped1D"]=createExportWrapper("cfg_BKReturnEnableMisshaped1D",0);var _cfg_BKReturnEnableVINRestrictions=Module["_cfg_BKReturnEnableVINRestrictions"]=createExportWrapper("cfg_BKReturnEnableVINRestrictions",0);var _cfg_BKReturnEnableComposite=Module["_cfg_BKReturnEnableComposite"]=createExportWrapper("cfg_BKReturnEnableComposite",0);var _api_BKDecodeImageMemory=Module["_api_BKDecodeImageMemory"]=createExportWrapper("api_BKDecodeImageMemory",4);var _fflush=createExportWrapper("fflush",1);var _strerror=createExportWrapper("strerror",1);var ___getTypeName=createExportWrapper("__getTypeName",1);var _emscripten_builtin_memalign=createExportWrapper("emscripten_builtin_memalign",2);var _setThrew=createExportWrapper("setThrew",2);var __emscripten_tempret_set=createExportWrapper("_emscripten_tempret_set",1);var _emscripten_stack_init=()=>(_emscripten_stack_init=wasmExports["emscripten_stack_init"])();var _emscripten_stack_get_free=()=>(_emscripten_stack_get_free=wasmExports["emscripten_stack_get_free"])();var _emscripten_stack_get_base=()=>(_emscripten_stack_get_base=wasmExports["emscripten_stack_get_base"])();var _emscripten_stack_get_end=()=>(_emscripten_stack_get_end=wasmExports["emscripten_stack_get_end"])();var __emscripten_stack_restore=a0=>(__emscripten_stack_restore=wasmExports["_emscripten_stack_restore"])(a0);var __emscripten_stack_alloc=a0=>(__emscripten_stack_alloc=wasmExports["_emscripten_stack_alloc"])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports["emscripten_stack_get_current"])();var ___cxa_decrement_exception_refcount=createExportWrapper("__cxa_decrement_exception_refcount",1);var ___cxa_increment_exception_refcount=createExportWrapper("__cxa_increment_exception_refcount",1);var ___cxa_free_exception=createExportWrapper("__cxa_free_exception",1);var ___get_exception_message=createExportWrapper("__get_exception_message",3);var ___cxa_can_catch=createExportWrapper("__cxa_can_catch",3);var ___cxa_get_exception_ptr=createExportWrapper("__cxa_get_exception_ptr",1);var ___emscripten_embedded_file_data=Module["___emscripten_embedded_file_data"]=3156808;function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_j(index){var sp=stackSave();try{return getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);return 0n}}function invoke_ji(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);return 0n}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viijii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiij(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiid(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_jiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);return 0n}}function invoke_iiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_fiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_diii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_i(index){var sp=stackSave();try{return getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viif(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["FS_createPreloadedFile"]=FS_createPreloadedFile;Module["FS_unlink"]=FS_unlink;Module["FS_createPath"]=FS_createPath;Module["FS_createDevice"]=FS_createDevice;Module["FS_createDataFile"]=FS_createDataFile;Module["FS_createLazyFile"]=FS_createLazyFile;var missingLibrarySymbols=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","runMainThreadEmAsm","listenOnce","autoResumeAudioContext","getDynCaller","dynCall","setWasmTableEntry","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","Browser_asyncPrepareDataCounter","getSocketFromFD","getSocketAddress","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace","getFunctionArgsName","createJsInvokerSignature","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","enumReadValueFromPointer","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","flushPendingDeletes","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName"];missingLibrarySymbols.forEach(missingLibrarySymbol);var unexportedSymbols=["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","out","err","callMain","abort","wasmMemory","wasmExports","writeStackCookie","checkStackCookie","INT53_MAX","INT53_MIN","bigintToI53Checked","stackSave","stackRestore","stackAlloc","setTempRet0","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","readEmAsmArgs","runEmAsmFunction","jstoi_q","jstoi_s","getExecutableName","getWasmTableEntry","handleException","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","checkWasiClock","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","findMatchingCatch","getExceptionMessageCommon","incrementExceptionRefcount","decrementExceptionRefcount","getExceptionMessage","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","arraySum","addDays","SYSCALLS","preloadPlugins","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_readFile","FS","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","checkArgCount","getRequiredArgCount","createJsInvoker","UnboundTypeError","PureVirtualError","GenericWireTypeSize","EmValType","EmValOptionalType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","registeredPointers","registerType","integerReadValueFromPointer","floatReadValueFromPointer","readPointer","runDestructors","newFunc","craftInvokerFunction","embind__requireFunction","finalizationRegistry","detachFinalizer_deps","deletionQueue","delayFunction","emval_freelist","emval_handles","emval_symbols","init_emval","count_emval_handles","getStringOrSymbol","Emval","emval_get_global","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","reflectConstruct"];unexportedSymbols.forEach(unexportedRuntimeSymbol);var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args=[]){assert(runDependencies==0,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(arg=>{HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function stackCheckInit(){_emscripten_stack_init();writeStackCookie()}function run(args=arguments_){if(runDependencies>0){return}stackCheckInit();preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();Module["onRuntimeInitialized"]?.();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}checkStackCookie()}function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=x=>{has=true};try{_fflush(0);["stdout","stderr"].forEach(name=>{var info=FS.analyzePath("/dev/"+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty?.output?.length){has=true}})}catch(e){}out=oldOut;err=oldErr;if(has){warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();}else{}
|
|
774
177
|
let Barkoder=null;return{initialize:async(key)=>{while(!Connector.moduleLoaded){await Common.wait(20);Common.debugMessage("while await",Connector.moduleLoaded,true);}
|
|
775
178
|
Common.debugMessage("UMD","return point",true);if(typeof key!='string')
|
|
776
179
|
return new window.Promise(function(resolve,reject){return reject("LicenseKeyNotString");});try{let key_len=key.length;const uintc8=new Uint8ClampedArray(key_len+1);for(let i=0;i<key_len;i++)uintc8[i]=key.charCodeAt(i);uintc8[key_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=Connector.initialize(dataPtr);if(typeof window.BarkoderSDK_callback3D=='undefined'){var timeCounter=0;var timeout=false;if(typeof window.BarkoderSDK_callback2D=='undefined')window.BarkoderSDK_callback2D=false;while(!window.BarkoderSDK_callback2D){await Common.wait(20);timeCounter+=20;if(timeCounter>=10000){Common.debugMessage("Init","Stage 2 timeout.",true);timeout=true;break;}}
|
|
777
180
|
window.BarkoderSDK_callback2D=undefined;Common.debugMessage("Init",`Stage 2/3 took ${timeCounter}ms`,true);if(!timeout)response=Connector.initialize(dataPtr);}
|
|
778
|
-
window.BarkoderSDK_callback3D=undefined;let ocrVersion=Connector.getVersion().barkoderOcrVersion;if((typeof ocrVersion=='boolean')&&ocrVersion){let IDDocument_obj={IDDocument:28};let Decoders_constants={...Constants.Decoders,...IDDocument_obj};Constants.Decoders=Object.freeze(Decoders_constants);}
|
|
181
|
+
window.BarkoderSDK_callback3D=undefined;let ocrVersion=Connector.getVersion().barkoderOcrVersion;if((typeof ocrVersion=='boolean')&&ocrVersion){let IDDocument_obj={IDDocument:28};let Databar_obj={Databar14:29,DatabarLimited:30,DatabarExpanded:31};let Postal_obj={PostalIMB:32,Postnet:33,Planet:34,AustralianPost:35,RoyalMail:36,KIX:37,JapanesePost:38};let Decoders_constants={...Constants.Decoders,...IDDocument_obj,...Databar_obj,...Postal_obj};Constants.Decoders=Object.freeze(Decoders_constants);}else{let Databar_obj={Databar14:29,DatabarLimited:30,DatabarExpanded:31};let Postal_obj={PostalIMB:32,Postnet:33,Planet:34,AustralianPost:35,RoyalMail:36,KIX:37,JapanesePost:38};let Decoders_constants={...Constants.Decoders,...Databar_obj,...Postal_obj};Constants.Decoders=Object.freeze(Decoders_constants);}
|
|
779
182
|
Module._free(dataPtr);dataPtr=null;return new window.Promise(function(resolve,reject){Barkoder={constants:Constants,configTypes:ConfigTypes,configureBarkoder:(barkoderConfig)=>{if(typeof barkoderConfig!='object')return false;let tmp_BarkoderConfig=new ConfigTypes.BarkoderConfig();let tmp_DekoderConfig=new ConfigTypes.DekoderConfig();let tmp_GeneralSettings=new ConfigTypes.GeneralSettings();for(const[key,value]of Object.entries(barkoderConfig)){if(key in tmp_BarkoderConfig)
|
|
780
|
-
{switch(key){case"closeSessionOnResultEnabled":Barkoder.setContinuous(!value);break;case"barkoderResolution":Barkoder.setCameraResolution(value);break;case"decoder":{let decoderConfig=value;let totalDecoders=Bridge.numberOfSupportedDecoders;let decodersToEnable=
|
|
183
|
+
{switch(key){case"closeSessionOnResultEnabled":Barkoder.setContinuous(!value);break;case"barkoderResolution":Barkoder.setCameraResolution(value);break;case"decoder":{let decoderConfig=value;let totalDecoders=Bridge.numberOfSupportedDecoders;let decodersToEnable=0n;for(const[key,value]of Object.entries(decoderConfig)){if((key in tmp_DekoderConfig)&&(typeof value=='object'))
|
|
781
184
|
{switch(key){case"general":{let generalSettings=value;for(const[key,value]of Object.entries(generalSettings)){if(key in tmp_GeneralSettings)
|
|
782
185
|
{let ROI_is_set=false;switch(key){case"decodingSpeed":Barkoder.setDecodingSpeed(value);break;case"formattingType":Barkoder.setFormatting(value);break;case"encodingCharacterSet":Barkoder.setEncodingCharacterSet(value);break;case"upcEanDeblur":Barkoder.setUpcEanDeblur(value);break;case"enableMisshaped1D":Barkoder.setEnableMisshaped1D(value);break;default:{if(!ROI_is_set)
|
|
783
186
|
if((typeof generalSettings.roiX=='number')&&(typeof generalSettings.roiY=='number')&&(typeof generalSettings.roiWidth=='number')&&(typeof generalSettings.roiHeight=='number'))
|
|
784
187
|
{Barkoder.setRegionOfInterest(generalSettings.roiX,generalSettings.roiY,generalSettings.roiWidth,generalSettings.roiHeight);ROI_is_set=true;}}}}}}
|
|
785
188
|
break;default:{let decoderNumber=Object.keys(tmp_DekoderConfig).indexOf(key);if(typeof value.enabled=='boolean')
|
|
786
|
-
if(value.enabled)decodersToEnable+=
|
|
189
|
+
if(typeof value.enabled=='boolean')decodersToEnable+=(2n**BigInt(decoderNumber));if((typeof value.minLength=='number')&&(typeof value.maxLength=='number'))
|
|
787
190
|
Barkoder.setLengthRange(decoderNumber,value.minLength,value.maxLength);if(typeof value.checksum=='number')
|
|
788
191
|
Connector.setSpecificConfig(decoderNumber,value.checksum,Connector.settingGroup.checksumType);if(typeof value.dpmMode=='number')
|
|
789
192
|
Connector.setSpecificConfig(decoderNumber,value.dpmMode,Connector.settingGroup.dpmMode);}}}}
|
|
790
193
|
Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decodersToEnable;}
|
|
791
194
|
break;}}}
|
|
792
|
-
return true;},scanImage:Connector.scanImage,setDecodingSpeed:(decodingSpeed)=>{if(typeof decodingSpeed=='number'){return Connector.setDecodingSpeed(decodingSpeed);}return-1;},setEnabledDecoders:function(){let totalDecoders=arguments.length;let decodersToEnable=
|
|
793
|
-
{let decoder_i=arguments[i];if(typeof decoder_i=='number')decodersToEnable+=
|
|
794
|
-
Common.debugMessage("API","decodersToEnable: "+decodersToEnable,true);Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decodersToEnable;},setUpcEanDeblur:(upcEanDeblur)=>{if(typeof upcEanDeblur=='number'){return Connector.setUpcEanDeblur(upcEanDeblur);}return-1;},getRegionOfInterest:Connector.getRegionOfInterest,setRegionOfInterest:(...args)=>{Connector.setRegionOfInterest(...args);Connector.storeROI(args[0],args[1],args[2],args[3]);Bridge.init_ROIs();Bridge.resizePreview();},setLengthRange:Connector.setLengthRange,setFormatting:(formatting)=>{if(typeof formatting=='number'){return Connector.setFormatting(formatting);}return-1;},setDuplicatesDelayMs:(duplicatesDelayMs)=>{if(typeof duplicatesDelayMs=='number'){return Connector.setDuplicatesDelayMs(duplicatesDelayMs);}return-1;},setEncodingCharacterSet:(encodingCharacterSet)=>{if(typeof encodingCharacterSet=='number'){return Connector.setEncodingCharacterSet(encodingCharacterSet);}return-1;},setMulticodeCachingEnabled:(multicodeCachingEnabled)=>{if(typeof multicodeCachingEnabled=='number'){return Connector.setMulticodeCachingEnabled(multicodeCachingEnabled);}return-1;},setMulticodeCachingDuration:(multicodeCachingDuration)=>{if(typeof multicodeCachingDuration=='number'){return Connector.setMulticodeCachingDuration(multicodeCachingDuration);}return-1;},setMaximumResultsCount:(maximumResultsCount)=>{if(typeof maximumResultsCount=='number'){return Connector.setMaximumResultsCount(maximumResultsCount);}return-1;},setEnableMisshaped1D:(enableMisshaped1D)=>{if(typeof enableMisshaped1D=='number'){return Connector.setEnableMisshaped1D(enableMisshaped1D);}return-1;},setEnableVINRestrictions:(enableVINRestrictions)=>{if(typeof enableVINRestrictions=='number'){return Connector.setEnableVINRestrictions(enableVINRestrictions);}return-1;},getDecodingSpeed:Connector.getDecodingSpeed,getUpcEanDeblur:Connector.getUpcEanDeblur,getFormatting:Connector.getFormatting,getDuplicatesDelayMs:Connector.getDuplicatesDelayMs,getMaximumResultsCount:Connector.getMaximumResultsCount,getEnableMisshaped1D:Connector.getEnableMisshaped1D,getEnableVINRestrictions:Connector.getEnableVINRestrictions,getEncodingCharacterSet:Connector.getEncodingCharacterSet,getMsiChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Msi,Connector.settingGroup.checksumType);},getCode39ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code39,Connector.settingGroup.checksumType);},getCode11ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code11,Connector.settingGroup.checksumType);},getDatamatrixDpmModeEnabled:()=>{return Boolean(Connector.getSpecificConfig(Constants.Decoders.Datamatrix,Connector.settingGroup.dpmMode));},isBarcodeTypeEnabled:(decoder)=>{if(typeof decoder=='number'){let barcodeTypeEnabled=Connector.getBarcodeTypeEnabled(decoder);if(barcodeTypeEnabled==1)return true;if(barcodeTypeEnabled==0)return false;return barcodeTypeEnabled;}return-1;},setBarcodeTypeEnabled:(decoder,enable)=>{if(typeof decoder=='number'&&typeof enable=='boolean'){return Connector.setBarcodeTypeEnabled(decoder,enable);}return-1;},getBarcodeTypeLengthRange:(decoder)=>{if(typeof decoder=='number'){let lengthRange=Connector.getLengthRange(decoder);if(lengthRange!=-1)
|
|
195
|
+
return true;},scanImage:Connector.scanImage,setDecodingSpeed:(decodingSpeed)=>{if(typeof decodingSpeed=='number'){return Connector.setDecodingSpeed(decodingSpeed);}return-1;},setEnabledDecoders:function(){let totalDecoders=arguments.length;let decodersToEnable=0n;Common.debugMessage("API","totalDecoders: "+totalDecoders,true);for(let i=0;i<totalDecoders;i++)
|
|
196
|
+
{let decoder_i=arguments[i];if(typeof decoder_i=='number')decodersToEnable+=(2n**BigInt(decoder_i));}
|
|
197
|
+
Common.debugMessage("API","decodersToEnable: "+decodersToEnable,true);let Res=Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decodersToEnable;},setUpcEanDeblur:(upcEanDeblur)=>{if(typeof upcEanDeblur=='number'){return Connector.setUpcEanDeblur(upcEanDeblur);}return-1;},getRegionOfInterest:Connector.getRegionOfInterest,setRegionOfInterest:(...args)=>{Connector.setRegionOfInterest(...args);Connector.storeROI(args[0],args[1],args[2],args[3]);Bridge.init_ROIs();Bridge.resizePreview();},setLengthRange:Connector.setLengthRange,setFormatting:(formatting)=>{if(typeof formatting=='number'){return Connector.setFormatting(formatting);}return-1;},setDuplicatesDelayMs:(duplicatesDelayMs)=>{if(typeof duplicatesDelayMs=='number'){return Connector.setDuplicatesDelayMs(duplicatesDelayMs);}return-1;},setEncodingCharacterSet:(encodingCharacterSet)=>{if(typeof encodingCharacterSet=='number'){return Connector.setEncodingCharacterSet(encodingCharacterSet);}return-1;},setMulticodeCachingEnabled:(multicodeCachingEnabled)=>{if(typeof multicodeCachingEnabled=='number'){return Connector.setMulticodeCachingEnabled(multicodeCachingEnabled);}return-1;},setMulticodeCachingDuration:(multicodeCachingDuration)=>{if(typeof multicodeCachingDuration=='number'){return Connector.setMulticodeCachingDuration(multicodeCachingDuration);}return-1;},setMaximumResultsCount:(maximumResultsCount)=>{if(typeof maximumResultsCount=='number'){return Connector.setMaximumResultsCount(maximumResultsCount);}return-1;},setEnableMisshaped1D:(enableMisshaped1D)=>{if(typeof enableMisshaped1D=='number'){return Connector.setEnableMisshaped1D(enableMisshaped1D);}return-1;},setEnableVINRestrictions:(enableVINRestrictions)=>{if(typeof enableVINRestrictions=='number'){return Connector.setEnableVINRestrictions(enableVINRestrictions);}return-1;},setEnableComposite:(enableComposite)=>{if(typeof enableComposite=='number'){return Connector.setEnableComposite(enableComposite);}return-1;},getDecodingSpeed:Connector.getDecodingSpeed,getUpcEanDeblur:Connector.getUpcEanDeblur,getFormatting:Connector.getFormatting,getDuplicatesDelayMs:Connector.getDuplicatesDelayMs,getMaximumResultsCount:Connector.getMaximumResultsCount,getEnableMisshaped1D:Connector.getEnableMisshaped1D,getEnableVINRestrictions:Connector.getEnableVINRestrictions,getEnableComposite:Connector.getEnableComposite,getEncodingCharacterSet:Connector.getEncodingCharacterSet,getMsiChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Msi,Connector.settingGroup.checksumType);},getCode39ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code39,Connector.settingGroup.checksumType);},getCode11ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code11,Connector.settingGroup.checksumType);},getDatamatrixDpmModeEnabled:()=>{return Boolean(Connector.getSpecificConfig(Constants.Decoders.Datamatrix,Connector.settingGroup.dpmMode));},isBarcodeTypeEnabled:(decoder)=>{if(typeof decoder=='number'){let barcodeTypeEnabled=Connector.getBarcodeTypeEnabled(decoder);if(barcodeTypeEnabled==1)return true;if(barcodeTypeEnabled==0)return false;return barcodeTypeEnabled;}return-1;},setBarcodeTypeEnabled:(decoder,enable)=>{if(typeof decoder=='number'&&typeof enable=='boolean'){return Connector.setBarcodeTypeEnabled(decoder,enable);}return-1;},getBarcodeTypeLengthRange:(decoder)=>{if(typeof decoder=='number'){let lengthRange=Connector.getLengthRange(decoder);if(lengthRange!=-1)
|
|
795
198
|
{let max=(lengthRange>>(8*1))&0xFF;let min=lengthRange&0xFF;return[min,max];}
|
|
796
|
-
else return-1;}return-1;},getMulticodeCachingEnabled:Connector.getMulticodeCachingEnabled,getMulticodeCachingDuration:Connector.getMulticodeCachingDuration,setCode11ChecksumType:(code11ChecksumType)=>{if(typeof code11ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code11,code11ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setCode39ChecksumType:(code39ChecksumType)=>{if(typeof code39ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code39,code39ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setMsiChecksumType:(msiChecksumType)=>{if(typeof msiChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Msi,msiChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setDatamatrixDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.Datamatrix,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QR,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRMicroDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QRMicro,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setFlashEnabled:(flashEnabled)=>{if(typeof flashEnabled=='boolean'){DOM_elements.buttonsProperties.showFlash=flashEnabled;return 0;}return-1;},setZoomEnabled:(zoomEnabled)=>{if(typeof zoomEnabled=='boolean'){DOM_elements.buttonsProperties.showZoom=zoomEnabled;return 0;}return-1;},setCloseEnabled:(closeEnabled)=>{if(typeof closeEnabled=='boolean'){DOM_elements.buttonsProperties.showClose=closeEnabled;return 0;}return-1;},setCameraPickerEnabled:(cameraPickerEnabled)=>{if(typeof cameraPickerEnabled=='boolean'){DOM_elements.buttonsProperties.showCameraPicker=cameraPickerEnabled;return 0;}return-1;},changeFlashState:()=>{JS_media.applyFlash(true);},changeZoomState:()=>{JS_media.applyZoom();},setCameraResolution:(camRes)=>{if(typeof camRes=='number'){if(camRes==0){JS_media.frameWidth.ideal=1280;JS_media.frameHeight.ideal=720;return 0;}
|
|
199
|
+
else return-1;}return-1;},getMulticodeCachingEnabled:Connector.getMulticodeCachingEnabled,getMulticodeCachingDuration:Connector.getMulticodeCachingDuration,setCode11ChecksumType:(code11ChecksumType)=>{if(typeof code11ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code11,code11ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setCode39ChecksumType:(code39ChecksumType)=>{if(typeof code39ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code39,code39ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setMsiChecksumType:(msiChecksumType)=>{if(typeof msiChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Msi,msiChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setDatamatrixDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.Datamatrix,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QR,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRMicroDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QRMicro,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setFlashEnabled:(flashEnabled)=>{if(typeof flashEnabled=='boolean'){DOM_elements.buttonsProperties.showFlash=flashEnabled;return 0;}return-1;},setZoomEnabled:(zoomEnabled)=>{if(typeof zoomEnabled=='boolean'){DOM_elements.buttonsProperties.showZoom=zoomEnabled;return 0;}return-1;},setCloseEnabled:(closeEnabled)=>{if(typeof closeEnabled=='boolean'){DOM_elements.buttonsProperties.showClose=closeEnabled;return 0;}return-1;},setCameraPickerEnabled:(cameraPickerEnabled)=>{if(typeof cameraPickerEnabled=='boolean'){DOM_elements.buttonsProperties.showCameraPicker=cameraPickerEnabled;return 0;}return-1;},changeFlashState:()=>{JS_media.applyFlash(true);},changeZoomState:()=>{JS_media.applyZoom();},getMaxZoomFactor:()=>{return(JS_media.zoom.supported)?((JS_media.zoom.ready)?JS_media.zoom.levels[2]:4):1;},isFlashAvailable:()=>{return(JS_media.flash.supported&&JS_media.flash.ready);},setCameraResolution:(camRes)=>{if(typeof camRes=='number'){if(camRes==0){JS_media.frameWidth.ideal=1280;JS_media.frameHeight.ideal=720;return 0;}
|
|
797
200
|
if(camRes==1){JS_media.frameWidth.ideal=1920;JS_media.frameHeight.ideal=1080;return 0;}
|
|
798
201
|
return-1;}return-1;},setDpsLimit:(dpsLimit)=>{if(typeof dpsLimit=='number'){if(dpsLimit>=1&&dpsLimit<=30){Decoder.cameraScanner.config.dps_limit=dpsLimit;return 0;}
|
|
799
202
|
return-1;}return-1;},setScannerTimeout:(timeout_ms)=>{if(typeof timeout_ms=='number'){if(timeout_ms==0){Decoder.cameraScanner.config.timeout=timeout_ms;return 0;}
|
|
800
203
|
else if(timeout_ms>=10&&timeout_ms<=3600){Decoder.cameraScanner.config.timeout=timeout_ms;return 0;}
|
|
801
|
-
return-1;}return-1;},setContinuous:(continuous)=>{if(typeof continuous=='boolean'){Decoder.cameraScanner.config.continuous=continuous;return 0;}return-1;},getCameraResolution:()=>{if((JS_media.frameWidth.ideal==1280)&&(JS_media.frameHeight.ideal==720))return 0;if((JS_media.frameWidth.ideal==1920)&&(JS_media.frameHeight.ideal==1080))return 1;return-1;},getContinuous:()=>{return Decoder.cameraScanner.config.continuous;},applyTemplate:Connector.applyTemplate,startScanner:async(...args)=>{Decoder.start(...args);},stopScanner:JS_media.closeHandler,setCameraId:(id)=>{JS_media.cameraId=id;},getActiveCamera:()=>{let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;if(active)
|
|
204
|
+
return-1;}return-1;},setContinuous:(continuous)=>{if(typeof continuous=='boolean'){Decoder.cameraScanner.config.continuous=continuous;return 0;}return-1;},setBeepOnSuccessEnabled:(beepEnabled)=>{if(typeof beepEnabled=='boolean'){Decoder.cameraScanner.config.result_beep=beepEnabled;return 0;}return-1;},getCameraResolution:()=>{if((JS_media.frameWidth.ideal==1280)&&(JS_media.frameHeight.ideal==720))return 0;if((JS_media.frameWidth.ideal==1920)&&(JS_media.frameHeight.ideal==1080))return 1;return-1;},getContinuous:()=>{return Decoder.cameraScanner.config.continuous;},isBeepOnSuccessEnabled:()=>{return Decoder.cameraScanner.config.result_beep;},applyTemplate:Connector.applyTemplate,startScanner:async(...args)=>{Decoder.start(...args);},stopScanner:JS_media.closeHandler,setCameraId:(id)=>{JS_media.cameraId=id;},getActiveCamera:()=>{let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;if(active)
|
|
802
205
|
{if(typeof JS_media.runtime_settings_videoTrack=="object")
|
|
803
206
|
{const activeCameraId=JS_media.runtime_settings_videoTrack.deviceId;let activeCamera=JS_media.cameras.filter((camera)=>camera.id==activeCameraId);return activeCamera[0];}
|
|
804
207
|
return null;}
|
|
805
|
-
return null;},getCameras:JS_media.getCameras,setPauseDecoding:(pause)=>{if(typeof pause=='boolean')Decoder.cameraScanner.runningState.paused=pause;},setLocationLineColor:(color)=>{if(typeof color=='string')Decoder.cameraScanner.overlay.locationLineColor=color;},setLocationLineWidth:(width)=>{if(typeof width=='number')Decoder.cameraScanner.overlay.locationLineWidth=width;},setRoiLineColor:(color)=>{if(typeof color=='string')Bridge.viewfinderAppearance.overlay.lineColor=color;},setRoiLineWidth:(width)=>{if(typeof width=='number')Bridge.viewfinderAppearance.overlay.lineWidth=width;},setRegionOfInterestVisible:(visible)=>{if(typeof visible=='boolean')Bridge.viewfinderAppearance.overlay.roiVisible=visible;},setImageResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image=enabled;},setLocationInPreviewEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.overlay.locationShow=enabled;},getLocationLineColor:()=>{return Decoder.cameraScanner.overlay.locationLineColor;},getLocationLineWidth:()=>{return Decoder.cameraScanner.overlay.locationLineWidth;},getRoiLineColor:()=>{return Bridge.viewfinderAppearance.overlay.lineColor;},getRoiLineWidth:()=>{return Bridge.viewfinderAppearance.overlay.lineWidth;},isRegionOfInterestVisible:()=>{return Bridge.viewfinderAppearance.overlay.roiVisible;},isImageResultEnabled:()=>{Decoder.cameraScanner.config.result_image;},isLocationInPreviewEnabled:()=>{return Decoder.cameraScanner.overlay.locationShow;},scanFromLocalFileSystem:function(input,result_callback){let file=input.files[0];let reader=new FileReader();if(file?.type.match(/image/i)){reader.readAsDataURL(file);reader.onload=function(){let currentSetting_MaximumResultsCount=Barkoder.getMaximumResultsCount();let currentSetting_DecodingSpeed=Barkoder.getDecodingSpeed();let currentSetting_UpcEanDeblur=Barkoder.getUpcEanDeblur();let currentSetting_DatamatrixDpmModeEnabled=Barkoder.getDatamatrixDpmModeEnabled();Barkoder.setMaximumResultsCount(100);Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Rigorous);Barkoder.setUpcEanDeblur(Barkoder.constants.UpcEanDeblur.Enable);Barkoder.setDatamatrixDpmModeEnabled(true);Barkoder.scanImage(reader.result,result_callback);Barkoder.setMaximumResultsCount(currentSetting_MaximumResultsCount);Barkoder.setDecodingSpeed(currentSetting_DecodingSpeed);Barkoder.setUpcEanDeblur(currentSetting_UpcEanDeblur);Barkoder.setDatamatrixDpmModeEnabled(currentSetting_DatamatrixDpmModeEnabled);};reader.onerror=function(){console.log(reader.error);};}else{if(typeof file=='object')
|
|
208
|
+
return null;},getCameras:JS_media.getCameras,setPauseDecoding:(pause)=>{if(typeof pause=='boolean')Decoder.cameraScanner.runningState.paused=pause;},setLocationLineColor:(color)=>{if(typeof color=='string')Decoder.cameraScanner.overlay.locationLineColor=color;},setLocationLineWidth:(width)=>{if(typeof width=='number')Decoder.cameraScanner.overlay.locationLineWidth=width;},setRoiLineColor:(color)=>{if(typeof color=='string')Bridge.viewfinderAppearance.overlay.lineColor=color;},setRoiLineWidth:(width)=>{if(typeof width=='number')Bridge.viewfinderAppearance.overlay.lineWidth=width;},setRegionOfInterestVisible:(visible)=>{if(typeof visible=='boolean')Bridge.viewfinderAppearance.overlay.roiVisible=visible;},setImageResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image=enabled;},setBarcodeThumbnailOnResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image_barcode=enabled;},setLocationInPreviewEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.overlay.locationShow=enabled;},getLocationLineColor:()=>{return Decoder.cameraScanner.overlay.locationLineColor;},getLocationLineWidth:()=>{return Decoder.cameraScanner.overlay.locationLineWidth;},getRoiLineColor:()=>{return Bridge.viewfinderAppearance.overlay.lineColor;},getRoiLineWidth:()=>{return Bridge.viewfinderAppearance.overlay.lineWidth;},isRegionOfInterestVisible:()=>{return Bridge.viewfinderAppearance.overlay.roiVisible;},isImageResultEnabled:()=>{return Decoder.cameraScanner.config.result_image;},isBarcodeThumbnailOnResultEnabled:()=>{return Decoder.cameraScanner.config.result_image_barcode;},isLocationInPreviewEnabled:()=>{return Decoder.cameraScanner.overlay.locationShow;},scanFromLocalFileSystem:function(input,result_callback){let file=input.files[0];let reader=new FileReader();if(file?.type.match(/image/i)){reader.readAsDataURL(file);reader.onload=function(){let currentSetting_MaximumResultsCount=Barkoder.getMaximumResultsCount();let currentSetting_DecodingSpeed=Barkoder.getDecodingSpeed();let currentSetting_UpcEanDeblur=Barkoder.getUpcEanDeblur();let currentSetting_DatamatrixDpmModeEnabled=Barkoder.getDatamatrixDpmModeEnabled();Barkoder.setMaximumResultsCount(100);Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Rigorous);Barkoder.setUpcEanDeblur(Barkoder.constants.UpcEanDeblur.Enable);Barkoder.setDatamatrixDpmModeEnabled(true);Barkoder.scanImage(reader.result,result_callback);Barkoder.setMaximumResultsCount(currentSetting_MaximumResultsCount);Barkoder.setDecodingSpeed(currentSetting_DecodingSpeed);Barkoder.setUpcEanDeblur(currentSetting_UpcEanDeblur);Barkoder.setDatamatrixDpmModeEnabled(currentSetting_DatamatrixDpmModeEnabled);};reader.onerror=function(){console.log(reader.error);};}else{if(typeof file=='object')
|
|
806
209
|
console.log('File is not an image.');else console.log('No file is selected.');}},getVersion:Connector.getVersion};let bkEvents=new BarkoderEvents();Barkoder=Object.assign(bkEvents,Barkoder);resolve(Barkoder);});}catch(e){Common.debugMessage("initialize","error: "+e,true);return new window.Promise(function(resolve,reject){return reject("LicenseKeyError");});}}};})
|