diff --git a/@zoom/videosdk-ui-toolkit/README.md b/@zoom/videosdk-ui-toolkit/README.md index 2c01b2c..86c086b 100644 --- a/@zoom/videosdk-ui-toolkit/README.md +++ b/@zoom/videosdk-ui-toolkit/README.md @@ -1,10 +1,10 @@ -# Zoom Video SDK UI toolkit for web +# Zoom Video SDK UI toolkit Use of this SDK is subject to our [Terms of Use](https://explore.zoom.us/en/video-sdk-terms/). The [Zoom Video SDK UI toolkit](https://developers.zoom.us/docs/video-sdk/web/ui-toolkit/) is a prebuilt video chat user interface powered by the Zoom Video SDK. -![Zoom Video SDK UI toolkit web](uitoolkitgalleryview.png) +![Zoom Video SDK UI toolkit web](ui-toolkit–gallery-view.png) ## Installation @@ -17,7 +17,7 @@ $ npm install @zoom/videosdk-ui-toolkit --save Or, for Vanilla JS applications, download the package and add it to your project. Then, add the following script and CSS style to the HTML page you want the UI toolkit to live on: ```html - + ``` @@ -26,8 +26,8 @@ Or, for Vanilla JS applications, download the package and add it to your project For webpack / single page applications like Angular, Vue, React, etc, import the UI toolkit, package and styles: ```js -import uitoolkit from '@zoom/videosdk-ui-toolkit' -import '@zoom/videosdk-ui-toolkit/dist/videosdk-ui-toolkit.css' +import uitoolkit from "@zoom/videosdk-ui-toolkit"; +import "@zoom/videosdk-ui-toolkit/dist/videosdk-ui-toolkit.css"; ``` In Angular, CSS can't be imported directly into the component, instead, add the styles to your `angular.json` file in the styles array: @@ -41,7 +41,7 @@ In Angular, CSS can't be imported directly into the component, instead, add the Or, for Vanilla JS applications, import the JS file directly: ```js -import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js' +import uitoolkit from "./@zoom/videosdk-ui-toolkit/index.js"; ``` > [JS imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html) work if your script tag has the `type="module"` attribute. @@ -55,48 +55,29 @@ import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js' To join a Video SDK session, create an HTML container that it will be rendered in: ```html -
+
``` Create your Video SDK session config object, with your [Video SDK JWT](https://developers.zoom.us/docs/video-sdk/auth/), and [Video SDK session info](https://developers.zoom.us/docs/video-sdk/web/sessions/#prerequisites), the features you want to render, and any options you want to specify. ```js var config = { - videoSDKJWT: '', - sessionName: 'SessionA', - userName: 'UserA', - sessionPasscode: 'abc123', - streamUrl: 'rtmp://a.rtmp.siteofyourchoice.com', - streamKey: 'xxxx-xxxx-xxxx-xxxx', - broadcastUrl: 'https://studio.siteofyourchoice.com/livestreaming', - crDisclaimer: 'Cloud recording disclaimer for the UIToolkit to prompt', - lttDisclaimer: 'Live Transscription and Translation disclaimer for the UIToolkit to prompt', - livestreamDisclaimer: 'Live streaming disclaimer for the UIToolkit to prompt', - disableCaptionsOnJoin: true, - features: ['preview', 'video', 'audio', 'share', 'chat', 'users', 'livestream', 'pstn', 'ltt', 'recording', 'settings', 'feedback'], - options: { init: {}, audio: {}, video: {}, share: {}}, + videoSDKJWT: "", + sessionName: "SessionA", + userName: "UserA", + sessionPasscode: "abc123", + features: ["preview", "video", "audio", "share", "chat", "users", "settings"], + options: { init: {}, audio: {}, video: {}, share: {} }, virtualBackground: { allowVirtualBackground: true, allowVirtualBackgroundUpload: true, - virtualBackgrounds: ['https://images.unsplash.com/photo-1715490187538-30a365fa05bd?q=80&w=1945&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'] - } -} + virtualBackgrounds: [ + "https://images.unsplash.com/photo-1715490187538-30a365fa05bd?q=80&w=1945&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ], + }, +}; ``` -If you pass a string to the config object disclaimers(cr, ltt, and livestream), you are telling the UIToolkit that it will handle prompting the disclaimers passed when the corresponding event triggers. If you leave the fields empty, the developer is responsible for the disclaimer UI and the prompting these disclaimers when the event is triggered. You can listen for these events and pass in a callback via the code below: - -```js -const client = ZoomVideo.createClient(); - -client.on('recording-change', () => {}); -client.on('caption-status', () => {}); -client.on('live-stream-status', () => {}); -``` - -Because the VideoClient follows the singleton pattern, you can call createClient() to retrieve the same client object the UIToolKit uses to control the underlying Zoom Video SDK. You can then utilize any functions offered by the base Zoom Video SDK. Please note, that certain components in the UIToolKit depend on state stored and passed within its underlying components so calling certain functions outside of the UIToolKit can introduce unexpected behavior in the UI. - - - Currently, we support the following features: | `features[]` | Description | @@ -106,40 +87,34 @@ Currently, we support the following features: | `audio` | Show the audio button on the toolbar, and to send and receive audio. | | `share` | Show the screen share button on the toolbar, and to send and receive screen share content. | | `chat` | Show the chat button on the toolbar, and to send and receive session chats. | -| `livestream` | Show the livestream button on the toolbar to start or end a livestream. | | `users` | Show the users button on the toolbar, and to see the list of users in the session. | -| `pstn` | Show the invite by phone feature in the users interface. | -| `crc` | Show the invite by SIP feature in the users interface. | -| `ltt` | Show the Live Transcription button on the toolbar. The user can start transcription and hide or show the captions. | -| `recording` | Show the Cloud Recording button on the toolbar. | | `settings` | Show the settings button on the toolbar, and to configure virtual background, camera, microphone, and speaker devices, and see session quality statistics. | -| `feedback` | Show the feedback flow after the session is left or ended. The user can rate the session (1-5 stars) and report feedback to Zoom. | We also support setting specific properties for the Video SDK [init](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/InitOptions.html), [audio](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/AudioOption.html), [video](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/CaptureVideoOption.html), and [share](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/ScreenShareOption.html) options. -| `options{}` | Properties | Default | Description | -| ----------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------- | ----------- | -| `init` | `enforceMultipleVideos`
`enforceVirtualBackground`
`webEndpoint` | `false`
`false`
`zoom.us` | Enables [rendering multiple videos](https://developers.zoom.us/docs/video-sdk/web/video/#render-multiple-participant-videos) if [SharedArrayBuffer](https://developers.zoom.us/docs/video-sdk/web/sharedarraybuffer/) is off.
Enables [virtual background](https://developers.zoom.us/docs/video-sdk/web/video/#use-virtual-background) if [SharedArrayBuffer](https://developers.zoom.us/docs/video-sdk/web/sharedarraybuffer/) is off.
Specifies the Zoom real-time media environment. | -| `audio` | `backgroundNoiseSuppression`
`originalSound`
`syncButtonsOnHeadset` | `true`
`false`
`false` | Zoom's AI background noise suppression.
Sends sound exactly as it's captured (opposite of background noise suppression).
Enables headset buttons like mute/unmute to work within [supported browsers](https://caniuse.com/webhid). | -| `video` | `originalRatio`
`virtualBackground` | `true`
`false`
`true`
`null` | Sends video exactly as it's captured. If false, Zoom crops it to 16:9.
Sets a default virtual background for the user. | -| `share` | `controls`
`displaySurface`
`hideShareAudioOption`
`optimizedForSharedVideo` | `null`
`null`
`false`
`false` | Enables configuring specific content to share within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_controller_option)
Enables configuring specific share surfaces within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_monitortypesurfaces_option).
Enables or disables the share computer audio option within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_systemaudio_option).
Prioritizes frame rate over resolution for better screen sharing of videos. | +| `options{}` | Properties | Default | Description | +| ----------- | ------------------------------------------------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `init` | `enforceMultipleVideos`
`enforceVirtualBackground`
`webEndpoint` | `false`
`false`
`zoom.us` | Enables [rendering multiple videos](https://developers.zoom.us/docs/video-sdk/web/video/#render-multiple-participant-videos) if [SharedArrayBuffer](https://developers.zoom.us/docs/video-sdk/web/sharedarraybuffer/) is off.
Enables [virtual background](https://developers.zoom.us/docs/video-sdk/web/video/#use-virtual-background) if [SharedArrayBuffer](https://developers.zoom.us/docs/video-sdk/web/sharedarraybuffer/) is off.
Specifies the Zoom real-time media environment. | +| `audio` | `backgroundNoiseSuppression`
`originalSound`
`syncButtonsOnHeadset` | `true`
`false`
`false` | Zoom's AI background noise suppression.
Sends sound exactly as it's captured (opposite of background noise suppression).
Enables headset buttons like mute/unmute to work within [supported browsers](https://caniuse.com/webhid). | +| `video` | `originalRatio`
`virtualBackground` | `true`
`false`
`true`
`null` | Sends video exactly as it's captured. If false, Zoom crops it to 16:9.
Sets a default virtual background for the user. | +| `share` | `controls`
`displaySurface`
`hideShareAudioOption`
`optimizedForSharedVideo` | `null`
`null`
`false`
`false` | Enables configuring specific content to share within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_controller_option)
Enables configuring specific share surfaces within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_monitortypesurfaces_option).
Enables or disables the share computer audio option within [supported browsers](https://caniuse.com/mdn-api_mediadevices_getdisplaymedia_systemaudio_option).
Prioritizes frame rate over resolution for better screen sharing of videos. | > You may notice some options irrelevant for the UI Toolkit use case are not exposed (for example [`skipJsMedia`](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/InitOptions.html#skipJsMedia) and [`alternativeNameForVideoPlayer`](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/InitOptions.html#alternativeNameForVideoPlayer)), or are defaulted on (for example [`leaveOnPageUnload`](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/InitOptions.html#leaveOnPageUnload) and [`patchJsMedia`](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/InitOptions.html#patchJsMedia)) with no option to change them. For feedback or requests relating to exposing additional [`init`](https://marketplacefront.zoom.us/sdk/custom/web/modules/VideoClient.html#init), [`audio`](https://marketplacefront.zoom.us/sdk/custom/web/modules/Stream.html#startAudio), [`video`](https://marketplacefront.zoom.us/sdk/custom/web/modules/Stream.html#startVideo), and [`share`](https://marketplacefront.zoom.us/sdk/custom/web/modules/Stream.html#startShareScreen) options from the Video SDK, please [share your use case here](https://github.com/zoom/videosdk-ui-toolkit-web/issues). Virtual backgrounds can also be configured further like providing a list of available backgrounds, allowing the user to upload their own background, or disabling virtual backgrounds completely. To set a default, specific virtual background for a user, use the `options` -> `video` -> `virtualBackground` approach mentioned above. -| `virtualBackground{}` | Default | Description | -| ------------------------------ | ----------- | ----------------------------------------------------------------------------- | -| `allowVirtualBackground` | `true` | Enables users to choose their virtual background from the `backgrounds` list. | -| `allowVirtualBackgroundUpload` | `true` | Enables users to upload their own virtual background. | -| `virtualBackgrounds` | `[]` | Sets the list of available virtual backgrounds. | +| `virtualBackground{}` | Default | Description | +| ------------------------------ | ------- | ----------------------------------------------------------------------------- | +| `allowVirtualBackground` | `true` | Enables users to choose their virtual background from the `backgrounds` list. | +| `allowVirtualBackgroundUpload` | `true` | Enables users to upload their own virtual background. | +| `virtualBackgrounds` | `[]` | Sets the list of available virtual backgrounds. | After you have configured your session, call the `uitoolkit.joinSession` function, passing in the container reference, and the Video SDK session config object: ```js -var sessionContainer = document.getElementById('sessionContainer') +var sessionContainer = document.getElementById("sessionContainer"); -uitoolkit.joinSession(sessionContainer, config) +uitoolkit.joinSession(sessionContainer, config); ``` ### Leave Session @@ -149,7 +124,7 @@ To leave a Video SDK session, the user can click the red leave button. The host You can also leave a session programmatically by calling the `uitoolkit.closeSession` function: ```js -uitoolkit.closeSession(sessionContainer) +uitoolkit.closeSession(sessionContainer); ``` ### Event Listeners @@ -157,29 +132,29 @@ uitoolkit.closeSession(sessionContainer) To subscribe to event listeners, define a callback function that you want to execute when the respective event is triggered: ```js -var sessionJoined = (() => { - console.log('session joined') -}) +var sessionJoined = () => { + console.log("session joined"); +}; -var sessionClosed = (() => { - console.log('session closed') -}) +var sessionClosed = () => { + console.log("session closed"); +}; ``` Then, pass the callback function to the respective **on** event listener (after calling the `uitoolkit.joinSession` function). ```js -uitoolkit.onSessionJoined(sessionJoined) +uitoolkit.onSessionJoined(sessionJoined); -uitoolkit.onSessionClosed(sessionClosed) +uitoolkit.onSessionClosed(sessionClosed); ``` To unsubscribe to event listeners, pass the callback function to the respective **off** event listener. ```js -uitoolkit.offSessionJoined(sessionJoined) +uitoolkit.offSessionJoined(sessionJoined); -uitoolkit.offSessionClosed(sessionClosed) +uitoolkit.offSessionClosed(sessionClosed); ``` Currently, we support the following event listeners: @@ -195,29 +170,29 @@ Currently, we support the following event listeners: Zoom's UI Toolkit now offers Developers powerful built-in components that are ready to use. Currently, we offer the following components: -| Component | Description | -| ---------- | --------------------------------------------------- | -| `uitoolkit-components` | Gives UI Toolkit components access to Video SDK session and context. | -| `controls-component` | Enables users to envoke actions such as muting, starting video, screen sharing, and more. | -| `video-component` | Displays user videos and screen sharing. | -| `chat-component` | Displays session and 1:1 chat messages. | -| `users-component` | Displays the list of users in a session and allows hosts to moderate the session. | -| `settings-component` | Displays the session settings and allows users to configure virtual background, camera, microphone, and speaker devices, and see session quality statistics. | +| Component | Description | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `uitoolkit-components` | Gives UI Toolkit components access to Video SDK session and context. | +| `controls-component` | Enables users to envoke actions such as muting, starting video, screen sharing, and more. | +| `video-component` | Displays user videos and screen sharing. | +| `chat-component` | Displays session and 1:1 chat messages. | +| `users-component` | Displays the list of users in a session and allows hosts to moderate the session. | +| `settings-component` | Displays the session settings and allows users to configure virtual background, camera, microphone, and speaker devices, and see session quality statistics. | ### Show UI Toolkit components When building with UI Toolkit components, the `uitoolkit-components` component is a required wrapper around the UI Toolkit components. To begin, create an HTML container that it will be rendered in: ```html -
+
``` Then, call the `uitoolkit.showUitoolkitComponents` function, passing in the container reference, and the Video SDK session config object: ```js -var uitoolkitContainer = document.getElementById('uitoolkitContainer') +var uitoolkitContainer = document.getElementById("uitoolkitContainer"); -uitoolkit.showUitoolkitComponents(uitoolkitContainer, config) +uitoolkit.showUitoolkitComponents(uitoolkitContainer, config); ``` ### Hide UI Toolkit components @@ -225,7 +200,7 @@ uitoolkit.showUitoolkitComponents(uitoolkitContainer, config) To close the wrapper, call the `uitoolkit.hideUiToolkitComponents` function while passing in the container reference: ```js -uitoolkit.hideUiToolkitComponents(providerContainer) +uitoolkit.hideUiToolkitComponents(providerContainer); ``` ### Show the controls component @@ -234,17 +209,17 @@ The controls component is a required component that enables users to control the To render the controls component, create and HTML container and pass it into the `uitoolkit.showControlsComponent` function: ```html -
+
... -
+
...
``` ```js -var controlsContainer = document.getElementById('controlsContainer') +var controlsContainer = document.getElementById("controlsContainer"); -uitoolkit.showControlsComponent(controlsContainer) +uitoolkit.showControlsComponent(controlsContainer); ``` ### Hide the controls component @@ -252,7 +227,7 @@ uitoolkit.showControlsComponent(controlsContainer) To close the Control Bar Component, call the `uitoolkit.hideControlsComponent` function while passing in the container reference: ```js -uitoolkit.hideControlsComponent(controlsContainer) +uitoolkit.hideControlsComponent(controlsContainer); ``` ### Show the video component @@ -260,17 +235,17 @@ uitoolkit.hideControlsComponent(controlsContainer) To render the video component, create and HTML container and pass it into the `uitoolkit.showVideoComponent` function: ```html -
+
... -
+
...
``` ```js -var videoContainer = document.getElementById('videoContainer') +var videoContainer = document.getElementById("videoContainer"); -uitoolkit.showVideoComponent(videoContainer) +uitoolkit.showVideoComponent(videoContainer); ``` ### Hide the video component @@ -278,7 +253,7 @@ uitoolkit.showVideoComponent(videoContainer) To close the video component, call the `uitoolkit.hideVideoComponent` function while passing in the container reference: ```js -uitoolkit.hideVideoComponent(videoContainer) +uitoolkit.hideVideoComponent(videoContainer); ``` ### Show the chat component @@ -286,17 +261,17 @@ uitoolkit.hideVideoComponent(videoContainer) To render the Chatkit, create and HTML container and pass it into the `uitoolkit.showChatComponent` function: ```html -
+
... -
+
...
``` ```js -var chatContainer = document.getElementById('chatContainer') +var chatContainer = document.getElementById("chatContainer"); -uitoolkit.showChatComponent(chatContainer) +uitoolkit.showChatComponent(chatContainer); ``` ### Hide the chat component @@ -304,7 +279,7 @@ uitoolkit.showChatComponent(chatContainer) To close the chat component, call the `uitoolkit.hideChatComponent` function while passing in the container reference: ```js -uitoolkit.hideChatComponent(chatContainer) +uitoolkit.hideChatComponent(chatContainer); ``` ### Show the users component @@ -312,17 +287,17 @@ uitoolkit.hideChatComponent(chatContainer) To render the users component, create and HTML container and pass it into the `uitoolkit.showUsersComponent` function: ```html -
+
... -
+
...
``` ```js -var usersContainer = document.getElementById('usersContainer') +var usersContainer = document.getElementById("usersContainer"); -uitoolkit.showUsersComponent(usersContainer) +uitoolkit.showUsersComponent(usersContainer); ``` ### Hide the users component @@ -330,7 +305,7 @@ uitoolkit.showUsersComponent(usersContainer) To close the users component, call the `uitoolkit.hideUsersComponent` function while passing in the container reference: ```js -uitoolkit.hideUsersComponent(usersContainer) +uitoolkit.hideUsersComponent(usersContainer); ``` ### Show the settings component @@ -338,17 +313,17 @@ uitoolkit.hideUsersComponent(usersContainer) To render the settings component, create and HTML container and pass it into the `uitoolkit.showSettingsComponent` function: ```html -
+
... -
+
...
``` ```js -var settingsContainer = document.getElementById('settingsContainer') +var settingsContainer = document.getElementById("settingsContainer"); -uitoolkit.showSettingsComponent(settingsContainer) +uitoolkit.showSettingsComponent(settingsContainer); ``` ### Hide the settings component @@ -356,7 +331,7 @@ uitoolkit.showSettingsComponent(settingsContainer) To close the settings component, call the `uitoolkit.hideSettingsComponent` function while passing in the container reference: ```js -uitoolkit.hideSettingsComponent(settingsContainer) +uitoolkit.hideSettingsComponent(settingsContainer); ``` ### Cleaning up the session @@ -389,4 +364,4 @@ Once your session has ended, we recommend properly cleaning up the UI Toolkit so ## Need help? -If you're looking for help, try [Developer Support](https://devsupport.zoom.us) or our [Developer Forum](https://devforum.zoom.us). Priority support is also available with [Premier Developer Support](https://zoom.us/docs/en-us/developer-support-plans.html) plans. \ No newline at end of file +If you're looking for help, try [Developer Support](https://devsupport.zoom.us) or our [Developer Forum](https://devforum.zoom.us). Priority support is also available with [Premier Developer Support](https://zoom.us/docs/en-us/developer-support-plans.html) plans. diff --git a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/blur.png b/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/blur.png deleted file mode 100644 index ad225e7..0000000 Binary files a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/blur.png and /dev/null differ diff --git a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/none.png b/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/none.png deleted file mode 100644 index 4b3a194..0000000 Binary files a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/none.png and /dev/null differ diff --git a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/photo.jpg b/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/photo.jpg deleted file mode 100644 index 2070cde..0000000 Binary files a/@zoom/videosdk-ui-toolkit/dist/assets/backgrounds/photo.jpg and /dev/null differ diff --git a/@zoom/videosdk-ui-toolkit/dist/assets/prober.js b/@zoom/videosdk-ui-toolkit/dist/assets/prober.js deleted file mode 100644 index 37268d3..0000000 --- a/@zoom/videosdk-ui-toolkit/dist/assets/prober.js +++ /dev/null @@ -1 +0,0 @@ -var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="prober.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={36836:($0,$1,$2)=>{js_send_data($0,$1,$2)},36866:($0,$1,$2,$3,$4,$5,$6,$7,$8)=>{js_report_qos_info($0,$1,$2,$3,$4,$5,$6,$7,$8)},36926:($0,$1)=>{LOG_OUT($0,$1)},36947:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_getcwd":___syscall_getcwd,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _create_prober=Module["_create_prober"]=function(){return(_create_prober=Module["_create_prober"]=Module["asm"]["create_prober"]).apply(null,arguments)};var _destroy_prober=Module["_destroy_prober"]=function(){return(_destroy_prober=Module["_destroy_prober"]=Module["asm"]["destroy_prober"]).apply(null,arguments)};var _readPackets=Module["_readPackets"]=function(){return(_readPackets=Module["_readPackets"]=Module["asm"]["readPackets"]).apply(null,arguments)};var _on_prober_timer=Module["_on_prober_timer"]=function(){return(_on_prober_timer=Module["_on_prober_timer"]=Module["asm"]["on_prober_timer"]).apply(null,arguments)};var _prober_start_send=Module["_prober_start_send"]=function(){return(_prober_start_send=Module["_prober_start_send"]=Module["asm"]["prober_start_send"]).apply(null,arguments)};var _prober_stop_send=Module["_prober_stop_send"]=function(){return(_prober_stop_send=Module["_prober_stop_send"]=Module["asm"]["prober_stop_send"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/@zoom/videosdk-ui-toolkit/dist/assets/prober.wasm b/@zoom/videosdk-ui-toolkit/dist/assets/prober.wasm deleted file mode 100755 index e6ea5f5..0000000 Binary files a/@zoom/videosdk-ui-toolkit/dist/assets/prober.wasm and /dev/null differ diff --git a/@zoom/videosdk-ui-toolkit/dist/favicon.ico b/@zoom/videosdk-ui-toolkit/dist/favicon.ico new file mode 100644 index 0000000..bf6d5e2 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/favicon.ico differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/SanFrancisco.jpg b/@zoom/videosdk-ui-toolkit/dist/image/SanFrancisco.jpg new file mode 100644 index 0000000..342d991 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/SanFrancisco.jpg differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-1.png b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-1.png new file mode 100644 index 0000000..3029e15 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-1.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-2.png b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-2.png new file mode 100644 index 0000000..8ae8ca6 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-2.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.jpg b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.jpg new file mode 100644 index 0000000..3292d2a Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.jpg differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.png b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.png new file mode 100644 index 0000000..c0d3375 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-3.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-ask.png b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-ask.png new file mode 100644 index 0000000..b0e4079 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/android/android-permission-ask.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/chrome-operation.jpg b/@zoom/videosdk-ui-toolkit/dist/image/av/chrome-operation.jpg new file mode 100644 index 0000000..5d11f03 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/chrome-operation.jpg differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/ios/ios-permission-ask.png b/@zoom/videosdk-ui-toolkit/dist/image/av/ios/ios-permission-ask.png new file mode 100644 index 0000000..2d14957 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/ios/ios-permission-ask.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation1.png b/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation1.png new file mode 100644 index 0000000..021f382 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation1.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation2.png b/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation2.png new file mode 100644 index 0000000..69dc251 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/safari-operation2.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_1.png b/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_1.png new file mode 100644 index 0000000..5d58a1f Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_1.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_2.png b/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_2.png new file mode 100644 index 0000000..59ec89e Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/av/share_disallow_image_2.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/blur.png b/@zoom/videosdk-ui-toolkit/dist/image/blur.png new file mode 100644 index 0000000..f8437a0 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/blur.png differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/earth.jpg b/@zoom/videosdk-ui-toolkit/dist/image/earth.jpg new file mode 100644 index 0000000..9e528f7 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/earth.jpg differ diff --git a/@zoom/videosdk-ui-toolkit/dist/image/grass.jpg b/@zoom/videosdk-ui-toolkit/dist/image/grass.jpg new file mode 100644 index 0000000..d17cded Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/image/grass.jpg differ diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/annoter.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/annoter.min.js new file mode 100644 index 0000000..47f457f --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/annoter.min.js @@ -0,0 +1,10 @@ +(window.webpackJsonpJsMediaSDK_Instance=window.webpackJsonpJsMediaSDK_Instance||[]).push([[0],{101:function(t,e,n){"use strict";function i(t){return t>>>10}function r(t){return t>>>8<<10|(t<<8>>>18)%1023}Object.defineProperty(e,"__esModule",{value:!0}),e.CAnnoReqId=e.CAnnoPduId=e.CAnnoObjId=e.CAnnoPageId=e.CAnnoDocId=e.CAnnoId=void 0;let s=0,o=0,a=0,h=0,c=0;class u{constructor(t){this._id=t}getId(){return this._id}setId(t){this._id=t}}e.CAnnoId=u;e.CAnnoDocId=class extends u{constructor(t){super(t)}acquireDocId(t){return s++,this._id=i(t)<<10|1023&s,this._id}amendDocId(t){return this._id=i(t)<<10|1023&this._id,this._id}};e.CAnnoPageId=class extends u{constructor(t){super(t)}acquirePageId(t){return o++,this._id=i(t)<<10|1023&o,this._id}amendDocId(t){return this._id=i(t)<<10|1023&this._id,this._id}};e.CAnnoObjId=class extends u{constructor(t){super(t)}acquireObjId(t){return a++,this._id=r(t)<<18|262143&a,this._id}amendDocId(t){return this._id=r(t)<<18|262143&this._id,this._id}};e.CAnnoPduId=class extends u{constructor(t){super(t)}acquirePduId(){return this._id=h++,this._id}};e.CAnnoReqId=class extends u{constructor(t){super(t)}acquirePduId(){return this._id=c++,this._id}}},102:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCanvasScale=e.getShareSessionId=e.extractActionInfo=e.normalizePoints=e.getCanvasStyleSize=e.revertRGBValue=e.parseColorValue=e.annoLog=e.peekPduType=e.Base64toUInt8Array=e.UInt8Array2Base64=e.getDefaultAnnoData=e.skipUnrecognizedData=e.skipUnrecognizedStruct=e.overWriteDataSize=e.overWriteStructSize=e.CAnnoBuffer=void 0;const i=n(98);function r(t){const e=t.style;return{width:parseInt(e.width.substring(0,e.width.length-2)),height:parseInt(e.height.substring(0,e.height.length-2))}}e.CAnnoBuffer=class{constructor(t){this.mData=t?Array.from(t):[],this.currentPos=0}getSize(){return this.mData.length}writeInt8(t){this.mData.push(255&t),this.currentPos+=1}writeInt16(t){this.mData.push(255&t),this.mData.push(t>>>8&255),this.currentPos+=2}writeInt32(t){this.mData.push(255&t),this.mData.push(t>>>8&255),this.mData.push(t>>>16&255),this.mData.push(t>>>24&255),this.currentPos+=4}writeInt16At(t,e){this.mData[t]=255&e,this.mData[t+1]=e>>>8&255}writeInt32At(t,e){this.mData[t]=255&e,this.mData[t+1]=e>>>8&255,this.mData[t+2]=e>>>16&255,this.mData[t+3]=e>>>24&255}writeFloat32(t){const e=new DataView(new ArrayBuffer(4));e.setFloat32(0,t,!0);const n=new Uint8Array(e.buffer);for(let t=0;t<4;t++)this.mData.push(n[t]);this.currentPos+=4}writeString(t){const e=t.length;this.writeInt32(e);for(let n=0;n=this.mData.length)return 0;const e=this.mData[t];return this.currentPos+=1,e}readInt16(){const t=this.currentPos;if(t+1>=this.mData.length)return 0;const e=this.mData[t]|this.mData[t+1]<<8;return this.currentPos+=2,e}readInt32(){const t=this.currentPos;if(t+3>=this.mData.length)return 0;const e=this.mData[t]|this.mData[t+1]<<8|this.mData[t+2]<<16|this.mData[t+3]<<24;return this.currentPos+=4,e}readString(){const t=this.readInt32();let e="";for(let n=0;n=this.mData.length)return 0;const t=this.mData.slice(this.currentPos,this.currentPos+4),e=new DataView(new Uint8Array(t).buffer);return this.currentPos+=4,e.getFloat32(0)}toInt8Array(){return new Uint8Array(this.mData)}tell(){return this.currentPos}seek(t){this.currentPos=this.mData.length>t?t:this.mData.length-1}},e.overWriteStructSize=function(t,e,n){const i=t.tell();n.struSize!=i-e&&(n.struSize=i-e,t.writeInt16At(e,n.struSize))},e.overWriteDataSize=function(t,e,n){const i=t.tell();n.dataSize!=i-e&&(n.dataSize=i-e,t.writeInt32At(e+2,n.dataSize))},e.skipUnrecognizedStruct=function(t,e,n){t.tell()-et.charCodeAt(0))},e.peekPduType=function(t){t.seek(6);const e=t.readInt32();return t.seek(0),e},e.parseColorValue=function(t){const e=t.slice(1);return 6!==e.length?255:parseInt(e.substring(0,2),16)+(parseInt(e.substring(2,4),16)<<8)+(parseInt(e.substring(4,6),16)<<16)},e.revertRGBValue=function(t){return t>>>16&255|(t>>>8&255)<<8|(255&t)<<16},e.getCanvasStyleSize=r,e.normalizePoints=function(t,e){const n=[];return t.forEach(t=>{n.push({x:t.x,y:t.y})}),n},e.getCanvasScale=function(t){const e=r(t),{width:n,height:i}=t,{width:s,height:o}=e;return Object.assign(Object.assign({},e),{scale:{x:s/n,y:o/i}})},e.extractActionInfo=function(t,e){return{pduType:e,appId:t.appId||i.NULL_NODE_ID,docId:t.docId||i.NULL_NODE_ID,pageId:t.pageId||i.NULL_NODE_ID,annoObjIds:t.annoObjIds||[],whiteboardObjIds:t.whiteboardObjIds||[]}},e.getShareSessionId=function(t){return t},e.annoLog=function(t){console.log("Annotation Log ==> "+t.toString())}},105:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CAnnoDoc=e.CAnnoObjSmoothPen=e.CAnnoObj=e.CAnnoLineFormat=e.CAnnoFormat=e.CAnnoObjScribble=e.getDefaultAnnoPduObj=void 0;const i=n(101),r=n(102),s=n(98);e.getDefaultAnnoPduObj=function(){return{struSize:14,dataSize:14,docId:s.NULL_NODE_ID,pageId:s.NULL_NODE_ID}};class o{constructor(){this.annoObjScribble=(0,s.getDefaultAnnoObjScribble)()}pack(t){const e=t.tell(),n=this.annoObjScribble.annoPoints.length;if(t.writeInt16(this.annoObjScribble.struSize),t.writeInt32(this.annoObjScribble.dataSize),n>0){t.writeInt32(n);for(let e=0;e0){this.annoPageStates=[];for(let t=0;t0){this.annoPduObj.annoObjIds=this.annoPduObj.annoObjIds||[];for(let t=0;t0){this.annoPduObj.annoObjIds=this.annoPduObj.annoObjIds||[];for(let t=0;t0){this.annoPduObj.annoObjIds=this.annoPduObj.annoObjIds||[];for(let t=0;te in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))a.call(e,n)&&c(t,n,e[n]);if(o)for(var n of o(e))h.call(e,n)&&c(t,n,e[n]);return t},l=(t,e,n)=>c(t,"symbol"!=typeof e?e+"":e,n) +/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */;const d={version:"4.6.0"},f={fabric:d};var p,g,v,_,b,m;typeof document<"u"&&typeof window<"u"&&(document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?d.document=document:d.document=document.implementation.createHTMLDocument(""),d.window=window),d.isTouchSupported="ontouchstart"in d.window||"ontouchstart"in d.document||d.window&&d.window.navigator&&d.window.navigator.maxTouchPoints>0,d.isLikelyNode=typeof t<"u"&&typeof window>"u",d.DPI=96,d.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",d.commaWsp="(?:\\s+,?\\s*|,\\s*)",d.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,d.reNonWord=/[ \n\.,;!\?\-]/,d.fontPaths={},d.iMatrix=[1,0,0,1,0,0],d.svgNS="http://www.w3.org/2000/svg",d.perfLimitSizeTotal=2097152,d.maxCacheSideLimit=4096,d.minCacheSideLimit=256,d.charWidthsCache={},d.textureSize=2048,d.disableStyleCopyPaste=!1,d.enableGLFiltering=!0,d.devicePixelRatio=d.window.devicePixelRatio||d.window.webkitDevicePixelRatio||d.window.mozDevicePixelRatio||1,d.browserShadowBlurConstant=1,d.arcToSegmentsCache={},d.boundsOfCurveCache={},d.cachesBoundsOfCurve=!0,d.forceGLPutImageData=!1,d.initFilterBackend=function(){return d.enableGLFiltering&&d.isWebglSupported&&d.isWebglSupported(d.textureSize)?(console.log("max texture size: "+d.maxTextureSize),new d.WebglFilterBackend({tileSize:d.textureSize})):d.Canvas2dFilterBackend?new d.Canvas2dFilterBackend:void 0},typeof document<"u"&&typeof window<"u"&&(window.fabric=d),function(){function t(t,e){if(this.__eventListeners[t]){var n=this.__eventListeners[t];e?n[n.indexOf(e)]=!1:d.util.array.fill(n,!1)}}function e(t,e){var n=function(){e.apply(this,arguments),this.off(t,n)}.bind(this);this.on(t,n)}d.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var n=this.__eventListeners[t];if(!n)return this;for(var i=0,r=n.length;i"u"?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return"function"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},d.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){t&&t.colorStops&&!(t instanceof d.Gradient)&&this.set(e,new d.Gradient(t))},_initPattern:function(t,e,n){!t||!t.source||t instanceof d.Pattern?n&&n():this.set(e,new d.Pattern(t,n))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},p=typeof f<"u"?f:void 0,g=Math.sqrt,v=Math.atan2,_=Math.pow,b=Math.PI/180,m=Math.PI/2,d.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/m){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/m){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var n=t.indexOf(e);return-1!==n&&t.splice(n,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*b},radiansToDegrees:function(t){return t/b},rotatePoint:function(t,e,n){var i=new d.Point(t.x-e.x,t.y-e.y),r=d.util.rotateVector(i,n);return new d.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var n=d.util.sin(e),i=d.util.cos(e);return{x:t.x*i-t.y*n,y:t.x*n+t.y*i}},transformPoint:function(t,e,n){return n?new d.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new d.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var n=0;ne;)(e+=s[l++%u])>h&&(e=h),t[d?"lineTo":"moveTo"](e,0),d=!d;t.restore()},createCanvasElement:function(){return d.document.createElement("canvas")},copyCanvasElement:function(t){var e=d.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,n){return t.toDataURL("image/"+e,n)},createImage:function(){return d.document.createElement("img")},multiplyTransformMatrices:function(t,e,n){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],n?0:t[0]*e[4]+t[2]*e[5]+t[4],n?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=v(t[1],t[0]),n=_(t[0],2)+_(t[1],2),i=g(n),r=(t[0]*t[3]-t[2]*t[1])/i,s=v(t[0]*t[2]+t[1]*t[3],n);return{angle:e/b,scaleX:i,scaleY:r,skewX:s/b,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return d.iMatrix.concat();var e=d.util.degreesToRadians(t.angle),n=d.util.cos(e),i=d.util.sin(e);return[n,i,-i,n,0,0]},calcDimensionsMatrix:function(t){var e=typeof t.scaleX>"u"?1:t.scaleX,n=typeof t.scaleY>"u"?1:t.scaleY,i=[t.flipX?-e:e,0,0,t.flipY?-n:n,0,0],r=d.util.multiplyTransformMatrices,s=d.util.degreesToRadians;return t.skewX&&(i=r(i,[1,0,Math.tan(s(t.skewX)),1],!0)),t.skewY&&(i=r(i,[1,Math.tan(s(t.skewY)),0,1],!0)),i},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],n=d.util.multiplyTransformMatrices;return t.angle&&(e=n(e,d.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=n(e,d.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,n,i){i>0&&(e>i?e-=i:e=0,n>i?n-=i:n=0);var r,s=!0,o=t.getImageData(e,n,2*i||1,2*i||1),a=o.data.length;for(r=3;r0?j-=2*c:1===a&&j<0&&(j+=2*c);for(var x=Math.ceil(Math.abs(j/c*2)),D=[],k=j/x,R=8/3*Math.sin(k/4)*Math.sin(k/4)/Math.sin(k/2),N=I+k,M=0;M=r?s-r:2*Math.PI-(r-s)}function o(e,n,i,r,s,o,a,h){var c;if(d.cachesBoundsOfCurve&&(c=t.call(arguments),d.boundsOfCurveCache[c]))return d.boundsOfCurveCache[c];var u,l,f,p,g,v,_,b,m=Math.sqrt,y=Math.min,O=Math.max,A=Math.abs,C=[],w=[[],[]];l=6*e-12*i+6*s,u=-3*e+9*i-9*s+3*a,f=3*i-3*e;for(var T=0;T<2;++T)if(T>0&&(l=6*n-12*r+6*o,u=-3*n+9*r-9*o+3*h,f=3*r-3*n),A(u)<1e-12){if(A(l)<1e-12)continue;0<(p=-f/l)&&p<1&&C.push(p)}else!((_=l*l-4*f*u)<0)&&(0<(g=(-l+(b=m(_)))/(2*u))&&g<1&&C.push(g),0<(v=(-l-b)/(2*u))&&v<1&&C.push(v));for(var S,P,E,I=C.length,j=I;I--;)S=(E=1-(p=C[I]))*E*E*e+3*E*E*p*i+3*E*p*p*s+p*p*p*a,w[0][I]=S,P=E*E*E*n+3*E*E*p*r+3*E*p*p*o+p*p*p*h,w[1][I]=P;w[0][j]=e,w[1][j]=n,w[0][j+1]=a,w[1][j+1]=h;var x=[{x:y.apply(null,w[0]),y:y.apply(null,w[1])},{x:O.apply(null,w[0]),y:O.apply(null,w[1])}];return d.cachesBoundsOfCurve&&(d.boundsOfCurveCache[c]=x),x}function a(t,e,n){for(var i=n[1],s=n[2],o=n[3],a=n[4],h=n[5],c=r(n[6]-t,n[7]-e,i,s,a,h,o),u=0,l=c.length;u1e-4;)n=a(s),r=s,(i=h(c.x,c.y,n.x,n.y))+o>e?s-=u/=2:(c=n,s+=u,o+=i);return n.angle=l(r),n}function v(t){for(var e,n,i,r,s=0,o=t.length,a=0,d=0,g=0,v=0,_=[],b=0;bC)for(var T=1,S=v.length;T2;for(e=e||0,c&&(a=t[2].xt[n-2].x?1:r.x===t[n-2].x?0:-1,h=r.y>t[n-2].y?1:r.y===t[n-2].y?0:-1),i.push(["L",r.x+a*e,r.y+h*e]),i},d.util.getPathSegmentsInfo=v,d.util.getBoundsOfCurve=o,d.util.getPointOnPath=function(t,e,n){n||(n=v(t));for(var i=0;e-n[i].length>0&&i=e}))}}}(),function(){function t(e,n,i){if(i)if(!d.isLikelyNode&&n instanceof Element)e=n;else if(n instanceof Array){e=[];for(var r=0,s=n.length;r57343)return t.charAt(e);if(55296<=n&&n<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var i=t.charCodeAt(e+1);if(56320>i||i>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var r=t.charCodeAt(e-1);if(55296>r||r>56319)throw"Low surrogate without preceding high surrogate";return!1}d.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")},graphemeSplit:function(e){var n,i=0,r=[];for(i=0;i-1?t.prototype[r]=function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=i;var r=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return r}}(r):t.prototype[r]=e[r],n&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function r(){}function s(e){for(var n=null,i=this;i.constructor.superclass;){var r=i.constructor.superclass.prototype[e];if(i[e]!==r){n=r;break}i=i.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,t.call(arguments,1)):n.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}d.util.createClass=function(){var n=null,o=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof o[0]&&(n=o.shift()),a.superclass=n,a.subclasses=[],n&&(r.prototype=n.prototype,a.prototype=new r,n.subclasses.push(a));for(var h=0,c=o.length;h-1||"touch"===t.pointerType}}(),function(){var t=d.document.createElement("div"),e="string"==typeof t.style.opacity,n="string"==typeof t.style.filter,i=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,r=function(t){return t};e?r=function(t,e){return t.style.opacity=e,t}:n&&(r=function(t,e){var n=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(n.zoom=1),i.test(n.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",n.filter=n.filter.replace(i,e)):n.filter+=" alpha(opacity="+100*e+")",t}),d.util.setStyle=function(t,e){var n=t.style;if(!n)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?r(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var i in e)if("opacity"===i)r(t,e[i]);else{n["float"===i||"cssFloat"===i?typeof n.styleFloat>"u"?"cssFloat":"styleFloat":i]=e[i]}return t}}(),function(){var t=Array.prototype.slice;var e,n,i,r,s=function(e){return t.call(e,0)};try{e=s(d.document.childNodes)instanceof Array}catch(i){}function o(t,e){var n=d.document.createElement(t);for(var i in e)"class"===i?n.className=e[i]:"for"===i?n.htmlFor=e[i]:n.setAttribute(i,e[i]);return n}function a(t){for(var e=0,n=0,i=d.document.documentElement,r=d.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===d.document?(e=r.scrollLeft||i.scrollLeft||0,n=r.scrollTop||i.scrollTop||0):(e+=t.scrollLeft||0,n+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:n}}e||(s=function(t){for(var e=new Array(t.length),n=t.length;n--;)e[n]=t[n];return e}),n=d.document.defaultView&&d.document.defaultView.getComputedStyle?function(t,e){var n=d.document.defaultView.getComputedStyle(t,null);return n?n[e]:void 0}:function(t,e){var n=t.style[e];return!n&&t.currentStyle&&(n=t.currentStyle[e]),n},i=d.document.documentElement.style,r="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",d.util.makeElementUnselectable=function(t){return typeof t.onselectstart<"u"&&(t.onselectstart=d.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},d.util.makeElementSelectable=function(t){return typeof t.onselectstart<"u"&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},d.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},d.util.getById=function(t){return"string"==typeof t?d.document.getElementById(t):t},d.util.toArray=s,d.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},d.util.makeElement=o,d.util.wrapElement=function(t,e,n){return"string"==typeof e&&(e=o(e,n)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},d.util.getScrollLeftTop=a,d.util.getElementOffset=function(t){var e,i,r=t&&t.ownerDocument,s={left:0,top:0},o={left:0,top:0},h={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return o;for(var c in h)o[h[c]]+=parseInt(n(t,c),10)||0;return e=r.documentElement,typeof t.getBoundingClientRect<"u"&&(s=t.getBoundingClientRect()),i=a(t),{left:s.left+i.left-(e.clientLeft||0)+o.left,top:s.top+i.top-(e.clientTop||0)+o.top}},d.util.getNodeCanvas=function(t){var e=d.jsdomImplForWrapper(t);return e._canvas||e._image},d.util.cleanUpJsdomNode=function(t){if(d.isLikelyNode){var e=d.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}d.util.request=function(e,n){n||(n={});var i=n.method?n.method.toUpperCase():"GET",r=n.onComplete||function(){},s=new d.window.XMLHttpRequest,o=n.body||n.parameters;return s.onreadystatechange=function(){4===s.readyState&&(r(s),s.onreadystatechange=t)},"GET"===i&&(o=null,"string"==typeof n.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,n.parameters))),s.open(i,e,!0),("POST"===i||"PUT"===i)&&s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(o),s}}(),d.log=console.log,d.warn=console.warn,function(){function t(){return!1}function e(t,e,n,i){return-n*Math.cos(t/i*(Math.PI/2))+n+e}var n=d.window.requestAnimationFrame||d.window.webkitRequestAnimationFrame||d.window.mozRequestAnimationFrame||d.window.oRequestAnimationFrame||d.window.msRequestAnimationFrame||function(t){return d.window.setTimeout(t,1e3/60)},i=d.window.cancelAnimationFrame||d.window.clearTimeout;function r(){return n.apply(d.window,arguments)}d.util.animate=function(n){var i=!1;return r((function(s){n||(n={});var o,a=s||+new Date,h=n.duration||500,c=a+h,u=n.onChange||t,l=n.abort||t,d=n.onComplete||t,f=n.easing||e,p="startValue"in n?n.startValue:0,g="endValue"in n?n.endValue:100,v=n.byValue||g-p;n.onStart&&n.onStart(),function t(e){var n=(o=e||+new Date)>c?h:o-a,s=n/h,_=f(n,p,v,h),b=Math.abs((_-p)/v);if(!i){if(l(_,b,s))return void d(g,1,1);if(o>c)return u(g,1,1),void d(g,1,1);u(_,b,s),r(t)}}(a)})),function(){i=!0}},d.util.requestAnimFrame=r,d.util.cancelAnimFrame=function(){return i.apply(d.window,arguments)}}(),function(){function t(t,e,n){var i="rgba("+parseInt(t[0]+n*(e[0]-t[0]),10)+","+parseInt(t[1]+n*(e[1]-t[1]),10)+","+parseInt(t[2]+n*(e[2]-t[2]),10);return i+=","+(t&&e?parseFloat(t[3]+n*(e[3]-t[3])):1),i+=")"}d.util.animateColor=function(e,n,i,r){var s=new d.Color(e).getSource(),o=new d.Color(n).getSource(),a=r.onComplete,h=r.onChange;return r=r||{},d.util.animate(d.util.object.extend(r,{duration:i||500,startValue:s,endValue:o,byValue:o,easing:function(e,n,i,s){return t(n,i,r.colorEasing?r.colorEasing(e,s):1-Math.cos(e/s*(Math.PI/2)))},onComplete:function(e,n,i){if(a)return a(t(o,o,0),n,i)},onChange:function(e,n,i){if(h){if(Array.isArray(e))return h(t(e,e,0),n,i);h(e,n,i)}}}))}}(),function(){function t(t,e,n,i){return tt.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return typeof e>"u"&&(e=.5),e=Math.max(Math.min(1,e),0),new n(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new n(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new n(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,n=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=n},clone:function(){return new n(this.x,this.y)}})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={});function n(t){this.status=t,this.points=[]}e.Intersection?e.warn("fabric.Intersection is already defined"):(e.Intersection=n,e.Intersection.prototype={constructor:n,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,i,r,s){var o,a=(s.x-r.x)*(t.y-r.y)-(s.y-r.y)*(t.x-r.x),h=(i.x-t.x)*(t.y-r.y)-(i.y-t.y)*(t.x-r.x),c=(s.y-r.y)*(i.x-t.x)-(s.x-r.x)*(i.y-t.y);if(0!==c){var u=a/c,l=h/c;0<=u&&u<=1&&0<=l&&l<=1?(o=new n("Intersection")).appendPoint(new e.Point(t.x+u*(i.x-t.x),t.y+u*(i.y-t.y))):o=new n}else o=new n(0===a||0===h?"Coincident":"Parallel");return o},e.Intersection.intersectLinePolygon=function(t,e,i){var r,s,o,a,h=new n,c=i.length;for(a=0;a0&&(h.status="Intersection"),h},e.Intersection.intersectPolygonPolygon=function(t,e){var i,r=new n,s=t.length;for(i=0;i0&&(r.status="Intersection"),r},e.Intersection.intersectPolygonRectangle=function(t,i,r){var s=i.min(r),o=i.max(r),a=new e.Point(o.x,s.y),h=new e.Point(s.x,o.y),c=n.intersectLinePolygon(s,a,t),u=n.intersectLinePolygon(a,o,t),l=n.intersectLinePolygon(o,h,t),d=n.intersectLinePolygon(h,s,t),f=new n;return f.appendPoints(c.points),f.appendPoints(u.points),f.appendPoints(l.points),f.appendPoints(d.points),f.points.length>0&&(f.status="Intersection"),f})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={});function n(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function i(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}e.Color?e.warn("fabric.Color is already defined."):(e.Color=n,e.Color.prototype={_tryParsingColor:function(t){var e;t in n.colorNameMap&&(t=n.colorNameMap[t]),"transparent"===t&&(e=[255,255,255,0]),e||(e=n.sourceFromHex(t)),e||(e=n.sourceFromRgb(t)),e||(e=n.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,n,i){t/=255,n/=255,i/=255;var r,s,o,a=e.util.array.max([t,n,i]),h=e.util.array.min([t,n,i]);if(o=(a+h)/2,a===h)r=s=0;else{var c=a-h;switch(s=o>.5?c/(2-a-h):c/(a+h),a){case t:r=(n-i)/c+(n0)-(t<0)||+t};function f(t,e){var n=t.angle+l(Math.atan2(e.y,e.x))+360;return Math.round(n%360/45)}function p(t,n){var i=n.transform.target,r=i.canvas,s=e.util.object.clone(n);s.target=i,r&&r.fire("object:"+t,s),i.fire(t,n)}function g(t,e){var n=e.canvas,i=t[n.uniScaleKey];return n.uniformScaling&&!i||!n.uniformScaling&&i}function v(t){return t.originX===c&&t.originY===c}function _(t,e,n){var i=t.lockScalingX,r=t.lockScalingY;return!!(i&&r||!e&&(i||r)&&n||i&&"x"===e||r&&"y"===e)}function b(t,e,n,i){return{e:t,transform:e,pointer:{x:n,y:i}}}function m(t){return function(e,n,i,r){var s=n.target,o=s.getCenterPoint(),a=s.translateToOriginPoint(o,n.originX,n.originY),h=t(e,n,i,r);return s.setPositionByOrigin(a,n.originX,n.originY),h}}function y(t,e){return function(n,i,r,s){var o=e(n,i,r,s);return o&&p(t,b(n,i,r,s)),o}}function O(t,n,i,r,s){var o=t.target,a=o.controls[t.corner],h=o.canvas.getZoom(),c=o.padding/h,u=o.toLocalPoint(new e.Point(r,s),n,i);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=a.offsetX,u.y-=a.offsetY,u}function A(t){return t.flipX!==t.flipY}function C(t,e,n,i,r){if(0!==t[e]){var s=r/t._getTransformedDimensions()[i]*t[n];t.set(n,s)}}function w(t,e,n,i){var r,c=e.target,u=c._getTransformedDimensions(0,c.skewY),d=O(e,e.originX,e.originY,n,i),f=Math.abs(2*d.x)-u.x,p=c.skewX;f<2?r=0:(r=l(Math.atan2(f/c.scaleX,u.y/c.scaleY)),e.originX===s&&e.originY===h&&(r=-r),e.originX===a&&e.originY===o&&(r=-r),A(c)&&(r=-r));var g=p!==r;if(g){var v=c._getTransformedDimensions().y;c.set("skewX",r),C(c,"skewY","scaleY","y",v)}return g}function T(t,e,n,i){var r,c=e.target,u=c._getTransformedDimensions(c.skewX,0),d=O(e,e.originX,e.originY,n,i),f=Math.abs(2*d.y)-u.y,p=c.skewY;f<2?r=0:(r=l(Math.atan2(f/c.scaleY,u.x/c.scaleX)),e.originX===s&&e.originY===h&&(r=-r),e.originX===a&&e.originY===o&&(r=-r),A(c)&&(r=-r));var g=p!==r;if(g){var v=c._getTransformedDimensions().x;c.set("skewY",r),C(c,"skewX","scaleX","x",v)}return g}function S(t,e,n,i,r){r=r||{};var s,o,a,h,c,l,f=e.target,p=f.lockScalingX,b=f.lockScalingY,m=r.by,y=g(t,f),A=_(f,m,y),C=e.gestureScale;if(A)return!1;if(C)o=e.scaleX*C,a=e.scaleY*C;else{if(s=O(e,e.originX,e.originY,n,i),c="y"!==m?d(s.x):1,l="x"!==m?d(s.y):1,e.signX||(e.signX=c),e.signY||(e.signY=l),f.lockScalingFlip&&(e.signX!==c||e.signY!==l))return!1;if(h=f._getTransformedDimensions(),y&&!m){var w=Math.abs(s.x)+Math.abs(s.y),T=e.original,S=w/(Math.abs(h.x*T.scaleX/f.scaleX)+Math.abs(h.y*T.scaleY/f.scaleY));o=T.scaleX*S,a=T.scaleY*S}else o=Math.abs(s.x*f.scaleX/h.x),a=Math.abs(s.y*f.scaleY/h.y);v(e)&&(o*=2,a*=2),e.signX!==c&&"y"!==m&&(e.originX=u[e.originX],o*=-1,e.signX=c),e.signY!==l&&"x"!==m&&(e.originY=u[e.originY],a*=-1,e.signY=l)}var P=f.scaleX,E=f.scaleY;return m?("x"===m&&f.set("scaleX",o),"y"===m&&f.set("scaleY",a)):(!p&&f.set("scaleX",o),!b&&f.set("scaleY",a)),P!==f.scaleX||E!==f.scaleY}r.scaleCursorStyleHandler=function(t,e,i){var r=g(t,i),s="";if(0!==e.x&&0===e.y?s="x":0===e.x&&0!==e.y&&(s="y"),_(i,s,r))return"not-allowed";var o=f(i,e);return n[o]+"-resize"},r.skewCursorStyleHandler=function(t,e,n){if(0!==e.x&&n.lockSkewingY||0!==e.y&&n.lockSkewingX)return"not-allowed";var r=f(n,e)%4;return i[r]+"-resize"},r.scaleSkewCursorStyleHandler=function(t,e,n){return t[n.canvas.altActionKey]?r.skewCursorStyleHandler(t,e,n):r.scaleCursorStyleHandler(t,e,n)},r.rotationWithSnapping=y("rotating",m((function(t,e,n,i){var r=e,s=r.target,o=s.translateToOriginPoint(s.getCenterPoint(),r.originX,r.originY);if(s.lockRotation)return!1;var a,h=Math.atan2(r.ey-o.y,r.ex-o.x),c=Math.atan2(i-o.y,n-o.x),u=l(c-h+r.theta);if(s.snapAngle>0){var d=s.snapAngle,f=s.snapThreshold||d,p=Math.ceil(u/d)*d,g=Math.floor(u/d)*d;Math.abs(u-g)0?s:a:(u>0&&(r=l===o?s:a),u<0&&(r=l===o?a:s),A(h)&&(r=r===s?a:s)),e.originX=r,y("skewing",m(w))(t,e,n,i))},r.skewHandlerY=function(t,e,n,i){var r,a=e.target,u=a.skewY,l=e.originX;return!a.lockSkewingY&&(0===u?r=O(e,c,c,n,i).y>0?o:h:(u>0&&(r=l===s?o:h),u<0&&(r=l===s?h:o),A(a)&&(r=r===o?h:o)),e.originY=r,y("skewing",m(T))(t,e,n,i))},r.dragHandler=function(t,e,n,i){var r=e.target,s=n-e.offsetX,o=i-e.offsetY,a=!r.get("lockMovementX")&&r.left!==s,h=!r.get("lockMovementY")&&r.top!==o;return a&&r.set("left",s),h&&r.set("top",o),(a||h)&&p("moving",b(t,e,n,i)),a||h},r.scaleOrSkewActionName=function(t,e,n){var i=t[n.canvas.altActionKey];return 0===e.x?i?"skewX":"scaleY":0===e.y?i?"skewY":"scaleX":void 0},r.rotationStyleHandler=function(t,e,n){return n.lockRotation?"not-allowed":e.cursorStyle},r.fireEvent=p,r.wrapWithFixedAnchor=m,r.wrapWithFireEvent=y,r.getLocalPoint=O,e.controlsUtils=r}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={}),n=e.util.degreesToRadians,i=e.controlsUtils;i.renderCircleControl=function(t,e,n,i,r){i=i||{};var s,o=this.sizeX||i.cornerSize||r.cornerSize,a=this.sizeY||i.cornerSize||r.cornerSize,h=typeof i.transparentCorners<"u"?i.transparentCorners:r.transparentCorners,c=h?"stroke":"fill",u=!h&&(i.cornerStrokeColor||r.cornerStrokeColor),l=e,d=n;t.save(),t.fillStyle=i.cornerColor||r.cornerColor,t.strokeStyle=i.cornerStrokeColor||r.cornerStrokeColor,o>a?(s=o,t.scale(1,a/o),d=n*o/a):a>o?(s=a,t.scale(o/a,1),l=e*a/o):s=o,t.lineWidth=1,t.beginPath(),t.arc(l,d,s/2,0,2*Math.PI,!1),t[c](),u&&t.stroke(),t.restore()},i.renderSquareControl=function(t,e,i,r,s){r=r||{};var o=this.sizeX||r.cornerSize||s.cornerSize,a=this.sizeY||r.cornerSize||s.cornerSize,h=typeof r.transparentCorners<"u"?r.transparentCorners:s.transparentCorners,c=h?"stroke":"fill",u=!h&&(r.cornerStrokeColor||s.cornerStrokeColor),l=o/2,d=a/2;t.save(),t.fillStyle=r.cornerColor||s.cornerColor,t.strokeStyle=r.cornerStrokeColor||s.cornerStrokeColor,t.lineWidth=1,t.translate(e,i),t.rotate(n(s.angle)),t[c+"Rect"](-l,-d,o,a),u&&t.strokeRect(-l,-d,o,a),t.restore()}}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={});e.Control=function(t){for(var e in t)this[e]=t[e]},e.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){var n=t._controlsVisibility;return n&&typeof n[e]<"u"?n[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,n){return e.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},n)},calcCornerCoords:function(t,n,i,r,s){var o,a,h,c,u=s?this.touchSizeX:this.sizeX,l=s?this.touchSizeY:this.sizeY;if(u&&l&&u!==l){var d=Math.atan2(l,u),f=Math.sqrt(u*u+l*l)/2,p=d-e.util.degreesToRadians(t),g=Math.PI/2-d-e.util.degreesToRadians(t);o=f*e.util.cos(p),a=f*e.util.sin(p),h=f*e.util.cos(g),c=f*e.util.sin(g)}else{f=.7071067812*(u&&l?u:n);p=e.util.degreesToRadians(45-t);o=h=f*e.util.cos(p),a=c=f*e.util.sin(p)}return{tl:{x:i-c,y:r-h},tr:{x:i+o,y:r-a},bl:{x:i-o,y:r+a},br:{x:i+c,y:r+h}}},render:function(t,n,i,r,s){switch((r=r||{}).cornerStyle||s.cornerStyle){case"circle":e.controlsUtils.renderCircleControl.call(this,t,n,i,r,s);break;default:e.controlsUtils.renderSquareControl.call(this,t,n,i,r,s)}}}}(typeof f<"u"?f:void 0),d.util.object.clone,d.Gradient=d.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,n=this;Object.keys(t).forEach((function(e){n[e]=t[e]})),this.id?this.id+="_"+d.Object.__uid++:this.id=d.Object.__uid++,e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice()},addColorStop:function(t){for(var e in t){var n=new d.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:n.toRgb(),opacity:n.getAlpha()})}return this},toObject:function(t){var e={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return d.util.populateWithProperties(this,e,t),e},toLive:function(t){var e,n,i,r=d.util.object.clone(this.coords);if(this.type){for("linear"===this.type?e=t.createLinearGradient(r.x1,r.y1,r.x2,r.y2):"radial"===this.type&&(e=t.createRadialGradient(r.x1,r.y1,r.r1,r.x2,r.y2,r.r2)),n=0,i=this.colorStops.length;n"u"))throw a;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=d.util.getById(t)||this._createCanvasElement(),d.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var n;for(var i in e=e||{},t)n=t[i],e.cssOnly||(this._setBackstoreDimension(i,t[i]),n+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(i,n);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,n,i,r=this._activeObject,s=this.backgroundImage,o=this.overlayImage;for(this.viewportTransform=t,n=0,i=this._objects.length;n0+c&&(o=s-1,n(this._objects,r),this._objects.splice(o,0,r)),c++;else 0!==(s=this._objects.indexOf(t))&&(o=this._findNewLowerIndex(t,s,e),n(this._objects,t),this._objects.splice(o,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,n){var i,r;if(n)for(i=e,r=e-1;r>=0;--r){if(t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t)){i=r;break}}else i=e-1;return i},bringForward:function(t,e){if(!t)return this;var i,r,s,o,a,h=this._activeObject,c=0;if(t===h&&"activeSelection"===t.type)for(i=(a=h._objects).length;i--;)r=a[i],(s=this._objects.indexOf(r))"}}),t(d.StaticCanvas.prototype,d.Observable),t(d.StaticCanvas.prototype,d.Collection),t(d.StaticCanvas.prototype,d.DataURLExporter),t(d.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=o();if(!e||!e.getContext)return null;var n=e.getContext("2d");if(!n)return null;switch(t){case"setLineDash":return typeof n.setLineDash<"u";default:return null}}}),d.StaticCanvas.prototype.toJSON=d.StaticCanvas.prototype.toObject,d.isLikelyNode&&(d.StaticCanvas.prototype.createPNGStream=function(){var t=s(this.lowerCanvasEl);return t&&t.createPNGStream()},d.StaticCanvas.prototype.createJPEGStream=function(t){var e=s(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),function(){var t=d.util.getPointer,e=d.util.degreesToRadians,n=d.util.isTouchEvent;for(var i in d.Canvas=d.util.createClass(d.StaticCanvas,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=d.PencilBrush&&new d.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e,n,i=this.getActiveObjects();if(i.length>0&&!this.preserveObjectStacking){e=[],n=[];for(var r=0,s=this._objects.length;r1&&(this._activeObject._objects=n),e.push.apply(e,n)}else e=this._objects;return e},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&this.renderTopLayer(this.contextTop);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_normalizePointer:function(t,e){var n=t.calcTransformMatrix(),i=d.util.invertTransform(n),r=this.restorePointerVpt(e);return d.util.transformPoint(r,i)},isTargetTransparent:function(t,e,n){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var i=this._normalizePointer(t,{x:e,y:n}),r=Math.max(t.cacheTranslationX+i.x*t.zoomX,0),s=Math.max(t.cacheTranslationY+i.y*t.zoomY,0);return d.util.isTransparent(t._cacheContext,Math.round(r),Math.round(s),this.targetFindTolerance)}var o=this.contextCache,a=t.selectionBackgroundColor,h=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(o),o.save(),o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),t.render(o),o.restore(),t.selectionBackgroundColor=a,d.util.isTransparent(o,e,n,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return"[object Array]"===Object.prototype.toString.call(this.selectionKey)?!!this.selectionKey.find((function(e){return!0===t[e]})):t[this.selectionKey]},_shouldClearSelection:function(t,e){var n=this.getActiveObjects(),i=this._activeObject;return!e||e&&i&&n.length>1&&-1===n.indexOf(e)&&i!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&i&&i!==e},_shouldCenterTransform:function(t,e,n){var i;if(t)return"scale"===e||"scaleX"===e||"scaleY"===e||"resizing"===e?i=this.centeredScaling||t.centeredScaling:"rotate"===e&&(i=this.centeredRotation||t.centeredRotation),i?!n:n},_getOriginFromCorner:function(t,e){var n={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?n.x="right":("mr"===e||"tr"===e||"br"===e)&&(n.x="left"),"tl"===e||"mt"===e||"tr"===e?n.y="bottom":("bl"===e||"mb"===e||"br"===e)&&(n.y="top"),n},_getActionFromCorner:function(t,e,n,i){if(!e||!t)return"drag";var r=i.controls[e];return r.getActionName(n,r,i)},_setupCurrentTransform:function(t,n,i){if(n){var r=this.getPointer(t),s=n.__corner,o=n.controls[s],a=i&&s?o.getActionHandler(t,n,o):d.controlsUtils.dragHandler,h=this._getActionFromCorner(i,s,t,n),c=this._getOriginFromCorner(n,s),u=t[this.centeredKey],l={target:n,action:h,actionHandler:a,corner:s,scaleX:n.scaleX,scaleY:n.scaleY,skewX:n.skewX,skewY:n.skewY,offsetX:r.x-n.left,offsetY:r.y-n.top,originX:c.x,originY:c.y,ex:r.x,ey:r.y,lastX:r.x,lastY:r.y,theta:e(n.angle),width:n.width*n.scaleX,shiftKey:t.shiftKey,altKey:u,original:d.util.saveObjectTransform(n)};this._shouldCenterTransform(n,h,u)&&(l.originX="center",l.originY="center"),l.original.originX=c.x,l.original.originY=c.y,this._currentTransform=l,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,n=new d.Point(e.ex,e.ey),i=d.util.transformPoint(n,this.viewportTransform),r=new d.Point(e.ex+e.left,e.ey+e.top),s=d.util.transformPoint(r,this.viewportTransform),o=Math.min(i.x,s.x),a=Math.min(i.y,s.y),h=Math.max(i.x,s.x),c=Math.max(i.y,s.y),u=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(o,a,h-o,c-a)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,o+=u,a+=u,h-=u,c-=u,d.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(o,a,h-o,c-a))},findTarget:function(t,e){if(!this.skipTargetFind){var i,r,s=this.getPointer(t,!0),o=this._activeObject,a=this.getActiveObjects(),h=n(t),c=a.length>1&&!e||1===a.length;if(this.targets=[],c&&o._findTargetCorner(s,h)||a.length>1&&!e&&o===this._searchPossibleTargets([o],s))return o;if(1===a.length&&o===this._searchPossibleTargets([o],s)){if(!this.preserveObjectStacking)return o;i=o,r=this.targets,this.targets=[]}var u=this._searchPossibleTargets(this._objects,s);return t[this.altSelectionKey]&&u&&i&&u!==i&&(u=i,this.targets=r),u}},_checkTarget:function(t,e,n){if(e&&e.visible&&e.evented&&e.containsPoint(t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;if(!this.isTargetTransparent(e,n.x,n.y))return!0}},_searchPossibleTargets:function(t,e){for(var n,i,r=t.length;r--;){var s=t[r],o=s.group?this._normalizePointer(s.group,e):e;if(this._checkTarget(o,s,e)){(n=t[r]).subTargetCheck&&n instanceof d.Group&&((i=this._searchPossibleTargets(n._objects,e))&&this.targets.push(i));break}}return n},restorePointerVpt:function(t){return d.util.transformPoint(t,d.util.invertTransform(this.viewportTransform))},getPointer:function(e,n){if(this._absolutePointer&&!n)return this._absolutePointer;if(this._pointer&&n)return this._pointer;var i,r=t(e),s=this.upperCanvasEl,o=s.getBoundingClientRect(),a=o.width||0,h=o.height||0;(!a||!h)&&("top"in o&&"bottom"in o&&(h=Math.abs(o.top-o.bottom)),"right"in o&&"left"in o&&(a=Math.abs(o.right-o.left))),this.calcOffset(),r.x=r.x-this._offset.left,r.y=r.y-this._offset.top,n||(r=this.restorePointerVpt(r));var c=this.getRetinaScaling();return 1!==c&&(r.x/=c,r.y/=c),i=0===a||0===h?{width:1,height:1}:{width:s.width/a,height:s.height/h},{x:r.x*i.width,y:r.y*i.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,n=this.upperCanvasEl;n?n.className="":(n=this._createCanvasElement(),this.upperCanvasEl=n),d.util.addClass(n,"upper-canvas "+t),this.wrapperEl.appendChild(n),this._copyCanvasStyle(e,n),this._applyCanvasStyle(n),this.contextTop=n.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=d.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),d.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),d.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,n=this.height||t.height;d.util.setStyle(t,{position:"absolute",width:e+"px",height:n+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=n,d.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(t,e){var n=!1,i=this.getActiveObjects(),r=[],s=[];t.forEach((function(t){-1===i.indexOf(t)&&(n=!0,t.fire("deselected",{e:e,target:t}),s.push(t))})),i.forEach((function(i){-1===t.indexOf(i)&&(n=!0,i.fire("selected",{e:e,target:i}),r.push(i))})),t.length>0&&i.length>0?n&&this.fire("selection:updated",{e:e,selected:r,deselected:s,updated:r[0]||s[0],target:this._activeObject}):i.length>0?this.fire("selection:created",{e:e,selected:r,target:this._activeObject}):t.length>0&&this.fire("selection:cleared",{e:e,deselected:s})},setActiveObject:function(t,e){var n=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(n,e),this},_setActiveObject:function(t,e){return!(this._activeObject===t||!this._discardActiveObject(e,t)||t.onSelect({e:e}))&&(this._activeObject=t,!0)},_discardActiveObject:function(t,e){var n=this._activeObject;if(n){if(n.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),n=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:n,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return t?(this.removeListeners(),t.contains(this.upperCanvasEl)&&t.removeChild(this.upperCanvasEl),t.contains(this.lowerCanvasEl)&&t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(t){d.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,d.StaticCanvas.prototype.dispose.call(this),this):this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,n){var i=this._realizeGroupTransformOnObject(t),r=this.callSuper("_toObject",t,e,n);return this._unwindGroupTransformOnObject(t,i),r},_realizeGroupTransformOnObject:function(t){if(t.group&&"activeSelection"===t.group.type&&this._activeObject===t.group){var e={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach((function(n){e[n]=t[n]})),d.util.addTransformToObject(t,this._activeObject.calcOwnMatrix()),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,n){var i=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,n),this._unwindGroupTransformOnObject(e,i)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),d.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),d.StaticCanvas)"prototype"!==i&&(d.Canvas[i]=d.StaticCanvas[i])}(),function(){var t=d.util.addListener,e=d.util.removeListener,n={passive:!1};function i(t,e){return t.button&&t.button===e-1}d.util.object.extend(d.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(t,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var i=this.upperCanvasEl,r=this._getEventPrefix();t(d.window,"resize",this._onResize),t(i,r+"down",this._onMouseDown),t(i,r+"move",this._onMouseMove,n),t(i,r+"out",this._onMouseOut),t(i,r+"enter",this._onMouseEnter),t(i,"wheel",this._onMouseWheel),t(i,"contextmenu",this._onContextMenu),t(i,"dblclick",this._onDoubleClick),t(i,"dragover",this._onDragOver),t(i,"dragenter",this._onDragEnter),t(i,"dragleave",this._onDragLeave),t(i,"drop",this._onDrop),this.enablePointerEvents||t(i,"touchstart",this._onTouchStart,n),typeof eventjs<"u"&&e in eventjs&&(eventjs[e](i,"gesture",this._onGesture),eventjs[e](i,"drag",this._onDrag),eventjs[e](i,"orientation",this._onOrientationChange),eventjs[e](i,"shake",this._onShake),eventjs[e](i,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(e,"remove");var t=this._getEventPrefix();e(d.document,t+"up",this._onMouseUp),e(d.document,"touchend",this._onTouchEnd,n),e(d.document,t+"move",this._onMouseMove,n),e(d.document,"touchmove",this._onMouseMove,n)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire("mouse:out",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire("mouseout",{e:t});var n=this;this._hoveredTargets.forEach((function(i){n.fire("mouse:out",{target:e,e:t}),i&&e.fire("mouseout",{e:t})})),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach((function(t){t.isEditing&&t.hiddenTextarea.focus()}))},_onMouseEnter:function(t){!this._currentTransform&&!this.findTarget(t)&&(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||(!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(i){i.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(i)),this.__onMouseDown(i),this._resetTransformEventData();var r=this.upperCanvasEl,s=this._getEventPrefix();t(d.document,"touchend",this._onTouchEnd,n),t(d.document,"touchmove",this._onMouseMove,n),e(r,s+"down",this._onMouseDown)},_onMouseDown:function(i){this.__onMouseDown(i),this._resetTransformEventData();var r=this.upperCanvasEl,s=this._getEventPrefix();e(r,s+"move",this._onMouseMove,n),t(d.document,s+"up",this._onMouseUp),t(d.document,s+"move",this._onMouseMove,n)},_onTouchEnd:function(i){if(!(i.touches.length>0)){this.__onMouseUp(i),this._resetTransformEventData(),this.mainTouchId=null;var r=this._getEventPrefix();e(d.document,"touchend",this._onTouchEnd,n),e(d.document,"touchmove",this._onMouseMove,n);var s=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout((function(){t(s.upperCanvasEl,r+"down",s._onMouseDown),s._willAddMouseDown=0}),400)}},_onMouseUp:function(i){this.__onMouseUp(i),this._resetTransformEventData();var r=this.upperCanvasEl,s=this._getEventPrefix();this._isMainEvent(i)&&(e(d.document,s+"up",this._onMouseUp),e(d.document,s+"move",this._onMouseMove,n),t(r,s+"move",this._onMouseMove,n))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,n=this._currentTransform,r=this._groupSelector,s=!1,o=!r||0===r.left&&0===r.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),i(t,3))this.fireRightClick&&this._handleEvent(t,"up",3,o);else{if(i(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,o),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(n&&(this._finalizeCurrentTransform(t),s=n.actionPerformed),!o){var a=e===this._activeObject;this._maybeGroupObjects(t),s||(s=this._shouldRender(e)||!a&&e===this._activeObject)}if(e){if(e.selectable&&e!==this._activeObject&&"up"===e.activeOn)this.setActiveObject(e,t),s=!0;else{var h=e._findTargetCorner(this.getPointer(t,!0),d.util.isTouchEvent(t)),c=e.controls[h],u=c&&c.getMouseUpHandler(t,e,c);if(u){var l=this.getPointer(t);u(t,n,l.x,l.y)}}e.isMoving=!1}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,o),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),s?this.requestRenderAll():o||this.renderTop()}}},_simpleEventHandler:function(t,e){var n=this.findTarget(e),i=this.targets,r={e:e,target:n,subTargets:i};if(this.fire(t,r),n&&n.fire(t,r),!i)return n;for(var s=0;s1&&(e=new d.ActiveSelection(n.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(n){for(var i,r=[],s=this._groupSelector.ex,o=this._groupSelector.ey,a=s+this._groupSelector.left,h=o+this._groupSelector.top,c=new d.Point(t(s,a),t(o,h)),u=new d.Point(e(s,a),e(o,h)),l=!this.selectionFullyContained,f=s===a&&o===h,p=this._objects.length;p--&&!((i=this._objects[p])&&i.selectable&&i.visible&&(l&&i.intersectsWithRect(c,u,!0)||i.isContainedWithinRect(c,u,!0)||l&&i.containsPoint(c,null,!0)||l&&i.containsPoint(u,null,!0))&&(r.push(i),f)););return r.length>1&&(r=r.filter((function(t){return!t.onSelect({e:n})}))),r},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),d.util.object.extend(d.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",n=t.quality||1,i=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),r=this.toCanvasElement(i,t);return d.util.toDataURL(r,e,n)},toCanvasElement:function(t,e){t=t||1;var n=((e=e||{}).width||this.width)*t,i=(e.height||this.height)*t,r=this.getZoom(),s=this.width,o=this.height,a=r*t,h=this.viewportTransform,c=(h[4]-(e.left||0))*t,u=(h[5]-(e.top||0))*t,l=this.interactive,f=[a,0,0,a,c,u],p=this.enableRetinaScaling,g=d.util.createCanvasElement(),v=this.contextTop;return g.width=n,g.height=i,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=n,this.height=i,this.calcViewportBoundaries(),this.renderCanvas(g.getContext("2d"),this._objects),this.viewportTransform=h,this.width=s,this.height=o,this.calcViewportBoundaries(),this.interactive=l,this.enableRetinaScaling=p,this.contextTop=v,g}}),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,i=e.util.object.clone,r=e.util.toFixed,s=e.util.string.capitalize,o=e.util.degreesToRadians,a=!e.isLikelyNode;e.Object||(e.Object=e.util.createClass(e.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:a,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=e.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var n=e.perfLimitSizeTotal,i=t.width,r=t.height,s=e.maxCacheSideLimit,o=e.minCacheSideLimit;if(i<=s&&r<=s&&i*r<=n)return iu&&(t.zoomX/=i/u,t.width=u,t.capped=!0),r>l&&(t.zoomY/=r/l,t.height=l,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),n=e.x*t.scaleX/this.scaleX,i=e.y*t.scaleY/this.scaleY;return{width:n+2,height:i+2,zoomX:t.scaleX,zoomY:t.scaleY,x:n,y:i}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var n=t._currentTransform.target,i=t._currentTransform.action;if(this===n&&i.slice&&"scale"===i.slice(0,5))return!1}var r,s,o=this._cacheCanvas,a=this._limitCacheSize(this._getCacheCanvasDimensions()),h=e.minCacheSideLimit,c=a.width,u=a.height,l=a.zoomX,d=a.zoomY,f=c!==this.cacheWidth||u!==this.cacheHeight,p=this.zoomX!==l||this.zoomY!==d,g=f||p,v=0,_=0,b=!1;if(f){var m=this._cacheCanvas.width,y=this._cacheCanvas.height,O=c>m||u>y;b=O||(c<.9*m||u<.9*y)&&m>h&&y>h,O&&!a.capped&&(c>h||u>h)&&(v=.1*c,_=.1*u)}return this instanceof e.Text&&this.path&&(g=!0,b=!0,v+=this.getHeightOfLine(0)*this.zoomX,_+=this.getHeightOfLine(0)*this.zoomY),!!g&&(b?(o.width=Math.ceil(c+v),o.height=Math.ceil(u+_)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,o.width,o.height)),r=a.x/2,s=a.y/2,this.cacheTranslationX=Math.round(o.width/2-r)+r,this.cacheTranslationY=Math.round(o.height/2-s)+s,this.cacheWidth=c,this.cacheHeight=u,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(l,d),this.zoomX=l,this.zoomY=d,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,n=this.calcTransformMatrix(!e);t.transform(n[0],n[1],n[2],n[3],n[4],n[5])},toObject:function(t){var n=e.Object.NUM_FRACTION_DIGITS,i={type:this.type,version:e.version,originX:this.originX,originY:this.originY,left:r(this.left,n),top:r(this.top,n),width:r(this.width,n),height:r(this.height,n),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:r(this.strokeWidth,n),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:r(this.strokeMiterLimit,n),scaleX:r(this.scaleX,n),scaleY:r(this.scaleY,n),angle:r(this.angle,n),flipX:this.flipX,flipY:this.flipY,opacity:r(this.opacity,n),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:r(this.skewX,n),skewY:r(this.skewY,n)};return this.clipPath&&!this.clipPath.excludeFromExport&&(i.clipPath=this.clipPath.toObject(t),i.clipPath.inverted=this.clipPath.inverted,i.clipPath.absolutePositioned=this.clipPath.absolutePositioned),e.util.populateWithProperties(this,i,t),this.includeDefaultValues||(i=this._removeDefaultValues(i)),i},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var n=e.util.getKlass(t.type).prototype;return n.stateProperties.forEach((function(e){"left"!==e&&"top"!==e&&(t[e]===n[e]&&delete t[e],"[object Array]"===Object.prototype.toString.call(t[e])&&"[object Array]"===Object.prototype.toString.call(n[e])&&0===t[e].length&&0===n[e].length&&delete t[e])})),t},toString:function(){return"#"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=e.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,n=t.scaleY;if(this.canvas){var i=this.canvas.getZoom(),r=this.canvas.getRetinaScaling();e*=i*r,n*=i*r}return{scaleX:e,scaleY:n}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,n){var i="scaleX"===t||"scaleY"===t,r=this[t]!==n,s=!1;return i&&(n=this._constrainScale(n)),"scaleX"===t&&n<0?(this.flipX=!this.flipX,n*=-1):"scaleY"===t&&n<0?(this.flipY=!this.flipY,n*=-1):"shadow"!==t||!n||n instanceof e.Shadow?"dirty"===t&&this.group&&this.group.set("dirty",n):n=new e.Shadow(n),this[t]=n,r&&(s=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,s&&this.group.set("dirty",!0)):s&&this.stateProperties.indexOf(t)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:e.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!!("stroke"===this.paintFirst&&this.hasFill()&&this.hasStroke()&&"object"==typeof this.shadow||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t){var n=this.clipPath;if(t.save(),n.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",n.absolutePositioned){var i=e.util.invertTransform(this.calcTransformMatrix());t.transform(i[0],i[1],i[2],i[3],i[4],i[5])}n.transform(t),t.scale(1/n.zoomX,1/n.zoomY),t.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),t.restore()},drawObject:function(t,e){var n=this.fill,i=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t),this.fill=n,this.stroke=i},_drawClipPath:function(t){var e=this.clipPath;e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!t){var e=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-n/2,e,n)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var n=e.stroke;n&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,n.toLive?"percentage"===n.gradientUnits||n.gradientTransform||n.patternTransform?this._applyPatternForTransformedGradient(t,n):(t.strokeStyle=n.toLive(t,this),this._applyPatternGradientTransform(t,n)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var n=e.fill;n&&(n.toLive?(t.fillStyle=n.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=n)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e){!e||0===e.length||(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,n){var i,r,s,a=this.getViewportTransform(),h=this.calcTransformMatrix();r=typeof(n=n||{}).hasBorders<"u"?n.hasBorders:this.hasBorders,s=typeof n.hasControls<"u"?n.hasControls:this.hasControls,h=e.util.multiplyTransformMatrices(a,h),i=e.util.qrDecompose(h),t.save(),t.translate(i.translateX,i.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),t.rotate(o(i.angle)),n.forActiveSelection||this.group?r&&this.drawBordersInGroup(t,i,n):r&&this.drawBorders(t,n),s&&this.drawControls(t,n),t.restore()},_setShadow:function(t){if(this.shadow){var n,i=this.shadow,r=this.canvas,s=r&&r.viewportTransform[0]||1,o=r&&r.viewportTransform[3]||1;n=i.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),r&&r._isRetinaScaling()&&(s*=e.devicePixelRatio,o*=e.devicePixelRatio),t.shadowColor=i.color,t.shadowBlur=i.blur*e.browserShadowBlurConstant*(s+o)*(n.scaleX+n.scaleY)/4,t.shadowOffsetX=i.offsetX*s*n.scaleX,t.shadowOffsetY=i.offsetY*o*n.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var n=e.gradientTransform||e.patternTransform,i=-this.width/2+e.offsetX||0,r=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,i,r):t.transform(1,0,0,1,i,r),n&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),{offsetX:i,offsetY:r}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,n){var i,r=this._limitCacheSize(this._getCacheCanvasDimensions()),s=e.util.createCanvasElement(),o=this.canvas.getRetinaScaling(),a=r.x/this.scaleX/o,h=r.y/this.scaleY/o;s.width=a,s.height=h,(i=s.getContext("2d")).beginPath(),i.moveTo(0,0),i.lineTo(a,0),i.lineTo(a,h),i.lineTo(0,h),i.closePath(),i.translate(a/2,h/2),i.scale(r.zoomX/this.scaleX/o,r.zoomY/this.scaleY/o),this._applyPatternGradientTransform(i,n),i.fillStyle=n.toLive(t),i.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(o*this.scaleX/r.zoomX,o*this.scaleY/r.zoomY),t.strokeStyle=i.createPattern(s,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var t=e.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var n=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),n=e.util.transformPoint(n,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,n.x+=t.offsetLeft,n.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(n,"center","center")},clone:function(t,n){var i=this.toObject(n);this.constructor.fromObject?this.constructor.fromObject(i,t):e.Object._fromObject("Object",i,t)},cloneAsImage:function(t,n){var i=this.toCanvasElement(n);return t&&t(new e.Image(i)),this},toCanvasElement:function(t){t||(t={});var n=e.util,i=n.saveObjectTransform(this),r=this.group,s=this.shadow,o=Math.abs,a=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&n.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var h,c,u,l,d=e.util.createCanvasElement(),f=this.getBoundingRect(!0,!0),p=this.shadow,g={x:0,y:0};p&&(c=p.blur,h=p.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),g.x=2*Math.round(o(p.offsetX)+c)*o(h.scaleX),g.y=2*Math.round(o(p.offsetY)+c)*o(h.scaleY)),u=f.width+g.x,l=f.height+g.y,d.width=Math.ceil(u),d.height=Math.ceil(l);var v=new e.StaticCanvas(d,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(v.backgroundColor="#fff"),this.setPositionByOrigin(new e.Point(v.width/2,v.height/2),"center","center");var _=this.canvas;v.add(this);var b=v.toCanvasElement(a||1,t);return this.shadow=s,this.set("canvas",_),r&&(this.group=r),this.set(i).setCoords(),v._objects=[],v.dispose(),v=null,b},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(t,n){n=n||this.canvas.getPointer(t);var i=new e.Point(n.x,n.y),r=this._getLeftTopCoords();return this.angle&&(i=e.util.rotatePoint(i,r,o(-this.angle))),{x:i.x-r.x,y:i.y-r.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)}}),e.util.createAccessors&&e.util.createAccessors(e.Object),n(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object._fromObject=function(t,n,r,s){var o=e[t];n=i(n,!0),e.util.enlivenPatterns([n.fill,n.stroke],(function(t){typeof t[0]<"u"&&(n.fill=t[0]),typeof t[1]<"u"&&(n.stroke=t[1]),e.util.enlivenObjects([n.clipPath],(function(t){n.clipPath=t[0];var e=s?new o(n[s],n):new o(n);r&&r(e)}))}))},e.Object.__uid=0)}(typeof f<"u"?f:void 0),function(){var t=d.util.degreesToRadians,e={left:-.5,center:0,right:.5},n={top:-.5,center:0,bottom:.5};d.util.object.extend(d.Object.prototype,{translateToGivenOrigin:function(t,i,r,s,o){var a,h,c,u=t.x,l=t.y;return"string"==typeof i?i=e[i]:i-=.5,"string"==typeof s?s=e[s]:s-=.5,"string"==typeof r?r=n[r]:r-=.5,"string"==typeof o?o=n[o]:o-=.5,h=o-r,((a=s-i)||h)&&(c=this._getTransformedDimensions(),u=t.x+a*c.x,l=t.y+h*c.y),new d.Point(u,l)},translateToCenterPoint:function(e,n,i){var r=this.translateToGivenOrigin(e,n,i,"center","center");return this.angle?d.util.rotatePoint(r,e,t(this.angle)):r},translateToOriginPoint:function(e,n,i){var r=this.translateToGivenOrigin(e,"center","center",n,i);return this.angle?d.util.rotatePoint(r,e,t(this.angle)):r},getCenterPoint:function(){var t=new d.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var n=this.getCenterPoint();return this.translateToOriginPoint(n,t,e)},toLocalPoint:function(e,n,i){var r,s,o=this.getCenterPoint();return r=typeof n<"u"&&typeof i<"u"?this.translateToGivenOrigin(o,"center","center",n,i):new d.Point(this.left,this.top),s=new d.Point(e.x,e.y),this.angle&&(s=d.util.rotatePoint(s,o,-t(this.angle))),s.subtractEquals(r)},setPositionByOrigin:function(t,e,n){var i=this.translateToCenterPoint(t,e,n),r=this.translateToOriginPoint(i,this.originX,this.originY);this.set("left",r.x),this.set("top",r.y)},adjustPosition:function(n){var i,r,s=t(this.angle),o=this.getScaledWidth(),a=d.util.cos(s)*o,h=d.util.sin(s)*o;i="string"==typeof this.originX?e[this.originX]:this.originX-.5,r="string"==typeof n?e[n]:n-.5,this.left+=a*(r-i),this.top+=h*(r-i),this.setCoords(),this.originX=n},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var t=d.util,e=t.degreesToRadians,n=t.multiplyTransformMatrices,i=t.transformPoint;t.object.extend(d.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){return function(t){return[new d.Point(t.tl.x,t.tl.y),new d.Point(t.tr.x,t.tr.y),new d.Point(t.br.x,t.br.y),new d.Point(t.bl.x,t.bl.y)]}(this._getCoords(t,e))},intersectsWithRect:function(t,e,n,i){var r=this.getCoords(n,i);return"Intersection"===d.Intersection.intersectPolygonRectangle(r,t,e).status},intersectsWithObject:function(t,e,n){return"Intersection"===d.Intersection.intersectPolygonPolygon(this.getCoords(e,n),t.getCoords(e,n)).status||t.isContainedWithinObject(this,e,n)||this.isContainedWithinObject(t,e,n)},isContainedWithinObject:function(t,e,n){for(var i=this.getCoords(e,n),r=e?t.aCoords:t.lineCoords,s=0,o=t._getImageLines(r);s<4;s++)if(!t.containsPoint(i[s],o))return!1;return!0},isContainedWithinRect:function(t,e,n,i){var r=this.getBoundingRect(n,i);return r.left>=t.x&&r.left+r.width<=e.x&&r.top>=t.y&&r.top+r.height<=e.y},containsPoint:function(t,e,n,i){var r=this._getCoords(n,i),s=(e=e||this._getImageLines(r),this._findCrossPoints(t,e));return 0!==s&&s%2==1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return!(!this.getCoords(!0,t).some((function(t){return t.x<=n.x&&t.x>=e.x&&t.y<=n.y&&t.y>=e.y}))&&!this.intersectsWithRect(e,n,!0,t))||this._containsCenterOfCanvas(e,n,t)},_containsCenterOfCanvas:function(t,e,n){var i={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(i,null,!0,n)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,n,!0,t)||this.getCoords(!0,t).every((function(t){return(t.x>=n.x||t.x<=e.x)&&(t.y>=n.y||t.y<=e.y)}))&&this._containsCenterOfCanvas(e,n,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var n,i,r,s,o,a=0;for(var h in e)if(!((o=e[h]).o.y=t.y&&o.d.y>=t.y||(o.o.x===o.d.x&&o.o.x>=t.x?s=o.o.x:(0,n=(o.d.y-o.o.y)/(o.d.x-o.o.x),i=t.y-0*t.x,r=o.o.y-n*o.o.x,s=-(i-r)/(0-n)),s>=t.x&&(a+=1),2!==a)))break;return a},getBoundingRect:function(e,n){var i=this.getCoords(e,n);return t.makeBoundingBoxFromPoints(i)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)"u"&&(e=this.skewX),typeof n>"u"&&(n=this.skewY);var i,r,s,o=0===e&&0===n;if(this.strokeUniform?(r=this.width,s=this.height):(r=(i=this._getNonTransformedDimensions()).x,s=i.y),o)return this._finalizeDimensions(r*this.scaleX,s*this.scaleY);var a=t.sizeAfterTransform(r,s,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:n});return this._finalizeDimensions(a.x,a.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions();return i(e,t,!0).scalarAdd(2*this.padding)}})}(),d.util.object.extend(d.Object.prototype,{sendToBack:function(){return this.group?d.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?d.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?d.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?d.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&"activeSelection"!==this.group.type?d.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&this.canvas.moveTo(this,t),this}}),function(){var t=d.util.object.extend,e="stateProperties";function n(e,n,i){var r={};i.forEach((function(t){r[t]=e[t]})),t(e[n],r,!0)}d.util.object.extend(d.Object.prototype,{hasStateChanged:function(t){var n="_"+(t=t||e);return Object.keys(this[n]).length=0;h--)if(r=a[h],this.isControlVisible(r)&&(i=this._getImageLines(e?this.oCoords[r].touchCorner:this.oCoords[r].corner),0!==(n=this._findCrossPoints({x:s,y:o},i))&&n%2==1))return this.__corner=r,r;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t=this.oCoords;for(var e in t){var n=this.controls[e];t[e].corner=n.calcCornerCoords(this.angle,this.cornerSize,t[e].x,t[e].y,!1),t[e].touchCorner=n.calcCornerCoords(this.angle,this.touchCornerSize,t[e].x,t[e].y,!0)}},drawSelectionBackground:function(e){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;e.save();var n=this.getCenterPoint(),i=this._calculateCurrentDimensions(),r=this.canvas.viewportTransform;return e.translate(n.x,n.y),e.scale(1/r[0],1/r[3]),e.rotate(t(this.angle)),e.fillStyle=this.selectionBackgroundColor,e.fillRect(-i.x/2,-i.y/2,i.x,i.y),e.restore(),this},drawBorders:function(t,e){e=e||{};var n=this._calculateCurrentDimensions(),i=this.borderScaleFactor,r=n.x+i,s=n.y+i,o=typeof e.hasControls<"u"?e.hasControls:this.hasControls,a=!1;return t.save(),t.strokeStyle=e.borderColor||this.borderColor,this._setLineDash(t,e.borderDashArray||this.borderDashArray),t.strokeRect(-r/2,-s/2,r,s),o&&(t.beginPath(),this.forEachControl((function(e,n,i){e.withConnection&&e.getVisibility(i,n)&&(a=!0,t.moveTo(e.x*r,e.y*s),t.lineTo(e.x*r+e.offsetX,e.y*s+e.offsetY))})),a&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,n){n=n||{};var i=d.util.sizeAfterTransform(this.width,this.height,e),r=this.strokeWidth,s=this.strokeUniform,o=this.borderScaleFactor,a=i.x+r*(s?this.canvas.getZoom():e.scaleX)+o,h=i.y+r*(s?this.canvas.getZoom():e.scaleY)+o;return t.save(),this._setLineDash(t,n.borderDashArray||this.borderDashArray),t.strokeStyle=n.borderColor||this.borderColor,t.strokeRect(-a/2,-h/2,a,h),t.restore(),this},drawControls:function(t,e){e=e||{},t.save();var n,i,r=this.canvas.getRetinaScaling();return t.setTransform(r,0,0,r,0,0),t.strokeStyle=t.fillStyle=e.cornerColor||this.cornerColor,this.transparentCorners||(t.strokeStyle=e.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(t,e.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(n=this.group.calcTransformMatrix()),this.forEachControl((function(r,s,o){i=o.oCoords[s],r.getVisibility(o,s)&&(n&&(i=d.util.transformPoint(i,n)),r.render(t,i.x,i.y,e,o))})),t.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t||(t={}),t)this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}})}(),d.util.object.extend(d.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var n=function(){},i=(e=e||{}).onComplete||n,r=e.onChange||n,s=this;return d.util.animate({startValue:t.left,endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),s.requestRenderAll(),r()},onComplete:function(){t.setCoords(),i()}}),this},fxCenterObjectV:function(t,e){var n=function(){},i=(e=e||{}).onComplete||n,r=e.onChange||n,s=this;return d.util.animate({startValue:t.top,endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),s.requestRenderAll(),r()},onComplete:function(){t.setCoords(),i()}}),this},fxRemove:function(t,e){var n=function(){},i=(e=e||{}).onComplete||n,r=e.onChange||n,s=this;return d.util.animate({startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set("opacity",e),s.requestRenderAll(),r()},onComplete:function(){s.remove(t),i()}}),this}}),d.util.object.extend(d.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,n=[];for(t in arguments[0])n.push(t);for(var i=0,r=n.length;i-1||r&&s.colorProperties.indexOf(r[1])>-1,a=r?this.get(r[0])[r[1]]:this.get(t);"from"in n||(n.from=a),o||(e=~e.indexOf("=")?a+parseFloat(e.replace("=","")):parseFloat(e));var h={startValue:n.from,endValue:e,byValue:n.by,easing:n.easing,duration:n.duration,abort:n.abort&&function(t,e,i){return n.abort.call(s,t,e,i)},onChange:function(e,o,a){r?s[r[0]][r[1]]=e:s.set(t,e),!i&&n.onChange&&n.onChange(e,o,a)},onComplete:function(t,e,r){i||(s.setCoords(),n.onComplete&&n.onComplete(t,e,r))}};return o?d.util.animateColor(h.startValue,h.endValue,h.duration,h):d.util.animate(h)}}),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,i=e.util.object.clone,r={x1:1,x2:1,y1:1,y2:1};function s(t,e){var n=t.origin,i=t.axis1,r=t.axis2,s=t.dimension,o=e.nearest,a=e.center,h=e.farthest;return function(){switch(this.get(n)){case o:return Math.min(this.get(i),this.get(r));case a:return Math.min(this.get(i),this.get(r))+.5*this.get(s);case h:return Math.max(this.get(i),this.get(r))}}}e.Line?e.warn("fabric.Line is already defined"):(e.Line=e.util.createClass(e.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:e.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(t,e){t||(t=[0,0,0,0]),this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper("_set",t,e),typeof r[t]<"u"&&this._setWidthHeight(),this},_getLeftToOriginX:s({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:s({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t){t.beginPath();var e=this.calcLinePoints();t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth;var n=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=n},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return n(this.callSuper("toObject",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,n=t*this.width*.5,i=e*this.height*.5;return{x1:n,x2:t*this.width*-.5,y1:i,y2:e*this.height*-.5}}}),e.Line.fromObject=function(t,n){var r=i(t,!0);r.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject("Line",r,(function(t){delete t.points,n&&n(t)}),"points")})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={}),n=Math.PI;e.Circle?e.warn("fabric.Circle is already defined."):(e.Circle=e.util.createClass(e.Object,{type:"circle",radius:0,startAngle:0,endAngle:2*n,cacheProperties:e.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,this.startAngle,this.endAngle,!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)}}),e.Circle.fromObject=function(t,n){e.Object._fromObject("Circle",t,n)})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={});e.Triangle?e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",width:100,height:100,_render:function(t){var e=this.width/2,n=this.height/2;t.beginPath(),t.moveTo(-e,n),t.lineTo(0,-n),t.lineTo(e,n),t.closePath(),this._renderPaintInOrder(t)}}),e.Triangle.fromObject=function(t,n){return e.Object._fromObject("Triangle",t,n)})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={}),n=2*Math.PI;e.Ellipse?e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,n,!1),t.restore(),this._renderPaintInOrder(t)}}),e.Ellipse.fromObject=function(t,n){e.Object._fromObject("Ellipse",t,n)})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={});e.util.object.extend,e.Rect?e.warn("fabric.Rect is already defined"):(e.Rect=e.util.createClass(e.Object,{stateProperties:e.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,i=this.width,r=this.height,s=-this.width/2,o=-this.height/2,a=0!==e||0!==n,h=.4477152502;t.beginPath(),t.moveTo(s+e,o),t.lineTo(s+i-e,o),a&&t.bezierCurveTo(s+i-h*e,o,s+i,o+h*n,s+i,o+n),t.lineTo(s+i,o+r-n),a&&t.bezierCurveTo(s+i,o+r-h*n,s+i-h*e,o+r,s+i-e,o+r),t.lineTo(s+e,o+r),a&&t.bezierCurveTo(s+h*e,o+r,s,o+r-h*n,s,o+r-n),t.lineTo(s,o+n),a&&t.bezierCurveTo(s,o+h*n,s+h*e,o,s+e,o),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))}}),e.Rect.fromObject=function(t,n){return e.Object._fromObject("Rect",t,n)})}(typeof f<"u"?f:void 0),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,i=e.util.array.min,r=e.util.array.max;e.util.toFixed,e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,cacheProperties:e.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_setPositionDimensions:function(t){var e,n=this._calcDimensions(t);this.width=n.width,this.height=n.height,t.fromSVG||(e=this.translateToGivenOrigin({x:n.left-this.strokeWidth/2,y:n.top-this.strokeWidth/2},"left","top",this.originX,this.originY)),typeof t.left>"u"&&(this.left=t.fromSVG?n.left:e.x),typeof t.top>"u"&&(this.top=t.fromSVG?n.top:e.y),this.pathOffset={x:n.left+this.width/2,y:n.top+this.height/2}},_calcDimensions:function(){var t=this.points,e=i(t,"x")||0,n=i(t,"y")||0;return{left:e,top:n,width:(r(t,"x")||0)-e,height:(r(t,"y")||0)-n}},toObject:function(t){return n(this.callSuper("toObject",t),{points:this.points.concat()})},commonRender:function(t){var e,n=this.points.length,i=this.pathOffset.x,r=this.pathOffset.y;if(!n||isNaN(this.points[n-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-i,this.points[0].y-r);for(var s=0;s"},toObject:function(t){return r(this.callSuper("toObject",t),{path:this.path.map((function(t){return t.slice()}))})},toDatalessObject:function(t){var e=this.toObject(["sourcePath"].concat(t));return e.sourcePath&&delete e.path,e},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,r,s=[],o=[],a=0,h=0,c=0,u=0,l=0,d=this.path.length;l"},addWithUpdate:function(t){var n=!!this.group;return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(n&&e.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,n?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,n){var i=this._objects.length;if(this.useSetOnGroup)for(;i--;)this._objects[i].setOnGroup(t,n);if("canvas"===t)for(;i--;)this._objects[i]._set(t,n);e.Object.prototype._set.call(this,t,n)},toObject:function(t){var n=this.includeDefaultValues,i=this._objects.filter((function(t){return!t.excludeFromExport})).map((function(e){var i=e.includeDefaultValues;e.includeDefaultValues=n;var r=e.toObject(t);return e.includeDefaultValues=i,r})),r=e.Object.prototype.toObject.call(this,t);return r.objects=i,r},toDatalessObject:function(t){var n,i=this.sourcePath;if(i)n=i;else{var r=this.includeDefaultValues;n=this._objects.map((function(e){var n=e.includeDefaultValues;e.includeDefaultValues=r;var i=e.toDatalessObject(t);return e.includeDefaultValues=n,i}))}var s=e.Object.prototype.toDatalessObject.call(this,t);return s.objects=n,s},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=e.Object.prototype.shouldCache.call(this);if(t)for(var n=0,i=this._objects.length;n"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,n){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),typeof(n=n||{}).hasControls>"u"&&(n.hasControls=!1),n.forActiveSelection=!0;for(var i=0,r=this._objects.length;i'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,n=this.getTotalObjectScaling(),i=n.scaleX,r=n.scaleY,s=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||i>e&&r>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=r);d.filterBackend||(d.filterBackend=d.initFilterBackend());var o=d.util.createCanvasElement(),a=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,h=s.width,c=s.height;o.width=h,o.height=c,this._element=o,this._lastScaleX=t.scaleX=i,this._lastScaleY=t.scaleY=r,d.filterBackend.applyFilters([t],s,h,c,this._element,a),this._filterScalingX=o.width/this._originalElement.width,this._filterScalingY=o.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter((function(t){return t&&!t.isNeutralState()})),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,n=e.naturalWidth||e.width,i=e.naturalHeight||e.height;if(this._element===this._originalElement){var r=d.util.createCanvasElement();r.width=n,r.height=i,this._element=r,this._filteredEl=r}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,n,i),this._lastScaleX=1,this._lastScaleY=1;return d.filterBackend||(d.filterBackend=d.initFilterBackend()),d.filterBackend.applyFilters(t,this._originalElement,n,i,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){d.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){d.util.setImageSmoothing(t,this.imageSmoothing),d.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var n=this._filterScalingX,i=this._filterScalingY,r=this.width,s=this.height,o=Math.min,a=Math.max,h=a(this.cropX,0),c=a(this.cropY,0),u=e.naturalWidth||e.width,l=e.naturalHeight||e.height,d=h*n,f=c*i,p=o(r*n,u-d),g=o(s*i,l-f),v=-r/2,_=-s/2,b=o(r,u/n-h),m=o(s,l/i-c);e&&t.drawImage(e,d,f,p,g,v,_,b,m)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(d.util.getById(t),e),d.util.addClass(this.getElement(),d.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?d.util.enlivenObjects(t,(function(t){e&&e(t)}),"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=d.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),n=this._element.width,i=this._element.height,r=1,s=1,o=0,a=0,h=0,c=0,u=this.width,l=this.height,f={width:u,height:l};return!e||"none"===e.alignX&&"none"===e.alignY?(r=u/n,s=l/i):("meet"===e.meetOrSlice&&(t=(u-n*(r=s=d.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(o=-t),"Max"===e.alignX&&(o=t),t=(l-i*s)/2,"Min"===e.alignY&&(a=-t),"Max"===e.alignY&&(a=t)),"slice"===e.meetOrSlice&&(t=n-u/(r=s=d.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(h=t/2),"Max"===e.alignX&&(h=t),t=i-l/s,"Mid"===e.alignY&&(c=t/2),"Max"===e.alignY&&(c=t),n=u/r,i=l/s)),{width:n,height:i,scaleX:r,scaleY:s,offsetLeft:o,offsetTop:a,cropX:h,cropY:c}}}),d.Image.CSS_CANVAS="canvas-img",d.Image.prototype.getSvgSrc=d.Image.prototype.getSrc,d.Image.fromObject=function(t,e){var n=d.util.object.clone(t);d.util.loadImage(n.src,(function(t,i){i?e&&e(null,!0):d.Image.prototype._initFilters.call(n,n.filters,(function(i){n.filters=i||[],d.Image.prototype._initFilters.call(n,[n.resizeFilter],(function(i){n.resizeFilter=i[0],d.util.enlivenObjects([n.clipPath],(function(i){n.clipPath=i[0];var r=new d.Image(t,n);e(r,!1)}))}))}))}),null,n.crossOrigin)},d.Image.fromURL=function(t,e,n){d.util.loadImage(t,(function(t,i){e&&e(new d.Image(t,n),i)}),null,n&&n.crossOrigin)})}(typeof f<"u"?f:void 0),d.util.object.extend(d.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(t){var e=function(){},n=(t=t||{}).onComplete||e,i=t.onChange||e,r=this;return d.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.rotate(t),i()},onComplete:function(){r.setCoords(),n()}}),this}}),d.util.object.extend(d.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound}),this}}),function(){var t=d.controlsUtils,e=t.scaleSkewCursorStyleHandler,n=t.scaleCursorStyleHandler,i=t.scalingEqually,r=t.scalingYOrSkewingX,s=t.scalingXOrSkewingY,o=t.scaleOrSkewActionName,a=d.Object.prototype.controls;if(a.ml=new d.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mr=new d.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mb=new d.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:r,getActionName:o}),a.mt=new d.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:r,getActionName:o}),a.tl=new d.Control({x:-.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),a.tr=new d.Control({x:.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),a.bl=new d.Control({x:-.5,y:.5,cursorStyleHandler:n,actionHandler:i}),a.br=new d.Control({x:.5,y:.5,cursorStyleHandler:n,actionHandler:i}),a.mtr=new d.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),d.Textbox){var h=d.Textbox.prototype.controls={};h.mtr=a.mtr,h.tr=a.tr,h.br=a.br,h.tl=a.tl,h.bl=a.bl,h.mt=a.mt,h.mb=a.mb,h.mr=new d.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),h.ml=new d.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"})}}();const{Object:y,util:{requestAnimFrame:O,cancelAnimFrame:A}}=d;y.prototype.transparentCorners=!1,y.prototype.shouldCache=()=>!1,y.prototype.hasControls=!1,y.prototype.hasBorders=!1,y.prototype.lockMovementX=!0,y.prototype.lockMovementY=!0;class C extends d.Canvas{constructor(){super(...arguments),l(this,"isRenderingTop",0)}renderTop(){const t=this.contextTop;return t?(this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this.fire("after:renderTop"),this):this}setCursor(){}setActiveObject(){return this}getObjsInArea(t,e){const n=this._objects,i=[];for(let r=0;r{try{this.renderTop()}finally{this.isRenderingTop=0}}))}dispose(){return this.isRendering&&A(this.isRendering),this.isRenderingTop&&A(this.isRenderingTop),super.dispose()}}const w=["scribble:created","eraser:removed","tool:updated"];class T{constructor(t){l(this,"canvas"),l(this,"tool",null),l(this,"providers",[]),this.canvas=new C(t);const{canvas:e}=this;e.selection=!1}setViewport(t){this.canvas.setViewportTransform(t),this.canvas.requestRenderAll()}getCanvas(){return this.canvas}clear(){this.canvas.clear()}getTool(){return this.tool}clearTool(){this.tool=null}switchTool(t,e={}){this.tool={type:t,props:e},this.emit("tool:updated")}add(...t){this.canvas.add(...t)}getObjs(){return this.canvas._objects}getObjById(t){return this.canvas._objects.find(e=>e.id===t)}removeObjById(t){const e=this.canvas._objects.find(e=>e.id===t);e&&(this.canvas.remove(e),this.canvas.requestRenderAll())}removeAll(){const t=this.canvas._objects;t.length&&(this.canvas.remove(...t),this.canvas.requestRenderAll())}requestRenderAll(){this.canvas.requestRenderAll()}resize(t,e,n){this.canvas.setDimensions({width:t,height:e}),this.canvas.calcOffset(),n&&n.x&&n.y&&this.setViewport([n.x,0,0,n.y,0,0])}register(t){t.register(this),this.providers.push(t)}hideObjById(t){const e=this.canvas._objects.find(e=>e.id===t);e&&(e.set("stroke","transparent"),this.canvas.requestRenderAll())}destroy(){this.providers.forEach(t=>t.unregister()),this.providers.length=0,this.canvas.dispose()}emit(t,e){if(w.includes(t))try{this.canvas.fire(t,e)}catch(t){console.error(t)}}on(t,e){return w.includes(t)?(this.canvas.on(t,e),()=>{this.canvas.off(t,e)}):()=>{}}off(t,e){w.includes(t)&&this.canvas.off(t,e)}}function S(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2}function P(t,e,n){const i=S(e,n);if(0===i)return S(t,e);let r=((t[0]-e[0])*(n[0]-e[0])+(t[1]-e[1])*(n[1]-e[1]))/i;return r=Math.max(0,Math.min(1,r)),S(t,function(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}(e,n,r))}function E(t,e){return function t(e,n,i,r,s){const o=s||[],a=e[n],h=e[i-1];let c=0,u=1;for(let t=n+1;tc&&(c=n,u=t)}return Math.sqrt(c)>r?(t(e,n,u+1,r,o),t(e,u,i,r,o)):(o.length||o.push(a),o.push(h)),o}(t,0,t.length,e)}function I(t){return[...t]}function j(t,e){return{x:t.x+e.x,y:t.y+e.y}}function x(t,e){return t.map(t=>j(t,e))}function D(t,e){return new d.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])}function k(t,e){return t.map(t=>D(t,e))}function R(t){return{x:-t.x,y:-t.y}}function N(t){const e=function(t){if(!t.length)return{left:0,top:0,width:0,height:0,center:{x:0,y:0}};const{minX:e,minY:n,maxX:i,maxY:r}=t.reduce((t,e,n)=>(0===n||(t.minX=Math.min(t.minX,e.x),t.minY=Math.min(t.minY,e.y),t.maxX=Math.max(t.maxX,e.x),t.maxY=Math.max(t.maxY,e.y)),t),{minX:t[0].x,minY:t[0].y,maxX:t[0].x,maxY:t[0].y}),s=i-e,o=r-n;return{left:e,top:n,width:s,height:o,center:{x:e+s/2,y:n+o/2}}}(t);return{points:x(t,R(e.center)),center:e.center,transform:[1,0,0,1,e.center.x,e.center.y]}}function M(t,e){return D(t,d.util.invertTransform(e))}function L(t){if(!t.length)return[];if(1===t.length){const e=t[0];return[["M",e.x,e.y],["L",e.x,e.y]]}if(2===t.length){const e=t[0],n=t[1];return[["M",e.x,e.y],["L",n.x,n.y]]}const e=function(t,e=0){const n=t.length;if(n<3)throw new Error("A curve must have at least three points.");const i=[];if(3===n)i.push(I(t[0]),I(t[1]),I(t[2]),I(t[2]));else{const n=[];n.push(t[0],t[0]);for(let e=1;e[t.x,t.y])),n=[["M",e[0][0],e[0][1]]];for(let t=1;t{t.off(e,n)}}var W=(t=>(t[t.LEFT=0]="LEFT",t[t.MIDDLE=1]="MIDDLE",t[t.RIGHT=2]="RIGHT",t))(W||{});class q extends d.Path{constructor(t,e){const n=t;1===n.length&&n.push(j(n[0],{x:.1,y:.1}));const i=void 0!==e.strokeWidth?e.strokeWidth:2,o=void 0!==e.stroke?e.stroke:"#005AC8";super(L(n),((t,e)=>r(t,s(e)))(u({},e),{strokeWidth:i,stroke:o})),l(this,"type","ZoomScribble"),l(this,"id"),l(this,"opacity",1),l(this,"fill","transparent"),l(this,"strokeLineCap","round"),l(this,"strokeLineJoin","round"),l(this,"noScaleCache",!1),l(this,"originX","left"),l(this,"originY","top"),l(this,"strokeWidth"),l(this,"stroke"),l(this,"points",[]),l(this,"pointsObjs",[]),l(this,"pointsObjSpace",[]),l(this,"vptMinDistanceToCheckContain",20),l(this,"vptMinDistanceToPreciseSelect",10),l(this,"hoverCursor","auto"),l(this,"strokeUniform",!0),l(this,"objectCaching",!1),this.id=4294967296*Math.floor(65536*Math.random())+((null==crypto?void 0:crypto.getRandomValues(new Uint32Array(1))[0])||Math.floor(4294967296*Math.random())),this.strokeWidth=i,this.stroke=o,this.setPoints(n)}setPoints(t){this.points=t,this.pointsObjs=t.map(t=>new d.Point(t.x,t.y)),this.pointsObjSpace=N(t).points}updatePoints(t,e="normal"){this.setPoints(t);const n="simple"===e?function(t){if(!t.length)return[];if(1===t.length){const e=t[0];return[["M",e.x,e.y],["L",e.x,e.y]]}if(2===t.length){const e=t[0],n=t[1];return[["M",e.x,e.y],["L",n.x,n.y]]}const e=[];for(let n=0;n{const s=r[i+1];if(e&&s){const i=new U(e,s).project(t,!1),r=F(i,t);(void 0===n||n.closestDistance>r)&&(n={closestPoint:i,closestDistance:r})}}),n}}const V=t=>t**.3;class G{constructor(){l(this,"tool",{type:"eraser",props:{}}),l(this,"cleanups",[]),l(this,"detecting",!1),l(this,"mouseMovePoints",[]),l(this,"cancelAnimate",null),l(this,"updateTrailPath",null),l(this,"trailPath",null),l(this,"radius",5)}register(t){const e=t.getCanvas(),n=()=>{const e=t.getTool();return(null==e?void 0:e.type)===this.tool.type};function i(e){e&&(t.removeObjById(e.id),t.emit("eraser:removed",e))}const r=()=>{e.requestRenderTop()};this.cleanups.push(H(e,"after:renderTop",()=>{if(this.trailPath){const t=e.getSelectionContext();t.save();const n=e.viewportTransform;n&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),z({obj:this.trailPath,ctx:t}),t.restore()}}),H(e,"mouse:down",t=>{const r=t.e;if(!n()||this.detecting||r.button===W.RIGHT||r.button===W.MIDDLE)return;const s=e.getPointer(r);this.mouseMovePoints.push(new d.Point(s.x,s.y)),this.detecting=!0,t.target&&i(t.target),this.trailPath=new q([],{stroke:"#DFE3E8",opacity:.4,strokeWidth:2*this.radius,strokeLineCap:"round",strokeLineJoin:"round",objectCaching:!1}),this.animate()}),H(e,"mouse:move",t=>{const n=t.e;if(!this.detecting)return;const r=e.getPointer(n);if(this.mouseMovePoints.push(new d.Point(r.x,r.y)),t.target)i(t.target);else{const t=this.mouseMovePoints,n=t[t.length-2],r=t[t.length-1];if(n&&r&&!Y(n,r)){const{min:t,max:s}=Math,o=new d.Point(t(n.x,r.x),t(n.y,r.y)),a=new d.Point(s(n.x,r.x),s(n.y,r.y)),h=e.getObjsInArea(o,a);if(h.length){const t=d.Intersection.intersectLinePolygon;for(const e of h){const s=e;null!=s&&s.points.length&&"Intersection"===t(n,r,s.pointsObjs).status&&i(e)}}}}this.animate()}),H(e,"mouse:up",()=>{this.resetState(),r()}),t.on("tool:updated",()=>{n()||(this.resetState(),r())})),this.updateTrailPath=()=>{if(!this.trailPath||this.mouseMovePoints.length<=0||!e.viewportTransform)return;const t=this.mouseMovePoints.slice();this.trailPath.updatePoints(t,"simple"),r()}}resetState(){this.detecting=!1,this.mouseMovePoints=[],this.trailPath=null}animate(){this.cancelAnimate&&(this.cancelAnimate(),this.cancelAnimate=null),this.updateTrailPath&&this.mouseMovePoints.length&&(this.cancelAnimate=d.util.animate({startValue:Math.floor(this.mouseMovePoints.length/10),endValue:this.mouseMovePoints.length-1,duration:1500,easing:(t,e,n,i)=>e+(n-e)*V(t/i),onChange:t=>{var e;this.mouseMovePoints=this.mouseMovePoints.slice(Math.floor(t)),null==(e=this.updateTrailPath)||e.call(this)},onComplete:()=>{var t;null==(t=this.updateTrailPath)||t.call(this)}}))}unregister(){this.cleanups.forEach(t=>t()),this.cleanups.length=0,this.resetState()}}class K{constructor(){l(this,"tool",{type:"pen",props:{strokeWidth:void 0,stroke:void 0}}),l(this,"points",[]),l(this,"path",null),l(this,"cleanups",[]),l(this,"currentPointer",null)}register(t){const e=t.getCanvas(),n=()=>{const e=t.getTool();return(null==e?void 0:e.type)===this.tool.type},i=()=>{var e;return(null==(e=t.getTool())?void 0:e.props)||u({},this.tool.props)},r=()=>{e.requestRenderTop()};this.cleanups.push(H(e,"after:renderTop",()=>{if(this.path){const t=e.getSelectionContext();t.save();const n=e.viewportTransform;n&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),z({obj:this.path,ctx:t}),t.restore()}}),H(e,"mouse:down",t=>{const s=t.e;if(!n()||s.button===W.RIGHT||s.button===W.MIDDLE||this.currentPointer||this.path)return;this.currentPointer={pointerId:s.pointerId};const o=e.getPointer(s),a=i();this.points=[o],this.path=new q(this.points,{stroke:a.stroke,strokeWidth:a.strokeWidth}),r()}),H(e,"mouse:move",t=>{const n=t.e;if(!this.path||!this.currentPointer||this.currentPointer.pointerId!==n.pointerId)return;const i=e.getPointer(n);this.points.push(i),this.path.updatePoints(this.points,"simple"),r()}),H(e,"mouse:up",n=>{if(!this.path||!this.currentPointer)return;const i=n.e,s=e.getPointer(i);this.points.push(s);const o=E(this.points.map(t=>[t.x,t.y]),.75);this.path.updatePoints(o.map(([t,e])=>new d.Point(t,e))),e.add(this.path),t.emit("scribble:created",this.path),this.resetState(),r()}),t.on("tool:updated",()=>{n()||(this.resetState(),r())}))}resetState(){this.path=null,this.currentPointer=null,this.points=[]}unregister(){this.cleanups.forEach(t=>t()),this.cleanups.length=0,this.resetState()}}function J(t){const e=t.height,n=t.width,i=t.absHeight;return{vW:n,vH:e,scale:{x:n/t.absWidth,y:e/i}}}var Q=(t=>(t[t.ONACK=0]="ONACK",t[t.TOOL_SELECT=1]="TOOL_SELECT",t[t.ERASE_ALL=2]="ERASE_ALL",t[t.RESIZE=3]="RESIZE",t[t.REMOVE_OBJECTS=4]="REMOVE_OBJECTS",t[t.RESTORE_OBJECTS=5]="RESTORE_OBJECTS",t[t.TOOL_BAR_CLOSED=6]="TOOL_BAR_CLOSED",t[t.CHANGE_SESSION=7]="CHANGE_SESSION",t[t.UPDATE_CANVAS=8]="UPDATE_CANVAS",t[t.DESTROY_SESSION=9]="DESTROY_SESSION",t))(Q||{}),Z=(t=>(t[t.ANNO_TOOL_TYPE_NONE=0]="ANNO_TOOL_TYPE_NONE",t[t.ANNO_TOOL_TYPE_PEN=1]="ANNO_TOOL_TYPE_PEN",t[t.ANNO_TOOL_TYPE_ERASER=7]="ANNO_TOOL_TYPE_ERASER",t))(Z||{});class ${constructor(){l(this,"onAnnotationMsg",()=>{}),l(this,"editor"),l(this,"historicalObjs",new Map),l(this,"sessionId"),l(this,"sessionArchive",new Map),l(this,"hasInit",!1)}init(t){this.onAnnotationMsg=t.onAnnotationMsg,this.sessionId=t.sessionId,this.editor=this.createEditor(u({annoCanvas:t.annoCanvas},J(t))),this.hasInit=!0}createEditor(t){const{annoCanvas:e,vW:n,vH:i,scale:r}=t,s=new T(e);return s.register(new K),s.register(new G),s.resize(n,i,r),s.on("scribble:created",t=>{let e=255;e=function(t){if(!/^#[0-9A-Fa-f]{6}$/.test(t))throw new Error("Invalid hex color format. Use #RRGGBB.");const e=t.slice(1);return parseInt(e,16)}(t.stroke),this.onAnnotationMsg({type:"addObject",objectData:{points:t.points,type:"line",lineFormat:{type:"soild",lineData:{width:t.strokeWidth,color:e}}},objectId:t.id})}),s.on("eraser:removed",t=>{this.historicalObjs.set(t.id,t),this.onAnnotationMsg({type:"removeObject",objectId:t.id})}),s}reInit(t){const e=this.editor.getObjs().slice(),n=this.editor.getTool();this.editor.destroy(),this.editor=this.createEditor(u({annoCanvas:t.annoCanvas},J(t))),this.editor.add(...e),n&&this.editor.switchTool(n.type,n.props)}destroy(){this.hasInit&&(this.historicalObjs.clear(),this.sessionArchive.clear(),this.editor.destroy())}_mapToolType(t){return 7===t?"eraser":1===t?"pen":"none"}restoreObjs(t){for(const e of t){const t=this.historicalObjs.get(e);t&&this.editor.add(t),this.historicalObjs.delete(e)}this.editor.requestRenderAll()}snapshot(){return{historicalObjs:new Map(this.historicalObjs),onCanvasObjs:this.editor.getObjs().slice()}}saveSession(){const t=this.snapshot();(t.historicalObjs.size||t.onCanvasObjs.length)&&this.sessionArchive.set(this.sessionId,t)}switchSession(t){if(this.sessionId===t)return;const e=this.sessionArchive.get(t);this.saveSession(),this.editor.removeAll(),this.historicalObjs=new Map,this.sessionId=t,e&&(this.historicalObjs=e.historicalObjs,this.editor.add(...e.onCanvasObjs)),this.editor.requestRenderAll()}removeAll(){const t=this.editor.getObjs();for(const e of t)this.historicalObjs.set(e.id,e);this.editor.removeAll()}removeObjs(t){for(const e of t){const t=this.editor.getObjById(e);t&&(this.historicalObjs.set(e,t),this.editor.removeObjById(e))}this.editor.requestRenderAll()}switchTool(t,e=2,n=255){let i="#0000FF";try{i=function(t){if(t<0||t>16777215)throw new Error("Decimal value must be between 0 and 16777215.");const e=t>>8&255,n=255&t,i=t=>t.toString(16).padStart(2,"0").toUpperCase();return"#".concat(i(t>>16&255)).concat(i(e)).concat(i(n))}(n)}catch(t){}this.editor.switchTool(this._mapToolType(t),{strokeWidth:e,stroke:i})}onMessage(t){if(1===t.type)this.switchTool(t.toolType,t.width,t.color);else if(2===t.type)this.removeAll();else if(0===t.type)this.editor.hideObjById(t.objectId);else if(6===t.type)this.editor.clearTool();else if(3===t.type){const e=J(t);this.editor.resize(e.vW,e.vH,e.scale)}else 5===t.type?this.restoreObjs(t.objectIds):4===t.type?this.removeObjs(t.objectIds):7===t.type?this.switchSession(t.sessionId):8===t.type?this.reInit(t):9===t.type&&(this.sessionArchive.delete(t.sessionId),this.sessionId===t.sessionId&&this.historicalObjs.clear())}}}.call(this,n(111).Buffer)},111:function(t,e,n){"use strict";(function(t){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=n(112),r=n(113),s=n(114);function o(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(t).length;default:if(i)return B(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return P(this,e,n);case"latin1":case"binary":return E(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function _(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:b(t,e,n,i,r);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,i,r){var s,o=1,a=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){var u=-1;for(s=n;sa&&(n=a-h),s=n;s>=0;s--){for(var l=!0,d=0;dr&&(i=r):i=r;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o>8,r=n%256,s.push(r),s.push(i);return s}(e,t.length-n),t,n,i)}function T(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+l<=n)switch(l){case 1:c<128&&(u=c);break;case 2:128==(192&(s=t[r+1]))&&(h=(31&c)<<6|63&s)>127&&(u=h);break;case 3:s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(h=(15&c)<<12|(63&s)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(h=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&h<1114112&&(u=h)}null===u?(u=65533,l=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},h.prototype.compare=function(t,e,n,i,r){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(e>>>=0),a=Math.min(s,o),c=this.slice(i,r),u=t.slice(e,n),l=0;lr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return O(this,t,e,n);case"latin1":case"binary":return A(this,t,e,n);case"base64":return C(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",s=e;sn)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,i,r,s){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function k(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,s=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function R(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,s=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function N(t,e,n,i,r,s){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,i,s){return s||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function L(t,e,n,i,s){return s||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}h.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},h.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||x(t,e,this.length);for(var i=this[t],r=1,s=0;++s=(r*=128)&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||x(t,e,this.length);for(var i=e,r=1,s=this[t+--i];i>0&&(r*=256);)s+=this[t+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*e)),s},h.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},h.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},h.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),r.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),r.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),r.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),r.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||D(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+r]=t/s&255;return e+n},h.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):R(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);D(this,t,e,n,r-1,-r)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+n},h.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);D(this,t,e,n,r-1,-r)}var s=n-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+n},h.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):R(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},h.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},h.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},h.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},h.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function X(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(39))},112:function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){for(var e,n=c(t),i=n[0],o=n[1],a=new s(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),h=0,u=o>0?i-4:i,l=0;l>16&255,a[h++]=e>>8&255,a[h++]=255&e;2===o&&(e=r[t.charCodeAt(l)]<<2|r[t.charCodeAt(l+1)]>>4,a[h++]=255&e);1===o&&(e=r[t.charCodeAt(l)]<<10|r[t.charCodeAt(l+1)]<<4|r[t.charCodeAt(l+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,s=[],o=0,a=n-r;oa?a:o+16383));1===r?(e=t[n-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var r,s,o=[],a=e;a>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},113:function(t,e){e.read=function(t,e,n,i,r){var s,o,a=8*r-i-1,h=(1<>1,u=-7,l=n?r-1:0,d=n?-1:1,f=t[e+l];for(l+=d,s=f&(1<<-u)-1,f>>=-u,u+=a;u>0;s=256*s+t[e+l],l+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=i;u>0;o=256*o+t[e+l],l+=d,u-=8);if(0===s)s=1-c;else{if(s===h)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=c}return(f?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,n,i,r,s){var o,a,h,c=8*s-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+l>=1?d/h:d*Math.pow(2,1-l))*h>=2&&(o++,h/=2),o+l>=u?(a=0,o=u):o+l>=1?(a=(e*h-1)*Math.pow(2,r),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,r),o=0));r>=8;t[n+f]=255&a,f+=p,a/=256,r-=8);for(o=o<0;t[n+f]=255&o,f+=p,o/=256,c-=8);t[n+f-p]|=128*g}},114:function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},115:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const a=n(105),h=n(101),c=n(98),u=n(102),l=n(106),d=s(n(2)),f=o(n(0));class p extends h.CAnnoId{constructor(t){super(t.appId),this.readyToAnnote=!1,this.currentTool=(0,c.getDefaultTool)(),this.executedActions=[],this.revokedActions=[],this.actionPduQueue=[],this.objectMapW2M=new Map,this.objectMapM2W=new Map,this.appId=t.appId,this.userName=t.userName,this.presenterId=(0,u.getShareSessionId)(t.presenterId),this.isPresenter=t.isPresenter,this.isBOSession=t.isBOSession,this.boardSDKIns=t.boardSDKIns,this.doc=this._createNewDoc(),this.sendRequestDrawPdu()}startAnnote(){f.default.Notify_APPUI(d.ANNO_UNDO_STATUS,{status:!!this.executedActions.length,presenterId:this.presenterId}),f.default.Notify_APPUI(d.ANNO_REDO_STATUS,{status:!!this.revokedActions.length,presenterId:this.presenterId})}destroy(){this.readyToAnnote=!1,this.doc=null,this.executedActions=[],this.revokedActions=[],this.actionPduQueue=[],this.objectMapW2M.clear(),this.objectMapM2W.clear(),this.boardSDKIns.onMessage({type:c.MSG_TO_WHITEBOARD_TYPE.DESTROY_SESSION,sessionId:this.presenterId})}sendRequestDrawPdu(){let t=(0,u.getDefaultAnnoData)(this.appId,this.userName,this.doc.getId());const e=new l.CAnnoPduDocRequestDraw(c.AnnoPduType.kDocRequestDraw,t);this.sendAnnoMessage(e.data)}sendAnnoMessage(t){const e=new u.CAnnoBuffer(null);e.writeInt8(37),e.writeInt8(this.isBOSession?1:0),e.writeInt16(0),e.writeInt32(this.presenterId);const n={command:c.ANNO_PDU_CMD,isPresenter:this.isPresenter,data:new Uint8Array(e.mData.concat(t.mData))};f.default.mediaSDKHandle.sendAnnotationPdu(n,this.isPresenter)}sendAnnoAction(t){this.readyToAnnote?this.sendAnnoMessage(t.data):this.actionPduQueue.push(t)}setTool(t){this.currentTool=t}onRequestDrawAck(){for(this.readyToAnnote=!0;this.actionPduQueue.length;){const t=this.actionPduQueue.shift();this.sendAnnoAction(t)}}handlePageSync(t){const{docId:e,pageId:n}=t.annoPduPage;this.doc.handlePageSync(e,n)}handleObjAddAck(t){const{annoObjIds:e}=t.annoPduObj;(null==e?void 0:e.length)&&e.forEach(t=>{const e=this.objectMapM2W.get(t);setTimeout(()=>{this.boardSDKIns.onMessage({type:c.MSG_TO_WHITEBOARD_TYPE.ONACK,objectId:e,sessionId:this.presenterId})},750)})}handleObjRemoveAllByHost(t){const{annoObjIds:e}=t.annoPduObj;if(null==e?void 0:e.length){const t=[];e.forEach(e=>{const n=this.objectMapM2W.get(e);n&&t.push(n)}),this.boardSDKIns.onMessage({type:c.MSG_TO_WHITEBOARD_TYPE.ERASE_ALL,objectIds:t,sessionId:this.presenterId})}}handleObjRestoreAllByHost(t){const{annoObjIds:e}=t.annoPduObj;if(null==e?void 0:e.length){const t=[];e.forEach(e=>{const n=this.objectMapM2W.get(e);n&&t.push(n)}),this.boardSDKIns.onMessage({type:c.MSG_TO_WHITEBOARD_TYPE.RESTORE_OBJECTS,objectIds:t,sessionId:this.presenterId})}}handleAddObject(t,e){let n;switch(this.currentTool.toolType){case c.AnnoToolType.ANNO_TOOL_TYPE_PEN:n=new a.CAnnoObjSmoothPen}const i=n.acquireObjId(this.appId);n.setObjHeader({objId:i});const{objectData:r,presenterId:s=this.presenterId}=t;if(!r)return;if(r.lineFormat&&n.setLineFormat(r.lineFormat),r.points){const t=(0,u.normalizePoints)(r.points,e);n.setData(t)}this.doc||(this.doc=this._createNewDoc(),this.readyToAnnote=!1,this.sendRequestDrawPdu());let o=(0,u.getDefaultAnnoData)(this.appId,this.userName,this.doc.getId(),this.doc.getPageId());o.annoObj=n;const h=new l.CAnnoPduAddObj(c.AnnoPduType.kAnnoObjAdd,o);o.annoObjIds=[i],o.whiteboardObjIds=[t.objectId];const d=(0,u.extractActionInfo)(o,c.AnnoPduType.kAnnoObjAdd);this._pushToExecutedAction(d),this.sendAnnoAction(h),this.objectMapW2M.set(t.objectId,i),this.objectMapM2W.set(i,t.objectId)}handleRemoveObject(t){const e=this.objectMapW2M.get(t.objectId);if(e)for(let n=0;n{n.push(t),i.push(this.objectMapM2W.get(t))}),e.isRemoved=!0}}if(!n.length)return e;if(e.annoObjIds=n,e.whiteboardObjIds=i,t){const t=new l.CAnnoPduRemoveUserObj(c.AnnoPduType.kAnnoObjRemoveUser,e),n=(0,u.extractActionInfo)(e,c.AnnoPduType.kAnnoObjRemoveUser);this._pushToExecutedAction(n),this.sendAnnoAction(t)}return this.boardSDKIns.onMessage({type:c.MSG_TO_WHITEBOARD_TYPE.ERASE_ALL,objectIds:i,sessionId:this.presenterId}),e}clearAll(t){const{isHost:e}=t;if(!e)return;let n,i,r=this.clearAllMine(!1);e&&!this.isPresenter&&(i=c.AnnoPduType.kAnnoObjRemoveAllByHost,n=new l.CAnnoPduRemoveAllObjByHost(i,r));const s=(0,u.extractActionInfo)(r,i);this._pushToExecutedAction(s),this.sendAnnoAction(n)}updateUserName(t){this.userName=t}_pushToExecutedAction(t){const e=this.executedActions.length;this.executedActions.push(t),0===e&&f.default.Notify_APPUI(d.ANNO_UNDO_STATUS,{status:!0,presenterId:this.presenterId})}_pushToRevokedAction(t){const e=this.revokedActions.length;this.revokedActions.push(t),0===e&&f.default.Notify_APPUI(d.ANNO_REDO_STATUS,{status:!0,presenterId:this.presenterId})}_popExecutedAction(){const t=this.executedActions.length,e=this.executedActions.pop();return t&&!this.executedActions.length&&f.default.Notify_APPUI(d.ANNO_UNDO_STATUS,{status:!1,presenterId:this.presenterId}),e}_popRevokedAction(){const t=this.revokedActions.length,e=this.revokedActions.pop();return t&&!this.revokedActions.length&&f.default.Notify_APPUI(d.ANNO_REDO_STATUS,{status:!1,presenterId:this.presenterId}),e}_copyPduActionData(t){let e=(0,u.getDefaultAnnoData)();return Object.assign(e,t),e}_markRemoveStatus(t,e){const{annoObjIds:n}=t;if(null==n?void 0:n.length)for(let t=0;t{n.includes(t)&&(i.isRemoved=e)})}}}_createNewDoc(){return new a.CAnnoDoc({appId:this.appId,isPresenter:this.isPresenter,userName:this.userName,preseterId:this.presenterId})}}e.default=p},93:function(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationMgr=void 0;const r=i(n(110)),s=i(n(115)),o=n(98),a=n(102),h=n(101),c=n(106),u=new Map;class l extends h.CAnnoId{constructor(t){super(t.appId),this.currentTool=(0,o.getDefaultTool)(),this.objectMapW2M=new Map,this.objectMapM2W=new Map,this.appId=t.appId,this.userName=t.userName,this.presenterId=(0,a.getShareSessionId)(t.presenterId),this.sharingMainCanvas=t.sharingMainCanvas,this.annoCanvas=t.annoCanvas,this.remoteSizeInfo=t.remoteSizeInfo,this.shareCanvasOserver=new MutationObserver(this.updateAnnoCanvasSize.bind(this)),this.shareCanvasOserver.observe(this.sharingMainCanvas,{attributes:!0}),this.boardSDKIns=new r.default,this.boardSDKIns.init({mainCanvas:this.sharingMainCanvas,annoCanvas:this.annoCanvas,onAnnotationMsg:this.onAnnotationMsg.bind(this),sessionId:this.presenterId}),this.annoSession=this._createSession(this.presenterId,t.isBOSession)}destroy(){var t;null===(t=this.boardSDKIns)||void 0===t||t.destroy(),u.forEach(t=>{t.destroy()}),this.shareCanvasOserver.disconnect()}startAnnotation(t=this.presenterId,e=!1){const n=(0,a.getShareSessionId)(t);this.presenterId=n;let i=u.get(n);i||(i=this._createSession(n)),i.isBOSession=e,this.annoSession=i,i.startAnnote(),this.boardSDKIns.onMessage({type:o.MSG_TO_WHITEBOARD_TYPE.CHANGE_SESSION,sessionId:this.presenterId}),this.currentTool.toolType=o.AnnoToolType.ANNO_TOOL_TYPE_NONE,this.boardSDKIns.onMessage(Object.assign({type:o.MSG_TO_WHITEBOARD_TYPE.TOOL_SELECT,sessionId:this.presenterId},this.currentTool)),this.updateAnnoCanvasSize()}stopAnnotation(t){const{presenterId:e}=t;if(!e)return;const n=(0,a.getShareSessionId)(e),i=u.get(n);null==i||i.destroy(),u.delete(n)}updateCanvas(t){var e;this.sharingMainCanvas=t.sharingMainCanvas,this.annoCanvas=t.annoCanvas;const n=this._checkRemoteSizeInfo();null===(e=this.boardSDKIns)||void 0===e||e.onMessage(Object.assign({type:o.MSG_TO_WHITEBOARD_TYPE.UPDATE_CANVAS,mainCanvas:this.sharingMainCanvas,annoCanvas:this.annoCanvas},n))}updateAnnoCanvasSize(){var t;const e=this._checkRemoteSizeInfo();null===(t=this.boardSDKIns)||void 0===t||t.onMessage(Object.assign({type:o.MSG_TO_WHITEBOARD_TYPE.RESIZE},e))}updateRemoteSizeInfo(t){this.remoteSizeInfo.width=t.width||this.remoteSizeInfo.width,this.remoteSizeInfo.height=t.height||this.remoteSizeInfo.height}getAppId(){return this.appId}onRWGMessage(t){if(37!==t[0])return;const e=(0,c.parsePdu)(t);if(!e)return;switch(e.getPduType()){case o.AnnoPduType.kDocRequestDrawAck:this.handleRequestDrawAck(e);break;case o.AnnoPduType.kPageSync:this.handlePageSync(e);break;case o.AnnoPduType.kAnnoObjAddAck:this.handleObjAddAck(e);break;case o.AnnoPduType.kAnnoObjRemoveAllByHost:this.handleObjRemoveAllByHost(e);break;case o.AnnoPduType.kAnnoObjRestoreAllByHost:this.handleObjRestoreAllByHost(e)}}handleRequestDrawAck(t){var e,n;if((null===(e=t.annoPduDocRequestDrawAck)||void 0===e?void 0:e.requesterId)===this.appId){const e=t.annoPduHeader.appId;null===(n=u.get(e))||void 0===n||n.onRequestDrawAck()}}handlePageSync(t){var e;const n=t.annoPduHeader.appId;null===(e=u.get(n))||void 0===e||e.handlePageSync(t)}handleObjAddAck(t){var e;const n=t.annoPduHeader.appId;null===(e=u.get(n))||void 0===e||e.handleObjAddAck(t)}handleObjRemoveAllByHost(t){var e;const n=t.annoPduHeader.appId;null===(e=u.get(n))||void 0===e||e.handleObjRemoveAllByHost(t)}handleObjRestoreAllByHost(t){var e;const n=t.annoPduHeader.appId;null===(e=u.get(n))||void 0===e||e.handleObjRestoreAllByHost(t)}onAnnotationMsg(t){const{type:e}=t;switch(e){case o.ANNO_MSG_TYPE.ADD_OBJECT:this.handleAddObject(t);break;case o.ANNO_MSG_TYPE.REMOVE_OBJECT:this.handleRemoveObject(t)}}handleAddObject(t){this.annoSession.handleAddObject(t,this.sharingMainCanvas)}handleRemoveObject(t){this.annoSession.handleRemoveObject(t)}onAnnotationActions(t){switch(t.actionType){case o.ANNOTATION_ACTTION_TYPE.SELECT_MOUSE:t.toolType=o.AnnoToolType.ANNO_TOOL_TYPE_NONE,this.handleSelectTool(t);break;case o.ANNOTATION_ACTTION_TYPE.SELECT_ERASER:t.toolType=o.AnnoToolType.ANNO_TOOL_TYPE_ERASER,this.handleSelectTool(t);break;case o.ANNOTATION_ACTTION_TYPE.SELECT_TOOL:this.handleSelectTool(t);break;case o.ANNOTATION_ACTTION_TYPE.UNDO:this.handleUndo();break;case o.ANNOTATION_ACTTION_TYPE.REDO:this.handleRedo();break;case o.ANNOTATION_ACTTION_TYPE.CLEAR:this.handleClear(t);break;case o.ANNOTATION_ACTTION_TYPE.CLOSE_TOOL_BAR:this.boardSDKIns.onMessage({type:o.MSG_TO_WHITEBOARD_TYPE.TOOL_BAR_CLOSED});break;case o.ANNOTATION_ACTTION_TYPE.UPDATE_PARAMS:this.handleUpdateParams(t);break;case o.ANNOTATION_ACTTION_TYPE.PAUSE_ANNOTATION:this.handlePauseAnnotation(t)}}handleSelectTool(t){const{toolType:e,width:n,color:i}=t,r=parseInt(i),s=16777215&r,a=(r>>>24)/255;this.currentTool={toolType:e,width:n,color:s,alpha:a},this.annoSession.setTool(this.currentTool),this.boardSDKIns.onMessage(Object.assign({type:o.MSG_TO_WHITEBOARD_TYPE.TOOL_SELECT,sessionId:this.presenterId},this.currentTool))}handleUndo(){var t;null===(t=u.get(this.presenterId))||void 0===t||t.handleUndo()}handleRedo(){var t;null===(t=u.get(this.presenterId))||void 0===t||t.handleRedo()}handleClear(t){var e;null===(e=u.get(this.presenterId))||void 0===e||e.handleClear(t)}handleUpdateParams(t){const{userName:e}=t;"string"==typeof e&&u.forEach(t=>{t.updateUserName(e)})}handlePauseAnnotation(t){const{paused:e}=t;if("boolean"==typeof e){let t;t=e?{toolType:o.AnnoToolType.ANNO_TOOL_TYPE_NONE}:this.currentTool,this.boardSDKIns.onMessage(Object.assign({type:o.MSG_TO_WHITEBOARD_TYPE.TOOL_SELECT,sessionId:this.presenterId},t))}}_createSession(t,e=!1){const n=new s.default({appId:this.appId,userName:this.userName,presenterId:t,isPresenter:this.appId===t,isBOSession:e,boardSDKIns:this.boardSDKIns});return u.set(t,n),n}_checkRemoteSizeInfo(){var t,e;const n=null===(t=this.sharingMainCanvas)||void 0===t?void 0:t.offsetWidth,i=null===(e=this.sharingMainCanvas)||void 0===e?void 0:e.offsetHeight;return{width:n,height:i,absWidth:this.remoteSizeInfo.width||n,absHeight:this.remoteSizeInfo.height||i}}}e.AnnotationMgr=l},98:function(t,e,n){"use strict";var i,r,s,o,a,h,c,u,l,d,f,p,g,v,_;Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultTool=e.getDefaultAnnoPageState=e.getDefaultAnnoPduPage=e.getDefaultAnnoObjScribble=e.getDefaultAnnoLineFormat=e.getDefaultPduDocRequestDrawAck=e.getDefaultPduDocRequestDraw=e.getDefaultAnnoPduHeader=e.getDefaultAnnoObjHeader=e.DEFAULT_CAPTURE_FRAME_RATE=e.MSG_TO_WHITEBOARD_TYPE=e.ANNOTATION_CLEAR_TYPE=e.AnnoToolType=e.ANNOTATION_ACTTION_TYPE=e.ANNO_MSG_TYPE=e.ANNO_ENCODE_TYPE=e.AnnoObjFlagMask=e.AnnoLineCapStyle=e.AnnoLineJoinStyle=e.AnnoLineDashStyle=e.AnnoLineFormatType=e.AnnoDocRequestDrawAckCode=e.AnnoDnSource=e.AnnoPduType=e.AnnoObjType=e.ANNO_PDU_CMD=e.ANNO_ENGINE_VERSION=e.NULL_NODE_ID=void 0,e.NULL_NODE_ID=4294967295,e.ANNO_ENGINE_VERSION=610,e.ANNO_PDU_CMD="SEND_ANNOTATION_PDU",function(t){t[t.kComposite=0]="kComposite",t[t.kGroup=1]="kGroup",t[t.kPen=2]="kPen",t[t.kSmoothPen=3]="kSmoothPen",t[t.kNull=77]="kNull"}(i||(e.AnnoObjType=i={})),function(t){t[t.kAppBase=4096]="kAppBase",t[t.kAppMax=8191]="kAppMax",t[t.kDocBase=8192]="kDocBase",t[t.kDocRequestDraw=8193]="kDocRequestDraw",t[t.kDocRequestDrawAck=8194]="kDocRequestDrawAck",t[t.kPageBase=12288]="kPageBase",t[t.kPageSync=12293]="kPageSync",t[t.kAnnoObjBase=65536]="kAnnoObjBase",t[t.kAnnoObjAdd=65537]="kAnnoObjAdd",t[t.kAnnoObjAddAck=65538]="kAnnoObjAddAck",t[t.kAnnoObjRemove=65539]="kAnnoObjRemove",t[t.kAnnoObjRestore=65540]="kAnnoObjRestore",t[t.kAnnoObjRemoveUser=65541]="kAnnoObjRemoveUser",t[t.kAnnoObjRestoreUser=65542]="kAnnoObjRestoreUser",t[t.kAnnoObjRemoveAll=65545]="kAnnoObjRemoveAll",t[t.kAnnoObjRestoreAll=65546]="kAnnoObjRestoreAll",t[t.kAnnoObjRemoveAllByHost=65547]="kAnnoObjRemoveAllByHost",t[t.kAnnoObjRestoreAllByHost=65548]="kAnnoObjRestoreAllByHost",t[t.kNull=143360]="kNull"}(r||(e.AnnoPduType=r={})),function(t){t[t.FROM_LOCAL=0]="FROM_LOCAL",t[t.FROM_REMOTE=1]="FROM_REMOTE"}(s||(e.AnnoDnSource=s={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.ACCPETED=1]="ACCPETED",t[t.DECLINED=2]="DECLINED"}(o||(e.AnnoDocRequestDrawAckCode=o={})),function(t){t[t.ANNO_LINE_FORMAT_TYPE_NONE=0]="ANNO_LINE_FORMAT_TYPE_NONE",t[t.ANNO_LINE_FORMAT_TYPE_COLOR=1]="ANNO_LINE_FORMAT_TYPE_COLOR",t[t.ANNO_LINE_FORMAT_TYPE_DEFAULT=1]="ANNO_LINE_FORMAT_TYPE_DEFAULT"}(a||(e.AnnoLineFormatType=a={})),function(t){t[t.ANNO_LINE_DASH_STYLE_SOLID=0]="ANNO_LINE_DASH_STYLE_SOLID",t[t.ANNO_LINE_DASH_STYLE_DASH=1]="ANNO_LINE_DASH_STYLE_DASH",t[t.ANNO_LINE_DASH_STYLE_DOT=2]="ANNO_LINE_DASH_STYLE_DOT",t[t.ANNO_LINE_DASH_STYLE_DASHDOT=3]="ANNO_LINE_DASH_STYLE_DASHDOT",t[t.ANNO_LINE_DASH_STYLE_DASHDOTDOT=4]="ANNO_LINE_DASH_STYLE_DASHDOTDOT",t[t.ANNO_LINE_DASH_STYLE_PATTERN=5]="ANNO_LINE_DASH_STYLE_PATTERN",t[t.ANNO_LINE_DASH_STYLE_DEFAULT=0]="ANNO_LINE_DASH_STYLE_DEFAULT"}(h||(e.AnnoLineDashStyle=h={})),function(t){t[t.ANNO_LINE_JOIN_STYLE_JOINMITER=0]="ANNO_LINE_JOIN_STYLE_JOINMITER",t[t.ANNO_LINE_JOIN_STYLE_JOINROUND=1]="ANNO_LINE_JOIN_STYLE_JOINROUND",t[t.ANNO_LINE_JOIN_STYLE_JOINBEVEL=2]="ANNO_LINE_JOIN_STYLE_JOINBEVEL",t[t.ANNO_LINE_JOIN_STYLE_MITERORBEVEL=3]="ANNO_LINE_JOIN_STYLE_MITERORBEVEL",t[t.ANNO_LINE_JOIN_STYLE_DEFAULT=1]="ANNO_LINE_JOIN_STYLE_DEFAULT"}(c||(e.AnnoLineJoinStyle=c={})),function(t){t[t.ANNO_LINE_CAP_STYLE_BUTT=0]="ANNO_LINE_CAP_STYLE_BUTT",t[t.ANNO_LINE_CAP_STYLE_CAPROUND=1]="ANNO_LINE_CAP_STYLE_CAPROUND",t[t.ANNO_LINE_CAP_STYLE_CAPSQUARE=2]="ANNO_LINE_CAP_STYLE_CAPSQUARE",t[t.ANNO_LINE_CAP_STYLE_CAPTRIANGLE=3]="ANNO_LINE_CAP_STYLE_CAPTRIANGLE",t[t.ANNO_LINE_CAP_STYLE_DEFAULT=1]="ANNO_LINE_CAP_STYLE_DEFAULT"}(u||(e.AnnoLineCapStyle=u={})),function(t){t[t.ANNO_OBJ_FLAG_NOTHING=0]="ANNO_OBJ_FLAG_NOTHING",t[t.ANNO_OBJ_FLAG_WITH_TRANSFORM=1]="ANNO_OBJ_FLAG_WITH_TRANSFORM",t[t.ANNO_OBJ_FLAG_WITH_LINE=2]="ANNO_OBJ_FLAG_WITH_LINE",t[t.ANNO_OBJ_FLAG_WITH_FILL=4]="ANNO_OBJ_FLAG_WITH_FILL",t[t.ANNO_OBJ_FLAG_WITH_TEXTFRAME=8]="ANNO_OBJ_FLAG_WITH_TEXTFRAME"}(l||(e.AnnoObjFlagMask=l={})),function(t){t[t.ANNO_ENCODE_TYPE_NONE=0]="ANNO_ENCODE_TYPE_NONE",t[t.ANNO_ENCODE_TYPE_BASE64=1]="ANNO_ENCODE_TYPE_BASE64",t[t.ANNO_ENCODE_TYPE_GZIP_BASE64=2]="ANNO_ENCODE_TYPE_GZIP_BASE64"}(d||(e.ANNO_ENCODE_TYPE=d={})),function(t){t.ADD_OBJECT="addObject",t.REMOVE_OBJECT="removeObject"}(f||(e.ANNO_MSG_TYPE=f={})),function(t){t[t.SELECT_MOUSE=0]="SELECT_MOUSE",t[t.SELECT_TOOL=1]="SELECT_TOOL",t[t.SELECT_ERASER=2]="SELECT_ERASER",t[t.UNDO=3]="UNDO",t[t.REDO=4]="REDO",t[t.CLEAR=5]="CLEAR",t[t.CLOSE_TOOL_BAR=6]="CLOSE_TOOL_BAR",t[t.UPDATE_PARAMS=7]="UPDATE_PARAMS",t[t.PAUSE_ANNOTATION=8]="PAUSE_ANNOTATION"}(p||(e.ANNOTATION_ACTTION_TYPE=p={})),function(t){t[t.ANNO_TOOL_TYPE_NONE=0]="ANNO_TOOL_TYPE_NONE",t[t.ANNO_TOOL_TYPE_PEN=1]="ANNO_TOOL_TYPE_PEN",t[t.ANNO_TOOL_TYPE_HIGHLIGHTER=2]="ANNO_TOOL_TYPE_HIGHLIGHTER",t[t.ANNO_TOOL_TYPE_SPOTLIGHT=3]="ANNO_TOOL_TYPE_SPOTLIGHT",t[t.ANNO_TOOL_TYPE_ARROW=4]="ANNO_TOOL_TYPE_ARROW",t[t.ANNO_TOOL_TYPE_TEXTBOX=5]="ANNO_TOOL_TYPE_TEXTBOX",t[t.ANNO_TOOL_TYPE_PICTURE=6]="ANNO_TOOL_TYPE_PICTURE",t[t.ANNO_TOOL_TYPE_ERASER=7]="ANNO_TOOL_TYPE_ERASER"}(g||(e.AnnoToolType=g={})),function(t){t[t.CLEAR_MINE=0]="CLEAR_MINE",t[t.CLEAR_VIEWER=1]="CLEAR_VIEWER",t[t.CLEAR_ALL=2]="CLEAR_ALL"}(v||(e.ANNOTATION_CLEAR_TYPE=v={})),function(t){t[t.ONACK=0]="ONACK",t[t.TOOL_SELECT=1]="TOOL_SELECT",t[t.ERASE_ALL=2]="ERASE_ALL",t[t.RESIZE=3]="RESIZE",t[t.REMOVE_OBJECTS=4]="REMOVE_OBJECTS",t[t.RESTORE_OBJECTS=5]="RESTORE_OBJECTS",t[t.TOOL_BAR_CLOSED=6]="TOOL_BAR_CLOSED",t[t.CHANGE_SESSION=7]="CHANGE_SESSION",t[t.UPDATE_CANVAS=8]="UPDATE_CANVAS",t[t.DESTROY_SESSION=9]="DESTROY_SESSION"}(_||(e.MSG_TO_WHITEBOARD_TYPE=_={})),e.DEFAULT_CAPTURE_FRAME_RATE=10,e.getDefaultAnnoObjHeader=function(){return{struSize:18,dataSize:18,objType:i.kNull,objFlag:e.NULL_NODE_ID,objId:e.NULL_NODE_ID}},e.getDefaultAnnoPduHeader=function(){return{struSize:22,dataSize:22,pduType:r.kNull,pduId:e.NULL_NODE_ID,appId:e.NULL_NODE_ID,pduTimeStamp:Date.now()}},e.getDefaultPduDocRequestDraw=function(){return{struSize:14,dataSize:14,requesterId:e.NULL_NODE_ID,docId:e.NULL_NODE_ID,requesterEngineVersion:e.ANNO_ENGINE_VERSION,requesterName:""}},e.getDefaultPduDocRequestDrawAck=function(){return{struSize:26,dataSize:26,requesterId:e.NULL_NODE_ID,composerId:e.NULL_NODE_ID,docId:e.NULL_NODE_ID,composerEngineVersion:e.NULL_NODE_ID,composerAckCode:o.UNKNOWN,docDpiScale:1,composerName:""}},e.getDefaultAnnoLineFormat=function(){return{struSize:10,dataSize:40,type:a.ANNO_LINE_FORMAT_TYPE_DEFAULT,annoLineData:{colorLine:{struSize:30,dataSize:30,dashStyle:h.ANNO_LINE_DASH_STYLE_DEFAULT,joinStyle:c.ANNO_LINE_JOIN_STYLE_DEFAULT,capStyle:u.ANNO_LINE_CAP_STYLE_DEFAULT,width:2,color:255,alpha:1}}}},e.getDefaultAnnoObjScribble=function(){return{struSize:6,dataSize:6,annoPoints:[]}},e.getDefaultAnnoPduPage=function(){return{struSize:14,dataSize:14,docId:e.NULL_NODE_ID,pageId:e.NULL_NODE_ID}},e.getDefaultAnnoPageState=function(){return{pageId:0,isErased:!1}},e.getDefaultTool=function(){return{toolType:g.ANNO_TOOL_TYPE_NONE,width:0,color:0,alpha:0}}}}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/annoter.min.js-f70a54867a7b3a7e819e.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/audio.encode.wasm b/@zoom/videosdk-ui-toolkit/dist/lib/audio.encode.wasm new file mode 100644 index 0000000..1175559 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/lib/audio.encode.wasm differ diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/audio.simd.wasm b/@zoom/videosdk-ui-toolkit/dist/lib/audio.simd.wasm new file mode 100644 index 0000000..a29f29f Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/lib/audio.simd.wasm differ diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/audio_simd.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/audio_simd.min.js new file mode 100644 index 0000000..8428f2a --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/audio_simd.min.js @@ -0,0 +1,21 @@ +!function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=55)}([,,,function(e,t,n){"use strict";var s=n(5),r=n(16);new Error;const i=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,u=null;function c(e,t){var n,s;if(!function(e){const t=performance.now();return(!i.has(e)||t-i.get(e)>5e3)&&(i.set(e,t),!0)}(e))return;let c;try{c=a("object"==typeof t?JSON.stringify(t):t)}catch(e){c=a(t)}null===(n=u)||void 0===n||n("NEM-".concat(e,"-").concat(c)),r.a.error("NotifyUIError,event=".concat(e,",data=").concat(c)),null===(s=o)||void 0===s||s(e,t)}var l=n(15);function h(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function _(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function p(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const n=await new Promise((e,t)=>{const n=s=>{let r=s.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===r.command?(v("DE"),self.removeEventListener("message",n),e(r.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===r.command&&(self.removeEventListener("message",n),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",n),v("DS"),postMessage({status:s.E,url:wasmUrl})});let r=await WebAssembly.instantiate(n,e);r.instance?(self.wasmModuleToShare=r.module,t(r.instance)):(self.wasmModuleToShare=n,t(r))}catch(e){v("IF"),g("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}n.d(t,"d",(function(){return h})),n.d(t,"g",(function(){return d})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return _})),n.d(t,"c",(function(){return p})),n.d(t,"q",(function(){return m})),n.d(t,"i",(function(){return E})),n.d(t,"u",(function(){return g})),n.d(t,"t",(function(){return A})),n.d(t,"o",(function(){return v})),n.d(t,"n",(function(){return S})),n.d(t,"v",(function(){return y})),n.d(t,"w",(function(){return T})),n.d(t,"p",(function(){return w})),n.d(t,"s",(function(){return D})),n.d(t,"k",(function(){return I})),n.d(t,"m",(function(){return C})),n.d(t,"r",(function(){return R})),n.d(t,"l",(function(){return U})),n.d(t,"x",(function(){return x})),n.d(t,"b",(function(){return F})),n.d(t,"h",(function(){return W})),n.d(t,"y",(function(){return q})),n.d(t,"a",(function(){return j})),n.d(t,"j",(function(){return V}));const b="function"!=typeof importScripts;function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;b?r.a.error(e,t):g(e,t)}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var n,r,i,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(n=t)||void 0===n?void 0:n.message)+" Stack: "+(null!==(r=null===(i=t)||void 0===i||null===(i=i.error)||void 0===i?void 0:i.stack)&&void 0!==r?r:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:s.G,errorMessage:e,errorEvent:t})}function A(e){postMessage({status:s.G,errorMessage:e,level:"low"})}function v(e){postMessage({status:s.zb,data:e})}function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:s.f,data:e});postMessage({status:s.f,data:e})}function y(e){postMessage({status:s.M,canvasId:e,replaceCanvas:!1})}function T(e){postMessage({status:s.N,canvasId:e})}function w(e){b?c(l.k,e):postMessage({status:s.Bb,where:e})}function M(){let e=this;this.promise=new Promise((function(t,n){e.reject=n,e.resolve=t}))}function D(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(n){t=null==e?void 0:e.getContext("2d")}return t||g("get2DContextFromCanvas return null"),t}class I{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let n=0;n0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,n)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new M;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class C{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let n=e.byteLength-this.sharedBufferList.bytesPerElement;if(n>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),s=n>e?n:e;if(s+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(s)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){g("Error in YuvWrap.recycle: ".concat(e))}}}function O(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function k(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const L=["","MOZ_","OP_","WEBKIT_"];function R(e,t){for(var n=0;n0&&(t+="&index="+e);let n={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:O,onclose:k,group:this,index:e},s=new N(n);await s.connect(),this.transportArray[e]=s}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const P=new Map,B=[90,180,360,720,1080],H=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const n=this.ssrcInfoMap.get(e);if(0===n.frames?n.firstTime=t:n.lastTime=t,n.frames+=1,n.frames>2&&n.frames%5==0&&n.lastTime-n.firstTime>=1e3){const t=Math.floor(1e3/((n.lastTime-n.firstTime)/(n.frames-1)));n.fps!==t&&(this._notifyFPS(e,t),n.fps=t),n.firstTime=n.lastTime,n.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,n)=>{const s=this.ssrcInfoMap.get(n);s&&e-s.lastTime>2e3&&(this.ssrcInfoMap.delete(n),this._notifyFPS(n,0))})}_notifyFPS(e,t){postMessage({status:s.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function x(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:r,r_h:i,rotation:a,ssrc:o}=e;let u=1==a||3==a,c=u?i:r,l=u?r:i;const h=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!P.get(h)||P.get(h).width!==c||P.get(h).height!==l){const e={width:c,height:l,ssrc:h,quality:f};P.set(h,e),n?n(e):postMessage({status:s.v,data:e})}t&&H.updateSSRCInfo(h,Date.now())}function F(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function W(e,t,n,s,r){if(!r&&!s||1==e)return!1;let i=s&&t>=640,a=r&&t>=1280;return 2!=e||640==t&&480==n?i||a:((i||a)&&E("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(n)),!1)}function q(e,t){e?e.send(t):g("websocket is null",new Error("message type ".concat(t[0])))}function j(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function V(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,n){"use strict";n.d(t,"y",(function(){return s})),n.d(t,"Y",(function(){return r})),n.d(t,"L",(function(){return i})),n.d(t,"K",(function(){return a})),n.d(t,"J",(function(){return o})),n.d(t,"v",(function(){return u})),n.d(t,"q",(function(){return c})),n.d(t,"r",(function(){return l})),n.d(t,"w",(function(){return h})),n.d(t,"x",(function(){return d})),n.d(t,"u",(function(){return f})),n.d(t,"X",(function(){return _})),n.d(t,"P",(function(){return p})),n.d(t,"Q",(function(){return m})),n.d(t,"O",(function(){return b})),n.d(t,"M",(function(){return E})),n.d(t,"s",(function(){return g})),n.d(t,"k",(function(){return A})),n.d(t,"n",(function(){return v})),n.d(t,"l",(function(){return S})),n.d(t,"m",(function(){return y})),n.d(t,"db",(function(){return T})),n.d(t,"B",(function(){return w})),n.d(t,"C",(function(){return M})),n.d(t,"W",(function(){return D})),n.d(t,"ab",(function(){return I})),n.d(t,"V",(function(){return C})),n.d(t,"Z",(function(){return O})),n.d(t,"N",(function(){return k})),n.d(t,"h",(function(){return L})),n.d(t,"g",(function(){return R})),n.d(t,"f",(function(){return U})),n.d(t,"A",(function(){return N})),n.d(t,"z",(function(){return P})),n.d(t,"S",(function(){return B})),n.d(t,"R",(function(){return H})),n.d(t,"e",(function(){return x})),n.d(t,"o",(function(){return F})),n.d(t,"T",(function(){return W})),n.d(t,"U",(function(){return q})),n.d(t,"G",(function(){return j})),n.d(t,"E",(function(){return V})),n.d(t,"H",(function(){return Y})),n.d(t,"I",(function(){return z})),n.d(t,"F",(function(){return G})),n.d(t,"bb",(function(){return Z})),n.d(t,"c",(function(){return K})),n.d(t,"b",(function(){return X})),n.d(t,"cb",(function(){return Q})),n.d(t,"d",(function(){return J})),n.d(t,"t",(function(){return $})),n.d(t,"D",(function(){return ee})),n.d(t,"p",(function(){return te})),n.d(t,"a",(function(){return ne})),n.d(t,"j",(function(){return se})),n.d(t,"i",(function(){return re}));const s=1e3,r=5,i=43,a=44,o=45,u=0,c=1,l=146,h=2,d=7,f=9,_=17,p=10,m=11,b=12,E=102,g=107,A=0,v=1,S=2,y=3,T=65,w=0,M=1,D=-1,I=0,C=1,O=2,k=3,L=1,R=2,U=3,N={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},P={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,H=20,x=15,F=10,W=8294400,q=5,j=0,V=1,Y=2,z=15,G=5,Z=400,K=7,X=8,Q={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,ne=1,se=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),re={PAUSE:0,RESUME:1,STOP:2}},function(e,t,n){"use strict";n.d(t,"j",(function(){return s})),n.d(t,"h",(function(){return r})),n.d(t,"l",(function(){return i})),n.d(t,"sb",(function(){return a})),n.d(t,"qb",(function(){return o})),n.d(t,"ub",(function(){return u})),n.d(t,"Z",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"bb",(function(){return h})),n.d(t,"db",(function(){return d})),n.d(t,"D",(function(){return f})),n.d(t,"ob",(function(){return _})),n.d(t,"H",(function(){return p})),n.d(t,"Eb",(function(){return m})),n.d(t,"n",(function(){return b})),n.d(t,"vb",(function(){return E})),n.d(t,"E",(function(){return g})),n.d(t,"b",(function(){return A})),n.d(t,"zb",(function(){return v})),n.d(t,"S",(function(){return S})),n.d(t,"I",(function(){return y})),n.d(t,"T",(function(){return T})),n.d(t,"xb",(function(){return w})),n.d(t,"f",(function(){return M})),n.d(t,"nb",(function(){return D})),n.d(t,"mb",(function(){return I})),n.d(t,"eb",(function(){return C})),n.d(t,"X",(function(){return O})),n.d(t,"V",(function(){return k})),n.d(t,"a",(function(){return L})),n.d(t,"z",(function(){return R})),n.d(t,"Fb",(function(){return U})),n.d(t,"G",(function(){return N})),n.d(t,"wb",(function(){return P})),n.d(t,"v",(function(){return B})),n.d(t,"u",(function(){return H})),n.d(t,"t",(function(){return x})),n.d(t,"w",(function(){return F})),n.d(t,"U",(function(){return W})),n.d(t,"jb",(function(){return q})),n.d(t,"kb",(function(){return j})),n.d(t,"R",(function(){return V})),n.d(t,"hb",(function(){return Y})),n.d(t,"ib",(function(){return z})),n.d(t,"F",(function(){return G})),n.d(t,"r",(function(){return Z})),n.d(t,"q",(function(){return K})),n.d(t,"y",(function(){return X})),n.d(t,"p",(function(){return Q})),n.d(t,"x",(function(){return J})),n.d(t,"Cb",(function(){return $})),n.d(t,"O",(function(){return ee})),n.d(t,"P",(function(){return te})),n.d(t,"Ab",(function(){return ne})),n.d(t,"C",(function(){return se})),n.d(t,"B",(function(){return re})),n.d(t,"A",(function(){return ie})),n.d(t,"K",(function(){return ae})),n.d(t,"J",(function(){return oe})),n.d(t,"L",(function(){return ue})),n.d(t,"o",(function(){return ce})),n.d(t,"s",(function(){return le})),n.d(t,"gb",(function(){return he})),n.d(t,"fb",(function(){return de})),n.d(t,"Db",(function(){return fe})),n.d(t,"Q",(function(){return _e})),n.d(t,"i",(function(){return pe})),n.d(t,"g",(function(){return me})),n.d(t,"k",(function(){return be})),n.d(t,"m",(function(){return Ee})),n.d(t,"rb",(function(){return ge})),n.d(t,"pb",(function(){return Ae})),n.d(t,"tb",(function(){return ve})),n.d(t,"Y",(function(){return Se})),n.d(t,"cb",(function(){return ye})),n.d(t,"ab",(function(){return Te})),n.d(t,"c",(function(){return we})),n.d(t,"M",(function(){return Me})),n.d(t,"Bb",(function(){return De})),n.d(t,"N",(function(){return Ie})),n.d(t,"yb",(function(){return Ce})),n.d(t,"W",(function(){return Oe})),n.d(t,"lb",(function(){return ke})),n.d(t,"e",(function(){return Le}));const s=1,r=2,i=3,a=7,o=8,u=9,c=12,l=14,h=15,d=16,f=18,_=20,p=21,m=24,b=26,E=27,g=30,A=31,v=35,S=36,y=37,T=38,w=47,M=48,D=50,I=51,C=52,O=53,k=54,L=56,R=57,U=60,N=61,P=62,B=66.5,H=66.6,x=67,F=68,W=69,q=71,j=72,V=73,Y=75,z=76,G=78,Z=105,K=106,X=107,Q=108,J=109,$=120,ee=121,te=122,ne=123,se=124,re=125,ie=126,ae=127,oe=128,ue=129,ce=132,le=133,he=135,de=136,fe=137,_e=151,pe=-1,me=-2,be=-3,Ee=-5,ge=-7,Ae=-8,ve=-9,Se=-12,ye=-14,Te=-15,we=-23,Me=-26,De=-27,Ie=-28,Ce=-35,Oe=-129,ke=-130,Le=-131},function(e,t,n){"use strict";n.d(t,"e",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"d",(function(){return f})),n.d(t,"a",(function(){return _})),n.d(t,"c",(function(){return p}));var s=n(7),r=n.n(s),i=n(14),a=n(17),o=n(5),u=n(10),c=n(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},h=e=>{0};class d{constructor(){this.onmessage=h,this.status=d.CLOSED,this.onopen=h,this.onclose=h,this.onwer=null}send(e){}delete(){this.onmessage=h,this.onopen=h,this.onclose=h,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}r()(d,"OPEN",1),r()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=h,this.sender=h,this.videoSender=h,this.reciver=h,this.wasmSender=h}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=h,this.sender=h,this.videoSender=h,this.reciver=h,this.wasmSender=h;let{consumer:n}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==n||n.setDataCallback(h),null==n||n.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=h),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:n}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(n,0);break;case o.L:this.status=n,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:n,interval:s}=e||{};n?s?(this.sender=e=>{n.enqueue(e)},this.wasmSender=e=>{n.enqueue(e)},this.videoSender=(e,t)=>{if(!n.enqueueSafe([e,t],!1)){let s=new Uint8Array(t.length+e.length);s.set(e,0),s.set(t,e.length),n.enqueueSafe(s)}}):(this.sender=e=>{n.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{n.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!n.enqueueSafe([e,t],!1)){let s=new Uint8Array(t.length+e.length);s.set(e,0),s.set(t,e.length),n.enqueueSafe(s)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let n=new Uint8Array(t.length+e.length);n.set(e,0),n.set(t,e.length),this.port.postMessage({cmd:o.K,data:n},[n.buffer])});let{sabqueue:r,consumer:u,useCopy:c,interval:l,offset:h}=t||{};if(u&&(u.cancelConsume(),u=null),r){const e=c?e=>{this.onmessage(e,0)}:h?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let n=null,s=_.dataTransportMgr.monitorlogfn;if(l&&s){var d;let e=new i.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});n=e.timeoutReport.bind(e)}u=new a.a(r,e,n),t.consumer=u,l?u.consume(l,c):this.reciver=()=>{u.consumeAll(c)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=h,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:n,interval:s,offset:r,length:i,useOneElement:o}=e,u=new a.b(r>0?t.buffer:t,void 0,void 0,!!o,r,i,r>0?t:null);this.sab.sender={sabqueue:u,interval:s,useCopy:n,offset:r}}if(null!=t&&t.sab){var n;let{sab:e,useCopy:s,interval:r,offset:i,length:o,useOneElement:u}=t,c=new a.b(i>0?e.buffer:e,void 0,void 0,!!u,i,o,i>0?e:null),{consumer:l}=(null===(n=this.sab)||void 0===n?void 0:n.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:c,interval:r,useCopy:s,offset:i}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class _{constructor(e){this.onmessage=h,this.onopen=h,this.onclose=h,this.connect_type=e.connect_type||_.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=u.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=_.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==c.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=_.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==c.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}r()(_,"UDP",0),r()(_,"TCP",1),r()(_,"RLB_UDP",2),r()(_,"dataTransportMgr",null);class p{constructor(e){this.sock=null,this.onmessage=h}isReady(){return!1}send(){h()}setStatus(e){0}}function m(e,t,n,s){var r;null===(r=c.a.monitorlogfn)||void 0===r||r.call(c.a,e,"".concat(t,",").concat(n,",").concat(s))}},function(e,t,n){var s=n(34);e.exports=function(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.d(t,"p",(function(){return s})),n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return a})),n.d(t,"i",(function(){return o})),n.d(t,"j",(function(){return u})),n.d(t,"k",(function(){return c})),n.d(t,"q",(function(){return l})),n.d(t,"r",(function(){return h})),n.d(t,"s",(function(){return d})),n.d(t,"l",(function(){return f})),n.d(t,"n",(function(){return _})),n.d(t,"e",(function(){return p})),n.d(t,"m",(function(){return m})),n.d(t,"o",(function(){return b})),n.d(t,"g",(function(){return E})),n.d(t,"h",(function(){return g})),n.d(t,"a",(function(){return A})),n.d(t,"f",(function(){return v}));const s=1,r=2,i=3,a=4,o=5,u=6,c=7,l=8,h=9,d=10,f=11,_=129,p=130,m=131,b=132,E=133,g=134,A=135,v=136},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return a}));var s=n(7),r=n.n(s);class i{constructor(){this.onmessage=()=>{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(n=>{n(e,t,1)}))}removeTransport(e){var t;let n=e.id;n in this.transportMap&&(delete this.transportMap[n],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let n=this.transportMap[t],s=n.target_thread==a.SELF_THREAD;if(n.type==e&&s)return n}return null}}r()(a,"NO_THREAD",0),r()(a,"SELF_THREAD",1)},function(e,t,n){"use strict";function s(){this.a=[],this.b=0,this.residue=null}s.prototype.getLength=function(){return this.a.length-this.b},s.prototype.isEmpty=function(){return 0==this.a.length},s.prototype.enqueue=function(e){this.a.push(e)},s.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},s.prototype.peek=function(){return 0{const e={};for(const t in r)e[r[t]]="WCL_"+t})(),{[r.AUDIO_ENCODE]:"audio.encode",[r.AUDIO_DECODE]:"audio.decode",[r.VIDEO_ENCODE]:"video.encode",[r.VIDEO_DECODE]:"video.decode",[r.SHARING_ENCODE]:"share.encode",[r.SHARING_DECODE]:"share.decode"})},function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return l}));var s=n(7),r=n.n(s),i=n(5),a=n(10),o=n(6),u=n(22);function c(e,t,n){if(!e)return;let s=o.a.dataTransportMgr;s.type===l.THREAD_MAIN?(s.setSabBuffer(e,t,n),e.remote.postMessage({cmd:i.gb,transportId:e.id,sender:n,reciver:t})):(e.setSabBuffer(t,n),s.mainThread.postMessage({cmd:i.gb,transportId:e.id,sender:n,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:n,data:s}=e.data,r=this.transportlists.find(e=>e.id===n);if(r||t==i.s)switch(t){case i.s:this.addRemoteTransport(e.data,null);break;case i.fb:r.setMsgPort(s||new a.a);break;case i.gb:r.setSabBuffer(e.data.sender,e.data.reciver);break;case i.o:r.remote=null,this.removeTransport(r)}}_onrecvsubthreadlistener(e,t){let{cmd:n,transportId:s,transportType:r}=t.data,a=this.transportlists.find(e=>e.id===s);switch(n){case i.s:this.addRemoteTransport(t.data,e);break;case i.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case i.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let n={cmd:i.s,transportType:e.type,transportId:e.id};e.portInfo?(n.port=e.portInfo,t.postMessage(n,[e.portInfo])):t.postMessage(n)}closeRemoteTransport(e,t){t.postMessage({cmd:i.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var n,s,r,a;(null!==(n=e.sabInfo)&&void 0!==n&&n.sender||null!==(s=e.sabInfo)&&void 0!==s&&s.reciver)&&t.postMessage({cmd:i.gb,transportId:e.id,sender:null===(r=e.sabInfo)||void 0===r?void 0:r.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:n,port:s,transportType:r}=e;let i=this.createMsgSocketTransport(r);i.id=n,i.remote=t,i.portInfo=s,s?i.setMsgPort(i.portInfo):this.bindMessageChannel(i),this.addTransport(i)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let n=t.target_thread||a.b.SELF_THREAD;e.target_thread=n,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:i.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,n){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),n&&(n.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:n},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,n))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof u.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof u.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let n=0;n{if(!e.transportlists.includes(t.type))return;let n=e.target_thread||a.b.SELF_THREAD;n==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=n&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=n,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let n=e.target_thread;if(n!=a.b.SELF_THREAD)this.createRemoteTransport(e,n),this.setRemoteTransportSABBUffer(e,n);else{var s,r,i,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(s=e.sabInfo)&&void 0!==s&&s.sender||null!==(r=e.sabInfo)&&void 0!==r&&r.reciver)e.setSabBuffer(null===(i=e.sabInfo)||void 0===i?void 0:i.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{n._report(),n._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let n="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,n)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,n){"use strict";n.d(t,"c",(function(){return s})),n.d(t,"f",(function(){return r})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"k",(function(){return o})),n.d(t,"g",(function(){return u})),n.d(t,"h",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"j",(function(){return h})),n.d(t,"i",(function(){return d})),n.d(t,"l",(function(){return f})),n.d(t,"d",(function(){return _}));const s=3,r=6,i=34,a=38,o=-51,u="SHARING_PARAM_INFO_FROM_SOCKET",c=121,l="AUDIO_QOS_DATA",h="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},_="EXPOSE_VB_FRAME"},function(e,t,n){"use strict";const s=e=>0==(e&e-1);let r=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let n=e;return t instanceof ErrorEvent?(t.filename&&(n+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(n+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(n+=" Message: ".concat(t.message)),t.error&&(n+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(n+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(n+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(n+=" Message: ".concat(t.message)),t.stack&&(n+=" Stack: ".concat(t.stack)),t.name&&(n+=" Name: ".concat(t.name)),t.constraint&&(n+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(n+=" Code: ".concat(t.code)),t.reason&&(n+=" Reason: ".concat(t.reason)),n+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(n+=" Message: ".concat(t.message)),t.name&&(n+=" Name: ".concat(t.name))):n+=t?t.toString():"",n}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const n=s(this._highFrequencyLogs[e]);this._instance&&n&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var n,s;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(n=(s=this._instance).directReport)||void 0===n||n.call(s,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=r},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return o}));var s=n(11),r=n(16);class i{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=r,this._BYTES_PER_ELEMENT=t,this.capacity=(i-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,r,1),this.read_ptr=new Uint32Array(this.buf,r+4,1),this.storageUint8sByteOffset=r+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,i-8),this.byteLength=i,this.label=n,this.usingOneElementBuffer=s,a&&(this.wasmMemory=a),s&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new s.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let i=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==i)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++i}if(i>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),i>=1e3&&(r.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),n&&n("vqslclear")),i>0&&n){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,n&&n("vqsl"+i))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let n=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+n),n+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=n;let s=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,s),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let n=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,n),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let n,s,r,i=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){n=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,i[0]):new Uint8Array(i[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n.byteLength);n.set(e,0)}else n=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+i[0]),s=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r=t*this._BYTES_PER_ELEMENT+8+4+i[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?n:{bCopyData:e,uint8s:n,begin:s,end:r}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof i))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=n,this.tick_lasted_time=0,this.timeoutMS=s,this.maxCount=r}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),n={};this.keysList.forEach((t,s)=>{n[t]=e[s]}),n[this.timeStampKey]=Number(t.getBigUint64(0,!0));let s,r=Number(t.getBigUint64(8,!0)),i=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,r);return s=(this.bCopyData,i),n.data=s,n}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,n=new Uint32Array(e.buffer,0,9),s=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{n[t]=this.obj[e]}),s.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),s.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},,,,,function(e,t,n){"use strict";var s=n(7),r=n.n(s),i=n(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new i.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,n,s){if(this._customer_callback){let r="".concat(e,",").concat(t,",").concat(n,",").concat(s);this._customer_callback(this._tag+"TimeOut",r)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),n="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),n=n.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",n)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(i.c.IsQosReport(e))return void this._cureen_qos_report++;if(i.c.IsVideoPkg(e)){let t=i.c.GetQOSTime(e),n=performance.now();if(this._lasted_qos_ts){let e=n-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,n)}this._lasted_qos_ts=t,this._lasted_sys_ts=n,this._lasted_data=e}}};var o=n(8),u=n(12),c=n(5);n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return h}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class h{constructor(e,t,n,s){this.id=e,this.type=t,this.datachannel=n,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=h.UNINIT,this.target_thread=s,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===h.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=h.DISCONNECT&&this._clear(),this._status=h.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==h.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var n;(this._status=h.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==u.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==u.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=h.CONNECTED)&&(null===(n=this.connectedFn)||void 0===n||n.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=h.DISCONNECT;let n=this.disconnectedFn;this._clear(),t!=h.DISCONNECT&&(null==n||n())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let n=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==n||n.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case c.A:this._onclose();break;case c.C:this._onopen();break;case c.B:this._onerror(t.ev);break;case c.H:this.report_monitor_func(t.tag,t.data)}}}r()(h,"UNINIT",0),r()(h,"CONNECTED",1),r()(h,"DISCONNECT",2)},function(e,t,n){"use strict";n.d(t,"d",(function(){return a})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"e",(function(){return l})),n.d(t,"a",(function(){return h}));var s=n(12),r=n(6),i=n(13);function a(e){return new r.a({sock:new r.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(r.a.dataTransportMgr)return;let n=new i.a({type:t?i.a.THREAD_SUB:i.a.THREAD_MAIN,remote:t?self:null});r.a.dataTransportMgr=n,n.monitorlogfn=e,t&&self.addEventListener("message",n._onrecvmainthreadlistener.bind(n))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function u(e){return r.a.dataTransportMgr.getTransportByType(e)}function c(e){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.removeDataChannel(e)}class h{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,n){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==s.a.VIDEO&&this.connectVideoSession(e),t==s.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==s.a.VIDEO&&this.connectVideoSession(e),t==s.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new r.c,n=u(r.e.VIDEO_ENCODE)||t,s=u(r.e.VIDEO_DECODE)||t,i=u(r.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?r.b.OPEN:r.b.CLOSED;n.setStatus(a),s.setStatus(a),this.isSupportVideoShare||i.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])n.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void i.send(t);s.send(t)}});const o=t=>{e.send(t)};n.onmessage=o,s.onmessage=o,i.onmessage=o}connectAudioSession(e){let t=new r.c,n=u(r.e.AUDIO_ENCODE)||t,s=u(r.e.AUDIO_DECODE)||t,i=e.isReady()?r.b.OPEN:r.b.CLOSED;n.setStatus(i),s.setStatus(i),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?n.send(t):s.send(t)});const a=t=>{e.send(t)};n.onmessage=a,s.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(7),r=n.n(s),i=n(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let n={id:e,worker:t},s=this._recvheartbeat.bind(this,n);n.listener=s,n.lastedtimestamp=Date.now(),n.worker.addEventListener("message",n.listener),this.monitorworkers[e]=n}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let n=t.data;n.cmd===i.Db&&(e.lastedtimestamp=n.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:i.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const n=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),s=Date.now(),r=this._lasted_timestamp;sr+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",s-r):t.forEach(t=>{var n;let r=e.monitorworkers[t],i=r.lastedtimestamp+(null!==(n=document)&&void 0!==n&&n.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);s>i&&(e.timeoutcallbackfn(r.id,s-r.lastedtimestamp),r.lastedtimestamp=s)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}r()(o,"INTREVAL_TIME_MS",3e3),r()(o,"HEART_TIMEOUT_MS",15e3),r()(o,"MAX_HEART_TIMEOUT_MS",3e4),r()(o,"instance",null)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));class s{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},,,function(e,t,n){"use strict";n(12);var s=n(7),r=n.n(s);const i=e=>btoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){r()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(i(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const n=this.textEncoder.encode(e);this.processList.push(n),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(i(t.buffer)),this.writeLog(this.EOL);const n=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(i(this.mergeBuffer(n).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let s=0;for(const t of e)n.set(t,s),s+=t.length;return n}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=n(3);n.d(t,"a",(function(){return l}));class u{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,n){if(t){var s=new Uint8Array(n?t+1:t),r=Object(o.d)().subarray(e+0,e+t);return s.set(r,0,t),n&&(s[t]=10),s}return e.data}writeWasmLog(e,t){const n=this.getTime(),s=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(n,s):(this.writeLog(n),this.writeLog(s),this.writeLog("\n"))}}class c extends u{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=n=>{"local_log_port"===n.data.command?this.port||(this.port=n.data.data):"local_log_ready"===n.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new c:null}},,,,,function(e,t,n){var s=n(24).default,r=n(35);e.exports=function(e){var t=r(e,"string");return"symbol"===s(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var s=n(24).default;e.exports=function(e,t){if("object"!==s(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var s=n(3),r=n(4),i=n(5),a=n(12),o=n(15),u=n(29);n(16);function c(e,t){let n=0,s=0;for(let r=0;rn&&(n=t)}return n=n>1?1:n,{sumRms:s/e.length/t,absMax:n}}const l={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},h={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let d,f,_,p,m,b,E,g,A,v,S=0,y=!0;var T=0;var w=!1;var M=null;var D=!1;var I={WASMTYPE:l,AUDIO_STATE:h,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");_=e.cwrap("_Heartbeat","number",["number"]),p=e.cwrap("_MuteUnmuteState","number",["number","number"]),m=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),b=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),E=e.cwrap("_Switch_Denoise","number",["number","number","number","number"]),g=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),A=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),v=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(e,t,n){d=e,t&&(S=t),n&&(f=n)},muteUnmuteState:function(e){if(null!=Object.values(h).find(t=>t==e))return d?void(S!=l.WORKLET_APM_ONLY&&(p(d,e),Object(s.o)("muteUnmuteState: "+e))):Object(s.o)("muteUnmuteState: -1")},switchOriginalSound:function(e,t,n,s){d&&m(d,e,t,n,s)},deliverRecordedData:function(e,t,n,s){d&&b(d,e,t,0,n,s)},switchDenoise:function(e,t){d&&(w=e,E(d,!!e,3,!!t))},audioInit:function(e,t,n,s,r,i,a,o,u,c){return g(e,t,n,s,r,i,a,o,u,c)},setDecoder:function(e){M=e},needCalculateDenoiseOutput:function(){D=!0},switchHighBitrate:function(e){d&&A(d,e)},disableJitterLog:function(){y=!1},setAllSpeechVolume:function(e){d&&v(d,e)},onMonitorLogWASM:function(e,t){if(t<=0)return;const n=Module.HEAPU8.subarray(e,e+t),r=String.fromCharCode.apply(null,n);r&&(!y&&r.includes("JITTER")||(S==l.ENCODE||S==l.DECODE?Object(s.n)(r):S==l.WORKLET?f&&f.port&&Object(s.n)(r,f.port):S==l.WORKLET_APM_ONLY&&f.port&&f.port.postMessage({status:"SPEECH_LOG",data:{log:r}})))},onMuteSpeechWarningWASM:function(){postMessage({status:o.h})},onAudioLevelWASM:function(e,t,n){var s;S!=l.ENCODE&&S!=l.WORKLET_APM_ONLY||1==e&&(0===t&&0===T||(T=t,S===l.ENCODE?postMessage({status:o.a,value:t}):null!==(s=f)&&void 0!==s&&s.port&&f.port.postMessage({status:o.a,data:t})))},onAPMProcessedPCMWASM:function(e,t,n,s){if(!w)return;let r=Module.HEAPF32.subarray(e/4,e/4+t);if(M){if(D){D=!1;let{sumRms:e}=c(r,2),t=function(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}(e);f.port&&f.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}M.push([r])}}};class C{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(e){return e===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==e||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=e,!0)}}class O{constructor(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(e),this.sabBuffer=new Float32Array(t),this.perFrameLength=n,this.writeChannelNumb=s,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%n==0,this.bufferIndex=null,this.supportSpecialOptimization){let e=this.bufferLen/n;this.bufferIndex=[];for(let t=0;tthis.CACHE_SIZE_MAX_VALUE&&(e=this.CACHE_SIZE_MAX_VALUE),e0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(e){if(void 0===e[0]||e[0].length*this.writeChannelNumb!==this.perFrameLength)return;let t=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),t?this.supportSpecialOptimization?this.writeSpecial(e):this.writeNormal(e):void 0}writeNormal(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let n=0;n=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=t,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let n=0;nthis.bufferLen){let n=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(n*this.perFrameLength+e)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,n*this.perFrameLength)}let n=null;if(this.bufferLen-e>=this.perFrameLength)n=this.sabBuffer.subarray(e,e+this.perFrameLength);else{let t=this.sabBuffer.subarray(e),s=this.sabBuffer.subarray(0,this.perFrameLength-t.length);n=this.placeBuffer,n.set(t),n.set(s,t.length)}return e+=this.perFrameLength,e>=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),n}readSpecial(){let e=this.sabState[this.STATE_READ_INDEX],t=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(tthis.bufferLen){let n=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(n+e)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,n*this.perFrameLength)}let n=this.bufferIndex[e];return e=(e+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),n}}var k=n(8),L=n(11),R=n(26),U=n(13),N=n(23),P=n(6),B=n(25);function H(e,t,n){mn&&mn.writeWasmLog(t,n,!0)}function x(e,t){self.fsHandler&&self.fsHandler.handleViperNetworkTrace(e,t)}n.d(t,"Get_ExternalRecord",(function(){return H})),n.d(t,"Viper_NetworkTrace",(function(){return x})),n.d(t,"Channel_Agent",(function(){return st})),n.d(t,"responseAudioQosData",(function(){return rt})),n.d(t,"network_quality_callback",(function(){return it})),n.d(t,"Open_Audio_WebSocket_Connect",(function(){return at})),n.d(t,"audio_websocket_on_open",(function(){return ct})),n.d(t,"audio_websocket_on_message",(function(){return gt})),n.d(t,"audio_websocket_on_close",(function(){return At})),n.d(t,"audio_websocket_on_error",(function(){return vt})),n.d(t,"frame_aec_callback",(function(){return St})),n.d(t,"frame_callback_SAB",(function(){return Mt})),n.d(t,"LOG_OUT_WEBRTC",(function(){return Dt})),n.d(t,"update_play_time",(function(){return It})),n.d(t,"calMilliSeconds",(function(){return Ct})),n.d(t,"frame_callback",(function(){return Ot})),n.d(t,"wcl_trace_log",(function(){return kt})),n.d(t,"media_data_transport_type_monitor",(function(){return Rt})),n.d(t,"audio_encode_frame_callback",(function(){return Ut})),n.d(t,"send_data_to_rwg",(function(){return Nt})),n.d(t,"sampleRateLog",(function(){return Pt})),n.d(t,"Get_Mixed_Audio_Interval",(function(){return sn})),n.d(t,"Get_Mixed_Audio_Interval_SAB",(function(){return rn})),n.d(t,"Encode_Audio_Data",(function(){return an})),n.d(t,"Encode_Audio_Data_SAB",(function(){return on})),n.d(t,"send_data",(function(){return un})),n.d(t,"LOG_OUT",(function(){return cn})),n.d(t,"put_aec_data",(function(){return ln})),n.d(t,"TURN_DOWN_VOLUME",(function(){return hn})),n.d(t,"SAVE_IV",(function(){return dn})),n.d(t,"getWasmMemory",(function(){return fn})),n.d(t,"freeWasmMemory",(function(){return _n})),n.d(t,"pump_rtp_data",(function(){return pn})),self.AudioWasmAdapter=I,self.wasmSuccessEvent=i.j,self.wasmFailEvent=i.i,self.downloadAndInstantiateWebAssembly=s.q,self.addEventListener("unhandledrejection",e=>{Object(s.u)("Unhandled rejection in audio worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)}),self.addEventListener("error",e=>{Object(s.u)("Unhandled exception in audio worker",e)});const F="undefined"!=typeof SharedArrayBuffer;var W,q,j,V,Y,z,G,Z,K,X,Q,J,$,ee,te;let ne;var se,re,ie,ae,oe,ue,ce,le,he,de,fe,_e,pe,me,be,Ee,ge,Ae=!1,ve=null,Se=null;self.onWasmModuleReady=()=>{W=Module.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),q=Module.cwrap("_Audio_UnInit","number",["number"]),j=Module.cwrap("_Audio_Try_Analysis","number",["number","number","array","number"]),V=Module.cwrap("_Get_Mixed_Audio","number",["number","number","number","number","number"]),Y=Module.cwrap("_Put_Pre_Aec_Data","number",["number","array","number","number","number","number"]),z=Module.cwrap("_Put_Pre_Aec_Data","number",["number","number","number","number","number","number"]),G=Module.cwrap("_Get_Aec_Delay","number",["number"]),Z=Module.cwrap("_ReSet_Aec","number",["number"]),K=Module.cwrap("_Audio_Set_Data_Encryption","number",["number","number"]),X=Module.cwrap("_Add_Cooker_info","number",["number","number","number","number"]),$=Module.cwrap("_Get_Audio_Meat_Weight","number",["number"]),Q=Module.cwrap("_Remove_Cooker_Info","number",["number","number"]),J=Module.cwrap("_Change_Aec_Flag","number",["number","boolean"]),ee=Module.cwrap("_Change_Connect_Type","number",["number","number"]),te=Module.cwrap("_Interpretation_Configure","number",["number","number","number","number"]),ne=Module.cwrap("_Request_Audio_Qos_Data","number",["number"]),se=Module._malloc(40),Module.HEAPU32.subarray(se/4,se/4+10),re=Module.cwrap("_Start_Audio_Share","number",["number","number","number"]),ie=Module.cwrap("_InsertShareData","number",["number","number","number","number","number","number"]),ue=Module.cwrap("_Set_Share_Volume_Level","number",["number","number","number"]),ce=Module.cwrap("_Set_Speech_Volume_Level","number",["number","number","number"]),le=Module.cwrap("_Cc_Set_Lang","number",["number","number"]),he=Module._malloc(4),Module.HEAPU32.subarray(he/4,he/4+1),de=Module.cwrap("_Set_Audio_Encryption_Key_Directly","number",["number","number","number","number"]),fe=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),_e=Module.cwrap("_Enable_Share_To_Bo","number",["number","boolean"]),pe=Module.cwrap("_Enable_Broadcast_To_Bo","number",["number","boolean"]),me=Module.cwrap("_Set_Audio_Pipe_To_Bo","number",["number","number"]),be=Module.cwrap("_Smooth_Send_For_Qos","number",["number"]),ge=Module.cwrap("_request_nack_t_periodically_for_qos","number",["number"]),Ke=Module.cwrap("_Enable_Pipe_OUT_RTP","number",["number","number"]),Qe=Module.cwrap("_setMultiViewFlag","number",["number","boolean"]),I.onWasmModuleReady(Module)};var ye,Te,we,Me,De,Ie,Ce,Oe=null,ke=null,Le=null,Re=null,Ue=null,Ne=!1,Pe=!1,Be=!1,He=!1,xe=null,Fe=!1,We=!1,qe=!1,je=0,Ve=!1,Ye=!0;self.isPreviewMode=!1;var ze=!1,Ge=null,Ze=!1,Ke=null,Xe=!1,Qe=null,Je=1,$e=1,et=1,tt=null;function nt(){return Jt==I.AUDIO_STATE.UNMUTE||ae}function st(){function e(e){let t=null,n=r.db,i=null,a=e.onmessage,o=e.onopen,u=e.onclose;e.onmessage=n=>{t=(new Date).getTime(),a.call(e,n)},e.onopen=s=>{t=(new Date).getTime(),function(){if(i)return;i=setInterval(()=>{var s;(new Date).getTime()-t>=1e3*n&&(clearInterval(i),i=null,null===(s=e.socket)||void 0===s||s.close())},1e3)}(),o.call(e,s,e)},e.onclose=t=>{try{clearInterval(i)}catch(e){Object(s.u)("WebSocket closed",e)}u.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,n,s,r,i){this.websocketaddress=t,this.onopen=n,this.onmessage=s,this.onerror=r,this.onclose=i,e(this)},this.connect=function(e,t,n,r,a){var o=this;Object(s.o)("SB"),o.init(e,t,n,r,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex++,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(s.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(s.o)("SERR"),o.socket.close()},o.socket.onclose=function(e){Object(s.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:i.k}),Object(s.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){1===this.socket.readyState&&this.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function rt(e,t,n,s,r,i,a){const u={sample_rate:e,rtt:t,jitter:n,avg_loss:s,max_loss:r,bandwidth:i,rate:a};postMessage({status:o.b,data:u})}function it(e,t,n){postMessage({status:i.P,isUplink:0===e,networkLevel:t,bwLevel:n})}function at(e,t,n,r,i,a){if(Object(s.o)("WSURL:".concat(isPreviewMode&&!a,":").concat(e)),!isPreviewMode||a){var o=new st;return o.connect(e,t,n,r,i),o}}let ot=null;async function ut(e,t){isPreviewMode&&!t||(ot=new s.l(e),await ot.connect())}function ct(){let e;for(ze=!0;Ge&&(e=Ge.dequeue());)Nt(e.data,e.data.length,e.c,!0);postMessage({status:i.l})}function lt(){let e=Be||He;if(Oe&&e!=We){let t=e?1:0,n=Be?1:0,r=He?1:0;Object(s.o)("AQOS-S-"+t+"-"+n+"-"+r),ee(Oe,e?0:2)}We=e}function ht(e){let{url:t}=e.params;xe=e,He=!0,t.includes("mode=2")&<(),postMessage({status:i.r})}function dt(e){let{url:t}=e.params;He=!1,xe=null,t.includes("mode=2")&<(),postMessage({status:i.q})}let ft=new Map;self.seqMap=ft,self.seqList=[];class _t{constructor(){this.channel=null,this.audioHandle=null}open(e){const{wsUrl:t}=e;this.channel=at(t,this._onOpen.bind(this),this._onMessage.bind(this),this._onError.bind(this),this._onClose.bind(this))}createHandle(e){let{userId:t,meetingNumber:n,meetingId:s}=e;this.audioHandle=W(t,n,s,0,0,Ye,!1,!0,1)}enableBOPipeOutRtp(){Ke(this.audioHandle,1)}pipeTo(e){e&&this.audioHandle?me(this.audioHandle,e):console.warn(new Error("audio handle not ready when pipe audio to bo"))}_onOpen(e){}_onError(e){}_onClose(e){}_onMessage(e){if(!e||!e.data)return;let t=new Uint8Array(e.data);0!==t.length&&(t[0]===r.v?this.channel&&1===this.channel.socket.readyState&&this.channel.send(t):t[0]!==r.M&&this.decode(t))}close(){this.channel.close(),this.channel=null}setAudioEncryptionKey(e,t){const n=fn(e);de(this.audioHandle,n,e.length,t),_n(n)}updateRosterInfo(e){const{add:t,remove:n}=e;t&&t.forEach(e=>{const{sn:t,userid:n}=e,s=fn(t);fe(this.audioHandle,n,s,t.length),_n(s)})}decode(e){this.audioHandle&&e[0]!==r.q&&j(this.audioHandle,0,e,e.length)}isShareToBoAudio(e){return 0===e[2]&&0===e[3]&&![r.M,r.v,r.u,r.r].includes(e[0])}}var pt=new _t;function mt(e,t){pt.isShareToBoAudio(e)?pt.decode(e):Fe&&e[0]===r.q||(j(Oe,0,e,e.length),Rt())}function bt(e){null!==Oe&&mt(e)}const Et=(()=>{let e;return{updateKey:t=>{t&&(e=t),Oe&&e&&mt(e)}}})();function gt(e){let t=new Uint8Array(e.data);if(102==t[0]){if(Ae)return;Ae=!0,ve=new Uint8Array(t)}null!==Oe?mt(t):t[0]==r.M?Et.updateKey(t):t[0]==r.r&&(tt=t)}function At(e){ze=!1,postMessage({status:i.p})}function vt(e){}function St(e,t,n,s){var r=new Uint8Array(2*s),i=Module.HEAP8.subarray(e+0,e+2*s);r.set(i,0,2*s),ln({data:r,channels:n,sampleHZ:t})}let yt=null,Tt=null;var wt=function(e,t){this._BYTES_PER_ELEMENT=t,this.capacity=(e.byteLength-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,0,1),this.read_ptr=new Uint32Array(this.buf,4,1),this.storageUint8s=new Uint8Array(this.buf,8,e.byteLength-8),this.cache_buffer=[]};function Mt(e,t,n,s,r,i,a,o){Tt===e&&yt.length==t*a||(yt=Module.HEAPF32.subarray(e/4,e/4+t*a),Tt=e),Gt.write([yt])}function Dt(e,t,n,s){self.fsHandler&&self.fsHandler.handleFile(e,t,n,s)}function It(e,t){if(!t)return;var n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s);let r,a=new Uint32Array(n.buffer),o=null,u=null,c=0,l=0;for(let e=0;e>10==en>>10&&(r=t,u=a.subarray(4*e,4*e+4),c=Ct(u))}(c||l)&&(Ht?Ht.postMessage({status:2,data:c,sdata:l,ssrc:r}):postMessage({status:i.z,at:c,st:l}))}function Ct(e){let t=e[1];return 4294967296*e[2]+t}function Ot(e,t,n,s,r,i,a,o){if(F&&zt)return Mt(e,t,0,0,0,0,a);var u=Module.HEAP8.subarray(e+0,e+4*t*a),c=new Uint8Array(4*t*a);c.set(u,0,4*t*a);var l=new Float32Array(c.buffer);if(Wt&&Jt===I.AUDIO_STATE.UNMUTE){var h=new Uint8Array(4*t*a);h.set(u,0,4*t*a);var d=new Float32Array(h.buffer),f={status:0,data:d},_=[d.buffer];Wt.postMessage(f,_)}let p,m;p={status:0,data:l,channels:a,sampleHz:i},m=[p.data.buffer],Bt&&Bt.postMessage(p,m)}function kt(e,t){mn&&mn.writeWasmLog(e,t,!0)}wt.prototype.clear=function(){this.write_ptr&&Atomics.store(this.write_ptr,0,0),this.read_ptr&&Atomics.store(this.read_ptr,0,0),this.cache_buffer=[]},wt.prototype.enqueueMergeData=function(e,t){for(;this.cache_buffer.length>0&&this.available_write()>0;){let e=this.cache_buffer.shift();this.push(e)}if(e&&t){if(this.cache_buffer.length>0){let n=new Uint8Array(e.length+t.length);n.set(e,0,e.length),n.set(t,e.length,t.length),this.cache_buffer.push(n)}else if(this.available_write()>0)this.pushMergeData(e,t);else{let n=new Uint8Array(e.length+t.length);n.set(e,0,e.length),n.set(t,e.length,t.length),this.cache_buffer.push(n)}this.cache_buffer.length>255&&(this.cache_buffer=[])}},wt.prototype.pushMergeData=function(e,t){let n=Atomics.load(this.write_ptr,0);try{this.storageUint8s.set(e,n*this._BYTES_PER_ELEMENT+4,e.byteLength),this.storageUint8s.set(t,n*this._BYTES_PER_ELEMENT+4+e.byteLength,t.byteLength),new Uint32Array(this.buf,n*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength+t.byteLength;let s=(n+1)%this.capacity;Atomics.store(this.write_ptr,0,s)}catch(e){throw Object(s.u)("Error in Producer.pushMergeData: ".concat(n," ").concat(this.buf),e),e}},wt.prototype.enqueue=function(e){for(;this.cache_buffer.length>0&&this.available_write()>0;){let e=this.cache_buffer.shift();this.push(e)}if(e){if(this.cache_buffer.length>0){let t=new Uint8Array(e.length);t.set(e,0,e.length),this.cache_buffer.push(t)}else if(this.available_write()>0)this.push(e);else{let t=new Uint8Array(e.length);t.set(e,0,e.length),this.cache_buffer.push(t)}this.cache_buffer.length>255&&(this.cache_buffer=[])}},wt.prototype.push=function(e){let t=Atomics.load(this.write_ptr,0);try{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+4,e.byteLength),new Uint32Array(this.buf,t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let n=(t+1)%this.capacity;Atomics.store(this.write_ptr,0,n)}catch(e){throw Object(s.u)("Error in Producer.push: ".concat(t," ").concat(this.buf),e),e}},wt.prototype.available_write=function(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)},wt.prototype._available_write=function(e,t){return this.usableCapacity-this._available_read(e,t)},wt.prototype._available_read=function(e,t){return(t+this.capacity-e)%this.capacity};var Lt=0;function Rt(){He&&1!==Lt?(Lt=1,postMessage({status:i.y,type:Lt})):Be&&!He&&2!==Lt?(Lt=2,postMessage({status:i.y,type:Lt})):Be||He||3===Lt||(Lt=3,postMessage({status:i.y,type:Lt}))}function Ut(e,t,n,s){Nt(e,t,n,!1,s!=Oe&&Oe)}function Nt(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];var o;if(i)o=e;else if(ze)o=Module.HEAP8.subarray(e+0,e+t);else{o=new Uint8Array(t);var u=Module.HEAP8.subarray(e+0,e+t);o.set(u,0,t)}if(Se&&o[0]===r.s&&Se.setRtpPackets(),a&&(o[2]=128),!ze)return Ge||(Ge=new L.a),void Ge.enqueue({data:o,c:n});if(n&&(nt()||!qe)&&He&&xe)return Rt(),void xe.send(o);if(!n||!nt()&&qe||!Be)null===ke||!ke.socket||1!==ke.socket.readyState||(!nt()||We)&&n&&qe||(Rt(),ke.send(o),o.length<12&&Object(s.u)("Audio encode data length is too short"));else if(Rt(),i)Tn.send(o);else{new Uint8Array(t).set(o,0,t),Tn.sendWasmData(o)}}function Pt(){}var Bt,Ht,xt,Ft,Wt,qt,jt,Vt,Yt=null,zt=null,Gt=null,Zt=null,Kt=null,Xt=null,Qt=null,Jt=-1,$t=0,en=0,tn=0,nn=!1;function sn(){if(Oe)return F&&zt?rn():void(Bt&&V(Oe,Le/100,0,Le,$e))}function rn(){var e;if(null===(e=Tn)||void 0===e||e.sock.reciver(),Gt&&Gt.isReady())for(;Gt.isNeedMoreData();)V(Oe,Le/100,0,Le,$e)}function an(e){if(F&&zt)return on();xt&&e&&(isPreviewMode||(Module.HEAPF32.subarray(qt/4,qt/4+Le/100*Je).set(e),I.deliverRecordedData(qt,Le/100,Le,Je)))}function on(e){if(Zt){let e=null;for(;null!==(e=Zt.read());)isPreviewMode||(Module.HEAPF32.subarray(qt/4,qt/4+Le/100*Je).set(e),I.deliverRecordedData(qt,Le/100,Le,Je))}if(Qt){let e=null;for(;null!=(e=Qt.read());)isPreviewMode||(Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e).set(e),z(Oe,jt,Le,$e,Le/100,1))}if(Xt&&ae){let e=null;for(;null!==(e=Xt.read());)Module.HEAPF32.subarray(Vt/4,Vt/4+oe/100*et).set(e),ie(Oe,Vt,oe,et,oe/100,0)}}function un(e,t){var n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s,0,t),ke&&1===ke.socket.readyState&&ke.send(n)}function cn(e,t){mn&&mn.writeWasmLog(e,t)}function ln(e){if(-1!=Jt&&2!=Jt&&zt&&Yt&&null!=e&&!(e.data.length>960)){var t=new Uint16Array(zt);if(Yt.lock(),t[2]<30){for(var n=3,s=t[2];s>0;)s--,n+=t[n+1],n+=2;if(e){var r=new Uint16Array(e.data.buffer);t[2]++,t[n]=e.sampleHZ,t[n+1]=r.length,n+=2,t.set(r,n)}}else console.log("too many data in sharebuffer!"),t[2]=0;Yt.unlock()}}function hn(){postMessage({status:i.c})}function dn(e,t){ye||(ye=setInterval((function(){Oe&&$(Oe)}),6e4));let n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s,0,t),(Me=new Uint8Array(n.length)).set(n,0),postMessage({status:i.a,data:n},[n.buffer])}function fn(e){if(!e)return 0;let t=Module._malloc(e.length);return Module.HEAPU8.subarray(t,t+e.length).set(e,0,e.length),t}function _n(e){e&&Module._free(e)}function pn(e,t,n,s){let r=null,i=null;e&&t&&(r=Module.HEAPU8.subarray(e,e+t)),n&&s&&(i=Module.HEAPU8.subarray(n,n+s)),Kt&&(r&&i?Xe||Kt.enqueueMergeData(r,i):i&&Kt.enqueue(i))}var mn=Object(u.a)();let bn;var En=0;function gn(){return!An}self.addEventListener("message",(function(e){var t,n=e.data;switch(n.command){case k.p:try{if(Object(s.o)("STARTMEDIA:".concat(function(e){let t=e.userid,n=e.isPreviewMode?1:0;return n|=gn()?2:0,"".concat(t,":").concat(n)}(n))),isPreviewMode=!!n.isPreviewMode,function(e){let t=e._id;En=t;let n=Je;e.audioEncodeChannelsNum&&(n=e.audioEncodeChannelsNum);let s=$e;e.audioDecodeChannelsNum&&(s=e.audioDecodeChannelsNum);let r=e.sampleRate;F&&!e.shouldNotChangeSampleRate&&(r=48e3),Ce=e.meetingid,Ie=e.meetingnumb+"",Ve=!0,Te=e.userid;let a=r/100;qt&&r==Le&&Je==n||(Je=n,_n(qt),qt=Module._malloc(4*a*Je),Module.HEAPF32.subarray(qt/4,qt/4+a*Je)),jt&&r==Le&&$e==s||($e=s,_n(jt),jt=Module._malloc(4*a*$e),Module.HEAPF32.subarray(jt/4,jt/4+a*$e)),Le=r,(qe=!!e.encode)?(De=!0,Ue=!0,Se=new R.a(i.e)):Re=!0,Ze=!!e.decoderInWorklet}(n),function(e){Sn||(mn&&mn.init({workerType:e.encode?a.b.AUDIO_ENCODE:a.b.AUDIO_DECODE}),Sn=!0)}(n),isPreviewMode){!function(e){postMessage({status:i.n}),postMessage({status:i.h}),yn(e)}(n);break}gn()||(An=!1,Object(s.o)("RSTHOLD")),yn(n),qe||(Object(s.o)("HB"),vn(n.userid,0,0)),postMessage({status:qe||Oe?i.h:i.g})}catch(e){postMessage({status:i.g}),Object(s.u)("Error in startMedia",e)}break;case k.i:ke&&(ke.close(),ke=null),ke=at(n.websocket_ip_address,ct,gt,vt,At,!0);break;case k.c:ke&&(ke.close(),ke=null);break;case k.j:{let e=n._id;ot&&(ot.forceClose(),ot=null);let t=1;n.webtransportURL.includes("mode=2")&&(t=0),ut({url:n.webtransportURL,label:"audio",id:e,onmessage:bt,onopen:ht,onclose:dt,groupSize:t},!0);break}case k.d:{let e=n._id;ot&&ot.id==e&&(ot.forceClose(),ot=null);break}case"EncodedAudioFrame":ke&&1===ke.socket.readyState&&ke.send(n.data);break;case k.b:{let e=n._id;if(e4e3&&Oe){var o=G(Oe);console.log("Store Delay: "+o),o>0&&postMessage({status:i.d,delay:o})}Re=null,Ue=null,Ee&&(clearInterval(Ee),Ee=null),Oe=null,qt&&Module._free(qt),qt=void 0,null,jt&&Module._free(jt),jt=void 0,null,ke=null,Module.HEAP8.fill(0),calledRun=void 0,ABORT=!1,dependenciesFulfilled=function e(){calledRun||run(),calledRun||(dependenciesFulfilled=e)},Ae=!1,ve=null,we=void 0,self.isPreviewMode=!1,Me=void 0,ze=!1,Ge=null,We=!1,He=!1,Be=!1,xe&&(xe.forceClose(),xe=null),yt=null,Tt=null,Gt=null,Zt=null,Kt=null,Xt=null,zt=null,Ht&&Ht.close(),xt&&xt.close(),tn=0,Jt=-1,Xe=!1,Ne=!1,Pe=!1,ye&&(clearInterval(ye),ye=null),en=0,Lt=0,$t=0,0,Yt=null,Fe=!1,ae=!1,pt=new _t,function(){try{let e=Tn;Tn=null,Be=!1,wn={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}();break;case"delay":0;break;case"failover":ke&&(ke.close(),ke=at(n.websocket_ip_address,ct,gt,vt,At));break;case"sharedBuffer":if(F){const e=n.data;(zt=e)&&(qe?((Zt=new O(zt.inputState,zt.inputBuffer,Le/100*Je)).clear(),zt.echoState&&zt.echoBuffer&&(Qt=new O(zt.echoState,zt.echoBuffer,Le/100*$e)).clear()):(Gt=new O(zt.outputState,zt.outputBuffer,Le/100*$e),Kt=new wt(zt.rtpBuffer,1200),Gt.clear(),Kt.clear()),$t=21)}break;case"modifySampleRate":if(Le===n.sampleRate)break;qt&&Module._free(qt),qt=Module._malloc(4*n.sampleRate/100*Je),Module.HEAPF32.subarray(qt/4,qt/4+n.sampleRate/100*Je),jt&&Module._free(jt),jt=Module._malloc(4*n.sampleRate/100*$e),Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e),Le=n.sampleRate,zt&&(qe?((Zt=new O(zt.inputState,zt.inputBuffer,Le/100*Je)).clear(),zt.echoState&&zt.echoBuffer&&(Qt=new O(zt.echoState,zt.echoBuffer,Le/100*$e)).clear()):(Gt=new O(zt.outputState,zt.outputBuffer,Le/100*$e)).clear());break;case"mute":var u,c;n.sharing||(Jt=n.bOn,I.muteUnmuteState(Jt),nn&&(Jt===I.AUDIO_STATE.UNMUTE?null===(u=Se)||void 0===u||u.startCheck():null===(c=Se)||void 0===c||c.stopCheck())),Jt!=I.AUDIO_STATE.UNMUTE&&!n.sharing||Ne?Jt==I.AUDIO_STATE.LEAVED?(Bt&&!n.fakeLeave&&(Bt.close(),Bt=null),Re&&(Gt&&Gt.clear(),Kt&&Kt.clear()),Ue&&(Zt&&Zt.clear(),clearInterval(ye),ye=null),ae||(Ee&&(clearInterval(Ee),Ee=0),Ne=!1)):Jt===I.AUDIO_STATE.MUTE&&Zt&&Zt.clear():(Ne=!0,Re&&(Gt&&(Gt.clear(),Gt.setWriteReady()),Kt&&Kt.clear()),Ue&&(Oe&&!De&&$(Oe),De=!1,Zt&&Zt.clear()));break;case"audio_denoise_switch":I.switchDenoise(n.switch?1:0,n.isHeadSet);break;case"original_sound_switch":I.switchOriginalSound(n.enable,n.highfidelity,!1,n.stereo);break;case"resetAec":Oe&&Z(Oe),$t=0,F&&zt&&($t=21);break;case"decodeAudioPort":Bt&&Bt.close(),(Bt=e.ports[0]).onmessage=function(e){const{status:t,cacheSize:n,isSAB:i}=e.data;switch(t){case"delay":0;break;case r.h:sn();break;case r.f:Object(s.o)("".concat(i?"ACSS":"ACS").concat(n||""));break;case"workletMessage":"error"===e.data.data.level&&Object(s.u)("Error from Audio Worklet"+e.data.data.message,e.data.data.data)}};break;case"encodeAudioPort":xt&&xt.close(),(xt=e.ports[0]).onmessage=function(e){if(Oe||isPreviewMode)switch(e.data.command){case r.g:Oe&&an(e.data.buffer)}};break;case"shareAudioDecodeAudioPort2":Ft&&Ft.close(),(Ft=e.ports[0]).onmessage=function(e){if(Oe||isPreviewMode)switch(e.data.command){case r.g:Oe&&an(e.data.buffer)}};break;case"audioWorkerPort":Wt&&(Wt.close(),Wt=null),(Wt=e.ports[0]).onmessage=function(e){switch(e.data.status){case 0:Oe&&Jt===I.AUDIO_STATE.UNMUTE&&Y&&(Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e).set(e.data.data),z(Oe,jt,Le,$e,Le/100,1))}};break;case"updateCurrentSSRC":en=n.SSRC;break;case"ENCRYPT":Pe=n.encrypt,Oe&&K(Oe,Pe?1:0);break;case"SOCKET_RECONNECT":self.IS_DISABLE_SOCKET_RECONNECT=!0===n.disable;break;case k.n:{let e=n.data.userNodeList;e&&e.forEach(e=>{let t=parseInt(e.userid);if(e.bremove)return void(Oe&&Q(Oe,t));let n=e.sn;if(16!=n.length&&32!=n.length)return;let s=fn(n);if(Oe){let e=!1;qe&&Te!=t||(e=!0),e&&X(Oe,t,s,n.length)}qe&&Te==t&&(we=n),_n(s)});break}case"decodeAudioPort2":Ht&&Ht.close(),Ht=e.ports[0];break;case"startAudioEncode":if(Ve&&n.ssid&&!isPreviewMode){Object(s.o)("HB"),Ve=!1;let e,t=Me;e=t?t.length:0;let r=0;if(r=fn(t),(Oe=W(n.ssid,Ie,Ce,r,e,Ye,qe,!0,1))?I.setAudioInstanceAndType(Oe,I.WASMTYPE.ENCODE):Object(s.u)("audio_handle not exist when encoding"),Oe&&tt&&mt(tt),I.muteUnmuteState(Jt),Oe&&ee(Oe,Be||He?0:2),_n(r),ve&&j(Oe,0,ve,ve.length),we){let e=fn(we);X(Oe,Te,e,we.length),_n(e)}}if(!Oe)return Object(s.u)("Error when init audio encode handle, start_handle_init: "+Ve+"ssrc: "+n.ssid+", isPreview:"+isPreviewMode),void postMessage({status:i.m});Ee||(Ee=setInterval(()=>{Oe&&be(Oe)},10)),n.isSharing?(ae=!0,et=n.sharingEncodeChannelsNum,oe=n.samplerate,Vt=Module._malloc(4*oe/100*et),Module.HEAPF32.subarray(Vt/4,Vt/4+oe/100*et),zt&&(Xt=new O(zt.sharingInputState,zt.sharingInputBuffer,oe/100*et)).clear(),re(Oe,ae,2==et)):Zt&&Zt.clear();break;case"AecFlag":Ye=n.flag,Oe&&J(Oe,Ye);break;case"audioDecodeSAB":{let e=n.data.buffer,t=n.data.offset,s=n.data.length;wn.reciver={sab:e,offset:t,length:s,interval:0,useCopy:!1,useOneElement:!1},Object(U.b)(Tn,null,wn.reciver);break}case"audioEncodeSAB":{let e=n.data.buffer,t=n.data.offset,s=n.data.length,r=n.data.bAudioEncodeMainThreadConsumerIntervalEnable;wn.sender={sab:e,offset:t,length:s,interval:r?10:0,useCopy:!1,useOneElement:!1,disableAuto:!0},Object(U.b)(Tn,wn.sender,null);break}case"PAUSE_OR_RESUME_AUDIO_DECODE":{let{bPause:e}=n.data;Fe=e;break}case"cc_set_lang":Module.HEAPU32.subarray(he/4,he/4+1)[0]=n.lang,Oe&&le(Oe,he);break;case"interpretation_enable":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.enable?1:0,Oe&&te(Oe,r.k,se,1);break;case"interpretation_set_lang":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.lang,Oe&&te(Oe,r.n,se,1);break;case"interpretation_mute_origin":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.mute?1:0,Oe&&te(Oe,r.l,se,1);break;case"interpretation_set_interpreter":{let e=Module.HEAPU32.subarray(se/4,se/4+10),t=se;n.interpreterList.length>=10&&(Object(s.u)("Interpreter list is larger than ".concat(9)),t=Module._malloc(4*n.interpreterList.length),e=Module.HEAPU32.subarray(t/4,t/4+n.interpreterList.length));for(let t=0;t=10&&Module._free(t);break}case"changeAudioShare":if(!Oe)return;ae=n.isStart,re(Oe,ae,!1),ae||Jt!=I.AUDIO_STATE.LEAVED||(Ee&&(clearInterval(Ee),Ee=0),Ne=!1,Xt&&Xt.clear());break;case k.l:{const e=()=>{Oe&&ne(Oe)};bn&&clearInterval(bn),n.data.enable&&(bn=setInterval(e,n.data.pollingInterval||r.y));break}case"setShareVolumeLevel":if(!Oe)return;ue(n.isFromMainSession?pt.audioHandle:Oe,n.userid,n.shareVolume);break;case"setSpeechVolumeLevel":if(!Oe)return;ce(Oe,n.userid,n.volume);break;case"BUILD_MA_CHANNEL_IN_BO":pt.open({wsUrl:n.data});break;case k.r:{let e=n.data;if(e.isFromMainSession){const{encryptKey:t,encryptType:n,userId:s,meetingNumber:r,confId:i}=e.updateParams;pt.createHandle({userId:s,meetingNumber:r+"",meetingId:i}),Oe&&pt.pipeTo(Oe),pt.setAudioEncryptionKey(t,n),Ze&&(I.disableJitterLog(),pt.enableBOPipeOutRtp())}break}case k.s:{let e=n.data;e.isFromMainSession&&pt.updateRosterInfo(e.body);break}case"ENABLE_SHARE_TO_BO":if(!Oe)return;_e(Oe,n.data);break;case"ENABLE_BROADCAST_TO_BO":if(!Oe)return;pe(Oe,n.data);break;case"stop_audio_incoming":Kt&&Kt.clear(),Xe=n.stopPlayAudio;break;case"highBitrate":Oe&&I.switchHighBitrate(n.highBitrate);break;case"RIWM":createWasm(),_free=Module._free=function(){return(_free=Module._free=Module.asm.free).apply(null,arguments)},___wasm_call_ctors=Module.___wasm_call_ctors=function(){return(___wasm_call_ctors=Module.___wasm_call_ctors=Module.asm.__wasm_call_ctors).apply(null,arguments)},stackSave=Module.stackSave=function(){return(stackSave=Module.stackSave=Module.asm.stackSave).apply(null,arguments)},stackRestore=Module.stackRestore=function(){return(stackRestore=Module.stackRestore=Module.asm.stackRestore).apply(null,arguments)},stackAlloc=Module.stackAlloc=function(){return(stackAlloc=Module.stackAlloc=Module.asm.stackAlloc).apply(null,arguments)},Module.zoomf={},run();break;case k.e:{let e=n.data||{},r=!!e.hold;Object(s.o)("HOLD:".concat(r,":").concat(e.userid,":").concat(e.reinit)),r?function(e){if(An)return;if(Te&&e.userid&&e.userid>>10!=Te>>10)return void Object(s.o)("HOLDINVALID");if(An=!0,null==Oe)return;let t=Oe;Oe=null,I.setAudioInstanceAndType(Oe,qe?I.WASMTYPE.ENCODE:I.WASMTYPE.DECODE),q(t)}(e):(t=e,An&&(An=!1,Ve=!0,t.reinit&&(Te=t.userid,qe||vn(Te,0,0),postMessage({status:qe||Oe?i.h:i.g}))));break}case k.m:I.setAllSpeechVolume(n.volume);break;case k.o:var l,h,d;(nn=n.value)?Jt===I.AUDIO_STATE.UNMUTE?null===(l=Se)||void 0===l||l.startCheck():null===(h=Se)||void 0===h||h.stopCheck():null===(d=Se)||void 0===d||d.stopCheck()}}));var An=!1;function vn(e,t,n){Oe&&je==e?Object(s.o)("AHNN"):(Oe&&(q(Oe),Oe=null,console.error("<<<<< pre audiouserid ".concat(je," now ").concat(e))),Oe=W(e,Ie,Ce,t,n,Ye,qe,!0,1),je=e,Oe&&!isPreviewMode?I.setAudioInstanceAndType(Oe,I.WASMTYPE.DECODE):Oe||Object(s.u)("audio_handle not exist when decoding"),Et.updateKey(),Ze&&(I.disableJitterLog(),Ke(Oe,1)),Qe(Oe,!1))}var Sn=!1;function yn(e){if(ot&&ot.id!=En&&(ot.forceClose(),ot=null),e.webtransportURL&&!ot){let t=1;e.webtransportURL.includes("mode=2")&&(t=0),ut({url:e.webtransportURL,label:"audio",id:En,onmessage:bt,onopen:ht,onclose:dt,groupSize:t})}Object(s.j)(ke,e.websocket_ip_address)&&(ke&&(ke.close(),ke=null,Object(s.u)("audio websocket cid changed")),ke=at(e.websocket_ip_address,ct,gt,vt,At)),function(){if(Tn)return;(Tn=Object(N.d)(qe?P.e.AUDIO_ENCODE:P.e.AUDIO_DECODE)).onmessage=Mn,Tn.onopen=()=>{Be=!0,lt()},Tn.onclose=()=>{Be=!1,lt()},(wn.sender||wn.reciver)&&Object(U.b)(Tn,wn.sender,wn.reciver)}()}var Tn=null,wn={};function Mn(e,t){Oe&&(qe||tn++%3!=0||ge(Oe),mt(new Uint8Array(e)))}Object(N.b)(),Object(B.a)(self)},,,,,,,,function(e,t,n){"use strict";n.r(t);var s=n(47);Object.keys(s).forEach(e=>self[e]=s[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/audio_simd.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1; +var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +} +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="audio.simd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={1105068:$0=>{console.log("Audio Version: ",$0)},1105105:($0,$1)=>{send_data($0,$1)},1105128:($0,$1)=>{SAVE_IV($0,$1)},1105146:($0,$1,$2,$3)=>{audio_encode_frame_callback($0,$1,$2,$3)},1105195:($0,$1,$2)=>{Get_ExternalRecord($0,$1,$2)},1105231:()=>{return Date.now()},1105254:($0,$1)=>{update_play_time($0,$1)},1105284:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},1105331:($0,$1)=>{AudioWasmAdapter.onMonitorLogWASM($0,$1)},1105374:($0,$1)=>{AudioWasmAdapter.onAudioLevelWASM($0,$1)},1105417:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},1105457:($0,$1,$2,$3)=>{AudioWasmAdapter.onAPMProcessedPCMWASM($0,$1,$2,$3)},1105517:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105552:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105587:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseAudioQosData($0,$1,$2,$3,$4,$5,$6,$7)},1105642:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105679:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105716:($0,$1,$2,$3,$4,$5,$6,$7)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7)},1105768:($0,$1)=>{get_edition($0,$1)},1105793:($0,$1)=>{SAVE_IV($0,$1)},1105811:($0,$1)=>{COMMIT_PRINT($0,$1)},1105833:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105869:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105905:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105941:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105977:($0,$1)=>{LOG_OUT($0,$1)},1105998:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _shmat(){err("missing function: shmat");abort(-1)}function _shmctl(){err("missing function: shmctl");abort(-1)}function _shmdt(){err("missing function: shmdt");abort(-1)}function _shmget(){err("missing function: shmget");abort(-1)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident) { if (!Module["zoomf"]) { Module["zoomf"] = {} } if (!Module["zoomf"]["_" + ident]) { return (Module["zoomf"]["_" + ident] = function () { return (Module["_" + ident] = Module["asm"][ident]).apply(null, arguments) }) } else { return Module["zoomf"]["_" + ident] } }function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"shmat":_shmat,"shmctl":_shmctl,"shmdt":_shmdt,"shmget":_shmget,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Audio_Init=Module["__Audio_Init"]=function(){return(__Audio_Init=Module["__Audio_Init"]=Module["asm"]["_Audio_Init"]).apply(null,arguments)};var __Audio_UnInit=Module["__Audio_UnInit"]=function(){return(__Audio_UnInit=Module["__Audio_UnInit"]=Module["asm"]["_Audio_UnInit"]).apply(null,arguments)};var __Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=function(){return(__Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=Module["asm"]["_Deliver_Recorded_Data"]).apply(null,arguments)};var __Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=function(){return(__Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=Module["asm"]["_Audio_Try_Analysis"]).apply(null,arguments)};var __Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=function(){return(__Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=Module["asm"]["_Put_Pre_Aec_Data"]).apply(null,arguments)};var __Set_Aec_Delay=Module["__Set_Aec_Delay"]=function(){return(__Set_Aec_Delay=Module["__Set_Aec_Delay"]=Module["asm"]["_Set_Aec_Delay"]).apply(null,arguments)};var __ReSet_Aec=Module["__ReSet_Aec"]=function(){return(__ReSet_Aec=Module["__ReSet_Aec"]=Module["asm"]["_ReSet_Aec"]).apply(null,arguments)};var __Get_Aec_Delay=Module["__Get_Aec_Delay"]=function(){return(__Get_Aec_Delay=Module["__Get_Aec_Delay"]=Module["asm"]["_Get_Aec_Delay"]).apply(null,arguments)};var __Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=function(){return(__Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=Module["asm"]["_Request_Audio_Qos_Data"]).apply(null,arguments)};var __Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=function(){return(__Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=Module["asm"]["_Get_Mixed_Audio"]).apply(null,arguments)};var __Get_Audio_Edition=Module["__Get_Audio_Edition"]=function(){return(__Get_Audio_Edition=Module["__Get_Audio_Edition"]=Module["asm"]["_Get_Audio_Edition"]).apply(null,arguments)};var __Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=function(){return(__Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=Module["asm"]["_Audio_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Cooker_info=Module["__Add_Cooker_info"]=function(){return(__Add_Cooker_info=Module["__Add_Cooker_info"]=Module["asm"]["_Add_Cooker_info"]).apply(null,arguments)};var __Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=function(){return(__Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=Module["asm"]["_Remove_Cooker_Info"]).apply(null,arguments)};var __Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=function(){return(__Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=Module["asm"]["_Get_Audio_Meat_Weight"]).apply(null,arguments)};var __Change_Aec_Flag=Module["__Change_Aec_Flag"]=function(){return(__Change_Aec_Flag=Module["__Change_Aec_Flag"]=Module["asm"]["_Change_Aec_Flag"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Cc_Set_Lang=Module["__Cc_Set_Lang"]=function(){return(__Cc_Set_Lang=Module["__Cc_Set_Lang"]=Module["asm"]["_Cc_Set_Lang"]).apply(null,arguments)};var __Interpretation_Configure=Module["__Interpretation_Configure"]=function(){return(__Interpretation_Configure=Module["__Interpretation_Configure"]=Module["asm"]["_Interpretation_Configure"]).apply(null,arguments)};var __Start_Audio_Share=Module["__Start_Audio_Share"]=function(){return(__Start_Audio_Share=Module["__Start_Audio_Share"]=Module["asm"]["_Start_Audio_Share"]).apply(null,arguments)};var __InsertShareData=Module["__InsertShareData"]=function(){return(__InsertShareData=Module["__InsertShareData"]=Module["asm"]["_InsertShareData"]).apply(null,arguments)};var __Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=function(){return(__Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=Module["asm"]["_Set_Share_Volume_Level"]).apply(null,arguments)};var __Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=function(){return(__Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=Module["asm"]["_Set_Speech_Volume_Level"]).apply(null,arguments)};var __Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=function(){return(__Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=Module["asm"]["_Set_All_Speech_Volume_Level"]).apply(null,arguments)};var __Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=function(){return(__Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=Module["asm"]["_Update_Monitor_Send_Audio_Info"]).apply(null,arguments)};var __Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=function(){return(__Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=Module["asm"]["_Update_Monitor_Receive_Audio_Info"]).apply(null,arguments)};var __Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=function(){return(__Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=Module["asm"]["_Set_Audio_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=function(){return(__Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=Module["asm"]["_Enable_Share_To_Bo"]).apply(null,arguments)};var __Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=function(){return(__Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=Module["asm"]["_Enable_Broadcast_To_Bo"]).apply(null,arguments)};var __Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=function(){return(__Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=Module["asm"]["_Set_Audio_Pipe_To_Bo"]).apply(null,arguments)};var __Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=function(){return(__Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=Module["asm"]["_Enable_Pipe_OUT_RTP"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __setMultiViewFlag=Module["__setMultiViewFlag"]=function(){return(__setMultiViewFlag=Module["__setMultiViewFlag"]=Module["asm"]["_setMultiViewFlag"]).apply(null,arguments)};var __Switch_Denoise=Module["__Switch_Denoise"]=function(){return(__Switch_Denoise=Module["__Switch_Denoise"]=Module["asm"]["_Switch_Denoise"]).apply(null,arguments)};var __Switch_Original_Sound=Module["__Switch_Original_Sound"]=function(){return(__Switch_Original_Sound=Module["__Switch_Original_Sound"]=Module["asm"]["_Switch_Original_Sound"]).apply(null,arguments)};var __Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=function(){return(__Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=Module["asm"]["_Switch_High_Bitrate"]).apply(null,arguments)};var __Heartbeat=Module["__Heartbeat"]=function(){return(__Heartbeat=Module["__Heartbeat"]=Module["asm"]["_Heartbeat"]).apply(null,arguments)};var __MuteUnmuteState=Module["__MuteUnmuteState"]=function(){return(__MuteUnmuteState=Module["__MuteUnmuteState"]=Module["asm"]["_MuteUnmuteState"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiiji=Module["dynCall_iiiji"]=function(){return(dynCall_iiiji=Module["dynCall_iiiji"]=Module["asm"]["dynCall_iiiji"]).apply(null,arguments)};var dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=function(){return(dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=Module["asm"]["dynCall_iiiiiijiii"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_jiii=Module["dynCall_jiii"]=function(){return(dynCall_jiii=Module["dynCall_jiii"]=Module["asm"]["dynCall_jiii"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_level_worklet_process.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_level_worklet_process.min.js new file mode 100644 index 0000000..4b29ad7 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_level_worklet_process.min.js @@ -0,0 +1,30 @@ +!function(t){var e={};function s(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(i,r,function(e){return t[e]}.bind(null,r));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=10)}([function(t,e,s){"use strict";s.d(e,"e",(function(){return i})),s.d(e,"i",(function(){return r})),s.d(e,"a",(function(){return n})),s.d(e,"d",(function(){return a})),s.d(e,"f",(function(){return o})),s.d(e,"c",(function(){return h})),s.d(e,"b",(function(){return u})),s.d(e,"g",(function(){return l})),s.d(e,"j",(function(){return c})),s.d(e,"h",(function(){return f}));const i=30,r=35,n=48,a=57,o=61,h=66.5,u=66.6,l=-26,c=-27,f=-28},function(t,e,s){"use strict";var i=s(0);s(3);new Error;new Map;var r=s(2);function n(t){postMessage({status:i.i,data:t})}function a(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e)return e.postMessage({status:i.a,data:t});postMessage({status:i.a,data:t})}new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(t,e){this.ssrcInfoMap.has(t)||this.ssrcInfoMap.set(t,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(t,e),this._removeZeroFPS()}_calculateFPS(t,e){const s=this.ssrcInfoMap.get(t);if(0===s.frames?s.firstTime=e:s.lastTime=e,s.frames+=1,s.frames>2&&s.frames%5==0&&s.lastTime-s.firstTime>=1e3){const e=Math.floor(1e3/((s.lastTime-s.firstTime)/(s.frames-1)));s.fps!==e&&(this._notifyFPS(t,e),s.fps=e),s.firstTime=s.lastTime,s.frames=1}}_removeZeroFPS(){let t=Date.now();this.ssrcInfoMap.forEach((e,s)=>{const i=this.ssrcInfoMap.get(s);i&&t-i.lastTime>2e3&&(this.ssrcInfoMap.delete(s),this._notifyFPS(s,0))})}_notifyFPS(t,e){postMessage({status:i.b,data:{ssrc:t,fps:e}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};var o=s(5);const h={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},u={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let l,c,f,d,_,A,E,m,S,b,p=0,T=!0;var g=0;var C=!1;var M=null;var w=!1;e.a={WASMTYPE:h,AUDIO_STATE:u,onWasmModuleReady:function(t){if(!t)return console.warn("[AudioWASMAdapter] Module undefined");f=t.cwrap("_Heartbeat","number",["number"]),d=t.cwrap("_MuteUnmuteState","number",["number","number"]),_=t.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),A=t.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),E=t.cwrap("_Switch_Denoise","number",["number","number","number","number"]),m=t.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),S=t.cwrap("_Switch_High_Bitrate","number",["number","number"]),b=t.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(t,e,s){l=t,e&&(p=e),s&&(c=s)},muteUnmuteState:function(t){if(null!=Object.values(u).find(e=>e==t))return l?void(p!=h.WORKLET_APM_ONLY&&(d(l,t),n("muteUnmuteState: "+t))):n("muteUnmuteState: -1")},switchOriginalSound:function(t,e,s,i){l&&_(l,t,e,s,i)},deliverRecordedData:function(t,e,s,i){l&&A(l,t,e,0,s,i)},switchDenoise:function(t,e){l&&(C=t,E(l,!!t,3,!!e))},audioInit:function(t,e,s,i,r,n,a,o,h,u){return m(t,e,s,i,r,n,a,o,h,u)},setDecoder:function(t){M=t},needCalculateDenoiseOutput:function(){w=!0},switchHighBitrate:function(t){l&&S(l,t)},disableJitterLog:function(){T=!1},setAllSpeechVolume:function(t){l&&b(l,t)},onMonitorLogWASM:function(t,e){if(e<=0)return;const s=Module.HEAPU8.subarray(t,t+e),i=String.fromCharCode.apply(null,s);i&&(!T&&i.includes("JITTER")||(p==h.ENCODE||p==h.DECODE?a(i):p==h.WORKLET?c&&c.port&&a(i,c.port):p==h.WORKLET_APM_ONLY&&c.port&&c.port.postMessage({status:"SPEECH_LOG",data:{log:i}})))},onMuteSpeechWarningWASM:function(){postMessage({status:r.b})},onAudioLevelWASM:function(t,e,s){var i;p!=h.ENCODE&&p!=h.WORKLET_APM_ONLY||1==t&&(0===e&&0===g||(g=e,p===h.ENCODE?postMessage({status:r.a,value:e}):null!==(i=c)&&void 0!==i&&i.port&&c.port.postMessage({status:r.a,data:e})))},onAPMProcessedPCMWASM:function(t,e,s,i){if(!C)return;let r=Module.HEAPF32.subarray(t/4,t/4+e);if(M){if(w){w=!1;let{sumRms:t}=Object(o.a)(r,2),e=Object(o.c)(t);c.port&&c.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:e})}M.push([r])}}}},function(t,e,s){"use strict";s.d(e,"a",(function(){return i})),s.d(e,"c",(function(){return r})),s.d(e,"b",(function(){return n}));const i=38,r=-51,n=121},function(t,e,s){"use strict";const i=t=>0==(t&t-1);let r=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(t,e){this._instance=t,this.fixVersion=e}getMessageFromErrorOrEvent(t,e){let s=t;return e instanceof ErrorEvent?(e.filename&&(s+=" File: ".concat(e.filename)),(e.lineno||e.colno)&&(s+=" Line: ".concat(e.lineno,":").concat(e.colno)),e.message&&(s+=" Message: ".concat(e.message)),e.error&&(s+="\nStack: ".concat(e.error.stack))):e instanceof Error?(e.fileName&&(s+=" File: ".concat(e.fileName)),(e.lineNumber||e.columnNumber)&&(s+=" Line: ".concat(e.lineNumber,":").concat(e.columnNumber)),e.message&&(s+=" Message: ".concat(e.message)),e.stack&&(s+=" Stack: ".concat(e.stack)),e.name&&(s+=" Name: ".concat(e.name)),e.constraint&&(s+=" Constraint: ".concat(e.constraint))):e instanceof CloseEvent?(e.code&&(s+=" Code: ".concat(e.code)),e.reason&&(s+=" Reason: ".concat(e.reason)),s+=" wasClean: ".concat(e.wasClean)):e instanceof DOMException?(e.message&&(s+=" Message: ".concat(e.message)),e.name&&(s+=" Name: ".concat(e.name))):s+=e?e.toString():"",s}error(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t=this.getMessageFromErrorOrEvent(t,e),this._highFrequencyLogs[t]?this._highFrequencyLogs[t]+=1:this._highFrequencyLogs[t]=1;const s=i(this._highFrequencyLogs[t]);this._instance&&s&&this._instance.error(t,[this.fixVersion])}severityerror(t,e){this._instance&&this._instance.error(JSON.stringify(t),e)}directReport(t,e){var s,i;this._instance&&(e||(e=["MEDIASDK_INFO"]),null===(s=(i=this._instance).directReport)||void 0===s||s.call(i,{msg:t},e))}warn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t=this.getMessageFromErrorOrEvent(t,e),this._instance&&this._instance.warn(t)}log(t){this._instance&&this._instance.log(t)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};e.a=r},function(t,e,s){"use strict";s.d(e,"b",(function(){return r})),s.d(e,"a",(function(){return n}));var i=s(6);class r{constructor(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(t),this.sabBuffer=new Float32Array(e),this.perFrameLength=s,this.writeChannelNumb=r,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%s==0,this.bufferIndex=null,this.supportSpecialOptimization){let t=this.bufferLen/s;this.bufferIndex=[];for(let e=0;ethis.CACHE_SIZE_MAX_VALUE&&(t=this.CACHE_SIZE_MAX_VALUE),t0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(t){if(void 0===t[0]||t[0].length*this.writeChannelNumb!==this.perFrameLength)return;let e=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),e?this.supportSpecialOptimization?this.writeSpecial(t):this.writeNormal(t):void 0}writeNormal(t){let e=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;s=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=e,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(t){let e=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;sthis.bufferLen){let s=Math.ceil((e-this.bufferLen)/this.perFrameLength)+1;t=(s*this.perFrameLength+t)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=null;if(this.bufferLen-t>=this.perFrameLength)s=this.sabBuffer.subarray(t,t+this.perFrameLength);else{let e=this.sabBuffer.subarray(t),i=this.sabBuffer.subarray(0,this.perFrameLength-e.length);s=this.placeBuffer,s.set(e),s.set(i,e.length)}return t+=this.perFrameLength,t>=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=t,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}readSpecial(){let t=this.sabState[this.STATE_READ_INDEX],e=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(ethis.bufferLen){let s=Math.ceil((e-this.bufferLen)/this.perFrameLength)+1;t=(s+t)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=this.bufferIndex[t];return t=(t+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=t,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}}class n{constructor(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=t,this.wframes=e,this.writeChannelNumb=s,this.cap=this.lcm(t,e),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(t,e){return 0===e?t:this.gcd(e,t%e)}lcm(t,e){return t/this.gcd(t,e)*e}push(t){if(null==t[0]||t[0].length*this.writeChannelNumb==this.wframes){for(let e=0;e=this.cap&&(this.woffset=this.woffset%this.cap)}else{var e;console.error("[Audio] critical error in AudioWorklet: data.length:",t.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(e=t[0])||void 0===e?void 0:e.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let t=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),t}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}},function(t,e,s){"use strict";s.d(e,"a",(function(){return r})),s.d(e,"b",(function(){return n})),s.d(e,"c",(function(){return a}));s(3);const i=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function r(t,e){let s=0,i=0;for(let r=0;rs&&(s=e)}return s=s>1?1:s,{sumRms:i/t.length/e,absMax:s}}function n(t){if("number"!=typeof t||t<0||t>1)return-1;let e=parseInt(32768*t/1e3);return 0==e&&t>250&&(e=1),i[e]}function a(t){let e=0;return e=t>.1995?15:t>.0794?14:t>.0316?13:t>.0126?12:t>.005?11:t>.002?10:t>79433e-8?9:t>31623e-8?8:t>12589e-8?7:t>50119e-9?6:t>19953e-9?5:t>79433e-10?4:t>31623e-10?3:t>12589e-10?2:t>5.0119e-7?1:0,e}},function(t,e,s){"use strict";s.d(e,"a",(function(){return i}));class i{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(t){return t===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==t||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=t,!0)}}},function(t,e,s){"use strict";s.d(e,"a",(function(){return i}));class i{constructor(t){this.messageQueue=[],this.auidoNodePort,this.userAgent="",this.isSafari=!1,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.print_=this.print_.bind(this),this.messageHeader=t}setUserAgent(t){this.userAgent=t,this.userAgent.match(/AppleWebKit\/(\d+)\./)&&(this.isSafari=!0)}setAuidoNodePort(t){this.auidoNodePort=t}debug(t){t=this.messageHeader+t;for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;i{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="audio.simd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={1105068:$0=>{console.log("Audio Version: ",$0)},1105105:($0,$1)=>{send_data($0,$1)},1105128:($0,$1)=>{SAVE_IV($0,$1)},1105146:($0,$1,$2,$3)=>{audio_encode_frame_callback($0,$1,$2,$3)},1105195:($0,$1,$2)=>{Get_ExternalRecord($0,$1,$2)},1105231:()=>{return Date.now()},1105254:($0,$1)=>{update_play_time($0,$1)},1105284:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},1105331:($0,$1)=>{AudioWasmAdapter.onMonitorLogWASM($0,$1)},1105374:($0,$1)=>{AudioWasmAdapter.onAudioLevelWASM($0,$1)},1105417:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},1105457:($0,$1,$2,$3)=>{AudioWasmAdapter.onAPMProcessedPCMWASM($0,$1,$2,$3)},1105517:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105552:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105587:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseAudioQosData($0,$1,$2,$3,$4,$5,$6,$7)},1105642:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105679:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105716:($0,$1,$2,$3,$4,$5,$6,$7)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7)},1105768:($0,$1)=>{get_edition($0,$1)},1105793:($0,$1)=>{SAVE_IV($0,$1)},1105811:($0,$1)=>{COMMIT_PRINT($0,$1)},1105833:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105869:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105905:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105941:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105977:($0,$1)=>{LOG_OUT($0,$1)},1105998:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _shmat(){err("missing function: shmat");abort(-1)}function _shmctl(){err("missing function: shmctl");abort(-1)}function _shmdt(){err("missing function: shmdt");abort(-1)}function _shmget(){err("missing function: shmget");abort(-1)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"shmat":_shmat,"shmctl":_shmctl,"shmdt":_shmdt,"shmget":_shmget,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Audio_Init=Module["__Audio_Init"]=function(){return(__Audio_Init=Module["__Audio_Init"]=Module["asm"]["_Audio_Init"]).apply(null,arguments)};var __Audio_UnInit=Module["__Audio_UnInit"]=function(){return(__Audio_UnInit=Module["__Audio_UnInit"]=Module["asm"]["_Audio_UnInit"]).apply(null,arguments)};var __Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=function(){return(__Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=Module["asm"]["_Deliver_Recorded_Data"]).apply(null,arguments)};var __Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=function(){return(__Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=Module["asm"]["_Audio_Try_Analysis"]).apply(null,arguments)};var __Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=function(){return(__Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=Module["asm"]["_Put_Pre_Aec_Data"]).apply(null,arguments)};var __Set_Aec_Delay=Module["__Set_Aec_Delay"]=function(){return(__Set_Aec_Delay=Module["__Set_Aec_Delay"]=Module["asm"]["_Set_Aec_Delay"]).apply(null,arguments)};var __ReSet_Aec=Module["__ReSet_Aec"]=function(){return(__ReSet_Aec=Module["__ReSet_Aec"]=Module["asm"]["_ReSet_Aec"]).apply(null,arguments)};var __Get_Aec_Delay=Module["__Get_Aec_Delay"]=function(){return(__Get_Aec_Delay=Module["__Get_Aec_Delay"]=Module["asm"]["_Get_Aec_Delay"]).apply(null,arguments)};var __Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=function(){return(__Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=Module["asm"]["_Request_Audio_Qos_Data"]).apply(null,arguments)};var __Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=function(){return(__Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=Module["asm"]["_Get_Mixed_Audio"]).apply(null,arguments)};var __Get_Audio_Edition=Module["__Get_Audio_Edition"]=function(){return(__Get_Audio_Edition=Module["__Get_Audio_Edition"]=Module["asm"]["_Get_Audio_Edition"]).apply(null,arguments)};var __Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=function(){return(__Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=Module["asm"]["_Audio_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Cooker_info=Module["__Add_Cooker_info"]=function(){return(__Add_Cooker_info=Module["__Add_Cooker_info"]=Module["asm"]["_Add_Cooker_info"]).apply(null,arguments)};var __Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=function(){return(__Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=Module["asm"]["_Remove_Cooker_Info"]).apply(null,arguments)};var __Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=function(){return(__Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=Module["asm"]["_Get_Audio_Meat_Weight"]).apply(null,arguments)};var __Change_Aec_Flag=Module["__Change_Aec_Flag"]=function(){return(__Change_Aec_Flag=Module["__Change_Aec_Flag"]=Module["asm"]["_Change_Aec_Flag"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Cc_Set_Lang=Module["__Cc_Set_Lang"]=function(){return(__Cc_Set_Lang=Module["__Cc_Set_Lang"]=Module["asm"]["_Cc_Set_Lang"]).apply(null,arguments)};var __Interpretation_Configure=Module["__Interpretation_Configure"]=function(){return(__Interpretation_Configure=Module["__Interpretation_Configure"]=Module["asm"]["_Interpretation_Configure"]).apply(null,arguments)};var __Start_Audio_Share=Module["__Start_Audio_Share"]=function(){return(__Start_Audio_Share=Module["__Start_Audio_Share"]=Module["asm"]["_Start_Audio_Share"]).apply(null,arguments)};var __InsertShareData=Module["__InsertShareData"]=function(){return(__InsertShareData=Module["__InsertShareData"]=Module["asm"]["_InsertShareData"]).apply(null,arguments)};var __Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=function(){return(__Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=Module["asm"]["_Set_Share_Volume_Level"]).apply(null,arguments)};var __Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=function(){return(__Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=Module["asm"]["_Set_Speech_Volume_Level"]).apply(null,arguments)};var __Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=function(){return(__Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=Module["asm"]["_Set_All_Speech_Volume_Level"]).apply(null,arguments)};var __Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=function(){return(__Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=Module["asm"]["_Update_Monitor_Send_Audio_Info"]).apply(null,arguments)};var __Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=function(){return(__Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=Module["asm"]["_Update_Monitor_Receive_Audio_Info"]).apply(null,arguments)};var __Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=function(){return(__Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=Module["asm"]["_Set_Audio_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=function(){return(__Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=Module["asm"]["_Enable_Share_To_Bo"]).apply(null,arguments)};var __Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=function(){return(__Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=Module["asm"]["_Enable_Broadcast_To_Bo"]).apply(null,arguments)};var __Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=function(){return(__Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=Module["asm"]["_Set_Audio_Pipe_To_Bo"]).apply(null,arguments)};var __Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=function(){return(__Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=Module["asm"]["_Enable_Pipe_OUT_RTP"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __setMultiViewFlag=Module["__setMultiViewFlag"]=function(){return(__setMultiViewFlag=Module["__setMultiViewFlag"]=Module["asm"]["_setMultiViewFlag"]).apply(null,arguments)};var __Switch_Denoise=Module["__Switch_Denoise"]=function(){return(__Switch_Denoise=Module["__Switch_Denoise"]=Module["asm"]["_Switch_Denoise"]).apply(null,arguments)};var __Switch_Original_Sound=Module["__Switch_Original_Sound"]=function(){return(__Switch_Original_Sound=Module["__Switch_Original_Sound"]=Module["asm"]["_Switch_Original_Sound"]).apply(null,arguments)};var __Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=function(){return(__Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=Module["asm"]["_Switch_High_Bitrate"]).apply(null,arguments)};var __Heartbeat=Module["__Heartbeat"]=function(){return(__Heartbeat=Module["__Heartbeat"]=Module["asm"]["_Heartbeat"]).apply(null,arguments)};var __MuteUnmuteState=Module["__MuteUnmuteState"]=function(){return(__MuteUnmuteState=Module["__MuteUnmuteState"]=Module["asm"]["_MuteUnmuteState"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiiji=Module["dynCall_iiiji"]=function(){return(dynCall_iiiji=Module["dynCall_iiiji"]=Module["asm"]["dynCall_iiiji"]).apply(null,arguments)};var dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=function(){return(dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=Module["asm"]["dynCall_iiiiiijiii"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_jiii=Module["dynCall_jiii"]=function(){return(dynCall_jiii=Module["dynCall_jiii"]=Module["asm"]["dynCall_jiii"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); + +} \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_process.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_process.min.js new file mode 100644 index 0000000..2637c52 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_process.min.js @@ -0,0 +1,21 @@ +!function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=54)}([,,,function(e,t,n){"use strict";var s=n(5),r=n(16);new Error;const i=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,u=null;function c(e,t){var n,s;if(!function(e){const t=performance.now();return(!i.has(e)||t-i.get(e)>5e3)&&(i.set(e,t),!0)}(e))return;let c;try{c=a("object"==typeof t?JSON.stringify(t):t)}catch(e){c=a(t)}null===(n=u)||void 0===n||n("NEM-".concat(e,"-").concat(c)),r.a.error("NotifyUIError,event=".concat(e,",data=").concat(c)),null===(s=o)||void 0===s||s(e,t)}var l=n(15);function h(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function _(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function p(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const n=await new Promise((e,t)=>{const n=s=>{let r=s.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===r.command?(v("DE"),self.removeEventListener("message",n),e(r.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===r.command&&(self.removeEventListener("message",n),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",n),v("DS"),postMessage({status:s.E,url:wasmUrl})});let r=await WebAssembly.instantiate(n,e);r.instance?(self.wasmModuleToShare=r.module,t(r.instance)):(self.wasmModuleToShare=n,t(r))}catch(e){v("IF"),g("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}n.d(t,"d",(function(){return h})),n.d(t,"g",(function(){return d})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return _})),n.d(t,"c",(function(){return p})),n.d(t,"q",(function(){return m})),n.d(t,"i",(function(){return E})),n.d(t,"u",(function(){return g})),n.d(t,"t",(function(){return A})),n.d(t,"o",(function(){return v})),n.d(t,"n",(function(){return S})),n.d(t,"v",(function(){return y})),n.d(t,"w",(function(){return T})),n.d(t,"p",(function(){return w})),n.d(t,"s",(function(){return D})),n.d(t,"k",(function(){return I})),n.d(t,"m",(function(){return C})),n.d(t,"r",(function(){return R})),n.d(t,"l",(function(){return U})),n.d(t,"x",(function(){return x})),n.d(t,"b",(function(){return F})),n.d(t,"h",(function(){return W})),n.d(t,"y",(function(){return q})),n.d(t,"a",(function(){return j})),n.d(t,"j",(function(){return V}));const b="function"!=typeof importScripts;function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;b?r.a.error(e,t):g(e,t)}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var n,r,i,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(n=t)||void 0===n?void 0:n.message)+" Stack: "+(null!==(r=null===(i=t)||void 0===i||null===(i=i.error)||void 0===i?void 0:i.stack)&&void 0!==r?r:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:s.G,errorMessage:e,errorEvent:t})}function A(e){postMessage({status:s.G,errorMessage:e,level:"low"})}function v(e){postMessage({status:s.zb,data:e})}function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:s.f,data:e});postMessage({status:s.f,data:e})}function y(e){postMessage({status:s.M,canvasId:e,replaceCanvas:!1})}function T(e){postMessage({status:s.N,canvasId:e})}function w(e){b?c(l.k,e):postMessage({status:s.Bb,where:e})}function M(){let e=this;this.promise=new Promise((function(t,n){e.reject=n,e.resolve=t}))}function D(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(n){t=null==e?void 0:e.getContext("2d")}return t||g("get2DContextFromCanvas return null"),t}class I{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let n=0;n0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,n)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new M;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class C{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let n=e.byteLength-this.sharedBufferList.bytesPerElement;if(n>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),s=n>e?n:e;if(s+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(s)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){g("Error in YuvWrap.recycle: ".concat(e))}}}function O(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function k(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const L=["","MOZ_","OP_","WEBKIT_"];function R(e,t){for(var n=0;n0&&(t+="&index="+e);let n={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:O,onclose:k,group:this,index:e},s=new N(n);await s.connect(),this.transportArray[e]=s}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const P=new Map,B=[90,180,360,720,1080],H=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const n=this.ssrcInfoMap.get(e);if(0===n.frames?n.firstTime=t:n.lastTime=t,n.frames+=1,n.frames>2&&n.frames%5==0&&n.lastTime-n.firstTime>=1e3){const t=Math.floor(1e3/((n.lastTime-n.firstTime)/(n.frames-1)));n.fps!==t&&(this._notifyFPS(e,t),n.fps=t),n.firstTime=n.lastTime,n.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,n)=>{const s=this.ssrcInfoMap.get(n);s&&e-s.lastTime>2e3&&(this.ssrcInfoMap.delete(n),this._notifyFPS(n,0))})}_notifyFPS(e,t){postMessage({status:s.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function x(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:r,r_h:i,rotation:a,ssrc:o}=e;let u=1==a||3==a,c=u?i:r,l=u?r:i;const h=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!P.get(h)||P.get(h).width!==c||P.get(h).height!==l){const e={width:c,height:l,ssrc:h,quality:f};P.set(h,e),n?n(e):postMessage({status:s.v,data:e})}t&&H.updateSSRCInfo(h,Date.now())}function F(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function W(e,t,n,s,r){if(!r&&!s||1==e)return!1;let i=s&&t>=640,a=r&&t>=1280;return 2!=e||640==t&&480==n?i||a:((i||a)&&E("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(n)),!1)}function q(e,t){e?e.send(t):g("websocket is null",new Error("message type ".concat(t[0])))}function j(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function V(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,n){"use strict";n.d(t,"y",(function(){return s})),n.d(t,"Y",(function(){return r})),n.d(t,"L",(function(){return i})),n.d(t,"K",(function(){return a})),n.d(t,"J",(function(){return o})),n.d(t,"v",(function(){return u})),n.d(t,"q",(function(){return c})),n.d(t,"r",(function(){return l})),n.d(t,"w",(function(){return h})),n.d(t,"x",(function(){return d})),n.d(t,"u",(function(){return f})),n.d(t,"X",(function(){return _})),n.d(t,"P",(function(){return p})),n.d(t,"Q",(function(){return m})),n.d(t,"O",(function(){return b})),n.d(t,"M",(function(){return E})),n.d(t,"s",(function(){return g})),n.d(t,"k",(function(){return A})),n.d(t,"n",(function(){return v})),n.d(t,"l",(function(){return S})),n.d(t,"m",(function(){return y})),n.d(t,"db",(function(){return T})),n.d(t,"B",(function(){return w})),n.d(t,"C",(function(){return M})),n.d(t,"W",(function(){return D})),n.d(t,"ab",(function(){return I})),n.d(t,"V",(function(){return C})),n.d(t,"Z",(function(){return O})),n.d(t,"N",(function(){return k})),n.d(t,"h",(function(){return L})),n.d(t,"g",(function(){return R})),n.d(t,"f",(function(){return U})),n.d(t,"A",(function(){return N})),n.d(t,"z",(function(){return P})),n.d(t,"S",(function(){return B})),n.d(t,"R",(function(){return H})),n.d(t,"e",(function(){return x})),n.d(t,"o",(function(){return F})),n.d(t,"T",(function(){return W})),n.d(t,"U",(function(){return q})),n.d(t,"G",(function(){return j})),n.d(t,"E",(function(){return V})),n.d(t,"H",(function(){return Y})),n.d(t,"I",(function(){return z})),n.d(t,"F",(function(){return G})),n.d(t,"bb",(function(){return Z})),n.d(t,"c",(function(){return K})),n.d(t,"b",(function(){return X})),n.d(t,"cb",(function(){return Q})),n.d(t,"d",(function(){return J})),n.d(t,"t",(function(){return $})),n.d(t,"D",(function(){return ee})),n.d(t,"p",(function(){return te})),n.d(t,"a",(function(){return ne})),n.d(t,"j",(function(){return se})),n.d(t,"i",(function(){return re}));const s=1e3,r=5,i=43,a=44,o=45,u=0,c=1,l=146,h=2,d=7,f=9,_=17,p=10,m=11,b=12,E=102,g=107,A=0,v=1,S=2,y=3,T=65,w=0,M=1,D=-1,I=0,C=1,O=2,k=3,L=1,R=2,U=3,N={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},P={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,H=20,x=15,F=10,W=8294400,q=5,j=0,V=1,Y=2,z=15,G=5,Z=400,K=7,X=8,Q={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,ne=1,se=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),re={PAUSE:0,RESUME:1,STOP:2}},function(e,t,n){"use strict";n.d(t,"j",(function(){return s})),n.d(t,"h",(function(){return r})),n.d(t,"l",(function(){return i})),n.d(t,"sb",(function(){return a})),n.d(t,"qb",(function(){return o})),n.d(t,"ub",(function(){return u})),n.d(t,"Z",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"bb",(function(){return h})),n.d(t,"db",(function(){return d})),n.d(t,"D",(function(){return f})),n.d(t,"ob",(function(){return _})),n.d(t,"H",(function(){return p})),n.d(t,"Eb",(function(){return m})),n.d(t,"n",(function(){return b})),n.d(t,"vb",(function(){return E})),n.d(t,"E",(function(){return g})),n.d(t,"b",(function(){return A})),n.d(t,"zb",(function(){return v})),n.d(t,"S",(function(){return S})),n.d(t,"I",(function(){return y})),n.d(t,"T",(function(){return T})),n.d(t,"xb",(function(){return w})),n.d(t,"f",(function(){return M})),n.d(t,"nb",(function(){return D})),n.d(t,"mb",(function(){return I})),n.d(t,"eb",(function(){return C})),n.d(t,"X",(function(){return O})),n.d(t,"V",(function(){return k})),n.d(t,"a",(function(){return L})),n.d(t,"z",(function(){return R})),n.d(t,"Fb",(function(){return U})),n.d(t,"G",(function(){return N})),n.d(t,"wb",(function(){return P})),n.d(t,"v",(function(){return B})),n.d(t,"u",(function(){return H})),n.d(t,"t",(function(){return x})),n.d(t,"w",(function(){return F})),n.d(t,"U",(function(){return W})),n.d(t,"jb",(function(){return q})),n.d(t,"kb",(function(){return j})),n.d(t,"R",(function(){return V})),n.d(t,"hb",(function(){return Y})),n.d(t,"ib",(function(){return z})),n.d(t,"F",(function(){return G})),n.d(t,"r",(function(){return Z})),n.d(t,"q",(function(){return K})),n.d(t,"y",(function(){return X})),n.d(t,"p",(function(){return Q})),n.d(t,"x",(function(){return J})),n.d(t,"Cb",(function(){return $})),n.d(t,"O",(function(){return ee})),n.d(t,"P",(function(){return te})),n.d(t,"Ab",(function(){return ne})),n.d(t,"C",(function(){return se})),n.d(t,"B",(function(){return re})),n.d(t,"A",(function(){return ie})),n.d(t,"K",(function(){return ae})),n.d(t,"J",(function(){return oe})),n.d(t,"L",(function(){return ue})),n.d(t,"o",(function(){return ce})),n.d(t,"s",(function(){return le})),n.d(t,"gb",(function(){return he})),n.d(t,"fb",(function(){return de})),n.d(t,"Db",(function(){return fe})),n.d(t,"Q",(function(){return _e})),n.d(t,"i",(function(){return pe})),n.d(t,"g",(function(){return me})),n.d(t,"k",(function(){return be})),n.d(t,"m",(function(){return Ee})),n.d(t,"rb",(function(){return ge})),n.d(t,"pb",(function(){return Ae})),n.d(t,"tb",(function(){return ve})),n.d(t,"Y",(function(){return Se})),n.d(t,"cb",(function(){return ye})),n.d(t,"ab",(function(){return Te})),n.d(t,"c",(function(){return we})),n.d(t,"M",(function(){return Me})),n.d(t,"Bb",(function(){return De})),n.d(t,"N",(function(){return Ie})),n.d(t,"yb",(function(){return Ce})),n.d(t,"W",(function(){return Oe})),n.d(t,"lb",(function(){return ke})),n.d(t,"e",(function(){return Le}));const s=1,r=2,i=3,a=7,o=8,u=9,c=12,l=14,h=15,d=16,f=18,_=20,p=21,m=24,b=26,E=27,g=30,A=31,v=35,S=36,y=37,T=38,w=47,M=48,D=50,I=51,C=52,O=53,k=54,L=56,R=57,U=60,N=61,P=62,B=66.5,H=66.6,x=67,F=68,W=69,q=71,j=72,V=73,Y=75,z=76,G=78,Z=105,K=106,X=107,Q=108,J=109,$=120,ee=121,te=122,ne=123,se=124,re=125,ie=126,ae=127,oe=128,ue=129,ce=132,le=133,he=135,de=136,fe=137,_e=151,pe=-1,me=-2,be=-3,Ee=-5,ge=-7,Ae=-8,ve=-9,Se=-12,ye=-14,Te=-15,we=-23,Me=-26,De=-27,Ie=-28,Ce=-35,Oe=-129,ke=-130,Le=-131},function(e,t,n){"use strict";n.d(t,"e",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"d",(function(){return f})),n.d(t,"a",(function(){return _})),n.d(t,"c",(function(){return p}));var s=n(7),r=n.n(s),i=n(14),a=n(17),o=n(5),u=n(10),c=n(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},h=e=>{0};class d{constructor(){this.onmessage=h,this.status=d.CLOSED,this.onopen=h,this.onclose=h,this.onwer=null}send(e){}delete(){this.onmessage=h,this.onopen=h,this.onclose=h,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}r()(d,"OPEN",1),r()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=h,this.sender=h,this.videoSender=h,this.reciver=h,this.wasmSender=h}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=h,this.sender=h,this.videoSender=h,this.reciver=h,this.wasmSender=h;let{consumer:n}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==n||n.setDataCallback(h),null==n||n.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=h),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:n}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(n,0);break;case o.L:this.status=n,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:n,interval:s}=e||{};n?s?(this.sender=e=>{n.enqueue(e)},this.wasmSender=e=>{n.enqueue(e)},this.videoSender=(e,t)=>{if(!n.enqueueSafe([e,t],!1)){let s=new Uint8Array(t.length+e.length);s.set(e,0),s.set(t,e.length),n.enqueueSafe(s)}}):(this.sender=e=>{n.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{n.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!n.enqueueSafe([e,t],!1)){let s=new Uint8Array(t.length+e.length);s.set(e,0),s.set(t,e.length),n.enqueueSafe(s)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let n=new Uint8Array(t.length+e.length);n.set(e,0),n.set(t,e.length),this.port.postMessage({cmd:o.K,data:n},[n.buffer])});let{sabqueue:r,consumer:u,useCopy:c,interval:l,offset:h}=t||{};if(u&&(u.cancelConsume(),u=null),r){const e=c?e=>{this.onmessage(e,0)}:h?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let n=null,s=_.dataTransportMgr.monitorlogfn;if(l&&s){var d;let e=new i.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});n=e.timeoutReport.bind(e)}u=new a.a(r,e,n),t.consumer=u,l?u.consume(l,c):this.reciver=()=>{u.consumeAll(c)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=h,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:n,interval:s,offset:r,length:i,useOneElement:o}=e,u=new a.b(r>0?t.buffer:t,void 0,void 0,!!o,r,i,r>0?t:null);this.sab.sender={sabqueue:u,interval:s,useCopy:n,offset:r}}if(null!=t&&t.sab){var n;let{sab:e,useCopy:s,interval:r,offset:i,length:o,useOneElement:u}=t,c=new a.b(i>0?e.buffer:e,void 0,void 0,!!u,i,o,i>0?e:null),{consumer:l}=(null===(n=this.sab)||void 0===n?void 0:n.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:c,interval:r,useCopy:s,offset:i}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class _{constructor(e){this.onmessage=h,this.onopen=h,this.onclose=h,this.connect_type=e.connect_type||_.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=u.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=_.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==c.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=_.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==c.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}r()(_,"UDP",0),r()(_,"TCP",1),r()(_,"RLB_UDP",2),r()(_,"dataTransportMgr",null);class p{constructor(e){this.sock=null,this.onmessage=h}isReady(){return!1}send(){h()}setStatus(e){0}}function m(e,t,n,s){var r;null===(r=c.a.monitorlogfn)||void 0===r||r.call(c.a,e,"".concat(t,",").concat(n,",").concat(s))}},function(e,t,n){var s=n(34);e.exports=function(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.d(t,"p",(function(){return s})),n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return a})),n.d(t,"i",(function(){return o})),n.d(t,"j",(function(){return u})),n.d(t,"k",(function(){return c})),n.d(t,"q",(function(){return l})),n.d(t,"r",(function(){return h})),n.d(t,"s",(function(){return d})),n.d(t,"l",(function(){return f})),n.d(t,"n",(function(){return _})),n.d(t,"e",(function(){return p})),n.d(t,"m",(function(){return m})),n.d(t,"o",(function(){return b})),n.d(t,"g",(function(){return E})),n.d(t,"h",(function(){return g})),n.d(t,"a",(function(){return A})),n.d(t,"f",(function(){return v}));const s=1,r=2,i=3,a=4,o=5,u=6,c=7,l=8,h=9,d=10,f=11,_=129,p=130,m=131,b=132,E=133,g=134,A=135,v=136},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return a}));var s=n(7),r=n.n(s);class i{constructor(){this.onmessage=()=>{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(n=>{n(e,t,1)}))}removeTransport(e){var t;let n=e.id;n in this.transportMap&&(delete this.transportMap[n],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let n=this.transportMap[t],s=n.target_thread==a.SELF_THREAD;if(n.type==e&&s)return n}return null}}r()(a,"NO_THREAD",0),r()(a,"SELF_THREAD",1)},function(e,t,n){"use strict";function s(){this.a=[],this.b=0,this.residue=null}s.prototype.getLength=function(){return this.a.length-this.b},s.prototype.isEmpty=function(){return 0==this.a.length},s.prototype.enqueue=function(e){this.a.push(e)},s.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},s.prototype.peek=function(){return 0{const e={};for(const t in r)e[r[t]]="WCL_"+t})(),{[r.AUDIO_ENCODE]:"audio.encode",[r.AUDIO_DECODE]:"audio.decode",[r.VIDEO_ENCODE]:"video.encode",[r.VIDEO_DECODE]:"video.decode",[r.SHARING_ENCODE]:"share.encode",[r.SHARING_DECODE]:"share.decode"})},function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return l}));var s=n(7),r=n.n(s),i=n(5),a=n(10),o=n(6),u=n(22);function c(e,t,n){if(!e)return;let s=o.a.dataTransportMgr;s.type===l.THREAD_MAIN?(s.setSabBuffer(e,t,n),e.remote.postMessage({cmd:i.gb,transportId:e.id,sender:n,reciver:t})):(e.setSabBuffer(t,n),s.mainThread.postMessage({cmd:i.gb,transportId:e.id,sender:n,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:n,data:s}=e.data,r=this.transportlists.find(e=>e.id===n);if(r||t==i.s)switch(t){case i.s:this.addRemoteTransport(e.data,null);break;case i.fb:r.setMsgPort(s||new a.a);break;case i.gb:r.setSabBuffer(e.data.sender,e.data.reciver);break;case i.o:r.remote=null,this.removeTransport(r)}}_onrecvsubthreadlistener(e,t){let{cmd:n,transportId:s,transportType:r}=t.data,a=this.transportlists.find(e=>e.id===s);switch(n){case i.s:this.addRemoteTransport(t.data,e);break;case i.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case i.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let n={cmd:i.s,transportType:e.type,transportId:e.id};e.portInfo?(n.port=e.portInfo,t.postMessage(n,[e.portInfo])):t.postMessage(n)}closeRemoteTransport(e,t){t.postMessage({cmd:i.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var n,s,r,a;(null!==(n=e.sabInfo)&&void 0!==n&&n.sender||null!==(s=e.sabInfo)&&void 0!==s&&s.reciver)&&t.postMessage({cmd:i.gb,transportId:e.id,sender:null===(r=e.sabInfo)||void 0===r?void 0:r.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:n,port:s,transportType:r}=e;let i=this.createMsgSocketTransport(r);i.id=n,i.remote=t,i.portInfo=s,s?i.setMsgPort(i.portInfo):this.bindMessageChannel(i),this.addTransport(i)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let n=t.target_thread||a.b.SELF_THREAD;e.target_thread=n,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:i.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,n){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),n&&(n.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:n},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,n))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof u.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof u.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let n=0;n{if(!e.transportlists.includes(t.type))return;let n=e.target_thread||a.b.SELF_THREAD;n==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=n&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=n,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let n=e.target_thread;if(n!=a.b.SELF_THREAD)this.createRemoteTransport(e,n),this.setRemoteTransportSABBUffer(e,n);else{var s,r,i,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(s=e.sabInfo)&&void 0!==s&&s.sender||null!==(r=e.sabInfo)&&void 0!==r&&r.reciver)e.setSabBuffer(null===(i=e.sabInfo)||void 0===i?void 0:i.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{n._report(),n._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let n="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,n)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,n){"use strict";n.d(t,"c",(function(){return s})),n.d(t,"f",(function(){return r})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"k",(function(){return o})),n.d(t,"g",(function(){return u})),n.d(t,"h",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"j",(function(){return h})),n.d(t,"i",(function(){return d})),n.d(t,"l",(function(){return f})),n.d(t,"d",(function(){return _}));const s=3,r=6,i=34,a=38,o=-51,u="SHARING_PARAM_INFO_FROM_SOCKET",c=121,l="AUDIO_QOS_DATA",h="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},_="EXPOSE_VB_FRAME"},function(e,t,n){"use strict";const s=e=>0==(e&e-1);let r=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let n=e;return t instanceof ErrorEvent?(t.filename&&(n+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(n+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(n+=" Message: ".concat(t.message)),t.error&&(n+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(n+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(n+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(n+=" Message: ".concat(t.message)),t.stack&&(n+=" Stack: ".concat(t.stack)),t.name&&(n+=" Name: ".concat(t.name)),t.constraint&&(n+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(n+=" Code: ".concat(t.code)),t.reason&&(n+=" Reason: ".concat(t.reason)),n+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(n+=" Message: ".concat(t.message)),t.name&&(n+=" Name: ".concat(t.name))):n+=t?t.toString():"",n}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const n=s(this._highFrequencyLogs[e]);this._instance&&n&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var n,s;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(n=(s=this._instance).directReport)||void 0===n||n.call(s,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=r},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return o}));var s=n(11),r=n(16);class i{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=r,this._BYTES_PER_ELEMENT=t,this.capacity=(i-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,r,1),this.read_ptr=new Uint32Array(this.buf,r+4,1),this.storageUint8sByteOffset=r+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,i-8),this.byteLength=i,this.label=n,this.usingOneElementBuffer=s,a&&(this.wasmMemory=a),s&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new s.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let i=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==i)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++i}if(i>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),i>=1e3&&(r.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),n&&n("vqslclear")),i>0&&n){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,n&&n("vqsl"+i))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let n=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+n),n+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=n;let s=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,s),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let n=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,n),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let n,s,r,i=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){n=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,i[0]):new Uint8Array(i[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n.byteLength);n.set(e,0)}else n=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+i[0]),s=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r=t*this._BYTES_PER_ELEMENT+8+4+i[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?n:{bCopyData:e,uint8s:n,begin:s,end:r}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof i))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=n,this.tick_lasted_time=0,this.timeoutMS=s,this.maxCount=r}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),n={};this.keysList.forEach((t,s)=>{n[t]=e[s]}),n[this.timeStampKey]=Number(t.getBigUint64(0,!0));let s,r=Number(t.getBigUint64(8,!0)),i=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,r);return s=(this.bCopyData,i),n.data=s,n}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,n=new Uint32Array(e.buffer,0,9),s=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{n[t]=this.obj[e]}),s.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),s.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},,,,,function(e,t,n){"use strict";var s=n(7),r=n.n(s),i=n(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new i.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,n,s){if(this._customer_callback){let r="".concat(e,",").concat(t,",").concat(n,",").concat(s);this._customer_callback(this._tag+"TimeOut",r)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),n="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),n=n.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",n)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(i.c.IsQosReport(e))return void this._cureen_qos_report++;if(i.c.IsVideoPkg(e)){let t=i.c.GetQOSTime(e),n=performance.now();if(this._lasted_qos_ts){let e=n-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,n)}this._lasted_qos_ts=t,this._lasted_sys_ts=n,this._lasted_data=e}}};var o=n(8),u=n(12),c=n(5);n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return h}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class h{constructor(e,t,n,s){this.id=e,this.type=t,this.datachannel=n,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=h.UNINIT,this.target_thread=s,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===h.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=h.DISCONNECT&&this._clear(),this._status=h.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==h.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var n;(this._status=h.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==u.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==u.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=h.CONNECTED)&&(null===(n=this.connectedFn)||void 0===n||n.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=h.DISCONNECT;let n=this.disconnectedFn;this._clear(),t!=h.DISCONNECT&&(null==n||n())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let n=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==n||n.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case c.A:this._onclose();break;case c.C:this._onopen();break;case c.B:this._onerror(t.ev);break;case c.H:this.report_monitor_func(t.tag,t.data)}}}r()(h,"UNINIT",0),r()(h,"CONNECTED",1),r()(h,"DISCONNECT",2)},function(e,t,n){"use strict";n.d(t,"d",(function(){return a})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"e",(function(){return l})),n.d(t,"a",(function(){return h}));var s=n(12),r=n(6),i=n(13);function a(e){return new r.a({sock:new r.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(r.a.dataTransportMgr)return;let n=new i.a({type:t?i.a.THREAD_SUB:i.a.THREAD_MAIN,remote:t?self:null});r.a.dataTransportMgr=n,n.monitorlogfn=e,t&&self.addEventListener("message",n._onrecvmainthreadlistener.bind(n))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function u(e){return r.a.dataTransportMgr.getTransportByType(e)}function c(e){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.removeDataChannel(e)}class h{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,n){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==s.a.VIDEO&&this.connectVideoSession(e),t==s.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==s.a.VIDEO&&this.connectVideoSession(e),t==s.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new r.c,n=u(r.e.VIDEO_ENCODE)||t,s=u(r.e.VIDEO_DECODE)||t,i=u(r.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?r.b.OPEN:r.b.CLOSED;n.setStatus(a),s.setStatus(a),this.isSupportVideoShare||i.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])n.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void i.send(t);s.send(t)}});const o=t=>{e.send(t)};n.onmessage=o,s.onmessage=o,i.onmessage=o}connectAudioSession(e){let t=new r.c,n=u(r.e.AUDIO_ENCODE)||t,s=u(r.e.AUDIO_DECODE)||t,i=e.isReady()?r.b.OPEN:r.b.CLOSED;n.setStatus(i),s.setStatus(i),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?n.send(t):s.send(t)});const a=t=>{e.send(t)};n.onmessage=a,s.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(7),r=n.n(s),i=n(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let n={id:e,worker:t},s=this._recvheartbeat.bind(this,n);n.listener=s,n.lastedtimestamp=Date.now(),n.worker.addEventListener("message",n.listener),this.monitorworkers[e]=n}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let n=t.data;n.cmd===i.Db&&(e.lastedtimestamp=n.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:i.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const n=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),s=Date.now(),r=this._lasted_timestamp;sr+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",s-r):t.forEach(t=>{var n;let r=e.monitorworkers[t],i=r.lastedtimestamp+(null!==(n=document)&&void 0!==n&&n.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);s>i&&(e.timeoutcallbackfn(r.id,s-r.lastedtimestamp),r.lastedtimestamp=s)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}r()(o,"INTREVAL_TIME_MS",3e3),r()(o,"HEART_TIMEOUT_MS",15e3),r()(o,"MAX_HEART_TIMEOUT_MS",3e4),r()(o,"instance",null)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));class s{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},,,function(e,t,n){"use strict";n(12);var s=n(7),r=n.n(s);const i=e=>btoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){r()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(i(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const n=this.textEncoder.encode(e);this.processList.push(n),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(i(t.buffer)),this.writeLog(this.EOL);const n=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(i(this.mergeBuffer(n).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let s=0;for(const t of e)n.set(t,s),s+=t.length;return n}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=n(3);n.d(t,"a",(function(){return l}));class u{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,n){if(t){var s=new Uint8Array(n?t+1:t),r=Object(o.d)().subarray(e+0,e+t);return s.set(r,0,t),n&&(s[t]=10),s}return e.data}writeWasmLog(e,t){const n=this.getTime(),s=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(n,s):(this.writeLog(n),this.writeLog(s),this.writeLog("\n"))}}class c extends u{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=n=>{"local_log_port"===n.data.command?this.port||(this.port=n.data.data):"local_log_ready"===n.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new c:null}},,,,,function(e,t,n){var s=n(24).default,r=n(35);e.exports=function(e){var t=r(e,"string");return"symbol"===s(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var s=n(24).default;e.exports=function(e,t){if("object"!==s(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var s=n(3),r=n(4),i=n(5),a=n(12),o=n(15),u=n(29);n(16);function c(e,t){let n=0,s=0;for(let r=0;rn&&(n=t)}return n=n>1?1:n,{sumRms:s/e.length/t,absMax:n}}const l={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},h={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let d,f,_,p,m,b,E,g,A,v,S=0,y=!0;var T=0;var w=!1;var M=null;var D=!1;var I={WASMTYPE:l,AUDIO_STATE:h,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");_=e.cwrap("_Heartbeat","number",["number"]),p=e.cwrap("_MuteUnmuteState","number",["number","number"]),m=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),b=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),E=e.cwrap("_Switch_Denoise","number",["number","number","number","number"]),g=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),A=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),v=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(e,t,n){d=e,t&&(S=t),n&&(f=n)},muteUnmuteState:function(e){if(null!=Object.values(h).find(t=>t==e))return d?void(S!=l.WORKLET_APM_ONLY&&(p(d,e),Object(s.o)("muteUnmuteState: "+e))):Object(s.o)("muteUnmuteState: -1")},switchOriginalSound:function(e,t,n,s){d&&m(d,e,t,n,s)},deliverRecordedData:function(e,t,n,s){d&&b(d,e,t,0,n,s)},switchDenoise:function(e,t){d&&(w=e,E(d,!!e,3,!!t))},audioInit:function(e,t,n,s,r,i,a,o,u,c){return g(e,t,n,s,r,i,a,o,u,c)},setDecoder:function(e){M=e},needCalculateDenoiseOutput:function(){D=!0},switchHighBitrate:function(e){d&&A(d,e)},disableJitterLog:function(){y=!1},setAllSpeechVolume:function(e){d&&v(d,e)},onMonitorLogWASM:function(e,t){if(t<=0)return;const n=Module.HEAPU8.subarray(e,e+t),r=String.fromCharCode.apply(null,n);r&&(!y&&r.includes("JITTER")||(S==l.ENCODE||S==l.DECODE?Object(s.n)(r):S==l.WORKLET?f&&f.port&&Object(s.n)(r,f.port):S==l.WORKLET_APM_ONLY&&f.port&&f.port.postMessage({status:"SPEECH_LOG",data:{log:r}})))},onMuteSpeechWarningWASM:function(){postMessage({status:o.h})},onAudioLevelWASM:function(e,t,n){var s;S!=l.ENCODE&&S!=l.WORKLET_APM_ONLY||1==e&&(0===t&&0===T||(T=t,S===l.ENCODE?postMessage({status:o.a,value:t}):null!==(s=f)&&void 0!==s&&s.port&&f.port.postMessage({status:o.a,data:t})))},onAPMProcessedPCMWASM:function(e,t,n,s){if(!w)return;let r=Module.HEAPF32.subarray(e/4,e/4+t);if(M){if(D){D=!1;let{sumRms:e}=c(r,2),t=function(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}(e);f.port&&f.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}M.push([r])}}};class C{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(e){return e===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==e||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=e,!0)}}class O{constructor(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(e),this.sabBuffer=new Float32Array(t),this.perFrameLength=n,this.writeChannelNumb=s,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%n==0,this.bufferIndex=null,this.supportSpecialOptimization){let e=this.bufferLen/n;this.bufferIndex=[];for(let t=0;tthis.CACHE_SIZE_MAX_VALUE&&(e=this.CACHE_SIZE_MAX_VALUE),e0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(e){if(void 0===e[0]||e[0].length*this.writeChannelNumb!==this.perFrameLength)return;let t=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),t?this.supportSpecialOptimization?this.writeSpecial(e):this.writeNormal(e):void 0}writeNormal(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let n=0;n=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=t,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let n=0;nthis.bufferLen){let n=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(n*this.perFrameLength+e)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,n*this.perFrameLength)}let n=null;if(this.bufferLen-e>=this.perFrameLength)n=this.sabBuffer.subarray(e,e+this.perFrameLength);else{let t=this.sabBuffer.subarray(e),s=this.sabBuffer.subarray(0,this.perFrameLength-t.length);n=this.placeBuffer,n.set(t),n.set(s,t.length)}return e+=this.perFrameLength,e>=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),n}readSpecial(){let e=this.sabState[this.STATE_READ_INDEX],t=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(tthis.bufferLen){let n=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(n+e)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,n*this.perFrameLength)}let n=this.bufferIndex[e];return e=(e+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),n}}var k=n(8),L=n(11),R=n(26),U=n(13),N=n(23),P=n(6),B=n(25);function H(e,t,n){mn&&mn.writeWasmLog(t,n,!0)}function x(e,t){self.fsHandler&&self.fsHandler.handleViperNetworkTrace(e,t)}n.d(t,"Get_ExternalRecord",(function(){return H})),n.d(t,"Viper_NetworkTrace",(function(){return x})),n.d(t,"Channel_Agent",(function(){return st})),n.d(t,"responseAudioQosData",(function(){return rt})),n.d(t,"network_quality_callback",(function(){return it})),n.d(t,"Open_Audio_WebSocket_Connect",(function(){return at})),n.d(t,"audio_websocket_on_open",(function(){return ct})),n.d(t,"audio_websocket_on_message",(function(){return gt})),n.d(t,"audio_websocket_on_close",(function(){return At})),n.d(t,"audio_websocket_on_error",(function(){return vt})),n.d(t,"frame_aec_callback",(function(){return St})),n.d(t,"frame_callback_SAB",(function(){return Mt})),n.d(t,"LOG_OUT_WEBRTC",(function(){return Dt})),n.d(t,"update_play_time",(function(){return It})),n.d(t,"calMilliSeconds",(function(){return Ct})),n.d(t,"frame_callback",(function(){return Ot})),n.d(t,"wcl_trace_log",(function(){return kt})),n.d(t,"media_data_transport_type_monitor",(function(){return Rt})),n.d(t,"audio_encode_frame_callback",(function(){return Ut})),n.d(t,"send_data_to_rwg",(function(){return Nt})),n.d(t,"sampleRateLog",(function(){return Pt})),n.d(t,"Get_Mixed_Audio_Interval",(function(){return sn})),n.d(t,"Get_Mixed_Audio_Interval_SAB",(function(){return rn})),n.d(t,"Encode_Audio_Data",(function(){return an})),n.d(t,"Encode_Audio_Data_SAB",(function(){return on})),n.d(t,"send_data",(function(){return un})),n.d(t,"LOG_OUT",(function(){return cn})),n.d(t,"put_aec_data",(function(){return ln})),n.d(t,"TURN_DOWN_VOLUME",(function(){return hn})),n.d(t,"SAVE_IV",(function(){return dn})),n.d(t,"getWasmMemory",(function(){return fn})),n.d(t,"freeWasmMemory",(function(){return _n})),n.d(t,"pump_rtp_data",(function(){return pn})),self.AudioWasmAdapter=I,self.wasmSuccessEvent=i.j,self.wasmFailEvent=i.i,self.downloadAndInstantiateWebAssembly=s.q,self.addEventListener("unhandledrejection",e=>{Object(s.u)("Unhandled rejection in audio worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)}),self.addEventListener("error",e=>{Object(s.u)("Unhandled exception in audio worker",e)});const F="undefined"!=typeof SharedArrayBuffer;var W,q,j,V,Y,z,G,Z,K,X,Q,J,$,ee,te;let ne;var se,re,ie,ae,oe,ue,ce,le,he,de,fe,_e,pe,me,be,Ee,ge,Ae=!1,ve=null,Se=null;self.onWasmModuleReady=()=>{W=Module.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),q=Module.cwrap("_Audio_UnInit","number",["number"]),j=Module.cwrap("_Audio_Try_Analysis","number",["number","number","array","number"]),V=Module.cwrap("_Get_Mixed_Audio","number",["number","number","number","number","number"]),Y=Module.cwrap("_Put_Pre_Aec_Data","number",["number","array","number","number","number","number"]),z=Module.cwrap("_Put_Pre_Aec_Data","number",["number","number","number","number","number","number"]),G=Module.cwrap("_Get_Aec_Delay","number",["number"]),Z=Module.cwrap("_ReSet_Aec","number",["number"]),K=Module.cwrap("_Audio_Set_Data_Encryption","number",["number","number"]),X=Module.cwrap("_Add_Cooker_info","number",["number","number","number","number"]),$=Module.cwrap("_Get_Audio_Meat_Weight","number",["number"]),Q=Module.cwrap("_Remove_Cooker_Info","number",["number","number"]),J=Module.cwrap("_Change_Aec_Flag","number",["number","boolean"]),ee=Module.cwrap("_Change_Connect_Type","number",["number","number"]),te=Module.cwrap("_Interpretation_Configure","number",["number","number","number","number"]),ne=Module.cwrap("_Request_Audio_Qos_Data","number",["number"]),se=Module._malloc(40),Module.HEAPU32.subarray(se/4,se/4+10),re=Module.cwrap("_Start_Audio_Share","number",["number","number","number"]),ie=Module.cwrap("_InsertShareData","number",["number","number","number","number","number","number"]),ue=Module.cwrap("_Set_Share_Volume_Level","number",["number","number","number"]),ce=Module.cwrap("_Set_Speech_Volume_Level","number",["number","number","number"]),le=Module.cwrap("_Cc_Set_Lang","number",["number","number"]),he=Module._malloc(4),Module.HEAPU32.subarray(he/4,he/4+1),de=Module.cwrap("_Set_Audio_Encryption_Key_Directly","number",["number","number","number","number"]),fe=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),_e=Module.cwrap("_Enable_Share_To_Bo","number",["number","boolean"]),pe=Module.cwrap("_Enable_Broadcast_To_Bo","number",["number","boolean"]),me=Module.cwrap("_Set_Audio_Pipe_To_Bo","number",["number","number"]),be=Module.cwrap("_Smooth_Send_For_Qos","number",["number"]),ge=Module.cwrap("_request_nack_t_periodically_for_qos","number",["number"]),Ke=Module.cwrap("_Enable_Pipe_OUT_RTP","number",["number","number"]),Qe=Module.cwrap("_setMultiViewFlag","number",["number","boolean"]),I.onWasmModuleReady(Module)};var ye,Te,we,Me,De,Ie,Ce,Oe=null,ke=null,Le=null,Re=null,Ue=null,Ne=!1,Pe=!1,Be=!1,He=!1,xe=null,Fe=!1,We=!1,qe=!1,je=0,Ve=!1,Ye=!0;self.isPreviewMode=!1;var ze=!1,Ge=null,Ze=!1,Ke=null,Xe=!1,Qe=null,Je=1,$e=1,et=1,tt=null;function nt(){return Jt==I.AUDIO_STATE.UNMUTE||ae}function st(){function e(e){let t=null,n=r.db,i=null,a=e.onmessage,o=e.onopen,u=e.onclose;e.onmessage=n=>{t=(new Date).getTime(),a.call(e,n)},e.onopen=s=>{t=(new Date).getTime(),function(){if(i)return;i=setInterval(()=>{var s;(new Date).getTime()-t>=1e3*n&&(clearInterval(i),i=null,null===(s=e.socket)||void 0===s||s.close())},1e3)}(),o.call(e,s,e)},e.onclose=t=>{try{clearInterval(i)}catch(e){Object(s.u)("WebSocket closed",e)}u.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,n,s,r,i){this.websocketaddress=t,this.onopen=n,this.onmessage=s,this.onerror=r,this.onclose=i,e(this)},this.connect=function(e,t,n,r,a){var o=this;Object(s.o)("SB"),o.init(e,t,n,r,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex++,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(s.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(s.o)("SERR"),o.socket.close()},o.socket.onclose=function(e){Object(s.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:i.k}),Object(s.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){1===this.socket.readyState&&this.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function rt(e,t,n,s,r,i,a){const u={sample_rate:e,rtt:t,jitter:n,avg_loss:s,max_loss:r,bandwidth:i,rate:a};postMessage({status:o.b,data:u})}function it(e,t,n){postMessage({status:i.P,isUplink:0===e,networkLevel:t,bwLevel:n})}function at(e,t,n,r,i,a){if(Object(s.o)("WSURL:".concat(isPreviewMode&&!a,":").concat(e)),!isPreviewMode||a){var o=new st;return o.connect(e,t,n,r,i),o}}let ot=null;async function ut(e,t){isPreviewMode&&!t||(ot=new s.l(e),await ot.connect())}function ct(){let e;for(ze=!0;Ge&&(e=Ge.dequeue());)Nt(e.data,e.data.length,e.c,!0);postMessage({status:i.l})}function lt(){let e=Be||He;if(Oe&&e!=We){let t=e?1:0,n=Be?1:0,r=He?1:0;Object(s.o)("AQOS-S-"+t+"-"+n+"-"+r),ee(Oe,e?0:2)}We=e}function ht(e){let{url:t}=e.params;xe=e,He=!0,t.includes("mode=2")&<(),postMessage({status:i.r})}function dt(e){let{url:t}=e.params;He=!1,xe=null,t.includes("mode=2")&<(),postMessage({status:i.q})}let ft=new Map;self.seqMap=ft,self.seqList=[];class _t{constructor(){this.channel=null,this.audioHandle=null}open(e){const{wsUrl:t}=e;this.channel=at(t,this._onOpen.bind(this),this._onMessage.bind(this),this._onError.bind(this),this._onClose.bind(this))}createHandle(e){let{userId:t,meetingNumber:n,meetingId:s}=e;this.audioHandle=W(t,n,s,0,0,Ye,!1,!0,1)}enableBOPipeOutRtp(){Ke(this.audioHandle,1)}pipeTo(e){e&&this.audioHandle?me(this.audioHandle,e):console.warn(new Error("audio handle not ready when pipe audio to bo"))}_onOpen(e){}_onError(e){}_onClose(e){}_onMessage(e){if(!e||!e.data)return;let t=new Uint8Array(e.data);0!==t.length&&(t[0]===r.v?this.channel&&1===this.channel.socket.readyState&&this.channel.send(t):t[0]!==r.M&&this.decode(t))}close(){this.channel.close(),this.channel=null}setAudioEncryptionKey(e,t){const n=fn(e);de(this.audioHandle,n,e.length,t),_n(n)}updateRosterInfo(e){const{add:t,remove:n}=e;t&&t.forEach(e=>{const{sn:t,userid:n}=e,s=fn(t);fe(this.audioHandle,n,s,t.length),_n(s)})}decode(e){this.audioHandle&&e[0]!==r.q&&j(this.audioHandle,0,e,e.length)}isShareToBoAudio(e){return 0===e[2]&&0===e[3]&&![r.M,r.v,r.u,r.r].includes(e[0])}}var pt=new _t;function mt(e,t){pt.isShareToBoAudio(e)?pt.decode(e):Fe&&e[0]===r.q||(j(Oe,0,e,e.length),Rt())}function bt(e){null!==Oe&&mt(e)}const Et=(()=>{let e;return{updateKey:t=>{t&&(e=t),Oe&&e&&mt(e)}}})();function gt(e){let t=new Uint8Array(e.data);if(102==t[0]){if(Ae)return;Ae=!0,ve=new Uint8Array(t)}null!==Oe?mt(t):t[0]==r.M?Et.updateKey(t):t[0]==r.r&&(tt=t)}function At(e){ze=!1,postMessage({status:i.p})}function vt(e){}function St(e,t,n,s){var r=new Uint8Array(2*s),i=Module.HEAP8.subarray(e+0,e+2*s);r.set(i,0,2*s),ln({data:r,channels:n,sampleHZ:t})}let yt=null,Tt=null;var wt=function(e,t){this._BYTES_PER_ELEMENT=t,this.capacity=(e.byteLength-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,0,1),this.read_ptr=new Uint32Array(this.buf,4,1),this.storageUint8s=new Uint8Array(this.buf,8,e.byteLength-8),this.cache_buffer=[]};function Mt(e,t,n,s,r,i,a,o){Tt===e&&yt.length==t*a||(yt=Module.HEAPF32.subarray(e/4,e/4+t*a),Tt=e),Gt.write([yt])}function Dt(e,t,n,s){self.fsHandler&&self.fsHandler.handleFile(e,t,n,s)}function It(e,t){if(!t)return;var n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s);let r,a=new Uint32Array(n.buffer),o=null,u=null,c=0,l=0;for(let e=0;e>10==en>>10&&(r=t,u=a.subarray(4*e,4*e+4),c=Ct(u))}(c||l)&&(Ht?Ht.postMessage({status:2,data:c,sdata:l,ssrc:r}):postMessage({status:i.z,at:c,st:l}))}function Ct(e){let t=e[1];return 4294967296*e[2]+t}function Ot(e,t,n,s,r,i,a,o){if(F&&zt)return Mt(e,t,0,0,0,0,a);var u=Module.HEAP8.subarray(e+0,e+4*t*a),c=new Uint8Array(4*t*a);c.set(u,0,4*t*a);var l=new Float32Array(c.buffer);if(Wt&&Jt===I.AUDIO_STATE.UNMUTE){var h=new Uint8Array(4*t*a);h.set(u,0,4*t*a);var d=new Float32Array(h.buffer),f={status:0,data:d},_=[d.buffer];Wt.postMessage(f,_)}let p,m;p={status:0,data:l,channels:a,sampleHz:i},m=[p.data.buffer],Bt&&Bt.postMessage(p,m)}function kt(e,t){mn&&mn.writeWasmLog(e,t,!0)}wt.prototype.clear=function(){this.write_ptr&&Atomics.store(this.write_ptr,0,0),this.read_ptr&&Atomics.store(this.read_ptr,0,0),this.cache_buffer=[]},wt.prototype.enqueueMergeData=function(e,t){for(;this.cache_buffer.length>0&&this.available_write()>0;){let e=this.cache_buffer.shift();this.push(e)}if(e&&t){if(this.cache_buffer.length>0){let n=new Uint8Array(e.length+t.length);n.set(e,0,e.length),n.set(t,e.length,t.length),this.cache_buffer.push(n)}else if(this.available_write()>0)this.pushMergeData(e,t);else{let n=new Uint8Array(e.length+t.length);n.set(e,0,e.length),n.set(t,e.length,t.length),this.cache_buffer.push(n)}this.cache_buffer.length>255&&(this.cache_buffer=[])}},wt.prototype.pushMergeData=function(e,t){let n=Atomics.load(this.write_ptr,0);try{this.storageUint8s.set(e,n*this._BYTES_PER_ELEMENT+4,e.byteLength),this.storageUint8s.set(t,n*this._BYTES_PER_ELEMENT+4+e.byteLength,t.byteLength),new Uint32Array(this.buf,n*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength+t.byteLength;let s=(n+1)%this.capacity;Atomics.store(this.write_ptr,0,s)}catch(e){throw Object(s.u)("Error in Producer.pushMergeData: ".concat(n," ").concat(this.buf),e),e}},wt.prototype.enqueue=function(e){for(;this.cache_buffer.length>0&&this.available_write()>0;){let e=this.cache_buffer.shift();this.push(e)}if(e){if(this.cache_buffer.length>0){let t=new Uint8Array(e.length);t.set(e,0,e.length),this.cache_buffer.push(t)}else if(this.available_write()>0)this.push(e);else{let t=new Uint8Array(e.length);t.set(e,0,e.length),this.cache_buffer.push(t)}this.cache_buffer.length>255&&(this.cache_buffer=[])}},wt.prototype.push=function(e){let t=Atomics.load(this.write_ptr,0);try{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+4,e.byteLength),new Uint32Array(this.buf,t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let n=(t+1)%this.capacity;Atomics.store(this.write_ptr,0,n)}catch(e){throw Object(s.u)("Error in Producer.push: ".concat(t," ").concat(this.buf),e),e}},wt.prototype.available_write=function(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)},wt.prototype._available_write=function(e,t){return this.usableCapacity-this._available_read(e,t)},wt.prototype._available_read=function(e,t){return(t+this.capacity-e)%this.capacity};var Lt=0;function Rt(){He&&1!==Lt?(Lt=1,postMessage({status:i.y,type:Lt})):Be&&!He&&2!==Lt?(Lt=2,postMessage({status:i.y,type:Lt})):Be||He||3===Lt||(Lt=3,postMessage({status:i.y,type:Lt}))}function Ut(e,t,n,s){Nt(e,t,n,!1,s!=Oe&&Oe)}function Nt(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];var o;if(i)o=e;else if(ze)o=Module.HEAP8.subarray(e+0,e+t);else{o=new Uint8Array(t);var u=Module.HEAP8.subarray(e+0,e+t);o.set(u,0,t)}if(Se&&o[0]===r.s&&Se.setRtpPackets(),a&&(o[2]=128),!ze)return Ge||(Ge=new L.a),void Ge.enqueue({data:o,c:n});if(n&&(nt()||!qe)&&He&&xe)return Rt(),void xe.send(o);if(!n||!nt()&&qe||!Be)null===ke||!ke.socket||1!==ke.socket.readyState||(!nt()||We)&&n&&qe||(Rt(),ke.send(o),o.length<12&&Object(s.u)("Audio encode data length is too short"));else if(Rt(),i)Tn.send(o);else{new Uint8Array(t).set(o,0,t),Tn.sendWasmData(o)}}function Pt(){}var Bt,Ht,xt,Ft,Wt,qt,jt,Vt,Yt=null,zt=null,Gt=null,Zt=null,Kt=null,Xt=null,Qt=null,Jt=-1,$t=0,en=0,tn=0,nn=!1;function sn(){if(Oe)return F&&zt?rn():void(Bt&&V(Oe,Le/100,0,Le,$e))}function rn(){var e;if(null===(e=Tn)||void 0===e||e.sock.reciver(),Gt&&Gt.isReady())for(;Gt.isNeedMoreData();)V(Oe,Le/100,0,Le,$e)}function an(e){if(F&&zt)return on();xt&&e&&(isPreviewMode||(Module.HEAPF32.subarray(qt/4,qt/4+Le/100*Je).set(e),I.deliverRecordedData(qt,Le/100,Le,Je)))}function on(e){if(Zt){let e=null;for(;null!==(e=Zt.read());)isPreviewMode||(Module.HEAPF32.subarray(qt/4,qt/4+Le/100*Je).set(e),I.deliverRecordedData(qt,Le/100,Le,Je))}if(Qt){let e=null;for(;null!=(e=Qt.read());)isPreviewMode||(Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e).set(e),z(Oe,jt,Le,$e,Le/100,1))}if(Xt&&ae){let e=null;for(;null!==(e=Xt.read());)Module.HEAPF32.subarray(Vt/4,Vt/4+oe/100*et).set(e),ie(Oe,Vt,oe,et,oe/100,0)}}function un(e,t){var n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s,0,t),ke&&1===ke.socket.readyState&&ke.send(n)}function cn(e,t){mn&&mn.writeWasmLog(e,t)}function ln(e){if(-1!=Jt&&2!=Jt&&zt&&Yt&&null!=e&&!(e.data.length>960)){var t=new Uint16Array(zt);if(Yt.lock(),t[2]<30){for(var n=3,s=t[2];s>0;)s--,n+=t[n+1],n+=2;if(e){var r=new Uint16Array(e.data.buffer);t[2]++,t[n]=e.sampleHZ,t[n+1]=r.length,n+=2,t.set(r,n)}}else console.log("too many data in sharebuffer!"),t[2]=0;Yt.unlock()}}function hn(){postMessage({status:i.c})}function dn(e,t){ye||(ye=setInterval((function(){Oe&&$(Oe)}),6e4));let n=new Uint8Array(t),s=Module.HEAP8.subarray(e+0,e+t);n.set(s,0,t),(Me=new Uint8Array(n.length)).set(n,0),postMessage({status:i.a,data:n},[n.buffer])}function fn(e){if(!e)return 0;let t=Module._malloc(e.length);return Module.HEAPU8.subarray(t,t+e.length).set(e,0,e.length),t}function _n(e){e&&Module._free(e)}function pn(e,t,n,s){let r=null,i=null;e&&t&&(r=Module.HEAPU8.subarray(e,e+t)),n&&s&&(i=Module.HEAPU8.subarray(n,n+s)),Kt&&(r&&i?Xe||Kt.enqueueMergeData(r,i):i&&Kt.enqueue(i))}var mn=Object(u.a)();let bn;var En=0;function gn(){return!An}self.addEventListener("message",(function(e){var t,n=e.data;switch(n.command){case k.p:try{if(Object(s.o)("STARTMEDIA:".concat(function(e){let t=e.userid,n=e.isPreviewMode?1:0;return n|=gn()?2:0,"".concat(t,":").concat(n)}(n))),isPreviewMode=!!n.isPreviewMode,function(e){let t=e._id;En=t;let n=Je;e.audioEncodeChannelsNum&&(n=e.audioEncodeChannelsNum);let s=$e;e.audioDecodeChannelsNum&&(s=e.audioDecodeChannelsNum);let r=e.sampleRate;F&&!e.shouldNotChangeSampleRate&&(r=48e3),Ce=e.meetingid,Ie=e.meetingnumb+"",Ve=!0,Te=e.userid;let a=r/100;qt&&r==Le&&Je==n||(Je=n,_n(qt),qt=Module._malloc(4*a*Je),Module.HEAPF32.subarray(qt/4,qt/4+a*Je)),jt&&r==Le&&$e==s||($e=s,_n(jt),jt=Module._malloc(4*a*$e),Module.HEAPF32.subarray(jt/4,jt/4+a*$e)),Le=r,(qe=!!e.encode)?(De=!0,Ue=!0,Se=new R.a(i.e)):Re=!0,Ze=!!e.decoderInWorklet}(n),function(e){Sn||(mn&&mn.init({workerType:e.encode?a.b.AUDIO_ENCODE:a.b.AUDIO_DECODE}),Sn=!0)}(n),isPreviewMode){!function(e){postMessage({status:i.n}),postMessage({status:i.h}),yn(e)}(n);break}gn()||(An=!1,Object(s.o)("RSTHOLD")),yn(n),qe||(Object(s.o)("HB"),vn(n.userid,0,0)),postMessage({status:qe||Oe?i.h:i.g})}catch(e){postMessage({status:i.g}),Object(s.u)("Error in startMedia",e)}break;case k.i:ke&&(ke.close(),ke=null),ke=at(n.websocket_ip_address,ct,gt,vt,At,!0);break;case k.c:ke&&(ke.close(),ke=null);break;case k.j:{let e=n._id;ot&&(ot.forceClose(),ot=null);let t=1;n.webtransportURL.includes("mode=2")&&(t=0),ut({url:n.webtransportURL,label:"audio",id:e,onmessage:bt,onopen:ht,onclose:dt,groupSize:t},!0);break}case k.d:{let e=n._id;ot&&ot.id==e&&(ot.forceClose(),ot=null);break}case"EncodedAudioFrame":ke&&1===ke.socket.readyState&&ke.send(n.data);break;case k.b:{let e=n._id;if(e4e3&&Oe){var o=G(Oe);console.log("Store Delay: "+o),o>0&&postMessage({status:i.d,delay:o})}Re=null,Ue=null,Ee&&(clearInterval(Ee),Ee=null),Oe=null,qt&&Module._free(qt),qt=void 0,null,jt&&Module._free(jt),jt=void 0,null,ke=null,Module.HEAP8.fill(0),calledRun=void 0,ABORT=!1,dependenciesFulfilled=function e(){calledRun||run(),calledRun||(dependenciesFulfilled=e)},Ae=!1,ve=null,we=void 0,self.isPreviewMode=!1,Me=void 0,ze=!1,Ge=null,We=!1,He=!1,Be=!1,xe&&(xe.forceClose(),xe=null),yt=null,Tt=null,Gt=null,Zt=null,Kt=null,Xt=null,zt=null,Ht&&Ht.close(),xt&&xt.close(),tn=0,Jt=-1,Xe=!1,Ne=!1,Pe=!1,ye&&(clearInterval(ye),ye=null),en=0,Lt=0,$t=0,0,Yt=null,Fe=!1,ae=!1,pt=new _t,function(){try{let e=Tn;Tn=null,Be=!1,wn={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}();break;case"delay":0;break;case"failover":ke&&(ke.close(),ke=at(n.websocket_ip_address,ct,gt,vt,At));break;case"sharedBuffer":if(F){const e=n.data;(zt=e)&&(qe?((Zt=new O(zt.inputState,zt.inputBuffer,Le/100*Je)).clear(),zt.echoState&&zt.echoBuffer&&(Qt=new O(zt.echoState,zt.echoBuffer,Le/100*$e)).clear()):(Gt=new O(zt.outputState,zt.outputBuffer,Le/100*$e),Kt=new wt(zt.rtpBuffer,1200),Gt.clear(),Kt.clear()),$t=21)}break;case"modifySampleRate":if(Le===n.sampleRate)break;qt&&Module._free(qt),qt=Module._malloc(4*n.sampleRate/100*Je),Module.HEAPF32.subarray(qt/4,qt/4+n.sampleRate/100*Je),jt&&Module._free(jt),jt=Module._malloc(4*n.sampleRate/100*$e),Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e),Le=n.sampleRate,zt&&(qe?((Zt=new O(zt.inputState,zt.inputBuffer,Le/100*Je)).clear(),zt.echoState&&zt.echoBuffer&&(Qt=new O(zt.echoState,zt.echoBuffer,Le/100*$e)).clear()):(Gt=new O(zt.outputState,zt.outputBuffer,Le/100*$e)).clear());break;case"mute":var u,c;n.sharing||(Jt=n.bOn,I.muteUnmuteState(Jt),nn&&(Jt===I.AUDIO_STATE.UNMUTE?null===(u=Se)||void 0===u||u.startCheck():null===(c=Se)||void 0===c||c.stopCheck())),Jt!=I.AUDIO_STATE.UNMUTE&&!n.sharing||Ne?Jt==I.AUDIO_STATE.LEAVED?(Bt&&!n.fakeLeave&&(Bt.close(),Bt=null),Re&&(Gt&&Gt.clear(),Kt&&Kt.clear()),Ue&&(Zt&&Zt.clear(),clearInterval(ye),ye=null),ae||(Ee&&(clearInterval(Ee),Ee=0),Ne=!1)):Jt===I.AUDIO_STATE.MUTE&&Zt&&Zt.clear():(Ne=!0,Re&&(Gt&&(Gt.clear(),Gt.setWriteReady()),Kt&&Kt.clear()),Ue&&(Oe&&!De&&$(Oe),De=!1,Zt&&Zt.clear()));break;case"audio_denoise_switch":I.switchDenoise(n.switch?1:0,n.isHeadSet);break;case"original_sound_switch":I.switchOriginalSound(n.enable,n.highfidelity,!1,n.stereo);break;case"resetAec":Oe&&Z(Oe),$t=0,F&&zt&&($t=21);break;case"decodeAudioPort":Bt&&Bt.close(),(Bt=e.ports[0]).onmessage=function(e){const{status:t,cacheSize:n,isSAB:i}=e.data;switch(t){case"delay":0;break;case r.h:sn();break;case r.f:Object(s.o)("".concat(i?"ACSS":"ACS").concat(n||""));break;case"workletMessage":"error"===e.data.data.level&&Object(s.u)("Error from Audio Worklet"+e.data.data.message,e.data.data.data)}};break;case"encodeAudioPort":xt&&xt.close(),(xt=e.ports[0]).onmessage=function(e){if(Oe||isPreviewMode)switch(e.data.command){case r.g:Oe&&an(e.data.buffer)}};break;case"shareAudioDecodeAudioPort2":Ft&&Ft.close(),(Ft=e.ports[0]).onmessage=function(e){if(Oe||isPreviewMode)switch(e.data.command){case r.g:Oe&&an(e.data.buffer)}};break;case"audioWorkerPort":Wt&&(Wt.close(),Wt=null),(Wt=e.ports[0]).onmessage=function(e){switch(e.data.status){case 0:Oe&&Jt===I.AUDIO_STATE.UNMUTE&&Y&&(Module.HEAPF32.subarray(jt/4,jt/4+Le/100*$e).set(e.data.data),z(Oe,jt,Le,$e,Le/100,1))}};break;case"updateCurrentSSRC":en=n.SSRC;break;case"ENCRYPT":Pe=n.encrypt,Oe&&K(Oe,Pe?1:0);break;case"SOCKET_RECONNECT":self.IS_DISABLE_SOCKET_RECONNECT=!0===n.disable;break;case k.n:{let e=n.data.userNodeList;e&&e.forEach(e=>{let t=parseInt(e.userid);if(e.bremove)return void(Oe&&Q(Oe,t));let n=e.sn;if(16!=n.length&&32!=n.length)return;let s=fn(n);if(Oe){let e=!1;qe&&Te!=t||(e=!0),e&&X(Oe,t,s,n.length)}qe&&Te==t&&(we=n),_n(s)});break}case"decodeAudioPort2":Ht&&Ht.close(),Ht=e.ports[0];break;case"startAudioEncode":if(Ve&&n.ssid&&!isPreviewMode){Object(s.o)("HB"),Ve=!1;let e,t=Me;e=t?t.length:0;let r=0;if(r=fn(t),(Oe=W(n.ssid,Ie,Ce,r,e,Ye,qe,!0,1))?I.setAudioInstanceAndType(Oe,I.WASMTYPE.ENCODE):Object(s.u)("audio_handle not exist when encoding"),Oe&&tt&&mt(tt),I.muteUnmuteState(Jt),Oe&&ee(Oe,Be||He?0:2),_n(r),ve&&j(Oe,0,ve,ve.length),we){let e=fn(we);X(Oe,Te,e,we.length),_n(e)}}if(!Oe)return Object(s.u)("Error when init audio encode handle, start_handle_init: "+Ve+"ssrc: "+n.ssid+", isPreview:"+isPreviewMode),void postMessage({status:i.m});Ee||(Ee=setInterval(()=>{Oe&&be(Oe)},10)),n.isSharing?(ae=!0,et=n.sharingEncodeChannelsNum,oe=n.samplerate,Vt=Module._malloc(4*oe/100*et),Module.HEAPF32.subarray(Vt/4,Vt/4+oe/100*et),zt&&(Xt=new O(zt.sharingInputState,zt.sharingInputBuffer,oe/100*et)).clear(),re(Oe,ae,2==et)):Zt&&Zt.clear();break;case"AecFlag":Ye=n.flag,Oe&&J(Oe,Ye);break;case"audioDecodeSAB":{let e=n.data.buffer,t=n.data.offset,s=n.data.length;wn.reciver={sab:e,offset:t,length:s,interval:0,useCopy:!1,useOneElement:!1},Object(U.b)(Tn,null,wn.reciver);break}case"audioEncodeSAB":{let e=n.data.buffer,t=n.data.offset,s=n.data.length,r=n.data.bAudioEncodeMainThreadConsumerIntervalEnable;wn.sender={sab:e,offset:t,length:s,interval:r?10:0,useCopy:!1,useOneElement:!1,disableAuto:!0},Object(U.b)(Tn,wn.sender,null);break}case"PAUSE_OR_RESUME_AUDIO_DECODE":{let{bPause:e}=n.data;Fe=e;break}case"cc_set_lang":Module.HEAPU32.subarray(he/4,he/4+1)[0]=n.lang,Oe&&le(Oe,he);break;case"interpretation_enable":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.enable?1:0,Oe&&te(Oe,r.k,se,1);break;case"interpretation_set_lang":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.lang,Oe&&te(Oe,r.n,se,1);break;case"interpretation_mute_origin":Module.HEAPU32.subarray(se/4,se/4+10)[0]=n.mute?1:0,Oe&&te(Oe,r.l,se,1);break;case"interpretation_set_interpreter":{let e=Module.HEAPU32.subarray(se/4,se/4+10),t=se;n.interpreterList.length>=10&&(Object(s.u)("Interpreter list is larger than ".concat(9)),t=Module._malloc(4*n.interpreterList.length),e=Module.HEAPU32.subarray(t/4,t/4+n.interpreterList.length));for(let t=0;t=10&&Module._free(t);break}case"changeAudioShare":if(!Oe)return;ae=n.isStart,re(Oe,ae,!1),ae||Jt!=I.AUDIO_STATE.LEAVED||(Ee&&(clearInterval(Ee),Ee=0),Ne=!1,Xt&&Xt.clear());break;case k.l:{const e=()=>{Oe&&ne(Oe)};bn&&clearInterval(bn),n.data.enable&&(bn=setInterval(e,n.data.pollingInterval||r.y));break}case"setShareVolumeLevel":if(!Oe)return;ue(n.isFromMainSession?pt.audioHandle:Oe,n.userid,n.shareVolume);break;case"setSpeechVolumeLevel":if(!Oe)return;ce(Oe,n.userid,n.volume);break;case"BUILD_MA_CHANNEL_IN_BO":pt.open({wsUrl:n.data});break;case k.r:{let e=n.data;if(e.isFromMainSession){const{encryptKey:t,encryptType:n,userId:s,meetingNumber:r,confId:i}=e.updateParams;pt.createHandle({userId:s,meetingNumber:r+"",meetingId:i}),Oe&&pt.pipeTo(Oe),pt.setAudioEncryptionKey(t,n),Ze&&(I.disableJitterLog(),pt.enableBOPipeOutRtp())}break}case k.s:{let e=n.data;e.isFromMainSession&&pt.updateRosterInfo(e.body);break}case"ENABLE_SHARE_TO_BO":if(!Oe)return;_e(Oe,n.data);break;case"ENABLE_BROADCAST_TO_BO":if(!Oe)return;pe(Oe,n.data);break;case"stop_audio_incoming":Kt&&Kt.clear(),Xe=n.stopPlayAudio;break;case"highBitrate":Oe&&I.switchHighBitrate(n.highBitrate);break;case"RIWM":createWasm(),_free=Module._free=function(){return(_free=Module._free=Module.asm.free).apply(null,arguments)},___wasm_call_ctors=Module.___wasm_call_ctors=function(){return(___wasm_call_ctors=Module.___wasm_call_ctors=Module.asm.__wasm_call_ctors).apply(null,arguments)},stackSave=Module.stackSave=function(){return(stackSave=Module.stackSave=Module.asm.stackSave).apply(null,arguments)},stackRestore=Module.stackRestore=function(){return(stackRestore=Module.stackRestore=Module.asm.stackRestore).apply(null,arguments)},stackAlloc=Module.stackAlloc=function(){return(stackAlloc=Module.stackAlloc=Module.asm.stackAlloc).apply(null,arguments)},Module.zoomf={},run();break;case k.e:{let e=n.data||{},r=!!e.hold;Object(s.o)("HOLD:".concat(r,":").concat(e.userid,":").concat(e.reinit)),r?function(e){if(An)return;if(Te&&e.userid&&e.userid>>10!=Te>>10)return void Object(s.o)("HOLDINVALID");if(An=!0,null==Oe)return;let t=Oe;Oe=null,I.setAudioInstanceAndType(Oe,qe?I.WASMTYPE.ENCODE:I.WASMTYPE.DECODE),q(t)}(e):(t=e,An&&(An=!1,Ve=!0,t.reinit&&(Te=t.userid,qe||vn(Te,0,0),postMessage({status:qe||Oe?i.h:i.g}))));break}case k.m:I.setAllSpeechVolume(n.volume);break;case k.o:var l,h,d;(nn=n.value)?Jt===I.AUDIO_STATE.UNMUTE?null===(l=Se)||void 0===l||l.startCheck():null===(h=Se)||void 0===h||h.stopCheck():null===(d=Se)||void 0===d||d.stopCheck()}}));var An=!1;function vn(e,t,n){Oe&&je==e?Object(s.o)("AHNN"):(Oe&&(q(Oe),Oe=null,console.error("<<<<< pre audiouserid ".concat(je," now ").concat(e))),Oe=W(e,Ie,Ce,t,n,Ye,qe,!0,1),je=e,Oe&&!isPreviewMode?I.setAudioInstanceAndType(Oe,I.WASMTYPE.DECODE):Oe||Object(s.u)("audio_handle not exist when decoding"),Et.updateKey(),Ze&&(I.disableJitterLog(),Ke(Oe,1)),Qe(Oe,!1))}var Sn=!1;function yn(e){if(ot&&ot.id!=En&&(ot.forceClose(),ot=null),e.webtransportURL&&!ot){let t=1;e.webtransportURL.includes("mode=2")&&(t=0),ut({url:e.webtransportURL,label:"audio",id:En,onmessage:bt,onopen:ht,onclose:dt,groupSize:t})}Object(s.j)(ke,e.websocket_ip_address)&&(ke&&(ke.close(),ke=null,Object(s.u)("audio websocket cid changed")),ke=at(e.websocket_ip_address,ct,gt,vt,At)),function(){if(Tn)return;(Tn=Object(N.d)(qe?P.e.AUDIO_ENCODE:P.e.AUDIO_DECODE)).onmessage=Mn,Tn.onopen=()=>{Be=!0,lt()},Tn.onclose=()=>{Be=!1,lt()},(wn.sender||wn.reciver)&&Object(U.b)(Tn,wn.sender,wn.reciver)}()}var Tn=null,wn={};function Mn(e,t){Oe&&(qe||tn++%3!=0||ge(Oe),mt(new Uint8Array(e)))}Object(N.b)(),Object(B.a)(self)},,,,,,,function(e,t,n){"use strict";n.r(t);var s=n(47);Object.keys(s).forEach(e=>self[e]=s[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/js_audio_process.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1; +var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +} +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="audio.encode.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={1099708:$0=>{console.log("Audio Version: ",$0)},1099745:($0,$1)=>{send_data($0,$1)},1099768:($0,$1)=>{SAVE_IV($0,$1)},1099786:($0,$1,$2,$3)=>{audio_encode_frame_callback($0,$1,$2,$3)},1099835:($0,$1,$2)=>{Get_ExternalRecord($0,$1,$2)},1099871:()=>{return Date.now()},1099894:($0,$1)=>{update_play_time($0,$1)},1099924:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},1099971:($0,$1)=>{AudioWasmAdapter.onMonitorLogWASM($0,$1)},1100014:($0,$1)=>{AudioWasmAdapter.onAudioLevelWASM($0,$1)},1100057:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},1100097:($0,$1,$2,$3)=>{AudioWasmAdapter.onAPMProcessedPCMWASM($0,$1,$2,$3)},1100157:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1100192:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1100227:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseAudioQosData($0,$1,$2,$3,$4,$5,$6,$7)},1100282:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1100319:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1100356:($0,$1,$2,$3,$4,$5,$6,$7)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7)},1100408:($0,$1)=>{get_edition($0,$1)},1100433:($0,$1)=>{SAVE_IV($0,$1)},1100451:($0,$1)=>{COMMIT_PRINT($0,$1)},1100473:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100509:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100545:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100581:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100617:($0,$1)=>{LOG_OUT($0,$1)},1100638:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _shmat(){err("missing function: shmat");abort(-1)}function _shmctl(){err("missing function: shmctl");abort(-1)}function _shmdt(){err("missing function: shmdt");abort(-1)}function _shmget(){err("missing function: shmget");abort(-1)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident) { if (!Module["zoomf"]) { Module["zoomf"] = {} } if (!Module["zoomf"]["_" + ident]) { return (Module["zoomf"]["_" + ident] = function () { return (Module["_" + ident] = Module["asm"][ident]).apply(null, arguments) }) } else { return Module["zoomf"]["_" + ident] } }function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"shmat":_shmat,"shmctl":_shmctl,"shmdt":_shmdt,"shmget":_shmget,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Audio_Init=Module["__Audio_Init"]=function(){return(__Audio_Init=Module["__Audio_Init"]=Module["asm"]["_Audio_Init"]).apply(null,arguments)};var __Audio_UnInit=Module["__Audio_UnInit"]=function(){return(__Audio_UnInit=Module["__Audio_UnInit"]=Module["asm"]["_Audio_UnInit"]).apply(null,arguments)};var __Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=function(){return(__Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=Module["asm"]["_Deliver_Recorded_Data"]).apply(null,arguments)};var __Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=function(){return(__Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=Module["asm"]["_Audio_Try_Analysis"]).apply(null,arguments)};var __Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=function(){return(__Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=Module["asm"]["_Put_Pre_Aec_Data"]).apply(null,arguments)};var __Set_Aec_Delay=Module["__Set_Aec_Delay"]=function(){return(__Set_Aec_Delay=Module["__Set_Aec_Delay"]=Module["asm"]["_Set_Aec_Delay"]).apply(null,arguments)};var __ReSet_Aec=Module["__ReSet_Aec"]=function(){return(__ReSet_Aec=Module["__ReSet_Aec"]=Module["asm"]["_ReSet_Aec"]).apply(null,arguments)};var __Get_Aec_Delay=Module["__Get_Aec_Delay"]=function(){return(__Get_Aec_Delay=Module["__Get_Aec_Delay"]=Module["asm"]["_Get_Aec_Delay"]).apply(null,arguments)};var __Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=function(){return(__Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=Module["asm"]["_Request_Audio_Qos_Data"]).apply(null,arguments)};var __Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=function(){return(__Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=Module["asm"]["_Get_Mixed_Audio"]).apply(null,arguments)};var __Get_Audio_Edition=Module["__Get_Audio_Edition"]=function(){return(__Get_Audio_Edition=Module["__Get_Audio_Edition"]=Module["asm"]["_Get_Audio_Edition"]).apply(null,arguments)};var __Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=function(){return(__Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=Module["asm"]["_Audio_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Cooker_info=Module["__Add_Cooker_info"]=function(){return(__Add_Cooker_info=Module["__Add_Cooker_info"]=Module["asm"]["_Add_Cooker_info"]).apply(null,arguments)};var __Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=function(){return(__Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=Module["asm"]["_Remove_Cooker_Info"]).apply(null,arguments)};var __Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=function(){return(__Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=Module["asm"]["_Get_Audio_Meat_Weight"]).apply(null,arguments)};var __Change_Aec_Flag=Module["__Change_Aec_Flag"]=function(){return(__Change_Aec_Flag=Module["__Change_Aec_Flag"]=Module["asm"]["_Change_Aec_Flag"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Cc_Set_Lang=Module["__Cc_Set_Lang"]=function(){return(__Cc_Set_Lang=Module["__Cc_Set_Lang"]=Module["asm"]["_Cc_Set_Lang"]).apply(null,arguments)};var __Interpretation_Configure=Module["__Interpretation_Configure"]=function(){return(__Interpretation_Configure=Module["__Interpretation_Configure"]=Module["asm"]["_Interpretation_Configure"]).apply(null,arguments)};var __Start_Audio_Share=Module["__Start_Audio_Share"]=function(){return(__Start_Audio_Share=Module["__Start_Audio_Share"]=Module["asm"]["_Start_Audio_Share"]).apply(null,arguments)};var __InsertShareData=Module["__InsertShareData"]=function(){return(__InsertShareData=Module["__InsertShareData"]=Module["asm"]["_InsertShareData"]).apply(null,arguments)};var __Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=function(){return(__Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=Module["asm"]["_Set_Share_Volume_Level"]).apply(null,arguments)};var __Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=function(){return(__Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=Module["asm"]["_Set_Speech_Volume_Level"]).apply(null,arguments)};var __Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=function(){return(__Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=Module["asm"]["_Set_All_Speech_Volume_Level"]).apply(null,arguments)};var __Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=function(){return(__Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=Module["asm"]["_Update_Monitor_Send_Audio_Info"]).apply(null,arguments)};var __Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=function(){return(__Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=Module["asm"]["_Update_Monitor_Receive_Audio_Info"]).apply(null,arguments)};var __Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=function(){return(__Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=Module["asm"]["_Set_Audio_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=function(){return(__Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=Module["asm"]["_Enable_Share_To_Bo"]).apply(null,arguments)};var __Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=function(){return(__Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=Module["asm"]["_Enable_Broadcast_To_Bo"]).apply(null,arguments)};var __Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=function(){return(__Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=Module["asm"]["_Set_Audio_Pipe_To_Bo"]).apply(null,arguments)};var __Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=function(){return(__Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=Module["asm"]["_Enable_Pipe_OUT_RTP"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __setMultiViewFlag=Module["__setMultiViewFlag"]=function(){return(__setMultiViewFlag=Module["__setMultiViewFlag"]=Module["asm"]["_setMultiViewFlag"]).apply(null,arguments)};var __Switch_Denoise=Module["__Switch_Denoise"]=function(){return(__Switch_Denoise=Module["__Switch_Denoise"]=Module["asm"]["_Switch_Denoise"]).apply(null,arguments)};var __Switch_Original_Sound=Module["__Switch_Original_Sound"]=function(){return(__Switch_Original_Sound=Module["__Switch_Original_Sound"]=Module["asm"]["_Switch_Original_Sound"]).apply(null,arguments)};var __Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=function(){return(__Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=Module["asm"]["_Switch_High_Bitrate"]).apply(null,arguments)};var __Heartbeat=Module["__Heartbeat"]=function(){return(__Heartbeat=Module["__Heartbeat"]=Module["asm"]["_Heartbeat"]).apply(null,arguments)};var __MuteUnmuteState=Module["__MuteUnmuteState"]=function(){return(__MuteUnmuteState=Module["__MuteUnmuteState"]=Module["asm"]["_MuteUnmuteState"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiiji=Module["dynCall_iiiji"]=function(){return(dynCall_iiiji=Module["dynCall_iiiji"]=Module["asm"]["dynCall_iiiji"]).apply(null,arguments)};var dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=function(){return(dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=Module["asm"]["dynCall_iiiiiijiii"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet.min.js new file mode 100644 index 0000000..9a9a1cc --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet.min.js @@ -0,0 +1,2 @@ +!function(e){var t={};function s(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,r){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(r,i,function(t){return e[t]}.bind(null,i));return r},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=8)}([function(e,t,s){"use strict";s.d(t,"e",(function(){return r})),s.d(t,"i",(function(){return i})),s.d(t,"a",(function(){return a})),s.d(t,"d",(function(){return o})),s.d(t,"f",(function(){return n})),s.d(t,"c",(function(){return h})),s.d(t,"b",(function(){return u})),s.d(t,"g",(function(){return l})),s.d(t,"j",(function(){return c})),s.d(t,"h",(function(){return f}));const r=30,i=35,a=48,o=57,n=61,h=66.5,u=66.6,l=-26,c=-27,f=-28},function(e,t,s){"use strict";var r=s(0);s(3);new Error;new Map;var i=s(2);function a(e){postMessage({status:r.i,data:e})}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:r.a,data:e});postMessage({status:r.a,data:e})}new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const s=this.ssrcInfoMap.get(e);if(0===s.frames?s.firstTime=t:s.lastTime=t,s.frames+=1,s.frames>2&&s.frames%5==0&&s.lastTime-s.firstTime>=1e3){const t=Math.floor(1e3/((s.lastTime-s.firstTime)/(s.frames-1)));s.fps!==t&&(this._notifyFPS(e,t),s.fps=t),s.firstTime=s.lastTime,s.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,s)=>{const r=this.ssrcInfoMap.get(s);r&&e-r.lastTime>2e3&&(this.ssrcInfoMap.delete(s),this._notifyFPS(s,0))})}_notifyFPS(e,t){postMessage({status:r.b,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};var n=s(5);const h={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},u={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let l,c,f,d,b,_,p,m,A,g,S=0,E=!0;var T=0;var M=!1;var P=null;var C=!1;t.a={WASMTYPE:h,AUDIO_STATE:u,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");f=e.cwrap("_Heartbeat","number",["number"]),d=e.cwrap("_MuteUnmuteState","number",["number","number"]),b=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),_=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),p=e.cwrap("_Switch_Denoise","number",["number","number","number","number"]),m=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),A=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),g=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(e,t,s){l=e,t&&(S=t),s&&(c=s)},muteUnmuteState:function(e){if(null!=Object.values(u).find(t=>t==e))return l?void(S!=h.WORKLET_APM_ONLY&&(d(l,e),a("muteUnmuteState: "+e))):a("muteUnmuteState: -1")},switchOriginalSound:function(e,t,s,r){l&&b(l,e,t,s,r)},deliverRecordedData:function(e,t,s,r){l&&_(l,e,t,0,s,r)},switchDenoise:function(e,t){l&&(M=e,p(l,!!e,3,!!t))},audioInit:function(e,t,s,r,i,a,o,n,h,u){return m(e,t,s,r,i,a,o,n,h,u)},setDecoder:function(e){P=e},needCalculateDenoiseOutput:function(){C=!0},switchHighBitrate:function(e){l&&A(l,e)},disableJitterLog:function(){E=!1},setAllSpeechVolume:function(e){l&&g(l,e)},onMonitorLogWASM:function(e,t){if(t<=0)return;const s=Module.HEAPU8.subarray(e,e+t),r=String.fromCharCode.apply(null,s);r&&(!E&&r.includes("JITTER")||(S==h.ENCODE||S==h.DECODE?o(r):S==h.WORKLET?c&&c.port&&o(r,c.port):S==h.WORKLET_APM_ONLY&&c.port&&c.port.postMessage({status:"SPEECH_LOG",data:{log:r}})))},onMuteSpeechWarningWASM:function(){postMessage({status:i.b})},onAudioLevelWASM:function(e,t,s){var r;S!=h.ENCODE&&S!=h.WORKLET_APM_ONLY||1==e&&(0===t&&0===T||(T=t,S===h.ENCODE?postMessage({status:i.a,value:t}):null!==(r=c)&&void 0!==r&&r.port&&c.port.postMessage({status:i.a,data:t})))},onAPMProcessedPCMWASM:function(e,t,s,r){if(!M)return;let i=Module.HEAPF32.subarray(e/4,e/4+t);if(P){if(C){C=!1;let{sumRms:e}=Object(n.a)(i,2),t=Object(n.c)(e);c.port&&c.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}P.push([i])}}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r})),s.d(t,"c",(function(){return i})),s.d(t,"b",(function(){return a}));const r=38,i=-51,a=121},function(e,t,s){"use strict";const r=e=>0==(e&e-1);let i=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let s=e;return t instanceof ErrorEvent?(t.filename&&(s+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(s+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(s+=" Message: ".concat(t.message)),t.error&&(s+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(s+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(s+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(s+=" Message: ".concat(t.message)),t.stack&&(s+=" Stack: ".concat(t.stack)),t.name&&(s+=" Name: ".concat(t.name)),t.constraint&&(s+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(s+=" Code: ".concat(t.code)),t.reason&&(s+=" Reason: ".concat(t.reason)),s+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(s+=" Message: ".concat(t.message)),t.name&&(s+=" Name: ".concat(t.name))):s+=t?t.toString():"",s}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const s=r(this._highFrequencyLogs[e]);this._instance&&s&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var s,r;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(s=(r=this._instance).directReport)||void 0===s||s.call(r,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=i},function(e,t,s){"use strict";s.d(t,"b",(function(){return i})),s.d(t,"a",(function(){return a}));var r=s(6);class i{constructor(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(e),this.sabBuffer=new Float32Array(t),this.perFrameLength=s,this.writeChannelNumb=i,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%s==0,this.bufferIndex=null,this.supportSpecialOptimization){let e=this.bufferLen/s;this.bufferIndex=[];for(let t=0;tthis.CACHE_SIZE_MAX_VALUE&&(e=this.CACHE_SIZE_MAX_VALUE),e0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(e){if(void 0===e[0]||e[0].length*this.writeChannelNumb!==this.perFrameLength)return;let t=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),t?this.supportSpecialOptimization?this.writeSpecial(e):this.writeNormal(e):void 0}writeNormal(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;s=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=t,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;sthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s*this.perFrameLength+e)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=null;if(this.bufferLen-e>=this.perFrameLength)s=this.sabBuffer.subarray(e,e+this.perFrameLength);else{let t=this.sabBuffer.subarray(e),r=this.sabBuffer.subarray(0,this.perFrameLength-t.length);s=this.placeBuffer,s.set(t),s.set(r,t.length)}return e+=this.perFrameLength,e>=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}readSpecial(){let e=this.sabState[this.STATE_READ_INDEX],t=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(tthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s+e)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=this.bufferIndex[e];return e=(e+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}}class a{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=e,this.wframes=t,this.writeChannelNumb=s,this.cap=this.lcm(e,t),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(e,t){return 0===t?e:this.gcd(t,e%t)}lcm(e,t){return e/this.gcd(e,t)*t}push(e){if(null==e[0]||e[0].length*this.writeChannelNumb==this.wframes){for(let t=0;t=this.cap&&(this.woffset=this.woffset%this.cap)}else{var t;console.error("[Audio] critical error in AudioWorklet: data.length:",e.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(t=e[0])||void 0===t?void 0:t.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let e=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),e}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return i})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return o}));s(3);const r=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function i(e,t){let s=0,r=0;for(let i=0;is&&(s=t)}return s=s>1?1:s,{sumRms:r/e.length/t,absMax:s}}function a(e){if("number"!=typeof e||e<0||e>1)return-1;let t=parseInt(32768*e/1e3);return 0==t&&e>250&&(t=1),r[t]}function o(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(e){return e===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==e||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=e,!0)}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(e){this.messageQueue=[],this.auidoNodePort,this.userAgent="",this.isSafari=!1,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.print_=this.print_.bind(this),this.messageHeader=e}setUserAgent(e){this.userAgent=e,this.userAgent.match(/AppleWebKit\/(\d+)\./)&&(this.isSafari=!0)}setAuidoNodePort(e){this.auidoNodePort=e}debug(e){e=this.messageHeader+e;for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rthis.cacheMaxSize&&(this.cacheSize=this.cacheMaxSize),this.onCacheSizeChange&&this.isReady&&this.cacheSizeController.shouldSendCacheSize(this.cacheSize)&&this.onCacheSizeChange(this.cacheSize)}copyTo(e){if(0===this.buffList.length)return e.fill(0),void this.increaseCacheSize();let t=this.buffList[0];if(t.buff.length-t.offset>=e.length)this.copy(t.buff,t.offset,e,0),t.offset+=e.length,t.offset===t.buff.length&&(this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff));else{if(this.buffList.length<2)return e.fill(0),void this.increaseCacheSize();let s=this.copy(t.buff,t.offset,e,0);this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff),t=this.buffList[0],s=this.copy(t.buff,t.offset,e,s),t.offset+=s}}requestMoreData(){this.buffList.length=2}}class c{constructor(e){this.buffList=[],this.frameLength=e,this.onframedata=null}copy(e,t,s,r){if(e[0].length*C<=s.length-r){for(let t=0;t=e[0].length*C){let s=this.copy(e,0,t.buff,t.offset);t.offset+=s,t.buff.length===t.offset&&(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff))}else{let s=this.copy(e,0,t.buff,t.offset);if(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff),e[0].length*C>s){let t=[];for(let r=0;rr?1:0)));this.push(t)}}}}class f{constructor(e,t){this.context=t,this.decodePort=null,this.encodePort=null,this.captureSize=e/100*C,this.playBuffer=new l,this.playBuffer.onrollbackbuffer=e=>{this.decodePort},this.playBuffer.onneedmoredata=()=>{this.decodePort&&this.decodePort.postMessage({status:1})},this.playBuffer.onCacheSizeChange=e=>{this.decodePort&&this.decodePort.postMessage({status:3,cacheSize:e})},this.quantum=new Float32Array(128*D),this.captureBuffer=new c(this.captureSize),this.captureBuffer.onframedata=e=>{this.encodePort&&this.encodePort.postMessage({command:2,buffer:e},[e.buffer])}}setDecodePort(e){this.decodePort&&this.decodePort.close(),this.decodePort=e,this.decodePort.onmessage=this.handleDecodeData.bind(this)}setEncodePort(e){this.encodePort&&this.encodePort.close(),this.encodePort=e,this.encodePort.onmessage=this.handleEncodeData.bind(this)}handleDecodeData(e){this.context.isPlaying&&this.playBuffer.push(e.data.data)}handleEncodeData(e){switch(e.data.event){case 0:this.captureBuffer.rollbackbuffer(e.data.buffer)}}requestMoreData(){this.playBuffer.requestMoreData()}close(){this.decodePort&&(this.decodePort=null,this.decodePort.close()),this.encodePort&&(this.encodePort=null,this.encodePort.close())}write(e){this.captureBuffer.push(e)}read(){return this.playBuffer.copyTo(this.quantum),this.requestMoreData(),this.quantum}}let d="undefined"!=typeof SharedArrayBuffer,b=!0;var _=null,p=null,m=null,A=null,g=null;let S=0,E=0,T=0,M=0,P=!1,C=1,D=1,w=null;var y,L,R,N,I=10;let v=1500;var B=new Map;function O(e){if(e){var t=e.length/16,s=0,r=0;for(s=0;s>=10;var a=0;for(r=16*s+4;r<16*s+12;r++)a+=e[r]*Math.pow(256,r-16*s-4);B.set(i,a)}}}function k(e){e>>=10;var t=B.get(e);return t?(B.set(e,0),t):0}function U(e){let t=e[1];return 4294967296*e[2]+t}globalThis.update_play_time=function(e,t){if(t){var s=new Uint8Array(t),r=Module.HEAP8.subarray(e+0,e+t);if(s.set(r),P){var i;null===(i=z.videoDecodePort)||void 0===i||i.postMessage({status:1,data:s},[s.buffer])}else{let e=new Uint32Array(s.buffer),t=null,r=null,i=0,a=0;for(let o=0;o>10==M>>10&&(r=e.subarray(4*o,4*o+4),i=U(r))}if(!i&&!a)return;z.port.postMessage({status:o.d,at:i,st:a})}}};let F=null,W=null;globalThis.frame_callback=function(e,t,s,r,i,a,o,n){F===e&&W.length==t*o||(W=Module.HEAPF32.subarray(e/4,e/4+t*o),F=e),w.push([W])};let z=null;class H extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"pcm",defaultValue:1}]}constructor(e){var t,s;super(),z=this,monitorLOG("WIB"),this.port.onmessage=this.handleMessage.bind(this),this.isPlaying=!1,this.isCapturing=!1,this.wasmModule=null==e||null===(t=e.processorOptions)||void 0===t?void 0:t.wasmModule,e&&e.processorOptions&&(e.processorOptions.audioEncodeChannelsNum&&(C=e.processorOptions.audioEncodeChannelsNum),e.processorOptions.audioDecodeChannelsNum&&(D=e.processorOptions.audioDecodeChannelsNum)),this.SABConstructor(e&&e.processorOptions?e.processorOptions.sharedBuffer:null),this.noSABConstructor(),globalThis.fsHandler&&globalThis.fsHandler.setPort(this.port),null!=e&&null!==(s=e.processorOptions)&&void 0!==s&&s.userAgent&&_workletPrinter.setUserAgent(e.processorOptions.userAgent),_workletPrinter.setAuidoNodePort(this.port),monitorLOG("WIE")}SABConstructor(e){this.sampleRate_=0,this.g_sharedbuffer=e||null,this.encodeSAB=null,this.decodeSAB=null,this.audioEncodePort=null,this.audioDecodePort=null,this.videoDecodePort=null,this.rtpSAB=null,this.stopPlayAudio=!1,w=new h.a(128*D,sampleRate/100*D)}noSABConstructor(){this.audioProcessBuffer=new f(sampleRate,this),this.isRunning=!0}handleMessage(e){const{status:t,data:s}=e.data;switch(t){case"diableSharedArrayBuffer":d=!1;break;case"disableDecoderinworklet":b=!1;break;case"data":console.info("Dropped audio data before initialized");break;case"stopPlayAudio":this.isPlaying=!1;break;case"stopWorklet":V=!0;break;case"startPlayAudio":this.isPlaying=!0;break;case"StartCaptureAudio":this.isCapturing=!0;break;case"sampleRate":this.sampleRate_=s;break;case"audiowasm":try{initWasm(Module,this.wasmModule)}catch(e){z.port.postMessage({status:"WASM_INIT_FAILED"}),_workletPrinter.error("init WASM failed, error message:"+e.message+e.stack)}break;case"initData":T=s.userid,S=s.meetingid,E=s.meetingnum;break;case"currentSSRC":M=s;break;case"stop_audio_incoming":this.stopPlayAudio=s;break;case"codecDoAVSync":P=!0,g&&m&&g(m,!0);break;case"checkProcess":{monitorLOG("PCC"+Z);let e=parseInt(1e3*X/this.sampleRate_);monitorLOG("ADD:"+e),!Z!==G&&(G=!Z,z.port.postMessage({status:"PROCESS_EXCEPTIONS",data:G})),Z=0,X=0;break}case"interpretation_set_lang":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.lang,y(m,1,L,1);break;case"interpretation_enable":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.enable?1:0,y(m,0,L,1);break;case"interpretation_mute_origin":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.mute?1:0,y(m,2,L,1);break;case"interpretation_set_interpreter":{let e=Module.HEAPU32.subarray(L/4,L/4+I),t=L;s.interpreterList.length>=I&&(t=Module._malloc(4*s.interpreterList.length),e=Module.HEAPU32.subarray(t/4,t/4+s.interpreterList.length));for(let t=0;t=I&&Module._free(t);break}case"setSpeechVolumeLevel":if(!m)return;R(m,s.userid,s.volume);break;case 131:n.a.setAllSpeechVolume(s.volume);break;default:d?this.handleMessageForSAB(e):this.handleMessageForNoSAB(e)}}handleMessageForSAB(e){const{status:t,data:s}=e.data;switch(t){case"encodeAudioPort":this.audioEncodePort&&this.audioEncodePort.close(),this.audioEncodePort=e.ports[0];break;case"decodeAudioPort":this.audioDecodePort&&this.audioDecodePort.close(),this.audioDecodePort=e.ports[0],this.audioDecodePort.onmessage=function(e){};break;case"decodeVideoPort":this.videoDecodePort&&this.videoDecodePort.close(),this.videoDecodePort=e.ports[0];break;case"close":break;case"sharedBuffer":s&&(this.g_sharedbuffer=s),this.g_sharedbuffer&&(this.encodeSAB=new h.b(this.g_sharedbuffer.inputState,this.g_sharedbuffer.inputBuffer,128*C,C),this.decodeSAB=new h.b(this.g_sharedbuffer.outputState,this.g_sharedbuffer.outputBuffer,128*D),this.g_sharedbuffer.echoState&&this.g_sharedbuffer.echoBuffer&&(this.echoSAB=new h.b(this.g_sharedbuffer.echoState,this.g_sharedbuffer.echoBuffer,128*D,D)),this.rtpSAB=new a(this.g_sharedbuffer.rtpBuffer,1200),this.decodeSAB.onCacheSizeChange=e=>{this.audioDecodePort&&this.audioDecodePort.postMessage({status:3,cacheSize:e,isSAB:!0})});break;default:console.warn("unhanle commands in audioworklet",t)}}handleMessageForNoSAB(e){const{status:t}=e.data;switch(t){case"encodeAudioPort":this.audioProcessBuffer.setEncodePort(e.ports[0]);break;case"decodeAudioPort":this.audioProcessBuffer.setDecodePort(e.ports[0]);break;case"close":this.audioProcessBuffer.close(),this.isPlaying=!1,this.isRunning=!1;break;default:console.warn("unhanle commands in audioworklet",t)}}onReceivedRTP(){}process(e,t,s){if(Z++,V)return!1;try{return d?b?this.SABDecodeProcess(e,t,s):this.SABProcess(e,t,s):this.NoSABprocess(e,t,s)}catch(e){return _workletPrinter.error("::process() exception: "+e.message+e.stack),!0}}NoSABprocess(e,t,s){return!!this.isRunning&&(!this.isPlaying||(this.inputDataForNoSAB(e),this.outputDataForNoSAB(t),!0))}inputDataForNoSAB(e){if(!e[0]||!e[0][0])return!0;let t=e[0];if(X+=t[0].length,!x&&e[0].length100&&(e=100);let t=this.rtpSAB.getReaderPtr(),s=0;for(;s1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:r.a,data:e});postMessage({status:r.a,data:e})}new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const s=this.ssrcInfoMap.get(e);if(0===s.frames?s.firstTime=t:s.lastTime=t,s.frames+=1,s.frames>2&&s.frames%5==0&&s.lastTime-s.firstTime>=1e3){const t=Math.floor(1e3/((s.lastTime-s.firstTime)/(s.frames-1)));s.fps!==t&&(this._notifyFPS(e,t),s.fps=t),s.firstTime=s.lastTime,s.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,s)=>{const r=this.ssrcInfoMap.get(s);r&&e-r.lastTime>2e3&&(this.ssrcInfoMap.delete(s),this._notifyFPS(s,0))})}_notifyFPS(e,t){postMessage({status:r.b,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};var n=s(5);const h={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},u={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let l,c,f,d,b,_,p,m,A,g,S=0,E=!0;var T=0;var M=!1;var P=null;var C=!1;t.a={WASMTYPE:h,AUDIO_STATE:u,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");f=e.cwrap("_Heartbeat","number",["number"]),d=e.cwrap("_MuteUnmuteState","number",["number","number"]),b=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),_=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),p=e.cwrap("_Switch_Denoise","number",["number","number","number","number"]),m=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),A=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),g=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(e,t,s){l=e,t&&(S=t),s&&(c=s)},muteUnmuteState:function(e){if(null!=Object.values(u).find(t=>t==e))return l?void(S!=h.WORKLET_APM_ONLY&&(d(l,e),a("muteUnmuteState: "+e))):a("muteUnmuteState: -1")},switchOriginalSound:function(e,t,s,r){l&&b(l,e,t,s,r)},deliverRecordedData:function(e,t,s,r){l&&_(l,e,t,0,s,r)},switchDenoise:function(e,t){l&&(M=e,p(l,!!e,3,!!t))},audioInit:function(e,t,s,r,i,a,o,n,h,u){return m(e,t,s,r,i,a,o,n,h,u)},setDecoder:function(e){P=e},needCalculateDenoiseOutput:function(){C=!0},switchHighBitrate:function(e){l&&A(l,e)},disableJitterLog:function(){E=!1},setAllSpeechVolume:function(e){l&&g(l,e)},onMonitorLogWASM:function(e,t){if(t<=0)return;const s=Module.HEAPU8.subarray(e,e+t),r=String.fromCharCode.apply(null,s);r&&(!E&&r.includes("JITTER")||(S==h.ENCODE||S==h.DECODE?o(r):S==h.WORKLET?c&&c.port&&o(r,c.port):S==h.WORKLET_APM_ONLY&&c.port&&c.port.postMessage({status:"SPEECH_LOG",data:{log:r}})))},onMuteSpeechWarningWASM:function(){postMessage({status:i.b})},onAudioLevelWASM:function(e,t,s){var r;S!=h.ENCODE&&S!=h.WORKLET_APM_ONLY||1==e&&(0===t&&0===T||(T=t,S===h.ENCODE?postMessage({status:i.a,value:t}):null!==(r=c)&&void 0!==r&&r.port&&c.port.postMessage({status:i.a,data:t})))},onAPMProcessedPCMWASM:function(e,t,s,r){if(!M)return;let i=Module.HEAPF32.subarray(e/4,e/4+t);if(P){if(C){C=!1;let{sumRms:e}=Object(n.a)(i,2),t=Object(n.c)(e);c.port&&c.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}P.push([i])}}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r})),s.d(t,"c",(function(){return i})),s.d(t,"b",(function(){return a}));const r=38,i=-51,a=121},function(e,t,s){"use strict";const r=e=>0==(e&e-1);let i=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let s=e;return t instanceof ErrorEvent?(t.filename&&(s+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(s+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(s+=" Message: ".concat(t.message)),t.error&&(s+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(s+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(s+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(s+=" Message: ".concat(t.message)),t.stack&&(s+=" Stack: ".concat(t.stack)),t.name&&(s+=" Name: ".concat(t.name)),t.constraint&&(s+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(s+=" Code: ".concat(t.code)),t.reason&&(s+=" Reason: ".concat(t.reason)),s+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(s+=" Message: ".concat(t.message)),t.name&&(s+=" Name: ".concat(t.name))):s+=t?t.toString():"",s}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const s=r(this._highFrequencyLogs[e]);this._instance&&s&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var s,r;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(s=(r=this._instance).directReport)||void 0===s||s.call(r,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=i},function(e,t,s){"use strict";s.d(t,"b",(function(){return i})),s.d(t,"a",(function(){return a}));var r=s(6);class i{constructor(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(e),this.sabBuffer=new Float32Array(t),this.perFrameLength=s,this.writeChannelNumb=i,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%s==0,this.bufferIndex=null,this.supportSpecialOptimization){let e=this.bufferLen/s;this.bufferIndex=[];for(let t=0;tthis.CACHE_SIZE_MAX_VALUE&&(e=this.CACHE_SIZE_MAX_VALUE),e0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(e){if(void 0===e[0]||e[0].length*this.writeChannelNumb!==this.perFrameLength)return;let t=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),t?this.supportSpecialOptimization?this.writeSpecial(e):this.writeNormal(e):void 0}writeNormal(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;s=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=t,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;sthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s*this.perFrameLength+e)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=null;if(this.bufferLen-e>=this.perFrameLength)s=this.sabBuffer.subarray(e,e+this.perFrameLength);else{let t=this.sabBuffer.subarray(e),r=this.sabBuffer.subarray(0,this.perFrameLength-t.length);s=this.placeBuffer,s.set(t),s.set(r,t.length)}return e+=this.perFrameLength,e>=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}readSpecial(){let e=this.sabState[this.STATE_READ_INDEX],t=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(tthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s+e)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=this.bufferIndex[e];return e=(e+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}}class a{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=e,this.wframes=t,this.writeChannelNumb=s,this.cap=this.lcm(e,t),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(e,t){return 0===t?e:this.gcd(t,e%t)}lcm(e,t){return e/this.gcd(e,t)*t}push(e){if(null==e[0]||e[0].length*this.writeChannelNumb==this.wframes){for(let t=0;t=this.cap&&(this.woffset=this.woffset%this.cap)}else{var t;console.error("[Audio] critical error in AudioWorklet: data.length:",e.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(t=e[0])||void 0===t?void 0:t.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let e=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),e}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return i})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return o}));s(3);const r=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function i(e,t){let s=0,r=0;for(let i=0;is&&(s=t)}return s=s>1?1:s,{sumRms:r/e.length/t,absMax:s}}function a(e){if("number"!=typeof e||e<0||e>1)return-1;let t=parseInt(32768*e/1e3);return 0==t&&e>250&&(t=1),r[t]}function o(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(e){return e===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==e||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=e,!0)}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(e){this.messageQueue=[],this.auidoNodePort,this.userAgent="",this.isSafari=!1,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.print_=this.print_.bind(this),this.messageHeader=e}setUserAgent(e){this.userAgent=e,this.userAgent.match(/AppleWebKit\/(\d+)\./)&&(this.isSafari=!0)}setAuidoNodePort(e){this.auidoNodePort=e}debug(e){e=this.messageHeader+e;for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rthis.cacheMaxSize&&(this.cacheSize=this.cacheMaxSize),this.onCacheSizeChange&&this.isReady&&this.cacheSizeController.shouldSendCacheSize(this.cacheSize)&&this.onCacheSizeChange(this.cacheSize)}copyTo(e){if(0===this.buffList.length)return e.fill(0),void this.increaseCacheSize();let t=this.buffList[0];if(t.buff.length-t.offset>=e.length)this.copy(t.buff,t.offset,e,0),t.offset+=e.length,t.offset===t.buff.length&&(this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff));else{if(this.buffList.length<2)return e.fill(0),void this.increaseCacheSize();let s=this.copy(t.buff,t.offset,e,0);this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff),t=this.buffList[0],s=this.copy(t.buff,t.offset,e,s),t.offset+=s}}requestMoreData(){this.buffList.length=2}}class c{constructor(e){this.buffList=[],this.frameLength=e,this.onframedata=null}copy(e,t,s,r){if(e[0].length*C<=s.length-r){for(let t=0;t=e[0].length*C){let s=this.copy(e,0,t.buff,t.offset);t.offset+=s,t.buff.length===t.offset&&(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff))}else{let s=this.copy(e,0,t.buff,t.offset);if(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff),e[0].length*C>s){let t=[];for(let r=0;rr?1:0)));this.push(t)}}}}class f{constructor(e,t){this.context=t,this.decodePort=null,this.encodePort=null,this.captureSize=e/100*C,this.playBuffer=new l,this.playBuffer.onrollbackbuffer=e=>{this.decodePort},this.playBuffer.onneedmoredata=()=>{this.decodePort&&this.decodePort.postMessage({status:1})},this.playBuffer.onCacheSizeChange=e=>{this.decodePort&&this.decodePort.postMessage({status:3,cacheSize:e})},this.quantum=new Float32Array(128*D),this.captureBuffer=new c(this.captureSize),this.captureBuffer.onframedata=e=>{this.encodePort&&this.encodePort.postMessage({command:2,buffer:e},[e.buffer])}}setDecodePort(e){this.decodePort&&this.decodePort.close(),this.decodePort=e,this.decodePort.onmessage=this.handleDecodeData.bind(this)}setEncodePort(e){this.encodePort&&this.encodePort.close(),this.encodePort=e,this.encodePort.onmessage=this.handleEncodeData.bind(this)}handleDecodeData(e){this.context.isPlaying&&this.playBuffer.push(e.data.data)}handleEncodeData(e){switch(e.data.event){case 0:this.captureBuffer.rollbackbuffer(e.data.buffer)}}requestMoreData(){this.playBuffer.requestMoreData()}close(){this.decodePort&&(this.decodePort=null,this.decodePort.close()),this.encodePort&&(this.encodePort=null,this.encodePort.close())}write(e){this.captureBuffer.push(e)}read(){return this.playBuffer.copyTo(this.quantum),this.requestMoreData(),this.quantum}}let d="undefined"!=typeof SharedArrayBuffer,b=!0;var _=null,p=null,m=null,A=null,g=null;let S=0,E=0,T=0,M=0,P=!1,C=1,D=1,w=null;var y,L,R,N,I=10;let v=1500;var B=new Map;function O(e){if(e){var t=e.length/16,s=0,r=0;for(s=0;s>=10;var a=0;for(r=16*s+4;r<16*s+12;r++)a+=e[r]*Math.pow(256,r-16*s-4);B.set(i,a)}}}function k(e){e>>=10;var t=B.get(e);return t?(B.set(e,0),t):0}function U(e){let t=e[1];return 4294967296*e[2]+t}globalThis.update_play_time=function(e,t){if(t){var s=new Uint8Array(t),r=Module.HEAP8.subarray(e+0,e+t);if(s.set(r),P){var i;null===(i=z.videoDecodePort)||void 0===i||i.postMessage({status:1,data:s},[s.buffer])}else{let e=new Uint32Array(s.buffer),t=null,r=null,i=0,a=0;for(let o=0;o>10==M>>10&&(r=e.subarray(4*o,4*o+4),i=U(r))}if(!i&&!a)return;z.port.postMessage({status:o.d,at:i,st:a})}}};let F=null,W=null;globalThis.frame_callback=function(e,t,s,r,i,a,o,n){F===e&&W.length==t*o||(W=Module.HEAPF32.subarray(e/4,e/4+t*o),F=e),w.push([W])};let z=null;class H extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"pcm",defaultValue:1}]}constructor(e){var t,s;super(),z=this,monitorLOG("WIB"),this.port.onmessage=this.handleMessage.bind(this),this.isPlaying=!1,this.isCapturing=!1,this.wasmModule=null==e||null===(t=e.processorOptions)||void 0===t?void 0:t.wasmModule,e&&e.processorOptions&&(e.processorOptions.audioEncodeChannelsNum&&(C=e.processorOptions.audioEncodeChannelsNum),e.processorOptions.audioDecodeChannelsNum&&(D=e.processorOptions.audioDecodeChannelsNum)),this.SABConstructor(e&&e.processorOptions?e.processorOptions.sharedBuffer:null),this.noSABConstructor(),globalThis.fsHandler&&globalThis.fsHandler.setPort(this.port),null!=e&&null!==(s=e.processorOptions)&&void 0!==s&&s.userAgent&&_workletPrinter.setUserAgent(e.processorOptions.userAgent),_workletPrinter.setAuidoNodePort(this.port),monitorLOG("WIE")}SABConstructor(e){this.sampleRate_=0,this.g_sharedbuffer=e||null,this.encodeSAB=null,this.decodeSAB=null,this.audioEncodePort=null,this.audioDecodePort=null,this.videoDecodePort=null,this.rtpSAB=null,this.stopPlayAudio=!1,w=new h.a(128*D,sampleRate/100*D)}noSABConstructor(){this.audioProcessBuffer=new f(sampleRate,this),this.isRunning=!0}handleMessage(e){const{status:t,data:s}=e.data;switch(t){case"diableSharedArrayBuffer":d=!1;break;case"disableDecoderinworklet":b=!1;break;case"data":console.info("Dropped audio data before initialized");break;case"stopPlayAudio":this.isPlaying=!1;break;case"stopWorklet":V=!0;break;case"startPlayAudio":this.isPlaying=!0;break;case"StartCaptureAudio":this.isCapturing=!0;break;case"sampleRate":this.sampleRate_=s;break;case"audiowasm":try{initWasm(Module,this.wasmModule)}catch(e){z.port.postMessage({status:"WASM_INIT_FAILED"}),_workletPrinter.error("init WASM failed, error message:"+e.message+e.stack)}break;case"initData":T=s.userid,S=s.meetingid,E=s.meetingnum;break;case"currentSSRC":M=s;break;case"stop_audio_incoming":this.stopPlayAudio=s;break;case"codecDoAVSync":P=!0,g&&m&&g(m,!0);break;case"checkProcess":{monitorLOG("PCC"+Z);let e=parseInt(1e3*X/this.sampleRate_);monitorLOG("ADD:"+e),!Z!==G&&(G=!Z,z.port.postMessage({status:"PROCESS_EXCEPTIONS",data:G})),Z=0,X=0;break}case"interpretation_set_lang":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.lang,y(m,1,L,1);break;case"interpretation_enable":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.enable?1:0,y(m,0,L,1);break;case"interpretation_mute_origin":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.mute?1:0,y(m,2,L,1);break;case"interpretation_set_interpreter":{let e=Module.HEAPU32.subarray(L/4,L/4+I),t=L;s.interpreterList.length>=I&&(t=Module._malloc(4*s.interpreterList.length),e=Module.HEAPU32.subarray(t/4,t/4+s.interpreterList.length));for(let t=0;t=I&&Module._free(t);break}case"setSpeechVolumeLevel":if(!m)return;R(m,s.userid,s.volume);break;case 131:n.a.setAllSpeechVolume(s.volume);break;default:d?this.handleMessageForSAB(e):this.handleMessageForNoSAB(e)}}handleMessageForSAB(e){const{status:t,data:s}=e.data;switch(t){case"encodeAudioPort":this.audioEncodePort&&this.audioEncodePort.close(),this.audioEncodePort=e.ports[0];break;case"decodeAudioPort":this.audioDecodePort&&this.audioDecodePort.close(),this.audioDecodePort=e.ports[0],this.audioDecodePort.onmessage=function(e){};break;case"decodeVideoPort":this.videoDecodePort&&this.videoDecodePort.close(),this.videoDecodePort=e.ports[0];break;case"close":break;case"sharedBuffer":s&&(this.g_sharedbuffer=s),this.g_sharedbuffer&&(this.encodeSAB=new h.b(this.g_sharedbuffer.inputState,this.g_sharedbuffer.inputBuffer,128*C,C),this.decodeSAB=new h.b(this.g_sharedbuffer.outputState,this.g_sharedbuffer.outputBuffer,128*D),this.g_sharedbuffer.echoState&&this.g_sharedbuffer.echoBuffer&&(this.echoSAB=new h.b(this.g_sharedbuffer.echoState,this.g_sharedbuffer.echoBuffer,128*D,D)),this.rtpSAB=new a(this.g_sharedbuffer.rtpBuffer,1200),this.decodeSAB.onCacheSizeChange=e=>{this.audioDecodePort&&this.audioDecodePort.postMessage({status:3,cacheSize:e,isSAB:!0})});break;default:console.warn("unhanle commands in audioworklet",t)}}handleMessageForNoSAB(e){const{status:t}=e.data;switch(t){case"encodeAudioPort":this.audioProcessBuffer.setEncodePort(e.ports[0]);break;case"decodeAudioPort":this.audioProcessBuffer.setDecodePort(e.ports[0]);break;case"close":this.audioProcessBuffer.close(),this.isPlaying=!1,this.isRunning=!1;break;default:console.warn("unhanle commands in audioworklet",t)}}onReceivedRTP(){}process(e,t,s){if(Z++,V)return!1;try{return d?b?this.SABDecodeProcess(e,t,s):this.SABProcess(e,t,s):this.NoSABprocess(e,t,s)}catch(e){return _workletPrinter.error("::process() exception: "+e.message+e.stack),!0}}NoSABprocess(e,t,s){return!!this.isRunning&&(!this.isPlaying||(this.inputDataForNoSAB(e),this.outputDataForNoSAB(t),!0))}inputDataForNoSAB(e){if(!e[0]||!e[0][0])return!0;let t=e[0];if(X+=t[0].length,!x&&e[0].length100&&(e=100);let t=this.rtpSAB.getReaderPtr(),s=0;for(;s{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="audio.encode.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={1099708:$0=>{console.log("Audio Version: ",$0)},1099745:($0,$1)=>{send_data($0,$1)},1099768:($0,$1)=>{SAVE_IV($0,$1)},1099786:($0,$1,$2,$3)=>{audio_encode_frame_callback($0,$1,$2,$3)},1099835:($0,$1,$2)=>{Get_ExternalRecord($0,$1,$2)},1099871:()=>{return Date.now()},1099894:($0,$1)=>{update_play_time($0,$1)},1099924:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},1099971:($0,$1)=>{AudioWasmAdapter.onMonitorLogWASM($0,$1)},1100014:($0,$1)=>{AudioWasmAdapter.onAudioLevelWASM($0,$1)},1100057:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},1100097:($0,$1,$2,$3)=>{AudioWasmAdapter.onAPMProcessedPCMWASM($0,$1,$2,$3)},1100157:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1100192:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1100227:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseAudioQosData($0,$1,$2,$3,$4,$5,$6,$7)},1100282:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1100319:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1100356:($0,$1,$2,$3,$4,$5,$6,$7)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7)},1100408:($0,$1)=>{get_edition($0,$1)},1100433:($0,$1)=>{SAVE_IV($0,$1)},1100451:($0,$1)=>{COMMIT_PRINT($0,$1)},1100473:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100509:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100545:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100581:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1100617:($0,$1)=>{LOG_OUT($0,$1)},1100638:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _shmat(){err("missing function: shmat");abort(-1)}function _shmctl(){err("missing function: shmctl");abort(-1)}function _shmdt(){err("missing function: shmdt");abort(-1)}function _shmget(){err("missing function: shmget");abort(-1)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"shmat":_shmat,"shmctl":_shmctl,"shmdt":_shmdt,"shmget":_shmget,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Audio_Init=Module["__Audio_Init"]=function(){return(__Audio_Init=Module["__Audio_Init"]=Module["asm"]["_Audio_Init"]).apply(null,arguments)};var __Audio_UnInit=Module["__Audio_UnInit"]=function(){return(__Audio_UnInit=Module["__Audio_UnInit"]=Module["asm"]["_Audio_UnInit"]).apply(null,arguments)};var __Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=function(){return(__Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=Module["asm"]["_Deliver_Recorded_Data"]).apply(null,arguments)};var __Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=function(){return(__Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=Module["asm"]["_Audio_Try_Analysis"]).apply(null,arguments)};var __Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=function(){return(__Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=Module["asm"]["_Put_Pre_Aec_Data"]).apply(null,arguments)};var __Set_Aec_Delay=Module["__Set_Aec_Delay"]=function(){return(__Set_Aec_Delay=Module["__Set_Aec_Delay"]=Module["asm"]["_Set_Aec_Delay"]).apply(null,arguments)};var __ReSet_Aec=Module["__ReSet_Aec"]=function(){return(__ReSet_Aec=Module["__ReSet_Aec"]=Module["asm"]["_ReSet_Aec"]).apply(null,arguments)};var __Get_Aec_Delay=Module["__Get_Aec_Delay"]=function(){return(__Get_Aec_Delay=Module["__Get_Aec_Delay"]=Module["asm"]["_Get_Aec_Delay"]).apply(null,arguments)};var __Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=function(){return(__Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=Module["asm"]["_Request_Audio_Qos_Data"]).apply(null,arguments)};var __Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=function(){return(__Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=Module["asm"]["_Get_Mixed_Audio"]).apply(null,arguments)};var __Get_Audio_Edition=Module["__Get_Audio_Edition"]=function(){return(__Get_Audio_Edition=Module["__Get_Audio_Edition"]=Module["asm"]["_Get_Audio_Edition"]).apply(null,arguments)};var __Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=function(){return(__Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=Module["asm"]["_Audio_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Cooker_info=Module["__Add_Cooker_info"]=function(){return(__Add_Cooker_info=Module["__Add_Cooker_info"]=Module["asm"]["_Add_Cooker_info"]).apply(null,arguments)};var __Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=function(){return(__Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=Module["asm"]["_Remove_Cooker_Info"]).apply(null,arguments)};var __Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=function(){return(__Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=Module["asm"]["_Get_Audio_Meat_Weight"]).apply(null,arguments)};var __Change_Aec_Flag=Module["__Change_Aec_Flag"]=function(){return(__Change_Aec_Flag=Module["__Change_Aec_Flag"]=Module["asm"]["_Change_Aec_Flag"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Cc_Set_Lang=Module["__Cc_Set_Lang"]=function(){return(__Cc_Set_Lang=Module["__Cc_Set_Lang"]=Module["asm"]["_Cc_Set_Lang"]).apply(null,arguments)};var __Interpretation_Configure=Module["__Interpretation_Configure"]=function(){return(__Interpretation_Configure=Module["__Interpretation_Configure"]=Module["asm"]["_Interpretation_Configure"]).apply(null,arguments)};var __Start_Audio_Share=Module["__Start_Audio_Share"]=function(){return(__Start_Audio_Share=Module["__Start_Audio_Share"]=Module["asm"]["_Start_Audio_Share"]).apply(null,arguments)};var __InsertShareData=Module["__InsertShareData"]=function(){return(__InsertShareData=Module["__InsertShareData"]=Module["asm"]["_InsertShareData"]).apply(null,arguments)};var __Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=function(){return(__Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=Module["asm"]["_Set_Share_Volume_Level"]).apply(null,arguments)};var __Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=function(){return(__Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=Module["asm"]["_Set_Speech_Volume_Level"]).apply(null,arguments)};var __Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=function(){return(__Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=Module["asm"]["_Set_All_Speech_Volume_Level"]).apply(null,arguments)};var __Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=function(){return(__Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=Module["asm"]["_Update_Monitor_Send_Audio_Info"]).apply(null,arguments)};var __Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=function(){return(__Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=Module["asm"]["_Update_Monitor_Receive_Audio_Info"]).apply(null,arguments)};var __Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=function(){return(__Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=Module["asm"]["_Set_Audio_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=function(){return(__Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=Module["asm"]["_Enable_Share_To_Bo"]).apply(null,arguments)};var __Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=function(){return(__Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=Module["asm"]["_Enable_Broadcast_To_Bo"]).apply(null,arguments)};var __Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=function(){return(__Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=Module["asm"]["_Set_Audio_Pipe_To_Bo"]).apply(null,arguments)};var __Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=function(){return(__Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=Module["asm"]["_Enable_Pipe_OUT_RTP"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __setMultiViewFlag=Module["__setMultiViewFlag"]=function(){return(__setMultiViewFlag=Module["__setMultiViewFlag"]=Module["asm"]["_setMultiViewFlag"]).apply(null,arguments)};var __Switch_Denoise=Module["__Switch_Denoise"]=function(){return(__Switch_Denoise=Module["__Switch_Denoise"]=Module["asm"]["_Switch_Denoise"]).apply(null,arguments)};var __Switch_Original_Sound=Module["__Switch_Original_Sound"]=function(){return(__Switch_Original_Sound=Module["__Switch_Original_Sound"]=Module["asm"]["_Switch_Original_Sound"]).apply(null,arguments)};var __Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=function(){return(__Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=Module["asm"]["_Switch_High_Bitrate"]).apply(null,arguments)};var __Heartbeat=Module["__Heartbeat"]=function(){return(__Heartbeat=Module["__Heartbeat"]=Module["asm"]["_Heartbeat"]).apply(null,arguments)};var __MuteUnmuteState=Module["__MuteUnmuteState"]=function(){return(__MuteUnmuteState=Module["__MuteUnmuteState"]=Module["asm"]["_MuteUnmuteState"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiiji=Module["dynCall_iiiji"]=function(){return(dynCall_iiiji=Module["dynCall_iiiji"]=Module["asm"]["dynCall_iiiji"]).apply(null,arguments)};var dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=function(){return(dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=Module["asm"]["dynCall_iiiiiijiii"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); + +} \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet_simd.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet_simd.min.js new file mode 100644 index 0000000..72a2094 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_audio_worklet_simd.min.js @@ -0,0 +1,30 @@ +!function(e){var t={};function s(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,r){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(r,i,function(t){return e[t]}.bind(null,i));return r},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=8)}([function(e,t,s){"use strict";s.d(t,"e",(function(){return r})),s.d(t,"i",(function(){return i})),s.d(t,"a",(function(){return a})),s.d(t,"d",(function(){return o})),s.d(t,"f",(function(){return n})),s.d(t,"c",(function(){return h})),s.d(t,"b",(function(){return u})),s.d(t,"g",(function(){return l})),s.d(t,"j",(function(){return c})),s.d(t,"h",(function(){return f}));const r=30,i=35,a=48,o=57,n=61,h=66.5,u=66.6,l=-26,c=-27,f=-28},function(e,t,s){"use strict";var r=s(0);s(3);new Error;new Map;var i=s(2);function a(e){postMessage({status:r.i,data:e})}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:r.a,data:e});postMessage({status:r.a,data:e})}new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const s=this.ssrcInfoMap.get(e);if(0===s.frames?s.firstTime=t:s.lastTime=t,s.frames+=1,s.frames>2&&s.frames%5==0&&s.lastTime-s.firstTime>=1e3){const t=Math.floor(1e3/((s.lastTime-s.firstTime)/(s.frames-1)));s.fps!==t&&(this._notifyFPS(e,t),s.fps=t),s.firstTime=s.lastTime,s.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,s)=>{const r=this.ssrcInfoMap.get(s);r&&e-r.lastTime>2e3&&(this.ssrcInfoMap.delete(s),this._notifyFPS(s,0))})}_notifyFPS(e,t){postMessage({status:r.b,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};var n=s(5);const h={WORKLET:1,ENCODE:2,DECODE:3,WORKLET_APM_ONLY:4},u={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let l,c,f,d,b,_,p,m,A,g,S=0,E=!0;var T=0;var M=!1;var P=null;var C=!1;t.a={WASMTYPE:h,AUDIO_STATE:u,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");f=e.cwrap("_Heartbeat","number",["number"]),d=e.cwrap("_MuteUnmuteState","number",["number","number"]),b=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),_=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),p=e.cwrap("_Switch_Denoise","number",["number","number","number","number"]),m=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),A=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),g=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"])},setAudioInstanceAndType:function(e,t,s){l=e,t&&(S=t),s&&(c=s)},muteUnmuteState:function(e){if(null!=Object.values(u).find(t=>t==e))return l?void(S!=h.WORKLET_APM_ONLY&&(d(l,e),a("muteUnmuteState: "+e))):a("muteUnmuteState: -1")},switchOriginalSound:function(e,t,s,r){l&&b(l,e,t,s,r)},deliverRecordedData:function(e,t,s,r){l&&_(l,e,t,0,s,r)},switchDenoise:function(e,t){l&&(M=e,p(l,!!e,3,!!t))},audioInit:function(e,t,s,r,i,a,o,n,h,u){return m(e,t,s,r,i,a,o,n,h,u)},setDecoder:function(e){P=e},needCalculateDenoiseOutput:function(){C=!0},switchHighBitrate:function(e){l&&A(l,e)},disableJitterLog:function(){E=!1},setAllSpeechVolume:function(e){l&&g(l,e)},onMonitorLogWASM:function(e,t){if(t<=0)return;const s=Module.HEAPU8.subarray(e,e+t),r=String.fromCharCode.apply(null,s);r&&(!E&&r.includes("JITTER")||(S==h.ENCODE||S==h.DECODE?o(r):S==h.WORKLET?c&&c.port&&o(r,c.port):S==h.WORKLET_APM_ONLY&&c.port&&c.port.postMessage({status:"SPEECH_LOG",data:{log:r}})))},onMuteSpeechWarningWASM:function(){postMessage({status:i.b})},onAudioLevelWASM:function(e,t,s){var r;S!=h.ENCODE&&S!=h.WORKLET_APM_ONLY||1==e&&(0===t&&0===T||(T=t,S===h.ENCODE?postMessage({status:i.a,value:t}):null!==(r=c)&&void 0!==r&&r.port&&c.port.postMessage({status:i.a,data:t})))},onAPMProcessedPCMWASM:function(e,t,s,r){if(!M)return;let i=Module.HEAPF32.subarray(e/4,e/4+t);if(P){if(C){C=!1;let{sumRms:e}=Object(n.a)(i,2),t=Object(n.c)(e);c.port&&c.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}P.push([i])}}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r})),s.d(t,"c",(function(){return i})),s.d(t,"b",(function(){return a}));const r=38,i=-51,a=121},function(e,t,s){"use strict";const r=e=>0==(e&e-1);let i=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let s=e;return t instanceof ErrorEvent?(t.filename&&(s+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(s+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(s+=" Message: ".concat(t.message)),t.error&&(s+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(s+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(s+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(s+=" Message: ".concat(t.message)),t.stack&&(s+=" Stack: ".concat(t.stack)),t.name&&(s+=" Name: ".concat(t.name)),t.constraint&&(s+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(s+=" Code: ".concat(t.code)),t.reason&&(s+=" Reason: ".concat(t.reason)),s+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(s+=" Message: ".concat(t.message)),t.name&&(s+=" Name: ".concat(t.name))):s+=t?t.toString():"",s}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const s=r(this._highFrequencyLogs[e]);this._instance&&s&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var s,r;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(s=(r=this._instance).directReport)||void 0===s||s.call(r,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=i},function(e,t,s){"use strict";s.d(t,"b",(function(){return i})),s.d(t,"a",(function(){return a}));var r=s(6);class i{constructor(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(e),this.sabBuffer=new Float32Array(t),this.perFrameLength=s,this.writeChannelNumb=i,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%s==0,this.bufferIndex=null,this.supportSpecialOptimization){let e=this.bufferLen/s;this.bufferIndex=[];for(let t=0;tthis.CACHE_SIZE_MAX_VALUE&&(e=this.CACHE_SIZE_MAX_VALUE),e0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(e){if(void 0===e[0]||e[0].length*this.writeChannelNumb!==this.perFrameLength)return;let t=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),t?this.supportSpecialOptimization?this.writeSpecial(e):this.writeNormal(e):void 0}writeNormal(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;s=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=t,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(e){let t=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;sthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s*this.perFrameLength+e)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=null;if(this.bufferLen-e>=this.perFrameLength)s=this.sabBuffer.subarray(e,e+this.perFrameLength);else{let t=this.sabBuffer.subarray(e),r=this.sabBuffer.subarray(0,this.perFrameLength-t.length);s=this.placeBuffer,s.set(t),s.set(r,t.length)}return e+=this.perFrameLength,e>=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}readSpecial(){let e=this.sabState[this.STATE_READ_INDEX],t=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(tthis.bufferLen){let s=Math.ceil((t-this.bufferLen)/this.perFrameLength)+1;e=(s+e)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=this.bufferIndex[e];return e=(e+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=e,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}}class a{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=e,this.wframes=t,this.writeChannelNumb=s,this.cap=this.lcm(e,t),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(e,t){return 0===t?e:this.gcd(t,e%t)}lcm(e,t){return e/this.gcd(e,t)*t}push(e){if(null==e[0]||e[0].length*this.writeChannelNumb==this.wframes){for(let t=0;t=this.cap&&(this.woffset=this.woffset%this.cap)}else{var t;console.error("[Audio] critical error in AudioWorklet: data.length:",e.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(t=e[0])||void 0===t?void 0:t.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let e=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),e}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return i})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return o}));s(3);const r=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function i(e,t){let s=0,r=0;for(let i=0;is&&(s=t)}return s=s>1?1:s,{sumRms:r/e.length/t,absMax:s}}function a(e){if("number"!=typeof e||e<0||e>1)return-1;let t=parseInt(32768*e/1e3);return 0==t&&e>250&&(t=1),r[t]}function o(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(e){return e===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==e||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=e,!0)}}},function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(e){this.messageQueue=[],this.auidoNodePort,this.userAgent="",this.isSafari=!1,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.print_=this.print_.bind(this),this.messageHeader=e}setUserAgent(e){this.userAgent=e,this.userAgent.match(/AppleWebKit\/(\d+)\./)&&(this.isSafari=!0)}setAuidoNodePort(e){this.auidoNodePort=e}debug(e){e=this.messageHeader+e;for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rthis.cacheMaxSize&&(this.cacheSize=this.cacheMaxSize),this.onCacheSizeChange&&this.isReady&&this.cacheSizeController.shouldSendCacheSize(this.cacheSize)&&this.onCacheSizeChange(this.cacheSize)}copyTo(e){if(0===this.buffList.length)return e.fill(0),void this.increaseCacheSize();let t=this.buffList[0];if(t.buff.length-t.offset>=e.length)this.copy(t.buff,t.offset,e,0),t.offset+=e.length,t.offset===t.buff.length&&(this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff));else{if(this.buffList.length<2)return e.fill(0),void this.increaseCacheSize();let s=this.copy(t.buff,t.offset,e,0);this.buffList.shift(),this.onrollbackbuffer&&this.onrollbackbuffer(t.buff),t=this.buffList[0],s=this.copy(t.buff,t.offset,e,s),t.offset+=s}}requestMoreData(){this.buffList.length=2}}class c{constructor(e){this.buffList=[],this.frameLength=e,this.onframedata=null}copy(e,t,s,r){if(e[0].length*C<=s.length-r){for(let t=0;t=e[0].length*C){let s=this.copy(e,0,t.buff,t.offset);t.offset+=s,t.buff.length===t.offset&&(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff))}else{let s=this.copy(e,0,t.buff,t.offset);if(this.buffList.shift(),this.onframedata&&this.onframedata(t.buff),e[0].length*C>s){let t=[];for(let r=0;rr?1:0)));this.push(t)}}}}class f{constructor(e,t){this.context=t,this.decodePort=null,this.encodePort=null,this.captureSize=e/100*C,this.playBuffer=new l,this.playBuffer.onrollbackbuffer=e=>{this.decodePort},this.playBuffer.onneedmoredata=()=>{this.decodePort&&this.decodePort.postMessage({status:1})},this.playBuffer.onCacheSizeChange=e=>{this.decodePort&&this.decodePort.postMessage({status:3,cacheSize:e})},this.quantum=new Float32Array(128*D),this.captureBuffer=new c(this.captureSize),this.captureBuffer.onframedata=e=>{this.encodePort&&this.encodePort.postMessage({command:2,buffer:e},[e.buffer])}}setDecodePort(e){this.decodePort&&this.decodePort.close(),this.decodePort=e,this.decodePort.onmessage=this.handleDecodeData.bind(this)}setEncodePort(e){this.encodePort&&this.encodePort.close(),this.encodePort=e,this.encodePort.onmessage=this.handleEncodeData.bind(this)}handleDecodeData(e){this.context.isPlaying&&this.playBuffer.push(e.data.data)}handleEncodeData(e){switch(e.data.event){case 0:this.captureBuffer.rollbackbuffer(e.data.buffer)}}requestMoreData(){this.playBuffer.requestMoreData()}close(){this.decodePort&&(this.decodePort=null,this.decodePort.close()),this.encodePort&&(this.encodePort=null,this.encodePort.close())}write(e){this.captureBuffer.push(e)}read(){return this.playBuffer.copyTo(this.quantum),this.requestMoreData(),this.quantum}}let d="undefined"!=typeof SharedArrayBuffer,b=!0;var _=null,p=null,m=null,A=null,g=null;let S=0,E=0,T=0,M=0,P=!1,C=1,D=1,w=null;var y,L,R,N,I=10;let v=1500;var B=new Map;function O(e){if(e){var t=e.length/16,s=0,r=0;for(s=0;s>=10;var a=0;for(r=16*s+4;r<16*s+12;r++)a+=e[r]*Math.pow(256,r-16*s-4);B.set(i,a)}}}function k(e){e>>=10;var t=B.get(e);return t?(B.set(e,0),t):0}function U(e){let t=e[1];return 4294967296*e[2]+t}globalThis.update_play_time=function(e,t){if(t){var s=new Uint8Array(t),r=Module.HEAP8.subarray(e+0,e+t);if(s.set(r),P){var i;null===(i=z.videoDecodePort)||void 0===i||i.postMessage({status:1,data:s},[s.buffer])}else{let e=new Uint32Array(s.buffer),t=null,r=null,i=0,a=0;for(let o=0;o>10==M>>10&&(r=e.subarray(4*o,4*o+4),i=U(r))}if(!i&&!a)return;z.port.postMessage({status:o.d,at:i,st:a})}}};let F=null,W=null;globalThis.frame_callback=function(e,t,s,r,i,a,o,n){F===e&&W.length==t*o||(W=Module.HEAPF32.subarray(e/4,e/4+t*o),F=e),w.push([W])};let z=null;class H extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"pcm",defaultValue:1}]}constructor(e){var t,s;super(),z=this,monitorLOG("WIB"),this.port.onmessage=this.handleMessage.bind(this),this.isPlaying=!1,this.isCapturing=!1,this.wasmModule=null==e||null===(t=e.processorOptions)||void 0===t?void 0:t.wasmModule,e&&e.processorOptions&&(e.processorOptions.audioEncodeChannelsNum&&(C=e.processorOptions.audioEncodeChannelsNum),e.processorOptions.audioDecodeChannelsNum&&(D=e.processorOptions.audioDecodeChannelsNum)),this.SABConstructor(e&&e.processorOptions?e.processorOptions.sharedBuffer:null),this.noSABConstructor(),globalThis.fsHandler&&globalThis.fsHandler.setPort(this.port),null!=e&&null!==(s=e.processorOptions)&&void 0!==s&&s.userAgent&&_workletPrinter.setUserAgent(e.processorOptions.userAgent),_workletPrinter.setAuidoNodePort(this.port),monitorLOG("WIE")}SABConstructor(e){this.sampleRate_=0,this.g_sharedbuffer=e||null,this.encodeSAB=null,this.decodeSAB=null,this.audioEncodePort=null,this.audioDecodePort=null,this.videoDecodePort=null,this.rtpSAB=null,this.stopPlayAudio=!1,w=new h.a(128*D,sampleRate/100*D)}noSABConstructor(){this.audioProcessBuffer=new f(sampleRate,this),this.isRunning=!0}handleMessage(e){const{status:t,data:s}=e.data;switch(t){case"diableSharedArrayBuffer":d=!1;break;case"disableDecoderinworklet":b=!1;break;case"data":console.info("Dropped audio data before initialized");break;case"stopPlayAudio":this.isPlaying=!1;break;case"stopWorklet":V=!0;break;case"startPlayAudio":this.isPlaying=!0;break;case"StartCaptureAudio":this.isCapturing=!0;break;case"sampleRate":this.sampleRate_=s;break;case"audiowasm":try{initWasm(Module,this.wasmModule)}catch(e){z.port.postMessage({status:"WASM_INIT_FAILED"}),_workletPrinter.error("init WASM failed, error message:"+e.message+e.stack)}break;case"initData":T=s.userid,S=s.meetingid,E=s.meetingnum;break;case"currentSSRC":M=s;break;case"stop_audio_incoming":this.stopPlayAudio=s;break;case"codecDoAVSync":P=!0,g&&m&&g(m,!0);break;case"checkProcess":{monitorLOG("PCC"+Z);let e=parseInt(1e3*X/this.sampleRate_);monitorLOG("ADD:"+e),!Z!==G&&(G=!Z,z.port.postMessage({status:"PROCESS_EXCEPTIONS",data:G})),Z=0,X=0;break}case"interpretation_set_lang":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.lang,y(m,1,L,1);break;case"interpretation_enable":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.enable?1:0,y(m,0,L,1);break;case"interpretation_mute_origin":Module.HEAPU32.subarray(L/4,L/4+I)[0]=s.mute?1:0,y(m,2,L,1);break;case"interpretation_set_interpreter":{let e=Module.HEAPU32.subarray(L/4,L/4+I),t=L;s.interpreterList.length>=I&&(t=Module._malloc(4*s.interpreterList.length),e=Module.HEAPU32.subarray(t/4,t/4+s.interpreterList.length));for(let t=0;t=I&&Module._free(t);break}case"setSpeechVolumeLevel":if(!m)return;R(m,s.userid,s.volume);break;case 131:n.a.setAllSpeechVolume(s.volume);break;default:d?this.handleMessageForSAB(e):this.handleMessageForNoSAB(e)}}handleMessageForSAB(e){const{status:t,data:s}=e.data;switch(t){case"encodeAudioPort":this.audioEncodePort&&this.audioEncodePort.close(),this.audioEncodePort=e.ports[0];break;case"decodeAudioPort":this.audioDecodePort&&this.audioDecodePort.close(),this.audioDecodePort=e.ports[0],this.audioDecodePort.onmessage=function(e){};break;case"decodeVideoPort":this.videoDecodePort&&this.videoDecodePort.close(),this.videoDecodePort=e.ports[0];break;case"close":break;case"sharedBuffer":s&&(this.g_sharedbuffer=s),this.g_sharedbuffer&&(this.encodeSAB=new h.b(this.g_sharedbuffer.inputState,this.g_sharedbuffer.inputBuffer,128*C,C),this.decodeSAB=new h.b(this.g_sharedbuffer.outputState,this.g_sharedbuffer.outputBuffer,128*D),this.g_sharedbuffer.echoState&&this.g_sharedbuffer.echoBuffer&&(this.echoSAB=new h.b(this.g_sharedbuffer.echoState,this.g_sharedbuffer.echoBuffer,128*D,D)),this.rtpSAB=new a(this.g_sharedbuffer.rtpBuffer,1200),this.decodeSAB.onCacheSizeChange=e=>{this.audioDecodePort&&this.audioDecodePort.postMessage({status:3,cacheSize:e,isSAB:!0})});break;default:console.warn("unhanle commands in audioworklet",t)}}handleMessageForNoSAB(e){const{status:t}=e.data;switch(t){case"encodeAudioPort":this.audioProcessBuffer.setEncodePort(e.ports[0]);break;case"decodeAudioPort":this.audioProcessBuffer.setDecodePort(e.ports[0]);break;case"close":this.audioProcessBuffer.close(),this.isPlaying=!1,this.isRunning=!1;break;default:console.warn("unhanle commands in audioworklet",t)}}onReceivedRTP(){}process(e,t,s){if(Z++,V)return!1;try{return d?b?this.SABDecodeProcess(e,t,s):this.SABProcess(e,t,s):this.NoSABprocess(e,t,s)}catch(e){return _workletPrinter.error("::process() exception: "+e.message+e.stack),!0}}NoSABprocess(e,t,s){return!!this.isRunning&&(!this.isPlaying||(this.inputDataForNoSAB(e),this.outputDataForNoSAB(t),!0))}inputDataForNoSAB(e){if(!e[0]||!e[0][0])return!0;let t=e[0];if(X+=t[0].length,!x&&e[0].length100&&(e=100);let t=this.rtpSAB.getReaderPtr(),s=0;for(;s{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":134217728/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="audio.simd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={1105068:$0=>{console.log("Audio Version: ",$0)},1105105:($0,$1)=>{send_data($0,$1)},1105128:($0,$1)=>{SAVE_IV($0,$1)},1105146:($0,$1,$2,$3)=>{audio_encode_frame_callback($0,$1,$2,$3)},1105195:($0,$1,$2)=>{Get_ExternalRecord($0,$1,$2)},1105231:()=>{return Date.now()},1105254:($0,$1)=>{update_play_time($0,$1)},1105284:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},1105331:($0,$1)=>{AudioWasmAdapter.onMonitorLogWASM($0,$1)},1105374:($0,$1)=>{AudioWasmAdapter.onAudioLevelWASM($0,$1)},1105417:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},1105457:($0,$1,$2,$3)=>{AudioWasmAdapter.onAPMProcessedPCMWASM($0,$1,$2,$3)},1105517:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105552:($0,$1,$2,$3)=>{pump_rtp_data($0,$1,$2,$3)},1105587:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseAudioQosData($0,$1,$2,$3,$4,$5,$6,$7)},1105642:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105679:($0,$1,$2,$3,$4)=>{sampleRateLog($0,$1,$2,$3,$4)},1105716:($0,$1,$2,$3,$4,$5,$6,$7)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7)},1105768:($0,$1)=>{get_edition($0,$1)},1105793:($0,$1)=>{SAVE_IV($0,$1)},1105811:($0,$1)=>{COMMIT_PRINT($0,$1)},1105833:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105869:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105905:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105941:($0,$1,$2,$3)=>{LOG_OUT_WEBRTC($0,$1,$2,$3)},1105977:($0,$1)=>{LOG_OUT($0,$1)},1105998:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 134217728}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _shmat(){err("missing function: shmat");abort(-1)}function _shmctl(){err("missing function: shmctl");abort(-1)}function _shmdt(){err("missing function: shmdt");abort(-1)}function _shmget(){err("missing function: shmget");abort(-1)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"memory":wasmMemory,"shmat":_shmat,"shmctl":_shmctl,"shmdt":_shmdt,"shmget":_shmget,"strftime":_strftime,"strftime_l":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Audio_Init=Module["__Audio_Init"]=function(){return(__Audio_Init=Module["__Audio_Init"]=Module["asm"]["_Audio_Init"]).apply(null,arguments)};var __Audio_UnInit=Module["__Audio_UnInit"]=function(){return(__Audio_UnInit=Module["__Audio_UnInit"]=Module["asm"]["_Audio_UnInit"]).apply(null,arguments)};var __Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=function(){return(__Deliver_Recorded_Data=Module["__Deliver_Recorded_Data"]=Module["asm"]["_Deliver_Recorded_Data"]).apply(null,arguments)};var __Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=function(){return(__Audio_Try_Analysis=Module["__Audio_Try_Analysis"]=Module["asm"]["_Audio_Try_Analysis"]).apply(null,arguments)};var __Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=function(){return(__Put_Pre_Aec_Data=Module["__Put_Pre_Aec_Data"]=Module["asm"]["_Put_Pre_Aec_Data"]).apply(null,arguments)};var __Set_Aec_Delay=Module["__Set_Aec_Delay"]=function(){return(__Set_Aec_Delay=Module["__Set_Aec_Delay"]=Module["asm"]["_Set_Aec_Delay"]).apply(null,arguments)};var __ReSet_Aec=Module["__ReSet_Aec"]=function(){return(__ReSet_Aec=Module["__ReSet_Aec"]=Module["asm"]["_ReSet_Aec"]).apply(null,arguments)};var __Get_Aec_Delay=Module["__Get_Aec_Delay"]=function(){return(__Get_Aec_Delay=Module["__Get_Aec_Delay"]=Module["asm"]["_Get_Aec_Delay"]).apply(null,arguments)};var __Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=function(){return(__Request_Audio_Qos_Data=Module["__Request_Audio_Qos_Data"]=Module["asm"]["_Request_Audio_Qos_Data"]).apply(null,arguments)};var __Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=function(){return(__Get_Mixed_Audio=Module["__Get_Mixed_Audio"]=Module["asm"]["_Get_Mixed_Audio"]).apply(null,arguments)};var __Get_Audio_Edition=Module["__Get_Audio_Edition"]=function(){return(__Get_Audio_Edition=Module["__Get_Audio_Edition"]=Module["asm"]["_Get_Audio_Edition"]).apply(null,arguments)};var __Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=function(){return(__Audio_Set_Data_Encryption=Module["__Audio_Set_Data_Encryption"]=Module["asm"]["_Audio_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Cooker_info=Module["__Add_Cooker_info"]=function(){return(__Add_Cooker_info=Module["__Add_Cooker_info"]=Module["asm"]["_Add_Cooker_info"]).apply(null,arguments)};var __Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=function(){return(__Remove_Cooker_Info=Module["__Remove_Cooker_Info"]=Module["asm"]["_Remove_Cooker_Info"]).apply(null,arguments)};var __Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=function(){return(__Get_Audio_Meat_Weight=Module["__Get_Audio_Meat_Weight"]=Module["asm"]["_Get_Audio_Meat_Weight"]).apply(null,arguments)};var __Change_Aec_Flag=Module["__Change_Aec_Flag"]=function(){return(__Change_Aec_Flag=Module["__Change_Aec_Flag"]=Module["asm"]["_Change_Aec_Flag"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Cc_Set_Lang=Module["__Cc_Set_Lang"]=function(){return(__Cc_Set_Lang=Module["__Cc_Set_Lang"]=Module["asm"]["_Cc_Set_Lang"]).apply(null,arguments)};var __Interpretation_Configure=Module["__Interpretation_Configure"]=function(){return(__Interpretation_Configure=Module["__Interpretation_Configure"]=Module["asm"]["_Interpretation_Configure"]).apply(null,arguments)};var __Start_Audio_Share=Module["__Start_Audio_Share"]=function(){return(__Start_Audio_Share=Module["__Start_Audio_Share"]=Module["asm"]["_Start_Audio_Share"]).apply(null,arguments)};var __InsertShareData=Module["__InsertShareData"]=function(){return(__InsertShareData=Module["__InsertShareData"]=Module["asm"]["_InsertShareData"]).apply(null,arguments)};var __Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=function(){return(__Set_Share_Volume_Level=Module["__Set_Share_Volume_Level"]=Module["asm"]["_Set_Share_Volume_Level"]).apply(null,arguments)};var __Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=function(){return(__Set_Speech_Volume_Level=Module["__Set_Speech_Volume_Level"]=Module["asm"]["_Set_Speech_Volume_Level"]).apply(null,arguments)};var __Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=function(){return(__Set_All_Speech_Volume_Level=Module["__Set_All_Speech_Volume_Level"]=Module["asm"]["_Set_All_Speech_Volume_Level"]).apply(null,arguments)};var __Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=function(){return(__Update_Monitor_Send_Audio_Info=Module["__Update_Monitor_Send_Audio_Info"]=Module["asm"]["_Update_Monitor_Send_Audio_Info"]).apply(null,arguments)};var __Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=function(){return(__Update_Monitor_Receive_Audio_Info=Module["__Update_Monitor_Receive_Audio_Info"]=Module["asm"]["_Update_Monitor_Receive_Audio_Info"]).apply(null,arguments)};var __Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=function(){return(__Set_Audio_Encryption_Key_Directly=Module["__Set_Audio_Encryption_Key_Directly"]=Module["asm"]["_Set_Audio_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=function(){return(__Enable_Share_To_Bo=Module["__Enable_Share_To_Bo"]=Module["asm"]["_Enable_Share_To_Bo"]).apply(null,arguments)};var __Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=function(){return(__Enable_Broadcast_To_Bo=Module["__Enable_Broadcast_To_Bo"]=Module["asm"]["_Enable_Broadcast_To_Bo"]).apply(null,arguments)};var __Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=function(){return(__Set_Audio_Pipe_To_Bo=Module["__Set_Audio_Pipe_To_Bo"]=Module["asm"]["_Set_Audio_Pipe_To_Bo"]).apply(null,arguments)};var __Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=function(){return(__Enable_Pipe_OUT_RTP=Module["__Enable_Pipe_OUT_RTP"]=Module["asm"]["_Enable_Pipe_OUT_RTP"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __setMultiViewFlag=Module["__setMultiViewFlag"]=function(){return(__setMultiViewFlag=Module["__setMultiViewFlag"]=Module["asm"]["_setMultiViewFlag"]).apply(null,arguments)};var __Switch_Denoise=Module["__Switch_Denoise"]=function(){return(__Switch_Denoise=Module["__Switch_Denoise"]=Module["asm"]["_Switch_Denoise"]).apply(null,arguments)};var __Switch_Original_Sound=Module["__Switch_Original_Sound"]=function(){return(__Switch_Original_Sound=Module["__Switch_Original_Sound"]=Module["asm"]["_Switch_Original_Sound"]).apply(null,arguments)};var __Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=function(){return(__Switch_High_Bitrate=Module["__Switch_High_Bitrate"]=Module["asm"]["_Switch_High_Bitrate"]).apply(null,arguments)};var __Heartbeat=Module["__Heartbeat"]=function(){return(__Heartbeat=Module["__Heartbeat"]=Module["asm"]["_Heartbeat"]).apply(null,arguments)};var __MuteUnmuteState=Module["__MuteUnmuteState"]=function(){return(__MuteUnmuteState=Module["__MuteUnmuteState"]=Module["asm"]["_MuteUnmuteState"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiiji=Module["dynCall_iiiji"]=function(){return(dynCall_iiiji=Module["dynCall_iiiji"]=Module["asm"]["dynCall_iiiji"]).apply(null,arguments)};var dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=function(){return(dynCall_iiiiiijiii=Module["dynCall_iiiiiijiii"]=Module["asm"]["dynCall_iiiiiijiii"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_jiii=Module["dynCall_jiii"]=function(){return(dynCall_jiii=Module["dynCall_jiii"]=Module["asm"]["dynCall_jiii"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); + +} \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_media.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_media.min.js new file mode 100644 index 0000000..ceec031 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_media.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("disk-file-writer")):"function"==typeof define&&define.amd?define("JsMediaSDK_Instance",["disk-file-writer"],t):"object"==typeof exports?exports.JsMediaSDK_Instance=t(require("disk-file-writer")):e.JsMediaSDK_Instance=t(e["disk-file-writer"])}(window,(function(t){return function(e){function t(t){for(var i,r,n=t[0],o=t[1],s=0,u=[];s0&&void 0!==arguments[0]?arguments[0]:"";this.name=e,this.handler=null,this.wasm=null,this.socket=null,this.defered=new n.Deferred,this.initSuccessPromise=this.defered.promise,this.wasmDefered=new n.Deferred,this.wasmSuccessPromise=this.wasmDefered.promise,this.handlerDefered=new n.Deferred,this.handlerSuccessPromise=this.handlerDefered.promise,this.socketDefered=new n.Deferred,this.socketSuccessPromise=this.socketDefered.promise,Promise.all([this.wasmSuccessPromise,this.handlerSuccessPromise,this.socketSuccessPromise]).then(e=>{let t=e.every(e=>!0===e);this.defered.resolve(t),t||s.error(this.name,{handler:this.handler,wasm:this.wasm,socket:this.socket})})}setHanderSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.handler=e,this.handlerDefered.resolve(e)}setWasmSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.wasm=e,this.wasmDefered.resolve(e)}setSocketSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.socket=e,this.socketDefered.resolve(e)}checkInitSuccess(){let e=this.handler&&this.wasm&&this.socket;return e&&this.defered.resolve(!0),e}isSocketInitSuccess(){return this.socket}waitforInitSuccess(){return this.initSuccessPromise}resetHandleDeferred(){this.setHanderSuccess(!0),this.handlerDefered=new n.Deferred,this.handlerSuccessPromise=this.handlerDefered.promise}}class u extends d{constructor(e){super(e)}}class l extends d{constructor(e){super(e)}}class c extends d{constructor(e){super(e)}}var h=i(5),f=i(4);const p=Object(o.a)("sdk.variables");function _(){this.crashCount=0,this.crashLastTime=0,this.AEW=null,this.ADW=null,this.AEWF=null,this.ADWF=null,this.VE=null,this.VD=null,this.SE=null,this.SD=null,this.VEMTimes=0,this.VDMTimes=0,this.SEMTimes=0,this.SDMTimes=0,this.extVBPort=null,this.frameSent=0,this.frameReceived=0,this.peerConnectionCannotConnectTimes=0}_.prototype.initDB=function(){let e,t={},i=this;t.init=function(a){if(this.db_name=a.db_name,this.db_version=a.db_version,this.db_store_name=a.db_store_name,indexedDB){try{e=indexedDB.open(this.db_name,this.db_version)}catch(e){return r.default.error("Error opening IndexedDB",e),void(i.indexDbObject=null)}e.onerror=function(e){i.indexDbObject=null},e.onupgradeneeded=function(e){this.db=e.target.result,this.db.createObjectStore(t.db_store_name)},e.onsuccess=function(e){t.db=e.target.result,i.openIndexFlag=!0,i.indexDbObject.select("delay")}}else i.indexDbObject=null},t.put=function(e,i){try{var a=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).put(e,i);a.onsuccess=function(){},a.onerror=function(e){r.default.error("Set Delay failed!",e)}}catch(e){r.default.error("IndexDb put Failed!",e)}},t.delete=function(i){e=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).delete(i),e.onsuccess=function(){p("Delete the key:"+i)}},t.select=function(e){try{var a=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name);if(e)var n=a.get(e);else n=a.getAll();n.onsuccess=function(){i.audioDelay=n.result},n.onerror=function(){i.audioDelay=0}}catch(e){r.default.error("IndexDb Select Failed",e)}},t.clear=function(){t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).clear().onsuccess=function(){p("Clear the IndexDb Successfully")}},t.close=function(){t.db&&t.db.close()},this.indexDbObject=t,this.indexDbObject.init({db_name:"AEC",db_version:1,db_store_name:"delay"})},_.prototype.Notify_APPUI_SAFE=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;ae.apply(this,i)))},_.prototype.Notify_APPUI=_.prototype.Notify_APPUI_SAFE,_.prototype.queueMessageToRwg=function(e,t){this.rwgMessageList.push({jsEvent:e,message:t})},_.prototype.clearMessageToRwg=function(){f.default.startSend(),this.rwgConnectSuccess=!0,this.rwgMessageList.length>0&&(this.rwgAgent||this._Notify_APPUI)&&(this.rwgMessageList.forEach(e=>{let{jsEvent:t,message:i}=e;this.sendMessageToRwg(t,i,!1,!1)}),this.rwgMessageList=[])},_.prototype.destroyQueueMessageToRwg=function(){this.rwgConnectSuccess=!1,this.rwgMessageList=[]},_.prototype.sendMessageToRwg=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(this.rwgConnectSuccess&&(this.rwgAgent||this._Notify_APPUI)||!i){this.rwgConnectSuccess&&a&&this.clearMessageToRwg();try{this.rwgAgent?this.rwgAgent.sendMessageToRwg(t):this.Notify_APPUI_SAFE(e,t)}catch(e){r.default.error("Error sending message to RWG",e)}}else this.queueMessageToRwg(e,t)},_.prototype.reinit=function(e){this.instance=e,this.SPECIAL_ID=0,this._callbackList=[],this._Notify_APPUI=null,this.localAudioDecMGR=null,this.localVideoDecMGR=null,this.localAudioEncMGR=null,this.localVideoEncMGR=null,this.localSharingDecMGR=null,this.localMouseDecMGR=null,this.localSharingEncMGR=null,this.localAudioPara=null,this.localVideoPara={},this.localSharingPara=null,this.Audio_WebSocket_Ip_Address=null,this.Audio_Web_Transport_Ip_Address=null,this.Video_WebSocket_Ip_Address=null,this.Video_Web_Transport_Ip_Address=null,this.Sharing_WebSocket_Ip_Address=null,this.mediaSDKHandle=null,this.audio_pcm_queue=new a.a,this.int16Array=null,this.isInitialFailed=!1,this.isAudioEncodeWASMOK=!1,this.isAudioDecodeWASMOK=!1,this.isVideoEncodeWASMOK=!1,this.isVideoDecodeWASMOK=!1,this.isSharingDecodeWASMOK=!1,this.isSharingEncodeWASMOK=!1,this.audioEncWorkerPath="",this.audioDecWorkerPath="",this.videoDecWorkerPath="",this.videoEncWorkerPath="",this.sharingDecWorkerPath="",this.sharingEncWorkerPath="",this.audioEncodeSession=null,this.audioDecodeSession=null,this.videoDecodeSession=null,this.videoEncodeSession=null,this.sharingDecodeSession=null,this.sharingEncodeSession=null,this.isAudioEncodeThreadStart=!1,this.isAudioDecodeThreadStart=!1,this.isVideoDecodeThreadStart=!1,this.isSharingDecodeThreadStart=!1,this.isVideoEncodeThreadStart=!1,this.isSharingEncodeThreadStart=!1,this.isAudioPlayWork=!1,this.isVideoPlayWork=!1,this.isSharingPlayWork=!1,this.shareBufferSampleNumb=30,this.audioWasmInfo=null,this.initialSuccessNumb=0,this.TotalWaitEvent=0,this.audioPostInterval=null,this.sharedBuffer=null,this.decoderinworklet=null,this.decoderinworkletOP=null,this.chromeWideAEC=null,this.shareSystemAudio=!1,this.indexDbObject=null,this.audioDelay=0,this.openIndexFlag=!1,this.audioBufferSize=n.default.browser.isFirefox?30:15,this.monitorIntervalHandle=null,this.e2eencrypt=!1,this.AudioNode=null,this.SharingAudioNode=null,this.CurrentSSRC=0,this.CurrentSSRCTime=0,this.audioPlayTime=0,this.videoDecResponseText=null,this.videoEncResponseText=null,this.sharingDecodeResponse=null,this.sharingEncodeResponse=null,this.sharingDecInitInstance=new u(h.f.SHARING_DECODE),this.sharingEncInitInstance=new u(h.f.SHARING_ENCODE),this.videoDecInitInstance=new l(h.f.VIDEO_DECODE),this.videoInitInstance=new l(h.f.VIDEO_ENCODE),this.audioDecInitInstance=new c(h.f.AUDIO_DECODE),this.audioEncodeInitInstance=new c(h.f.AUDIO_ENCODE),this.audioDecodeResponse=null,this.audioEncodeResponse=null,this.ivObj={},this.userNodeList=[],this.rwgAgent=null,this.ComputerAudioStatus=h.a.ComputerAudio_Null,this.DesktopAudioStatus=h.a.DesktopAudio_Null,this.initDB(),this.resourceManager=null,this.vbarraybuffer=null,this.vbbin=null,this.vbjson=null,this.tfjsurl=null,this.afnbin=null,this.afnjson=null,this.basebin=null,this.basejson=null,this.workletMessageQueue=new a.a,this.workletWasmInitSuccess=!1,this.videoEncodeInitSuccess=null,this.vbPreloadSuccess=null,this.enableAduioBridge=!1,this.audioMode=-1,this.enableEchoDetection=0,this.enableHADecOpt=0,this.enableSafariHWCodec=0,this.enable360pHWDec=0,this.enable360pHWEnc=0,this.enableAndroidHWCodec=0,this.disableHWCodec=0,this.enableOptCopyFrame=0,this.enableTransferDataChannel=0,this.enableCanvasAlphaChannel=!0,this.enableWebrtcTurnServer=!1,this.VEMTimes=0,this.VDMTimes=0,this.SEMTimes=0,this.SDMTimes=0,this.isPreviewMode={audioEncode:!1,audioDecode:!1,videoEncode:!1,videoDecode:!1},this.rwgConnectSuccess=!1,this.rwgMessageList=[],this.localSsrc=0,this.frameSent=0,this.frameReceived=0};let m=new _;t.default=m},function(e,t,i){var a=i(87),r=i(46);e.exports=function(e,t){var i=r(e,t,"get");return a(e,i)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){"use strict";i.r(t),i.d(t,"START_MEDIA",(function(){return a})),i.d(t,"ADD_RENDER_VIDEO",(function(){return r})),i.d(t,"STOP_RENDER_VIDEO",(function(){return n})),i.d(t,"START_CAPTURE_VIDEO",(function(){return o})),i.d(t,"STOP_CAPTURE_VIDEO",(function(){return s})),i.d(t,"ADD_RENDER_AUDIO",(function(){return d})),i.d(t,"STOP_RENDER_AUDIO",(function(){return u})),i.d(t,"UNMUTE_AUDIO",(function(){return l})),i.d(t,"MUTE_AUDIO",(function(){return c})),i.d(t,"CHANGE_FRAME_RATE",(function(){return h})),i.d(t,"CHANGE_VIDEO_RESOLUTION",(function(){return f})),i.d(t,"CHANGE_AUDIO_SPEAKER",(function(){return p})),i.d(t,"CHANGE_VIDEO_CAPTURE_DEVICE",(function(){return _})),i.d(t,"CHANGE_CURRENT_ACTIVE_SSRC",(function(){return m})),i.d(t,"REMOVE_AUDIO_CAPTURE",(function(){return g})),i.d(t,"LEAVE_MEETING",(function(){return E})),i.d(t,"MEETING_FAIL_OVER",(function(){return S})),i.d(t,"END_MEDIA",(function(){return v})),i.d(t,"CHANGE_AUDIO_MIC",(function(){return C})),i.d(t,"WEBRTC_RESTART",(function(){return A})),i.d(t,"REMOVE_RENDER_AUDIO",(function(){return T})),i.d(t,"LEAVE_COMPUTER_AUDIO",(function(){return R})),i.d(t,"JOIN_COMPUTER_AUDIO",(function(){return I})),i.d(t,"START_SHARING",(function(){return b})),i.d(t,"STOP_SHARING",(function(){return O})),i.d(t,"SWITCH_CANVAS_FOR_VIDEO_CAPTURE",(function(){return D})),i.d(t,"START_REMOTE_CONTROL",(function(){return w})),i.d(t,"UPDATE_REMOTE_CONTROL_PROPERTIES",(function(){return y})),i.d(t,"CANCEL_REMOTE_CONTROL",(function(){return M})),i.d(t,"UPDATE_SUBSCRIBE_VIDEO",(function(){return P})),i.d(t,"START_DESKTOP_SHARING",(function(){return N})),i.d(t,"START_SHARING_WHITEBOARD",(function(){return V})),i.d(t,"STOP_DESKTOP_SHARING",(function(){return k})),i.d(t,"STOP_SHARING_WHITEBOARD",(function(){return U})),i.d(t,"PAUSE_DESKTOP_SHARING",(function(){return L})),i.d(t,"RESUME_DESKTOP_SHARING",(function(){return x})),i.d(t,"CHECK_CHROME_SHARING_EXTENSION",(function(){return W})),i.d(t,"SWITCH_CANVAS_FOR_SHARING_CAPTURE",(function(){return B})),i.d(t,"CHANGE_CURRENT_SHARING_ACTIVE_SSRC",(function(){return G})),i.d(t,"COMMAND_SOCKET_MESSAGE_NOTIFY",(function(){return F})),i.d(t,"RESEND_REMOTE_CONTROL_POSITION_PDU",(function(){return H})),i.d(t,"AES_GCM_IV_VALUE",(function(){return K})),i.d(t,"USER_NODE_LIST",(function(){return j})),i.d(t,"UPDATE_SHARING_DECODE_PARAM",(function(){return Y})),i.d(t,"PAUSE_OR_RESUME_AUDIO_DECODE",(function(){return q})),i.d(t,"UPDATE_CANVAS_SIZE",(function(){return X})),i.d(t,"CLEAR_CANVAS",(function(){return Q})),i.d(t,"ZOOM_RENDER",(function(){return z})),i.d(t,"CHANGE_SHARING_2ND_VIDEO_CAPTUREVIDEO_DEVICE",(function(){return J})),i.d(t,"SET_OTHER_AUDIO_VOLUME_LEVEL",(function(){return Z})),i.d(t,"USER_NODE_AUDIO_STATUS_LIST",(function(){return $})),i.d(t,"UPDATE_MASK_CANVAS_SIZE",(function(){return ee})),i.d(t,"MOVE_PTZ_CAMERA",(function(){return te})),i.d(t,"START_STOP_REMOTE_CONTROL_CHECK",(function(){return ie})),i.d(t,"SEND_REMOTE_CONTROL_QR_CODE",(function(){return ae})),i.d(t,"AUDIO_CC_SELECT_LANGUAGE",(function(){return re})),i.d(t,"AUIOD_INTERPRETATION_MUTE",(function(){return ne})),i.d(t,"AUDIO_INTERPRETATION_SELECT_LANGUAGE",(function(){return oe})),i.d(t,"AUDIO_INTERPRETATION_LIST_INFO",(function(){return se})),i.d(t,"AUDIO_INTERPRETATION_ENABLE",(function(){return de})),i.d(t,"VIDEO_MASK_SETTING",(function(){return ue})),i.d(t,"UPDATE_BG_IMAGE",(function(){return le})),i.d(t,"UPDATE_MASK_INFO",(function(){return ce})),i.d(t,"FINISH_MASK_SETTING",(function(){return he})),i.d(t,"START_VIDEO_STREAM_IN_MASK_SETTING_SUCCESS",(function(){return fe})),i.d(t,"VIDEO_ENABLE_DECODE_HW",(function(){return pe})),i.d(t,"VIDEO_ENABLE_ENCODE_HW",(function(){return _e})),i.d(t,"JOIN_DESKTOP_AUDIO",(function(){return me})),i.d(t,"LEAVE_DESKTOP_AUDIO",(function(){return ge})),i.d(t,"SET_DESKTOP_VOLUME",(function(){return Ee})),i.d(t,"MIRROR_MY_VIDEO",(function(){return Se})),i.d(t,"REMOVE_EXPIRED_CANVAS",(function(){return ve})),i.d(t,"WEBGL_LOST_REPLACE_CANVAS",(function(){return Ce})),i.d(t,"UPDATE_VIDEO_QUALITY",(function(){return Ae})),i.d(t,"SEND_RENDER_LOG",(function(){return Te})),i.d(t,"USER_NODE_LIST_IN_MAIN_SESSION",(function(){return Re})),i.d(t,"UPDATE_MEDIA_PARAMS",(function(){return Ie})),i.d(t,"SHARING_ADD_REV_CHANNEL_TYPE",(function(){return be})),i.d(t,"SHARING_REMOVE_REV_CHANNEL_TYPE",(function(){return Oe})),i.d(t,"BUILD_MS_CHANNEL_IN_BO",(function(){return De})),i.d(t,"BUILD_MA_CHANNEL_IN_BO",(function(){return we})),i.d(t,"ENABLE_SHARE_TO_BO",(function(){return ye})),i.d(t,"ENABLE_BROADCAST_TO_BO",(function(){return Me})),i.d(t,"SWITCH_WATER_MARK_FLAG",(function(){return Pe})),i.d(t,"START_VIDEO_VB_SETTING",(function(){return Ne})),i.d(t,"UPDATE_VIDEO_VB_BG_IMAGE",(function(){return Ve})),i.d(t,"STOP_VIDEO_VB_SETTING",(function(){return ke})),i.d(t,"START_VIDEO_STREAM_IN_VB_SETTING_SUCCESS",(function(){return Ue})),i.d(t,"SWITCH_MASK_AND_VB",(function(){return Le})),i.d(t,"VB_MODEL_PRELOADING_3S",(function(){return xe})),i.d(t,"VB_MODEL_PRELOADING_10S",(function(){return We})),i.d(t,"VB_MODEL_PRELOADING_OK",(function(){return Be})),i.d(t,"ENABLE_VIDEO_OBSERVER",(function(){return Ge})),i.d(t,"SWITCH_SHARING_TYPE",(function(){return Fe})),i.d(t,"CHANGE_HID_ENABLE",(function(){return He})),i.d(t,"ADD_VIDEO_VB_SETTING_DOM",(function(){return Ke})),i.d(t,"REMOVE_VIDEO_VB_SETTING_DOM",(function(){return je})),i.d(t,"NEW_ACTIVE_SPEAKER_SSRC",(function(){return Ye})),i.d(t,"NEW_ACTIVE_SPEAKER_FIRST_FRAME_CALLBACK",(function(){return qe})),i.d(t,"CANCEL_NEW_ACTIVE_SPEAKER_BEFORE_CALL_BACK",(function(){return Xe})),i.d(t,"NOTIFY_SDK_JOIN_RWG_SUCCESS",(function(){return Qe})),i.d(t,"AUDIO_BRIDGE_FIRST_RECV_DATA",(function(){return ze})),i.d(t,"AUDIO_BRIDGE_CAN_SEND_DATA",(function(){return Je})),i.d(t,"FIRST_VIDEO_FRAME",(function(){return Ze})),i.d(t,"PREVIEW_INIT_VIDEO_DECODE_SUCCESS",(function(){return $e})),i.d(t,"PREVIEW_INIT_AUDIO_DECODE_SUCCESS",(function(){return et})),i.d(t,"WHITEBOARD_JOIN_MESSAGE",(function(){return tt})),i.d(t,"AUDIO_DENOISE_SWITCH",(function(){return it})),i.d(t,"SET_CODEC_MODE",(function(){return at})),i.d(t,"STOP_AUDIO_INCOMING",(function(){return rt})),i.d(t,"MOBILE_ROTATE",(function(){return nt})),i.d(t,"SAVE_LOCAL_LOG",(function(){return ot})),i.d(t,"CHANGE_AUDIO_PROFILE",(function(){return st})),i.d(t,"AUDIO_JOIN_SUCCESS",(function(){return dt})),i.d(t,"RWG_COMMAND_BYPASS_TO_WCL",(function(){return ut})),i.d(t,"SHARE_2ND_AUDIO_CAPTURE_DEVICE",(function(){return lt})),i.d(t,"SUBSCRIBE_VIDEO",(function(){return ct})),i.d(t,"UNSUBSCRIBE_VIDEO",(function(){return ht})),i.d(t,"UI_SUBSCRIBE_VIDEO",(function(){return ft})),i.d(t,"UI_UNSUBSCRIBE_VIDEO",(function(){return pt})),i.d(t,"MOBILE_CAPTURE_DEVICE_CHANGE",(function(){return _t})),i.d(t,"ON_HOLD",(function(){return mt})),i.d(t,"SET_ALL_SPEECH_VOLUME",(function(){return gt})),i.d(t,"ENABLE_FILE_AUDIO_PLAYBACK_LOCALLY",(function(){return Et})),i.d(t,"START_ANNOTATION_A",(function(){return St})),i.d(t,"ANNOTATION_ACTIONS",(function(){return vt})),i.d(t,"STOP_ANNOTATION_A",(function(){return Ct})),i.d(t,"START_ANNOTATION_SUCCESS",(function(){return At})),i.d(t,"DEVICE_CHANGE_EVENT",(function(){return Tt})),i.d(t,"RECAPTURE_AUDIO",(function(){return Rt})),i.d(t,"REQUEST_PERMISSION",(function(){return It})),i.d(t,"REQUEST_PERMISSION_RESULT",(function(){return bt})),i.d(t,"REQUEST_PERMISSIOM_POP_REMINDER",(function(){return Ot})),i.d(t,"INIT_SUCCESS",(function(){return Dt})),i.d(t,"INIT_SUCCESS_VIDEO",(function(){return wt})),i.d(t,"INIT_SUCCESS_AUDIO",(function(){return yt})),i.d(t,"INIT_SUCCESS_SHARING",(function(){return Mt})),i.d(t,"USER_GRANT_CAPTURE_AUDIO",(function(){return Pt})),i.d(t,"CURRENT_VIDEO_RESOLUTION",(function(){return Nt})),i.d(t,"SHARING_DEC_THREAD_OK",(function(){return Vt})),i.d(t,"SHARING_DATA",(function(){return kt})),i.d(t,"SHARING_PARA",(function(){return Ut})),i.d(t,"SHARING_MORE_INFO",(function(){return Lt})),i.d(t,"VIDEO_DECODE_MAX_SIZE",(function(){return xt})),i.d(t,"CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT",(function(){return Wt})),i.d(t,"START_VIDEO_CAPTURE_SUCCESS",(function(){return Bt})),i.d(t,"STOP_VIDEO_CAPTURE_SUCCESS",(function(){return Gt})),i.d(t,"START_REMOTE_CONTROL_SUCCESS",(function(){return Ft})),i.d(t,"CANCEL_REMOTE_CONTROL_SUCCESS",(function(){return Ht})),i.d(t,"REMOTE_CONTROL_COPIED_TEXT_NOTIFY",(function(){return Kt})),i.d(t,"MONITOR_LOG",(function(){return jt})),i.d(t,"CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT",(function(){return Yt})),i.d(t,"DESKTOP_SHARING_CAPTURE_SUCCESS",(function(){return qt})),i.d(t,"CHECK_CHROME_SHARING_EXTENSION_RESPONSE",(function(){return Xt})),i.d(t,"SHARING_DECODE_MAX_SIZE",(function(){return Qt})),i.d(t,"REQUEST_AUDIO_BRIDGE_TOKEN",(function(){return zt})),i.d(t,"SEND_MESSAGE_TO_RWG",(function(){return Jt})),i.d(t,"AES_GCM_IV_RESPONSE",(function(){return Zt})),i.d(t,"SHARING_DESKTOP_STREAM_HAVE_AUDIO",(function(){return $t})),i.d(t,"JOIN_COMPUTER_AUDIO_COMPLETE",(function(){return ei})),i.d(t,"JOIN_DESKTOP_AUDIO_COMPLETE",(function(){return ti})),i.d(t,"LEAVE_COMPUTER_AUDIO_COMPLETE",(function(){return ii})),i.d(t,"LEAVE_DESKTOP_AUDIO_COMPLETE",(function(){return ai})),i.d(t,"HID_STATUS_MUTE",(function(){return ri})),i.d(t,"HID_STATUS_OFF_HOOK",(function(){return ni})),i.d(t,"WB_MESSAGE",(function(){return oi})),i.d(t,"AUDIO_STREAM_FAILED",(function(){return si})),i.d(t,"VIDEO_STREAM_FAILED",(function(){return di})),i.d(t,"AUDIO_SPEAKER_SET_SUCCESS",(function(){return ui})),i.d(t,"FIRST_IOS_FRAME",(function(){return li})),i.d(t,"AUDIOBRIDGE_EBABLE_SHARE_TO_BO_SUCCESS",(function(){return ci})),i.d(t,"AUDIOBRIDGE_SET_CC_LANG_SUCCESS",(function(){return hi})),i.d(t,"AUDIOBRIDGE_ENABLE_BROADCAST_TO_BO_SUCCESS",(function(){return fi})),i.d(t,"AUDIO_LEVEL_INDICATOR",(function(){return pi})),i.d(t,"SYNC_RENDERER_TYPE_RESPONSE",(function(){return _i})),i.d(t,"INIT_FAILED",(function(){return mi})),i.d(t,"INIT_FAILED_VIDEO",(function(){return gi})),i.d(t,"INIT_FAILED_AUDIO",(function(){return Ei})),i.d(t,"INIT_FAILED_SHARING",(function(){return Si})),i.d(t,"AUDIO_CAPTURE_FAILED",(function(){return vi})),i.d(t,"AUDIO_WEBSOCKET_BROKEN",(function(){return Ci})),i.d(t,"VIDEO_WEBSOCKET_BROKEN",(function(){return Ai})),i.d(t,"SHARING_DEC_THREAD_FAILED",(function(){return Ti})),i.d(t,"AUDIO_ZERO_DATA",(function(){return Ri})),i.d(t,"AUDIO_CTX_SAMPLERATE",(function(){return Ii})),i.d(t,"USER_FORBIDDED_CAPTURE_VIDEO",(function(){return bi})),i.d(t,"USER_CAMERA_IS_TAKEN_BY_OTHER_PROGRAMS",(function(){return Oi})),i.d(t,"STOP_VIDEO_CAPTURE_FAILED",(function(){return Di})),i.d(t,"START_REMOTE_CONTROL_FAILED",(function(){return wi})),i.d(t,"CANCEL_REMOTE_CONTROL_FAILED",(function(){return yi})),i.d(t,"REMOTE_CONTROL_PASTE_TEXT_LENGTH_OVERFLOW",(function(){return Mi})),i.d(t,"USER_STOP_DESKTOP_SHARING",(function(){return Pi})),i.d(t,"USER_CANCEL_PERMISSION_REQUEST",(function(){return Ni})),i.d(t,"DESKTOP_SHARING_CHROME_EXTENSION_UNINSTALLED",(function(){return Vi})),i.d(t,"DESKTOP_SHARING_PERMISSION_DENIED",(function(){return ki})),i.d(t,"DESKTOP_SHARING_TIME_OUT",(function(){return Ui})),i.d(t,"DESKTOP_SHARING_ERROR",(function(){return Li})),i.d(t,"AUDIO_SPEAKER_SET_ERROR",(function(){return xi})),i.d(t,"DESKTOP_SHARING_SYSTEM_ERROR",(function(){return Wi})),i.d(t,"AUDIO_CLIPPING",(function(){return Bi})),i.d(t,"AUDIO_AUTO_PLAY_FAILED",(function(){return Gi})),i.d(t,"WCL_SIP_WEBSOCKET_CONNECT_ERROR",(function(){return Fi})),i.d(t,"SHARING_DESKTOP_STREAM_HAVE_NO_AUDIO",(function(){return Hi})),i.d(t,"WCL_AUDIO_BRIDGE_RECONNECT_START",(function(){return Ki})),i.d(t,"WCL_AUDIO_BRIDGE_RECONNECT_END",(function(){return ji})),i.d(t,"WEBGL_LOST_IN_MULTI_VIEW",(function(){return Yi})),i.d(t,"MASK_SETTING_PARA_ERROR",(function(){return qi})),i.d(t,"VIDEO_VB_SETTING_PARA_ERROR",(function(){return Xi})),i.d(t,"NOTIFY_UI_FAILOVER",(function(){return Qi})),i.d(t,"AUDIO_CONNECT_HID_JOIN_FAILED",(function(){return zi})),i.d(t,"JOIN_COMPUTER_AUDIO_FAILURE",(function(){return Ji})),i.d(t,"AUDIOBRIDGE_EBABLE_BROADCAST_TO_BO_FAILURE",(function(){return Zi})),i.d(t,"AUDIOBRIDGE_SET_CC_LANG_FAILURE",(function(){return $i})),i.d(t,"AUDIOBRIDGE_EBABLE_SHARE_TO_BO_FAILURE",(function(){return ea})),i.d(t,"AUDIO_MIC_SET_ERROR",(function(){return ta})),i.d(t,"NOTIFY_UI_WMSC_FAILOVER",(function(){return ia})),i.d(t,"NOTIFY_UI_WMSC_WSS_DISCONNECTED",(function(){return aa})),i.d(t,"RECOVER_WEBRTC_AUDIO",(function(){return ra})),i.d(t,"MEDIA_RECONNECT",(function(){return na})),i.d(t,"WEBGL_CONTEXT_INVALID",(function(){return oa})),i.d(t,"WASM_MEMORY_FAIL",(function(){return sa})),i.d(t,"LOST_CAMERA_ACCESS",(function(){return da})),i.d(t,"WORKLET_PROCESS_EXCEPTIONS",(function(){return ua})),i.d(t,"VB_PROCESS_IMAGE_FAIL",(function(){return la})),i.d(t,"MEDIA_HEALTH_CHECK_FAILED",(function(){return ca})),i.d(t,"START_ANNOTATION_FAILED",(function(){return ha})),i.d(t,"AUDIO_SENT_BYTES_ZERO",(function(){return fa})),i.d(t,"AUDIO_STOP",(function(){return pa})),i.d(t,"AUDIO_START",(function(){return _a})),i.d(t,"AUDIO_REMOVE",(function(){return ma})),i.d(t,"AUDIO_ILLEGAL",(function(){return ga})),i.d(t,"SHARING_PARAM_INFO_FROM_SOCKET",(function(){return Ea})),i.d(t,"ZOOM_CONNECTION_VIDEO_OFFER_EVT",(function(){return Sa})),i.d(t,"ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT",(function(){return va})),i.d(t,"ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT",(function(){return Ca})),i.d(t,"ZOOM_CONNECTION_REMOVE_UDP_EVT",(function(){return Aa})),i.d(t,"EVT_TYPE_WS_VIDEO_DATACHANNEL_ANSWER",(function(){return Ta})),i.d(t,"WS_CONF_AB_TOKEN_REQ",(function(){return Ra})),i.d(t,"WS_CONF_AB_TOKEN_RES",(function(){return Ia})),i.d(t,"WS_CONF_END_INDICATION",(function(){return ba})),i.d(t,"WS_VIDEO_MULTI_SUBSCRIBE_REQ",(function(){return Oa})),i.d(t,"WS_VIDEO_MULTI_UNSUBSCRIBE_REQ",(function(){return Da})),i.d(t,"RWG_MONITOR_LOG_EVENT",(function(){return wa})),i.d(t,"WS_CONF_WCL_SET_FULL_HD_REQ",(function(){return ya})),i.d(t,"PUBSUB_EVT",(function(){return Ma})),i.d(t,"SHARING_FIRST_DECODE_FRAME_RECEIVED_SSRC",(function(){return Pa})),i.d(t,"MEDIA_CONNECTED",(function(){return Na})),i.d(t,"HAVE_NO_WATERMARK",(function(){return Va})),i.d(t,"HAVE_WATERMARK",(function(){return ka})),i.d(t,"SPEAKING_WHEN_MUTE",(function(){return Ua})),i.d(t,"AUDIO_QOS_DATA",(function(){return La})),i.d(t,"VIDEO_QOS_DATA",(function(){return xa})),i.d(t,"VIDEOSHARE_QOS_DATA",(function(){return Wa})),i.d(t,"NETWORK_QUALITY_CHANGE",(function(){return Ba})),i.d(t,"NETWORK_QUALITY_CHANGE_AUDIO",(function(){return Ga})),i.d(t,"sdkIvTypeKeyEnum",(function(){return Fa})),i.d(t,"CURRENT_DECODE_VIDEO_QUALITY",(function(){return Ha})),i.d(t,"CURRENT_DECODE_VIDEO_FPS",(function(){return Ka})),i.d(t,"ENABLE_REUSE_STREAM",(function(){return ja})),i.d(t,"PRESET_MEDIA_CONSTRAINTS",(function(){return Ya})),i.d(t,"DESTORY_REUSE_STREAM",(function(){return qa})),i.d(t,"VB_SETTING_PARA_ERROR_TYPE",(function(){return Xa})),i.d(t,"AUDIO_STREAM_MUTED",(function(){return Qa})),i.d(t,"AUDIO_STREAM_UNMUTED",(function(){return za})),i.d(t,"VIDEO_STREAM_MUTED",(function(){return Ja})),i.d(t,"VIDEO_STREAM_UNMUTED",(function(){return Za})),i.d(t,"EXPOSE_VB_FRAME",(function(){return $a})),i.d(t,"UNIFIED_VB_FRAME",(function(){return er})),i.d(t,"UNIFIED_VB_STOP",(function(){return tr})),i.d(t,"UNIFIED_VB_PAUSE",(function(){return ir})),i.d(t,"UNIFIED_VB_ACK",(function(){return ar})),i.d(t,"ANNO_UNDO_STATUS",(function(){return rr})),i.d(t,"ANNO_REDO_STATUS",(function(){return nr})),i.d(t,"CAPTURE_FAILED_REASON",(function(){return or})),i.d(t,"REQUEST_PERMISSION_STATUS",(function(){return sr}));const a=0,r=1,n=2,o=3,s=4,d=5,u=6,l=7,c=8,h=9,f=10,p=11,_=12,m=13,g=14,E=15,S=16,v=17,C=18,A=19,T=20,R=21,I=22,b=23,O=24,D=25,w=26,y=27,M=28,P=29,N=30,V=30.1,k=31,U=31.1,L=32,x=33,W=34,B=35,G=36,F=40,H=41,K=42,j=43,Y=44,q=45,X=46,Q=47,z=48,J=49,Z=50,$=51,ee=52,te=53,ie=54,ae=55,re=57,ne=58,oe=59,se=60,de=61,ue=62,le=63,ce=64,he=65,fe=66,pe=70,_e=71,me=72,ge=73,Ee=74,Se=75,ve=76,Ce=77,Ae=78,Te=79,Re=80,Ie=81,be=82,Oe=83,De=84,we=85,ye=86,Me=87,Pe=90,Ne=91,Ve=92,ke=93,Ue=94,Le=95,xe=96,We=97,Be=98,Ge=99,Fe=101,He=100,Ke=102,je=103,Ye=110,qe=111,Xe=112,Qe=113,ze=114,Je=115,Ze=116,$e=117,et=118,tt=120,it=121,at=122,rt=123,nt=124,ot=125,st=126,dt=127,ut=128,lt=129,ct=130,ht=131,ft=132,pt=133,_t=135,mt=136,gt=137,Et=138,St=150,vt=152,Ct=156,At=158,Tt=159,Rt=160,It=161,bt=162,Ot=163,Dt=1,wt=1.1,yt=1.2,Mt=1.3,Pt=2,Nt=3,Vt=4,kt=5,Ut=6,Lt=6.1,xt=7,Wt=8,Bt=9,Gt=10,Ft=11,Ht=12,Kt=13,jt=14,Yt=15,qt=16,Xt=17,Qt=18,zt=19,Jt=20,Zt=21,$t=23,ei=24,ti=25,ii=26,ai=27,ri=28,ni=29,oi=30,si=31,di=32,ui=33,li=34,ci=35,hi=36,fi=37,pi=38,_i=39,mi=-1,gi=-1.1,Ei=-1.2,Si=-1.3,vi=-2,Ci=-3,Ai=-4,Ti=-5,Ri=-6,Ii=-7,bi=-8,Oi=-9,Di=-10,wi=-11,yi=-12,Mi=-14,Pi=-15,Ni=-16,Vi=-17,ki=-18,Ui=-19,Li=-20,xi=-21,Wi=-22,Bi=-23,Gi=-24,Fi=-28,Hi=-27,Ki=-29,ji=-31,Yi=-32,qi=-33,Xi=-34,Qi=-35,zi=-36,Ji=-37,Zi=-38,$i=-39,ea=-40,ta=-41,ia=-42,aa=-43,ra=-44,na=-45,oa=-51,sa=-52,da=-60,ua=-53,la=-70,ca=-129,ha=-130,fa=-136,pa=0,_a=1,ma=2,ga=-1,Ea="SHARING_PARAM_INFO_FROM_SOCKET",Sa=24321,va=24322,Ca=24322,Aa=24323,Ta=24322,Ra=4300,Ia=4299,ba=7939,Oa=12303,Da=12305,wa=4167,ya=4355,Ma={ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT:"ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT",ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT:"ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT",END_MEDIA:"END_MEDIA",DESTROY:"DESTROY",DC_COMING_MESSAGE:"DC_COMING_MESSAGE",AUDIO_BRIDGE_WS_TOKEN:"AUDIO_BRIDGE_WS_TOKEN"},Pa=70,Na=170,Va=!1,ka=!0,Ua=121,La="AUDIO_QOS_DATA",xa="VIDEO_QOS_DATA",Wa="VIDEOSHARE_QOS_DATA",Ba="NETWORK_QUALITY_CHANGE",Ga="NETWORK_QUALITY_CHANGE_AUDIO",Fa={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},Ha=66.5,Ka=66.6,ja="ENABLE_REUSE_STREAM",Ya="PRESET_MEDIA_CONSTRAINTS",qa="DESTORY_REUSE_STREAM",Xa={FAIL:4},Qa="AUDIO_STREAM_MUTED",za="AUDIO_STREAM_UNMUTED",Ja="VIDEO_STREAM_MUTED",Za="VIDEO_STREAM_UNMUTED",$a="EXPOSE_VB_FRAME",er="UNIFIED_VB_FRAME",tr="UNIFIED_VB_STOP",ir="UNIFIED_VB_PAUSE",ar="UNIFIED_VB_ACK",rr="ANNO_UNDO_STATUS",nr="ANNO_REDO_STATUS",or={USER_DENIED:1,SYSTEM_DENIED:2,DEVICE_IN_USE:3,NO_DEVICE:4,UNKNOWN_REASON:5,OVERCONSTRAINED:6,USER_DISMISS:7},sr={GRANTED_AUDIO_VIDEO:1,GRANTED_AUDIO:2,DENIED:3,EXCEPTION_FAILS:4,DISMISS:5}},function(e,t,i){"use strict";i.r(t),i.d(t,"apiSupportUtility",(function(){return b})),i.d(t,"IsSupportWebGLOffscreenCanvas",(function(){return U})),i.d(t,"DetectIsMTRAndroidWithSAB",(function(){return L})),i.d(t,"Get_Logical_SSrc",(function(){return W})),i.d(t,"createMainAudioContext",(function(){return B})),i.d(t,"createAudioContext",(function(){return G})),i.d(t,"Deferred",(function(){return H})),i.d(t,"getFilename",(function(){return K})),i.d(t,"IntegrityHelper",(function(){return j})),i.d(t,"getGcd",(function(){return Y})),i.d(t,"getLcm",(function(){return q})),i.d(t,"AdjustRegion_AspectRatio",(function(){return X})),i.d(t,"deepEqual",(function(){return Q})),i.d(t,"getWMSCModule",(function(){return z})),i.d(t,"getAnnoterModule",(function(){return J})),i.d(t,"addSelfViewDebugInfoForWebRTC",(function(){return Z})),i.d(t,"addUserEventListener",(function(){return $})),i.d(t,"VideoStreamCanCapture",(function(){return ee})),i.d(t,"RecordVideoState",(function(){return te})),i.d(t,"CheckCanvasSize",(function(){return ie})),i.d(t,"parseDOMParams",(function(){return ae})),i.d(t,"checkBrowserVersion",(function(){return re})),i.d(t,"replaceComma",(function(){return ne})),i.d(t,"isChromeOS",(function(){return oe})),i.d(t,"isMobileDevice",(function(){return se})),i.d(t,"isTablet",(function(){return de})),i.d(t,"isWebGLAvailable",(function(){return ue})),i.d(t,"createRlbSocket",(function(){return le})),i.d(t,"setIsWebRTCMode",(function(){return ce})),i.d(t,"updateAudioProbResult",(function(){return fe})),i.d(t,"isMacIntel",(function(){return pe})),i.d(t,"IsSupportTransferableDataChannel",(function(){return _e}));var a=i(33),r=i(28),n=i(7),o=i(0),s=i(6),d=i(4),u=i(47),l=i.n(u),c=i(37),h=i(22),f=i(34),p=i(20),_=i(12);const m={};let g=!1,E=!1;const S=function(){let e=(i={},a=navigator.userAgent.toLowerCase(),(t=a.match(/rv:([\d.]+)\) like gecko/))||(t=a.match(/msie ([\d\.]+)/))?(i.ie=t[1],i.name="ie"):(t=a.match(/(?:edge|edg)\/([\d\.]+)/))?(i.edge=t[1],i.name="edge"):(t=a.match(/(?:firefox|iceweasel)\/([\d\.]+)/))?(i.firefox=t[1],i.name="firefox"):(t=a.match(/(?:opera|opr).([\d\.]+)/))?(i.opera=t[1],i.name="opera"):(t=a.match(/chrome\/([\d\.]+)/))?(i.chrome=t[1],i.name="chrome"):(t=a.match(/version\/([\d\.]+).*safari/))&&(i.safari=t[1],i.name="safari"),i);var t,i,a;return function(){return e}}(),v=function(){let e={};return function(){try{var t,i,a,r,n,o;let s=l()(navigator.userAgent),d="tablet"==(null==s||null===(t=s.device)||void 0===t?void 0:t.type)||de(),u="mobile"==(null==s||null===(i=s.device)||void 0===i?void 0:i.type)||se(),c=null==s||null===(a=s.os)||void 0===a?void 0:a.name,h=null==s||null===(r=s.os)||void 0===r?void 0:r.version,f=0;if(d?f=4:u&&(f=1),!c){const e=navigator.userAgent.match(/\(([^;]+); OpenHarmony ([\d.]+)\)/);e&&e.length>2&&(c="OpenHarmony",h=e[2],"Tablet"===e[1]?f=4:"Phone"===e[1]&&(f=1))}e.osType=f,e.os=c,e.osVersion=h,e.browser=Object.assign({},s.browser),null!==(n=c)&&void 0!==n&&n.toLowerCase().includes("mac")&&(d||u)&&(e.os="ios"),null!==(o=c)&&void 0!==o&&o.toLowerCase().includes("linux")&&(d||u)&&(e.os="android");let p=(h||"").split(".")[0];c&&navigator.userAgentData&&(c.toLowerCase().includes("win")&&"10"==p||c.toLowerCase().includes("android")||c.toLowerCase().includes("mac"))&&navigator.userAgentData.getHighEntropyValues(["platform","platformVersion"]).then(t=>{c=null==t?void 0:t.platform;const i=(c||"").toLowerCase(),a=parseInt((t.platformVersion||"").split(".")[0]);i.includes("win")?(h=a>=13?"11":a>0?"10":"7",e.os=c,e.osVersion=h):(i.includes("android")||i.includes("mac"))&&(h=t.platformVersion,e.osVersion=h)})}catch(e){}}(),function(){return e}}(),C=(e,t)=>{const i=t.toString().split("."),a=e.toString().split("."),r=i.length,n=a.length,o=Math.min(r,n);for(let e=0;et}return n>=r},A=(e,t)=>{var i=S();if("chrome"===e||"chromium"===e){if(i.chrome||i.edge||i.opera){var a=i.chrome||i.edge||i.opera;return C(a,t)}}else if(i[e])return C(i[e],t);return!1},T=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:90;return A("chrome",e)},R=e=>A("firefox",e),I=e=>A("safari",e);const b=new class{constructor(){this._isSupportMultiThread=!1,this._isSupportSIMD=!1,this.inProgressPromise={checkSupportMultiThread:null,checkSupportSIMD:null},this._isSupportWebtransport=!1,this._isSupportVirtualBackground=!1}async checkIsSupportMultiThread(){if(!this.getIsSupportMultiThread())try{this.inProgressPromise.checkSupportMultiThread?await this.inProgressPromise.checkSupportMultiThread:(this.inProgressPromise.checkSupportMultiThread=a.default.threads(),this._setIsSupportMultiThread(await this.inProgressPromise.checkSupportMultiThread))}catch(e){this._setIsSupportMultiThread(!1)}}_setIsSupportMultiThread(e){this._isSupportMultiThread=e}getIsSupportMultiThread(){return this._isSupportMultiThread}async checkIsSupportSIMD(){if(!this.getIsSupportSIMD())try{this.inProgressPromise.checkSupportSIMD?await this.inProgressPromise.checkSupportSIMD:(this.inProgressPromise.checkSupportSIMD=a.default.simd(),this._setIsSupportSIMD(await this.inProgressPromise.checkSupportSIMD))}catch(e){this._setIsSupportSIMD(!1)}}_setIsSupportSIMD(e){this._isSupportSIMD=e}getIsSupportSIMD(){return this._isSupportSIMD}getIsSupportWebtransport(){return T(97)&&"function"==typeof WebTransport&&this._isSupportWebtransport}setIsSupportWebtransport(e){this._isSupportWebtransport=!!e}getIsSupportVirtualBackground(){const e=T(91)||R(89)||I(17.4);return navigator.hardwareConcurrency&&navigator.hardwareConcurrency>2&&e&&"function"==typeof OffscreenCanvas&&this._isSupportVirtualBackground}setIsSupportVirtualBackground(e){this._isSupportVirtualBackground=!!e}getIsRenderSelfVideoInEncodeWorker(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!o.default.enableMultiDecodeVideoWithoutSAB&&e&&!this.getIsSupportMultiThread()&&this.getIsSupportVirtualBackground()}};var O={capacity:void 0,capacity1080:!0,get capacityfor720(){return void 0!==this.capacity&&this.capacity},set capacityfor720(e){this.capacity=e},get capacityfor1080(){return void 0!==this.capacity1080&&this.capacity1080},set capacityfor1080(e){this.capacity1080=e}},D={capacitydeco:void 0,get capacitydecofor1080(){return void 0!==this.capacitydeco&&this.capacitydeco},set capacitydecofor1080(e){this.capacitydeco=e}};function w(e,t,i){const a=e.match(t);return a&&a.length>=i&&parseInt(a[i],10)}function y(){const{navigator:e}=window,t={browser:null,version:null};if("undefined"==typeof window||!window.navigator)return t.browser="Not a browser.",t;if(e.mozGetUserMedia)t.browser="firefox",t.version=w(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia)t.browser="chrome",t.version=w(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=w(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!window.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=w(e.userAgent,/AppleWebKit\/(\d+)\./,1)}return t}const M=y();function P(){try{var e=navigator.userAgent||navigator.vendor||window.opera;return!!/android/i.test(e)}catch(e){return!1}}const N=function(){let e={vendor:"",renderInfo:"",isAstcSupported:!1,isWebGLContextInvalid:!0};try{const a=document.createElement("canvas");if(!a){const e="Error: document.createElement return a null canvas!";n.default.error(e)}let r=a.getContext("webgl")||a.getContext("moz-webgl")||a.getContext("webkit-3d")||a.getContext("experimental-webgl");if(!r||r.isContextLost()){const e="Error: canvas.getContext fail, context:".concat(r,", lost:").concat(null==r?void 0:r.isContextLost(),", size:(").concat(a.width,",").concat(a.height,")");n.default.error(e)}if(r){var t,i;if(e.isWebGLContextInvalid=!1,r.isContextLost()){const e="Error: webgl context is lost, canvas(".concat(a.width,",").concat(a.height,")!");n.default.error(e)}let o,s;if("firefox"===M.browser)o=r.getParameter(r.RENDERER),s=r.getParameter(r.VENDOR);else{let e=r.getExtension("WEBGL_debug_renderer_info");o=r.getParameter(e.UNMASKED_RENDERER_WEBGL),s=r.getParameter(e.UNMASKED_VENDOR_WEBGL)}if(e.renderInfo=null===(t=o)||void 0===t?void 0:t.toLowerCase(),e.vendor=null===(i=s)||void 0===i?void 0:i.toLowerCase(),e.isAstcSupported=-1!==r.getSupportedExtensions().indexOf("WEBGL_compressed_texture_astc"),""==s){const e="Error: vendor is null, debug:".concat(debugInfo,", render:").concat(debugInfo.UNMASKED_RENDERER_WEBGL,", vendor:").concat(debugInfo.UNMASKED_VENDOR_WEBGL,", contextLost:").concat(r.isContextLost(),"!");n.default.error(e)}}}catch(e){n.default.error("Error while get webgl context:",e)}return e}(),V=function(){if("function"!=typeof OffscreenCanvas)return!1;let e={isSupportWebgl:!1,isSupportWebgl2:!1};try{const t=new OffscreenCanvas(1,1);(t.getContext("webgl")||t.getContext("experimental-webgl")||t.getContext("moz-webgl")||t.getContext("webkit-3d"))&&(e.isSupportWebgl=!0)}catch(e){n.default.error("Error while get webglcontext:",e)}try{if(e.isSupportWebgl){new OffscreenCanvas(1,1).getContext("webgl2")&&(e.isSupportWebgl2=!0)}}catch(e){n.default.error("Error while get webglcontext2:",e)}return e}();var k=function(){let e=Object.assign({},V,N);return e.cpu=navigator.hardwareConcurrency?navigator.hardwareConcurrency:0,e.VE=0,e.SE=0,e.VD=0,e.SD=0,e.SAB=null!=typeof SharedArrayBuffer,e.errorMessage=null,e.visibility=!0,e.unvisibilitycount=0,e.time=0,e}();function U(){return V.isSupportWebgl}function L(){return-1!==navigator.userAgent.indexOf("MSFT Teams Android Room")&&"undefined"!=typeof SharedArrayBuffer}function x(){return"function"==typeof VideoTrackReader&&"function"==typeof VideoFrame}function W(e){return e?e>>10<<10:-1}function B(){return G("Main",F.getAudioContextConfigure())}function G(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"function"!=typeof AudioContext?(n.default.error("Not Support AudioContext"),null):(n.default.log("Creating ".concat(e," AudioContext")),t=i?new AudioContext(i):new AudioContext,t.onstatechange=()=>{n.default.log("".concat(e," AudioContext state changed to ").concat(t.state)),d.default.add_monitor("ACSC:".concat(e,":").concat(t.state))},t.onsinkchange=()=>{"object"==typeof t.sinkId&&"none"===t.sinkId.type?n.default.log("".concat(e," AudioContext - Audio changed to not play on any device")):n.default.log("".concat(e," AudioContext - Audio output device changed to ").concat(t.sinkId))},t)}const F={getOSInfo:()=>v(),getGpuInfo:()=>N,isMTRAndroidWithSAB:()=>L(),isSupport2DCanvasDrawFrame:()=>("function"==typeof MediaStreamTrackProcessor||x())&&"chrome"==M.browser&&M.version>=104&&-1==navigator.appVersion.indexOf("Mac"),checkLocalP2PConnection:()=>new Promise(async(e,t)=>{function i(e){return new Promise((t,i)=>{e.onconnectionstatechange=i=>{"connected"===e.connectionState&&t(!0)}})}function a(e){e&&e.close()}let r,o,s=null,d=null,u=document.createElement("canvas");try{u.width=200,u.height=200,u.getContext("2d");let t=u.captureStream();if("function"!=typeof RTCPeerConnection)return void e(!1);if(s=new RTCPeerConnection,d=new RTCPeerConnection,s.onicecandidate=e=>{e.candidate&&d.addIceCandidate(new RTCIceCandidate(e.candidate))},d.onicecandidate=e=>{e.candidate&&s.addIceCandidate(new RTCIceCandidate(e.candidate))},Promise.all([i(s),i(d)]).then(()=>{e(!0),a(s),a(d)}),"function"!=typeof s.addStream)return void e(!1);await s.addStream(t),r=await s.createOffer(),await s.setLocalDescription(r),await d.setRemoteDescription(r),o=await d.createAnswer(),await d.setLocalDescription(o),await s.setRemoteDescription(o),setTimeout(()=>{e(!1),a(s),a(d)},200)}catch(t){n.default.error("Error when trying to check for local RTC peer connection",t),e(!1)}}),getDocumentHandle:e=>document.getElementById(e),browserType:M,browser:{isFirefox:"firefox"===M.browser,isChrome:"chrome"===M.browser,isSafari:"safari"===M.browser},isIphoneOrIpadSafari(){return this.isIphoneOrIpadBrowser()||this.isIpadOS()},isOpera65:()=>function(){try{var e=navigator.userAgent.match(/OPR\/(\d+)\./);return!!(e&&Number(e[1])<66)}catch(e){return!1}}(),isOpera:()=>/opera|opr\/[\d]+/i.test(navigator.userAgent),isOperaVersionHigherThan(e){try{var t=navigator.userAgent.match(/OPR\/(\d+)\./);return!!(t&&Number(t[1])>=e)}catch(e){return!1}},isAndroidBrowser:()=>P(),isAndroidVersionLessEqual(e){const t=v();if(!t.os||"android"!==t.os.toLowerCase()||!t.osVersion)return!1;const i=t.osVersion.toString().split(".");return parseInt(i[0])<=e},isSupportVideoFrame:()=>"undefined"!=typeof VideoFrame,isQuestBrowser:()=>function(){try{return/oculusbrowser/i.test(navigator.userAgent)}catch(e){return!1}}(),isMobileSafariSupportVideoFrame(){return(this.isIphoneOrIpadBrowser()||this.isIpadOS()&&o.default.rwgAgent)&&this.isSupportVideoFrame()},isSelfPreviewRenderWithVideo(){return!!this.isMobileSafariSupportVideoFrame()||(!b.getIsSupportMultiThread()&&!b.getIsSupportVirtualBackground()&&this.isSupportVideoFrameOrBitmapCapture()||this.isAndroidBrowser()&&!this.isMTRAndroidWithSAB()&&!o.default.rwgAgent)},isSupportNewWaitRoomFlow:()=>!0,isMacIntelSafari(){try{return!(!this.browser.isSafari||navigator.maxTouchPoints&&!(navigator.maxTouchPoints<=2)||N.isAstcSupported||!this.isMac())}catch(e){return!1}},isMacIntelChrome(){try{var e;return!!(this.browser.isChrome&&(!navigator.maxTouchPoints||navigator.maxTouchPoints<=2)&&(null===(e=N.vendor)||void 0===e?void 0:e.indexOf("intel"))>-1&&this.isMac())}catch(e){return!1}},isIphoneOrIpadBrowser(){try{return!!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)}catch(e){return!1}},isIpadOS:()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&(/iPad/.test(navigator.platform)||/MacIntel/.test(navigator.platform)),isChromeOS:()=>function(){try{return!!/\bCrOS\b/.test(navigator.userAgent)}catch(e){return!1}}(),isWindowsChrome(){const{userAgent:e}=navigator;return/windows/i.test(e)},isTeslaMode:()=>/TESLA/.test(navigator.userAgent),isMac:()=>navigator.platform.indexOf("Mac")>-1,isWindows:()=>navigator.platform.indexOf("Win")>-1,isLinux(){return navigator.platform.indexOf("Linux")>-1&&!this.isChromeOS()},isMTRAndroid:()=>/MSFT Teams Android Room/i.test(navigator.userAgent),isSupportChromeWideAEC(){const e=o.default.chromeWideAEC&&this.isChromeOS()&&T(116);return(this.isMac()||this.isWindows()||this.isLinux())&&T(111)||e||o.default.isGoogleMeetMode},isSupportOpenMicWhenShareAudio(){return this.isSupportChromeWideAEC()&&!o.default.shareSystemAudio},getAudioFeatureFlags:()=>o.default.enableAudioBridge?4:12,isSupportShareMultiStream:()=>!0,isSupportVideoLTR:()=>!0,isSupportAudioBridgeAvsync:()=>!0,getAudioContextConfigure(){let e={};return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:90;return A("chromium",e)}(74)&&(e={sampleRate:48e3,latencyHint:.02}),e},download(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(m[e])return m[e];let i=new Promise(async(i,a)=>{let r={};t&&(r.integrity=t);for(let t=0;t<3;t++)try{let o=await fetch(e,r);if(null!=o&&o.ok){i(o.text()),t>0&&n.default.error("after ".concat(t," retry download js ").concat(e," successed "));break}2==t&&a("download failed ".concat(e," ").concat(null==o?void 0:o.status))}catch(e){2==t&&a(e)}});return m[e]=i,i},async downloadAndCompileWebAssembly(e,t,i){let a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const r="".concat(e).concat(a);if(m[r])return m[r];let o=new Promise(async(r,o)=>{let s=null;i.add_monitor("CS".concat(t));for(let o=0;o<3;o++){try{if(a)s=await WebAssembly.compileStreaming(fetch(e,{priority:"high"}));else{const t=await fetch(e,{priority:"high"});s=await t.arrayBuffer()}i.add_monitor("CE".concat(t))}catch(r){if("TypeError"===r.name)try{const t=await fetch(e,{priority:"high"}),i=await t.arrayBuffer();s=await WebAssembly.compile(i)}catch(r){2==o&&(i.add_monitor("".concat(a?"CF":"FF").concat(t)),n.default.error("Failed to download WASM file using compile: ".concat(e," for worker type: ").concat(t),r))}else 2==o&&n.default.error("Failed to download WASM file using ".concat(a?"compileStreaming":"fetch",": ").concat(e," for worker type: ").concat(t),r)}if(s)return r(s),void(o>0&&n.default.error("after ".concat(o," retry download wasm ").concat(e," successed ")))}o(new Error("Unable to download and compile WASM file: ".concat(e," for worker type: ").concat(t)))});return m[r]=o,o},readBlob:e=>new Promise((t,i)=>{var a=new FileReader;a.onload=function(){t(a.result)},a.readAsText(e)}),readBlobAsBuffer:e=>new Promise((t,i)=>{var a=new FileReader;a.onload=function(e){t(e.target.result)},a.readAsArrayBuffer(e)}),lengthInUtf8Bytes(e){var t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)},isLittleEndian(){let e=new ArrayBuffer(2),t=new Uint8Array(e),i=new Uint16Array(e);return t[0]=170,t[1]=187,48042===i[0]},sleep:e=>new Promise((t,i)=>{setTimeout(()=>{t(!0)},e)}),isSDKSupportMultiThread:async()=>(await b.checkIsSupportMultiThread(),b.getIsSupportMultiThread()),is32bitChrome:async()=>{if(-1!=navigator.userAgent.indexOf("WOW64"))return!0;if(navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues){return(await navigator.userAgentData.getHighEntropyValues(["wow64"])).wow64}return!1},isAMDGraphic(){try{return this.graphicName.includes("amd")}catch(e){return!1}},graphicName:N.renderInfo,graphicvendorname:N.vendor,isGraphicShouldUseHardwareAccelerationDecode(){return!(!this.isAMDGraphic()||!this.isChromeOS())||!(this.isAMDGraphic()&&!this.isChromeOS())},VP9MachineDetect(){const e=navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/vp9",bitrate:1e7,framerate:25,height:1920,width:1080}});return new Promise((t,i)=>{e.then(e=>{e.supported||(n.default.log("video/vp9 codec isn't supported in software or hardware"),t(!1)),t(e.powerEfficient)}).catch(e=>{n.default.warn("Error when trying to determine support for VP9 codec",e),t(!1)})})},async IsSupportVideoDecodeHardwareAcceleration(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("function"!=typeof VideoDecoder||this.browser.isSafari&&!I("17.5"))return!1;var t={codec:"avc1.640028",description:new Uint8Array([1,100,0,31,255,225,0,14,103,100,0,51,172,27,26,17,129,64,22,201,160,16,7,0,5,104,200,66,60,48,0,5,104,82,16,207,12,0,25,104,114,16,143,24,67,17,132,56,140,84,81,8,18,22,41,3,194,98,3,5,32,122,9,140,0,5,104,36,132,51,203,0,5,104,46,132,51,195,0,25,104,54,132,35,198,16,196,97,14,35,21,20,66,4,133,138,64,240,152,128,193,72,30,130,99,0,5,104,62,132,51,203]),codedWidth:1280,codedHeight:720,optimizeForLatency:!0,hardwareAcceleration:e?"no-preference":"prefer-hardware"};try{return!!(await VideoDecoder.isConfigSupported(t)).supported}catch(e){return!1}},async IsSupportVideoEncodeHardwareAcceleration(){if("function"!=typeof VideoEncoder||this.browser.isSafari&&!I("17.5"))return!1;var e={codec:"avc1.640028",bitrate:15e5,width:1280,height:720,avc:{format:"annexb"},framerate:25,hardwareAcceleration:"no-preference",latencyMode:"realtime",bitrateMode:"constant",scalabilityMode:"L1T2"};return!!(await VideoEncoder.isConfigSupported(e)).supported},AdapterWhiteListCheckForEncoder(){if(!U())return-1;try{var e=N.renderInfo,t=N.vendor,i=e.toLowerCase(),a=t.includes("ARM"),r=(i.includes("amd"),i.includes("intel"));i.includes("hd graphics"),i.includes("nvidia"),i.includes("geforce");return r?0:a?-1:0}catch(e){return 0}},isChromeVersionHigherThan:T,isFirefoxVersionHigherThan:R,isSafariVersionHigherThan:I,async isSDKSupportSIMD(){if("object"!=typeof WebAssembly)return!1;if("chrome"==M.browser){if(!(M.version>=84))return!1;await b.checkIsSupportSIMD()}else await b.checkIsSupportSIMD();return b.getIsSupportSIMD()},buffer2stringSplitByComma:e=>new Uint8Array(e).join(","),stringSplitByComma2Buffer(e){try{let t=e.split(",").map(e=>parseInt(e)),i=new ArrayBuffer(t.length),a=new Uint8Array(i);for(let e=0;e{let a=!1;for(let r=0;r0)return e.match(/firefox\/[\d.]+/gi);if(e.indexOf("safari")>0&&e.indexOf("chrome")<0){var t,i="safari/unknow";return i=e.match(/safari\/[\d.]+/gi),t=e.match(/safari\/[\d.]+/gi),i&&(i=[i.toString().replace("version","safari")]),t&&(i=[t.toString().replace("version","safari")]),i}return e.indexOf("chrome")>0?e.match(/chrome\/[\d.]+/gi):"other"}();return e[0]&&e[0].match(/(\d+)/)?e[0].match(/(\d+)/)[0]:"other"},getIOSMajorVersion(){if(/iP(hone|od|ad)/.test(navigator.platform)){let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return parseInt(e[1],10)}return null},getMacSafariMajorVersion(){if(this.browser.isSafari){const e=navigator.userAgent.match(/Version\/([\d\.]+)/);return e&&e[1]?parseFloat(e[1]):null}return null},isSupportImageCapture(){var e;return(null===(e=this.browser)||void 0===e?void 0:e.isChrome)&&"function"==typeof ImageCapture&&U()},isSupportOffscreenCanvas:()=>U(),isSupport2dOffscreenCanvas:()=>"function"==typeof OffscreenCanvas,isSupportVideoTrackReader:()=>x()&&U(),isSupportMediaStreamTrackProcessor:function(){return"function"==typeof MediaStreamTrackProcessor&&U()},isSupportVideoFrameOrBitmapCapture(){return this.isSupportImageCapture()||this.isSupportVideoTrackReader()||this.isSupportMediaStreamTrackProcessor()},isSupportSharedArrayBuffer:()=>"undefined"!=typeof SharedArrayBuffer,async queryPTZPermisson(){try{return"granted"==(await navigator.permissions.query({name:"camera",panTiltZoom:!0})).state}catch(e){return n.default.error("Error when querying pan-tilt-zoom permission",e),!1}},isSupportCameraPan(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.pan)},isSupportCameraTilt(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.tilt)},isSupportCameraZoom(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.zoom)},isSupportPTZ(){var e,t;const i=null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t?void 0:t.call(e);return i&&i.pan&&i.tilt&&i.zoom},get720pcapacity:()=>O.capacityfor720,set720pcapacity(e){O.capacityfor720=e},get1080pcapacity:()=>O.capacity1080,set1080pcapacity(e){O.capacity1080=e},isSupportBrowserWebRTC:()=>!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&window.RTCPeerConnection),getsub1080pcapacity:()=>D.capacitydecofor1080,setsub1080pcapacity(e){D.capacitydecofor1080=e},getMaxCountRender:()=>{if(g)return P()?16:26;var e;return U()&&(null===(e=navigator)||void 0===e?void 0:e.hardwareConcurrency)>=2&&"function"==typeof requestAnimationFrame&&"function"==typeof SharedArrayBuffer||o.default.enableMultiDecodeVideoWithoutSAB?26:1},checkAudioAutoPlay:()=>new Promise((e,t)=>{let i=new ArrayBuffer(684),a=new Uint32Array(i);a.set([1179011410,676,1163280727,544501094,16,65539,16e3,64e3,2097156,1635017060,640],0);let r=new Blob([a],{type:"audio/wav"}),o=window.URL.createObjectURL(r),s=new Audio(o);s.addEventListener("canplaythrough",()=>{s.play().then(()=>{e(!0)}).catch(e=>{n.default.log("Unable to auto play audio",e),t(e)}).finally(()=>{window.URL.revokeObjectURL(o)})}),s.load&&s.load()}),isSupportSendVideoFullHD(){return this.isSupportVideoShareSend()&&navigator.hardwareConcurrency>=8},isSupportSendVideoShareFullHD:()=>!1,isSupportVideoShare:()=>!0,isSupportVideoShareSend(){let e,t=y();return"chrome"==t.browser&&(e=this.getBrowserVersion()),!!this.isSupportSharedArrayBuffer()&&!("chrome"!==t.browser||e&&e<=100||navigator.hardwareConcurrency<=2||this.isTeslaMode()||this.isAndroidBrowser()&&!this.isMTRAndroidWithSAB()||this.isIphoneOrIpadBrowser())},isSupportVideoShareReceive:()=>!0,getOption(e,t,i){try{let a=e.length;if(t>a)return 0;let r=e.slice(a-t-i+1,a-t+1);if(r){return parseInt(r,16)}}catch(e){}return 0},async isSupportWebGPURender(e){const t=this.parseGPUBlacklist(e);return await this.evaluateRendererType(!0,!1,t)==s.j.WEBGPU},getMachineCapability(){var e,t,i,a,r,n,s;return k.VE=null===o.default||void 0===o.default||null===(e=o.default.localVideoPara)||void 0===e||null===(e=e.VE)||void 0===e?void 0:e.buffer.byteLength,k.VD=null===o.default||void 0===o.default||null===(t=o.default.localVideoPara)||void 0===t||null===(t=t.VD)||void 0===t?void 0:t.buffer.byteLength,k.SE=null===o.default||void 0===o.default||null===(i=o.default.localVideoPara)||void 0===i||null===(i=i.SE)||void 0===i?void 0:i.buffer.byteLength,k.SD=null===o.default||void 0===o.default||null===(a=o.default.localVideoPara)||void 0===a||null===(a=a.SD)||void 0===a?void 0:a.buffer.byteLength,k.dt=null===o.default||void 0===o.default||null===(r=o.default.localVideoPara)||void 0===r?void 0:r.videodecodethreadnumb,k.et=null===o.default||void 0===o.default||null===(n=o.default.localVideoPara)||void 0===n?void 0:n.videoencodethreadnumb,k.MT=null===o.default||void 0===o.default||null===(s=o.default.localVideoPara)||void 0===s?void 0:s.isSupportMultiThread,k.time=performance.now(),k},watermark:(()=>{const e=new r.a,t=document.createElement("canvas"),i={enableWaterMark:!1,waterMarkText:"",watermarkOpacity:0,watermarkRepeated:!1,watermarkPosition:void 0};return{getWaterMarkData(a){let{width:r,height:n}=a;if(!i.enableWaterMark)return null;const o=r<512||n<288?16:i.watermarkPosition,s=i.watermarkRepeated&&r>306&&n>202,d=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}}(r,n);r=d.width,n=d.height;return s?e.Get_Repeated_WaterMarkRGBA({canvas:t,name:i.waterMarkText,width:d.width,height:d.height,opacity:i.watermarkOpacity,position:o,convertToDataUrl:!0}):e.Get_WaterMarkRGBA({canvas:t,name:i.waterMarkText,width:d.width,height:d.height,opacity:i.watermarkOpacity,position:o,convertToDataUrl:!0})},updateWaterMarkInfo(e){Object.assign(i,e)}}})(),isSupportAudioDenoise(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("function"!=typeof AudioContext)return!1;if("chrome"==y().browser){if(this.getBrowserVersion()<=100)return!1}const t=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]));return!1!==t&&(!0!==t?(n.default.error("WebAssembly.validate don't return a boolean"),!1):!(!e&&!this.isSupportSharedArrayBuffer())&&!(navigator.hardwareConcurrency<=2||this.isTeslaMode()||this.isAndroidBrowser()&&!this.isMTRAndroidWithSAB()||this.isIphoneOrIpadBrowser()))},isSupportPlayStereo(){return!!(this.browser.isFirefox||this.browser.isSafari||this.isSupportChromeWideAEC())},isBrowserSupportStereo(){return!this.browser.isSafari},isSupportShare2ndAudioDevice(e){return!this.browser.isSafari&&!this.isIphoneOrIpadBrowser()&&(!!e||!(this.isMac()&&!T(126))&&!!this.isSupportSharedArrayBuffer())},isSupportSharingStereo:()=>!1,isSupportVideoActiveChannel:()=>!0,async evaluateRendererType(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=s.j.WEBGL,r=null;const o=U();try{if(this.isWebGL2Supported(t)?a=s.j.WEBGL_2:n.default.log("evaluateRendererType() WebGL 2 is not supported."),!this.isSupportVideoFrame())return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: VideoFrame is not supported)"),a;if(!(this.isMac()||this.isWindows()||this.isChromeOS()||this.isLinux()))return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: unsupported platform)"),a;if(!(this.browser.isChrome&&this.isChromeVersionHigherThan(119)||this.isOpera()&&this.isOperaVersionHigherThan(108)||this.browser.isChrome&&(this.isLinux()||this.isAndroidBrowser())&&this.isChromeVersionHigherThan(121)))return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: unmatched browser)"),a;if(!navigator.gpu)return a;const d=await navigator.gpu.requestAdapter();if(!d)return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: no available adapter.)"),a;if(!await d.requestDevice())return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: no available device.)"),a;let u=void 0;if("function"==typeof d.requestAdapterInfo?u=await d.requestAdapterInfo():"info"in d&&(u=d.info),!u)return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: no available adapter info.)"),a;n.default.log("evaluateRendererType() GPUAdapterInfo: arch=".concat(u.architecture,", vendor=").concat(u.vendor)),console.log("evaluateRendererType() GPUAdapterInfo: arch=".concat(u.architecture,", vendor=").concat(u.vendor));const l=this.queryDeviceProfile(u);if(!this.isGPUProfileOnWebGPUWhitelist(l,i))return a;if(o){r=new OffscreenCanvas(1,1);if(!r.getContext("webgpu"))return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: no available GPUContext.)"),a;if(!this.isOpFeatureEnabled(e))return n.default.log("evaluateRendererType() WebGPU is not supported. (reason: WebGPU is not allowed for this account.)"),a;r=null,a=s.j.WEBGPU}else n.default.log("evaluateRendererType() OffscreenCanvas is not supported while checking WebGPU.");return a}catch(e){return n.default.error("evaluateRendererType()",e),a}finally{r=null}},isOpFeatureEnabled:e=>1&e,queryDeviceProfile(e){if(e){let t={};return t.architecture=e.architecture,t.vendor=e.vendor,t}return null},isGPUProfileOnWebGPUWhitelist(e,t){if(!e)return!1;const i=e.vendor,a=e.architecture;return-1==s.g.indexOf(i)?(n.default.log("isGPUProfileOnWebGPUWhitelist() vendor:".concat(i," arch:").concat(a," is not on the vendor whitelist!")),!1):null===t||!this.isHitGPUBlacklist(i,a,t)},isHitGPUBlacklist(e,t,i){if(""===e||void 0===e||void 0===t||void 0===i)return!1;for(let a=0;a2&&void 0!==arguments[2]?arguments[2]:null;e!==s.D.DISABLED&&e!==s.D.ENABLED&&e!==s.D.AUTO&&(n.default.error("evaluateWebRTCStrategy() invalid webrtcSelection(".concat(e,") from caller.")),e=s.D.AUTO);let o={shouldUseWebRTC:!1,errNo:s.E.UNKNOWN,errMsg:""};if(!this.isWebRTCFeatureEnabled(t))return o.shouldUseWebRTC=!1,o.errNo=s.E.FEATURE_OPTION_DISABLED,o.errMsg="webrtc is disabled(feature option is disabled).",o;const d=this.getOSInfo();let u=(null==d||null===(i=d.browser)||void 0===i?void 0:i.name)||"",l=(null==d||null===(a=d.browser)||void 0===a?void 0:a.version)||"",c=N;const f={os:null==d?void 0:d.os,browserName:u,browserVersion:l,vendor:c.vendor,renderInfo:c.renderInfo,isAstcSupported:c.isAstcSupported};if(e===s.D.DISABLED)return n.default.log("evaluateWebRTCStrategy() WebRTC is disabled by caller."),o.shouldUseWebRTC=!1,o.errNo=s.E.SUCCEED,o.errMsg="webrtc is disabled(disabled by caller).",o;const p=this.isSupportBrowserWebRTC();try{if(h.a.isOnWebRTCWhitelist(f)){const i=h.a.evalWebRTCStrategy(r,f,p,e);o.errNo=i.errNo,o.errMsg=i.errMsg,i.stg==s.D.ENABLED?o.shouldUseWebRTC=!0:i.stg==s.D.DISABLED?o.shouldUseWebRTC=!1:i.stg==s.D.AUTO?o.shouldUseWebRTC=this.isDefaultToUseWebRTC(t,f):(o.shouldUseWebRTC=!1,o.errNo=s.E.UNKNOWN_SELECTION,o.errMsg="webrtc is disabled(unknown selection type).",n.default.error("evaluateWebRTCStrategy() unknown WEBRTC_STG:".concat(i.stg)))}else o.shouldUseWebRTC=!1,o.errNo=s.E.DEVICE_NOT_ON_WHITELIST,o.errMsg="webrtc is disabled(not on the whitelist)."}catch(e){n.default.error("evaluateWebRTCStrategy() error:",e),o.shouldUseWebRTC=!1,o.errNo=s.E.OTHER_EX,o.errMsg="webrtc is disabled(unexpected error:".concat(e.errorMessage,").")}return n.default.directReport("evaluateWebRTCStrategy() stg=".concat(JSON.stringify(o),", isBrowserSupportWebRTC=").concat(p,", webrtcBlacklist=").concat(JSON.stringify(r),", selection=").concat(e)),o},isWebRTCFeatureEnabled(e){const t=p.a.read(e,_.a.ENABLE_WEBRTC_FEATURE.index,1,_.a.ENABLE_WEBRTC_FEATURE.default);return n.default.log("isWebRTCFeatureEnabled() optionVal:".concat(t)),!!t},getWebRTCStrategyOptions(e){const t=p.a.read(e,_.a.WEBRTC_STG.index,1,_.a.WEBRTC_STG.default);n.default.log("getWebRTCStrategyOption() optionVal:".concat(t));const i=[];return Object.entries(s.D).forEach(e=>{let[a,r]=e;const n={key:a,value:r,isDefault:!1};t===r&&(n.isDefault=!0),i.push(n)}),i},isDefaultToUseWebRTC(e,t){var i;if(p.a.read(e,_.a.FORCE_TO_USE_WEBRTC.index,1,_.a.FORCE_TO_USE_WEBRTC.default)&_.a.FORCE_TO_USE_WEBRTC.candidates.VIDEO_ON_BROWSER_32BIT&&E)return!0;const a={os:null===(i=t.os)||void 0===i?void 0:i.toLowerCase()},r=p.a.read(e,_.a.WEBRTC_AUTO_CONFIG.index,1,_.a.WEBRTC_AUTO_CONFIG.default);if(r===_.a.WEBRTC_AUTO_CONFIG.candidates.NO_CONFIG)return!1;return[{os:"android",flag:_.a.WEBRTC_AUTO_CONFIG.candidates.MOB_ANDROID},{os:"ios",flag:_.a.WEBRTC_AUTO_CONFIG.candidates.MOB_IOS},{os:"win",flag:_.a.WEBRTC_AUTO_CONFIG.candidates.DESKTOP},{os:"mac",flag:_.a.WEBRTC_AUTO_CONFIG.candidates.DESKTOP},{os:"chromium os",flag:_.a.WEBRTC_AUTO_CONFIG.candidates.DESKTOP}].some(e=>{let{os:t,flag:i}=e;return r&i&&a.os.includes(t)})},isWebGL2Supported:e=>"function"==typeof OffscreenCanvas&&(e&&V.isSupportWebgl2),isWebGL2SupportedWhenOpEnabled:()=>V.isSupportWebgl2,async isWebGPUSupported(e,t){if(!e)return!1;if(!this.isSupportVideoFrame())return!1;if(!(this.isMac()||this.isWindows()||this.isChromeOS()||this.isLinux()))return!1;if(!(this.browser.isChrome&&this.isChromeVersionHigherThan(119)||this.isOpera()&&this.isOperaVersionHigherThan(108)||this.browser.isChrome&&(this.isLinux()||this.isAndroidBrowser())&&this.isChromeVersionHigherThan(121)))return!1;if(!navigator.gpu)return!1;const i=await navigator.gpu.requestAdapter();if(!i)return!1;if(!await i.requestDevice())return!1;let a=void 0;if("function"==typeof i.requestAdapterInfo?a=await i.requestAdapterInfo():"info"in i&&(a=i.info),!a)return!1;const r=this.queryDeviceProfile(a);if(!this.isGPUProfileOnWebGPUWhitelist(r,t))return n.default.log("isWebGPUSupported() hit blacklist! profile=".concat(JSON.stringify(r),", blacklist=").concat(JSON.stringify(t))),!1;let o=new OffscreenCanvas(1,1);return o.getContext("webgpu")?(o=null,!0):(o=null,!1)},async isRendererTypeSupported(e,t,i,a){return!(e<=s.j.UNDEFINED||e>s.j.WEBGL_2)&&(e===s.j.WEBGL?U():e===s.j.WEBGL_2?this.isWebGL2Supported(i):e===s.j.WEBGPU&&await this.isWebGPUSupported(t,a))},videoToMediaStreamManager:(()=>{let e,t,i=document.createElement("canvas"),a=i.getContext("2d"),r=640,n=360;const o=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<4?10:24,s=1e3/("chrome"===M.browser?o:10);let d=null,u=0,l=null;return{_draw(){if(!e)return;this.drawCanvas(i,a,r,n);const t=performance.now();if(u){const e=t-u;e>s?this._setFasterTimer():e<.8*s&&this._clearFastTimer()}u=t},_setFasterTimer(){d||(d=setInterval(()=>{e&&e.currentTime>0&&!e.paused&&!e.ended&&performance.now()-u>=s/2&&this.drawCanvas(i,a,r,n)},s))},_clearFastTimer(){u=0,clearInterval(d),d=null},drawCanvas(t,i,a,r){t.width=a,t.height=r;let n=0,o=0;e.videoWidth/e.videoHeight>a/r?(o=e.videoHeight,n=a/r*o):(n=e.videoWidth,o=r/a*n),i.drawImage(e,(e.videoWidth-n)/2,(e.videoHeight-o)/2,n,o,0,0,a,r)},startCapture(a,s,d){return e=a,s&&d&&s/d==16/9&&(r=s,n=d),l&&e.removeEventListener("timeupdate",l),l=this._draw.bind(this),a.addEventListener("timeupdate",l),t=i.captureStream(o),t},stopCapture(){l&&e.removeEventListener("timeupdate",l),this._clearFastTimer(),t&&(t.getVideoTracks().forEach(e=>e.stop()),t=null),e=null},isSupported:()=>"function"==typeof HTMLCanvasElement.prototype.captureStream}})(),audioToMediaStreamMananger:(()=>{let e=null,t=null,i=null,a=null,r=null;return{startCapture(o){if(t||(t=G("File")),r&&o===r)e=r;else{this.destroy(),e=o,r=e,a=t.createMediaElementSource(e);const n=t.createMediaStreamDestination();a.connect(n),i=n.stream}return"suspended"!==t.state&&"interrupted"!==t.state||t.resume().catch(e=>{n.default.error("File audio context resume error: ",e)}),i},stopCapture(){t&&t.suspend(),e=null},destroy(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a&&a.disconnect(),i&&(i.getAudioTracks().forEach(e=>e.stop()),i=null),r=null,a=null,!e&&t&&(t.close(),t=null)},isAudioFileStream:e=>e===i,isSupported:()=>"undefined"!=typeof AudioContext&&"function"==typeof AudioContext.prototype.createMediaStreamDestination&&"function"==typeof AudioContext.prototype.createMediaElementSource}})(),evaluateAudioStrategy(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(this.isEnforceWasmMachine())return!1;const i=p.a.read(e,1,2),a=/iPad|iPhone|iPod/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2,r=navigator.userAgent.match(/Android/i),n=navigator.userAgent.match(/\(([^;]+); OpenHarmony ([\d.]+)\)/),o=this.isMTRAndroid(),s=this.isTeslaMode();return o?8&i:s?2&i:r||n?4&i:a?1&i:!(!(128&i)&&!he)&&this.isDefaultAudioBridgeMachine(e,i,t)},isEnforceWasmMachine(){var e;if("undefined"==typeof RTCPeerConnection)return!0;let t=this.getOSInfo();return!se()&&((null==t||null===(e=t.browser)||void 0===e||null===(e=e.name)||void 0===e?void 0:e.toLowerCase().includes("firefox"))||this.browser.isFirefox)},isDefaultAudioBridgeMachine(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(1===i)return!0;if(0===i)return!1;if(p.a.read(e,_.a.FORCE_TO_USE_WEBRTC.index,1,_.a.FORCE_TO_USE_WEBRTC.default)&_.a.FORCE_TO_USE_WEBRTC.candidates.AUDIO_ON_BROWSER_32BIT&&E)return!0;let a=this.getOSInfo();return a&&a.os&&a.browser?0!==a.osType?32&t:this.isSupportSharedArrayBuffer()?"Windows"!==a.os&&"Mac OS"!==a.os&&"Chromium OS"!==a.os?32&t:("Chrome"===a.browser.name||"Safari"===a.browser.name||"Edge"===a.browser.name)&&navigator.hardwareConcurrency>4?64&t:32&t:32&t:(navigator.hardwareConcurrency<=4||!this.isSupportSharedArrayBuffer())&&32&t},requestScreenWakeLock:()=>c.screenWakeLock.requestWakeLock(),releaseScreenWakeLock:()=>c.screenWakeLock.release(),isSupportPeerConnection:()=>"function"==typeof RTCPeerConnection,async initAsyncJob(){E=!!await this.is32bitChrome()}};function H(){let e=this;this.promise=new Promise((function(t,i){e.reject=i,e.resolve=t}))}function K(e){return e.split("/").pop().split("?")[0].split("#")[0]}t.default=F;class j{constructor(e,t){this.scriptURL=e,this.lateLoadedAssetsHash=t}getIntegrity(){let e=K(this.scriptURL),t=this.lateLoadedAssetsHash[e];return t||null}}function Y(e,t){let i=Math.max(e,t),a=Math.min(e,t);return i%a==0?a:Y(i%a,a)}function q(e,t){return e*t/Y(e,t)}function X(e,t,i,a,r,n,o){if(0==e||0==t)return!1;if(0!=r){let i=q(e,r),a=i/e;e=i,t*=a}if(0!=n){let i=q(t,n),a=i/t;t=i,e*=a}if(o.width{const r=t,n="self_view_debug_".concat(i);if(r){const t=r.parentNode;if(!t)return;const i=e.getVideoTracks()[0],{width:o=0,height:s=0}=i.getSettings(),d=[{elementId:"s_u_"+a,value:"userId: ".concat(a)},{elementId:"s_r_"+a,value:"stream resolutions: ".concat(o,"x").concat(s)},{elementId:"s_a_"+a,value:"stream active: ".concat(e.active)},{elementId:"s_m_"+a,value:"video track muted: ".concat(i.muted)},{elementId:"s_p_"+a,value:"video tag paused: ".concat(!!r.paused)},{elementId:"s_sr_"+a,value:"video tag src: ".concat(!!r.srcObject)}],u=t.querySelector("#".concat(n));u?(u.nextElementSibling&&t.removeChild(u.nextElementSibling),d.reverse().forEach(e=>{const{elementId:i,value:a}=e,r=t.querySelector("#".concat(i));r?r.innerText!==a&&(r.innerText=a):u.insertAdjacentHTML("afterbegin",'
').concat(a,"
"))})):r.insertAdjacentHTML("afterend",'
'))}else{const e=document.getElementById(n);if(e){e.parentNode.removeChild(e)}}}))}function $(e){const t=document.body,i=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];function a(){e()}return i.forEach(e=>t.addEventListener(e,a,!1)),function(){i.forEach(e=>t.removeEventListener(e,a))}}function ee(e){let t=null==e?void 0:e.getVideoTracks();return!(null==t||!t.length)&&!t[0].muted}function te(e){try{var t;let[i]=(null===(t=e.srcObject)||void 0===t?void 0:t.getVideoTracks())||[],a="VDom:".concat(e.ended,":").concat(e.paused,":").concat(e.readyState,",VTrack:").concat(null==i?void 0:i.muted,":").concat(null==i?void 0:i.readyState);d.default.add_monitor(a)}catch(e){n.default.error("RecordVideoState error",e)}}function ie(e,t){(e<0||t<0||e>3e3||t>3e3)&&n.default.directReport("CANVASSIZE:".concat(e,"x").concat(t))}function ae(e){const t={dom:null,id:""};if(e)if("string"==typeof e)t.dom=document.getElementById(e),t.id=e;else if(e instanceof HTMLElement){var i;t.dom=e,t.id=null==e||null===(i=e.getAttribute)||void 0===i?void 0:i.call(e,"id")}return t}function re(){try{const e={safari:"15.0",firefox:"89",chrome:"91",edge:"91",opera:"77"},t={safari:"16.4",firefox:"105",chrome:"102",edge:"102",opera:"88"};let i=Object.assign({name:"",version:""},v().browser);if(-1==Object.keys(e).findIndex(e=>{if(i.name.toLowerCase().includes(e))return i.name=e,!0}))return console.error("!!!!! For a better experience, please use Chrome (version >= 102) or Safari (version >= 16.4) browser "),void n.default.error("unkown browser info");C(i.version,e[i.name])||(console.error("!!!! For a better experience, \n Chrome (version > ".concat(e.chrome," ,performance version > ").concat(t.chrome,") \n Safari (version > ").concat(e.safari," , performance version > ").concat(t.safari,") \n Firefox (version > ").concat(e.firefox," , performance version > ").concat(t.firefox,") \n Edge (version > ").concat(e.edge," , performance version > ").concat(t.edge," ) \n Opera (version > ").concat(e.opera," , performance version > ").concat(t.opera,") \n")),n.default.error("less than min version "))}catch(e){n.default.error("check browser version error",e)}}function ne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}function oe(){return/\bCrOS\b/.test(navigator.userAgent)}function se(){return!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||/iPad/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))}function de(){var e,t,i;if(oe())return!1;const a=((null===(e=navigator)||void 0===e?void 0:e.userAgent)||"").toLowerCase();if(/ipad|android(?!.*mobile)|tablet/i.test(a))return!0;const r=Math.min((null===(t=window)||void 0===t||null===(t=t.screen)||void 0===t?void 0:t.width)||0,(null===(i=window)||void 0===i||null===(i=i.screen)||void 0===i?void 0:i.height)||0),n="ontouchstart"in window||navigator.maxTouchPoints>0;return r>=600&&r<=1280&&n}function ue(){try{const e=document.createElement("canvas");return!!(e.getContext("webgl")||e.getContext("experimental-webgl"))}catch(e){return!1}}function le(e){const t=self.ZoomTPModule;return new(t&&t.ZoomTPWebSocket?t.ZoomTPWebSocket:WebSocket)(e)}function ce(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];g=e}let he=!0;function fe(){try{let e=(new f.a).getAudioSolutionInfo();he=null==e?void 0:e.getProbResult()}catch(e){n.default.error("updateAudioProbResult error",e),he=!0}}function pe(){return F.isMacIntelSafari()||F.isMacIntelChrome()}function _e(){try{return!("safari"!==(null==M?void 0:M.browser)||!I(15))||!("chrome"!==(null==M?void 0:M.browser)||!T(131))}catch(e){return!1}}fe()},function(e,t,i){"use strict";i.r(t);var a=i(2),r=i(0),n=i(7);const o={AEWF:"Audio encode WASM failed to download/compile",ADWF:"Audio decode WASM failed to download/compile",VDWF:"Video decode WASM failed to download/compile",VEWF:"Video encode WASM failed to download/compile",SEWF:"Sharing encode WASM failed to download/compile",SDWF:"Sharing decode WASM failed to download/compile",MWCGLF:"WebGL context failed to be restored",VCFF:"Captured video format is not supported",SHHF:"Initialization of sharing decode WASM failed",SDSF:"Sharing decode WebSocket failed to connect after 10 attempts",SEHF:"Initialization of sharing encode WASM failed",SESF:"Sharing encode WebSocket failed to connect after 10 attempts",ADHF:"Initialization of audio decode WASM failed",ADSF:"Audio decode WebSocket failed to connect after 10 attempts",AEHF:"Initialization of audio encode WASM failed",AESF:"Audio encode WebSocket failed to connect after 10 attempts",VDHF:"Initialization of video decode WASM failed",VDSF:"Video decode WebSocket failed to connect after 10 attempts",VEHF:"Initialization of video encode WASM failed",VESF:"Video encode WebSocket failed to connect after 10 attempts",INITVDCERR:"An error occurred when initializing video WebRTC DataChannel",INITADCERR:"An error occurred when initializing audio WebRTC DataChannel"},s=["VCAPTURE","VFCLOSE","VDCS","CPC","VDCR","ADCS","ADCR","VCFOK","VCTN","ABRTT"];var d=function(){function e(){this.base_time=null,this.monitor="",this.last_get_monitor_time=0,this.checkIsNecessaryLogMap=new Map,this.highfrequencyerror=new Map,this.startSendLog=!1}return e.prototype={init:function(){this.base_time||(this.base_time=(new Date).getTime(),this.checkIsNecessaryLogMap=new Map,this.add_monitor("STARTMONITOR"+this.base_time))},need_to_flush_log:function(e){return e&&("F"==e[e.length-1]||"f"==e[e.length-1])&&this.startSendLog},append_to_monitor:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)try{const i=2e3;this.monitor&&this.monitor.length+e.length>i&&this.send_instant_monitor(),this.monitor?this.monitor+=e:this.monitor=e,t&&this.send_instant_monitor()}catch(e){n.default.error("Error when adding data to the monitor log",e)}},add_monitor:function(e,t){if(this.base_time||this.init(),e&&this.checkLogValidity(e))try{if(o[e]){let i=o[e];t&&(i="".concat(i,". Additional information: ").concat(t)),n.default.error(i)}let i=(new Date).getTime()-this.base_time,a=e+"("+Math.ceil(i)+")",r=this.need_to_flush_log(e);this.append_to_monitor(a,r)}catch(e){n.default.error("Error when adding data to the monitor log",e)}},get_monitor:function(){let e=this.monitor,t=(new Date).getTime();return null!=e&&(e.length>80||t-this.last_get_monitor_time>180)?(this.last_get_monitor_time=t,this.monitor=null,"WCL_M, "+e):""},get_instant_monitor:function(){let e=this.monitor;return this.monitor=null,e?"WCL_M, "+e:null},send_instant_monitor:function(){let e=this.get_instant_monitor();e&&r.default.sendMessageToRwg(a.MONITOR_LOG,{evt:a.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:e}})},send_monitor_directly:function(e){e&&this.checkLogValidity(e)&&r.default.sendMessageToRwg(a.MONITOR_LOG,{evt:a.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:e}})},add_monitor2(e){if(this.base_time||this.init(),e&&this.checkLogValidity(e)){let t=e+"("+((new Date).getTime()-this.base_time)+")";this.append_to_monitor(t)}},add_monitor3(e){if(this.base_time||this.init(),!e||!this.checkLogValidity(e))return;this.highfrequencyerror[e]?this.highfrequencyerror[e]+=1:this.highfrequencyerror[e]=1;Object(n.isPowerOf2)(this.highfrequencyerror[e])&&this.add_monitor(e,"Occurred ".concat(this.highfrequencyerror[e]," times"))},checkIsNecessaryExceptionLogAndReturnRepeatTimes(e){let t=!0,i=0;try{return this.checkIsNecessaryLogMap.get(e)&&this.checkIsNecessaryLogMap.get(e)%100!=0&&(t=!1),i=this.checkIsNecessaryLogMap.get(e),{isNecessary:t,repeatNumber:void 0===i?0:i}}catch(e){return{isNecessary:!0,repeatNumber:0}}finally{let t=this.checkIsNecessaryLogMap.get(e)||0;if(this.checkIsNecessaryLogMap.set(e,t+1),this.checkIsNecessaryLogMap.size>200){let e=Array.from(this.checkIsNecessaryLogMap.keys()).slice(0,20);console.log("delete log cache keys",e),e.forEach(e=>this.checkIsNecessaryLogMap.delete(e))}}},reset(){this.base_time=null,this.last_get_monitor_time=0,this.monitor="",this.highfrequencyerror.clear()},startSend(){this.startSendLog=!0},checkLogValidity(e){return!!this.startSendLog||!s.some(t=>-1!==e.indexOf(t))}},new e}();t.default=d},function(e,t,i){"use strict";i.d(t,"h",(function(){return a})),i.d(t,"d",(function(){return r})),i.d(t,"c",(function(){return n})),i.d(t,"b",(function(){return o})),i.d(t,"e",(function(){return s})),i.d(t,"f",(function(){return d})),i.d(t,"i",(function(){return u})),i.d(t,"a",(function(){return l})),i.d(t,"g",(function(){return c}));const a={ZOOM_CONNECTION_COMMAND:0,ZOOM_CONNECTION_AUDIO:1,ZOOM_CONNECTION_VIDEO:2,ZOOM_CONNECTION_SHARING_JPEG:3,ZOOM_CONNECTION_SHARING_VIDEO:4,ZOOM_CONNECTION_MEDIA_LOG:5,ZOOM_CONNECTION_SHARING_REMOTE_CONTROL:6,ZOOM_CONNECTION_UNKNOW:7},r={NET_WEBSOCKET:0,NET_DATACHANNEL:1,NET_WEBTRANSPORT:2},n={encode:1,decode:2},o={AUDIO:1,SHARING:2,VIDEO:3},s={UNKNOWN:0,WIN:1,MAC:2,PAD:3,MOBILE:4,CALL_IN:5,LINUX:6,WEB:7,CHROME:8},d={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},u=(()=>{const e={};for(const t in d)e[d[t]]="WCL_"+t;return e})(),l={ComputerAudio_Null:0,ComputerAudio_Connecting:1,ComputerAudio_Connected:2,DesktopAudio_Null:0,DesktopAudio_Connecting:1,DesktopAudio_Connected:2},c={[d.AUDIO_ENCODE]:"audio.encode",[d.AUDIO_DECODE]:"audio.decode",[d.VIDEO_ENCODE]:"video.encode",[d.VIDEO_DECODE]:"video.decode",[d.SHARING_ENCODE]:"share.encode",[d.SHARING_DECODE]:"share.decode"}},function(e,t,i){"use strict";i.d(t,"C",(function(){return a})),i.d(t,"j",(function(){return r})),i.d(t,"D",(function(){return n})),i.d(t,"E",(function(){return o})),i.d(t,"t",(function(){return s})),i.d(t,"k",(function(){return d})),i.d(t,"v",(function(){return u})),i.d(t,"x",(function(){return l})),i.d(t,"p",(function(){return c})),i.d(t,"s",(function(){return h})),i.d(t,"q",(function(){return f})),i.d(t,"r",(function(){return p})),i.d(t,"a",(function(){return _})),i.d(t,"b",(function(){return m})),i.d(t,"w",(function(){return g})),i.d(t,"g",(function(){return E})),i.d(t,"y",(function(){return S})),i.d(t,"z",(function(){return v})),i.d(t,"A",(function(){return C})),i.d(t,"B",(function(){return A})),i.d(t,"e",(function(){return T})),i.d(t,"d",(function(){return R})),i.d(t,"c",(function(){return I})),i.d(t,"f",(function(){return b})),i.d(t,"n",(function(){return O})),i.d(t,"o",(function(){return D})),i.d(t,"m",(function(){return w})),i.d(t,"l",(function(){return y})),i.d(t,"h",(function(){return M})),i.d(t,"u",(function(){return P})),i.d(t,"i",(function(){return N}));const a={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},r={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},n={DISABLED:0,ENABLED:1,AUTO:2},o={SUCCEED:0,UNKNOWN:-1,INVALID_ARG:-2,BROWSER_NOT_SPT:-3,DEVICE_ON_BLACKLIST:-4,INVALID_DEVICE_INFO:-5,UNKNOWN_SELECTION:-6,OTHER_EX:-7,DEVICE_NOT_ON_WHITELIST:-8,FEATURE_OPTION_DISABLED:-9},s={AVAILABLE:0,VIDEO:1,SHARE:2},d={IDLE:0,PENDING:1,READY:2,RENDERING:3},u={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},l={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},c=0,h=1,f=2,p=3,_=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],m=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},E=["intel","nvidia","apple","amd","qualcomm","arm"],S="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n struct FsUniforms {\n rotation: f32,\n };\n\n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n\n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n",v="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(6) var vertexUniforms: FsUniforms;\n\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n\n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var vPlaneTex: texture_2d;\n @group(0) @binding(5) var uniforms: FsUniforms;\n // @group(0) @binding(7) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n return color;\n }\n",C="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(5) var vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var uniforms: FsUniforms;\n // @group(0) @binding(5) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n\n return color;\n }\n",A="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n",T="\n\n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n\n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d;\n @group(0) @binding(2) var uniforms: FsUniforms;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n\n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n\n return color;\n }\n",R="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4 {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n",I="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n\n struct ClearColorUniforms {\n clearColor: vec4,\n };\n\n @group(0) @binding(0) var uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4 {\n return uniforms.clearColor;\n }\n",b={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},O={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},D={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},w=[60,120,180,360,540,720,1080,2160],y={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},M=6,P=[180,360,540,720,1080,2160],N=5},function(e,t,i){"use strict";i.r(t),i.d(t,"isPowerOf2",(function(){return r})),i.d(t,"GlobalTracingLogger",(function(){return a}));class a{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let i=e;return t instanceof ErrorEvent?(t.filename&&(i+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(i+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(i+=" Message: ".concat(t.message)),t.error&&(i+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(i+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(i+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(i+=" Message: ".concat(t.message)),t.stack&&(i+=" Stack: ".concat(t.stack)),t.name&&(i+=" Name: ".concat(t.name)),t.constraint&&(i+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(i+=" Code: ".concat(t.code)),t.reason&&(i+=" Reason: ".concat(t.reason)),i+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(i+=" Message: ".concat(t.message)),t.name&&(i+=" Name: ".concat(t.name))):i+=t?t.toString():"",i}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const i=r(this._highFrequencyLogs[e]);this._instance&&i&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var i,a;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(i=(a=this._instance).directReport)||void 0===i||i.call(a,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}}const r=e=>0==(e&e-1);let n=new a;t.default=n},function(e,t,i){var a=i(88),r=i(46);e.exports=function(e,t,i){var n=r(e,t,"set");return a(e,n,i),i},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){"use strict";i.r(t),i.d(t,"Audio_Dec_WASM_OK",(function(){return a})),i.d(t,"Audio_Dec_Handle_OK",(function(){return r})),i.d(t,"Audio_Dec_WebSocket_OK",(function(){return n})),i.d(t,"Audio_Enc_WASM_OK",(function(){return o})),i.d(t,"Audio_Enc_Handle_OK",(function(){return s})),i.d(t,"Video_Dec_WASM_OK",(function(){return d})),i.d(t,"Video_Dec_Handle_OK",(function(){return u})),i.d(t,"Video_Dec_WebSocket_OK",(function(){return l})),i.d(t,"Video_Enc_WASM_OK",(function(){return c})),i.d(t,"Video_Enc_Handle_OK",(function(){return h})),i.d(t,"Sharing_Dec_WASM_OK",(function(){return f})),i.d(t,"AUDIO_DELAY",(function(){return p})),i.d(t,"Sharing_Dec_WebSocket_OK",(function(){return _})),i.d(t,"Sharing_Handle_OK",(function(){return m})),i.d(t,"DECODE_MESSAGE",(function(){return g})),i.d(t,"Video_Capture_Tick",(function(){return E})),i.d(t,"MONITOR_MESSAGE",(function(){return S})),i.d(t,"WORKER_MAIN_VIDEO_ENCODE_RINGBUFFER_TICK",(function(){return v})),i.d(t,"WORKER_MAIN_AUDIO_ENCODE_RINGBUFFER_TICK",(function(){return C})),i.d(t,"WORKER_MAIN_VIDEO_DECODE_RINGBUFFER_TICK",(function(){return A})),i.d(t,"Audio_Encode_Preview_OK",(function(){return T})),i.d(t,"Video_Encode_Preview_OK",(function(){return R})),i.d(t,"DOWNLOAD_WASM_FROM_MAIN_THREAD",(function(){return I})),i.d(t,"APP_TROUBLESHOOTING_INFO",(function(){return b})),i.d(t,"WCL_TROUBLESHOOTING_INFO",(function(){return O})),i.d(t,"SHARING_DATA_VIDEO_MODE",(function(){return D})),i.d(t,"MOUSE_DATA_VIDEO_MODE",(function(){return w})),i.d(t,"SHARING_DECODE_MESSAGE",(function(){return y})),i.d(t,"VIDEO_ENCODED_DATA",(function(){return M})),i.d(t,"AUDIO_ENCODED_DATA",(function(){return P})),i.d(t,"WASMPTR",(function(){return N})),i.d(t,"AUDIO_MONITOR_LOG",(function(){return V})),i.d(t,"VIDEO_RESOLUTION_UPDATE",(function(){return k})),i.d(t,"VIDEO_RENDER_MONITOR_LOG",(function(){return U})),i.d(t,"Sharing_Width_And_Height_Info",(function(){return L})),i.d(t,"SHARING_RENDER_MONITOR_LOG",(function(){return x})),i.d(t,"SHARING_GET_IMAGE_DATA_WRONG",(function(){return W})),i.d(t,"AES_GCM_IV_CALLBACK_FROM_WASM",(function(){return B})),i.d(t,"CURRENT_SSRC_TIME",(function(){return G})),i.d(t,"WhiteBoard_Video_Capture_Tick",(function(){return F})),i.d(t,"GLOBAL_TRACING_LOG",(function(){return H})),i.d(t,"Video_Sharing_Handle_OK",(function(){return K})),i.d(t,"CURRENT_DECODE_VIDEO_QUALITY",(function(){return j})),i.d(t,"CURRENT_DECODE_VIDEO_FPS",(function(){return Y})),i.d(t,"CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT",(function(){return q})),i.d(t,"CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT",(function(){return X})),i.d(t,"SHARING_FIRST_DECODE_FRAME_RECEIVED",(function(){return Q})),i.d(t,"VIDEO_CAPTURER_RESOLUTION_CHANGE",(function(){return z})),i.d(t,"VIDEO_CAPTURE_FRAME_COUNT_STATISTIC",(function(){return J})),i.d(t,"SHARING_CAPTURE_FRAME_COUNT_STATISTIC",(function(){return Z})),i.d(t,"UNSUPPORTED_SHARING_FORMAT",(function(){return $})),i.d(t,"UNSUPPORTED_VIDEO_FORMAT",(function(){return ee})),i.d(t,"FIRST_SHARING_FRAME_FOR_MOBILE",(function(){return te})),i.d(t,"CONNECT_WEBTRANSPORT_OK",(function(){return ie})),i.d(t,"CONNECT_WEBTRANSPORT_CLOSE",(function(){return ae})),i.d(t,"CURRENT_MEDIA_DATA_TRANSPORT_TYPE",(function(){return re})),i.d(t,"CONNECT_WEBSOCKET_CLOSE",(function(){return ne})),i.d(t,"CURRENT_ENCODED_TYPE",(function(){return oe})),i.d(t,"WHITEBOARD_WORKER_MESSAGE",(function(){return se})),i.d(t,"NETWORK_QUALITY_CHANGE",(function(){return de})),i.d(t,"NETWORK_QUALITY_CHANGE_AUDIO",(function(){return ue})),i.d(t,"WEBCODEC_PERFORMANCE_STATUS",(function(){return le})),i.d(t,"DATACHANNEL_OPEN",(function(){return ce})),i.d(t,"DATACHANNEL_ERROR",(function(){return he})),i.d(t,"DATACHANNEL_CLOSE",(function(){return fe})),i.d(t,"MSG_QUEUE_DATA",(function(){return pe})),i.d(t,"MSG_BUFFER_TICKT",(function(){return _e})),i.d(t,"MSG_QUEUE_STATUS",(function(){return me})),i.d(t,"CLOSE_TRANSPORT",(function(){return ge})),i.d(t,"CREATE_MSGSOCK_TRANSPORT",(function(){return Ee})),i.d(t,"TRANSPORT_SET_SABBUFF",(function(){return Se})),i.d(t,"TRANSPORT_SET_MSGPORT",(function(){return ve})),i.d(t,"WORKER_HEARTBEAT",(function(){return Ce})),i.d(t,"RECEIVE_ANNOTATION_PDU",(function(){return Ae})),i.d(t,"Audio_Dec_WASM_FAILED",(function(){return Te})),i.d(t,"Audio_Dec_Handle_FAILED",(function(){return Re})),i.d(t,"Audio_Dec_WebSocket_FAILED",(function(){return Ie})),i.d(t,"Audio_Enc_WASM_FAILED",(function(){return be})),i.d(t,"Audio_Enc_Handle_FAILED",(function(){return Oe})),i.d(t,"Video_Dec_WASM_FAILED",(function(){return De})),i.d(t,"Video_Dec_Handle_FAILED",(function(){return we})),i.d(t,"Video_Dec_WebSocket_FAILED",(function(){return ye})),i.d(t,"Video_Enc_WASM_FAILED",(function(){return Me})),i.d(t,"Video_Enc_Handle_FAILED",(function(){return Pe})),i.d(t,"Sharing_Dec_WASM_FAILED",(function(){return Ne})),i.d(t,"Sharing_Handle_FAILED",(function(){return Ve})),i.d(t,"Sharing_Dec_WebSocket_FAILED",(function(){return ke})),i.d(t,"AUDIO_CLIPPING",(function(){return Ue})),i.d(t,"MULTIVIEW_WEBGL_CONTEXT_LOST",(function(){return Le})),i.d(t,"WEBGL_CONTEXT_CREATE_FAILED",(function(){return xe})),i.d(t,"MULTIVIEW_WEBGL_CONTEXT_RESTORED",(function(){return We})),i.d(t,"WASM_MEMORY_GRROW_FAILED",(function(){return Be})),i.d(t,"SHARING_HEALTH_CHECK_FAILED",(function(){return Ge})),i.d(t,"VIDEO_HEALTH_CHECK_FAILED",(function(){return Fe})),i.d(t,"AUDIO_HEALTH_CHECK_FAILED",(function(){return He})),i.d(t,"WEBRTC_VIDEO_HEALTH_CHECK_FAILED",(function(){return Ke})),i.d(t,"WEBRTC_AUDIO_HEALTH_CHECK_FAILED",(function(){return je}));const a=1,r=2,n=3,o=4,s=5,d=7,u=8,l=9,c=10,h=11,f=12,p=14,_=15,m=16,g=18,E=20,S=21,v=22,C=23,A=24,T=26,R=27,I=30,b=31,O=35,D=36,w=37,y=38,M=39,P=42,N=47,V=48,k=50,U=51,L=52,x=53,W=54,B=56,G=57,F=60,H=61,K=62,j=66.5,Y=66.6,q=67,X=68,Q=69,z=71,J=72,Z=73,$=75,ee=76,te=78,ie=105,ae=106,re=107,ne=108,oe=109,se=120,de=121,ue=122,le=123,ce=124,he=125,fe=126,pe=127,_e=128,me=129,ge=132,Ee=133,Se=135,ve=136,Ce=137,Ae=151,Te=-1,Re=-2,Ie=-3,be=-4,Oe=-5,De=-7,we=-8,ye=-9,Me=-10,Pe=-11,Ne=-12,Ve=-14,ke=-15,Ue=-23,Le=-26,xe=-27,We=-28,Be=-35,Ge=-129,Fe=-130,He=-131,Ke=-135,je=-136},function(e,t,i){"use strict";i.r(t),i.d(t,"QOS_DEFAULT_POLLING_INTERVAL",(function(){return a})),i.d(t,"VIDEO_MONITOR_LOG_SECOENDS",(function(){return r})),i.d(t,"THREAD_STATE_IDLE",(function(){return n})),i.d(t,"THREAD_STATE_CREATING",(function(){return o})),i.d(t,"THREAD_STATE_CREATED",(function(){return s})),i.d(t,"MEDIA_S2C_KEEPALIVE",(function(){return d})),i.d(t,"MEDIA_AUDIO_DATA",(function(){return u})),i.d(t,"MEDIA_AUDIO_RTCP",(function(){return l})),i.d(t,"MEDIA_AUDIO_FEATURE",(function(){return c})),i.d(t,"MEDIA_VIDEO_DATA",(function(){return h})),i.d(t,"MEDIA_VIDEO_RTCP",(function(){return f})),i.d(t,"MEDIA_NTP_UPDATE",(function(){return p})),i.d(t,"VIDEO_KEYFRAME_REQ",(function(){return _})),i.d(t,"VIDEO_CAPTURER_RESOLUTION_360P",(function(){return m})),i.d(t,"VIDEO_CAPTURER_RESOLUTION_720P",(function(){return g})),i.d(t,"VIDEO_CAPTURER_RESOLUTION_1080P",(function(){return E})),i.d(t,"UPDATE_ENCRYPTION_GCM_MODEL_KEY",(function(){return S})),i.d(t,"MEDIA_AUDIO_QOS_SESS_DATA",(function(){return v})),i.d(t,"INTERPRETATION_ENABLE",(function(){return C})),i.d(t,"INTERPRETATION_SET_LANG",(function(){return A})),i.d(t,"INTERPRETATION_MUTE",(function(){return T})),i.d(t,"INTERPRETATION_SET_INTERPRETER",(function(){return R})),i.d(t,"DATA_DIRECTION_FROM_RECEIVE",(function(){return I})),i.d(t,"DATA_DIRECTION_FROM_SEND",(function(){return b})),i.d(t,"RWG_WCL_PDU_QOS_DATA",(function(){return O})),i.d(t,"RWG_WCL_PDU_QOS_DATA_VIDEO",(function(){return D})),i.d(t,"serverHeartbeatMaxTimeoutSeconds",(function(){return w})),i.d(t,"RQUEST_ANIMATION_MODE",(function(){return y})),i.d(t,"SET_INTERVAL_MODE",(function(){return M})),i.d(t,"VIDEO_INVALID",(function(){return P})),i.d(t,"VIDEO_RGBA",(function(){return N})),i.d(t,"VIDEO_I420",(function(){return V})),i.d(t,"VIDEO_NV12",(function(){return k})),i.d(t,"VIDEO_BGRA",(function(){return U})),i.d(t,"EVENT_ROLLBACK_BUFFER",(function(){return L})),i.d(t,"EVENT_NEEDMORE_DATA",(function(){return x})),i.d(t,"EVENT_CAPTURE_DATA",(function(){return W})),i.d(t,"EVENT_CACHE_SIZE",(function(){return B})),i.d(t,"WEBCODEC_ENCODE_OFF",(function(){return G})),i.d(t,"WEBCODEC_DECODE_OFF",(function(){return F})),i.d(t,"QosSession",(function(){return H})),i.d(t,"QosConnectType",(function(){return K})),i.d(t,"MAX_VIDEO_CAPTURE_FPS",(function(){return j})),i.d(t,"MIN_VIDEO_CAPTURE_FPS",(function(){return Y})),i.d(t,"VIDEO_CAPTURE_FPS",(function(){return q})),i.d(t,"VIDEO_CAPTURE_20FPS",(function(){return X})),i.d(t,"DOWN_VIDEO_CAPTURE_FPS",(function(){return Q})),i.d(t,"LOWER_VIDEO_CAPTURE_FPS",(function(){return z})),i.d(t,"VIDEO_DATA_MAX_SIZE",(function(){return J})),i.d(t,"VIDEO_FRAME_BUFFER_SIZE",(function(){return Z})),i.d(t,"SHARING_NULL",(function(){return $})),i.d(t,"SHARING_NORMAL",(function(){return ee})),i.d(t,"SHARING_VIDEO_MODE",(function(){return te})),i.d(t,"SHARING_VIDEO_MODE_CAPTURED_FPS",(function(){return ie})),i.d(t,"SHARING_NORMAL_MODE_CAPTURED_FPS",(function(){return ae})),i.d(t,"VIDEO_RINGBUF_PKG_NUM",(function(){return re})),i.d(t,"ADDITIONNAL_MULTITHREAD_NUMBER_ENCODE_FOR_360P",(function(){return ne})),i.d(t,"ADDITIONNAL_MULTITHREAD_NUMBER_ENCODE_FOR_720P",(function(){return oe})),i.d(t,"ADDITIONNAL_MULTITHREAD_NUMBER_ENCODE_FOR_1080p",(function(){return se})),i.d(t,"WCL_PLATFORM_TYPE",(function(){return de})),i.d(t,"AS_CAPTURE_SOURCE",(function(){return ue})),i.d(t,"MEDIA_COMMAND",(function(){return le})),i.d(t,"RENDER_UNSET",(function(){return ce})),i.d(t,"RENDER_IN_WORKER",(function(){return he})),i.d(t,"RENDER_IN_MAIN",(function(){return fe})),i.d(t,"WEBRTC_NO_AUDIO_MODE",(function(){return pe})),i.d(t,"WEBRTC_COMMPUTER_AUDIO_MODE",(function(){return _e})),i.d(t,"WEBRTC_SHARE_AUDIO_MODE",(function(){return me})),i.d(t,"WEBRTC_MULTI_AUDIO_MODE",(function(){return ge})),i.d(t,"VIDEO_FRAME",(function(){return Ee})),i.d(t,"SHARING_FRAME",(function(){return Se})),i.d(t,"MAX_RENDER_WITHOUT_SAB",(function(){return ve})),i.d(t,"ACTIVE_SPEAKER_SSRC",(function(){return Ce})),i.d(t,"FACE_MODE_UNKNOW",(function(){return Ae})),i.d(t,"FACE_MODE_USER",(function(){return Te})),i.d(t,"FACE_MODE_ENVIRONMENT",(function(){return Re})),i.d(t,"ORIGINAL_SOUND_OFF",(function(){return Ie})),i.d(t,"ORIGINAL_SOUND_ON",(function(){return be})),i.d(t,"ORIGINAL_SOUND_STEREO",(function(){return Oe})),i.d(t,"ORIGINAL_SOUND_HIGHFIDELITY",(function(){return De})),i.d(t,"ORIGINAL_SOUND_HIGHFIDELITY_STEREO",(function(){return we})),i.d(t,"SHARE_AUDIO",(function(){return ye})),i.d(t,"ORIGINAL_SOUND_OFF_HIGH_BITRATE",(function(){return Me})),i.d(t,"PUBLISHER_ICEConnectionState_Failed",(function(){return Pe})),i.d(t,"SUBSCRIBER_ICEConnectionState_Failed",(function(){return Ne})),i.d(t,"NO_MESSAGE_FAILOVER",(function(){return Ve})),i.d(t,"WS_ERROR_FAILOVER",(function(){return ke})),i.d(t,"WS_CLOSE_FAILOVER",(function(){return Ue})),i.d(t,"RUNTIME_ERROR_FAILOVER",(function(){return Le})),i.d(t,"WEBRTC_FALLBACK_TO_WASM",(function(){return xe})),i.d(t,"VB_CONSTANT",(function(){return We})),i.d(t,"AUDIO_ENCODE_WORKER",(function(){return Be})),i.d(t,"AUDIO_DECODE_WORKER",(function(){return Ge})),i.d(t,"AUDIO_WASM_WORKLET",(function(){return Fe})),i.d(t,"AUDIO_WEBRTC_WORKLET",(function(){return He})),i.d(t,"DATACHANNEL_MONITOR_SEPARATOR",(function(){return Ke})),i.d(t,"LOADEDMETADATAT_IMEOUT",(function(){return je})),i.d(t,"MEDIA_SOLUTION_WEBRTC",(function(){return Ye})),i.d(t,"MEDIA_SOLUTION_WASM",(function(){return qe})),i.d(t,"AudioProfile",(function(){return Xe})),i.d(t,"REPORT_KEY_SHARE",(function(){return Qe})),i.d(t,"REPORT_KEY_NORMAL",(function(){return ze})),i.d(t,"WEBGL_CONTEXT_INVALID_WHEN_START",(function(){return Je})),i.d(t,"HEALTH_CHECK_TYPE",(function(){return Ze})),i.d(t,"HEALTH_CHECK_OPERATOR",(function(){return $e})),i.d(t,"REMINDER_AFTER_MUTED",(function(){return et})),i.d(t,"RECAPTURE_AUDIO_AFTER_MUTED",(function(){return tt})),i.d(t,"NET_QUALITY_LEVEL",(function(){return it})),i.d(t,"NET_BW_LEVEL",(function(){return at}));const a=1e3,r=5,n=43,o=44,s=45,d=0,u=1,l=6,c=146,h=2,f=7,p=9,_=17,m=10,g=11,E=12,S=102,v=107,C=0,A=1,T=2,R=3,I=0,b=1,O=108,D=104,w=65,y=0,M=1,P=-1,N=0,V=1,k=2,U=3,L=0,x=1,W=2,B=3,G=1,F=2,H={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},K={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},j=30,Y=1,q=24,X=20,Q=15,z=10,J=8294400,Z=5,$=0,ee=1,te=2,ie=15,ae=5,re=400,ne=3,oe=7,se=8,de={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},ue={DESKTOP_SOURCE:0,UAC_SOURCE:1},le={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ce=-1,he=0,fe=1,pe=0,_e=1,me=2,ge=_e+me,Ee=0,Se=1,ve=25,Ce=1,Ae=-1,Te=0,Re=1,Ie=0,be=1,Oe=2|be,De=4|be,we=Oe|De,ye=8,Me=16,Pe=3,Ne=107,Ve="100",ke="101",Ue="102",Le="103",xe="150",We="WCL_M,isWebEnabled:1, isLocalEnabled:1, isSmartBkgnd:1, bkgType:2",Be=0,Ge=1,Fe=2,He=3,Ke="{[WLCCONT]}",je=1e4,Ye=1,qe=2,Xe={[Ie]:new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),[be]:new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),[Oe]:new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),[De]:new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),[we]:new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),[ye]:new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),[Me]:new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]])},Qe="SHARE",ze="NORMAL",Je="WebGLContextInvalidWhenStart",Ze={VIDEO:0,SHARE:1},$e={PAUSE:0,RESUME:1,STOP:2},et=!0,tt=!1,it={NET_QUALITY_UNKNOWN:-1,NET_QUALITY_VERY_BAD:0,NET_QUALITY_BAD:1,NET_QUALITY_NOT_GOOD:2,NET_QUALITY_NORMAL:3,NET_QUALITY_GOOD:4,NET_QUALITY_EXCELLENT:5},at={NET_BW_LEVEL_UNKNOWN:-1,NET_BW_LEVEL_VERY_LOW:0,NET_BW_LEVEL_LOW:1,NET_BW_LEVEL_NORMAL:2}},function(e,t,i){"use strict";i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return u})),i.d(t,"h",(function(){return l})),i.d(t,"g",(function(){return c})),i.d(t,"d",(function(){return h})),i.d(t,"i",(function(){return f})),i.d(t,"j",(function(){return p})),i.d(t,"e",(function(){return _})),i.d(t,"c",(function(){return m})),i.d(t,"f",(function(){return E}));var a=i(9),r=i(7),n=i(13),o=i(2);function s(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}const d="function"!=typeof importScripts;function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;d?r.default.error(e,t):l(e,t)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var i,r,n,o;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(i=t)||void 0===i?void 0:i.message)+" Stack: "+(null!==(r=null===(n=t)||void 0===n||null===(n=n.error)||void 0===n?void 0:n.stack)&&void 0!==r?r:null===(o=t)||void 0===o?void 0:o.stack),t=null);postMessage({status:a.GLOBAL_TRACING_LOG,errorMessage:e,errorEvent:t})}function c(e){postMessage({status:a.GLOBAL_TRACING_LOG,errorMessage:e,level:"low"})}function h(e){postMessage({status:a.WCL_TROUBLESHOOTING_INFO,data:e})}function f(e){postMessage({status:a.MULTIVIEW_WEBGL_CONTEXT_LOST,canvasId:e,replaceCanvas:!1})}function p(e){postMessage({status:a.MULTIVIEW_WEBGL_CONTEXT_RESTORED,canvasId:e})}function _(e){d?Object(n.NotifyUIError)(o.WEBGL_CONTEXT_INVALID,e):postMessage({status:a.WEBGL_CONTEXT_CREATE_FAILED,where:e})}class m{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let i=e.byteLength-this.sharedBufferList.bytesPerElement;if(i>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),a=i>e?i:e;if(a+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(a)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){l("Error in YuvWrap.recycle: ".concat(e))}}}const g=["","MOZ_","OP_","WEBKIT_"];function E(e,t){for(var i=0;i2&&i.frames%5==0&&i.lastTime-i.firstTime>=1e3){const t=Math.floor(1e3/((i.lastTime-i.firstTime)/(i.frames-1)));i.fps!==t&&(this._notifyFPS(e,t),i.fps=t),i.firstTime=i.lastTime,i.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,i)=>{const a=this.ssrcInfoMap.get(i);a&&e-a.lastTime>2e3&&(this.ssrcInfoMap.delete(i),this._notifyFPS(i,0))})}_notifyFPS(e,t){postMessage({status:a.CURRENT_DECODE_VIDEO_FPS,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));const a={AUDIO_BRIDGE_1:{index:1,default:15},AUDIO_BRIDGE_2:{index:2,default:1},HW_ENCODER_FOR_360P:{index:3,default:0},WEBGL_CONTEXT_LOST_OPT:{index:4,default:0},RECEIVE_720P_ON_SAFARI:{index:5,default:0},MULTI_VIEW_ON_MOBILE:{index:8,default:0},AUDIO_DENOISE:{index:11,default:1},VB_ON_FIREFOX:{index:12,default:0},ENABLE_DECODE_720P_ON_IOS:{index:15,default:1},UNIFIED_RENDER:{index:20,default:0},WEBGPU_RENDERER:{index:21,default:0},ORIGINAL_SOUND:{index:22,default:0},SEND_1080P_VIDEO:{index:24,default:0},SEND_1080P_VIDEO_SHARE:{index:25,default:0},VB_ON_SAFARI_17:{index:27,default:0},WEBGL2_RENDERER:{index:29,default:1},AUDIO_ECHO_DETECT:{index:31,default:0},UNIFIED_RENDER_ON_MOBILE:{index:34,default:0},WEBCODEC_DECODE_OPTION:{index:36,default:0},HW_WEBCODEC_ON_SAFARI:{index:37,default:1},HW_DECODE_FOR_360P:{index:38,default:0},WEBCODEC_ON_ANDROID_CHROME:{index:39,default:0},SUPPORT_ANNOTATION:{index:40,default:0},WEBCODEC_ENCODE_OPT_1ON1:{index:41,default:0},CAP_WEBCODEC_SUPPORT:{index:42,default:0},WEBRTC_STG:{index:43,default:0},WEBGL_CANVAS_OPTION_OPT:{index:44,default:1},DEFAULT_RENDERER:{index:45,default:3},WEB_TRANSPORT_CONTROL:{index:46,default:0},ENABLE_TP_RLB_WEBSOCKET:{index:47,default:0},ENABLE_TRANSFERABLE_RTC_DATACHANNEL:{index:48,default:1},ENABLE_WEBRTC_FEATURE:{index:49,default:0},WEBRTC_AUTO_CONFIG:{index:50,default:0,candidates:{NO_CONFIG:0,MOB_ANDROID:1,MOB_IOS:2,DESKTOP:4,OTHERS:8}},FORCE_TO_USE_WEBRTC:{index:51,default:0,candidates:{NO_CONFIG:0,AUDIO_ON_BROWSER_32BIT:1,VIDEO_ON_BROWSER_32BIT:2}},ENABLE_WEBRTC_TURN_SERVERS:{index:52,default:0},EXTRA_DEVICE_INTERVAL_ENUMERATE:{index:53,default:0,candidates:{DISABLE:0,ENABLE:1}}}},function(e,t,i){"use strict";i.r(t),i.d(t,"CameraOccupiedError",(function(){return r})),i.d(t,"CAPTURE_ERROR_TYPE",(function(){return n})),i.d(t,"SetNotifyUIFn",(function(){return l})),i.d(t,"SetMonitorFn",(function(){return c})),i.d(t,"NotifyUIError",(function(){return h}));var a=i(7);function r(e){this.name="CameraOccupiedError",this.message=e,this.stack=(new Error).stack}r.prototype=new Error;const n={EXCEPTION:-1,PERMISSION_RESET:-2,LOST_ACCESS:-3},o=new Map;function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let d=null,u=null;function l(e){d=e}function c(e){u=e}function h(e,t){var i,r;if(!function(e){const t=performance.now();return(!o.has(e)||t-o.get(e)>5e3)&&(o.set(e,t),!0)}(e))return;let n;try{n=s("object"==typeof t?JSON.stringify(t):t)}catch(e){n=s(t)}null===(i=u)||void 0===i||i("NEM-".concat(e,"-").concat(n)),a.default.error("NotifyUIError,event=".concat(e,",data=").concat(n)),null===(r=d)||void 0===r||r(e,t)}},function(e,t,i){var a=i(81);e.exports=function(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){"use strict";var a=i(38),r=i(48);let n=a;i.n(r)()(a)&&(n=window.PubSub);let o=function(){};o.prototype={publish(){return n.publish.apply(this,arguments)},publishSync(){return n.publishSync.apply(this,arguments)},trigger(){return this.publish.apply(this,arguments)},triggerSync(){return this.publishSync.apply(this,arguments)},emit(){return this.publish.apply(this,arguments)},subscribe(){return n.subscribe.apply(this,arguments)},on(){return this.subscribe.apply(this,arguments)},unsubscribe(){return n.unsubscribe.apply(this,arguments)},clearAllSubscriptions(){n.clearAllSubscriptions()}},t.a=new o},function(e,t,i){"use strict";i.d(t,"h",(function(){return n})),i.d(t,"e",(function(){return o})),i.d(t,"g",(function(){return s})),i.d(t,"f",(function(){return d})),i.d(t,"d",(function(){return u})),i.d(t,"a",(function(){return l})),i.d(t,"b",(function(){return c})),i.d(t,"c",(function(){return h}));var a=i(11),r=i(6);function n(e,t){const i=Math.pow(10,t);return Math.floor(e*i)/i}function o(e,t){const i=Math.pow(10,t);return Math.ceil(e*i)/i}function s(e,t,i){if(!e||t<0||i<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(i));let r=!1,n=0;const o=e.acquireGPUFeaturesHelper();return o&&(n=o.queryMaxTextureDimension2D(),n>0&&(r=t>n||i>n)),r&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(i," max:").concat(n)),Object(a.d)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(i," max:").concat(n))),r}function d(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let i=!1,r=0;const n=e.acquireGPUFeaturesHelper();return n&&(r=n.queryMaxBufferSize(),r>0&&(i=t>r)),i&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(r)),Object(a.d)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(r))),i}function u(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===r.s||t===r.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function l(e,t){let i=0,a=0,r=0,n=0;const o=t.width/t.height;return e.width/e.height>o?(a=e.height,i=a*o,r=(e.width-i)/2,n=0):(i=e.width,a=i/o,r=0,n=(e.height-a)/2),i<=e.canvas.width&&(r=(e.canvas.width-i)/2),a<=e.canvas.height&&(n=(e.canvas.height-a)/2),{x:r,y:n,width:i,height:a}}function c(e,t,i,a){if(!e||!t||!i)return null;const n=t.width/t.height;let o=t.width,s=t.height;if(t.width>e.width||t.height>e.height){const i=e.width/t.width,a=e.height/t.height,r=Math.min(i,a);o*=r,s*=r}let d=0,u=0;e.width/e.height>n?(u=Math.floor(e.height/s)*s,d=Math.floor(u*n/o)*o,d>e.width&&(d=Math.floor(e.width/o)*o,u=Math.floor(d/n/s)*s)):(d=Math.floor(e.width/o)*o,u=Math.floor(d/n/s)*s,u>e.height&&(u=Math.floor(e.height/s)*s,d=Math.floor(u*n/o)*o));let l=0,c=0,h=0,f=0;a==r.p?(l=1-(l+(s-1)/e.height),c=t.left/e.width,f=1-t.top/e.height,h=c+o/e.width):a==r.s?(c=1-(l+(s-1)/e.height),h=1-t.top/e.height,l=t.left/e.width,f=c+o/e.width):a==r.q?(l=t.top/e.height,c=t.left/e.width,f=l+(s-1)/e.height,h=c+o/e.width):a==r.r&&(c=t.top/e.height,h=l+(s-1)/e.height,l=t.left/e.width,f=c+o/e.width);let p=[],_=[{x:h,y:f},{x:h,y:l},{x:c,y:l},{x:h,y:f},{x:c,y:f},{x:c,y:l}];for(let e=0;e<_.length;++e){let t={u:_[e].x,v:_[e].y};p.push(t)}let m=[];for(let e=0;ee){const t=a.height*e;u=o/i.height,l=(Math.round((a.width-t)/2)+n)/i.width,h=u+(a.height-1)/i.height,c=l+t/i.width}else{const t=a.width/e;u=(Math.round((a.height-t)/2)+o)/i.height,l=n/i.width,h=u+(t-1)/i.height,c=l+a.width/i.width}s==r.p?(u=1-(u+(a.height-1)/i.height),l=a.left/i.width,h=1-a.top/i.height,c=l+a.width/i.width):s==r.s?(l=1-(u+(a.height-1)/i.height),c=1-a.top/i.height,u=a.left/i.width,h=l+a.width/i.width):s==r.q?(u=a.top/i.height,l=a.left/i.width,h=u+(a.height-1)/i.height,c=l+a.width/i.width):s==r.r&&(l=a.top/i.height,c=u+(a.height-1)/i.height,u=a.left/i.width,h=l+a.width/i.width)}else{const e=a.width/a.height;let t=a.width,d=a.height;if(a.width>i.width||a.height>i.height){const e=i.width/a.width,r=i.height/a.height,n=Math.min(e,r);t*=n,d*=n}let f=0,p=0;i.width/i.height>e?(p=Math.floor(i.height/d)*d,f=Math.floor(p*e/t)*t,f>i.width&&(f=Math.floor(i.width/t)*t,p=Math.floor(f/e/d)*d)):(f=Math.floor(i.width/t)*t,p=Math.floor(f/e/d)*d,p>i.height&&(p=Math.floor(i.height/d)*d,f=Math.floor(p*e/t)*t)),s==r.p?(u=1-(u+(d-1)/i.height),l=a.left/i.width,h=1-a.top/i.height,c=l+t/i.width,a.height>a.width&&(l=o(l,2),c=n(c,2))):s==r.s?(l=1-(u+(d-1)/i.height),c=1-a.top/i.height,u=a.left/i.width,h=l+t/i.width):s==r.q?(u=a.top/i.height,l=a.left/i.width,h=u+(d-1)/i.height,c=l+t/i.width):s==r.r&&(l=a.top/i.height,c=u+(d-1)/i.height,u=a.left/i.width,h=l+t/i.width)}let f=[],p=[{x:c,y:h},{x:c,y:u},{x:l,y:u},{x:c,y:h},{x:l,y:h},{x:l,y:u}];for(let e=0;e=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},a.prototype.peek=function(){return 0{r[t]=function(){a&&console[t](e,...i(arguments))}}),r.isEnable=function(){return a},r};r.isEnable=function(){return a},t.a=r},function(e,t,i){"use strict";function a(e,t,i,a){return n(e,t),r(i,"set"),function(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}(e,i,a),a}function r(e,t){if(void 0===e)throw new TypeError("attempted to "+t+" private static field before its declaration")}function n(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")}class o{static isEnableCanvasCtxOptionsOpt(){return t=s,n(e=o,o),r(t,"get"),function(e,t){return t.get?t.get.call(e):t.value}(e,t);var e,t}static setIsEnableCanvasCtxOptionsOpt(e){a(o,o,s,e)}}var s={writable:!0,value:!1};t.a=o},function(e,t,i){"use strict";var a=i(7);t.a=class{static read(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!e)return a.default.error("[ABOptionsReader] error in read(): options(".concat(e,") is invalid")),r;const n=e.length;if(t<0||i<=0||t>n||t+i-1>n)return a.default.error("[ABOptionsReader] error in read(): invalid parameters! opLen=".concat(n,", bitIndex=").concat(t,", readCount=").concat(i)),r;const o=n-t-i+1,s=n-t+1;try{const t=e.slice(o,s),i=parseInt(t,16);return isNaN(i)?r:i}catch(e){a.default.error("[ABOptionsReader] error in read()",e)}return r}static batchRead(e,t){const i=new Map;for(let a=0;a0&&(p=o.blacklist),s){if(""!==c&&e.includes(c)){if(""===h&&""===f&&!p)return!0;if(t===f||""!==f&&t.includes(f))return!0;if(""!==h&&t.includes(h)){if(p){return!this.isHitBlacklist(e,t,i,h,p)}return!0}if(""!==h)return!1;if(p){return!this.isHitBlacklist(e,t,i,h,p)}return!0}}else a.default.error("isOnWebCodecWhitelist() no vendor field in the json entry! entry:".concat(o))}return!1},isGPUProfileOnWebCodecWhitelist(e,t,i){if(!this.isOffscreenCanvasSupported())return a.default.log("isGPUProfileOnWebCodecWhitelist() OffscreenCanvas is not supported."),!1;try{const r=i.vendor,n=i.renderInfo,o=this.isOnWebCodecWhitelist(r,n,e,t);return a.default.directReport("isGPUProfileOnWebCodecWhitelist() isOnWhitelist:".concat(o,", vendor:").concat(r,", renderInfo:").concat(n,", codecType:").concat(e,", config:").concat(JSON.stringify(t))),o}catch(e){return!1}},evalWebRTCStrategy(e,t,i,n){var o,s,d,u,l;let c={stg:r.D.DISABLED,errNo:r.E.UNKNOWN,errMsg:""};if(!i)return c.stg=r.D.DISABLED,c.errNo=r.E.BROWSER_NOT_SPT,c.errMsg="webrtc is disabled(not supported by browser).",c;if(n===r.D.DISABLED)return c.stg=r.D.DISABLED,c.errNo=r.E.SUCCEED,c;if(!e||0==e.length)return c.stg=n,c.errNo=r.E.SUCCEED,c;const h={os:null===(o=t.os)||void 0===o?void 0:o.toLowerCase(),browserName:null===(s=t.browserName)||void 0===s?void 0:s.toLowerCase(),browserVersion:null===(d=t.browserVersion)||void 0===d?void 0:d.toLowerCase(),vendor:null===(u=t.vendor)||void 0===u?void 0:u.toLowerCase(),renderInfo:null===(l=t.renderInfo)||void 0===l?void 0:l.toLowerCase(),isAstcSupported:t.isAstcSupported};for(const i of e){let e=0,n=!1;if(i.os&&""!==i.os){if(!h.os.includes(i.os.toLowerCase()))continue;h.os.includes("mac")&&(n=!0),e|=4096}let o=!1;if(i.browser&&i.browser.name&&""!==i.browser.name){if(!h.browserName.includes(i.browser.name.toLowerCase()))continue;if(h.browserName.includes("safari")&&(o=!0),i.browser.versions&&i.browser.versions.length>0){if(!i.browser.versions.some(e=>this.isBrowserVersionHitBlacklist(t.browserVersion,e)))continue;e|=256}else e|=256}if(i.vendor&&""!==i.vendor)if(h.vendor.includes(i.vendor.toLowerCase()))e|=16;else{if(!n||!o||"intel"!==i.vendor.toLowerCase()||h.isAstcSupported)continue;e|=16}if(i.renderInfo&&""!==i.renderInfo){if(h.renderInfo!==i.renderInfo.toLowerCase())continue;e|=1}if(e>0)return c.stg=r.D.DISABLED,c.errNo=r.E.DEVICE_ON_BLACKLIST,c.errMsg="webrtc is disabled(hit blacklist).",a.default.log("evalWebRTCStrategy() stg:".concat(JSON.stringify(c))),c}return c.stg=n,c.errNo=r.E.SUCCEED,c},isOnWebRTCWhitelist(e){var t,i;if(!e)return!1;a.default.directReport("isOnWebRTCWhitelist() deviceInfo=".concat(JSON.stringify(e)));const r={os:null===(t=e.os)||void 0===t?void 0:t.toLowerCase(),browserName:null===(i=e.browserName)||void 0===i?void 0:i.toLowerCase()};return[{browserName:"chrome",os:["win","mac","ios","android","chromium os"]},{browserName:"edge",os:["win"]},{browserName:"safari",os:["mac","ios"]},{browserName:"mobile safari",os:["ios"]}].some(e=>e.browserName===r.browserName&&e.os.some(e=>r.os.includes(e)))},isLowerThanMinGeneration(e,t,i){try{const a=e.toLowerCase(),r=t.toLowerCase(),n=parseInt(i);if("nvidia"===a){if(r.includes("geforce")){const e=r.indexOf("geforce gt ");if(parseInt(r.slice(e+11))i&&t"function"==typeof OffscreenCanvas,isHitBlacklist(e,t,i,r,n){if(!t||""===t)return a.default.error("isHitBlacklist() targetRenderInfo is invalid"),!0;if(!n)return a.default.error("isHitBlacklist() an invalid blacklist configuration object"),!1;if("encoder"!==i&&"decoder"!==i&&"all"!==i)return a.default.error("isHitBlacklist() an invalid codecType(".concat(i,").")),!0;const o=r.toLowerCase();let s=!1;for(const r of n){const n="model"in r,d="codecType"in r,u="renderInfo"in r,l="minGeneration"in r,c="os"in r;let h=null;n&&""!==r.model&&(h=this.replaceSpacesWithUnderscores(r.model.toLowerCase()));let f=null;if(!d){a.default.warn("isHitBlacklist() miss codecType field in the configuration.");continue}if(f=r.codecType,"all"!==f&&"encoder"!==f&&"decoder"!==f){a.default.error("isHitBlacklist() codecType(".concat(f,") should be all/(empty)/encoder/decoder."));continue}let p=null;u&&""!==r.renderInfo&&(p=this.replaceSpacesWithUnderscores(r.renderInfo.toLowerCase()));let _=null;l&&(_=r.minGeneration);let m=null;if(c&&""!==r.os&&(m=r.os.toLowerCase()),!n&&!u){if(!c){a.default.warn("isHitBlacklist() invalid blacklist entry. entry:".concat(r));continue}if(this.isOnOSBlacklist(m)){s=!0;break}}if(u&&""!==p&&(t===p||t.includes(p))&&("all"===f||f===i)){if(!c){s=!0;break}if(this.isOnOSBlacklist(m)){s=!0;break}}if(h)if(""!==o){if(h!==o){a.default.warn("isHitBlacklist() model(".concat(h,") in blacklist entry and model(").concat(o,") in whitelist should be same!"));continue}if("all"===f||f===i)if(_&&""!==_){if(this.isLowerThanMinGeneration(e,t,_)){if(!c){s=!0;break}if(this.isOnOSBlacklist(m)){s=!0;break}}}else{if(!c){s=!0;break}if(this.isOnOSBlacklist(m)){s=!0;break}}}else if(t.includes(h)&&("all"===f||f===i))if(_&&""!==_){if(this.isLowerThanMinGeneration(e,t,_)){if(!c){s=!0;break}if(this.isOnOSBlacklist(m)){s=!0;break}}}else{if(!c){s=!0;break}if(this.isOnOSBlacklist(m)){s=!0;break}}}return s},isOnOSBlacklist(e){const t=e.toLowerCase();return!("windows"!==t||!this.isWindows())||(!("mac"!==t||!this.isMac())||(!("chromeos"!==t||!this.isChromeOS())||(!("android"!==t||!this.isAndroid())||(!("linux"!==t||!this.isLinux())||!("ios"!==t||!this.is_iOS())))))},isWindows:()=>navigator.platform.indexOf("Win")>-1,isMac:()=>navigator.platform.indexOf("Mac")>-1,isChromeOS(){try{return!!/\bCrOS\b/.test(navigator.userAgent)}catch(e){return!1}},isAndroid(){try{var e=navigator.userAgent||navigator.vendor||window.opera;return!!/android/i.test(e)}catch(e){return!1}},isLinux(){return navigator.platform.indexOf("Linux")>-1&&!this.isChromeOS()},is_iOS(){try{return!!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)}catch(e){return!1}},replaceSpacesWithUnderscores(e){if(!e||""===e)return"";const t=e.trim();return""===t?"":"_".concat(t.replace(/ /g,"_"),"_")},isBrowserVersionHitBlacklist(e,t){if(!e||!t)return a.default.error("compareBrowserVersion() invalid parameters! browserVersion:".concat(e,", blacklistVersion:").concat(t)),!1;const i=t[0];let r=0;"<"==i?r=-1:"="==i?r=0:">"==i?r=1:(a.default.error("isBrowserVersionHitBlacklist() invalid operator! operator:".concat(i)),r=0);const n=t.slice(1),o=e.toString().split("."),s=n.toString().split("."),d=Math.min(o.length,s.length);for(let e=0;ei)return!1}else if(1==r&&t7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=n,this.textureindex=i||0,this.texturestride=this.textureindex?3:s?4:6,this.initmask=s||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=d,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=o,o||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(o);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=a.VIDEO_INVALID,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var n=e.contextGL;let o=n.canvas.width,s=n.canvas.height;r&&(o=r.width,s=r.height);var d,u,l,c,h=a==e.ROTATION_CLOCK90||a==e.ROTATION_CLOCK270?i:t,f=a==e.ROTATION_CLOCK90||a==e.ROTATION_CLOCK270?t:i,p=h/f*s,_=f/h*o;p>o?(d=0,l=1,c=1-(u=(s-_)/2/s)):(u=0,c=1,l=1-(d=(o-p)/2/o)),d=2*d-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,d,u,l,c,d,c,l,u,d,u,l,c,d,c]);n.bindBuffer(n.ARRAY_BUFFER,e.vertexPosBuffer),n.bufferData(n.ARRAY_BUFFER,m,n.DYNAMIC_DRAW)}function h(e,t,i,a,r){var n=e.contextGL,o=a.top/i,s=a.left/t,d=o+(a.height-1)/i,u=s+a.width/t,l=[s,o,u,o,u,d,s,d];r==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),r==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),r==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],h=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=h;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);n.bindBuffer(n.ARRAY_BUFFER,e.texturePosBuffer),n.bufferData(n.ARRAY_BUFFER,f,n.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(r.f)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;if(null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost())this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(r.e)("WebGLRestoreTimeout")},1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext()}catch(e){Object(r.b)("webgl restoreContext exception",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(r.g)("webglcontextlost event: canvas listener size=".concat(d.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(d.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const i=d.indexOf(this.canvasID);d.splice(i,1),s.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(r.g)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(r.f)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=s.get(e);t&&this.removeEventListener(e,t),s.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===d.indexOf(this.canvasID)&&(d.push(this.canvasID),d.length>4&&Object(r.g)("webglcanvas listener size=".concat(d.length,", ids:").concat(d.join())))},l.prototype.isWebGL=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,i,a=this.canvasElement,n=null,s=["webgl","experimental-webgl","moz-webgl","webkit-3d"],d=0;!n&&d 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),a=e.createShader(e.VERTEX_SHADER);e.shaderSource(a,t),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS)||e.isContextLost()||Object(r.g)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(a));var n=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)||e.isContextLost()||Object(r.g)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(n));var o=e.createProgram();e.attachShader(o,a),e.attachShader(o,n),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)||e.isContextLost()||Object(r.g)("webgl Program failed to compile: "+e.getProgramInfoLog(o)),e.useProgram(o),this.shaderProgram=o},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var a=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=i;var r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=o}this.texturePosBuffer=r},l.prototype.initTextures=function(e){var t=this.contextGL,i=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var r=this.initTexture();this.yTextureRef=r,this.oyTextureRef=r;var n=this.initTexture();this.uTextureRef=n,this.ouTextureRef=n;var o=this.initTexture();if(this.vTextureRef=o,this.ovTextureRef=o,e){this.BindTextures(a.VIDEO_I420);var s=this.initTexture(),d=t.getUniformLocation(i,"cursorSampler");t.uniform1i(d,this.textureindex*this.texturestride+3),this.cursorTextureRef=s;var u=this.initTexture(),l=t.getUniformLocation(i,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var h=this.initTexture(),f=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=h;var p=t.getUniformLocation(i,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var _=this.initTexture(),m=t.getUniformLocation(i,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=_}var g=t.getUniformLocation(i,"colorRange");this.colorRangeRef=g,this.onlyRGBARef=t.getUniformLocation(i,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(i,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(i,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(i,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(i,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(i,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,i=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==a.VIDEO_I420){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"uSampler");t.uniform1i(a,1);let r=t.getUniformLocation(i,"vSampler");t.uniform1i(r,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"ySampler");t.uniform1i(a,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,0);let n=t.getUniformLocation(i,"vSampler");t.uniform1i(n,0)}else if(e==a.VIDEO_NV12){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"uSampler");t.uniform1i(a,1);let r=t.getUniformLocation(i,"vSampler");t.uniform1i(r,0)}let r=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(r,0);let n=t.getUniformLocation(i,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(n,6)):t.uniform1i(n,0);let o=t.getUniformLocation(i,"cursorSampler");t.uniform1i(o,0);let s=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(s,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=s.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var i=this.contextGL;i.deleteProgram(this.program),i.activeTexture(i.TEXTURE0+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE1+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE2+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),this.textureindex||this.initmask||(i.activeTexture(i.TEXTURE3+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE4+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(this.getRepeatedWatermarkTextureValue(i)),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE5+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null)),i.bindBuffer(i.ARRAY_BUFFER,null),i.deleteTexture(this.yTextureRef),i.deleteTexture(this.uTextureRef),i.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(i.deleteTexture(this.cursorTextureRef),i.deleteTexture(this.waterMarkTextureRef),i.deleteTexture(this.repeatedWaterMarkTextureRef),i.deleteTexture(this.previewVideoTextureRef),i.deleteBuffer(this.vertexPosBuffer),i.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&i.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&i.deleteBuffer(this.masktexturePosBuffer),i.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var n=this.contextGL;n?this.drawNextOutputPictureFrame(e,t,i,a,r):this.drawNextOuptutPictureRGBA(e,t,i,a)},l.prototype.updateVertexInfoForMultiView=function(e,t,i,a,r){var n,o,s,d,u=this.contextGL;if(this.isUseFillMode({width:i,height:a,rotation:r}))n=0,o=0,s=1,d=1;else{var l=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?a:i,c=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?i:a,h=l/c*t;h>e?(n=0,s=1,d=1-(o=(t-c/l*e)/2/t)):(o=0,d=1,s=1-(n=(e-h)/2/e))}n=2*n-1,s=2*s-1,o=1-2*o,d=1-2*d;var f=new Float32Array([s,o,n,o,s,d,n,d,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,i,a,r,o,s){var d,u,l,c,h=this.contextGL;if(this.isUseFillMode({width:i.width,height:i.height,rotation:a})){const r=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?s/o:o/s,n=i.left||0,h=i.top||0;if(i.width/i.height>r){const a=i.height*r;d=h/t,u=(Math.round((i.width-a)/2)+n)/e,l=d+(i.height-1)/t,c=u+a/e}else{const a=i.width/r;l=(d=(Math.round((i.height-a)/2)+h)/t)+(a-1)/t,c=(u=n/e)+i.width/e}}else d=Object(n.e)(i.top/t,2),u=Object(n.e)(i.left/e,2),l=Object(n.h)((i.top+i.height-1)/t,2),c=Object(n.h)((i.width-1+i.left)/e,2);var f=[u,d,c,d,c,l,u,l];a==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),a==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),a==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],_=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=_,r)if(a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);h.bindBuffer(h.ARRAY_BUFFER,this.texturePosBuffer),h.bufferData(h.ARRAY_BUFFER,m,h.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,i,r,n){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,d=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),n=n||this.ROTATION_CLOCK0;var _=(i=i||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||i.height!=this.croppingParams.height,m=i.top!=this.croppingParams.top||i.left!=this.croppingParams.left,g=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,E=e!=this.textureWidth||t!=this.textureHeight,S=n!=this.picRotation;(_||g||S)&&c(this,i.width,i.height,n,s),(_||m||E||S)&&h(this,e,t,i,n);let v=o?0:1;v!=this.colorRange&&(u.uniform1i(this.colorRangeRef,v),this.colorRange=v),s?u.viewport(s.x,s.y,s.width,s.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,a.VIDEO_I420),Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.picRotation=n,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var C=r,A=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),d){var T=C.subarray(0,A);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),d){var I=C.subarray(A,A+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,I)}var b=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),d){var O=C.subarray(A+R,A+R+b);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,O)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):d&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var D=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(D,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,i,a,r){if(this.isAvaiable()){var n=this.contextGL,o=r;if(!(!this.hasWholeFrame||e<=0||t<=0||i<0||a<0||i+e>this.textureWidth||a+t>this.textureHeight)&&r&&r.length==e*t*3/2){var s=this.yTextureRef,d=this.uTextureRef,u=this.vTextureRef,l=e*t,c=o.subarray(0,l);n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s),n.texSubImage2D(n.TEXTURE_2D,0,i,a,e,t,n.LUMINANCE,n.UNSIGNED_BYTE,c);var h=e/2*t/2,f=o.subarray(l,l+h);n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,d),n.texSubImage2D(n.TEXTURE_2D,0,i/2,a/2,e/2,t/2,n.LUMINANCE,n.UNSIGNED_BYTE,f);var p=h,_=o.subarray(l+h,l+h+p);n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,u),n.texSubImage2D(n.TEXTURE_2D,0,i/2,a/2,e/2,t/2,n.LUMINANCE,n.UNSIGNED_BYTE,_)}}},l.prototype.updateCursor=function(e,t,i){if(this.isAvaiable()){var a=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,this.cursorTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,i){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(this.watermarkData=i,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,i,a,r){if(this.isAvaiable()){var n=this.contextGL;if(!(!this.hasWholeFrame||e&&(a<0||r<0))){n.viewport(0,0,n.canvas.width,n.canvas.height);var o=this.yTextureRef,s=this.uTextureRef,d=this.vTextureRef,u=this.cursorTextureRef;if(n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,s),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,d),n.activeTexture(n.TEXTURE3),n.bindTexture(n.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,o=i/this.croppingParams.height,s=a/this.croppingParams.width,d=r/this.croppingParams.height;this.cx=e,this.cy=o,this.cw=s,this.ch=d,n.uniform4f(this.cursorInfoRef,e,o,s,d)}else n.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,i,a){if(this.isAvaiable()){var r=a,n=this.canvasElement.getContext("2d"),o=n.getImageData(0,0,e,t);o.data.set(r),n.putImageData(o,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[a.VIDEO_RGBA,a.VIDEO_BGRA].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,i,r,n){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);const h=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!r||!r.length||r.length!=e*t*3/2&&!h||i&&(i.top<0||i.left<0||i.left+i.width>e||i.top+i.height>t))return!1;let f=o?0:1;if(this.colorRange=f,this.rotation=n,Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=d.canvas.width,this.canvasHeight=d.canvas.height,!s)return;if(d.bindTexture(d.TEXTURE_2D,u),h)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,r);var p=r,_=e*t,m=p.subarray(0,_);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,m);let g=0,E=0;this.videoMode==a.VIDEO_I420?(g=e/2*t/2,E=g):this.videoMode==a.VIDEO_NV12&&(g=e*t/2,E=0);var S=p.subarray(_,_+g);if(d.bindTexture(d.TEXTURE_2D,l),E){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S);var v=p.subarray(_+g,_+g+E);d.bindTexture(d.TEXTURE_2D,c),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,v)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,S);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!i)return;if(!this.isAvaiable())return;var o=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(r)||(this.rotation=r),Object.assign(this.croppingParams,a),!n)return;o.bindTexture(o.TEXTURE_2D,this.yTextureRef);const s=0,d=o.RGBA,u=o.RGBA,l=o.UNSIGNED_BYTE;o.texImage2D(o.TEXTURE_2D,s,d,u,l,i)},l.prototype.updateSelfMaskImage=function(e,t,i){if(!(e<=0||t<=0)&&i&&i.length==e*t*4&&this.isAvaiable()){var a=this.contextGL;a.bindTexture(a.TEXTURE_2D,this.maskTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var i=this.contextGL;let a=this.isRGBAMode(this.videoMode)?1:0;i.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(a,this.hasCursor,this.videoMode),this.initmask&&i.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,i,a){if(this.isAvaiable()){var r,n=this.contextGL;return this.destination&&this.destination.length==i*a*4||(this.destination=new Uint8Array(i*a*4)),r=this.destination,n.flush(),n.readPixels(e,t,i,a,n.RGBA,n.UNSIGNED_BYTE,r),r}},l.prototype.updateSelfVideoTextures=function(e,t,i,a){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&i&&i.length%4==0&&this.isAvaiable()){var o=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=n,Object.assign(this.croppingParams,a),r&&(o.bindTexture(o.TEXTURE_2D,this.yTextureRef),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,e,t,0,o.RGBA,o.UNSIGNED_BYTE,i))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var r=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,i,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),t?(r.enable(r.BLEND),r.blendFunc(r.ZERO,r.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(a.VIDEO_RGBA),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,i){if(this.isAvaiable()){var r=this.contextGL;r.uniform1i(this.onlyRGBARef,e),r.uniform1i(this.bgraModeRef,e&&i===a.VIDEO_BGRA?1:0),r.uniform1i(this.cursorFlagRef,t),e||r.uniform1i(this.yuvmodeRef,i)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:i,rotation:a}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!i)return!1;const r=a===this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?i/t:t/i;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(r-e)<.01)},t.default=l},function(e,t,i){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.VB_VIDEOFRAME_COPYTO_ERROR=t.VB_EVENT_TYPE=void 0,function(e){e.VB_INIT_SUCCESS="VB_INIT_SUCCESS",e.VB_INIT_FAILED="VB_INIT_FAILED",e.VB_GENERATED_FRAME="VB_GENERATED_FRAME",e.VB_SEND_FRAME="VB_SEND_FRAME",e.VB_UPDATE_BG="VB_UPDATE_BG",e.VB_PREDICT_DONE="VB_PREDICT_DONE",e.VB_MODEL_READY="VB_MODEL_READY",e.VB_FREE_MEMORY="VB_FREE_MEMORY",e.VB_VIDEO_FORMAT_UNSUPPORTED="VB_VIDEO_FORMAT_UNSUPPORTED",e.VB_WORKER_INIT="VB_WORKER_INIT",e.VB_WORKER_ERROR="VB_WORKER_ERROR",e.VB_RENDER_CANVAS="VB_RENDER_CANVAS",e.VB_RENDER_FRAME="VB_RENDER_FRAME",e.VB_START="VB_START",e.VB_REQUEST_FRAME="VB_REQUEST_FRAME",e.VB_TOGGLE_VB="VB_TOGGLE_VB",e.VB_STOP="VB_STOP",e.VB_MIRROR="VB_MIRROR",e.VB_GENERATE_STREAM="VB_GENERATE_STREAM",e.VB_STOP_STREAM="VB_STOP_STREAM",e.VB_CHANGE_STREAM_CANVAS_SIZE="VB_CHANGE_STREAM_CANVAS_SIZE",e.VB_GENERATE_FIRST_FRAME="VB_GENERATE_FIRST_FRAME",e.VB_UPDATE_STATS="VB_UPDATE_STATS",e.VB_UPDATE_NEED_FRAME="VB_UPDATE_NEED_FRAME",e.VB_UPDATE_FRAME_RATE="VB_UPDATE_FRAME_RATE",e.VB_RESOLUTION_CHANGE="VB_RESOLUTION_CHANGE"}(a||(t.VB_EVENT_TYPE=a={})),t.VB_VIDEOFRAME_COPYTO_ERROR="VB_VIDEOFRAME_COPYTO_ERROR"},function(e,t,i){var a=i(41),r=i(62),n=i(63),o=a?a.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?r(e):n(e)}},function(e,t,i){var a=i(25),r=i(27);e.exports=function(e){return"number"==typeof e||r(e)&&"[object Number]"==a(e)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,i){"use strict";t.a=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:i,opacity:a,name:r}=e;t.fillStyle="rgba(0, 0, 0, ".concat(a,")"),t.fillText(r,i.x,i.y),t.fillStyle="rgba(255, 255, 255, ".concat(a,")"),t.fillText(r,i.x+1,i.y+1)}_getTransformInfo(e){let t,{canvas:i,position:a}=e;if(1===a)t={x:i.width/2,y:0,rateRadio:0,maxWidth:i.width};else if(2===a)t={x:i.width/2,y:i.height,rateRadio:0,maxWidth:i.width};else if(4===a)t={x:0,y:i.height/2,rateRadio:Math.PI/2,maxWidth:i.height};else if(8===a)t={x:i.width,y:i.height/2,rateRadio:-Math.PI/2,maxWidth:i.height};else{const e=-21*Math.PI/180;t={x:i.width/2,y:i.height/2,rateRadio:e,maxWidth:Math.min(i.width/Math.cos(e),-i.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:i,name:a,textWidth:r}=e;const n=this._getPaddingWidth({ctx:i,position:t,name:a});return 1===t?{x:-r.width/2,y:n}:2===t||4===t||8===t?{x:-r.width/2,y:-n}:{x:-r.width/2,y:i.measureText(a[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:i,name:a}=e;return[1,2,4,8].includes(i)?32:t.measureText(a[0]).width}_setBaseLine(e){let{ctx:t,position:i}=e;t.textBaseline=1===i?"top":2===i||4===i||8===i?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:i,width:a,height:r,opacity:n=.15,position:o,convertToDataUrl:s}=e;if(!i||!a||!r)return;n=n||.15;a*=1,r*=1,t.width=a,t.height=r;let d=this._getTransformInfo({canvas:t,position:o});var u=t.getContext("2d");let l;if(u.clearRect(0,0,t.width,t.height),u.translate(d.x,d.y),u.rotate(d.rateRadio),this._setBaseLine({ctx:u,position:o}),u.lineWidth=1,u.imageSmoothingEnabled=!0,1==i.length){const e=d.maxWidth/i.length;u.font=e+"px 'Segoe UI'",l=u.measureText(i)}else{let e=16;for(u.font=e+"px 'Segoe UI'",l=u.measureText(i);l.widthd.maxWidth-2*this._getPaddingWidth({ctx:u,position:o,name:i}))if(e>16)e-=1,u.font=e+"px 'Segoe UI'",l=u.measureText(i);else{const e=i;for(;i.length>5&&l.width>d.maxWidth-2*this._getPaddingWidth({ctx:u,position:o,name:i+"..."});)i=i.slice(0,i.length-1),l=u.measureText(i+"...");e!==i&&(i+="...")}}const c=this._calcTextPos({position:o,ctx:u,name:i,textWidth:l});var h;if(this._drawWatermarkWithShadow({ctx:u,name:i,opacity:n,textPos:c}),s)h=t.toDataURL();else{var f=u.getImageData(0,0,u.canvas.width,u.canvas.height);h=new Uint8Array(f.data.buffer)}return u.rotate(-d.rateRadio),u.translate(-d.x,-d.y),h}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:i,width:a,height:r,opacity:n=.15,position:o,convertToDataUrl:s}=e;if(!i||!a||!r)return;n=n||.15;a*=1,r*=1,t.width=a,t.height=r;const d=t.getContext("2d");d.clearRect(0,0,t.width,t.height),d.translate(a/2,r/2),d.rotate(-21*Math.PI/180),d.imageSmoothingEnabled=!0;d.font="".concat(32,"px 'Segoe UI'"),d.textBaseline="top";const u=d.measureText(i),l=.37*u.width;let c,h=0,f=-r;do{let e=h%2==0?l-a:-a;do{d.fillStyle="rgba(0, 0, 0, ".concat(n,")"),d.fillText(i,e,f),d.fillStyle="rgba(255, 255, 255, ".concat(n,")"),d.fillText(i,e+1,f+1),e+=u.width+l}while(e(async e=>{if(!WebAssembly.validate(e))return!1;try{return(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),!0}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),simd:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))},t.default=new a},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var a=i(7);class r{constructor(e){this.mediaType=e,this.firstSelect=null,this.finalSelect=null,this.webRTCProb={probTime:0,probResult:null},this.hasProcess=!1}getProbResult(){var e;const t=JSON.parse(localStorage.getItem("".concat(this.mediaType,"States")));return!1!==(null==t||null===(e=t.webRTCProb)||void 0===e?void 0:e.probResult)}updatewebRTCProbResult(e){this.webRTCProb.probTime=Date.now(),this.webRTCProb.probResult=e,this.updateLocalStorage()}updateLocalStorage(){var e,t;let i=JSON.parse(localStorage.getItem("".concat(this.mediaType,"States")))||{},r={mediaType:this.mediaType,firstSelect:this.firstSelect,finalSelect:this.finalSelect,webRTCProb:{probTime:this.webRTCProb.probTime||(null==i||null===(e=i.webRTCProb)||void 0===e?void 0:e.probTime),probResult:null===this.webRTCProb.probResult?null==i||null===(t=i.webRTCProb)||void 0===t?void 0:t.probResult:this.webRTCProb.probResult}};localStorage.setItem("".concat(this.mediaType,"States"),JSON.stringify(r)),a.default.directReport(r)}}class n{constructor(e){this.mediaType=e}getInfo(){try{return JSON.parse(localStorage.getItem("webcodec".concat(this.mediaType)))||{}}catch(e){return{}}}updateInfo(e,t){try{let i=this.getInfo(),{failed:a,total:r}=i.usedcount||{failed:0,total:0},{avgusedtime:n,usedmaxtime:o}=i.usedtime||{avgusedtime:0,usedmaxtime:0},{avgratio:s,maxratio:d}=i.ratio||{avgratio:0,maxratio:0},{avgdelay:u}=i.delay||{avgdelay:0};e.failed&&(a++,n=(3*n+e.elapsed)/4,o=e.elapsed>o?e.elapsed:o,i.usedtime=Object.assign(i.usedtime||{},{usedmaxtime:o,avgusedtime:n})),e.elapsed>31e3&&e.failed||r++,i.usedcount=Object.assign(i.usedcount||{},{failed:a,total:r}),e.outputIndex>3&&(u=(3*u+e.avgDelay)/4,i.delay=Object.assign(i.delay||{},{avgdelay:u})),e.inputIndex>5&&(s=(3*s+e.ratio)/4,d=e.ratio>d?e.ratio:d,i.ratio=Object.assign(i.ratio||{},{avgratio:s,maxratio:d}));let l=t.osVersion,c=t.browserVersion,h=t.sdkVersion;i.version={osVersion:l,browserVersion:c,sdbversion:h},localStorage.setItem("webcodec".concat(this.mediaType),JSON.stringify(i))}catch(e){a.default.error("<<< update localStorage error",e)}}}class o{constructor(){this.audioSolutionInfo=new r("audio"),this.videoEncoderInfo=new n("videoencode"),this.videoDecoderInfo=new n("videodecode")}getAudioSolutionInfo(){return this.audioSolutionInfo}getVideoEncoderInfo(){return this.videoEncoderInfo}getVideoDecoderInfo(){return this.videoDecoderInfo}}},function(e,i){e.exports=t},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";var a=this&&this.__awaiter||function(e,t,i,a){return new(i||(i=Promise))((function(r,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function s(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}d((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.screenWakeLock=void 0;const n=r(i(7));const o=new class{constructor(){this.sentinel=null,this.isSupport=()=>"wakeLock"in navigator&&"request"in navigator.wakeLock,this.requestWakeLock=()=>a(this,void 0,void 0,(function*(){return this.isSupport()?this.sentinel&&!this.sentinel.released?Promise.reject("wakeLock has requested"):(yield this.release(),document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange),this.initWakeLock()):Promise.reject("wakeLock API not available")})),this.release=()=>a(this,void 0,void 0,(function*(){return this.isSupport()?this.sentinel?(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange),this.sentinel.release().then(()=>(this.sentinel=null,"WakeLock release success")).catch(e=>(n.default.error("Error WakeLock release:",e),e))):"WakeLock not exist":"wakeLock API not available"})),this.handleVisibilityChange=()=>{"visible"===document.visibilityState&&(!this.sentinel||this.sentinel&&this.sentinel.released)&&(this.sentinel=null,this.initWakeLock())},this.initWakeLock=()=>a(this,void 0,void 0,(function*(){try{return this.sentinel=yield navigator.wakeLock.request("screen"),this.sentinel}catch(e){return n.default.error("Error WakeLock request:",e),Promise.reject(e)}}))}};t.screenWakeLock=o},function(e,t,i){(function(e){!function(i,a){"use strict";var r={};i.PubSub=r;var n=i.define;!function(e){var t={},i=-1;function a(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function r(e,t,i){try{e(t,i)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function n(e,t,i){e(t,i)}function o(e,i,a,o){var s,d=t[i],u=o?n:r;if(t.hasOwnProperty(i))for(s in d)d.hasOwnProperty(s)&&u(d[s],e,a)}function s(e,i,r,n){var s=function(e,t,i){return function(){var a=String(e),r=a.lastIndexOf(".");for(o(e,e,t,i);-1!==r;)r=(a=a.substr(0,r)).lastIndexOf("."),o(e,a,t,i)}}(e,i,n);return!!function(e){for(var i=String(e),r=Boolean(t.hasOwnProperty(i)&&a(t[i])),n=i.lastIndexOf(".");!r&&-1!==n;)n=(i=i.substr(0,n)).lastIndexOf("."),r=Boolean(t.hasOwnProperty(i)&&a(t[i]));return r}(e)&&(!0===r?s():setTimeout(s,0),!0)}e.publish=function(t,i){return s(t,i,!1,e.immediateExceptions)},e.publishSync=function(t,i){return s(t,i,!0,e.immediateExceptions)},e.subscribe=function(e,a){if("function"!=typeof a)return!1;t.hasOwnProperty(e)||(t[e]={});var r="uid_"+String(++i);return t[e][r]=a,r},e.subscribeOnce=function(t,i){var a=e.subscribe(t,(function(){e.unsubscribe(a),i.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var i;for(i in t)t.hasOwnProperty(i)&&0===i.indexOf(e)&&delete t[i]},e.unsubscribe=function(i){var a,r,n,o="string"==typeof i&&(t.hasOwnProperty(i)||function(e){var i;for(i in t)if(t.hasOwnProperty(i)&&0===i.indexOf(e))return!0;return!1}(i)),s=!o&&"string"==typeof i,d="function"==typeof i,u=!1;if(!o){for(a in t)if(t.hasOwnProperty(a)){if(r=t[a],s&&r[i]){delete r[i],u=i;break}if(d)for(n in r)r.hasOwnProperty(n)&&r[n]===i&&(delete r[n],u=!0)}return u}e.clearSubscriptions(i)}}(r),"function"==typeof n&&n.amd?n((function(){return r})):(void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r)}("object"==typeof window&&window||this)}).call(this,i(36)(e))},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){var i=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||i)}},function(e,t,i){var a=i(21).Symbol;e.exports=a},function(e,t,i){(function(t){var i="object"==typeof t&&t&&t.Object===Object&&t;e.exports=i}).call(this,i(39))},function(e,t){var i=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return i.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){function i(t){return e.exports=i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,i(t)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){var a;!function(r,n){"use strict";var o="model",s="name",d="type",u="vendor",l="version",c="mobile",h="tablet",f="smarttv",p=function(e){for(var t={},i=0;i0?2===n.length?"function"==typeof n[1]?this[n[0]]=n[1].call(this,s):this[n[0]]=n[1]:3===n.length?"function"!=typeof n[1]||n[1].exec&&n[1].test?this[n[0]]=s?s.replace(n[1],n[2]):void 0:this[n[0]]=s?n[1].call(this,s,n[2]):void 0:4===n.length&&(this[n[0]]=s?n[3].call(this,s.replace(n[1],n[2])):void 0):this[n]=s||void 0;d+=2}},S=function(e,t){for(var i in t)if("object"==typeof t[i]&&t[i].length>0){for(var a=0;a2&&(e[o]="iPad",e[d]=h),e},this.getEngine=function(){var e={name:void 0,version:void 0};return E.call(e,a,u.engine),e},this.getOS=function(){var e={name:void 0,version:void 0};return E.call(e,a,u.os),f&&!e[s]&&n&&"Unknown"!=n.platform&&(e[s]=n.platform.replace(/chrome os/i,"Chromium OS").replace(/macos/i,"Mac OS")),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return a},this.setUA=function(e){return a="string"==typeof e&&e.length>500?g(e,500):e,this},this.setUA(a),this};A.VERSION="1.0.37",A.BROWSER=p([s,l,"major"]),A.CPU=p(["architecture"]),A.DEVICE=p([o,u,d,"console",c,f,h,"wearable","embedded"]),A.ENGINE=A.OS=p([s,l]),void 0!==t?(void 0!==e&&e.exports&&(t=e.exports=A),t.UAParser=A):i(55)?void 0===(a=function(){return A}.call(t,i,t,e))||(e.exports=a):void 0!==r&&(r.UAParser=A);var T=void 0!==r&&(r.jQuery||r.Zepto);if(T&&!T.ua){var R=new A;T.ua=R.getResult(),T.ua.get=function(){return R.getUA()},T.ua.set=function(e){R.setUA(e);var t=R.getResult();for(var i in t)T.ua[i]=t[i]}}}("object"==typeof window?window:this)},function(e,t,i){var a=i(56),r=i(59),n=i(71),o=i(73),s=i(74),d=i(75),u=i(40),l=i(77),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||d(e)||l(e)||n(e)))return!e.length;var t=r(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!a(e).length;for(var i in e)if(c.call(e,i))return!1;return!0}},function(e,t,i){"use strict";(function(e){var a=i(32),r=i.n(a),n=i(18),o=i(15),s=i(2),d=i(26),u=i.n(d),l=i(50),c=i.n(l),h=i(3),f=i(5);const p=Object(n.a)("sdk.remoteControl"),_=0,m=0,g=83,E=82,S=84,v=85,C=87,A=88;function T(e){let t=this;this.dom=e.dom,this.socketURL=e.socketURL,this.meetingID=e.meetingID,this.condID=e.condID,this.blobSocket=null;let i=this._keyMouseEventHandler.bind(this);this.keyMouseEventHandler=function(e){t.keyMouseFilters(e).then(e=>{i(e)})},this.keyMouseEventHandlerThrottle=r()((function(e){t.keyMouseEventHandler(e)}),1e3/24),this.pasteOnDocument=this._pasteOnDocument.bind(this),this.copyOnDocument=this._copyOnDocument.bind(this),this.cutOnDocument=this._cutOnDocument.bind(this),this.focus=this._focus.bind(this),this.PUBSUB_SHARING_PARAM_INFO_TOKEN=null,this.preventDefault=this._preventDefault.bind(this),this.browserBlurEventHandler=this._browserBlurEventHandler.bind(this),this.positionMap={canvas:{offsetX:0,offsetY:0},src:{x:0,y:0,w:0,h:0,scaleWidth:0,scaleHeight:0},dst:{x:0,y:0,w:0,h:0}},this.blockedKeyboardEventOfPaste=[],this.keydownupMergeRemoveMap={},this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map={},this.PASTE_MAX_BYTE_LENGTH=64e3,this.currentMousePositionProps={clientX:0,clientY:0,x2video:0,y2video:0},this.isControllerNow=!0,this.remoteOS=f.e.UNKNOWN,this.localOS=this.getLocalOS(),this._blockedCopyKeyboardList=[],this.maxSleep=500}T.prototype={start(){return new Promise(async(e,t)=>{try{p("remote control start"),this.modifyDom(),this.bindEvent(),this.subscribeSharingWidthOrHeightChange(),await this.connectSocket(),this.sendPostionPDU(),this.socketBlobMessageHandler(),e(!0)}catch(e){t(e)}})},destroy(){return new Promise((e,t)=>{try{p("destroy remote control"),this.unbindEvent(),this.uncheckAndClearKeydownupMergeRemoveMap(),this.destroySocket(),o.a.unsubscribe(this.PUBSUB_SHARING_PARAM_INFO_TOKEN),e(!0)}catch(t){p(t),e(!1)}})},modifyDom(){try{this.dom.setAttribute("tabindex","0"),this.dom.focus()}catch(e){}},_focus(){this.dom.focus()},getLocalOS(){let t=e.navigator.platform;return/win/i.test(t)?f.e.WIN:/mac/i.test(t)?f.e.MAC:f.e.UNKNOWN},setIsControlerNow(e){this.isControllerNow=e},blobSocketCheckAndSend(e){this.isControllerNow&&this.blobSocket.send(e)},isKeyboardEvent:e=>!!e&&(e.type&&-1!==["keydown","keyup"].indexOf(e.type.toLowerCase())),isThisKeyIgnoreCase:(e,t)=>e.key&&e.key.toLowerCase()==t.toLowerCase(),async _copyOnDocument(e){if(!this.isFocusNow())return;let t=this._blockedCopyKeyboardList;"done"!=t[t.length-1]&&(this._blockedCopyKeyboardList=[],this._blockedCopyKeyboardList.push("done"),p("copyOnDocument",e),this.processMonitorCtrlMetaWithKey("c"))},async _cutOnDocument(e){this.isFocusNow()&&(p("_cutOnDocument",e),this.processMonitorCtrlMetaWithKey("x"))},processMonitorCtrlMetaWithKey(e){let t=0,i=1,a=2,r=this.remoteOS===f.e.MAC,n={t:"keydown",event_type:1,repeat:!1,alt:!1,shift:!1,capslock:!1,numlock:!0,pduType:v,ctrl:!r,super:r},o=Object.assign({},n,{charCode:0,keyCode:r?91:17,key:r?"Meta":"Control"}),s=Object.assign({},n,{charCode:e.charCodeAt(0),keyCode:e.toUpperCase().charCodeAt(0),key:e}),d=Object.assign({},o,{input_event_type:t}),u=(Object.assign({},o,{input_event_type:a}),Object.assign({},s,{input_event_type:t})),l=(Object.assign({},s,{input_event_type:a}),Object.assign({},o,{t:"keyup",ctrl:!1,super:!1,input_event_type:i})),c=Object.assign({},s,{t:"keyup",ctrl:!1,super:r,input_event_type:i});(r?[d,u,c,l]:[d,u,l,c]).forEach(e=>{this.processEvent(e)})},isFocusNow(){return this.dom===document.activeElement},async _pasteOnDocument(e){if(this.isFocusNow()){let t=(e.clipboardData||window.clipboardData).getData("text");p("_pasteOnDocument",t);let i=[];for(let e=0;ethis.PASTE_MAX_BYTE_LENGTH?(this.triggerPasteTextLengthOverflow(),this.dropAllEventFromBlockedKeyboardEventOfPaste()):(this.blobSocketCheckAndSend(a),this.processMonitorCtrlMetaWithKey("v"))}},onReturnCopiedText(e){!this._onReturnCopiedText_list&&(this._onReturnCopiedText_list=[]),this._onReturnCopiedText_list.push(e)},triggerReturnCopiedText(e){this._onReturnCopiedText_list&&this._onReturnCopiedText_list.forEach(t=>t(e))},onPasteTextLengthOverflow(e){!this._onPasteTextLengthOverflow_list&&(this._onPasteTextLengthOverflow_list=[]),this._onPasteTextLengthOverflow_list.push(e)},triggerPasteTextLengthOverflow(){this._onPasteTextLengthOverflow_list&&this._onPasteTextLengthOverflow_list.forEach(e=>e())},dropAllEventFromBlockedKeyboardEventOfPaste(){this.blockedKeyboardEventOfPaste=[]},createParamsFromKeyboardEvent:e=>({key:e.key,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,repeat:e.repeat,charCode:e.charCode,keyCode:e.keyCode,which:e.which,ctrlKey:e.ctrlKey,metaKey:e.metaKey}),sendAllEventFromBlockedKeyboardEventOfPaste(){for(p("blockedKeyboardEventOfPaste.length",this.blockedKeyboardEventOfPaste.length);this.blockedKeyboardEventOfPaste.length>0;){let e=this.blockedKeyboardEventOfPaste.shift();this._keyMouseEventHandler(e)}},_preventDefault(e){if(-1!==["keydown","keyup"].indexOf(e.type)){let t=["v","c","x"];for(let i=0;i{p("subscribeSharingWidthOrHeightChange",i.body),e.positionMap.dst.w=i.body.logicWidth,e.positionMap.dst.h=i.body.logicHeight,e.positionMap.src.w=i.body.logicWidth,e.positionMap.src.h=i.body.logicHeight,e.sendPostionPDU()})},setDstWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of destination sharing video width/height are not correct");this.positionMap.dst.w=e,this.positionMap.dst.h=t},setSrcWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of source sharing video width/height are not correct");this.positionMap.src.w=e,this.positionMap.src.h=t},setSrcWidthAndHeightAndSendPDU(e,t){if(!e||!t)throw new Error("the value of source sharing video width/height are not correct");this.positionMap.src.w!==e&&this.positionMap.src.h!==t&&(this.setSrcWidthAndHeight(e,t),this.sendPostionPDU())},setSrcOffsetXYAndSendPDU(e,t){e=Math.floor(e),t=Math.floor(t),this.positionMap.canvas.offsetX===e&&this.positionMap.canvas.offsetY===t||(this.setSrcOffsetXY(e,t),this.sendPostionPDU())},setSrcScaleWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of source sharing video scaleWidth/scaleHeight are not correct");this.positionMap.src.scaleWidth=e,this.positionMap.src.scaleHeight=t},setSrcOffsetXY(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=Math.floor(e),a=Math.floor(t);if(!u()(i)&&!u()(a))throw new Error("the value of source offset x or y is not correct");this.positionMap.canvas.offsetX=i,this.positionMap.canvas.offsetY=a},sendPostionPDU(){let e=new ArrayBuffer(36),t=new Uint8Array(e),i=new DataView(e,4),a=new DataView(e,20);t[0]=E,i.setInt32(0,this.positionMap.src.x,!0),i.setInt32(4,this.positionMap.src.y,!0),i.setInt32(8,this.positionMap.src.w,!0),i.setInt32(12,this.positionMap.src.h,!0),a.setInt32(0,this.positionMap.dst.x,!0),a.setInt32(4,this.positionMap.dst.y,!0),a.setInt32(8,this.positionMap.dst.w,!0),a.setInt32(12,this.positionMap.dst.h,!0),p("send position pdu");try{this.blobSocket.send(e)}catch(e){}},unbindEvent(){let e=this.dom;e.removeEventListener("click",this.focus),e.removeEventListener("keydown",this.keyMouseEventHandler),e.removeEventListener("keyup",this.keyMouseEventHandler),document.removeEventListener("paste",this.pasteOnDocument),document.removeEventListener("copy",this.copyOnDocument),document.removeEventListener("cut",this.cutOnDocument),e.removeEventListener("contextmenu",this.preventDefault),e.removeEventListener("wheel",this.preventDefault),e.removeEventListener("dblclick",this.preventDefault),e.removeEventListener("keydown",this.preventDefault),e.removeEventListener("keyup",this.preventDefault),e.removeEventListener("dblclick",this.keyMouseEventHandler),e.removeEventListener("mousedown",this.keyMouseEventHandler),e.removeEventListener("mouseup",this.keyMouseEventHandler),e.removeEventListener("mousemove",this.keyMouseEventHandlerThrottle),e.removeEventListener("wheel",this.keyMouseEventHandler),window.removeEventListener("blur",this.browserBlurEventHandler)},bindEvent(){let e=this.dom;p("dom",e),e.addEventListener("click",this.focus),e.addEventListener("keydown",this.keyMouseEventHandler),e.addEventListener("keyup",this.keyMouseEventHandler),document.addEventListener("paste",this.pasteOnDocument),document.addEventListener("copy",this.copyOnDocument),document.addEventListener("cut",this.cutOnDocument),e.addEventListener("contextmenu",this.preventDefault),e.addEventListener("wheel",this.preventDefault),e.addEventListener("dblclick",this.preventDefault),e.addEventListener("keydown",this.preventDefault),e.addEventListener("keyup",this.preventDefault),e.addEventListener("dblclick",this.keyMouseEventHandler),e.addEventListener("mousedown",this.keyMouseEventHandler),e.addEventListener("mouseup",this.keyMouseEventHandler),e.addEventListener("mousemove",this.keyMouseEventHandlerThrottle),e.addEventListener("wheel",this.keyMouseEventHandler),window.addEventListener("blur",this.browserBlurEventHandler)},recordCurrentMousePosition(e){try{let t=this.positionMap,i=e.clientX,a=e.clientY;Object.assign(this.currentMousePositionProps,{clientX:i,clientY:a,x2video:i-t.canvas.offsetX,y2video:a-t.canvas.offsetY})}catch(e){}},resolvePosition(e){let t=e.clientX,i=e.clientY,a=this.positionMap;return t-=a.canvas.offsetX,i-=a.canvas.offsetY,t*=a.dst.w/a.src.scaleWidth,i*=a.dst.h/a.src.scaleHeight,t=Math.floor(t),i=Math.floor(i),{x:t,y:i}},generateBuffer(e){if(void 0!==e.key&&!/^[\x00-\x7F]*$/.test(e.key))throw new Error("params.key must only contain ascii character");let t=8;(e=Object.assign({v:0,x:0,y:0,dx:0,dy:0,repeat:0},e)).pduType===S&&(t+=4);let i=new ArrayBuffer(t),a=new Uint8Array(i),r=new DataView(i,4),n=new DataView(i,4);if(a[0]=e.pduType,a[1]=63&e.input_event_type,e.pduType===g)r.setUint16(0,e.x,!0),r.setUint16(2,e.y,!0);else if(e.pduType===S)n.setInt16(0,e.x,!0),n.setInt16(2,e.y,!0),n.setInt16(4,e.dx,!0),n.setInt16(6,e.dy,!0);else if(e.pduType===v){let t=new DataView(i,4),r=new DataView(i,6),n=new Uint8Array(i,2);t.setUint16(0,e.keyCode,!0),r.setUint16(0,e.charCode,!0);let o={shift:1,capslock:2,ctrl:4,alt:8,numlock:16,super:32},s=0;Object.keys(o).forEach(t=>{!0===e[t]&&(s+=o[t])}),n[0]=s,e.repeat&&(a[1]=32|a[1])}return i},processEvent(e){this.blobSocket&&this.blobSocketCheckAndSend(this.generateBuffer(e))},debug(e){let t=[],i={};t=e.pduType===v?["t","keyCode","charCode","key"]:["t","x","y","dx","dy","input_event_type"],t.forEach(t=>{i[t]=e[t]}),p("debug",JSON.stringify(i))},blockedPasteKeyboard(e){let t=this;return new Promise((i,a)=>{t.isKeyboardEvent(e)&&t.isPasteEvent(e)?t.blockedKeyboardEventOfPaste.push(e):i(e)})},isPasteEvent(e){let t=this.isThisKeyIgnoreCase(e,"v");return!!(e.ctrlKey^e.metaKey&&t)},isCopyEvent(e){let t=this.isThisKeyIgnoreCase(e,"c");return!!(e.ctrlKey^e.metaKey&&t)},isCutEvent(e){let t=this.isThisKeyIgnoreCase(e,"x");return!!(e.ctrlKey^e.metaKey&&t)},returnNewEventByTransformCtrlKeyOrCommandKey(e){let t=this.createParamsFromKeyboardEvent(e);switch(this.remoteOS){case f.e.WIN:Object.assign(t,{ctrlKey:!0,metaKey:!1});break;case f.e.MAC:Object.assign(t,{ctrlKey:!1,metaKey:!0});break;case f.e.UNKNOWN:}return new e.constructor(e.type,t)},transformCtrlCAndCommandC(e){let t=this;return new Promise((i,a)=>{if(this.isKeyboardEvent(e)&&(e.ctrlKey||e.metaKey)&&t.isThisKeyIgnoreCase(e,"c")){t.createParamsFromKeyboardEvent(e);i(t.returnNewEventByTransformCtrlKeyOrCommandKey(e))}else i(e)})},keyMouseEventHandlerFilter_MatainKeyDownUpMergeMap(e){return new Promise((t,i)=>{try{this.isKeyboardEvent(e)&&e.key&&("keydown"!==e.type||e.repeat||(this.keydownupMergeRemoveMap[e.key]={t:+new Date,e:e}),"keydown"===e.type&&e.repeat&&delete this.keydownupMergeRemoveMap[e.key],"keyup"===e.type&&delete this.keydownupMergeRemoveMap[e.key])}catch(e){p.error(e)}t(e)})},_browserBlurEventHandler(){this._checkAndClearKeydownupMergeRemoveMap(this.maxSleep,!0)},checkAndClearKeydownupMergeRemoveMap(){let e=this;this.checkAndClearKeydownupMergeRemoveMapInterval=setInterval(()=>{e._checkAndClearKeydownupMergeRemoveMap(this.maxSleep)},100)},_checkAndClearKeydownupMergeRemoveMap(e,t){let i=this.keydownupMergeRemoveMap;Object.keys(i).forEach(a=>{let r=i[a];if(+new Date-r.t>=e||t){let e=new r.e.constructor("keyup",r.e);try{this._keyMouseEventHandler(e)}catch(e){}delete this.keydownupMergeRemoveMap[a]}})},uncheckAndClearKeydownupMergeRemoveMap(){this._checkAndClearKeydownupMergeRemoveMap(0),clearInterval(this.checkAndClearKeydownupMergeRemoveMapInterval)},keyMouseFilters(e){return new Promise((t,i)=>{t(e)}).then(e=>this.blockedPasteKeyboard(e)).then(e=>this.blockedCopyKeyboard(e)).then(e=>this.blockedCutKeyboard(e)).then(e=>this.keyMouseEventHandlerFilter_MatainKeyDownUpMergeMap(e)).then(e=>this.blockedSomeKeyboardEventNotHaveKeydownBefore(e)).then(e=>this.keyMouseEventHandlerFilter_EVERY_KEYUP_MUST_HAVE_KEYDOWN_BEFORE(e))},blockedSingleMetaKey(e){return new Promise((t,i)=>{this.isKeyboardEvent(e)&&e.key&&(/command/i.test(e.key)||/meta/i.test(e.key)||/control/i.test(e.key))&&!e.shiftKey&&!e.altKey&&e.ctrlKey^e.metaKey||t(e)})},blockedCutKeyboard(e){let t=this;return new Promise((i,a)=>{t.isKeyboardEvent(e)&&t.isCutEvent(e)||i(e)})},blockedCopyKeyboard(e){let t=this;return new Promise((i,a)=>{t.isKeyboardEvent(e)&&t.isCopyEvent(e)?t._blockedCopyKeyboardList.push(e):i(e)})},blockedSomeKeyboardEventNotHaveKeydownBefore(e){return new Promise((t,i)=>{if(this.isKeyboardEvent(e)&&e.key){let t=!1;if(["x","c","v"].forEach(i=>{this.isThisKeyIgnoreCase(e,i)&&(t=!0)}),"keyup"===e.type&&t){if(!!!this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key])return}}t(e)})},keyMouseEventHandlerFilter_EVERY_KEYUP_MUST_HAVE_KEYDOWN_BEFORE(e){return new Promise((t,i)=>{try{if(this.isKeyboardEvent(e)&&e.key&&("keydown"===e.type&&(this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key]=e),"keyup"===e.type)){let t=!!this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key];delete this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key];let i=!1;if(["meta"].forEach(t=>{this.isThisKeyIgnoreCase(e,t)&&(i=!0)}),!t&&!i){p.warn("keyup trigger, but no keydown before");let t=new e.constructor("keydown",e);this._keyMouseEventHandler(t)}}}catch(e){p.error(e)}t(e)})},_keyMouseEventHandler(e){this.isKeyboardEvent(e)&&p("_keyMouseEventHandler keyboard",e);let t={},i={keydown:0,keyup:1,keychar:2},a={mousemove:0,mousedown:{left:1,right:4,middle:7},mouseup:{left:2,right:5,middle:8},mouseleftdbldown:3,mouserightdbldown:6,wheel:10},r=e.getModifierState?function(t){return e.getModifierState(t)}:function(e,t){return t},n=_,o=e.key&&1===e.key.length;if(-1!==["keydown","keyup"].indexOf(e.type))t.event_type=1,n=v,void 0!==i[e.type]&&(t.input_event_type=i[e.type]);else{if(-1===["mousedown","mouseup","mousemove","wheel","click","dblclick","contextmenu"].indexOf(e.type))return void p.warn("the event type cannot be handled");{t.event_type=0,this.recordCurrentMousePosition(e);let i=this.resolvePosition(e);if(Object.assign(t,{x:i.x,y:i.y}),n="wheel"===e.type?S:g,void 0!==a[e.type]&&(t.input_event_type=a[e.type]),-1!==["mousedown","mouseup"].indexOf(e.type)){let i;switch(e.button){case 0:i="left";break;case 1:i="middle";break;case 2:i="right";break;default:i="left"}t.input_event_type=a[e.type][i]}-1!==["dblclick"].indexOf(e.type)&&(t.input_event_type=a.mouseleftdbldown)}}if("wheel"===e.type){let i={deltaX:"dx",deltaY:"dy"};Object.keys(i).forEach(a=>{e[a]&&(t[i[a]]=e[a]>0?-100:100)})}const s=this.ctrlMetaConvert({keyCode:e.keyCode,key:e.key,ctrlKey:e.ctrlKey,metaKey:e.metaKey});Object.assign(t,{t:e.type,pduType:n,keyCode:s.keyCode,charCode:o?e.key.charCodeAt(0):0,key:s.key,repeat:e.repeat,ctrl:s.ctrlKey,alt:e.altKey,super:s.metaKey,shift:e.shiftKey,capslock:r("CapsLock",!1),numlock:r("NumLock",!1)}),this.isKeyboardEvent(e)&&p("processEvent",JSON.stringify(t)),this.processEvent(t)},ctrlMetaConvert(e){const t=e.metaKey,i=e.ctrlKey;return(this.remoteOS===f.e.MAC&&this.localOS===f.e.WIN||this.remoteOS===f.e.WIN&&this.localOS===f.e.MAC)&&e.key&&(/Meta/i.test(e.key)?(e.ctrlKey=!0,e.keyCode=17,e.metaKey=i,e.key="Control"):/Control/i.test(e.key)&&(e.metaKey=!0,e.keyCode=91,e.ctrlKey=t,e.key="Meta")),e},isCapslock(e){var t=e.keyCode,i=e.key,a=e.shiftKey;return!!/[a-zA-Z]/.test(i)&&(i.charCodeAt(0)!==t?!a:a)},async stop(){this.blobSocket&&this.blobSocket.close(),this.blobSocket=null},async connectSocket(){var e=await this.createBlobSocket("".concat(this.socketURL,"/wc/media/").concat(this.meetingID,"?type=r&mode=2&cid=").concat(this.condID));return e.binaryType="blob",this.blobSocket=e,!0},socketBlobMessageHandler(){if(this.blobSocket){let e=this;this.blobSocket.addEventListener("message",(async function(t){let i=t.data,a=await h.default.readBlobAsBuffer(i,i.size),r=new Int8Array(a),n=r[0];if(n===A&&e.isControllerNow){let t=i.slice(8),a=await h.default.readBlob(t),n=r[4];p("COPY_TEXT_FROM_RWG",a,n),e.triggerReturnCopiedText({data:a,x:e.currentMousePositionProps.x2video,y:e.currentMousePositionProps.y2video})}n===m&&e.blobSocket.send(a)}))}},destroySocket(){try{this.blobSocket.close(),this.blobSocket=null}catch(e){p("destroySocket",e)}},createBlobSocket:e=>new Promise((t,i)=>{var a=new WebSocket(e);a.addEventListener("open",()=>{}),a.addEventListener("message",e=>{try{let i=JSON.parse(e.data);0===i.evt&&i.body&&t(a)}catch(e){}}),a.addEventListener("error",e=>{i(e)}),a.addEventListener("close",()=>{i(new Error("socket close"))})}),setRemoteOS(e){void 0!==e&&(this.remoteOS=e)}},t.a=T}).call(this,i(39))},function(e,t,i){!function(e){var t,i,a,r=String.fromCharCode;function n(e){for(var t,i,a=[],r=0,n=e.length;r=55296&&t<=56319&&r=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(e,t){return r(e>>t&63|128)}function d(e){if(0==(4294967168&e))return r(e);var t="";return 0==(4294965248&e)?t=r(e>>6&31|192):0==(4294901760&e)?(o(e),t=r(e>>12&15|224),t+=s(e,6)):0==(4292870144&e)&&(t=r(e>>18&7|240),t+=s(e,12),t+=s(e,6)),t+=r(63&e|128)}function u(){if(a>=i)throw Error("Invalid byte index");var e=255&t[a];if(a++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,r;if(a>i)throw Error("Invalid byte index");if(a==i)return!1;if(e=255&t[a],a++,0==(128&e))return e;if(192==(224&e)){if((r=(31&e)<<6|u())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&e)){if((r=(15&e)<<12|u()<<6|u())>=2048)return o(r),r;throw Error("Invalid continuation byte")}if(240==(248&e)&&(r=(7&e)<<18|u()<<12|u()<<6|u())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=n(e),i=t.length,a=-1,r="";++a65535&&(n+=r((t-=65536)>>>10&1023|55296),t=56320|1023&t),n+=r(t);return n}(s)}}(t)},function(e,t,i){var a=i(25),r=i(27);e.exports=function(e){return!0===e||!1===e||r(e)&&"[object Boolean]"==a(e)}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatisticHelper=void 0;t.StatisticHelper=class{constructor(){this.timeMap=new Map,this.baseTime=0,this.totalTime=0}flushTimeMap(){const e=performance.now(),t=this.timeMap.get(this.status)||0,i=e-this.baseTime;this.timeMap.set(this.status,t+i),this.baseTime=e,this.totalTime+=i}start(e){this.status=e,this.baseTime=performance.now()}update(e){e!==this.status&&(this.flushTimeMap(),this.status=e)}end(){this.flushTimeMap();const e={};for(const[t,i]of this.timeMap)e[String(t)]=Number((i/this.totalTime*100).toFixed(2));return e}}},function(e,t,i){"use strict";var a=this&&this.__awaiter||function(e,t,i,a){return new(i||(i=Promise))((function(r,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function s(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}d((a=a.apply(e,t||[])).next())}))},r=this&&this.__rest||function(e,t){var i={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(i[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r2&&e&&"function"==typeof OffscreenCanvas}catch(e){return!1}}))}sendCanvas(){if(this.cvsEle){const e=this.cvsEle.transferControlToOffscreen();this.postMessage({cmd:o.VB_EVENT_TYPE.VB_RENDER_CANVAS,payload:e},[e])}}generateVBStream(){if(this.vbTrackGenerator){const e=this.vbTrackGenerator.writable;this.postMessage({cmd:o.VB_EVENT_TYPE.VB_GENERATE_STREAM,payload:e},[e])}else if(this.streamCanvas)if(this.isSafari){const e=this.streamCanvas.transferControlToOffscreen();this.postMessage({cmd:o.VB_EVENT_TYPE.VB_GENERATE_STREAM,payload:e},[e])}else this.streamRender=new u.default(this.streamCanvas,c.VB_STREAM_CANVAS),this.postMessage({cmd:o.VB_EVENT_TYPE.VB_GENERATE_STREAM})}initialize(){return this.isVBReady?Promise.resolve():(this.isVBInitializing||(this.isVBInitializing=!0,this.vbLoadingTimer.isVBPredictDone=!1,this.initPromise=new Promise((e,t)=>a(this,void 0,void 0,(function*(){this.initReject=t,this.initResolve=e;try{const e=yield fetch(this.vbWorkerUrl);if(e.ok){const t=yield e.arrayBuffer();if(this.destoryed)return;const i=window.URL.createObjectURL(new Blob([t]));this.worker=new Worker(i,{name:c.VB_WORKER_NAME}),this.worker.addEventListener("message",this.handle_message_from_vb_worker),this.postMessage({cmd:o.VB_EVENT_TYPE.VB_WORKER_INIT,payload:Object.assign(Object.assign({},this.initParam),{cdnPath:this.cdnPath})}),this.sendCanvas(),window.URL.revokeObjectURL(i)}else{const{url:i,status:a}=e;this.isVBInitializing=!1,t(`Fetch worker file failed. url: ${i}, status: ${a}`)}}catch(e){this.isVBInitializing=!1,t(e)}})))),this.initPromise)}send_frame(e){this.isVBReady&&("format"in e?this.postMessage({cmd:o.VB_EVENT_TYPE.VB_SEND_FRAME,payload:e},[e]):this.postMessage({cmd:o.VB_EVENT_TYPE.VB_SEND_FRAME,payload:e},[e.data.buffer]))}Crop_Mask_Bg_16V9(){let e,t,i,a=0,r=this.bgImage.width,n=this.bgImage.height;return 16/9*n>=r?(i=r,a=r/(16/9),e=0,t=(n-a)/2):(i=n*(16/9),a=n,e=(r-i)/2,t=0),{sx:e,sy:t,sw:i,sh:a}}set_background_image(e){if(this.bgImage=e,!this.isVBReady)return!1;const t=this.Crop_Mask_Bg_16V9();let i,a,r,n,s,d;i=t.sx,a=t.sy,r=t.sw,n=t.sh,r>1920?(s=1920,d=1080):(s=r,d=n),this.bgConvertCanvas||(this.bgConvertCanvas=new OffscreenCanvas(s,d)),this.bgConvertCanvas.width=s,this.bgConvertCanvas.height=d;let u=null;try{u=this.bgConvertCanvas.getContext("2d",{willReadFrequently:!0})}catch(e){}finally{u||(u=this.bgConvertCanvas.getContext("2d"))}if(!u)return!1;u.drawImage(e,i,a,r,n,0,0,this.bgConvertCanvas.width,this.bgConvertCanvas.height);let l=u.getImageData(0,0,this.bgConvertCanvas.width,this.bgConvertCanvas.height);return this.postMessage({cmd:o.VB_EVENT_TYPE.VB_UPDATE_BG,payload:l}),"close"in e&&e.close(),!0}set_background_blur(){this.isVBReady&&this.postMessage({cmd:o.VB_EVENT_TYPE.VB_UPDATE_BG,payload:"blur"})}handle_message_from_vb_worker(e){const{cmd:t}=e.data;switch(c.EXTERNAL_EVENTS.has(t)&&(t!==o.VB_EVENT_TYPE.VB_GENERATED_FRAME||this._needFrame)&&this.callback&&this.callback(e.data),t){case o.VB_EVENT_TYPE.VB_MODEL_READY:this.vbLoadingTimer.start();break;case o.VB_EVENT_TYPE.VB_PREDICT_DONE:{const{payload:t}=e.data;this.vbLoadingTimer.isVBPredictDone=!0,this.vbLoadingTimer.clear(),this._backend=t;break}case o.VB_EVENT_TYPE.VB_INIT_FAILED:{const{payload:t}=e.data;this.isVBInitializing=!1,this.initReject(t);break}case o.VB_EVENT_TYPE.VB_INIT_SUCCESS:this.isVBReady=!0,this.isVBInitializing=!1,this.bgImage&&this.set_background_image(this.bgImage),this.generateVBStream(),this.initResolve();break;case o.VB_EVENT_TYPE.VB_REQUEST_FRAME:if(this.updateConstraints(),this.captureVideoEle&&this.isVideoPlaying(this.captureVideoEle))if(window.VideoFrame){if(this.isMetadataLoaded)try{const e=new VideoFrame(this.captureVideoEle);this.send_frame(e),e.close()}catch(e){this.callback&&!this.isReportVideoFrameError&&(this.callback({cmd:o.VB_EVENT_TYPE.VB_WORKER_ERROR,payload:e}),this.isReportVideoFrameError=!0)}}else if(this.captureCtx){this.captureCtx.drawImage(this.captureVideoEle,0,0);const e=this.captureCtx.getImageData(0,0,this.captureVideoEle.videoWidth,this.captureVideoEle.videoHeight);this.streamRender&&this.isStreamEnabled&&!this.isEnabled&&this.streamRender.render(e),this.send_frame(e)}break;case o.VB_EVENT_TYPE.VB_GENERATED_FRAME:{const t=e.data.payload,{data_ptr:i}=t;this.streamRender&&this.isStreamEnabled&&this.streamRender.render(t),i&&this.freeMemory(i);break}case o.VB_EVENT_TYPE.VB_UPDATE_STATS:this.stats=e.data.payload;break;case o.VB_EVENT_TYPE.VB_RESOLUTION_CHANGE:{const{width:t,height:i}=e.data.payload;this.stats.width=t,this.stats.height=i}}}onMessage(e){this.callback=e}createCaptureEle(){window.MediaStreamTrackProcessor||(this.captureVideoEle=document.querySelector("#"+c.VB_CAPTURE_VIDEO),this.captureVideoEle||(this.captureVideoEle=document.createElement("video"),this.captureVideoEle.autoplay=!0,this.captureVideoEle.playsInline=!0,this.captureVideoEle.id=c.VB_CAPTURE_VIDEO,this.captureVideoEle.style.position="fixed",this.captureVideoEle.style.width="1px",this.captureVideoEle.style.height="1px",this.captureVideoEle.style.bottom="0px",this.captureVideoEle.style.right="0px",this.captureVideoEle.muted=!0,document.body.appendChild(this.captureVideoEle)),this.captureCanvas||window.VideoFrame||(this.captureCanvas=document.createElement("canvas"),this.captureCtx=this.captureCanvas.getContext("2d")))}isVideoPlaying(e){return(e.paused||e.ended)&&e.play(),e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}postMessage(e,t){var i,a;t?null===(i=this.worker)||void 0===i||i.postMessage(e,t):null===(a=this.worker)||void 0===a||a.postMessage(e)}updateStreamCanvasSize(e,t){this.streamCanvas&&(this.isSafari?this.postMessage({cmd:o.VB_EVENT_TYPE.VB_CHANGE_STREAM_CANVAS_SIZE,payload:{width:e,height:t}}):(this.streamCanvas.width=e,this.streamCanvas.height=t))}updateConstraints(){const e=this.videoStream.getVideoTracks()[0],{width:t,height:i,frameRate:a}=e.getSettings();t&&i&&(!this.streamCanvas||t===this.streamCanvas.width&&i===this.streamCanvas.height||this.updateStreamCanvasSize(t,i),this.captureCanvas&&(t!==this.captureCanvas.width&&(this.captureCanvas.width=t),i!==this.captureCanvas.height&&(this.captureCanvas.height=i))),a&&this.frameRate!=Math.min(a,24)&&(this.frameRate=Math.min(a,24),this.postMessage({cmd:o.VB_EVENT_TYPE.VB_UPDATE_FRAME_RATE,payload:this.frameRate}))}captureVideo(e){return a(this,void 0,void 0,(function*(){if(this.isVBReady||this.isVBInitializing?this.isVBInitializing&&(yield this.initPromise):yield this.initialize(),this.isCapturing)return Promise.reject("Capture is already started");let t=!0;if("id"in e){if(!e.active)return Promise.reject("stream is not active");this.videoStream&&this.videoStream.id===e.id?t=!1:(this.stopCapture(),this.videoStream=e)}else if(this.videoStream&&this.captureConf===e)t=!1;else{this.stopCapture(),this.isCapturing=!0;try{this.videoStream=yield navigator.mediaDevices.getUserMedia(Object.assign(Object.assign({},e),{audio:!1})),this.captureConf=e,this.isCapturing=!1}catch(e){return this.isCapturing=!1,Promise.reject(e)}}if(this.createCaptureEle(),t){let e;if(!(e=this.videoStream.getVideoTracks()[0]))return Promise.reject("No video track in stream");{const t=e.getSettings(),{width:i=0,height:a=0,frameRate:r=24}=t;if(this.updateStreamCanvasSize(i,a),this.frameRate=Math.min(r,24),window.MediaStreamTrackProcessor){this.trackProcessor=new window.MediaStreamTrackProcessor({track:e});const t=this.trackProcessor.readable;this.postMessage({cmd:o.VB_EVENT_TYPE.VB_START,payload:{videoStream:t,frameRate:this.frameRate}},[t])}else this.captureVideoEle&&(this.isMetadataLoaded=!1,this.captureVideoEle.addEventListener("loadedmetadata",this.handleLoadMetadata),this.captureVideoEle.srcObject=this.videoStream,this.captureVideoEle.play(),this.captureCanvas&&(this.captureCanvas.width=i,this.captureCanvas.height=a),this.postMessage({cmd:o.VB_EVENT_TYPE.VB_START,payload:{frameRate:this.frameRate}}))}}else{if(this.isVBRunning)return;this.videoStream.getVideoTracks()[0].enabled=!0,this.captureVideoEle&&this.captureVideoEle.play(),this.postMessage({cmd:o.VB_EVENT_TYPE.VB_START})}this.isVBRunning=!0}))}stopCapture(e=!0){this.postMessage({cmd:o.VB_EVENT_TYPE.VB_STOP,payload:e}),this.captureVideoEle&&this.captureVideoEle.pause(),this.videoStream&&e&&(this.videoStream.getTracks().forEach(e=>{e.stop()}),this.videoStream=null),this.isVBRunning=!1}setMirror(e){this.postMessage({cmd:o.VB_EVENT_TYPE.VB_MIRROR,payload:e})}freeMemory(e){this.isVBReady&&this.postMessage({cmd:o.VB_EVENT_TYPE.VB_FREE_MEMORY,payload:e})}startReceiveMode(e){return e&&(this.captureConf=e),this.msgChannel||(this.msgChannel=new MessageChannel,this.msgChannel.port1.onmessage=e=>{var t;const{type:i,frame:a}=e.data;this.receiveTimer&&clearTimeout(this.receiveTimer),i===d.UNIFIED_VB_FRAME&&a?(null===(t=this.msgChannel)||void 0===t||t.port1.postMessage({type:d.UNIFIED_VB_ACK}),this.isEnabled?(this.isVBRunning&&this.stopCapture(),this.renderFrame(a)):a.close(),this.isSafari||(this.receiveTimer=setTimeout(()=>{this.captureConf&&!this.isVBRunning&&this.captureVideo(this.captureConf)},1e3))):i!==d.UNIFIED_VB_PAUSE&&i!==d.UNIFIED_VB_STOP||(this.captureConf&&!this.isVBRunning&&this.captureVideo(this.captureConf),i===d.UNIFIED_VB_STOP&&this.msgChannel&&(this.msgChannel.port1.onmessage=null,this.msgChannel=null))}),this.msgChannel.port2}enable(){this.postMessage({cmd:o.VB_EVENT_TYPE.VB_TOGGLE_VB,payload:!0}),this.isEnabled=!0}disable(){this.postMessage({cmd:o.VB_EVENT_TYPE.VB_TOGGLE_VB,payload:!1}),this.isEnabled=!1,!this.isVBRunning&&this.msgChannel&&this.captureConf&&(this.captureVideo(this.captureConf).catch(e=>{}),clearTimeout(this.receiveTimer))}renderFrame(e){return a(this,void 0,void 0,(function*(){this.postMessage({cmd:o.VB_EVENT_TYPE.VB_RENDER_FRAME,payload:e}),"close"in e&&e.close()}))}destory(){this.destoryed=!0,this.stopCapture(),this.vbLoadingTimer.clear(),this.msgChannel&&(this.msgChannel.port2.onmessage=null),this.captureVideoEle&&document.body.removeChild(this.captureVideoEle),this.worker&&(this.worker.removeEventListener("message",this.handle_message_from_vb_worker),this.worker.terminate())}createStream(){if(this.isStreamEnabled=!0,this.vbStream)return this.postMessage({cmd:o.VB_EVENT_TYPE.VB_GENERATE_STREAM}),this.vbStream;if(window.MediaStreamTrackGenerator)this.vbTrackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.vbStream=new MediaStream([this.vbTrackGenerator]);else{if(this.streamCanvas=document.createElement("canvas"),this.videoStream){const e=this.videoStream.getVideoTracks()[0];if(e){const{width:t=0,height:i=0}=e.getSettings();this.streamCanvas.width=t,this.streamCanvas.height=i}}this.vbStream=this.streamCanvas.captureStream(24)}const e=this.vbStream.getVideoTracks()[0];return e&&(e.getStats=()=>this.stats),this.isVBReady&&this.generateVBStream(),this.vbStream}stopStream(){this.vbStream&&(this.isStreamEnabled=!1,this.postMessage({cmd:o.VB_EVENT_TYPE.VB_STOP_STREAM}))}handleLoadMetadata(){this.isMetadataLoaded=!0,this.captureVideoEle.removeEventListener("loadedmetadata",this.handleLoadMetadata)}}if(c.VB_WORKER_NAME="vb_worker",c.VB_CAPTURE_VIDEO="VB_CAPTURE_VIDEO",c.VB_STREAM_CANVAS="VB_STREAM_CANVAS",c.EXTERNAL_EVENTS=new Set([o.VB_EVENT_TYPE.VB_GENERATED_FRAME,o.VB_EVENT_TYPE.VB_INIT_FAILED,o.VB_EVENT_TYPE.VB_INIT_SUCCESS,o.VB_EVENT_TYPE.VB_MODEL_READY,o.VB_EVENT_TYPE.VB_PREDICT_DONE,o.VB_EVENT_TYPE.VB_VIDEO_FORMAT_UNSUPPORTED,o.VB_EVENT_TYPE.VB_WORKER_ERROR,o.VB_EVENT_TYPE.VB_GENERATE_FIRST_FRAME,o.VB_EVENT_TYPE.VB_RESOLUTION_CHANGE]),t.default=c,document){const e=document.currentScript;if(e){const t=e.src;if(t){let e=t.indexOf("/vb.min.js");-1!==e&&(c.cdnPath=t.substring(0,e))}}}},function(e,t,i){var a=i(91).default;e.exports=a},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,i){var a=i(40),r=i(57),n=Object.prototype.hasOwnProperty;e.exports=function(e){if(!a(e))return r(e);var t=[];for(var i in Object(e))n.call(e,i)&&"constructor"!=i&&t.push(i);return t}},function(e,t,i){var a=i(58)(Object.keys,Object);e.exports=a},function(e,t){e.exports=function(e,t){return function(i){return e(t(i))}}},function(e,t,i){var a=i(60),r=i(67),n=i(68),o=i(69),s=i(70),d=i(25),u=i(43),l=u(a),c=u(r),h=u(n),f=u(o),p=u(s),_=d;(a&&"[object DataView]"!=_(new a(new ArrayBuffer(1)))||r&&"[object Map]"!=_(new r)||n&&"[object Promise]"!=_(n.resolve())||o&&"[object Set]"!=_(new o)||s&&"[object WeakMap]"!=_(new s))&&(_=function(e){var t=d(e),i="[object Object]"==t?e.constructor:void 0,a=i?u(i):"";if(a)switch(a){case l:return"[object DataView]";case c:return"[object Map]";case h:return"[object Promise]";case f:return"[object Set]";case p:return"[object WeakMap]"}return t}),e.exports=_},function(e,t,i){var a=i(29)(i(21),"DataView");e.exports=a},function(e,t,i){var a=i(31),r=i(64),n=i(30),o=i(43),s=/^\[object .+?Constructor\]$/,d=Function.prototype,u=Object.prototype,l=d.toString,c=u.hasOwnProperty,h=RegExp("^"+l.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!n(e)||r(e))&&(a(e)?h:s).test(o(e))}},function(e,t,i){var a=i(41),r=Object.prototype,n=r.hasOwnProperty,o=r.toString,s=a?a.toStringTag:void 0;e.exports=function(e){var t=n.call(e,s),i=e[s];try{e[s]=void 0;var a=!0}catch(e){}var r=o.call(e);return a&&(t?e[s]=i:delete e[s]),r}},function(e,t){var i=Object.prototype.toString;e.exports=function(e){return i.call(e)}},function(e,t,i){var a,r=i(65),n=(a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";e.exports=function(e){return!!n&&n in e}},function(e,t,i){var a=i(21)["__core-js_shared__"];e.exports=a},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,i){var a=i(29)(i(21),"Map");e.exports=a},function(e,t,i){var a=i(29)(i(21),"Promise");e.exports=a},function(e,t,i){var a=i(29)(i(21),"Set");e.exports=a},function(e,t,i){var a=i(29)(i(21),"WeakMap");e.exports=a},function(e,t,i){var a=i(72),r=i(27),n=Object.prototype,o=n.hasOwnProperty,s=n.propertyIsEnumerable,d=a(function(){return arguments}())?a:function(e){return r(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=d},function(e,t,i){var a=i(25),r=i(27);e.exports=function(e){return r(e)&&"[object Arguments]"==a(e)}},function(e,t){var i=Array.isArray;e.exports=i},function(e,t,i){var a=i(31),r=i(44);e.exports=function(e){return null!=e&&r(e.length)&&!a(e)}},function(e,t,i){(function(e){var a=i(21),r=i(76),n=t&&!t.nodeType&&t,o=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===n?a.Buffer:void 0,d=(s?s.isBuffer:void 0)||r;e.exports=d}).call(this,i(36)(e))},function(e,t){e.exports=function(){return!1}},function(e,t,i){var a=i(78),r=i(79),n=i(80),o=n&&n.isTypedArray,s=o?r(o):a;e.exports=s},function(e,t,i){var a=i(25),r=i(44),n=i(27),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return n(e)&&r(e.length)&&!!o[a(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,i){(function(e){var a=i(42),r=t&&!t.nodeType&&t,n=r&&"object"==typeof e&&e&&!e.nodeType&&e,o=n&&n.exports===r&&a.process,s=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s}).call(this,i(36)(e))},function(e,t,i){var a=i(45).default,r=i(82);e.exports=function(e){var t=r(e,"string");return"symbol"===a(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){var a=i(45).default;e.exports=function(e,t){if("object"!==a(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){var a=i(30),r=i(84),n=i(85),o=Math.max,s=Math.min;e.exports=function(e,t,i){var d,u,l,c,h,f,p=0,_=!1,m=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function E(t){var i=d,a=u;return d=u=void 0,p=t,c=e.apply(a,i)}function S(e){return p=e,h=setTimeout(C,t),_?E(e):c}function v(e){var i=e-f;return void 0===f||i>=t||i<0||m&&e-p>=l}function C(){var e=r();if(v(e))return A(e);h=setTimeout(C,function(e){var i=t-(e-f);return m?s(i,l-(e-p)):i}(e))}function A(e){return h=void 0,g&&d?E(e):(d=u=void 0,c)}function T(){var e=r(),i=v(e);if(d=arguments,u=this,f=e,i){if(void 0===h)return S(f);if(m)return h=setTimeout(C,t),E(f)}return void 0===h&&(h=setTimeout(C,t)),c}return t=n(t)||0,a(i)&&(_=!!i.leading,l=(m="maxWait"in i)?o(n(i.maxWait)||0,t):l,g="trailing"in i?!!i.trailing:g),T.cancel=function(){void 0!==h&&clearTimeout(h),p=0,d=f=u=h=void 0},T.flush=function(){return void 0===h?c:A(r())},T}},function(e,t,i){var a=i(21);e.exports=function(){return a.Date.now()}},function(e,t,i){var a=i(30),r=i(86),n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,d=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(r(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var i=s.test(e);return i||d.test(e)?u(e.slice(2),i?2:8):o.test(e)?NaN:+e}},function(e,t,i){var a=i(25),r=i(27);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==a(e)}},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,i){"use strict";var a=this&&this.__awaiter||function(e,t,i,a){return new(i||(i=Promise))((function(r,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function s(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}d((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(i(23)),o=i(10);t.default=class{constructor(e,t){this.isMirror=!1,this.display=new n.default(e,t,0,void 0,{preserveDrawingBuffer:!1},void 0,!1,!1)}renderFrame(e,t,i,a){if(this.display){let r={x:0,y:0,width:this.display.canvasElement.width,height:this.display.canvasElement.height};this.display.updateRemoteVideoTextures(e,t,a,i,0,!0,r,!1),this.display.drawRemoteVideo(r,this.isMirror)}}render(e){return a(this,void 0,void 0,(function*(){let t=o.VIDEO_RGBA;if("data_ptr"in e){const{data:t,format_width:i,format_height:a,valid_x:r,valid_y:n,valid_width:s,valid_height:d}=e;let u={top:n,left:r,width:s,height:d};this.display.setVideoMode(o.VIDEO_I420),this.renderFrame(i,a,t,u)}else if(self.VideoFrame&&e instanceof VideoFrame){const{format:i,visibleRect:a}=e;if(i&&a){if("I420"===i||"I420A"===i)t=o.VIDEO_I420;else if("NV12"===i)t=o.VIDEO_NV12;else{if("BGRA"!==i)return void(this.onUnsupportedFrame&&this.onUnsupportedFrame(i));t=o.VIDEO_BGRA}const{width:r,height:n}=a,s=new Uint8Array(e.allocationSize()),d={top:0,left:0,width:r,height:n};this.display.setVideoMode(t);try{yield e.copyTo(s),this.renderFrame(r,n,s,d)}catch(e){}e.close()}}else if(e instanceof ImageData){const{width:t,height:i}=e,a={top:0,left:0,width:t,height:i};this.display.setVideoMode(o.VIDEO_RGBA),this.renderFrame(t,i,e.data,a)}}))}updateSize(e,t){this.display.canvasElement.width=e,this.display.canvasElement.height=t}setMirror(e){this.isMirror=e}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.timer3s=null,this.timer10s=null,this.isVBPredictDone=!1,this.inited=!1}start(){this.inited=!0,this.clear(),this.timer3s=setTimeout(()=>{this.isVBPredictDone||this.ontimeout3s()},3e3),this.timer10s=setTimeout(()=>{this.isVBPredictDone||this.ontimeout10s()},1e4)}clear(){clearTimeout(this.timer3s),clearTimeout(this.timer10s),this.timer3s=null,this.timer10s=null}}},function(t,i,a){"use strict";a.r(i);var r={};a.r(r),a.d(r,"setCachedUserNodeListToWorker",(function(){return he})),a.d(r,"setUserNodeListToWorker",(function(){return fe})),a.d(r,"UpdateAudioPlayStatus",(function(){return pe})),a.d(r,"UpdateVideoPlayStatus",(function(){return _e})),a.d(r,"UpdateSharingPlayStatus",(function(){return me})),a.d(r,"preserveMessageController",(function(){return ge})),a.d(r,"previewController",(function(){return Ee})),a.d(r,"initVideoEncode",(function(){return Se})),a.d(r,"CloseMediaNetSessionToRwg",(function(){return Ce})),a.d(r,"AssertMediaSdkNotDestory",(function(){return Ae})),a.d(r,"initVideoDecode",(function(){return Re})),a.d(r,"initAudioEncode",(function(){return Ie})),a.d(r,"initAudioDecode",(function(){return be})),a.d(r,"initSharingDecode",(function(){return Oe})),a.d(r,"initSharingEncode",(function(){return De})),a.d(r,"Sharing_Decode_Post_message",(function(){return we})),a.d(r,"Sharing_Encode_Post_message",(function(){return ye})),a.d(r,"addAudioMonitorLog",(function(){return xe})),a.d(r,"initAudioSharedBuffer",(function(){return Ge})),a.d(r,"setSharingEngineInitProperties",(function(){return Fe})),a.d(r,"setAudioEngineInitProperties",(function(){return He})),a.d(r,"setVideoEngineInitProperties",(function(){return Ke})),a.d(r,"Set_Audio_WebSocket_Ip_Address",(function(){return je})),a.d(r,"Set_Audio_Web_Transport_Ip_Address",(function(){return Ye})),a.d(r,"Set_Video_WebSocket_Ip_Address",(function(){return qe})),a.d(r,"Set_Video_Web_Transport_Ip_Address",(function(){return Xe})),a.d(r,"JsAudioEngine_UnInit",(function(){return Qe})),a.d(r,"JsVideoEngine_UnInit",(function(){return ze})),a.d(r,"JsSharingEngine_UnInit",(function(){return Je})),a.d(r,"Video_Encode_Frame",(function(){return Ze})),a.d(r,"Sharing_Encode_Frame",(function(){return $e})),a.d(r,"Put_Video_Frame_Buffer",(function(){return et})),a.d(r,"Clear_Decoded_Sharing_Frame",(function(){return tt})),a.d(r,"Add_Video_Decode_Thread",(function(){return it})),a.d(r,"Add_Audio_Decode_Thread",(function(){return at})),a.d(r,"Get_SSRC_Latest_Time",(function(){return rt})),a.d(r,"Get_Video_SSRC_Latest_Time",(function(){return nt})),a.d(r,"Meeting_Fail_Over",(function(){return ot})),a.d(r,"Modify_Audio_SampleRate",(function(){return st})),a.d(r,"Notify_Audio_Thread_Status",(function(){return dt})),a.d(r,"Notify_Audio_Thread_AEC_Status",(function(){return ut})),a.d(r,"Notify_Audio_Thread_Msg_Channel",(function(){return lt})),a.d(r,"Notify_Video_Thread_Msg_Channel",(function(){return ct})),a.d(r,"Notify_Video_Sharing_Msg_Channel",(function(){return ht})),a.d(r,"Notify_Audio_Thread_Msg_Channel2",(function(){return ft})),a.d(r,"Notify_Audio_Thread_Msg_Channel3",(function(){return pt})),a.d(r,"Notify_Audio_Video_Thread_Msg_Channel",(function(){return _t})),a.d(r,"Notify_Video_Encode_Thread",(function(){return mt})),a.d(r,"Notify_Video_Encode_Thread_Transferable_Data",(function(){return gt})),a.d(r,"TransoferDataToVideoEncodeThread",(function(){return Et})),a.d(r,"Notify_Video_Decode_Thread",(function(){return St})),a.d(r,"Notify_Sharing_Video_Encode_Thread_Transferable_Data",(function(){return vt})),a.d(r,"Notify_Sharing_Encode_Thread_Transferable_Data",(function(){return Ct})),a.d(r,"Notify_Sharing_Video_Decode_Thread",(function(){return At})),a.d(r,"Notify_Sharing_Decode_Thread",(function(){return Tt})),a.d(r,"Notify_Audio_Thread_CurrentSSRC",(function(){return Rt})),a.d(r,"Notify_Audio_Encode_Thread",(function(){return It})),a.d(r,"Notify_Audio_Decode_Thread",(function(){return bt})),a.d(r,"Notify_Audio_Thread_Interpretation_Enable",(function(){return Ot})),a.d(r,"Notify_Audio_Thread_CC_Set_Lang",(function(){return Dt})),a.d(r,"Notify_Audio_Thread_Interpretation_Set_Lang",(function(){return wt})),a.d(r,"Notify_Audio_Thread_Interpretation_Mute",(function(){return yt})),a.d(r,"Notify_Audio_Thread_Interpretation_Set_Interpreter",(function(){return Mt})),a.d(r,"Reset_Aec",(function(){return Pt})),a.d(r,"saveBrowserInfo",(function(){return Vt})),a.d(r,"Start_Monitor",(function(){return kt})),a.d(r,"Send_Render_Monitor_Log",(function(){return Ut})),a.d(r,"Stop_Monitor",(function(){return Lt})),a.d(r,"Update_Video_Encrpt",(function(){return xt})),a.d(r,"Update_Sharing_Encrpt",(function(){return Wt})),a.d(r,"Update_Sharing_Video_Encode_Status",(function(){return Bt})),a.d(r,"Update_Sharing_Encode_Status",(function(){return Gt})),a.d(r,"Notify_Sharing_Video_Encode_Thread",(function(){return Ft})),a.d(r,"Notify_Sharing_Encode_Thread",(function(){return Ht})),a.d(r,"Update_Audio_Encrpt",(function(){return Kt})),a.d(r,"disableSocketReconnect",(function(){return jt})),a.d(r,"closeAllPromiseObject",(function(){return Yt})),a.d(r,"clearWorkerListener",(function(){return qt})),a.d(r,"closeAllMedia",(function(){return Xt})),a.d(r,"destroyAllWorkers",(function(){return Qt})),a.d(r,"pushMessageToWorker",(function(){return Zt})),a.d(r,"isVideoEncodeHandleReady",(function(){return $t})),a.d(r,"transportSettingCanvas",(function(){return ei})),a.d(r,"initResourceManager",(function(){return ti})),a.d(r,"prepareVBfile",(function(){return ri})),a.d(r,"transportImageBitMap",(function(){return ni})),a.d(r,"transportBgImageBitMap",(function(){return oi})),a.d(r,"transportVBBgImageBitMap",(function(){return si})),a.d(r,"transportMaskImageBitMap",(function(){return di})),a.d(r,"MirrorSendVideo",(function(){return ui})),a.d(r,"isSharingNotClearChromeVersion",(function(){return li})),a.d(r,"MEDIA_INIT_SUCCESS_CALLBACK_METADATA",(function(){return ci})),a.d(r,"setMediaSessionHold",(function(){return hi})),a.d(r,"TransferCmdMsgToWorker",(function(){return pi})),a.d(r,"CreateThreadWorker",(function(){return _i})),a.d(r,"GetWorkerTypeThread",(function(){return mi}));var n=a(2),o=a(10),s=a(9),d=a(17);function u(){this.ssrcQueueMap=new Map,u.prototype.AddQueue=function(e){var t=new d.a;return this.ssrcQueueMap.set(e,t),t},u.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},u.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},u.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},u.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},u.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var l=function(){this.frames=0,this.ntp=new d.a};l.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,i=0,a=0,r=0,n=0;n30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,i=0,a=0,r=0,n=0;nthis.max_timeout&&(this.max_timeout=e),e{i._report(),i._timeoutid=0},this.interval_report_time)}}class P{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,o=arguments.length>6?arguments[6]:void 0;this.offset=r,this._BYTES_PER_ELEMENT=t,this.capacity=(n-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,r,1),this.read_ptr=new Uint32Array(this.buf,r+4,1),this.storageUint8sByteOffset=r+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,n-8),this.byteLength=n,this.label=i,this.usingOneElementBuffer=a,o&&(this.wasmMemory=o),a&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new d.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let a=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==a)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++a}if(a>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),a>=1e3&&(C.default.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),i&&i("vqslclear")),a>0&&i){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,i&&i("vqsl"+a))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let i=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+i),i+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=i;let a=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,a),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let i,a,r,n=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){i=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,n[0]):new Uint8Array(n[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,i.byteLength);i.set(e,0)}else i=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+n[0]),a=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r=t*this._BYTES_PER_ELEMENT+8+4+n[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?i:{bCopyData:e,uint8s:i,begin:a,end:r}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class N{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof P))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=i,this.tick_lasted_time=0,this.timeoutMS=a,this.maxCount=r}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class V{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),i={};this.keysList.forEach((t,a)=>{i[t]=e[a]}),i[this.timeStampKey]=Number(t.getBigUint64(0,!0));let a,r=Number(t.getBigUint64(8,!0)),n=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,r);return a=(this.bCopyData,n),i.data=a,i}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,i=new Uint32Array(e.buffer,0,9),a=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{i[t]=this.obj[e]}),a.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),a.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}class k{constructor(){this.onmessage=()=>{}}addEventListener(){}close(){}}class U{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(i=>{i(e,t,1)}))}removeTransport(e){var t;let i=e.id;i in this.transportMap&&(delete this.transportMap[i],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let i=this.transportMap[t],a=i.target_thread==U.SELF_THREAD;if(i.type==e&&a)return i}return null}}function L(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new M({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}D()(U,"NO_THREAD",0),D()(U,"SELF_THREAD",1),L.prototype._qos_report_timeout=function(e,t,i,a){if(this._customer_callback){let r="".concat(e,",").concat(t,",").concat(i,",").concat(a);this._customer_callback(this._tag+"TimeOut",r)}},L.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),i="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),i=i.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",i)):console.error("tag:".concat(this._tag,",").concat(t))},L.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},L.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},L.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},L.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(y.IsQosReport(e))return void this._cureen_qos_report++;if(y.IsVideoPkg(e)){let t=y.GetQOSTime(e),i=performance.now();if(this._lasted_qos_ts){let e=i-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,i)}this._lasted_qos_ts=t,this._lasted_sys_ts=i,this._lasted_data=e}}};class x{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class W{constructor(e,t,i,a){this.id=e,this.type=t,this.datachannel=i,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=W.UNINIT,this.target_thread=a,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===W.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:134,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:135,id:this.id,type:this.type})),this._status!=W.DISCONNECT&&this._clear(),this._status=W.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==W.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var i;(this._status=W.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new L({tag:this.type==R.b.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new L({tag:this.type==R.b.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=W.CONNECTED)&&(null===(i=this.connectedFn)||void 0===i||i.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=W.DISCONNECT;let i=this.disconnectedFn;this._clear(),t!=W.DISCONNECT&&(null==i||i())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let i=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==i||i.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case s.DATACHANNEL_CLOSE:this._onclose();break;case s.DATACHANNEL_OPEN:this._onopen();break;case s.DATACHANNEL_ERROR:this._onerror(t.ev);break;case s.MONITOR_MESSAGE:this.report_monitor_func(t.tag,t.data)}}}D()(W,"UNINIT",0),D()(W,"CONNECTED",1),D()(W,"DISCONNECT",2);class B{constructor(e){let t=e||{};this.type=t.type||B.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new U(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:i,data:a}=e.data,r=this.transportlists.find(e=>e.id===i);if(r||t==s.CREATE_MSGSOCK_TRANSPORT)switch(t){case s.CREATE_MSGSOCK_TRANSPORT:this.addRemoteTransport(e.data,null);break;case s.TRANSPORT_SET_MSGPORT:r.setMsgPort(a||new k);break;case s.TRANSPORT_SET_SABBUFF:r.setSabBuffer(e.data.sender,e.data.reciver);break;case s.CLOSE_TRANSPORT:r.remote=null,this.removeTransport(r)}}_onrecvsubthreadlistener(e,t){let{cmd:i,transportId:a,transportType:r}=t.data,n=this.transportlists.find(e=>e.id===a);switch(i){case s.CREATE_MSGSOCK_TRANSPORT:this.addRemoteTransport(t.data,e);break;case s.TRANSPORT_SET_SABBUFF:this.setSabBufferInfo(n,t.data.sender,t.data.reciver);break;case s.CLOSE_TRANSPORT:n.remote=null,this.removeTransport(n)}}createRemoteTransport(e,t){let i={cmd:s.CREATE_MSGSOCK_TRANSPORT,transportType:e.type,transportId:e.id};e.portInfo?(i.port=e.portInfo,t.postMessage(i,[e.portInfo])):t.postMessage(i)}closeRemoteTransport(e,t){t.postMessage({cmd:s.CLOSE_TRANSPORT,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var i,a,r,n;(null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(a=e.sabInfo)&&void 0!==a&&a.reciver)&&t.postMessage({cmd:s.TRANSPORT_SET_SABBUFF,transportId:e.id,sender:null===(r=e.sabInfo)||void 0===r?void 0:r.sender,reciver:null===(n=e.sabInfo)||void 0===n?void 0:n.reciver})}addRemoteTransport(e,t){let{transportId:i,port:a,transportType:r}=e;let n=this.createMsgSocketTransport(r);n.id=i,n.remote=t,n.portInfo=a,a?n.setMsgPort(n.portInfo):this.bindMessageChannel(n),this.addTransport(n)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let i=t.target_thread||U.SELF_THREAD;e.target_thread=i,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=U.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new j({mgr:this,sock:new K,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=B.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.TRANSPORT_SET_MSGPORT,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,i){this.type==B.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),i&&(i.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:i},e.target_thread!=U.NO_THREAD&&(e.target_thread!=U.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,i))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof W){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof W))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let i=0;i{if(!e.transportlists.includes(t.type))return;let i=e.target_thread||U.SELF_THREAD;i==t.target_thread||(this.type==B.THREAD_MAIN&&t.target_thread!=U.NO_THREAD&&t.target_thread!=i&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=i,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let i=e.target_thread;if(i!=U.SELF_THREAD)this.createRemoteTransport(e,i),this.setRemoteTransportSABBUffer(e,i);else{var a,r,n,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(a=e.sabInfo)&&void 0!==a&&a.sender||null!==(r=e.sabInfo)&&void 0!==r&&r.reciver)e.setSabBuffer(null===(n=e.sabInfo)||void 0===n?void 0:n.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=U.SELF_THREAD?this.type==B.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;t{0};class H{constructor(){this.onmessage=F,this.status=H.CLOSED,this.onopen=F,this.onclose=F,this.onwer=null}send(e){}delete(){this.onmessage=F,this.onopen=F,this.onclose=F,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=H.OPEN,this.onopen()}close(){this.status=H.CLOSED,this.onclose()}}D()(H,"OPEN",1),D()(H,"CLOSED",2);class K extends H{constructor(){super({}),this.sab={},this.port=null,this.onmessage=F,this.sender=F,this.videoSender=F,this.reciver=F,this.wasmSender=F}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=F,this.sender=F,this.videoSender=F,this.reciver=F,this.wasmSender=F;let{consumer:i}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==i||i.setDataCallback(F),null==i||i.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=F),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=H.OPEN||this.onopen()}close(){this.status=H.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:i}=e.data;switch(t){case s.MSG_BUFFER_TICKT:this.reciver();break;case s.MSG_QUEUE_DATA:this.onmessage(i,0);break;case s.MSG_QUEUE_STATUS:this.status=i,this.status==H.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:i,interval:a}=e||{};i?a?(this.sender=e=>{i.enqueue(e)},this.wasmSender=e=>{i.enqueue(e)},this.videoSender=(e,t)=>{if(!i.enqueueSafe([e,t],!1)){let a=new Uint8Array(t.length+e.length);a.set(e,0),a.set(t,e.length),i.enqueueSafe(a)}}):(this.sender=e=>{i.enqueue(e),this.port.postMessage({cmd:s.MSG_BUFFER_TICKT})},this.wasmSender=e=>{i.enqueue(e),this.port.postMessage({cmd:s.MSG_BUFFER_TICKT})},this.videoSender=(e,t)=>{if(!i.enqueueSafe([e,t],!1)){let a=new Uint8Array(t.length+e.length);a.set(e,0),a.set(t,e.length),i.enqueueSafe(a)}this.port.postMessage({cmd:s.MSG_BUFFER_TICKT})}):(this.sender=e=>{this.port.postMessage({cmd:s.MSG_QUEUE_DATA,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:s.MSG_QUEUE_DATA,data:t},[t.buffer])},this.videoSender=(e,t)=>{let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),this.port.postMessage({cmd:s.MSG_QUEUE_DATA,data:i},[i.buffer])});let{sabqueue:r,consumer:n,useCopy:o,interval:d,offset:u}=t||{};if(n&&(n.cancelConsume(),n=null),r){const e=o?e=>{this.onmessage(e,0)}:u?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let i=null,a=j.dataTransportMgr.monitorlogfn;if(d&&a){var l;let e=new M({tag:"WCL_M,VDRB"+(null===(l=this.onwer)||void 0===l?void 0:l.type),interval:1e4,reportcallback:q});i=e.timeoutReport.bind(e)}n=new N(r,e,i),t.consumer=n,d?n.consume(d,o):this.reciver=()=>{n.consumeAll(o)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=F,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:i,interval:a,offset:r,length:n,useOneElement:o}=e,s=new P(r>0?t.buffer:t,void 0,void 0,!!o,r,n,r>0?t:null);this.sab.sender={sabqueue:s,interval:a,useCopy:i,offset:r}}if(null!=t&&t.sab){var i;let{sab:e,useCopy:a,interval:r,offset:n,length:o,useOneElement:s}=t,d=new P(n>0?e.buffer:e,void 0,void 0,!!s,n,o,n>0?e:null),{consumer:u}=(null===(i=this.sab)||void 0===i?void 0:i.reciver)||{};u&&(u.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:d,interval:r,useCopy:a,offset:n}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:s.MSG_QUEUE_STATUS,data:e})):console.error("MsgQueueSocket not initialized")}}class j{constructor(e){this.onmessage=F,this.onopen=F,this.onclose=F,this.connect_type=e.connect_type||j.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new H,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=U.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=j.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==B.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=j.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==B.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof K))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof K))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof K&&this.sock.setStatus(e)}}D()(j,"UDP",0),D()(j,"TCP",1),D()(j,"RLB_UDP",2),D()(j,"dataTransportMgr",null);class Y{constructor(e){this.sock=null,this.onmessage=F}isReady(){return!1}send(){F()}setStatus(e){0}}function q(e,t,i,a){var r;null===(r=B.monitorlogfn)||void 0===r||r.call(B,e,"".concat(t,",").concat(i,",").concat(a))}function X(e,t){try{const i="undefined"!=typeof DedicatedWorkerGlobalScope;if(!j.dataTransportMgr&&!i)return void console.error("not InitDataTransportModule");let a=j.dataTransportMgr;if(t in a.refs)return;let r=a._onrecvsubthreadlistener.bind(a,e);e.addEventListener("message",r);let n={worker:e,type:t,listener:r};a.refs[t]=n}catch(e){console.error("<<<< initTransportWorker",e)}}function Q(e){return j.dataTransportMgr.getTransportByType(e)}function z(e){if(!j.dataTransportMgr)throw new Error("not InitDataTransportModule");j.dataTransportMgr.removeDataChannel(e)}class J{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,j.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,j.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,i){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==R.b.VIDEO&&this.connectVideoSession(e),t==R.b.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==R.b.VIDEO&&this.connectVideoSession(e),t==R.b.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new Y,i=Q(G.VIDEO_ENCODE)||t,a=Q(G.VIDEO_DECODE)||t,r=Q(G.SHARR_DECODE)||t,n=(null==e?void 0:e.isReady())?H.OPEN:H.CLOSED;i.setStatus(n),a.setStatus(n),this.isSupportVideoShare||r.setStatus(n),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])i.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void r.send(t);a.send(t)}});const o=t=>{e.send(t)};i.onmessage=o,a.onmessage=o,r.onmessage=o}connectAudioSession(e){let t=new Y,i=Q(G.AUDIO_ENCODE)||t,a=Q(G.AUDIO_DECODE)||t,r=e.isReady()?H.OPEN:H.CLOSED;i.setStatus(r),a.setStatus(r),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?i.send(t):a.send(t)});const n=t=>{e.send(t)};i.onmessage=n,a.onmessage=n}notifyTransportStatus(e,t){}}var Z=a(13);function $(e){ie.instance||(ie.instance=new ie),ie.instance.start(e)}function ee(e){ie.instance&&ie.instance.setTimeoutCallback(e)}function te(e,t){ie.instance&&ie.instance.registerWorker(t,e)}class ie{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let i={id:e,worker:t},a=this._recvheartbeat.bind(this,i);i.listener=a,i.lastedtimestamp=Date.now(),i.worker.addEventListener("message",i.listener),this.monitorworkers[e]=i}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let i=t.data;i.cmd===s.WORKER_HEARTBEAT&&(e.lastedtimestamp=i.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:s.WORKER_HEARTBEAT,timestamp:Date.now()})},ie.INTREVAL_TIME_MS));const i=Math.max(ie.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=ie.instance,t=Object.keys(e.monitorworkers),a=Date.now(),r=this._lasted_timestamp;ar+ie.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",a-r):t.forEach(t=>{var i;let r=e.monitorworkers[t],n=r.lastedtimestamp+(null!==(i=document)&&void 0!==i&&i.hidden?ie.MAX_HEART_TIMEOUT_MS:ie.HEART_TIMEOUT_MS);a>n&&(e.timeoutcallbackfn(r.id,a-r.lastedtimestamp),r.lastedtimestamp=a)}))},ie.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}D()(ie,"INTREVAL_TIME_MS",3e3),D()(ie,"HEART_TIMEOUT_MS",15e3),D()(ie,"MAX_HEART_TIMEOUT_MS",3e4),D()(ie,"instance",null);const ae=Object(v.a)("sdk.engine"),{VB_SETTING_PARA_ERROR_TYPE:re}=n;async function ne(e,t){let i;switch(e){case R.f.VIDEO_ENCODE:i=I.default.videoEncResponseText;break;case R.f.VIDEO_DECODE:i=I.default.videoDecResponseText;break;case R.f.AUDIO_ENCODE:i=I.default.audioEncodeResponse;break;case R.f.AUDIO_DECODE:i=I.default.audioDecodeResponse;break;case R.f.SHARING_DECODE:i=I.default.sharingDecodeResponse;break;case R.f.SHARING_ENCODE:i=I.default.sharingEncodeResponse}i||(i=await oe(t.workerJsFileUrl,t.integrityHelper));const a="wasmUrl = '"+t.workerWasmFileUrl+"';";return i.replace(/self\.__wasmCodeDataEndFlag\s*=\s*1[;|,]/,a+"self.__wasmCodeDataEndFlag = 1;")}function oe(e,t){let i=null;return t&&(i=t.getIntegrity()),S.default.download(e,i)}function se(e,t,i,a,r){return new Promise((o,s)=>{!async function(e,t,i,a,r){if(r&&r.isDestroy)return T.default.add_monitor("ZIDX",a),ae("WorkerType:".concat(a,";The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. "));let o,s={};if(R.i[a]&&Object.assign(s,{name:R.i[a]}),a==R.f.AUDIO_ENCODE?I.default.AEW&&(o=I.default.AEW):a==R.f.AUDIO_DECODE&&I.default.ADW&&(o=I.default.ADW),o)a==R.f.AUDIO_ENCODE?I.default.AEWF=!0:a==R.f.AUDIO_DECODE&&(I.default.ADWF=!0);else{const t=window.URL.createObjectURL(new Blob([await ne(a,e)]));o=new Worker(t,s),o.addEventListener("error",e=>{if(e.message&&e.message.includes("RuntimeError:")){let e=performance.now();e-I.default.crashLastTime>3e4&&(I.default.crashCount++,I.default.crashLastTime=e,Object(Z.NotifyUIError)(n.NOTIFY_UI_FAILOVER),le("NOTIFY_UI_FAILOVER ".concat(I.default.crashCount)))}}),a===R.f.VIDEO_ENCODE&&o.postMessage({command:"WORKER_BOLB_URL",blobUrl:t}),I.default.mediaSDKHandle.is32bitbrowser&&(a==R.f.AUDIO_ENCODE?I.default.AEW=o:a==R.f.AUDIO_DECODE&&(I.default.ADW=o))}t&&t.call(i,o)}(e,(function(e){var r=I.default.SPECIAL_ID;t&&(T.default.add_monitor("WAM"+a),t.Add(r,e)),e.onmessage=e=>{i(e)},o()}),this,a,r)})}function de(e,t){let i=t.data;[ue,ce].forEach(t=>{try{t.call(null,e,i)}catch(e){C.default.error("Error from allWorkersListener",e)}})}function ue(e,t){-1!==[R.f.AUDIO_ENCODE,R.f.VIDEO_ENCODE,R.f.SHARING_ENCODE].indexOf(e)&&t.status===s.AES_GCM_IV_CALLBACK_FROM_WASM&&(ae("allWorkersListener_AES_IV",e,t),I.default.Notify_APPUI_SAFE(n.AES_GCM_IV_RESPONSE,{workerType:e,iv:S.default.buffer2stringSplitByComma(t.data)}))}function le(e){let t=S.default.getMachineCapability();t.errorMessage=e,C.default.severityerror(t,["MEDIASDK_ERROR"])}function ce(e,t){if(t.status===s.GLOBAL_TRACING_LOG)if("low"==t.level)C.default.directReport("".concat(t.errorMessage));else{let i="Error from ".concat(e," worker: ").concat(t.errorMessage);-1!=i.indexOf("E:H")?le(i):C.default.error(i,t.errorEvent)}}function he(e){try{var t;null!==(t=I.default.userNodeList)&&void 0!==t&&t.length&&Zt(e,{userNodeList:I.default.userNodeList},129,!1,!1)}catch(t){C.default.error("Error when sending cached user node list to worker workerType "+e,t)}}function fe(e){let t=I.default.userNodeList||[],i=e.concat(t);I.default.userNodeList=S.default.removeDuplicates(i,(e,t)=>e.userid!==t.userid),[R.f.AUDIO_ENCODE,R.f.AUDIO_DECODE,R.f.VIDEO_ENCODE,R.f.VIDEO_DECODE,R.f.SHARING_ENCODE,R.f.SHARING_DECODE].forEach(async e=>{let t;switch(e){case R.f.AUDIO_ENCODE:t=I.default.audioEncodeInitInstance;break;case R.f.AUDIO_DECODE:t=I.default.audioDecInitInstance;break;case R.f.VIDEO_ENCODE:t=I.default.videoInitInstance;break;case R.f.VIDEO_DECODE:t=I.default.videoDecInitInstance;break;case R.f.SHARING_ENCODE:t=I.default.sharingEncInitInstance;break;case R.f.SHARING_DECODE:t=I.default.sharingDecInitInstance}try{await t.waitforInitSuccess(),ae("setUserNodeListToWorker init success",e),Zt(e,{userNodeList:I.default.userNodeList},129,!1,!0)}catch(e){C.default.error("Error when sending user node list to worker",e)}})}function pe(e){I.default.isAudioPlayWork=e}async function _e(e){I.default.isVideoPlayWork=e,await Zt(R.f.VIDEO_DECODE,{isVideoPlayWork:e},"VideoPlayStatus",!1,!0)}function me(e){I.default.isSharingPlayWork=e}const ge=function(){const e={SDK_TO_WORKER:"SDK_TO_WORKER",SDK_TO_WORKER_WAIT_OK:"SDK_TO_WORKER_WAIT_OK",SDK_TO_APP:"SDK_TO_APP",SDK_TO_SDK:"SDK_TO_SDK"};return{nameMap:{INIT_VIDEO_ENCODE_SUCCESS:"INIT_VIDEO_ENCODE_SUCCESS",INIT_VIDEO_DECODE_SUCCESS:"INIT_VIDEO_DECODE_SUCCESS",CREATE_VIDEO_ENCODE_HANDLE_SUCCESS:"CREATE_VIDEO_ENCODE_HANDLE_SUCCESS",CREATE_VIDEO_DECODE_HANDLE_SUCCESS:"CREATE_VIDEO_DECODE_HANDLE_SUCCESS",CREATE_AUDIO_ENCODE_HANDLE_SUCCESS:"CREATE_AUDIO_ENCODE_HANDLE_SUCCESS",CREATE_AUDIO_DECODE_HANDLE_SUCCESS:"CREATE_AUDIO_DECODE_HANDLE_SUCCESS"},map:new Map,direction:e,clear(){this.map.clear()},subscribeMessage(t){const i=this.map.get(t);i&&(i.forEach(t=>{const{direction:i,messageParams:a,handler:r}=t;if(i===e.SDK_TO_APP)I.default.Notify_APPUI(...a);else if(i===e.SDK_TO_WORKER_WAIT_OK)Zt(...a);else if(i===e.SDK_TO_WORKER){const[e,t]=a,i=zt(e);i&&i.postMessage(t)}else i===e.SDK_TO_SDK&&r&&r(a)}),this.map.delete(t))},enqueueMessage(e){let{name:t,messageParams:i,direction:a,...r}=e;this.map.has(t)||this.map.set(t,[]),this.map.get(t).push({direction:a,messageParams:i||[],...r})}}}(),Ee={resetAudioEncode:e=>{!e&&I.default.isPreviewMode.audioEncode&&(I.default.audioEncodeSession=null),I.default.isPreviewMode.audioEncode=!!e},resetAudioDecode:e=>{!e&&I.default.isPreviewMode.audioDecode&&(I.default.audioDecodeSession=null),I.default.isPreviewMode.audioDecode=!!e},resetVideoEncode:e=>{!e&&I.default.isPreviewMode.videoEncode&&(I.default.videoEncodeSession=null),I.default.isPreviewMode.videoEncode=!!e},resetVideoDecode:e=>{!e&&I.default.isPreviewMode.videoDecode&&(I.default.videoDecodeSession=null),I.default.isPreviewMode.videoDecode=!!e}};async function Se(e,t){I.default.localVideoEncMGR||(I.default.localVideoEncMGR=new p({sessionid:t._id})),ve(R.f.VIDEO_DECODE,I.default.localVideoEncMGR.sessionid,t._id),I.default.videoEncWorkerPath=e.workerJsFileUrl;let i=await oe(e.workerJsFileUrl,e.integrityHelper);if(I.default.videoEncResponseText=i,!Ae(t))return!1;if(await async function(e,t,i,a){if(!I.default.localVideoEncMGR)return;I.default.isVideoEncodeThreadStart||(I.default.isVideoEncodeThreadStart=!0,await se(a,I.default.localVideoEncMGR,Ve,R.f.VIDEO_ENCODE,i))}(0,0,t,e),!Ae(t,"Add_Video_Encode_Thread"))return C.default.error("Add_Video_Encode_Thread Worker Not Controled"),!1;let a=mi(R.f.VIDEO_ENCODE);X(a,R.f.VIDEO_ENCODE),te(a,R.f.VIDEO_ENCODE),ge.subscribeMessage(ge.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS),await async function(e){if(!I.default.localVideoEncMGR)return;if(await I.default.videoInitInstance.wasmSuccessPromise,!Ae(e))return;var t=I.default.localVideoEncMGR.map.get(I.default.SPECIAL_ID);let i=I.default.localVideoPara.confId||0;Te(I.default.videoEncodeSession,i)&&(I.default.videoEncodeSession=null);if(t&&!I.default.videoEncodeSession){I.default.videoEncodeSession={type:R.f.VIDEO_ENCODE,userId:i};var a=0;a="firefox"===S.default.browserType.browser?1080:1070,I.default.mediaSDKHandle.mtu_size=a;let r=null;I.default.ivObj&&(r=I.default.ivObj[R.f.VIDEO_ENCODE],r=S.default.stringSplitByComma2Buffer(r));let n={command:1,_id:e._id,websocket_ip_address:I.default.Video_WebSocket_Ip_Address?I.default.Video_WebSocket_Ip_Address+"&mode=2":void 0,confId:I.default.localVideoPara.confId,confKey:"",logon:I.default.localVideoPara.logon,sendvideo:!0,isChromeOrEdge:S.default.browser.isChrome,isArmSafari:S.default.browser.isSafari&&!S.default.isMacIntelSafari(),isFirefox:I.default.localVideoPara.isFirefox,mtu_size:a,meetingid:I.default.localVideoPara.meetingid,meetingnumb:I.default.localVideoPara.meetingnumb,videoencodethreadnumb:I.default.localVideoPara.videoencodethreadnumb,iv:r,videodecodethreadnumb:I.default.localVideoPara.videodecodethreadnumb,isSupportMultiThread:I.default.localVideoPara.isSupportMultiThread,isSupportVirtualBackground:I.default.localVideoPara.isSupportVirtualBackground,uplimit:I.default.uplimit,isSupportWebCodecEnocde:I.default.localVideoPara.isSupportWebCodecEnocde,initWebCodecFlag:I.default.localVideoPara.initWebCodecFlag,is360penablehwenc:I.default.enable360pHWEnc,is360penablehwdec:I.default.enable360pHWDec,enable720p:I.default.localVideoPara.enable720p,enableOptCopyFrame:I.default.enableOptCopyFrame,isPreviewMode:I.default.isPreviewMode.videoEncode,...I.default.Video_Web_Transport_Ip_Address?{webtransportURL:I.default.Video_Web_Transport_Ip_Address+"&mode=2"}:{},enableAudioBridge:I.default.enableAudioBridge,platformType:I.default.localVideoPara.platformType,rendererType:I.default.localVideoPara.rendererType,graphicalname:S.default.graphicName,vendorname:S.default.graphicvendorname,enableMultiDecodeVideoWithoutSAB:!!I.default.enableMultiDecodeVideoWithoutSAB,IsRenderInWorker:I.default.localVideoPara.IsRenderInWorker,enableVBWasmBackend:e.enableVBWasmBackend,webrtcvideo:I.default.localVideoPara.webrtcvideo,isEnableCanvasAlphaChannel:!1,isEnableCanvasCtxOptionsOpt:b.a.isEnableCanvasCtxOptionsOpt(),MaskFlag:I.default.localVideoPara.MaskFlag,isSafari:I.default.localVideoPara.isSafari};t.postMessage(n),I.default.tfjsurl&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:I.default.tfjsurl,type:"js"}),I.default.vbbin&&I.default.vbjson&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:I.default.vbbin,json:I.default.vbjson},index:0}),I.default.afnbin&&I.default.afnjson&&(t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:I.default.afnbin,json:I.default.afnjson},index:1}),I.default.basebin&&I.default.basejson&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:I.default.basebin,json:I.default.basejson},index:2}))}}(t)}function ve(e,t,i){let a=t==i;return a||C.default.error("mediasdkInstance id ".concat(i," not equal media type ").concat(e," id ").concat(t)),a}function Ce(e,t){I.default.sendMessageToRwg(n.SEND_MESSAGE_TO_RWG,{evt:n.ZOOM_CONNECTION_REMOVE_UDP_EVT,body:{flag:t,type:e}},!1)}function Ae(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.isDestroy&&C.default.log("mediasdkInstance id ".concat(e._id," is Destoryed from ").concat(t)),!e.isDestroy}function Te(e,t){return!(!e||e.userId>>10==t>>10)&&(e.userId&&C.default.error("mediasdk user changed media type ".concat(e.type," pre id ").concat(e.userId," now id ").concat(t)),!0)}async function Re(e,t){I.default.localVideoDecMGR||(I.default.localVideoDecMGR=new p({sessionid:t._id})),ve(R.f.VIDEO_DECODE,I.default.localVideoDecMGR.sessionid,t._id),I.default.videoDecWorkerPath=e.workerJsFileUrl;let i=await oe(e.workerJsFileUrl,e.integrityHelper);if(!Ae(t))return!1;if(I.default.videoDecResponseText=i,await it(0,null,t,e),!Ae(t,"Add_Video_Decode_Thread"))return C.default.error("Add_Video_Decode_Thread Worker Not Controled"),!1;let a=mi(R.f.VIDEO_DECODE);X(a,R.f.VIDEO_DECODE),te(a,R.f.VIDEO_DECODE),ge.subscribeMessage(ge.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS),await async function(e){if(I.default.isPreviewMode.videoDecode)return;if(!I.default.localVideoDecMGR)return;if(await I.default.videoDecInitInstance.wasmSuccessPromise,!Ae(e))return!1;var t=I.default.localVideoDecMGR.map.get(I.default.SPECIAL_ID);let i=I.default.localVideoPara.confId||0;Te(I.default.videoDecodeSession,i)&&(I.default.videoDecodeSession=null);if(t&&!I.default.videoDecodeSession){I.default.videoDecodeSession={type:R.f.VIDEO_DECODE,userId:i};let a={command:1,_id:e._id,websocket_ip_address:I.default.Video_WebSocket_Ip_Address?I.default.Video_WebSocket_Ip_Address+"&mode=5":void 0,confId:I.default.localVideoPara.confId,confKey:"",logon:I.default.localVideoPara.logon,mtu_size:0,meetingid:I.default.localVideoPara.meetingid,meetingnumb:I.default.localVideoPara.meetingnumb,videoencodethreadnumb:1,videodecodethreadnumb:I.default.localVideoPara.videodecodethreadnumb,isFirefox:I.default.localVideoPara.isFirefox,isSupportMultiThread:I.default.localVideoPara.isSupportMultiThread,isSupportVideoTrackReader:I.default.localVideoPara.isSupportVideoTrackReader,isSupportOffscreenCanvas:I.default.localVideoPara.isSupportOffscreenCanvas,isenablehw:I.default.localVideoPara.isenablehw,isEnableVideoDecodeHardWareThread:I.default.localVideoPara.isEnableVideoDecodeHardWareThread,isEnableHardWareThread:I.default.localVideoPara.isEnableHardWareThread,isTeslaMode:I.default.localVideoPara.isTeslaMode,enableMultiDecodeVideoWithoutSAB:!!I.default.enableMultiDecodeVideoWithoutSAB,...I.default.Video_Web_Transport_Ip_Address?{webtransportURL:I.default.Video_Web_Transport_Ip_Address+"&mode=1"}:{},enableAudioBridge:I.default.enableAudioBridge,graphicalname:S.default.graphicName,vendorname:S.default.graphicvendorname,platformType:I.default.localVideoPara.platformType,rendererType:I.default.localVideoPara.rendererType,isWebCodecDecoderOnWhitelist:I.default.localVideoPara.isWebCodecDecoderOnWhitelist,decHAOption:I.default.enableHADecOpt?"no-preference":void 0,is360penablehwenc:I.default.enable360pHWEnc,is360penablehwdec:I.default.enable360pHWDec,webrtcvideo:I.default.localVideoPara.webrtcvideo,isEnableCanvasAlphaChannel:I.default.enableCanvasAlphaChannel,isEnableCanvasCtxOptionsOpt:b.a.isEnableCanvasCtxOptionsOpt()};t.postMessage(a)}}(t)}async function Ie(e,t){if(await Ge(t.audioCtx.sampleRate),I.default.localAudioEncMGR||(I.default.localAudioEncMGR=new f({sessionid:t._id})),ve(R.f.AUDIO_ENCODE,I.default.localAudioEncMGR.sessionid,t._id),I.default.audioEncWorkerPath=e.workerJsFileUrl,I.default.audioEncodeResponse=await oe(e.workerJsFileUrl,e.integrityHelper),!Ae(t))return!1;if(await async function(e,t,i){I.default.isAudioEncodeThreadStart||(I.default.isAudioEncodeThreadStart=!0,await se(i,I.default.localAudioEncMGR,Be,R.f.AUDIO_ENCODE,t))}(0,t,e),!Ae(t,"Add_Audio_Encode_Thread"))return C.default.error("Add_Audio_Encode_Thread Worker Not Controled"),!1;let i=mi(R.f.AUDIO_ENCODE);X(i,R.f.AUDIO_ENCODE),te(i,R.f.AUDIO_ENCODE),ge.subscribeMessage(ge.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS),await async function(e){if(!I.default.localAudioEncMGR)return void C.default.error("jsMediaEngineVariables.localAudioEncMGR is null when call Audio_Encode_Post_message");var t=I.default.localAudioEncMGR.map.get(I.default.SPECIAL_ID);I.default.AEWF&&t.postMessage({command:"RIWM"});if(await I.default.audioEncodeInitInstance.wasmSuccessPromise,!Ae(e))return!1;let i=I.default.localAudioPara.userid||0;Te(I.default.audioEncodeSession,i)&&(I.default.audioEncodeSession=null);if(t&&!I.default.audioEncodeSession){I.default.audioEncodeSession={type:R.f.AUDIO_ENCODE,userId:i};let a=null;I.default.ivObj&&(a=I.default.ivObj[R.f.AUDIO_ENCODE],a=S.default.stringSplitByComma2Buffer(a));let r={command:1,_id:e._id,websocket_ip_address:I.default.Audio_WebSocket_Ip_Address?I.default.Audio_WebSocket_Ip_Address+"&mode=2":void 0,sampleRate:I.default.localAudioPara.sampleRate,userid:I.default.localAudioPara.userid,encode:1,meetingid:I.default.localAudioPara.meetingid,meetingnumb:I.default.localAudioPara.meetingnumb,iv:a,shouldNotChangeSampleRate:S.default.browser.isFirefox||S.default.browser.isSafari,isPreviewMode:I.default.isPreviewMode.audioEncode,audioEncodeChannelsNum:S.default.isBrowserSupportStereo()?2:1,audioDecodeChannelsNum:S.default.isSupportPlayStereo()?2:1,...I.default.Audio_Web_Transport_Ip_Address?{webtransportURL:I.default.Audio_Web_Transport_Ip_Address+"&mode=2"}:{}};if(t.postMessage(r),I.default.sharedBuffer){ae("post audioEnc sab");try{t.postMessage({command:"sharedBuffer",data:I.default.sharedBuffer})}catch(e){t.postMessage({command:"sharedBuffer",data:I.default.sharedBuffer},[I.default.sharedBuffer])}}}}(t)}async function be(e,t){var i;if(await Ge(null===(i=t.audioCtx)||void 0===i?void 0:i.sampleRate),I.default.localAudioDecMGR||(I.default.localAudioDecMGR=new f({sessionid:t._id})),ve(R.f.AUDIO_DECODE,I.default.localAudioDecMGR.sessionid,t._id),I.default.audioDecWorkerPath=e.workerJsFileUrl,I.default.audioDecodeResponse=await oe(e.workerJsFileUrl,e.integrityHelper),"string"==typeof I.default.audioDecodeResponse?T.default.add_monitor("DAFL"+I.default.audioDecodeResponse.length):T.default.add_monitor("DAFF"),!Ae(t))return!1;if(await at(0,null,t,e),!Ae(t,"Add_Audio_Decode_Thread"))return C.default.error("Add_Audio_Decode_Thread Worker Not Controled"),!1;let a=mi(R.f.AUDIO_DECODE);X(a,R.f.AUDIO_DECODE),te(a,R.f.AUDIO_DECODE),ge.subscribeMessage(ge.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS),T.default.add_monitor("ADTS"),await async function(e){if(I.default.isPreviewMode.audioDecode)return void T.default.add_monitor("ZISA");if(!I.default.localAudioDecMGR)return void C.default.warn("jsMediaEngineVariables.localAudioDecMGR is null when call Audio_Decode_Post_message");var t=I.default.localAudioDecMGR.map.get(I.default.SPECIAL_ID);I.default.ADWF&&t.postMessage({command:"RIWM"});if(await I.default.audioDecInitInstance.wasmSuccessPromise,!Ae(e))return!0;let i=I.default.localAudioPara.userid||0;Te(I.default.audioDecodeSession,i)&&(I.default.audioDecodeSession=null);if(t&&!I.default.audioDecodeSession){I.default.audioDecodeSession={type:R.f.AUDIO_DECODE,userId:i};let a={command:1,_id:e._id,websocket_ip_address:I.default.Audio_WebSocket_Ip_Address?I.default.Audio_WebSocket_Ip_Address+"&mode=5":void 0,sampleRate:I.default.localAudioPara.sampleRate,userid:I.default.localAudioPara.userid,logon:I.default.localAudioPara.logon,decode:1,meetingid:I.default.localAudioPara.meetingid,meetingnumb:I.default.localAudioPara.meetingnumb,videodecodethreadnumb:I.default.localAudioPara.videodecodethreadnumb,isSupportMultiThread:I.default.localAudioPara.isSupportMultiThread,decoderInWorklet:I.default.decoderinworklet,audioDecodeChannelsNum:S.default.isSupportPlayStereo()?2:1,shouldNotChangeSampleRate:S.default.browser.isFirefox||S.default.browser.isSafari,...I.default.Audio_Web_Transport_Ip_Address?{webtransportURL:I.default.Audio_Web_Transport_Ip_Address+"&mode=1"}:{}};if(T.default.add_monitor("ADSM"),t.postMessage(a),I.default.sharedBuffer){ae("post audioDec sab");try{t.postMessage({command:"sharedBuffer",data:I.default.sharedBuffer})}catch(e){t.postMessage({command:"sharedBuffer",data:I.default.sharedBuffer},[I.default.sharedBuffer])}}}else T.default.add_monitor("ADSME"+!!t+!!I.default.audioDecodeSession)}(t)}async function Oe(e,t){if(I.default.localSharingDecMGR||(I.default.localSharingDecMGR=new E({sessionid:t._id})),I.default.localMouseDecMGR||(I.default.localMouseDecMGR=new E({sessionid:t._id})),ve(R.f.SHARING_DECODE,I.default.localSharingDecMGR.sessionid,t._id),I.default.sharingDecWorkerPath=e.workerJsFileUrl,I.default.sharingDecodeResponse=await oe(e.workerJsFileUrl,e.integrityHelper),!Ae(t))return!1;if(await async function(e,t){I.default.isSharingDecodeThreadStart||(I.default.isSharingDecodeThreadStart=!0,await se(t,I.default.localSharingDecMGR,Me,R.f.SHARING_DECODE,e))}(t,e),!Ae(t,"Add_Sharing_Decode_Thread"))return C.default.error("Add_Sharing_Decode_Thread Worker Not Controled"),!1;let i=mi(R.f.SHARING_DECODE);X(i,R.f.SHARING_DECODE),te(i,R.f.SHARING_DECODE),await we(t)}async function De(e,t){if(I.default.localSharingEncMGR||(I.default.localSharingEncMGR=new E({sessionid:t._id})),ve(R.f.SHARING_ENCODE,I.default.localSharingEncMGR.sessionid,t._id),I.default.sharingEncWorkerPath=e.workerJsFileUrl,I.default.sharingEncodeResponse=await oe(e.workerJsFileUrl,e.integrityHelper),!Ae(t))return!1;if(await async function(e,t){if(e&&e.isDestroy)return ae("WorkerType:sharingEnc;The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. ");I.default.isSharingEncodeThreadStart||(I.default.isSharingEncodeThreadStart=!0,await se(t,I.default.localSharingEncMGR,Pe,R.f.SHARING_ENCODE,e))}(t,e),!Ae(t,"Add_Sharing_Encode_Thread"))return C.default.error("Add_Sharing_Encode_Thread Worker Not Controled"),!1;te(mi(R.f.SHARING_ENCODE),R.f.SHARING_ENCODE),await ye(t)}async function we(e){if(await I.default.sharingDecInitInstance.wasmSuccessPromise,!Ae(e))return!1;var t=I.default.localSharingDecMGR.Get(I.default.SPECIAL_ID);let i=I.default.localSharingPara.userid||0;Te(I.default.sharingDecodeSession,i)&&(I.default.sharingDecodeSession=null),t&&!I.default.sharingDecodeSession&&(I.default.sharingDecodeSession={type:R.f.SHARING_DECODE,userId:i},t.postMessage({command:1,_id:e._id,websocket_ip_address:I.default.Sharing_WebSocket_Ip_Address,confId:I.default.localSharingPara.userid,confKey:"",logon:I.default.localSharingPara.logon,meetingid:I.default.localSharingPara.meetingid,meetingnumb:I.default.localSharingPara.meetingnumb,multiThreadNum:1,graphicalname:S.default.graphicName,vendorname:S.default.graphicvendorname,rendererType:I.default.localSharingPara.rendererType,isWebCodecDecoderOnWhitelist:I.default.localSharingPara.isWebCodecDecoderOnWhitelist,isEnableCanvasAlphaChannel:I.default.enableCanvasAlphaChannel,isEnableCanvasCtxOptionsOpt:b.a.isEnableCanvasCtxOptionsOpt()}))}async function ye(e){if(await I.default.sharingEncInitInstance.wasmSuccessPromise,!Ae(e))return!1;var t=I.default.localSharingEncMGR.Get(I.default.SPECIAL_ID);let i=I.default.localSharingPara.userid||0;if(Te(I.default.sharingEncodeSession,i)&&(I.default.sharingEncodeSession=null),t&&!I.default.sharingEncodeSession){let a=1;T.default.add_monitor2("STN"+a);let r=null;I.default.ivObj&&(r=I.default.ivObj[R.f.SHARING_ENCODE],r=S.default.stringSplitByComma2Buffer(r)),I.default.sharingEncodeSession={type:R.f.SHARING_ENCODE,userId:i},t.postMessage({command:1,_id:e._id,encode:!0,websocket_ip_address:I.default.Sharing_WebSocket_Ip_Address,confId:I.default.localSharingPara.userid,confKey:"",logon:I.default.localSharingPara.logon,isChromeOrEdge:S.default.browser.isChrome,meetingid:I.default.localSharingPara.meetingid,meetingnumb:I.default.localSharingPara.meetingnumb,multiThreadNum:1,iv:r,uplimit:I.default.uplimit,graphicalname:S.default.graphicName,vendorname:S.default.graphicvendorname,rendererType:I.default.localSharingPara.rendererType,isEnableCanvasAlphaChannel:!1,isEnableCanvasCtxOptionsOpt:b.a.isEnableCanvasCtxOptionsOpt()})}}function Me(e){var t=e.data;try{if(t.status===s.Sharing_Width_And_Height_Info)A.a.publish(n.SHARING_PARAM_INFO_FROM_SOCKET,{body:{width:t.logicWidth,height:t.logicHeight,logicWidth:t.logicWidth,logicHeight:t.logicHeight}}),I.default.Notify_APPUI(n.SHARING_PARA,{body:{width:t.logicWidth,height:t.logicHeight,logicWidth:t.logicWidth,logicHeight:t.logicHeight}});else if(t.status===s.FIRST_SHARING_FRAME_FOR_MOBILE)I.default.Notify_APPUI(n.FIRST_IOS_FRAME,t.ssrc);else if(t.status===s.SHARING_RENDER_MONITOR_LOG)T.default.add_monitor2(t.data);else if(t.status===s.SHARING_FIRST_DECODE_FRAME_RECEIVED)T.default.add_monitor("FSF"),I.default.Notify_APPUI(n.SHARING_FIRST_DECODE_FRAME_RECEIVED_SSRC,{ssrc:t.ssrc});else if(t.status===s.SHARING_DATA_VIDEO_MODE)!function(e,t,i,a,r,n,o,s,d,u,l,c,h){if(!I.default.isSharingPlayWork)return;var f={yuvdata:t,ntptime:i,ssrc:e,width:a,height:r,r_x:n,r_y:o,r_w:s,r_h:d,logic_w:u,logic_h:l,yuv_limited:c,isFromMainSession:h};I.default.mediaSDKHandle.SharingRenderObj.Put_Sharing_Data_From_Queue(f,15)}(t.sharing_ssrc,t.data,t.sharing_timestamp,t.sharing_width,t.sharing_height,t.rendering_x,t.rendering_y,t.rendering_w,t.rendering_h,t.logic_w,t.logic_h,t.yuv_limited,t.isFromMainSession);else if(t.status===s.MOUSE_DATA_VIDEO_MODE)!function(e,t,i,a,r,n,o,s,d,u){if(!I.default.isSharingPlayWork)return;var l={buffer:t,ntptime:i,ssrc:e,width:a,height:r,r_x:n,r_y:o,mLogic_w:s,mLogic_h:d,sync_id:u};I.default.mediaSDKHandle.SharingRenderObj.Put_Mouse_Data_Into_Queue(l)}(t.mouse_ssrc,t.data,t.mouse_timestamp,t.mouse_width,t.mouse_height,t.mouse_x,t.mouse_y,t.mLogic_w,t.mLogic_h,t.sync_id);else if(t.status===s.SHARING_DECODE_MESSAGE)I.default.Notify_APPUI(n.SHARING_DECODE_MAX_SIZE,{ssrc:t.ssrc,size:t.size,fps:t.size});else if(t.status===n.VIDEOSHARE_QOS_DATA){const e={encoding:!1,...t.data};I.default.Notify_APPUI_SAFE(n.VIDEOSHARE_QOS_DATA,e)}else if(t.status===s.Sharing_Dec_WASM_OK)T.default.add_monitor("SDWS"),I.default.isSharingDecodeWASMOK=!0,I.default.sharingDecInitInstance.setWasmSuccess();else if(t.status===s.Sharing_Dec_WASM_FAILED)T.default.add_monitor("SDWF",t.data),le("SDWF"),I.default.sharingDecInitInstance.setWasmSuccess(!1);else if(t.status===s.Sharing_Handle_OK||t.status===s.Video_Sharing_Handle_OK)T.default.add_monitor("SDHS"),I.default.sharingDecInitInstance.setHanderSuccess();else if(t.status===s.Sharing_Handle_FAILED)T.default.add_monitor("SHHF"),I.default.sharingDecInitInstance.setHanderSuccess(!1);else if(t.status===s.Sharing_Dec_WebSocket_OK)T.default.add_monitor("SDSS"),I.default.sharingDecInitInstance.setSocketSuccess();else if(t.status===s.Sharing_Dec_WebSocket_FAILED)T.default.add_monitor("SDSF"),I.default.sharingDecInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.VIDEO_WEBSOCKET_BROKEN,null),I.default.sharingDecInitInstance.setSocketSuccess(!1);else{if(t.status==s.MONITOR_MESSAGE)return void T.default.send_monitor_directly(t.data);if(t.status===s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localSharingDecMGR.map.get(I.default.SPECIAL_ID);Le(t.url,e,R.f.SHARING_DECODE)}else t.status==s.APP_TROUBLESHOOTING_INFO?(I.default.monitorSharingDecodeAPPInfo=t,T.default.send_monitor_directly(I.default.monitorSharingDecodeAPPInfo.data),I.default.monitorSharingDecodeAPPInfo=null):t.status==s.WCL_TROUBLESHOOTING_INFO?T.default.add_monitor("SD"+t.data):t.status==s.MULTIVIEW_WEBGL_CONTEXT_LOST?(T.default.add_monitor("MWGLF"),I.default.Notify_APPUI(n.WEBGL_LOST_IN_MULTI_VIEW,{canvasId:t.canvasId,replaceCanvas:!!t.replaceCanvas})):t.status==s.MULTIVIEW_WEBGL_CONTEXT_RESTORED?T.default.add_monitor("MWGRF"):"WFMO"==t.status?Ue(R.f.SHARING_DECODE):t.status==s.WASM_MEMORY_GRROW_FAILED?I.default.SDMTimes++<2&&(le(R.f.SHARING_DECODE+" Memory Allocate Failed"),T.default.add_monitor("SDMAF"),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL)):t.status==s.RECEIVE_ANNOTATION_PDU?I.default.mediaSDKHandle.onAnnotationPdu(t.data):t.status==s.WEBGL_CONTEXT_CREATE_FAILED?Object(Z.NotifyUIError)(n.WEBGL_CONTEXT_INVALID,t.where):de(R.f.SHARING_DECODE,e)}}catch(e){C.default.error("Error in SharingDec_Listener",e)}}function Pe(e){var t=e.data;try{if(t.status===s.SHARING_GET_IMAGE_DATA_WRONG)T.default.add_monitor("GIDF");else if(t.status===s.Sharing_Dec_WASM_OK)T.default.add_monitor("SEWS"),I.default.isSharingEncodeWASMOK=!0,I.default.sharingEncInitInstance.setWasmSuccess();else if(t.status===s.Sharing_Dec_WASM_FAILED)T.default.add_monitor("SEWF",t.data),le("SEWF"),I.default.sharingEncInitInstance.setWasmSuccess(!1);else if(t.status===s.Sharing_Handle_OK||t.status===s.Video_Sharing_Handle_OK)T.default.add_monitor("SEHS"),I.default.sharingEncInitInstance.setHanderSuccess();else if(t.status===s.Sharing_Handle_FAILED)T.default.add_monitor("SEHF"),I.default.sharingEncInitInstance.setHanderSuccess(!1);else if(t.status===s.Sharing_Dec_WebSocket_OK)T.default.add_monitor("SESS"),I.default.sharingEncInitInstance.setSocketSuccess();else if(t.status===s.Sharing_Dec_WebSocket_FAILED)T.default.add_monitor("SESF",t.data),I.default.sharingEncInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.VIDEO_WEBSOCKET_BROKEN,null),I.default.sharingEncInitInstance.setSocketSuccess(!1);else if(t.status==s.SHARING_CAPTURE_FRAME_COUNT_STATISTIC)T.default.add_monitor2("SCFOK");else if(t.status==s.UNSUPPORTED_SHARING_FORMAT)T.default.add_monitor("SCFF"+t.format);else if(t.status==s.Video_Capture_Tick)I.default.mediaSDKHandle.isSupportVideoTrackReader?(I.default.mediaSDKHandle.canISendNextSharingFrame=!0,I.default.mediaSDKHandle.Process_Sharing()):I.default.mediaSDKHandle.Process_Sharing();else if(t.status==s.WhiteBoard_Video_Capture_Tick)I.default.mediaSDKHandle.Process_Sharing();else if(t.status===s.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT){var i;null===(i=I.default.mediaSDKHandle)||void 0===i||i.onSharingSizeChange(t),I.default.Notify_APPUI(n.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,{width:t.width,height:t.height})}else{if(t.status==s.MONITOR_MESSAGE)return void T.default.send_monitor_directly(t.data);if(t.status==s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localSharingEncMGR.map.get(I.default.SPECIAL_ID);Le(t.url,e)}else if(t.status===n.VIDEOSHARE_QOS_DATA){const e={encoding:!0,...t.data};I.default.Notify_APPUI_SAFE(n.VIDEOSHARE_QOS_DATA,e)}else t.status==s.APP_TROUBLESHOOTING_INFO?T.default.send_monitor_directly(t.data):t.status==s.WCL_TROUBLESHOOTING_INFO?T.default.add_monitor("SE"+t.data):t.status==s.MULTIVIEW_WEBGL_CONTEXT_LOST?I.default.Notify_APPUI(n.WEBGL_LOST_IN_MULTI_VIEW,{canvasId:t.canvasId,replaceCanvas:!!t.replaceCanvas}):t.status==s.WHITEBOARD_WORKER_MESSAGE?I.default.Notify_APPUI(n.WB_MESSAGE,{data:t.data}):"WFMO"==t.status?Ue(R.f.SHARING_ENCODE):t.status==s.SHARING_HEALTH_CHECK_FAILED?(Object(Z.NotifyUIError)(n.MEDIA_HEALTH_CHECK_FAILED,s.SHARING_HEALTH_CHECK_FAILED),C.default.error("Health Check Failed: ".concat(s.SHARING_HEALTH_CHECK_FAILED,", ").concat(t.videoType,",").concat(t.subforme,",").concat(t.hasRTPPackets))):t.status==s.WASM_MEMORY_GRROW_FAILED?I.default.SEMTimes++<2&&(le(R.f.SHARING_ENCODE+" Memory Allocate Failed"),T.default.add_monitor("SEMAF"),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL)):t.status==s.RECEIVE_ANNOTATION_PDU?I.default.mediaSDKHandle.onAnnotationPdu(t.data):t.status==s.WEBGL_CONTEXT_CREATE_FAILED?Object(Z.NotifyUIError)(n.WEBGL_CONTEXT_INVALID,t.where):de(R.f.SHARING_ENCODE,e)}}catch(e){C.default.error("Error in SharingEnc_Listener",e)}}function Ne(e){var t,i=e.data,a=!0;try{if("NewActiveSpeakerFirstframeCallback"===i.status)I.default.Notify_APPUI(n.NEW_ACTIVE_SPEAKER_FIRST_FRAME_CALLBACK,{ssrc:i.ssrc});else if(i.status===s.VIDEO_RESOLUTION_UPDATE)I.default.Notify_APPUI(n.CURRENT_VIDEO_RESOLUTION,{width:i.width,height:i.height});else if(i.status===s.WORKER_MAIN_VIDEO_DECODE_RINGBUFFER_TICK){let e=I.default.mediaSDKHandle.videoDecodeFrameBackSABRingBufferConsumer;e&&e.consumeAll(I.default.mediaSDKHandle.bVideoDecodeFrameBackSABRingBufferConsumeCopyData)}else if(i.status===s.VIDEO_RENDER_MONITOR_LOG)T.default.add_monitor2(i.data);else if(i.status==s.MULTIVIEW_WEBGL_CONTEXT_LOST)T.default.add_monitor("MWGLF"),I.default.Notify_APPUI(n.WEBGL_LOST_IN_MULTI_VIEW,{canvasId:i.canvasId,replaceCanvas:!!i.replaceCanvas});else if(i.status==s.MULTIVIEW_WEBGL_CONTEXT_RESTORED)T.default.add_monitor("MWGRF");else if(i.status==s.WEBGL_CONTEXT_CREATE_FAILED)T.default.add_monitor("MWCGLF"),Object(Z.NotifyUIError)(n.WEBGL_CONTEXT_INVALID,i.where);else if(0===i.status)et(i.video_ssrc,i.data,i.video_timestamp,i.video_width,i.video_height,i.rendering_x,i.rendering_y,i.rendering_w,i.rendering_h,i.rotation,i.yuv_limited);else if(i.status===s.Video_Dec_WASM_OK)T.default.add_monitor("VDWS"),I.default.isVideoDecodeWASMOK=!0,I.default.videoDecInitInstance.setWasmSuccess(),I.default.isPreviewMode.videoDecode&&I.default.Notify_APPUI_SAFE(n.PREVIEW_INIT_VIDEO_DECODE_SUCCESS);else if(i.status===s.DECODE_MESSAGE){let e=i.size;I.default.Notify_APPUI(n.VIDEO_DECODE_MAX_SIZE,{ssrc:i.ssrc,size:e}),T.default.add_monitor("VDMS:"+e)}else if(i.status===s.Video_Dec_WASM_FAILED)T.default.add_monitor("VDWF",i.data),le("VDWF"),I.default.videoDecInitInstance.setWasmSuccess(!1);else if(i.status===s.Video_Dec_Handle_OK)T.default.add_monitor("VDHS"),I.default.videoDecInitInstance.setHanderSuccess();else if(i.status===s.Video_Dec_Handle_FAILED)T.default.add_monitor("VDHF"),I.default.videoDecInitInstance.setHanderSuccess(!1);else if(i.status===s.Video_Dec_WebSocket_OK)I.default.videoDecInitInstance.setSocketSuccess(),T.default.add_monitor("VDSS");else if(i.status===s.Video_Dec_WebSocket_FAILED)T.default.add_monitor("VDSF"),I.default.videoDecInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.VIDEO_WEBSOCKET_BROKEN,null),I.default.videoDecInitInstance.setSocketSuccess(!1);else if(i.status===s.CONNECT_WEBTRANSPORT_OK)T.default.add_monitor("VDWPS");else if(i.status===s.CONNECT_WEBTRANSPORT_CLOSE)T.default.add_monitor("VDWPCLOSE"),Ce(R.h.ZOOM_CONNECTION_VIDEO,R.d.NET_WEBTRANSPORT);else if(i.status===s.CONNECT_WEBSOCKET_CLOSE)T.default.add_monitor("VDWSCLOSE");else if(i.status===s.CURRENT_MEDIA_DATA_TRANSPORT_TYPE)T.default.add_monitor("VDTTP:"+i.type);else if(i.status==s.MONITOR_MESSAGE)T.default.send_monitor_directly(i.data),a=!1;else if(i.status==s.APP_TROUBLESHOOTING_INFO)a=!1,I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:i.data}});else if(i.status==s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localVideoDecMGR.map.get(I.default.SPECIAL_ID);Le(i.url,e,R.f.VIDEO_DECODE),a=!1}else if(i.status==s.WCL_TROUBLESHOOTING_INFO)a=!1,T.default.add_monitor("VD"+i.data);else if(i.status===s.CURRENT_DECODE_VIDEO_QUALITY)I.default.Notify_APPUI_SAFE(n.CURRENT_DECODE_VIDEO_QUALITY,i.data);else if(i.status===s.CURRENT_DECODE_VIDEO_FPS)I.default.Notify_APPUI_SAFE(n.CURRENT_DECODE_VIDEO_FPS,i.data);else if(i.status===n.VIDEO_QOS_DATA){const e={encoding:!1,...i.data};I.default.Notify_APPUI_SAFE(n.VIDEO_QOS_DATA,e)}else"FIRST_VIDEO_FRAME"===i.status?(I.default.Notify_APPUI_SAFE(n.FIRST_VIDEO_FRAME),T.default.add_monitor("FVF")):i.status===s.NETWORK_QUALITY_CHANGE?I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE,{isUplink:i.isUplink,networkLevel:i.networkLevel,bwLevel:i.bwLevel}):"WFMO"==i.status?(a=!1,Ue(R.f.VIDEO_DECODE)):i.status==s.Video_Sharing_Handle_OK?a=!0:i.status==s.WASM_MEMORY_GRROW_FAILED?(a=!1,I.default.VDMTimes++<2&&(le(R.f.VIDEO_DECODE+" Memory Allocate Failed"),T.default.add_monitor("VDMAF"),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL))):i.status==s.WEBCODEC_PERFORMANCE_STATUS?fi(i.data):(i.status==s.GLOBAL_TRACING_LOG&&(a=!1),de(R.f.VIDEO_DECODE,e))}catch(e){C.default.error("Error in VideoDec_Listener",e)}a&&null!==(t=I.default.mediaSDKHandle)&&void 0!==t&&t.isSupportVideoShare&&Me(e)}function Ve(e){var t,i=e.data,a=!0;if(i!==s.WORKER_MAIN_VIDEO_ENCODE_RINGBUFFER_TICK){try{if("VBPredictDone"===i.status)T.default.add_monitor("VBPOK"+i.predictCostTime),I.default.isPreviewMode.videoEncode&&ge.enqueueMessage({name:ge.nameMap.INIT_VIDEO_ENCODE_SUCCESS,messageParams:[n.VB_MODEL_PRELOADING_OK,null],direction:ge.direction.SDK_TO_APP}),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_OK,null);else if("VBPredictAbout3s"===i.status)T.default.add_monitor("VBP3S"),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_3S,null);else if("VBPredictAbout10s"===i.status)T.default.add_monitor("VBP10S"),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_10S,null);else if("vbInitializeFailed"===i.status)C.default.error("VB tensorflow backend initialize failed"),T.default.add_monitor("VBBEF"),I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,re.FAIL);else if(0===i.status);else if(i.status===s.Video_Enc_WASM_OK||i.status===s.Video_Dec_WASM_OK)T.default.add_monitor("VEWS"),I.default.isVideoEncodeWASMOK=!0,I.default.videoInitInstance.setWasmSuccess();else if(i.status===s.Video_Enc_WASM_FAILED)T.default.add_monitor("VEWF",i.data),le("VEWF"),I.default.videoInitInstance.setWasmSuccess(!1);else if(i.status===s.Video_Enc_Handle_OK||s.Video_Dec_Handle_OK===i.status)T.default.add_monitor("VEHS"),I.default.videoInitInstance.setHanderSuccess();else if(i.status===s.Video_Enc_Handle_FAILED||s.Video_Dec_Handle_FAILED===i.status)T.default.add_monitor("VEHF"),I.default.videoInitInstance.setHanderSuccess(!1);else if(s.Video_Dec_WebSocket_OK===i.status)T.default.add_monitor("VESS"),I.default.videoInitInstance.setSocketSuccess();else if(i.status===s.Video_Dec_WebSocket_FAILED)T.default.add_monitor("VESF"),I.default.videoInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.VIDEO_WEBSOCKET_BROKEN,null),I.default.videoInitInstance.setSocketSuccess(!1);else if(i.status===s.CONNECT_WEBTRANSPORT_OK)T.default.add_monitor("VEWPS");else if(i.status===s.CONNECT_WEBTRANSPORT_CLOSE)T.default.add_monitor("VEWPCLOSE");else if(i.status===s.CONNECT_WEBSOCKET_CLOSE)T.default.add_monitor("VEWSCLOSE");else if(i.status===s.CURRENT_MEDIA_DATA_TRANSPORT_TYPE)T.default.add_monitor("VETTP:"+i.type);else if(i.status===s.CURRENT_ENCODED_TYPE)T.default.add_monitor("VEHORS:"+i.type);else if(i.status===s.Video_Capture_Tick)I.default.mediaSDKHandle.Process_Video();else if(i.status===s.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT)I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:i.width,height:i.height});else if(i.status===s.VIDEO_CAPTURER_RESOLUTION_CHANGE)T.default.add_monitor("VCRC"+i.width),I.default.mediaSDKHandle.Change_Video_Capture_Resolution(i.width,i.height);else if(i.status==s.VIDEO_CAPTURE_FRAME_COUNT_STATISTIC)T.default.add_monitor2("VCFOK");else if(i.status==s.UNSUPPORTED_VIDEO_FORMAT)T.default.add_monitor("VCFF","format: ".concat(i.format));else{if(i.status==s.MONITOR_MESSAGE)return a=!1,void T.default.send_monitor_directly(i.data);if(i.status==s.APP_TROUBLESHOOTING_INFO)a=!1,T.default.send_monitor_directly(i.data);else if(i.status===s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localVideoEncMGR.map.get(I.default.SPECIAL_ID);Le(i.url,e,R.f.VIDEO_ENCODE),a=!1}else if(i.status==s.WCL_TROUBLESHOOTING_INFO)a=!1,T.default.add_monitor("VE"+i.data);else if(i.status==s.WASMPTR){let e=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){var r=I.default.localVideoDecMGR.map.get(e);r&&r.postMessage({command:"encodedimagebitmapwasmptr",data:i.data,wasmMemory:i.wasmMemory})}else I.default.isPreviewMode.videoEncode&&ge.enqueueMessage({name:ge.nameMap.INIT_VIDEO_DECODE_SUCCESS,messageParams:[R.f.VIDEO_DECODE,{command:"encodedimagebitmapwasmptr",data:i.data,wasmMemory:i.wasmMemory}],direction:ge.direction.SDK_TO_WORKER})}else if(i.status===n.VIDEO_QOS_DATA){const e={encoding:!0,...i.data};I.default.Notify_APPUI_SAFE(n.VIDEO_QOS_DATA,e)}else if(i.status===n.VIDEOSHARE_QOS_DATA){const e={encoding:!0,...i.data};I.default.Notify_APPUI_SAFE(n.VIDEOSHARE_QOS_DATA,e)}else if(i.status==s.MULTIVIEW_WEBGL_CONTEXT_LOST)T.default.add_monitor("MWGLF"),I.default.Notify_APPUI(n.WEBGL_LOST_IN_MULTI_VIEW,{canvasId:i.canvasId,replaceCanvas:!!i.replaceCanvas});else if(i.status==s.MULTIVIEW_WEBGL_CONTEXT_RESTORED)T.default.add_monitor("MWGRF");else if(i.status===s.Video_Encode_Preview_OK)I.default.mediaSDKHandle.init_Notify_APPUI(!0,R.f.VIDEO_ENCODE);else if(i.status===s.NETWORK_QUALITY_CHANGE)I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE,{isUplink:i.isUplink,networkLevel:i.networkLevel,bwLevel:i.bwLevel});else if("WFMO"==i.status)a=!1,Ue(R.f.VIDEO_ENCODE);else if(i.status==s.VIDEO_HEALTH_CHECK_FAILED)Object(Z.NotifyUIError)(n.MEDIA_HEALTH_CHECK_FAILED,s.VIDEO_HEALTH_CHECK_FAILED),C.default.error("Health Check Failed: ".concat(s.VIDEO_HEALTH_CHECK_FAILED,", ").concat(i.videoType,",").concat(i.subforme,",").concat(i.hasRTPPackets));else if(i.status===n.EXPOSE_VB_FRAME){const{frame:e}=i,{frameSent:t,frameReceived:a}=I.default;I.default.extVBPort&&t===a?(I.default.extVBPort.postMessage({type:n.UNIFIED_VB_FRAME,frame:e}),I.default.frameSent++):T.default.add_monitor("EVBOF-".concat(t-a)),e.close()}else i.status==s.Video_Sharing_Handle_OK?a=!0:i.status==s.WASM_MEMORY_GRROW_FAILED?(a=!1,I.default.VEMTimes++<2&&(le(R.f.VIDEO_ENCODE+" Memory Allocate Failed"),T.default.add_monitor("VEMAF"),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL))):i.status==s.WEBCODEC_PERFORMANCE_STATUS?fi(i.data):i.status==s.WEBGL_CONTEXT_CREATE_FAILED?Object(Z.NotifyUIError)(n.WEBGL_CONTEXT_INVALID,i.where):(i.status==s.GLOBAL_TRACING_LOG&&(a=!1),de(R.f.VIDEO_ENCODE,e))}}catch(e){C.default.error("Error in VideoEnc_Listener",e)}a&&null!==(t=I.default.mediaSDKHandle)&&void 0!==t&&t.isSupportVideoShare&&Pe(e)}}function ke(e,t){let i;try{i=new WebAssembly.Memory({initial:e,maximum:t,shared:!0})}catch(e){C.default.error("E:H Allocate WasmMemory Failed",e),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL)}return i}function Ue(e){let t,i,a=!1,r=S.default.isIphoneOrIpadBrowser()||S.default.isIpadOS()?4096:8192,n=I.default.mediaSDKHandle.is32bitbrowser||!S.default.isChromeVersionHigherThan(90)||S.default.isChromeOS();if(e==R.f.VIDEO_ENCODE){var o;if(i=I.default.localVideoEncMGR.map.get(0),I.default.VE)a=!0,t=I.default.VE;else null!==(o=I.default.mediaSDKHandle)&&void 0!==o&&o.isSupportVideoShare&&(r=32e3),t=ke(1024,r),n&&(I.default.VE=t);I.default.localVideoPara&&(I.default.localVideoPara.VE=t)}else if(e==R.f.VIDEO_DECODE){var s;if(i=I.default.localVideoDecMGR.map.get(0),I.default.VD)a=!0,t=I.default.VD;else null!==(s=I.default.mediaSDKHandle)&&void 0!==s&&s.isSupportVideoShare&&(r=16384),t=ke(1024,r),n&&(I.default.VD=t);I.default.localVideoPara&&(I.default.localVideoPara.VD=t)}else e==R.f.SHARING_ENCODE?(i=I.default.localSharingEncMGR.map.get(0),I.default.SE?(a=!0,t=I.default.SE):(t=ke(1024,r),n&&(I.default.SE=t)),I.default.localVideoPara&&(I.default.localVideoPara.SE=t)):e==R.f.SHARING_DECODE&&(i=I.default.localSharingDecMGR.map.get(0),I.default.SD?(a=!0,t=I.default.SD):(t=ke(1024,r),n&&(I.default.SD=t)),I.default.localVideoPara&&(I.default.localVideoPara.SD=t));if(a){new Uint8Array(t.buffer).fill(0)}i.postMessage({command:"wasmMemory",data:t})}function Le(e,t,i){S.default.downloadAndCompileWebAssembly(e,i,T.default,!S.default.browser.isSafari&&I.default.enableStreamingInstantiate).then(e=>{t.postMessage({command:"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK",data:e})}).catch(e=>{t.postMessage({command:"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"})})}const xe=function(){let e={send:null,recvWorklet:null,recvWorker:null},t=null,i=/(WCL_MCM_AUDIO.*?)(\{\[SPEECHINPUT_R16\]\}),(.*?),(.*?),(.*?),(.*?),(\{\[SEND\]\}.*?)(\{\[DENOISE\]\}.*?)\{\[CAPTURE\]\},(.*?),(\{\[AEC\]\},.*?),(\{\[END\]\})/,a=/(WCL_MCM_AUDIO.*?)(\{\[SPEECHOUTPUT_R16\]\},)(.*?),(\{\[NETWORK\]\}.*?)(\{\[RECEIVE\]\}.*?)\{\[RENDER\]\},(.*?),(.*?)(\{\[END\]\})/;return{push(i){let{log:a,logSource:r}=i;if(a&&this._isLogValid(a)){if(this._checkNeedReportImmediate(a,r))return r===o.AUDIO_WEBRTC_WORKLET?this._sendWebRTCLog(a):this._report(a);r===o.AUDIO_ENCODE_WORKER?e.send=a:r===o.AUDIO_DECODE_WORKER?e.recvWorker=a:e.recvWorklet=a,this._clearTImer(),t=setTimeout(this._checkNeedReport.bind(this),2e3)}},_isLogValid:e=>!!(e.match("WCL_MCM_AUDIO")||e.match("JITTER")||e.match("DEVICE")||e.match("ORIGINAL_SOUND")||e.match("AUDIO_CODEC_EVENT")||e.match("AUDIOEVENT")||e.match("AUDIO_DEVICE_VOLUME")),_checkNeedReportImmediate:(e,t)=>t===o.AUDIO_WEBRTC_WORKLET||!e.match("SPEECHOUTPUT_R16")&&!e.match("SPEECHINPUT_R16"),_checkNeedReport(){const e=this._generateLog();e&&this._report(e)},_sendWebRTCLog(e){const{denoise:t,captureCounter:i}=this._parseSend(e);this._report("WCL_AB,"+t+"{[CAPTURTE]},"+i+",{[END]}")},_generateLog(){if(!e.send&&!e.recvWorker&&!e.recvWorklet)return null;const{inputputPrefix:t,speechInStr:i,speechInOutStr:a,denoiseInStr:r,denoiseOutStr:n,send:o,denoise:s,captureCounter:d,aec:u}=this._parseSend(e.send);let l={};e.recvWorklet&&(l=this._parseRecv(e.recvWorklet));let c=this._parseRecv(e.recvWorker),h=l.outputPrefix||c.outputPrefix,f=l.speechOutStr||c.speechOutStr,p=l.network||c.network,_=l.renderCounter||c.renderCounter,m=l.others||c.others,g=c.receive;this.recordEchoLog(u);const E=t||h,S="{[SPEECH_R16]},".concat(i,",").concat(a,",").concat(f,",").concat(r,",").concat(n,",").concat(u,",").concat(p).concat(g).concat(m,"{[PROCESS]},").concat(d,",").concat(_,",").concat(o).concat(s,"{[END]}");return"".concat(E).concat(S)},recordEchoLog(e){let t=e.match(/-?\d+/g);t&&(parseInt(t[0])||parseInt(t[1]))&&C.default.directReport("echo captured: "+t[0]+": "+t[1])},_parseSend(e){const t=i.exec(e||"")||[];return{inputputPrefix:t[1]||"",speechInStr:t[3]||"",speechInOutStr:t[4]||"",denoiseInStr:t[5]||"",denoiseOutStr:t[6]||"",send:t[7]||"",denoise:t[8]||"",captureCounter:t[9]||"",aec:t[10]||""}},_parseRecv(e){const t=a.exec(e||"")||[];return{outputPrefix:t[1]||"",speechOutStr:t[3]||"",network:t[4]||"",receive:t[5]||"",renderCounter:t[6]||"",others:t[7]||""}},_report(e){e&&I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:e}})},_clearTImer(){clearTimeout(t),t=null},clear(){e={send:null,recv:null},this._clearTImer()}}}();function We(e){var t=e.data;try{if(0===t.status)t.time?I.default.AudioNode&&I.default.AudioNode.postData("data",{ssrc:I.default.CurrentSSRC,data:t.data,time:t.time}):I.default.AudioNode&&I.default.AudioNode.postData("data",{ssrc:I.default.CurrentSSRC,data:t.data,time:null});else if(t.status===s.Audio_Enc_WASM_OK||t.status===s.Audio_Dec_WASM_OK)T.default.add_monitor("ADWS"),I.default.isAudioDecodeWASMOK=!0,I.default.audioDecInitInstance.setWasmSuccess(),I.default.isPreviewMode.audioDecode&&I.default.Notify_APPUI_SAFE(n.PREVIEW_INIT_AUDIO_DECODE_SUCCESS);else if(t.status===s.Audio_Dec_WASM_FAILED)T.default.add_monitor("ADWF",t.data),le("ADWF"),I.default.audioDecInitInstance.setWasmSuccess(!1);else if(t.status===s.Audio_Dec_Handle_OK)T.default.add_monitor("ADHS"),I.default.audioDecInitInstance.setHanderSuccess();else if(t.status===s.Audio_Dec_Handle_FAILED)T.default.add_monitor("ADHF"),I.default.audioDecInitInstance.setHanderSuccess(!1);else if(t.status===s.Audio_Dec_WebSocket_OK)T.default.add_monitor("ADSS"),I.default.audioDecInitInstance.setSocketSuccess();else if(t.status===s.Audio_Dec_WebSocket_FAILED)T.default.add_monitor("ADSF"),I.default.audioDecInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.AUDIO_WEBSOCKET_BROKEN,null),I.default.audioDecInitInstance.setSocketSuccess(!1);else if(t.status===s.CONNECT_WEBTRANSPORT_OK)T.default.add_monitor("ADWPS");else if(t.status===s.CONNECT_WEBTRANSPORT_CLOSE)T.default.add_monitor("ADWPCLOSE"),Ce(R.h.ZOOM_CONNECTION_AUDIO,R.d.NET_WEBTRANSPORT);else if(t.status===s.CONNECT_WEBSOCKET_CLOSE)T.default.add_monitor("ADWSCLOSE");else if(t.status===s.CURRENT_MEDIA_DATA_TRANSPORT_TYPE)T.default.add_monitor("ADTTP:"+t.type);else if(t.status==s.MONITOR_MESSAGE)T.default.send_monitor_directly(t.data);else if(t.status===s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localAudioDecMGR.map.get(I.default.SPECIAL_ID);Le(t.url,e,R.f.AUDIO_DECODE)}else if(t.status==s.WCL_TROUBLESHOOTING_INFO)T.default.add_monitor("AD"+t.data);else if(t.status==s.CURRENT_SSRC_TIME)t.at&&I.default.CurrentSSRCTime!==t.at&&(I.default.CurrentSSRCTime=t.at,I.default.audioPlayTime=Date.now()),t.st&&I.default.mediaSDKHandle.SharingRenderObj&&I.default.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(t.st);else if("multiCurrentTime"==t.status){if(I.default.localVideoDecMGR){var i=I.default.localVideoDecMGR.map.get(I.default.SPECIAL_ID);i&&i.postMessage({command:"audioDecodeTime",data:t.data,status:1})}}else if(t.status==s.AUDIO_ENCODED_DATA);else if(t.status===s.AUDIO_MONITOR_LOG)xe.push({log:t.data,logSource:o.AUDIO_DECODE_WORKER});else if(t.status===n.AUDIO_QOS_DATA){const e={encoding:!1,...t.data};I.default.Notify_APPUI_SAFE(n.AUDIO_QOS_DATA,e)}else t.status===s.NETWORK_QUALITY_CHANGE_AUDIO?I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE_AUDIO,{isUplink:t.isUplink,networkLevel:t.networkLevel,bwLevel:t.bwLevel}):de(R.f.AUDIO_DECODE,e)}catch(e){C.default.error("Error in AudioDecodeListener",e)}}function Be(e){if(I.default.localAudioDecMGR||I.default.isPreviewMode.audioEncode)try{let a=e.data;if(a.status===s.WORKER_MAIN_AUDIO_ENCODE_RINGBUFFER_TICK);else if(0==a.status){var t=I.default.SPECIAL_ID,i=I.default.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"EncodedAudioFrame",data:a.data},[a.data.buffer])}else if(a.status==s.AUDIO_ENCODED_DATA);else if(a.status===s.Audio_Enc_WASM_OK||a.status===s.Audio_Dec_WASM_OK)T.default.add_monitor("AEWS"),I.default.isAudioEncodeWASMOK=!0,I.default.audioEncodeInitInstance.setWasmSuccess();else if(a.status===s.Audio_Enc_WASM_FAILED||a.status===s.Audio_Dec_WASM_FAILED)T.default.add_monitor("AEWF",a.data),le("AEWF"),I.default.audioEncodeInitInstance.setWasmSuccess(!1);else if(a.status===s.Audio_Dec_Handle_OK)T.default.add_monitor("AEHS"),I.default.audioEncodeInitInstance.setHanderSuccess();else if(a.status===s.Audio_Dec_WebSocket_OK)T.default.add_monitor("AESS"),I.default.audioEncodeInitInstance.setSocketSuccess();else if(a.status===s.Audio_Dec_WebSocket_FAILED)T.default.add_monitor("AESF"),I.default.audioEncodeInitInstance.isSocketInitSuccess()&&Object(Z.NotifyUIError)(n.AUDIO_WEBSOCKET_BROKEN,null),I.default.audioEncodeInitInstance.setSocketSuccess(!1);else if(a.status===s.Audio_Dec_Handle_FAILED)T.default.add_monitor("AEHF"),I.default.audioEncodeInitInstance.setHanderSuccess(!1);else if(a.status===s.Audio_Enc_Handle_FAILED)I.default.Notify_APPUI_SAFE(s.Audio_Enc_Handle_FAILED,null);else if(a.status===s.CONNECT_WEBTRANSPORT_OK)T.default.add_monitor("AEWPS");else if(a.status===s.CONNECT_WEBTRANSPORT_CLOSE)T.default.add_monitor("AEWPCLOSE");else if(a.status===s.CONNECT_WEBSOCKET_CLOSE)T.default.add_monitor("AEWSCLOSE");else if(a.status===s.CURRENT_MEDIA_DATA_TRANSPORT_TYPE)T.default.add_monitor("AETTP:"+a.type);else if(a.status===s.AUDIO_DELAY)I.default.indexDbObject.put(a.delay,"delay"),I.default.openIndexFlag&&I.default.indexDbObject.select("delay");else if(a.status===s.DOWNLOAD_WASM_FROM_MAIN_THREAD){let e=I.default.localAudioEncMGR.map.get(I.default.SPECIAL_ID);Le(a.url,e,R.f.AUDIO_ENCODE)}else if(a.status==s.WCL_TROUBLESHOOTING_INFO)T.default.add_monitor("AE"+a.data);else if(a.status==s.AUDIO_CLIPPING);else if(a.status===s.AUDIO_MONITOR_LOG)xe.push({log:a.data,logSource:o.AUDIO_ENCODE_WORKER});else if(a.status===n.AUDIO_QOS_DATA){const e={encoding:!0,...a.data};I.default.Notify_APPUI_SAFE(n.AUDIO_QOS_DATA,e)}else a.status===s.Audio_Encode_Preview_OK?I.default.mediaSDKHandle.init_Notify_APPUI(!0,R.f.AUDIO_ENCODE):a.status===n.SPEAKING_WHEN_MUTE?I.default.Notify_APPUI_SAFE(n.SPEAKING_WHEN_MUTE):a.status===n.AUDIO_LEVEL_INDICATOR?I.default.Notify_APPUI_SAFE(n.AUDIO_LEVEL_INDICATOR,{value:a.value}):a.status===s.NETWORK_QUALITY_CHANGE_AUDIO?I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE_AUDIO,{isUplink:a.isUplink,networkLevel:a.networkLevel,bwLevel:a.bwLevel}):a.status==s.AUDIO_HEALTH_CHECK_FAILED?(Object(Z.NotifyUIError)(n.MEDIA_HEALTH_CHECK_FAILED,s.AUDIO_HEALTH_CHECK_FAILED),C.default.error("Health Check Failed: ".concat(s.AUDIO_HEALTH_CHECK_FAILED,", ").concat(a.videoType,",").concat(a.subforme,",").concat(a.hasRTPPackets))):de(R.f.AUDIO_ENCODE,e)}catch(e){C.default.error("Error in AudioEnc_Listener",e)}}async function Ge(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:48e3;const t=S.default.browser.isSafari&&S.default.getMacSafariMajorVersion()<16;if(!I.default.sharedBuffer&&S.default.isSupportSharedArrayBuffer()&&!t){ae("LP2PSP");let t=1;(S.default.browser.isFirefox||48e3===S.default.getAudioContextConfigure().sampleRate)&&(t=48);let i=640;i=S.default.isChromeVersionHigherThan(74)?960:e/100*2;let a=S.default.isBrowserSupportStereo()?2:1,r=S.default.isSupportPlayStereo()?2:1,n=S.default.isSupportSharingStereo()?2:1;I.default.sharedBuffer={inputState:new SharedArrayBuffer(24),inputBuffer:new SharedArrayBuffer(t*i*4*4*a),sharingInputState:new SharedArrayBuffer(24),sharingInputBuffer:new SharedArrayBuffer(t*i*4*4*n),outputState:new SharedArrayBuffer(24),outputBuffer:new SharedArrayBuffer(t*i*4*4*2),rtpBuffer:new SharedArrayBuffer(120008),echoState:I.default.enableEchoDetection?new SharedArrayBuffer(24):void 0,echoBuffer:I.default.enableEchoDetection?new SharedArrayBuffer(t*i*4*4*r):void 0}}T.default.add_monitor("INITSAB"+!!I.default.sharedBuffer),I.default.decoderinworklet=I.default.decoderinworkletOP&&!!I.default.sharedBuffer}function Fe(e,t){var i;I.default.localSharingPara?Object.assign(I.default.localSharingPara,t):I.default.localSharingPara=t,i=e,I.default.Sharing_WebSocket_Ip_Address=i}function He(e,t){I.default.localAudioPara?Object.assign(I.default.localAudioPara,t):I.default.localAudioPara=t,je(e)}function Ke(e,t){I.default.localVideoPara?Object.assign(I.default.localVideoPara,t):I.default.localVideoPara=t,qe(e)}function je(e){I.default.Audio_WebSocket_Ip_Address=e}function Ye(e){I.default.Audio_Web_Transport_Ip_Address=e}function qe(e){I.default.Video_WebSocket_Ip_Address=e}function Xe(e){I.default.Video_Web_Transport_Ip_Address=e}function Qe(){!function(e){if(e=I.default.SPECIAL_ID,I.default.localAudioEncMGR){var t=I.default.localAudioEncMGR.map.get(e);t&&(t.postMessage({command:2}),I.default.localAudioEncMGR.map.delete(e)),I.default.audioEncodeSession=null}}(I.default.SPECIAL_ID),function(e){if(e=I.default.SPECIAL_ID,I.default.localAudioDecMGR){var t=I.default.localAudioDecMGR.map.get(I.default.SPECIAL_ID);t&&(t.postMessage({command:2}),I.default.localAudioDecMGR.map.delete(e)),I.default.audioDecodeSession=null}}(I.default.SPECIAL_ID),I.default.localAudioDecMGR=null,I.default.localAudioEncMGR=null}function ze(){!function(e){if(e=I.default.SPECIAL_ID,I.default.localVideoDecMGR){var t=I.default.localVideoDecMGR.map.get(e);t&&(t.postMessage({command:2}),I.default.localVideoDecMGR.map.delete(e)),I.default.videoDecodeSession=null}}(I.default.SPECIAL_ID),I.default.localVideoDecMGR=null,I.default.localVideoEncMGR=null}function Je(){!function(){var e=I.default.SPECIAL_ID;if(I.default.localSharingDecMGR){var t=I.default.localSharingDecMGR.Get(e);t&&(t.postMessage({command:2}),I.default.localSharingDecMGR=null),I.default.isSharingDecodeThreadStart=!1}}()}function Ze(e,t,i,a,r){if(I.default.localVideoEncMGR){var n=I.default.localVideoEncMGR.map.get(e);if(n){var o={command:"encodeVideoFrame",data:t,stride:i,x:a,y:r};n.postMessage(o,[o.data.buffer])}}}function $e(e,t,i,a,r,n){var o,s;if(s=null!==(o=I.default.mediaSDKHandle)&&void 0!==o&&o.isSupportVideoShare?I.default.localVideoEncMGR.map.get(e):I.default.localSharingEncMGR.map.get(e)){let e;t?(e={command:"encodeSharingFrame",data:t,width:r,height:n},s.postMessage(e,[e.data.buffer])):(e={command:"encodeSharingFrame"},s.postMessage(e))}}function et(e,t,i,a,r,n,o,s,d,u,l){if(I.default.isVideoPlayWork){var c={yuvdata:t,ntptime:i,ssrc:e,width:a,height:r,r_x:n,r_y:o,r_w:s,r_h:d,rotation:u,yuv_limited:l};c.ssrc=c.ssrc>>10<<10,I.default.mediaSDKHandle.VideoRenderObj.Put_Video_Data_Queue(c,15)}}function tt(){return I.default.localSharingDecMGR?I.default.localSharingDecMGR.SharingQueueMGR.ClearQueue():I.default.localMouseDecMGR?I.default.localMouseDecMGR.SharingQueueMGR.ClearQueue():0}async function it(e,t,i,a){I.default.isVideoDecodeThreadStart||(I.default.isVideoDecodeThreadStart=!0,await se(a,I.default.localVideoDecMGR,Ne,R.f.VIDEO_DECODE,i))}async function at(e,t,i,a){if(T.default.add_monitor("AADT"),i&&i.isDestroy)return T.default.add_monitor("ZID"),ae("WorkerType:audioDec;The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. ");I.default.isAudioDecodeThreadStart||(I.default.isAudioDecodeThreadStart=!0,await se(a,I.default.localAudioDecMGR,We,R.f.AUDIO_DECODE,i))}function rt(e){if(e>>=10,I.default.localAudioDecMGR){var t=I.default.localAudioDecMGR.GetSSRCTimeMap(e);return null===t?0:t}}function nt(e){return{currentSSRCTime:I.default.CurrentSSRCTime,audioPlayTime:I.default.audioPlayTime}}function ot(e,t){var i=I.default.SPECIAL_ID,a=I.default.localVideoDecMGR.map.get(i);a.postMessage({command:"failover",websocket_ip_address:t}),(a=I.default.localAudioDecMGR.map.get(i)).postMessage({command:"failover",websocket_ip_address:e})}function st(e){for(var t,i=I.default.SPECIAL_ID,a=I.default.audio_pcm_queue.dequeue();a;)a=I.default.audio_pcm_queue.dequeue();I.default.localAudioEncMGR&&(t=I.default.localAudioEncMGR.map.get(i))&&I.default.audioEncodeSession&&t.postMessage({command:"modifySampleRate",sampleRate:e}),I.default.localAudioDecMGR&&(t=I.default.localAudioDecMGR.map.get(i))&&I.default.audioDecodeSession&&t.postMessage({command:"modifySampleRate",sampleRate:e})}function dt(e,t,i){var a;(e=I.default.SPECIAL_ID,I.default.localAudioDecMGR)&&((a=I.default.localAudioDecMGR.map.get(e))&&a.postMessage({command:"mute",bOn:t,fakeLeave:i}));I.default.localAudioEncMGR&&((a=I.default.localAudioEncMGR.map.get(e))&&a.postMessage({command:"mute",bOn:t,fakeLeave:i}))}function ut(e,t){var i;(e=I.default.SPECIAL_ID,I.default.localAudioDecMGR)&&((i=I.default.localAudioDecMGR.map.get(e))&&i.postMessage({command:"AecFlag",flag:t}));I.default.localAudioEncMGR&&((i=I.default.localAudioEncMGR.map.get(e))&&i.postMessage({command:"AecFlag",flag:t}))}function lt(e,t,i,a){var r,n=I.default.SPECIAL_ID;I.default.localAudioDecMGR&&((r=I.default.localAudioDecMGR.map.get(n))&&r.postMessage({command:i},[e.port2]));I.default.localAudioEncMGR&&((r=I.default.localAudioEncMGR.map.get(n))&&r.postMessage({command:a},[t.port1]))}function ct(e,t){var i=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){let t=I.default.localVideoDecMGR.map.get(i);t&&t.postMessage({command:"decodeVideoPort"},[e.port1])}if(I.default.localVideoEncMGR){let e=I.default.localVideoEncMGR.map.get(i);e&&e.postMessage({command:"encodeVideoPort"},[t.port2])}}function ht(e,t){var i=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){let t=I.default.localVideoDecMGR.map.get(i);t&&t.postMessage({command:"vsport"},[e.port1])}if(I.default.localSharingDecMGR){let e=I.default.localSharingDecMGR.map.get(i);e&&e.postMessage({command:"vsport"},[t.port2])}}function ft(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioDecMGR){var i=I.default.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"decodeAudioPort2"},[e.port2])}}function pt(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioEncMGR){var i=I.default.localAudioEncMGR.map.get(t);i&&i.postMessage({command:"shareAudioDecodeAudioPort2"},[e.port2])}}function _t(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){var i=I.default.localVideoDecMGR.map.get(t);i&&i.postMessage({command:"decodeVideoPortWithAudio",port:e.port1},[e.port1])}}function mt(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var i=I.default.localVideoEncMGR.map.get(t);i&&i.postMessage(e)}}function gt(e,t){Et({command:e,data:t},[t])}function Et(e,t){let i=I.default.SPECIAL_ID;if(!I.default.localVideoEncMGR)return!1;let a=I.default.localVideoEncMGR.map.get(i);return!!a&&(a.postMessage(e,t),!0)}function St(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){var i=I.default.localVideoDecMGR.map.get(t);i&&i.postMessage(e)}}function vt(e,t){var i=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var a=I.default.localVideoEncMGR.map.get(i);a&&a.postMessage({command:e,data:t},[t])}}function Ct(e,t){var i=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR){var a=I.default.localSharingEncMGR.map.get(i);a&&a.postMessage({command:e,data:t},[t])}}function At(e){if(!I.default.localVideoDecMGR)return;var t=I.default.localVideoDecMGR.map.get(I.default.SPECIAL_ID);t&&t.postMessage(e)}function Tt(e){var t=I.default.SPECIAL_ID;if(I.default.localSharingDecMGR){var i=I.default.localSharingDecMGR.map.get(t);i&&i.postMessage(e)}}function Rt(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioDecMGR){var i=I.default.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"updateCurrentSSRC",SSRC:e})}}function It(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioEncMGR){var i=I.default.localAudioEncMGR.map.get(t);i&&i.postMessage(e)}}function bt(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioDecMGR){var i=I.default.localAudioDecMGR.map.get(t);i&&i.postMessage(e)}}function Ot(e){var t={command:"interpretation_enable",enable:e};It(t),I.default.decoderinworklet?I.default.workletWasmInitSuccess&&I.default.AudioNode?I.default.AudioNode.postCMD("interpretation_enable",t):I.default.workletMessageQueue.enqueue(t):bt(t)}function Dt(e){It({command:"cc_set_lang",lang:e})}function wt(e){var t={command:"interpretation_set_lang",lang:e};It(t),I.default.decoderinworklet?I.default.workletWasmInitSuccess&&I.default.AudioNode?I.default.AudioNode.postCMD("interpretation_set_lang",t):I.default.workletMessageQueue.enqueue(t):bt(t)}function yt(e){var t={command:"interpretation_mute_origin",mute:e};It(t),I.default.decoderinworklet?I.default.workletWasmInitSuccess&&I.default.AudioNode?I.default.AudioNode.postCMD("interpretation_mute_origin",t):I.default.workletMessageQueue.enqueue(t):bt(t)}function Mt(e){var t={command:"interpretation_set_interpreter",interpreterList:e};It(t),I.default.decoderinworklet?I.default.workletWasmInitSuccess&&I.default.AudioNode?I.default.AudioNode.postCMD("interpretation_set_interpreter",t):I.default.workletMessageQueue.enqueue(t):bt(t)}function Pt(){var e=I.default.SPECIAL_ID;if(I.default.localAudioEncMGR){var t=I.default.localAudioEncMGR.map.get(e);t&&t.postMessage({command:"resetAec"})}}function Nt(e){try{if(T.default&&e){let t=["ERR:",e.message,"f"].join(""),i=T.default.checkIsNecessaryExceptionLogAndReturnRepeatTimes(t);i.isNecessary?(ae("error repeat ".concat(i.repeatNumber),t),T.default.add_monitor(t+"(repeat:".concat(i.repeatNumber,")"))):ae("error but ignore",e.message)}}catch(e){ae("_listenWindowErrorEvent error",e)}}function Vt(){try{var e,t;T.default.add_monitor(["BSAGT:",navigator.userAgent].join("")),T.default.add_monitor("BSLITEND:"+(S.default.isLittleEndian()?1:0)),window.navigator.hardwareConcurrency&&T.default.add_monitor("OSCPUS:"+window.navigator.hardwareConcurrency);let i=S.default.getOSInfo();T.default.add_monitor("deviceType:".concat(i.osType,"|os_name:").concat(i.os,"|os_version:").concat(i.osVersion)),T.default.add_monitor("browser_name:".concat(null==i||null===(e=i.browser)||void 0===e?void 0:e.name,"|browser_version:").concat(null==i||null===(t=i.browser)||void 0===t?void 0:t.version)),Object(S.checkBrowserVersion)()}catch(e){console.error("<<<<",e)}}function kt(e){T.default.init(),window.addEventListener("error",Nt),I.default.monitorIntervalHandle=setInterval((function(){if(!T.default.startSendLog)return;let e=T.default.get_monitor();e&&T.default.send_monitor_directly(e)}),1e4)}function Ut(e){T.default.add_monitor2(e)}function Lt(e){window.removeEventListener("error",Nt),clearInterval(I.default.monitorIntervalHandle),T.default.send_instant_monitor()}function xt(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var i=I.default.localVideoEncMGR.map.get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function Wt(e){var t=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR){var i=I.default.localSharingEncMGR.Get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function Bt(e){if(!I.default.localVideoEncMGR)return;var t=I.default.localVideoEncMGR.map.get(I.default.SPECIAL_ID);t&&t.postMessage(e)}function Gt(e){if(!I.default.localSharingEncMGR)return;var t=I.default.localSharingEncMGR.map.get(I.default.SPECIAL_ID);t&&t.postMessage(e)}function Ft(e){if(!I.default.localVideoEncMGR)return;var t=I.default.localVideoEncMGR.map.get(I.default.SPECIAL_ID);t&&t.postMessage(e)}function Ht(e){if(!I.default.localSharingEncMGR)return;var t=I.default.localSharingEncMGR.map.get(I.default.SPECIAL_ID);t&&t.postMessage(e)}function Kt(e){var t=I.default.SPECIAL_ID;if(I.default.localAudioEncMGR){var i=I.default.localAudioEncMGR.map.get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function jt(){let e=I.default.SPECIAL_ID;[I.default.localAudioDecMGR,I.default.localAudioEncMGR,I.default.localVideoDecMGR,I.default.localVideoEncMGR,I.default.localSharingDecMGR,I.default.localSharingEncMGR].forEach(t=>{if(t&&t.map.get(e)){t.map.get(e).postMessage({command:"SOCKET_RECONNECT",disable:!0})}})}function Yt(e){e.forEach(e=>{e&&(e.setHanderSuccess(!1),e.setSocketSuccess(!1),e.setWasmSuccess(!1))})}function qt(e,t){let i=I.default.SPECIAL_ID;e&&e.forEach(e=>{if(e&&e.map.get(i)){e.map.get(i).onmessage=null}}),t&&t.forEach(e=>{if(e&&e.map.get(i)){e.map.get(i).onmessage=null}})}async function Xt(e,t,i){let a=I.default.SPECIAL_ID,r=t;r.forEach(t=>{if(t&&t.map.get(a)){t.map.get(a).postMessage({command:2,_id:e._id})}}),r=i,r.forEach(t=>{if(t&&t.map.get(a)){t.map.get(a).postMessage({command:2,_id:e._id})}}),await S.default.sleep(1e3)}async function Qt(e,t){let i=I.default.SPECIAL_ID,a=e;a.forEach(e=>{if(e&&e.map.get(i)){e.map.get(i).terminate()}}),a=t,await S.default.is32bitChrome()||a.forEach(e=>{if(e&&e.map.get(i)){e.map.get(i).terminate()}})}function zt(e){let t;switch(e){case R.f.AUDIO_DECODE:t=I.default.localAudioDecMGR;break;case R.f.AUDIO_ENCODE:t=I.default.localAudioEncMGR;break;case R.f.VIDEO_DECODE:t=I.default.localVideoDecMGR;break;case R.f.VIDEO_ENCODE:t=I.default.localVideoEncMGR;break;case R.f.SHARING_DECODE:t=I.default.localSharingDecMGR;break;case R.f.SHARING_ENCODE:t=I.default.localSharingEncMGR}let i=I.default.SPECIAL_ID;return t&&t.map.get(i)?t.map.get(i):null}async function Jt(e){switch(e){case R.f.VIDEO_ENCODE:await I.default.videoInitInstance.initSuccessPromise;break;case R.f.VIDEO_DECODE:await I.default.videoDecInitInstance.initSuccessPromise;break;case R.f.AUDIO_ENCODE:await I.default.audioEncodeInitInstance.initSuccessPromise;break;case R.f.AUDIO_DECODE:await I.default.audioDecInitInstance.initSuccessPromise;break;case R.f.SHARING_ENCODE:await I.default.sharingEncInitInstance.initSuccessPromise;break;case R.f.SHARING_DECODE:await I.default.sharingDecInitInstance.initSuccessPromise;break;default:C.default.error("No matched worker type: ".concat(e))}}async function Zt(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];r&&await Jt(e);let n=zt(e);if(!n){if(!r)return ae("worker handle not ready, drop!",e,t,i),!1;if(ae.warn("worker handle not ready, waiting!",e,t,i),n=zt(e),!n)return}return a?n.postMessage({command:i,data:t},[t]):n.postMessage({command:i,data:t}),!0}function $t(){return null!==zt(R.f.VIDEO_ENCODE)}function ei(e,t,i){var a=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var r=I.default.localVideoEncMGR.map.get(a);r&&(e?r.postMessage({command:t,canvas:e,rendercanvasID:i},[e]):r.postMessage({command:t,canvas:e,rendercanvasID:i}))}}function ti(e){let t;return t=new e({storeOptions:{nameSpaceId:"vbFile"}}),new Promise((e,i)=>{t.on("ready",()=>{e(t)})})}function ii(e){let t=new Uint8Array(e,0,12),i=new Uint8Array(e,12,32);window.crypto.subtle.importKey("raw",i,"AES-GCM",!0,["encrypt","decrypt"]).then(a=>{let r=t.length+i.length,n=new Uint32Array(e.slice(r,r+4))[0];r+=4;let o=e.slice(r,r+n);r+=n,n=new Uint32Array(e.slice(r,r+4))[0],r+=4;let s=new Uint8Array(e,r,n);r+=n,n=new Uint32Array(e.slice(r,r+4))[0],r+=4;let d=e.slice(r,r+n);r+=n,n=new Uint32Array(e.slice(r,r+4))[0],r+=4;let u=new Uint8Array(e,r,n);I.default.basebin=o,I.default.afnbin=d,ai(u,a,t).then(e=>{I.default.afnjson=(new TextDecoder).decode(e);var t=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var i=I.default.localVideoEncMGR.map.get(t);i&&I.default.afnbin&&I.default.afnjson&&i.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:I.default.afnbin,json:I.default.afnjson},index:1})}}),ai(s,a,t).then(e=>{I.default.basejson=(new TextDecoder).decode(e);var t=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var i=I.default.localVideoEncMGR.map.get(t);i&&I.default.basebin&&I.default.basejson&&i.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:I.default.basebin,json:I.default.basejson},index:2})}})})}function ai(e,t,i){return window.crypto.subtle.decrypt({name:"AES-GCM",iv:i},t,e)}function ri(e){for(let a=0;a{if(!e.ok)throw new Error("network issue");return e.arrayBuffer()}).then(t=>{T.default.add_monitor("VDBIN"),I.default.vbarraybuffer=t;try{e[a].path.indexOf("dual")>=0&&ii(t)}catch(e){C.default.error("An error occurred when decrypting the virtual background file",e),T.default.add_monitor("VBDECRYPTF"),I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,re.FAIL)}}).catch(e=>{C.default.error("An error occurred when trying to obtain the virtual background file",e),T.default.add_monitor("VBFF"),I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,re.FAIL)})}function ni(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var i=I.default.localVideoEncMGR.map.get(t);i&&(e?i.postMessage({command:"imagebitmap",data:e},[e]):i.postMessage({command:"imagebitmap"}))}}function oi(e,t){var i=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var a=I.default.localVideoEncMGR.map.get(i);a&&(e?a.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e},[e]):a.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e}))}}function si(e,t){var i=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var a=I.default.localVideoEncMGR.map.get(i);a&&(e?a.postMessage({command:"vbbgimagebitmap",imagename:t,data:e},[e]):a.postMessage({command:"vbbgimagebitmap",imagename:t,data:e}))}}function di(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var n=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var o=I.default.localVideoEncMGR.map.get(n);o&&(e?o.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e,maskCoordinate:i,width:a,height:r},[e]):o.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e,maskCoordinate:i,width:a,height:r}))}}function ui(e){var t=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){var i=I.default.localVideoDecMGR.map.get(t);i&&i.postMessage(e)}}function li(){try{return S.default.browser.isChrome&&-1!==["85","86"].indexOf(S.default.getBrowserVersion())}catch(e){return ae(e),!1}}const ci={[R.f.VIDEO_ENCODE]:{success:n.INIT_SUCCESS_VIDEO,failed:n.INIT_FAILED_VIDEO,callbackDataValue:R.c.encode},[R.f.VIDEO_DECODE]:{success:n.INIT_SUCCESS_VIDEO,failed:n.INIT_FAILED_VIDEO,callbackDataValue:R.c.decode},[R.f.AUDIO_ENCODE]:{success:n.INIT_SUCCESS_AUDIO,failed:n.INIT_FAILED_AUDIO,callbackDataValue:R.c.encode},[R.f.AUDIO_DECODE]:{success:n.INIT_SUCCESS_AUDIO,failed:n.INIT_FAILED_AUDIO,callbackDataValue:R.c.decode},[R.f.SHARING_DECODE]:{success:n.INIT_SUCCESS_SHARING,failed:n.INIT_FAILED_SHARING,callbackDataValue:R.c.decode},[R.f.SHARING_ENCODE]:{success:n.INIT_SUCCESS_SHARING,failed:n.INIT_FAILED_SHARING,callbackDataValue:R.c.encode}};function hi(e,t){let i=[R.f.AUDIO_ENCODE,R.f.AUDIO_DECODE,R.f.VIDEO_ENCODE,R.f.VIDEO_DECODE];e.isSupportVideoShare||i.push(R.f.SHARING_ENCODE,R.f.SHARING_DECODE),i.forEach(async e=>{Zt(e,t,130,!1,!0)})}function fi(e){var t,i,a;let r=S.default.getOSInfo();e.cpu=(null===(t=navigator)||void 0===t?void 0:t.hardwareConcurrency)||1,e.deviceType=r.osType,e.osType=r.os,C.default.directReport(JSON.stringify(e));let n=null===I.default||void 0===I.default||null===(i=I.default.instance)||void 0===i?void 0:i.persistenceInfo;if(!n)return;let o=e.encode?n.getVideoEncoderInfo():n.getVideoDecoderInfo(),s={};s.osVersion=r.osVersion,s.browserVersion=null===(a=r.browser)||void 0===a?void 0:a.version,s.sdkVersion=9305,o.updateInfo(e,s)}function pi(e,t){var i;const a=[[],[[R.f.AUDIO_ENCODE],[R.f.AUDIO_DECODE],[R.f.AUDIO_ENCODE,R.f.AUDIO_DECODE]],[[R.f.VIDEO_ENCODE],[R.f.VIDEO_DECODE],[R.f.VIDEO_ENCODE,R.f.VIDEO_DECODE]],[],[[R.f.SHARING_ENCODE],[R.f.SHARING_DECODE],[R.f.SHARING_ENCODE,R.f.SHARING_DECODE]]];let r=null===(i=t.body)||void 0===i?void 0:i.data;if(!r)return;let n=r.type,o=r.mode;e.isSupportVideoShare&&4==n&&(n=2);let s=a[n][o];s&&0!=s.length&&s.forEach(e=>{Zt(e,r,133,!1,!0)})}function _i(e,t){let i=null,a=null;return{create:function(){return i||(i=new Promise(async(i,r)=>{try{let r=S.default.isSupportVideoShareSend()&&await S.default.isSDKSupportMultiThread()&&await S.default.isSDKSupportSIMD();const n=await fetch(e),o=await n.arrayBuffer(),s=window.URL.createObjectURL(new Blob([o]));let d=new Worker(s,t?{name:t}:void 0);a=d,d.onmessage=e=>{d.onmessage=null,e.data[0]||(a.terminate(),a=null),i(a)},d.postMessage({command:136,data:r})}catch(e){i(null)}}),i)},destroy:function(){if(!a&&!i)return;let e=i;i=null,a=null,e&&e.then(e=>{null==e||e.terminate()})}}}function mi(e){return zt(e)}let gi=null;if("function"==typeof AudioWorklet){class e extends AudioWorkletNode{constructor(e,t,i){super(e,t,i),this.port.onmessage=this.handleMessage.bind(this)}handleMessage(e){var t=e.data;switch(t.status){case"delay":if(I.default.localAudioDecMGR)(i=I.default.localAudioDecMGR.map.get(0))&&i.postMessage({command:"delay"});break;case s.CURRENT_SSRC_TIME:t.at&&(I.default.CurrentSSRCTime=t.at,I.default.audioPlayTime=Date.now()),t.st&&I.default.mediaSDKHandle.SharingRenderObj&&I.default.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(t.st);break;case s.AUDIO_MONITOR_LOG:xe.push({log:t.data,logSource:o.AUDIO_WASM_WORKLET});break;case"MONITOR_LOG":T.default.add_monitor(t.data);break;case"UPDATE_MULTIVIEW_TIME":var i;if(I.default.localVideoDecMGR)(i=I.default.localVideoDecMGR.map.get(0))&&i.postMessage({command:"audioDecodeTime",data:t.data,status:1});break;case"WASM_INIT_SUCCESS":for(T.default.add_monitor("DIWL"+t.data.audio_handle),I.default.workletWasmInitSuccess=!0;!I.default.workletMessageQueue.isEmpty();){let e=I.default.workletMessageQueue.dequeue();this.postCMD(e.command,e)}break;case"workletMessage":"error"===t.data.level&&C.default.error(t.data.message,t.data.data);break;case"WASM_INIT_FAILED":T.default.add_monitor("AWMAF"),Object(Z.NotifyUIError)(n.WASM_MEMORY_FAIL);break;case"PROCESS_EXCEPTIONS":Object(Z.NotifyUIError)(n.WORKLET_PROCESS_EXCEPTIONS,t.data)}}postData(e,t){this.port.postMessage({status:e,data:t},[t.data.buffer])}postCMD(e,t){this.port.postMessage({status:e,data:t})}}gi=e}var Ei=gi,Si=a(31),vi=a.n(Si),Ci=a(49),Ai=a(51),Ti=a.n(Ai),Ri=a(26),Ii=a.n(Ri),bi=a(32),Oi=a.n(bi);const Di=Object(v.a)("sdk.rtcUtil");class wi{constructor(e,t){this.rtcPeerConnection=null,this.dataChannel=null,this.id=Date.now()<<3|t,this.dataChannelLabel=null,this.datachannelcloselistener=null,this.datachannelopenlistener=null,this.rtcPeerConnectionCreatedListener=null,this.reconnectCount=0,this.reconnectMax=10,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen=0,this.connectionID=null,this.pubSubTokenList=[],this.isForceClosed=!1,this.reconnectRTCPeerConnectionThrottle=Oi()(()=>{this.reconnectRTCPeerConnection()},2e3),this.timeoutThenCloseInterval=null,this.userid=null,this.connectionType=t,this.dataChannelStatus="",this.delaycloseTimeout=0,this.delaycloseid_=0,this._netWorker=null,this.dataTransportMgr=e,this.dataChannelController=null}setUserid(e){this.userid=e}isSupportDataChannel(){return!!window.RTCDataChannel}iceClosed(e){this.isForceClosed||(Di("rtcPeerConnection.iceClosed",e),this._close(!0),this._clear())}async initConnection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ZoomWebclientVideoDataChannel";if(T.default.add_monitor("DCCONN"),!this.isSupportDataChannel())return void T.default.add_monitor("DCUNSUPPORT");this.dataChannelLabel=t,this.connectionID=e,this.rtcPeerConnection=new RTCPeerConnection({iceCandidatePoolSize:1}),this.rtcPeerConnection.addEventListener("iceconnectionstatechange",e=>{if(this.isForceClosed)return;let t=this.rtcPeerConnection;if("failed"!==t.iceConnectionState&&"closed"!==t.iceConnectionState||(Di("".concat(this.dataChannelLabel," iceconnectionstatechange"),t.iceConnectionState),T.default.add_monitor("ICECONNSTATECHANGE:"+this.dataChannelLabel),this.iceClosed(),this.delaycloseid_&&(clearTimeout(this.delaycloseid_),this.delaycloseid_=0)),"disconnected"===t.iceConnectionState&&!this.delaycloseid_){let e=this;this.delaycloseid_=setTimeout(()=>{e.delaycloseid_=0,e.iceClosed()},e.delaycloseTimeout)}"connected"===t.iceConnectionState&&this.delaycloseid_&&(clearTimeout(this.delaycloseid_),this.delaycloseid_=0)});let i=null;this._netWorker&&(i=await this._netWorker.create(),te(i,"net")),this._createDataChannel(i),await this.rtcPeerConnection.createOffer().then(async t=>(Di("original offer",JSON.stringify(t)),t.sdp=t.sdp.replace(/a=ice-ufrag:.+/g,"a=ice-ufrag:".concat(e)),Di("modified offer",t),this.rtcPeerConnection.setLocalDescription(t))).then(()=>{this.rtcPeerConnectionCreatedListener.call(null,this.rtcPeerConnection)})}_close(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];T.default.add_monitor("RTCPeerConnUtil.CLOSE");try{this._closeDataChannel(),this.rtcPeerConnection&&this.rtcPeerConnection.close()}catch(e){C.default.error("Error when closing RTCPeerConnection",e)}finally{this.dataChannel=null,this.rtcPeerConnection=null,e&&this.datachannelcloselistener&&this.datachannelcloselistener(null),this.sendDataChannelStatusMonitorLog(),this.reconnectRTCPeerConnectionThrottle()}}forceClose(){T.default.add_monitor("DCFORCECLOSE:"+this.dataChannelLabel),Di("forceClose : "+this.dataChannelLabel),this.isForceClosed=!0,this._close(!0),this._clear()}resetDataChannelTransfered(e){this._netWorker=e,this._close(!0),this._clear()}isDestroyed(){return this.isForceClosed}_clear(){this.timeoutThenCloseInterval&&clearInterval(this.timeoutThenCloseInterval),this.timeoutThenCloseInterval=0,this.datachannelcloselistener=null,this.datachannelopenlistener=null,this.pubSubTokenList.forEach(e=>{A.a.unsubscribe(e)}),this.pubSubTokenList=[]}onConnectionCreated(e){this.rtcPeerConnectionCreatedListener=e}reconnectRTCPeerConnection(){this.isForceClosed||this.reconnectCount{this.initConnection(this.connectionID,this.dataChannelLabel)},1e3*Math.pow(2,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen)))}oneSingleLineLog(e){setTimeout(()=>{T.default.send_instant_monitor(),T.default.add_monitor(e),T.default.send_instant_monitor()},0)}checkEmptyUserIdAndResendMonitor(e){e&&this.userid!=e&&(this.setUserid(e),this.sendDataChannelStatusMonitorLog())}sendDataChannelStatusMonitorLog(){this.userid&&("OPEN"===this.dataChannelStatus?(T.default.add_monitor("DCOPEN:"+this.dataChannelLabel),this.oneSingleLineLog("".concat(o.DATACHANNEL_MONITOR_SEPARATOR,",").concat(this.userid,",").concat(this.connectionType,",DCOPEN,").concat(o.DATACHANNEL_MONITOR_SEPARATOR))):"CLOSED"===this.dataChannelStatus&&(T.default.add_monitor("DCCLOSE:"+this.dataChannelLabel),this.oneSingleLineLog("".concat(o.DATACHANNEL_MONITOR_SEPARATOR,",").concat(this.userid,",").concat(this.connectionType,",DCCLOSE,").concat(o.DATACHANNEL_MONITOR_SEPARATOR))))}sendDataChannelController(e){this.dataChannelController=e}_closeDataChannel(){if(this.dataChannel)try{this.dataChannelStatus="CLOSED",this.dataChannel.close()}catch(e){C.default.error("Error when trying to close existing RTCDataChannel",e)}finally{this.dataChannel=null}}_createDataChannel(e){this._closeDataChannel();let t=this.rtcPeerConnection.createDataChannel(this.dataChannelLabel,{ordered:!1,maxRetransmits:0,reliable:!1});t.binaryType="arraybuffer";let i="".concat(this.id,"-").concat(Math.floor(performance.now())),a=new W(i,this.connectionType,t,e);this.connectionType==R.b.VIDEO?a.transportlists=[G.SHARR_DECODE,G.VIDEO_DECODE,G.VIDEO_ENCODE]:a.transportlists=[G.AUDIO_DECODE,G.AUDIO_ENCODE],a.report_monitor_func=(e,t)=>{T.default.add_monitor("".concat(e,":").concat(t))},a.open(),a.onopen(e=>{this.dataChannelController.connectSession(a),function(e){if(!j.dataTransportMgr)throw new Error("not InitDataTransportModule");j.dataTransportMgr.addDataChannel(e)}(a),this.datachannelopenlistener&&this.datachannelopenlistener(e),this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen=0,clearInterval(this.timeoutThenCloseInterval),this.dataChannelStatus="OPEN",this.sendDataChannelStatusMonitorLog()}),a.onclose(e=>{this.dataChannelController.disconnectSession(new x(a.type,a.transfered)),z(a),this._ondatachannelclosed(e)}),a.onerror(e=>{z(a);const t=e.error||{};C.default.warn("WebRTC DataChannel ".concat(this.dataChannelLabel," received error with errorDetail: ").concat(t.errorDetail),t),clearInterval(this.timeoutThenCloseInterval),T.default.add_monitor("DCERROR","".concat(this.dataChannelLabel,": ").concat(t.message,", error detail: ").concat(t.errorDetail)),Di("dataChannel.onerror",e)}),this.dataChannel=a}_ondatachannelclosed(e){"CLOSED"!=this.dataChannelStatus&&(clearInterval(this.timeoutThenCloseInterval),Di("dataChannel.onclose",e),this.dataChannelStatus="CLOSED",this.datachannelcloselistener&&this.datachannelcloselistener(e),this._close(),this._clear())}onDataChannelClose(e){this.datachannelcloselistener=e}onDataChannelOpen(e){this.datachannelopenlistener=e}waitForAnswerFromRWG(e){let t=this;return new Promise((i,a)=>{let r=A.a.on(e,(e,r)=>{t.isDestroyed()&&a(),i(r)});this.pubSubTokenList.push(r)})}setRemoteDescription(e){Di("setRemoteDescription",e),this.rtcPeerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp}))}closeIfTimeout(){clearInterval(this.timeoutThenCloseInterval),this.timeoutThenCloseInterval=setTimeout(()=>{Di("closeIfTimeout"),this._close()},1e4)}addIceCandidate(e){this.rtcPeerConnection.addIceCandidate(new RTCIceCandidate({candidate:e,sdpMLineIndex:0,sdpMid:"0"}))}}var yi=a(6),Mi=a(28),Pi=a(11);const Ni=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16/9;if(!e||!t)return null;const n=i||0,o=a||0;if(e/t>r){const i=t*r;return{width:i,height:t,left:Math.round((e-i)/2)+n,top:0+o}}{const i=e/r;return{width:e,height:i,left:0+n,top:Math.round((t-i)/2)+o}}};function Vi(e){this.Notify_APPUI=e.Notify_APPUI,this.isSupportOffscreenCanvas=e.isSupportOffscreenCanvas,this.jsMediaEngine=e.jsMediaEngine,this.threadNumbs=e.videodecodethreadnumb,this.globalTracingLogger=e.globalTracingLogger,this.monitorLoggerFn=e.monitorLoggerFn,this.renderManager=e.renderManager,this.waterMarkCanvas=null,this.videoRenderLevel=10,this.videoRenderLevelCount=1,this.renderPeriodTotal=100,this.renderPeriodCount=0,this.renderPeriodTotalFps=0,this.renderPeriodFpsCount=0,this.lastRenderAudioTimeStamp=0,this.videoBufEmptyCount=0,this.videoBufCount=0,this.videoRenderMaxLevel=15,this.timestamp=0,this.audioPlayTime=0,this.videoTimestamp=0,this.videoWaterMarkName="",this.isCreateVideoWaterMark=!1,this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.currentactive=0,this.audioPlaySsrc=0,this.currentVideoHeight=0,this.currentVideoWidth=0,this.videoRenderArray=[],this.WaterMarkRGBA=new Mi.a,this.vMonitorCount=0,this.videoQueue=new h,this.timestart=0,this.rendingFlag=!0,this.rAFID=0,this.rAFIDBack=null,this.prevRequestAnimationTimestap=0,this.retryRequestAnimationStep=2,this.ssrcDisplayMap=new Map,this.ssrcHaddataMap=new Map,this.canvasToLocalDisplay=new Map,this.canvasIdSet=new Set,this.selfvideossrc=0,this.localVideoPtr=0,this.sabBuffer=0,this.localvideossrc=0,this.encodedVideoSharedArrayBufferUint8Array=null,this.encodedVideoSharedArrayBufferUint16Array=null,this.encodedVideoSharedArrayWasmMemory=null,this.startCaptureVideo=!1,this.clearColor=new Uint8Array(4),this.videorendercanvas=null,this.keyrender=null,this.renderIndex=0,this.activeSpeakssrc=0,this.needClear=!1,this.renderMode=0,this.intervalHandle,this.croppingParams={top:0,left:0,height:1,width:1},this.coordinate={x:0,y:0,width:640,height:360},this.isSupportVideoTrackReader=!1,this.bWebglContextLostProtectingMap=new Map,this.ismirror=!1,this.lfTimeStamp=0,this.activeFps=0,this.lastActiveSSRC=0,this.disableOriginalRatio=!1,this.onStopDrawCallback=e.onStopDrawCallback,this.onReStoreCallback=e.onReStoreCallback,this.videoRenderWGLFSTOP=!1}Vi.prototype.clearUseridRender=function(e,t,i){let a=e[0],r=a.display;if(r)if(r.setWatermarkFlag(0),this.renderMode)r.clearCanvas(t);else{let e=a.ssrc;if(!r||!t)return;this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.height=1,this.croppingParams.width=1,this.clearColor[0]=255*t.R,this.clearColor[1]=255*t.G,this.clearColor[2]=255*t.B,this.clearColor[3]=255*t.A;const n=this.renderManager.getRendererProvider().isWebGLRendererType(),s=this.renderManager.getRendererProvider().isWebGL2RendererType();if(n||s){let e=this.canvasToLocalDisplay.get(a.canvas);if(!e)return void console.log("no clearDisplay");e.setVideoMode(o.VIDEO_RGBA),e.colorRange=0,e.setFillMode(1,1),e.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===i&&((i={}).x=a.x,i.y=a.y,i.width=a.width,i.height=a.height),e.drawSelfVideo(i,!0)}else{if(!r)return void console.log("no clearDisplay");r.setVideoMode(o.VIDEO_RGBA),r.setColorRange(0),r.setFillMode(1,1),r.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===i&&((i={}).x=a.x,i.y=a.y,i.width=a.width,i.height=a.height),r.drawSelfVideo(i,!0)}let d=this;this.ssrcDisplayMap.forEach((function(t,i){let a,r;i==d.Get_Logical_SSrc(d.selfvideossrc)&&(a=!0),i==d.Get_Logical_SSrc(e)&&(r=!0),t.forEach(e=>{if(!e.haddata||r)return;let t=e.display;d.coordinate.x=e.x,d.coordinate.y=e.y,d.coordinate.width=e.width,d.coordinate.height=e.height,t&&(!r||n&&s?t.getVideoMode()!=o.VIDEO_INVALID&&(-1==[o.VIDEO_RGBA,o.VIDEO_BGRA].indexOf(t.getVideoMode())&&a?t.drawSelfVideo(d.coordinate,!1,d.ismirror):a?t.drawRemoteVideo(d.coordinate,d.ismirror):t.drawRemoteVideo(d.coordinate)):t.drawSelfVideo(d.coordinate,!0))})})),this.renderManager.renderFor(yi.t.VIDEO)}},Vi.prototype.Set_Render_Array_rAF=function(e){if(this.videoRenderArray=e,this.ssrcDisplayMap.clear(),this.ssrcHaddataMap.clear(),this.videoRenderArray.length>0)for(let e=0;e>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(i,e.ntptime)}for(var a=this.videoQueue.GetQueueLength(e.ssrc)-10;a>=0;)a--}},Vi.prototype.Update_RemoteVideo_Texture=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(this.Check_Request_Animation(),t)if(e&&i){let t=this.Get_Logical_SSrc(i),s=this.FindVideoRenderListFromMap(i);if(!s.length)return void this.renderManager.destroyUnusedVideoFrame(e);let d=this,u=n&&(1==a||3==a);this.ssrcHaddataMap.set(t,!0),r?(this.croppingParams.top=r.y,this.croppingParams.left=r.x,this.croppingParams.height=r.height,this.croppingParams.width=r.width):(this.croppingParams.top=e.visibleRect?0:e.cropTop,this.croppingParams.left=e.visibleRect?0:e.cropLeft,this.croppingParams.height=e.visibleRect?e.visibleRect.height:e.cropHeight,this.croppingParams.width=e.visibleRect?e.visibleRect.width:e.cropWidth);let{width:l,height:c}=e.visibleRect||{};if(l&&c||(c=this.croppingParams.height,l=this.croppingParams.width),u){let e=c;c=l,l=e,e=this.croppingParams.height,this.croppingParams.height=this.croppingParams.width,this.croppingParams.width=e}n&&(a=0),this.canvasIdSet.clear(),s&&s.forEach(t=>{t.haddata=!0;let i=t.display;d.coordinate.x=t.x,d.coordinate.y=t.y,d.coordinate.width=t.width,d.coordinate.height=t.height;let r=!(i&&i.reuse&&t.rendercanvasID&&this.canvasIdSet.has(t.rendercanvasID));i&&(i.setVideoMode(o.VIDEO_RGBA),d.Should_Update_Watermark(i,t.width,t.height,t.width,t.height)&&d.Update_Display_Watermark(i,t.width,t.height,t.width,t.height),e&&i.updateRemoteVideoTexturesImageBitmap(l,c,e,d.croppingParams,a,r),this.canvasIdSet.add(t.rendercanvasID))})}else this.renderManager.destroyUnusedVideoFrame(e);else{if(e&&e.ssrc){let t,i=this.Get_Logical_SSrc(e.ssrc),a=this.FindVideoRenderListFromMap(e.ssrc);if(!a.length)return e.yuvdataptr&&Module._free(e.yuvdataptr),void this.renderManager.destroyUnusedVideoFrame(e);let r=!1,n=this;this.ssrcHaddataMap.set(i,!0);let s=e;this.croppingParams.top=s.r_y,this.croppingParams.left=s.r_x,this.croppingParams.height=s.r_h,this.croppingParams.width=s.r_w,t=s,t.enableMultiDecodeVideoWithoutSAB?t.yuvdata=t.data:t.yuvdata=Object(Pi.a)().subarray(t.yuvdataptr,t.yuvdataptr+t.yuvlength),!t.yuvdata.length||t.yuvdata.length!=t.width*t.height*3/2||this.croppingParams.top<0||this.croppingParams.left<0||this.croppingParams.left+this.croppingParams.width>t.width||this.croppingParams.top+this.croppingParams.height>t.height||a&&(this.canvasIdSet.clear(),a.forEach(e=>{e.haddata=!0;let i=e.display;n.coordinate.x=e.x,n.coordinate.y=e.y,n.coordinate.width=e.width,n.coordinate.height=e.height;let a=!(i&&i.reuse&&e.rendercanvasID&&this.canvasIdSet.has(e.rendercanvasID));i&&(i.setVideoMode(o.VIDEO_I420),this.Should_Update_Watermark(i,e.width,e.height,e.width,e.height)&&this.Update_Display_Watermark(i,e.width,e.height,e.width,e.height),t&&i.updateRemoteVideoTextures(t.width,t.height,n.croppingParams,t.yuvdata,t.rotation,t.yuv_limited,n.coordinate,r,a),this.canvasIdSet.add(e.rendercanvasID))}))}else this.renderManager.destroyUnusedVideoFrame(e);e.yuvdataptr&&Module._free(e.yuvdataptr)}},Vi.prototype.Set_Cropping_Mode=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.disableOriginalRatio=!!e},Vi.prototype.Update_Cropping_Params=function(){if(this.disableOriginalRatio){const e=Ni(this.croppingParams.width,this.croppingParams.height,this.croppingParams.left,this.croppingParams.top);e&&(this.croppingParams={...this.croppingParams,...e})}},Vi.prototype.Update_SelfVideo_Texture=function(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:o.VIDEO_RGBA,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;if(n?(this.croppingParams.top=n.top,this.croppingParams.left=n.left,this.croppingParams.width=n.width,this.croppingParams.height=n.height):(this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.height=t,this.croppingParams.width=e),this.renderMode){let n=0;this.canvasIdSet.clear();const d=this.FindVideoRenderList(a);for(;n{a.haddata=!0,d.coordinate.x=a.x,d.coordinate.y=a.y,d.coordinate.width=a.width,d.coordinate.height=a.height,d.Update_Cropping_Params();let n=a.display,u=!(n&&n.reuse&&a.rendercanvasID&&this.canvasIdSet.has(a.rendercanvasID));n&&(n.setVideoMode(r),d.Should_Update_Watermark(n,a.width,a.height,a.width,a.height)&&d.Update_Display_Watermark(n,a.width,a.height,a.width,a.height),-1!==[o.VIDEO_RGBA,o.VIDEO_BGRA].indexOf(r)?n.updateSelfVideoTextures(e,t,i,d.croppingParams,u,s):n.updateRemoteVideoTextures(e,t,d.croppingParams,i,s,!0,d.coordinate,!1,u),this.canvasIdSet.add(a.rendercanvasID))}),this.renderManager.renderFor(yi.t.VIDEO))}},Vi.prototype.Draw_Send_Video_Img=function(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:o.VIDEO_RGBA,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.Update_SelfVideo_Texture(t,i,e,a,r,n)},Vi.prototype.setMirrorMyVideoOption=function(e){this.ismirror=e},Vi.prototype.Start_Draw=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this.rendingFlag=!0,this.renderMode=e,e?t?(this.intervalHandle=setInterval(this.JsMediaSDK_VideoRender_interval.bind(this),t),this.intervalHandle):null:(xi(this),this.Start_Request_Animation_Frame())},Vi.prototype.Stop_Draw=function(){this.rendingFlag=!1,this.renderMode?clearInterval(this.intervalHandle):this.Stop_Request_Animation_Frame()},Vi.prototype.contextLostCallback=function(e){let t=e.currentTarget.canvasId;Ui&&Object(Pi.i)(t),e.preventDefault()},Vi.prototype.contextRestoredCallback=function(e){let t=e.currentTarget,i=t.canvasId,a=t.callback;this.Restored_From_Context_Lost(t,t,i,this.Log_Error.bind(this),a),this.onReStoreCallback&&this.onReStoreCallback(this),Ui&&Object(Pi.j)(i)},Vi.prototype.webGLContextLostProtect=function(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t&&t!==e&&(t.contextLostHandler&&t.removeEventListener("webglcontextlost",t.contextLostHandler),t.contextRestoredHandler&&t.removeEventListener("webglcontextrestored",t.contextRestoredHandler)),e&&!this.bWebglContextLostProtectingMap.get(e)&&(e.canvasId=i,e.callback=a,this.renderMode||((t=this.bWebglContextLostProtectingMap.get(i))&&(t.removeEventListener("webglcontextlost",t.contextLostHandler),t.removeEventListener("webglcontextrestored",t.contextRestoredHandler)),this.bWebglContextLostProtectingMap.set(i,e),e.contextLostHandler=this.contextLostCallback.bind(this),e.contextRestoredHandler=this.contextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",e.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",e.contextRestoredHandler,{capture:!1})))},Vi.prototype._Replace_Video_Render_Array_From_Context_LOST=function(e){let{canvas:t,oldCanvas:i,newDisplayMap:a}=e;for(let e=0;e4&&void 0!==arguments[4]?arguments[4]:null;if(this.renderMode)this._Replace_Video_Render_Array_From_Context_LOST({canvas:e,oldCanvas:t});else{const n=this.renderManager.onRestoredFromContextLost(i,e,t,this.threadNumbs,a,this.canvasToLocalDisplay);n&&(this.ssrcDisplayMap.forEach((i,a)=>{i.forEach(i=>{if(i.haddata=!1,i.canvas===t){t!==e&&(i.canvas=e);let a=i.display;i.display=n.get(a.getTextureIndex())}})}),this._Replace_Video_Render_Array_From_Context_LOST({canvas:e,oldCanvas:t,newDisplayMap:n}),null==r||r({canvas:e,oldCanvas:t,newDisplayMap:n}),this.rendingFlag&&this.Start_Request_Animation_Frame())}},Vi.prototype.Replace_Canvas=function(e,t){let i=null;this.bWebglContextLostProtectingMap.forEach((e,a)=>{a===t&&(i=e)}),i!=e&&(this.bWebglContextLostProtectingMap.delete(t),this.webGLContextLostProtect(e,i,t),this.Restored_From_Context_Lost(e,i,t,this.Log_Error.bind(this))),this.isSupportOffscreenCanvas&&(this.waterMarkCanvas||this.videorendercanvas)&&(this.waterMarkCanvas=this.videorendercanvas=new OffscreenCanvas(640,360))},Vi.prototype.Get_Display=function(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r=this.renderManager.getRendererProvider().isWebGLRendererType(),n=this.renderManager.getRendererProvider().isWebGL2RendererType();(r||n)&&this.webGLContextLostProtect(e,null,t,a);const o=this.renderManager.getVideoRenderDisplay(e,t,this.threadNumbs,this.Log_Error.bind(this),this.canvasToLocalDisplay);return o},Vi.prototype.GiveBack_Display=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e[0];i&&i.display&&this.renderManager.recycleRenderDisplay(i.canvas,i.display,t)},Vi.prototype.Get_Logical_SSrc=function(e){return e?e>>10<<10:-1},Vi.prototype.Set_LocalVideo_Ptr=function(e){e&&(this.localVideoPtr=e)},Vi.prototype.Set_LocalVideo_Buffer=function(e){e&&(this.encodedVideoSharedArrayWasmMemory=e,this.sabBuffer=e.buffer,this.encodedVideoSharedArrayBufferUint8Array=new Uint8Array(this.sabBuffer),this.encodedVideoSharedArrayBufferUint16Array=new Uint16Array(this.sabBuffer))},Vi.prototype.Set_LocalVideo_SSRC=function(e){e&&(this.localvideossrc=e,this.selfvideossrc=e)},Vi.prototype.Draw_LocalVideo=function(){if(this.localVideoPtr&&this.sabBuffer&&this.localvideossrc){this.encodedVideoSharedArrayWasmMemory&&this.encodedVideoSharedArrayWasmMemory.buffer!=this.sabBuffer&&(this.encodedVideoSharedArrayBufferUint8Array=new Uint8Array(this.encodedVideoSharedArrayWasmMemory.buffer),this.encodedVideoSharedArrayBufferUint16Array=new Uint16Array(this.encodedVideoSharedArrayWasmMemory.buffer),this.sabBuffer=this.encodedVideoSharedArrayWasmMemory.buffer);let e=Atomics.load(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr),t=Atomics.load(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr+1),i=!0;if(e==t&&(i=!1),e-t==1&&(e=(e+1)%o.VIDEO_FRAME_BUFFER_SIZE),i){let t=0,i=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e)/2],a=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+2)/2],r=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+4)/2],n=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+6)/2],s=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+8)/2],d=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+10)/2],u=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+12)/2],l=255&u,c=u>>8&255;t=l&&l!==o.VIDEO_BGRA?i*a*3/2:i*a*4,this.croppingParams.top=r,this.croppingParams.left=n,this.croppingParams.height=d,this.croppingParams.width=s;let h=this.encodedVideoSharedArrayBufferUint8Array.subarray(this.localVideoPtr+4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+4+8,this.localVideoPtr+4+(o.VIDEO_DATA_MAX_SIZE+4+8+2)*e+4+8+t);this.Update_SelfVideo_Texture(i,a,h,this.Get_Logical_SSrc(this.localvideossrc),l,this.croppingParams,c),Atomics.store(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr,(e+1)%o.VIDEO_FRAME_BUFFER_SIZE)}}},Vi.prototype.Update_LocalVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=this.localvideossrc;if(this.renderMode){let r=0,n=0,s=!1,d=this.FindVideoRenderList(a),u=i&&(1==t||3==t);for(;n>10==e>>10)return this.videoRenderArray[t];return null},Vi.prototype.FindVideoRenderList=function(e){let t=this.isActiveSeakerSsrc(e),i=this.FindVideoRender(o.ACTIVE_SPEAKER_SSRC),a=[e>>10];t&&i&&a.push(o.ACTIVE_SPEAKER_SSRC>>10);let r=[];for(let e=0;e>10)&&r.push(this.videoRenderArray[e]);return r},Vi.prototype.FindVideoRenderListFromMap=function(e){let t=this.isActiveSeakerSsrc(e),i=[...this.ssrcDisplayMap.get(this.Get_Logical_SSrc(e))||[]];if(t){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(o.ACTIVE_SPEAKER_SSRC))||[];i.push(...e)}return i},Vi.prototype.JsMediaSDK_VideoRender_interval=function(){this.startCaptureVideo&&this.Draw_LocalVideo();let e=this.FindVideoRender(o.ACTIVE_SPEAKER_SSRC),t=this.FindVideoRender(this.activeSpeakssrc);if(0!=this.videoRenderArray.length){for(let a=0;ai.height&&(1===i.rotation||3===i.rotation)||i.width=0&&i.r_y>=0&&i.r_x+i.r_w<=i.width&&i.r_y+i.r_h<=i.height){8400==this.vMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("VDGLM"):postMessage({status:s.VIDEO_RENDER_MONITOR_LOG,data:"VDGLW"}),this.vMonitorCount=0),this.vMonitorCount++;let t=this;p.forEach(n=>{n.display&&(t.Should_Update_Watermark(n.display,a,r,d,c)&&t.Update_Display_Watermark(n.display,a,r,d,c),l?n.display&&(n.display.setVideoMode(o.VIDEO_I420),n.display.updateRemoteVideoTextures(i.width,i.height,t.croppingParams,e,i.rotation,i.yuv_limited),n.firstFrame=!0):(n.display.setVideoMode(o.VIDEO_I420),n.display.drawNextOutputPictureFrame(i.width,i.height,t.croppingParams,e,i.rotation,i.yuv_limited,n)))})}else this.Log_Error("Invalid YUV data: ".concat(i.r_x," ").concat(i.r_y," ").concat(i.r_w," ").concat(i.r_h," ").concat(i.width," ").concat(i.height));i.yuvdata instanceof Pi.c&&i.yuvdata.recycle()}l&&p.forEach(e=>{if(l&&e.firstFrame){const{x:t,y:i,width:a,height:r}=e,n={x:t,y:i,width:a,height:r};h?e.display.drawSelfVideo(n):e.display.drawRemoteVideo(n)}})}this.renderManager.renderFor(yi.t.VIDEO)}},Vi.prototype.Get_Decoded_Video_Frame=function(e){if(this.videoQueue){var t=this.videoQueue.GetQueue(e);return t?t.dequeue():null}},Vi.prototype.Set_SSRC_Latest_Time_Stamp=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.timestamp!==e&&"number"==typeof e&&e&&(this.timestamp=e,this.audioPlaySsrc=t,this.audioPlayTime=Date.now())},Vi.prototype.Get_Decoded_Video_Buffer_Length=function(e){return this.videoQueue?this.videoQueue.GetQueueLength(e):0},Vi.prototype.Get_SSRC_VIDEO_FPS=function(e){if(e>>=10,this.videoQueue&&this.videoQueue.ssrcInfo){var t=this.videoQueue.ssrcInfo.GetSSRCFpsInfo(e);if(t)return Math.round(t)}return 0},Vi.prototype.Change_Current_SSRC=function(e){this.currentactive=e,this.ClearQueue()},Vi.prototype.Set_Render_Array_IntervalMode=function(e,t){if(this.videoRenderArray=e,this.renderMode&&this.videoRenderArray.length>0)for(let e=0;e=(null===(i=this.videoRenderArray)||void 0===i?void 0:i.length))&&this.Log_Error("videoRenderArray:".concat(this.videoRenderArray,", length:").concat(null===(s=this.videoRenderArray)||void 0===s?void 0:s.length));this.renderMode&&r<(null===(a=this.videoRenderArray)||void 0===a?void 0:a.length)&&(this.videoRenderArray[r].display=this._Create_WebGL_Canvas({videoRenderArrayIndex:r,canvas:n,canvasId:o}),this.Set_Render_Array(this.videoRenderArray))},Vi.prototype.ClearQueue=function(){try{let e=this.videoQueue.ssrcQueueMap;for(let[t,i]of e)for(;!i.isEmpty();){let e=i.dequeue();e.yuvdata&&e.yuvdata instanceof Pi.c&&e.yuvdata.recycle()}}catch(e){this.Log_Error("Exception during VideoRender.ClearQueue",e)}this.videoQueue&&this.videoQueue.ClearQueue(),this.currentVideoHeight=0,this.currentVideoWidth=0},Vi.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateVideoWaterMark:i,videoWaterMarkName:a,watermarkOpacity:r,watermarkRepeated:n,watermarkPosition:o}=e;this.waterMarkCanvas=t||this.videorendercanvas,this.isCreateVideoWaterMark=i,this.videoWaterMarkName=a,void 0!==n&&(this.isWaterMarkRepeatedEnable=!!n),void 0!==r&&(this.waterMarkOpacity=r),void 0!==o&&(this.watermarkPosition=o)},Vi.prototype.Set_WaterMark_Flag=function(e){if(this.videoRenderArray.length>0)for(let t=0;t306&&t>202};const ki=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}};Vi.prototype.Update_Display_Watermark=function(e,t,i,a,r){const n=this.Should_Watermark_Repeated(a,r);this.waterMarkCanvas||this.videorendercanvas||(this.videorendercanvas=this.isSupportOffscreenCanvas?new OffscreenCanvas(640,360):null);const o=a<512||r<288?16:this.watermarkPosition,s=this.waterMarkCanvas||this.videorendercanvas;if("function"==typeof OffscreenCanvas&&s instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const d=ki(t,i);t=d.width,i=d.height;const u=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:s,name:this.videoWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:o}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:s,name:this.videoWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:o});e.updateWatermark(t,i,u)},Vi.prototype.Should_Update_Watermark=function(e,t,i,a,r){if(!this.isCreateVideoWaterMark)return!1;let n=!1;const o=ki(t,i);o.width===e.getWatermarkWidth()&&o.height===e.getWatermarkHeight()||(n=!0);const s=this.Should_Watermark_Repeated(a,r);e.isSetWatermark()||(n=!0),s!==e.isWatermarkRepeated()&&(n=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(n=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const d=t<512||i<288?16:this.watermarkPosition;return d!==e.getWatermarkPosition()&&(n=!0,e.setWatermarkPosition(d)),n},Vi.prototype.calCulateActiveFps=function(e){this.activeFps&&e>=this.lfTimeStamp?this.activeFps=500/(e-this.lfTimeStamp)+this.activeFps/2:this.lfTimeStamp&&(this.activeFps=1e3/(e-this.lfTimeStamp))},Vi.prototype.Put_Video_Data_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;if(this.videoQueue){var i=this.videoQueue.GetQueue(e.ssrc);if(i||(i=this.videoQueue.AddQueue(e.ssrc)),i.enqueue(e),(this.Get_Logical_SSrc(this.currentactive)==this.Get_Logical_SSrc(e.ssrc)||this.Get_Logical_SSrc(this.audioPlaySsrc)==this.Get_Logical_SSrc(e.ssrc))&&(this.lfTimeStamp&&this.calCulateActiveFps(e.ntptime),this.lfTimeStamp=e.ntptime),this.lastActiveSSRC!=e.ssrc&&(this.lfTimeStamp=0,this.activeFps=0),this.lastActiveSSRC=e.ssrc,this.videoQueue&&this.videoQueue.ssrcInfo){var a=e.ssrc>>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(a,e.ntptime)}for(var r=this.videoQueue.GetQueueLength(e.ssrc),n=r-t;n>=0;){let t=this.Get_Decoded_Video_Frame(e.ssrc);t.yuvdata instanceof Pi.c&&t.yuvdata.recycle(),n--}}else e.yuvdata&&e.yuvdata instanceof Pi.c&&e.yuvdata.recycle()},Vi.prototype.Set_VideoTrackReader=function(e){this.isSupportVideoTrackReader=e},Vi.prototype.Clear_OffScreenCanvas=function(e){this.renderManager.clearOffscreenCanvas(e),e.contextLostHandler&&(e.removeEventListener("webglcontextlost",e.contextLostHandler),e.contextLostHandler=null),e.contextRestoredHandler&&(e.removeEventListener("webglcontextrestored",e.contextRestoredHandler),e.contextRestoredHandler=null),e.width=1,e.height=1},Vi.prototype.Zoom_Render=function(e){},Vi.prototype.Decode_Ssrc=function(e){return this.ssrcDisplayMap.has(this.Get_Logical_SSrc(e))||this.Get_Logical_SSrc(e)==this.Get_Logical_SSrc(this.selfvideossrc)};const Ui="undefined"==typeof window;function Li(e){let t=Date.now(),i=Wi;if(t-Bi<30)i.Start_Request_Animation_Frame(e);else if(Bi=t,i.rendingFlag){i.needClear&&(i.needClear=!1);try{i.startCaptureVideo&&i.localVideoPtr&&i.Draw_LocalVideo(),i.ssrcDisplayMap.forEach((function(e,a){if(a!=i.Get_Logical_SSrc(o.ACTIVE_SPEAKER_SSRC)||!i.ssrcDisplayMap.has(i.Get_Logical_SSrc(i.activeSpeakssrc)))if(a==i.Get_Logical_SSrc(o.ACTIVE_SPEAKER_SSRC)&&(a=i.activeSpeakssrc),i.isActiveSsrcVideo(a))if(i.calPacingTime(t),t-i.timestart{var t;let r=e.display;null!=r&&null!==(t=r.isAvaiable)&&void 0!==t&&t.call(r)||setTimeout(()=>{var e;null==r||null===(e=r.restoreContext)||void 0===e||e.call(r)},5),e.haddata&&(i.coordinate.x=e.x,i.coordinate.y=e.y,i.coordinate.width=e.width,i.coordinate.height=e.height,r&&r.getVideoMode()!=o.VIDEO_INVALID&&(a&&-1!==[o.VIDEO_RGBA,o.VIDEO_BGRA].indexOf(r.getVideoMode())?r.drawSelfVideo(i.coordinate,!1,i.ismirror):a?r.drawRemoteVideo(i.coordinate,i.ismirror):r.drawRemoteVideo(i.coordinate)))})})),i.renderManager.renderFor(yi.t.VIDEO)}catch(e){i.Log_Error("Exception while rendering video",e)}i.Start_Request_Animation_Frame(e)}else i.rAFID&&i.Stop_Request_Animation_Frame()}function xi(e){return!!e&&(Wi=e,!0)}var Wi;Vi.prototype.Check_Request_Animation=function(){if(Ui&&this.rendingFlag&&this.prevRequestAnimationTimestap){performance.now()-this.prevRequestAnimationTimestap>5e3&&!this.rAFIDBack&&(postMessage({status:s.MONITOR_MESSAGE,data:"WCL_M,RCIF"}),this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0),this.rAFIDBack=setInterval(Li.bind(null,!0),30))}},Vi.prototype.Start_Request_Animation_Frame=function(e,t){if(!e&&this.rAFIDBack&&(console.log("Request_Animation_start"),this.Stop_Request_Animation_Frame_Backup()),!this.rAFIDBack)return t||(this.retryRequestAnimationStep=2),this.prevRequestAnimationTimestap=performance.now(),this.rAFID=requestAnimationFrame(Li),this.rAFID},Vi.prototype.Stop_Request_Animation_Frame_Backup=function(){this.rAFIDBack&&(clearInterval(this.rAFIDBack),this.rAFIDBack=null)},Vi.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&cancelAnimationFrame(this.rAFID),this.rAFID=0,this.prevRequestAnimationTimestap=0,this.retryRequestAnimationStep=2,this.Stop_Request_Animation_Frame_Backup()},Vi.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(Pi.h)(e,t)},Vi.prototype.calPacingTime=function(e){if(this.pacingTime=30,this.activeFps>=1&&this.activeFps<=40&&(this.pacingTime=1e3/this.activeFps),this.timestamp&&this.videoTimestamp){let t=this.timestamp+e-this.audioPlayTime,i=this.videoTimestamp+this.pacingTime-t,a=this.currentactive?this.currentactive:this.audioPlaySsrc,r=this.videoQueue.GetQueueLength(this.Get_Logical_SSrc(a));i>65&&i<1e4&&r>=1&&(this.pacingTime=1.5*this.pacingTime),i<-65&&(this.pacingTime=1*this.pacingTime/2)}else this.timestamp||(this.pacingTime>150?this.pacingTime=1*this.pacingTime/2:this.pacingTime=this.pacingTime-10)},Vi.prototype.getRenderManager=function(){return this.renderManager},Vi.prototype.cleanup=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.renderManager.cleanup(e,t,i)},Vi.prototype.setActiveSpeakerSsrc=function(e){this.activeSpeakssrc=e},Vi.prototype.getActiveSpeakerSsrc=function(e){return this.activeSpeakssrc},Vi.prototype.isActiveSeakerSsrc=function(e){return this.activeSpeakssrc&&this.activeSpeakssrc>>10==e>>10},Vi.prototype.isActiveSsrcVideo=function(e){let t=e>>10;return t==this.currentactive>>10||t==this.audioPlaySsrc>>10},Vi.prototype.clearDraw=function(e){e&&(this.clearColor[0]=255*e.R,this.clearColor[1]=255*e.G,this.clearColor[2]=255*e.B,this.clearColor[3]=255*e.A),this.needClear=!0},Vi.prototype.isSelfVideo=function(e){return this.Get_Logical_SSrc(e)==this.Get_Logical_SSrc(this.selfvideossrc)||this.isActiveSeakerSsrc(this.selfvideossrc)&&e>>10==o.ACTIVE_SPEAKER_SSRC>>10};var Bi=0,Gi=Vi;function Fi(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new g,this.sharingQueue=new g,this.WaterMarkRGBA=new Mi.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=o.RQUEST_ANIMATION_MODE,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null}Fi.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},Fi.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},Fi.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},Fi.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},Fi.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},Fi.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},Fi.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let i=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-i,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},Fi.prototype.JsMediaSDK_SharingRender=function(){var e,t,i;if(this.sharingDisplay)if(!1!==(null===(e=(t=this.sharingDisplay).isAvaiable)||void 0===e?void 0:e.call(t))){null===(i=this.statisticObj)||void 0===i||i.sample();var a=this.Get_Decoded_Sharing_Frame(this.currentshareactive,this.isFromMainSession),r=this.Get_Decoded_Mouse_Frame(this.currentshareactive,this.isFromMainSession);if(a){let e,t;this.lRTimeStamp=a.ntptime,a.yuvdata instanceof Pi.c?(e=a.yuvdata.yuvdata,t=a.yuvdata):(e=a.yuvdata,t=null),this.sharingWidthAndHeightInfo.logicWidth==a.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==a.logic_h||(this.PubSub?PubSub.publish(n.SHARING_PARAM_INFO_FROM_SOCKET,{body:{width:a.logic_w,height:a.logic_h,logicWidth:a.logic_w,logicHeight:a.logic_h}}):(postMessage({status:s.Sharing_Width_And_Height_Info,logicWidth:a.logic_w,logicHeight:a.logic_h}),this.updateOffscreenCanvasSize(a.logic_w,a.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=a.logic_w,this.sharingWidthAndHeightInfo.logicHeight=a.logic_h);var o=a.logic_h,d=a.logic_w,u=a.r_h,l=a.r_w;this.xratio=l/d,this.yratio=u/o;var c={top:a.r_x,left:a.r_y,height:a.r_h,width:a.r_w};this.currentSharingHeight==a.r_h&&this.currentSharingWidth==a.r_w&&this.currentSharingLogicHeight==a.logic_h&&this.currentSharingLogicWidth==a.logic_w||(this.Notify_APPUI?this.Notify_APPUI(n.SHARING_PARA,{body:{height:a.logic_h,width:a.logic_w,logicHeight:a.logic_h,logicWidth:a.logic_w}}):(postMessage({status:s.Sharing_Width_And_Height_Info,logicWidth:a.logic_w,logicHeight:a.logic_h}),this.updateOffscreenCanvasSize(a.logic_w,a.logic_h)),this.currentSharingHeight=a.r_h,this.currentSharingWidth=a.r_w,this.currentSharingLogicHeight=a.logic_h,this.currentSharingLogicWidth=a.logic_w);const i=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:a.r_w,r=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:a.r_h;this.Should_Update_Watermark(this.sharingDisplay,i,r)&&this.Update_Display_Watermark(this.sharingDisplay,i,r),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:s.SHARING_RENDER_MONITOR_LOG,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOutputPictureFrame(a.width,a.height,c,e,null,a.yuv_limited),t&&t.recycle(),a.dataptr&&Module._free(a.dataptr)}else if(this.brefresh&&(this.brefresh=!1,0!=this.sharingDisplay.getTextureWidth()&&0!=this.sharingDisplay.getTextureHeight()&&0!==this.currentSharingWidth&&0!==this.currentSharingHeight)){const e=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:this.currentSharingWidth,t=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:this.currentSharingHeight;this.Should_Update_Watermark(this.sharingDisplay,e,t)&&this.Update_Display_Watermark(this.sharingDisplay,e,t),this.sharingDisplay.drawNextOutputPictureFrame(this.sharingDisplay.getTextureWidth(),this.sharingDisplay.getTextureHeight(),this.sharingDisplay.getCroppingParams(),null,this.picRotation,!0,null,!1),a=!0}r&&(this.Cursorx=r.r_x*this.xratio,this.Cursory=r.r_y*this.yratio,this.CursorWidth=r.width*this.xratio,this.CursorHeight=r.height*this.yratio,this.sharingDisplay.updateCursor(r.width,r.height,r.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:s.SHARING_RENDER_MONITOR_LOG,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.drawCursor(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight)),a&&this.renderManager.renderFor(yi.t.SHARE)}else{var h,f;null===(h=(f=this.sharingDisplay).restoreContext)||void 0===h||h.call(f)}else Object(Pi.h)("JsMediaSDK_SharingRender error, display is null")},Fi.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},Fi.prototype.updateOffscreenCanvasSize=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!i)return console.log("drop logic w/h");try{let i=this.sharingDisplay.getAttachedCanvas();i&&i instanceof OffscreenCanvas&&(i.width=e,i.height=t,this.brefresh=!0)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},Fi.prototype.Set_Render_Display=function(e){this.sharingDisplay=e},Fi.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},Fi.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:i,sharingWaterMarkName:a,watermarkOpacity:r,watermarkRepeated:n,watermarkPosition:o}=e;i||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=i,this.sharingWaterMarkName=a,void 0!==n&&(this.isWaterMarkRepeatedEnable=!!n),void 0!==r&&(this.waterMarkOpacity=r),void 0!==o&&(this.watermarkPosition=o)},Fi.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},Fi.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.setWatermarkFlag(e?1:0)},Fi.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const Hi=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}};Fi.prototype.Update_Display_Watermark=function(e,t,i){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const a=t<512||i<288?16:this.watermarkPosition,r=this.Should_Watermark_Repeated(t,i),n=Hi(t,i);t=n.width,i=n.height;const o=r?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:a}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:a});e.updateWatermark(t,i,o)},Fi.prototype.Should_Update_Watermark=function(e,t,i){if(!this.isCreateSharingWaterMark)return!1;let a=!1;const r=Hi(t,i);r.width===e.getWatermarkWidth()&&r.height===e.getWatermarkHeight()||(a=!0);const n=this.Should_Watermark_Repeated(t,i);e.isSetWatermark()||(a=!0),n!==e.isWatermarkRepeated()&&(a=!0,e.setWatermarkRepeated(n)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(a=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const o=t<512||i<288?16:this.watermarkPosition;return o!==e.getWatermarkPosition()&&(a=!0,e.setWatermarkPosition(o)),a},Fi.prototype.Update_Sharing_Canvas_Size=function(e){let{width:t,height:i}=e;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(i)}},Fi.prototype.ClearQueue=function(){try{let e=this.sharingQueue.ssrcQueueMap;for(let[t,i]of e)for(;!i.isEmpty();){let e=i.dequeue();e.yuvdata&&e.yuvdata instanceof Pi.c&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},Fi.prototype.Get_Decoded_Sharing_Frame=function(e,t){if(!this.sharingQueue)return null;var i=this.GetLogicalSSRCPart(e,t),a=this.sharingQueue.GetQueue(i);return a?a.dequeue():null},Fi.prototype.Get_Decoded_Mouse_Frame=function(e,t){if(this.mouseQueue){var i=this.GetLogicalSSRCPart(e,t),a=this.mouseQueue.GetQueue(i);return a?a.dequeue():null}},Fi.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var i=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||i!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(n.FIRST_IOS_FRAME,this.currentshareactive):postMessage({status:s.FIRST_SHARING_FRAME_FOR_MOBILE,ssrc:this.currentshareactive}));var a=this.sharingQueue.GetQueue(i);a||(a=this.sharingQueue.AddQueue(i)),a.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var r=this.sharingQueue.GetQueueLength(i),o=r-t;for(this.maxQueueLength=t;o>=0;){let t=this.Get_Decoded_Sharing_Frame(e.ssrc,e.isFromMainSession);t.yuvdata instanceof Pi.c&&t.yuvdata.recycle(),t.dataptr&&Module._free(t.dataptr),o--}}},Fi.prototype.Get_Current_QueueLength=function(){if(!this.sharingQueue)return;let e=this.currentshareactive;var t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)},Fi.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),i=this.mouseQueue.GetQueue(t);i||(i=this.mouseQueue.AddQueue(t)),i.enqueue(e);for(var a=this.mouseQueue.GetQueueLength(t)-10;a>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc,e.isFromMainSession),a--}},Fi.prototype.GetLogicalSSRCPart=function(e,t){let i=e>>10;return t&&(i|=1<<23),i},Fi.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},Fi.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(Pi.h)(e,t)},Fi.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):Object(Pi.g)(e)},Fi.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},Fi.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval(()=>{this.No_Bindthis_Interval()},20)):(this.Start_Draw(),this.startRAFHealthCheck())},Fi.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},Fi.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval(()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(o.SET_INTERVAL_MODE),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))},2e3)},Fi.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)};var Ki=Fi,ji=a(23),Yi=a(16);let qi=new Map,Xi=[];function Qi(e){e.preventDefault()}function zi(e,t,i,a,r,n,s){let d=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=r,this.textureindex=i||0,this.texturestride=this.textureindex?3:s?4:6,this.initmask=s||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=d,zi.prototype.ROTATION_CLOCK0=0,zi.prototype.ROTATION_CLOCK90=1,zi.prototype.ROTATION_CLOCK180=2,zi.prototype.ROTATION_CLOCK270=3,this.webGLResources=n,n||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(n);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=o.VIDEO_INVALID,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function Ji(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var n=e.contextGL;let o=n.canvas.width,s=n.canvas.height;r&&(o=r.width,s=r.height);var d,u,l,c,h=a==e.ROTATION_CLOCK90||a==e.ROTATION_CLOCK270?i:t,f=a==e.ROTATION_CLOCK90||a==e.ROTATION_CLOCK270?t:i,p=h/f*s,_=f/h*o;p>o?(d=0,l=1,c=1-(u=(s-_)/2/s)):(u=0,c=1,l=1-(d=(o-p)/2/o)),d=2*d-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,d,u,l,c,d,c,l,u,d,u,l,c,d,c]);n.bindBuffer(n.ARRAY_BUFFER,e.vertexPosBuffer),n.bufferData(n.ARRAY_BUFFER,m,n.DYNAMIC_DRAW)}function Zi(e,t,i,a,r){var n=e.contextGL,o=a.top/i,s=a.left/t,d=o+(a.height-1)/i,u=s+a.width/t,l=[s,o,u,o,u,d,s,d];r==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),r==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),r==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],h=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=h;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);n.bindBuffer(n.ARRAY_BUFFER,e.texturePosBuffer),n.bufferData(n.ARRAY_BUFFER,f,n.DYNAMIC_DRAW)}zi.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},zi.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(Pi.f)(this.contextGL,"WEBGL_lose_context"))},zi.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(Pi.e)("WebGL2RestoreTimeout")},1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){Object(Pi.b)("webgl restoreContext exception2",e)}},zi.prototype.webgGLContextLostCallback=function(e){Object(Pi.g)("webglcontextlost2 event: canvas listener size=".concat(Xi.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(Xi.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},zi.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const i=Xi.indexOf(this.canvasID);Xi.splice(i,1),qi.delete(e)}},zi.prototype.webGLContextRestoredCallback=function(e){Object(Pi.g)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},zi.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(Pi.f)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=qi.get(e);t&&this.removeEventListener(e,t),qi.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===Xi.indexOf(this.canvasID)&&(Xi.push(this.canvasID),Xi.length>4&&Object(Pi.g)("webgl2canvas listener size=".concat(Xi.length,", ids:").concat(Xi.join())))},zi.prototype.isWebGL2=function(){return this.contextGL},zi.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},zi.prototype.initContextGL=function(){for(var e,t,i,a=this.canvasElement,r=null,n=["webgl2"],o=0;!r&&o 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && \n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask* mask.a+ c*(1.0-mask.a);\n }\n }\n\n if (waterMarkFlag!=1) {\n c.a = 1.0;\n }\n\n outputColor = c;\n }\n "),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||Object(Pi.g)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(i));var a=e.createProgram();e.attachShader(a,t),e.attachShader(a,i),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||e.isContextLost()||Object(Pi.g)("webgl2 Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a),this.shaderProgram=a},zi.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var a=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=i;var r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=o}this.texturePosBuffer=r},zi.prototype.initTextures=function(e){var t=this.contextGL,i=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var a=this.initTexture();this.yTextureRef=a,this.oyTextureRef=a;var r=this.initTexture();this.uTextureRef=r,this.ouTextureRef=r;var n=this.initTexture();if(this.vTextureRef=n,this.ovTextureRef=n,e){this.BindTextures(o.VIDEO_I420);var s=this.initTexture(),d=t.getUniformLocation(i,"cursorSampler");t.uniform1i(d,this.textureindex*this.texturestride+3),this.cursorTextureRef=s;var u=this.initTexture(),l=t.getUniformLocation(i,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var h=this.initTexture(),f=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=h;var p=t.getUniformLocation(i,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var _=this.initTexture(),m=t.getUniformLocation(i,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=_}var g=t.getUniformLocation(i,"colorRange");this.colorRangeRef=g,this.onlyRGBARef=t.getUniformLocation(i,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(i,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(i,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(i,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(i,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(i,"yuvmode")},zi.prototype.BindTextures=function(e){var t=this.contextGL,i=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==o.VIDEO_I420){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"uSampler");t.uniform1i(a,1);let r=t.getUniformLocation(i,"vSampler");t.uniform1i(r,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"ySampler");t.uniform1i(a,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,0);let n=t.getUniformLocation(i,"vSampler");t.uniform1i(n,0)}else if(e==o.VIDEO_NV12){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let a=t.getUniformLocation(i,"uSampler");t.uniform1i(a,1);let r=t.getUniformLocation(i,"vSampler");t.uniform1i(r,0)}let a=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(a,0);let r=t.getUniformLocation(i,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(r,6)):t.uniform1i(r,0);let n=t.getUniformLocation(i,"cursorSampler");t.uniform1i(n,0);let s=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(s,0)},zi.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},zi.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},zi.prototype.cleanup=function(){let e=this.canvasElement,t=qi.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=Qi,e.addEventListener("webglcontextlost",Qi,{capture:!1})),this.isAvaiable()){var i=this.contextGL;i.deleteProgram(this.program),i.activeTexture(i.TEXTURE0+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE1+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE2+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),this.textureindex||this.initmask||(i.activeTexture(i.TEXTURE3+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE4+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(this.getRepeatedWatermarkTextureValue(i)),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE5+this.textureindex*this.texturestride),i.bindTexture(i.TEXTURE_2D,null)),i.bindBuffer(i.ARRAY_BUFFER,null),i.deleteTexture(this.yTextureRef),i.deleteTexture(this.uTextureRef),i.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(i.deleteTexture(this.cursorTextureRef),i.deleteTexture(this.waterMarkTextureRef),i.deleteTexture(this.repeatedWaterMarkTextureRef),i.deleteTexture(this.previewVideoTextureRef),i.deleteBuffer(this.vertexPosBuffer),i.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&i.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&i.deleteBuffer(this.masktexturePosBuffer),i.glInitSucceed=0}},zi.prototype.drawNextOutputPicture=function(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var n=this.contextGL;n?this.drawNextOutputPictureFrame(e,t,i,a,r):this.drawNextOuptutPictureRGBA(e,t,i,a)},zi.prototype.updateVertexInfoForMultiView=function(e,t,i,a,r){var n,o,s,d,u=this.contextGL;if(this.isUseFillMode({width:i,height:a,rotation:r}))n=0,o=0,s=1,d=1;else{var l=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?a:i,c=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?i:a,h=l/c*t;h>e?(n=0,s=1,d=1-(o=(t-c/l*e)/2/t)):(o=0,d=1,s=1-(n=(e-h)/2/e))}n=2*n-1,s=2*s-1,o=1-2*o,d=1-2*d;var f=new Float32Array([s,o,n,o,s,d,n,d,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},zi.prototype.updateTextureInfoForMultiView=function(e,t,i,a,r,n,o){var s,d,u,l,c=this.contextGL;if(this.isUseFillMode({width:i.width,height:i.height,rotation:a})){const r=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?o/n:n/o,c=i.left||0,h=i.top||0;if(i.width/i.height>r){const a=i.height*r;s=h/t,d=(Math.round((i.width-a)/2)+c)/e,u=s+(i.height-1)/t,l=d+a/e}else{const a=i.width/r;u=(s=(Math.round((i.height-a)/2)+h)/t)+(a-1)/t,l=(d=c/e)+i.width/e}}else s=Object(Yi.e)(i.top/t,2),d=Object(Yi.e)(i.left/e,2),u=Object(Yi.h)((i.top+i.height-1)/t,2),l=Object(Yi.h)((i.width-1+i.left)/e,2);var h=[d,s,l,s,l,u,d,u];a==this.ROTATION_CLOCK90&&(h.unshift(h[6],h[7]),h=h.slice(0,8)),a==this.ROTATION_CLOCK180&&(h.unshift(h[4],h[5],h[6],h[7]),h=h.slice(0,8)),a==this.ROTATION_CLOCK270&&(h.push(h[0],h[1]),h=h.slice(2,10));var f=h[0],p=h[1];if(h[0]=h[2],h[1]=h[3],h[2]=f,h[3]=p,r)if(a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270){let e=h[1];h[1]=h[3],h[3]=e,e=h[5],h[5]=h[7],h[7]=e}else h[0]=1-h[0],h[2]=1-h[2],h[4]=1-h[4],h[6]=1-h[6];var _=new Float32Array([...h,1,0,0,0,1,1,0,1]);c.bindBuffer(c.ARRAY_BUFFER,this.texturePosBuffer),c.bufferData(c.ARRAY_BUFFER,_,c.DYNAMIC_DRAW)},zi.prototype.drawNextOutputPictureFrame=function(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,d=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),c=this.uTextureRef,h=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),r=r||this.ROTATION_CLOCK0;var f=(i=i||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||i.height!=this.croppingParams.height,p=i.top!=this.croppingParams.top||i.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,m=e!=this.textureWidth||t!=this.textureHeight,g=r!=this.picRotation;(f||_||g)&&Ji(this,i.width,i.height,r,s),(f||p||m||g)&&Zi(this,e,t,i,r);let E=n?0:1;E!=this.colorRange&&(u.uniform1i(this.colorRangeRef,E),this.colorRange=E),s?u.viewport(s.x,s.y,s.width,s.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,o.VIDEO_I420),Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.picRotation=r,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var S=a,v=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),d){var C=S.subarray(0,v);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,C)}var A=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,c),d){var T=S.subarray(v,v+A);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=A;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,h),d){var I=S.subarray(v+A,v+A+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,I)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):d&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var b=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(b,5),this.render(),this.hasWholeFrame=1},zi.prototype.updateTextureBlock=function(e,t,i,a,r){if(this.isAvaiable()){var n=this.contextGL,o=r;if(!(!this.hasWholeFrame||e<=0||t<=0||i<0||a<0||i+e>this.textureWidth||a+t>this.textureHeight)&&r&&r.length==e*t*3/2){var s=this.yTextureRef,d=this.uTextureRef,u=this.vTextureRef,l=e*t,c=o.subarray(0,l);n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s),n.texSubImage2D(n.TEXTURE_2D,0,i,a,e,t,n.LUMINANCE,n.UNSIGNED_BYTE,c);var h=e/2*t/2,f=o.subarray(l,l+h);n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,d),n.texSubImage2D(n.TEXTURE_2D,0,i/2,a/2,e/2,t/2,n.LUMINANCE,n.UNSIGNED_BYTE,f);var p=h,_=o.subarray(l+h,l+h+p);n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,u),n.texSubImage2D(n.TEXTURE_2D,0,i/2,a/2,e/2,t/2,n.LUMINANCE,n.UNSIGNED_BYTE,_)}}},zi.prototype.updateCursor=function(e,t,i){if(this.isAvaiable()){var a=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,this.cursorTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},zi.prototype.updateWatermark=function(e,t,i){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(this.watermarkData=i,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},zi.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},zi.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},zi.prototype.drawCursor=function(e,t,i,a,r){if(this.isAvaiable()){var n=this.contextGL;if(!(!this.hasWholeFrame||e&&(a<0||r<0))){n.viewport(0,0,n.canvas.width,n.canvas.height);var o=this.yTextureRef,s=this.uTextureRef,d=this.vTextureRef,u=this.cursorTextureRef;if(n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,s),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,d),n.activeTexture(n.TEXTURE3),n.bindTexture(n.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,o=i/this.croppingParams.height,s=a/this.croppingParams.width,d=r/this.croppingParams.height;this.cx=e,this.cy=o,this.cw=s,this.ch=d,n.uniform4f(this.cursorInfoRef,e,o,s,d)}else n.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},zi.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},zi.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},zi.prototype.drawNextOuptutPictureRGBA=function(e,t,i,a){if(this.isAvaiable()){var r=a,n=this.canvasElement.getContext("2d"),o=n.getImageData(0,0,e,t);o.data.set(r),n.putImageData(o,0,0)}},zi.prototype.isRGBAMode=function(e){return-1!==[o.VIDEO_RGBA,o.VIDEO_BGRA].indexOf(e)},zi.prototype.updateRemoteVideoTextures=function(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);const h=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!a||!a.length||a.length!=e*t*3/2&&!h||i&&(i.top<0||i.left<0||i.left+i.width>e||i.top+i.height>t))return!1;let f=n?0:1;if(this.colorRange=f,this.rotation=r,Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=d.canvas.width,this.canvasHeight=d.canvas.height,!s)return;if(d.bindTexture(d.TEXTURE_2D,u),h)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,a);var p=a,_=e*t,m=p.subarray(0,_);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,m);let g=0,E=0;this.videoMode==o.VIDEO_I420?(g=e/2*t/2,E=g):this.videoMode==o.VIDEO_NV12&&(g=e*t/2,E=0);var S=p.subarray(_,_+g);if(d.bindTexture(d.TEXTURE_2D,l),E){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S);var v=p.subarray(_+g,_+g+E);d.bindTexture(d.TEXTURE_2D,c),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,v)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,S);return!0},zi.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!i)return;if(!this.isAvaiable())return;var o=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(r)||(this.rotation=r),Object.assign(this.croppingParams,a),!n)return;o.bindTexture(o.TEXTURE_2D,this.yTextureRef);const s=0,d=o.RGBA,u=o.RGBA,l=o.UNSIGNED_BYTE;o.texImage2D(o.TEXTURE_2D,s,d,u,l,i)},zi.prototype.updateSelfMaskImage=function(e,t,i){if(!(e<=0||t<=0)&&i&&i.length==e*t*4&&this.isAvaiable()){var a=this.contextGL;a.bindTexture(a.TEXTURE_2D,this.maskTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i)}},zi.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},zi.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var i=this.contextGL;let a=this.isRGBAMode(this.videoMode)?1:0;i.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(a,this.hasCursor,this.videoMode),this.initmask&&i.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.render()},zi.prototype.readPixelsSyncRequest=function(e,t,i,a){if(this.isAvaiable()){var r,n=this.contextGL;return this.destination&&this.destination.length==i*a*4||(this.destination=new Uint8Array(i*a*4)),r=this.destination,n.flush(),n.readPixels(e,t,i,a,n.RGBA,n.UNSIGNED_BYTE,r),r}},zi.prototype.updateSelfVideoTextures=function(e,t,i,a){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&i&&i.length%4==0&&this.isAvaiable()){var o=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=n,Object.assign(this.croppingParams,a),r&&(o.bindTexture(o.TEXTURE_2D,this.yTextureRef),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,e,t,0,o.RGBA,o.UNSIGNED_BYTE,i))}},zi.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var a=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,i,e.width,e.height),a.viewport(e.x,e.y,e.width,e.height),t?(a.enable(a.BLEND),a.blendFunc(a.ZERO,a.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(o.VIDEO_RGBA),this.render()}},zi.prototype.isSetWatermark=function(){return this.hasWaterMark},zi.prototype.recoverTextures=function(){},zi.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},zi.prototype.setUniformFlag=function(e,t,i){if(this.isAvaiable()){var a=this.contextGL;a.uniform1i(this.onlyRGBARef,e),a.uniform1i(this.bgraModeRef,e&&i===o.VIDEO_BGRA?1:0),a.uniform1i(this.cursorFlagRef,t),e||a.uniform1i(this.yuvmodeRef,i)}},zi.prototype.setVideoMode=function(e){this.videoMode=e},zi.prototype.getVideoMode=function(e){return this.videoMode},zi.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},zi.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},zi.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},zi.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},zi.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},zi.prototype.getWatermarkPosition=function(){return this.watermarkPosition},zi.prototype.setMultiView=function(e){return this.isMultiView=e},zi.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},zi.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},zi.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},zi.prototype.getFillMode=function(){return this.fillMode},zi.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},zi.prototype.getTextureIndex=function(){return this.textureindex},zi.prototype.getIndex=function(){return this.textureindex},zi.prototype.getWatermarkWidth=function(){return this.watermarkWidth},zi.prototype.getWatermarkHeight=function(){return this.watermarkHeight},zi.prototype.getTextureWidth=function(){return this.textureWidth},zi.prototype.getTextureHeight=function(){return this.textureHeight},zi.prototype.getCroppingParams=function(){return this.croppingParams},zi.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},zi.prototype.getAttachedCanvas=function(){return this.canvasElement},zi.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},zi.prototype.isUseFillMode=function(e){let{width:t,height:i,rotation:a}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!i)return!1;const r=a===this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?i/t:t/i;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(r-e)<.01)};var $i=zi;class ea{constructor(e){this.options={analyserFrequent:100,...e||{}},this.asnTime=performance.now(),this.audioStream=null,this.analyserNodeBufferDataArray=null,this.audioCtx=null,this.destinationNode=null,"function"==typeof AudioContext&&(this.audioCtx=new(window.AudioContext||window.webkitAudioContext),this.destinationNode=new MediaStreamAudioDestinationNode(this.audioCtx),this.initAnalyserNode()),this.lastUILevel=0}initAnalyserNode(){this.analyserNode=this.audioCtx.createAnalyser(),this.analyserNode.connect(this.destinationNode),this.analyserNode.fftSize=1024}setAudioStream(e){this.audioStream=e}start(){if(this.audioCtx)return this.getAnalyzingStatus()&&this.stop(),this.getDestroyedStatus()?Promise.reject(new Error("instance is destroyed already")):new Promise(e=>{this.setAnalyzingStatus(!0),this.sourceNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.sourceNode.connect(this.analyserNode),this.resumeAudioCtx(),this.setAnalyzeInterval(),e(!0)})}stop(){this.setAnalyzingStatus(!1),this.clearAnalyzeInterval()}destroy(){var e;this.stop(),this.analyserNode&&this.destinationNode&&this.analyserNode.disconnect(this.destinationNode),this.setDestroyedStatus(!0),null===(e=this.audioCtx)||void 0===e||e.suspend().finally(()=>{var e;return null===(e=this.audioCtx)||void 0===e?void 0:e.close()}),this.audioStream=null,this.analyserNodeBufferDataArray=null}analyserNodeIntervalCallback(){if(!this.analyserNodeBufferDataArray)return;this.analyserNode.getFloatTimeDomainData(this.analyserNodeBufferDataArray);let{sumRms:e,absMax:t}=function(e,t){let i=0,a=0;for(let r=0;ri&&(i=t)}let r=a/e.length/t;return i=i>1?1:i,{sumRms:r,absMax:i}}(this.analyserNodeBufferDataArray,2);const i=ia(t);i!==this.lastUILevel&&(this.lastUILevel=i,this.options.analyserCallback(i))}setAnalyzeInterval(){this.clearAnalyzeInterval();const e=this.analyserNode.fftSize;this.analyserNodeBufferDataArray=new Float32Array(e),this.analyserNodeTimer=window.setInterval(this.analyserNodeIntervalCallback.bind(this),this.options.analyserFrequent)}clearAnalyzeInterval(){this.analyserNodeTimer&&(window.clearInterval(this.analyserNodeTimer),this.analyserNodeTimer=null,this.analyserNodeBufferDataArray=null)}getAnalyzingStatus(){return!!this.isAnalyzing}setAnalyzingStatus(e){this.isAnalyzing=!!e}getDestroyedStatus(){return!!this.isDestroyed}setDestroyedStatus(e){this.isDestroyed=!!e}resumeAudioCtx(){"running"!==this.audioCtx.state&&this.audioCtx.resume().catch(e=>{C.default.error("audio-level audio context resume error: ",e)})}}const ta=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function ia(e){if("number"!=typeof e||e<0||e>1)return-1;let t=parseInt(32768*e/1e3);return 0==t&&e>250&&(t=1),ta[t]}const aa=(e,t)=>T.default.add_monitor("AB"+e);var ra=[],na=[];class oa{constructor(){this.levelR16LogTimer=null,this.audioStatus=-1}startLogTimer(){try{this.levelR16LogTimer||(this.levelR16LogTimer=setInterval(()=>{ra.push("x"),na.push("x"),ra.length>30&&ra.shift(),na.length>30&&na.shift()},1e3)),this.audioStatus=2}catch{aa("SALLTERR")}}suspendLogTimer(e){try{this.levelR16LogTimer&&(clearInterval(this.levelR16LogTimer),this.levelR16LogTimer=null),this.audioStatus=e?3:1}catch{aa("PALLTERR")}}destroy(){this.suspendLogTimer(),this.levelR16LogTimer=null}}class sa{constructor(e,t){this.workletPath=t||{},this.audioStream=null,this.audioCtx=null,this.webRTCWorkletNode=null,this.inputNode=null,this.outputNode=null,this.isDestroyed=!1,this.mutedLevelLogTimer=new oa,this.initAudioContext(),this.isCreatingWorklet=!1,this.setAudioStreamCallback=e,this.doingDenoise=!1,this.checkProcessInterval=null}initAudioContext(){if(!this.audioCtx){let e=S.default.getAudioContextConfigure();if(this.audioCtx=Object(S.createAudioContext)("WebRTCInput",e),!this.audioCtx)return;this.audioCtx.onstatechange=()=>{var e,t;if(C.default.log("WebRTCInput AudioContext state changed to ".concat(null===(e=this.audioCtx)||void 0===e?void 0:e.state)),T.default.add_monitor("ACSC:WebRTCInput:".concat(null===(t=this.audioCtx)||void 0===t?void 0:t.state)),this.audioStream){this.setAudioStreamCallback(null,!0);const e=this.audioStream.getAudioTracks()[0];if(e){var i;const{muted:t}=e;"running"===(null===(i=this.audioCtx)||void 0===i?void 0:i.state)&&t&&(aa("ACRM"),C.default.error("Audio context running when track muted"))}}},this.outputNode=this.audioCtx.createMediaStreamDestination(),this.resumeAudioCtx()}}async createWebRTCWorklet(){const{jsPath:e,wasmPath:t}=this.workletPath;if(this.audioCtx&&e&&!this.isCreatingWorklet){if(this.isCreatingWorklet=!0,!this.webRTCWorkletNode){try{await this.audioCtx.audioWorklet.addModule(e)}catch(e){return C.default.error("Error when add webRTC worklet module",e),void(this.isCreatingWorklet=!1)}let i=void 0;if(S.default.isSupportAudioDenoise(!0)&&t&&(i=await S.default.downloadAndCompileWebAssembly(t,"AudioWorklet",T.default,!S.default.browser.isSafari&&I.default.enableStreamingInstantiate)),this.isDestroyed)return C.default.log("webrtc manager has been destroyed before create audio worklet node"),void this.destroy();let a=S.default.isBrowserSupportStereo()?2:1;this.webRTCWorkletNode=new Ei(this.audioCtx,"webRTCWorklet",{processorOptions:{userAgent:navigator.userAgent,wasmModule:i,inputAudioChannel:a},numberOfOutputs:1,outputChannelCount:[2]}),this.webRTCWorkletNode.onprocessorerror=e=>{C.default.error("Exception thrown in WebRTC AudioWorkletProcessor",e)},this.webRTCWorkletNode.postCMD("audiowasm"),this.webRTCWorkletNode.port.addEventListener("message",e=>{this.handleMessage(e)}),this.audioStream&&!this.inputNode&&(this.inputNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.inputNode.connect(this.webRTCWorkletNode)),this.webRTCWorkletNode.connect(this.outputNode),"running"===this.audioCtx.state&&this.startCheckProcess(),C.default.log("create worklet successfully")}this.isCreatingWorklet=!1,this.webRTCWorkletNode.postCMD("clearBuffer"),this.resumeAudioCtx()}}handleMessage(e){var t=e.data;switch(t.status){case"AUDIO_LEVEL_R16":{var i;if(1!=(null===(i=this.mutedLevelLogTimer)||void 0===i?void 0:i.audioStatus))break;const e=t.level.toString(16);ra.push(e),ra.length>30&&ra.shift()}break;case"AUDIO_LEVEL_R16_DENOISE":{var a;if(1!=(null===(a=this.mutedLevelLogTimer)||void 0===a?void 0:a.audioStatus))break;const e=t.level.toString(16);na.push(e),na.length>30&&na.shift()}break;case"WASM_INIT_SUCCESS":this.changeDenoiseSwitch(this.denoiseSwitch,this.isHeadSet);break;case"audio_process_changed":C.default.log("denoise switch changed"+t.data),this.doingDenoise=t.data,this.setAudioStreamCallback(null,!0);break;case n.AUDIO_LEVEL_INDICATOR:null!=t.data&&I.default.Notify_APPUI_SAFE(n.AUDIO_LEVEL_INDICATOR,{value:t.data});break;case"SPEECH_LOG":xe.push({log:t.data.log,logSource:o.AUDIO_WEBRTC_WORKLET})}}setAudioStream(e){this.audioStream=e,this.webRTCWorkletNode&&(this.inputNode&&(this.inputNode.disconnect(),this.inputNode=null),e&&(this.inputNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.inputNode.connect(this.webRTCWorkletNode)))}getAudioStream(){var e;return this.outputNode&&this.webRTCWorkletNode&&this.doingDenoise&&"running"===(null===(e=this.audioCtx)||void 0===e?void 0:e.state)?this.outputNode.stream:this.audioStream}changeDenoiseSwitch(e,t){this.denoiseSwitch=!!e,this.isHeadSet=!!t,this.webRTCWorkletNode&&this.webRTCWorkletNode.postCMD("audio_denoise_switch",{enable:this.denoiseSwitch,isHeadSet:this.isHeadSet})}getLevelR16Log(){const e=ra.join(""),t=na.join("");return ra=[],na=[],{resLevelR16Log:e,resLevelR16LogDenoise:t}}resumeAudioCtx(){var e,t,i;1!==(null===(e=this.mutedLevelLogTimer)||void 0===e?void 0:e.audioStatus)||"running"===(null===(t=this.audioCtx)||void 0===t?void 0:t.state)||"closed"===(null===(i=this.audioCtx)||void 0===i?void 0:i.state)||this.isCreatingWorklet||(this.startCheckProcess(),this.audioCtx.resume().catch(e=>{C.default.error("webRTC audioContext resume fail",e)}))}suspendAudioCtx(){var e;"suspended"===(null===(e=this.audioCtx)||void 0===e?void 0:e.state)||this.isCreatingWorklet||(this.stopCheckProcess(),this.audioCtx.suspend().catch(e=>{C.default.error("Error when suspend audio context",e)}))}changeAudioStatus(e,t){var i,a,r;t?(null===(i=this.mutedLevelLogTimer)||void 0===i||i.suspendLogTimer(!0),this.suspendAudioCtx()):e?(null===(a=this.mutedLevelLogTimer)||void 0===a||a.startLogTimer(),this.suspendAudioCtx()):(null===(r=this.mutedLevelLogTimer)||void 0===r||r.suspendLogTimer(!1),this.resumeAudioCtx())}startCheckProcess(){this.stopCheckProcess(),this.webRTCWorkletNode&&(this.webRTCWorkletNode.postCMD("clearProcess",null),this.checkProcessInterval=setInterval(()=>{this.webRTCWorkletNode&&this.webRTCWorkletNode.postCMD("checkProcess",null)},1e4))}stopCheckProcess(){this.checkProcessInterval&&(clearInterval(this.checkProcessInterval),this.checkProcessInterval=null)}destroy(){try{this.isDestroyed=!0,this.webRTCWorkletNode&&(this.webRTCWorkletNode.disconnect(),this.webRTCWorkletNode.postCMD("stopWorklet",!0),this.webRTCWorkletNode=null),this.inputNode&&(this.inputNode.disconnect(this.audioLevelNode),this.inputNode=null),this.outputNode&&(this.outputNode.disconnect(),this.outputNode=null),this.audioCtx&&"closed"!==this.audioCtx.state&&this.audioCtx.suspend().finally(()=>{this.audioCtx.close(),this.audioCtx=null}),this.audioStream=null,this.mutedLevelLogTimer&&(this.mutedLevelLogTimer.destroy(),this.mutedLevelLogTimer=null),this.wasmModule=null,this.isCreatingWorklet=!1,aa("DSALOK")}catch(e){aa("DSALERR"),C.default.error("Error when destroy webRTC manager",e)}}}var da=["headset","pods","buds","opencomm","arctis","mpow","hyperx cloud","zone wired","aeropex by aftershokz","plt focus","xiberia","pxc 550","tk-hs001","lifechat lx","cisco 56"],ua=[["wh-","wf-","wi-"],["1000x","ch","xb","sp","h9","c2","c5","c6","c1","h8","c4","c3"]],la={jabra:["evolve","pro 900","pro 920","pro 93","pro 94","talk","biz","engage","elite","uc voice","link 180","link 2","link 860","link 850","link 400","blueparrott"],plantronics:["savi","blackwire","c5","c3","c4","c6","c7","bt","audio","da","encorepro","hw111n","gamecom","apu","voyager"],logitech:["h570","h820","h650","pro x"],sennheiser:["sc","mb","pc","sd","dect","g4me1","audio"],sony:["wh","wf","mdr"],bose:["qc","quiet","soundlink","soundsport","on-ear","nc"],beats:["fit","flex","power","solo","studio","mivi"],razer:["kraken","blackshark","barracuda","nari","hammerhead","opus"],yealink:["uh","wh","yh","cp"],soundcore:["life","liberty","spirit","strike"],addasound:["sr","epic"],jbl:["tune","quantum","live","wave","t450bt","c200","everest","c310"],epos:["impact","pc 8 usb","h3","adapt"],jlab:["go","bt","epic","studio"]};var ca=function(e){if("string"!=typeof e)return!1;let t=e.toLowerCase();for(let e=0;et.deviceId?1:-1:e.kind>t.kind?1:-1}function pa(){this._deviceList=null,this._deviceDetectTimer=null,this.addChangeListener(),this.enumDevices()}pa.prototype.init=function(){this.micId=null,this.micLabel=null,this.speakerId=null,this.speakerLabel=null,this.cameraId=null,this.cameraLabel=null,this.startTime=Date.now(),this.userId=0,this.videoWidth=0,this.videoHeight=0,this.audioBridge=!1,this.isUpdatingDevice=!1,this.denoiseSwitch=!1},pa.prototype.isSupportDeviceChange=function(){return!(S.default.isAndroidBrowser()&&!S.default.browser.isFirefox)},pa.prototype.addChangeListener=function(){var e,t,i,a;this.isSupportDeviceChange()?(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.removeEventListener)||void 0===t||t.call(e,"devicechange",this.enumDevices.bind(this)),null===(i=navigator.mediaDevices)||void 0===i||null===(a=i.addEventListener)||void 0===a||a.call(i,"devicechange",this.enumDevices.bind(this))):this.enableSelfDeviceDetect();this.checkPlatformNeedExtraSelfDetection()&&this.enableSelfDeviceDetect()},pa.prototype.checkPlatformNeedExtraSelfDetection=function(){return S.default.isIphoneOrIpadSafari()||S.default.isLinux()},pa.prototype.enableSelfDeviceDetect=function(){this.disableSelfDeviceDetect();this._deviceDetectTimer=setInterval(this.enumDevices.bind(this),3e3)},pa.prototype.disableSelfDeviceDetect=function(){this._deviceDetectTimer&&clearInterval(this._deviceDetectTimer)},pa.prototype.receiveABOptionForExtraDeviceDetect=function(e){if(0==e){if(!this.isSupportDeviceChange())return;this.checkPlatformNeedExtraSelfDetection()&&this.disableSelfDeviceDetect()}},pa.prototype.isDeviceChanged=function(e){let t=this._deviceList;if(null===t)return!0;if(e.length!=t.length)return!0;t.sort(fa),e.sort(fa);let i=0,a=0;for(;!(i>=e.length||a>=t.length);){if(t[a].deviceId!=e[i].deviceId)return!0;i++,a++}return!1},pa.prototype.enumDevices=function(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null===(e=navigator)||void 0===e||null===(e=e.mediaDevices)||void 0===e||null===(t=e.enumerateDevices)||void 0===t?void 0:t.call(e).then(e=>{this.isSupportDeviceChange()&&i?(I.default.Notify_APPUI_SAFE(n.DEVICE_CHANGE_EVENT,e),this.reportAudioAllMonitorLogs(e)):null==this._deviceList?this.reportAudioAllMonitorLogs(e):this.isDeviceChanged(e)&&(I.default.Notify_APPUI_SAFE(n.DEVICE_CHANGE_EVENT,e),this.reportAudioAllMonitorLogs(e)),this._deviceList=e}).catch(e=>{C.GlobalTracingLogger.error("MediaSDK catched error while enumerateDevice: ",e)})},pa.prototype.reportAudioAllMonitorLogs=function(e){e&&e.forEach(e=>{var t;if("audioinput"==e.kind)this.sendDeviceInfo(-1,1,this.getIndex(e.label),e.deviceId,null===(t=e.label)||void 0===t||null===(t=t.replace(ha,""))||void 0===t?void 0:t.trim(),!0);else if("audiooutput"==e.kind){var i;this.sendDeviceInfo(-1,0,this.getIndex(e.label),e.deviceId,null===(i=e.label)||void 0===i||null===(i=i.replace(ha,""))||void 0===i?void 0:i.trim(),!0)}})},pa.prototype.notifyDenoiseSetting=function(){if(S.default.isSupportAudioDenoise(!!this.audioBridge)&&this.micId)if(this.audioBridge)this.audioBridge.changeDenoiseSwitch(this.denoiseSwitch,_a.isHeadSet());else{It({command:"audio_denoise_switch",switch:this.denoiseSwitch,isHeadSet:_a.isHeadSet()})}},pa.prototype.hasOutputDevice=async function(e){if(""===e)return!0;let t=(await navigator.mediaDevices.enumerateDevices()).filter(e=>"audiooutput"===e.kind);return 0!==t.length&&t.filter(t=>t.deviceId===e).length},pa.prototype.changeDenoiseSwitch=function(e){this.denoiseSwitch=e,this.notifyDenoiseSetting()},pa.prototype.setAudioBridge=function(e){this.audioBridge=e},pa.prototype.hasPermission=async function(e){try{return"granted"===(await navigator.permissions.query({name:e})).state}catch(t){let i=null;if("microphone"===e)i="audioinput";else{if("camera"!==e)return!1;i="videoinput"}return(await navigator.mediaDevices.enumerateDevices()).forEach(e=>{if(e.kind===i&&""===e.label)return!1}),!0}},pa.prototype.setUserId=function(e){if("number"!=typeof e||Number.isNaN(e))return;const t=this.userId>>10<<10==e>>10<<10;this.userId=e,t||this.reportAudioAllMonitorLogs(this._deviceList)},pa.prototype.updateSelectedMicDevices=function(e,t,i,a){var r;t=null===(r=t)||void 0===r||null===(r=r.replace(ha,""))||void 0===r?void 0:r.trim(),a&&(this.micId=e,this.micLabel=t),this.notifyDenoiseSetting(),this.sendDeviceInfo(i,1,this.getIndex(this.micLabel),e,t,a,this.isHeadSet())},pa.prototype.updateShareAudioDevices=function(e,t){this.sendDeviceInfo(0,2,0,e,t,!0,!1)},pa.prototype.updateSelectedSpeakerDevices=async function(e,t,i){e=e||"default";let a="default";(await navigator.mediaDevices.enumerateDevices()).forEach(t=>{var i;"audiooutput"===t.kind&&t.deviceId===e&&(a=null===(i=t.label)||void 0===i||null===(i=i.replace(ha,""))||void 0===i?void 0:i.trim())}),i&&(this.speakerId=e,this.speakerLabel=a),this.sendDeviceInfo(t,0,this.getIndex(this.speakerLabel),e,a,i,this.isHeadSet(!1))},pa.prototype.updateSelectedCameraDevices=function(e,t,i,a,r,n,o){var s;this.cameraId=e,this.cameraLabel=null==t||null===(s=t.replace(ha,""))||void 0===s?void 0:s.trim(),this.videoWidth=i,this.videoHeight=a,this.videoFrameRate=r,this.sendCameraInfo(n,o,r)},pa.prototype.isHeadSet=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=null;return t=e?this.micLabel:this.speakerLabel,ca(t)},pa.prototype.getIndex=function(e){return"default"==e?-1:"communications"==e?S.default.isMac()?0:-2:0},pa.prototype.sendDeviceInfo=function(e,t,i,a,r,o,s){if(!this.userId)return;let d=null,u=Date.now()-this.startTime;d=-1==e?"WCL_AUDIOD-ALL,"+this.userId+","+t+","+i+","+r+","+a+","+o+","+e+",7,"+u+",1":"WCL_AUDIOD,"+this.userId+","+t+","+i+","+r+","+a+","+o+","+e+",7,"+u+",1,"+(o?1:0)+","+s,I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:d}})},pa.prototype.sendCameraInfo=function(e,t,i){if(!this.userId||this.isUpdatingDevice)return;let a=null;a="WCL_CAMERA,"+this.userId+",0,"+this.cameraLabel+","+t+","+e+","+"-1,"+this.videoWidth+","+this.videoHeight+","+"-1,"+i+","+-1,I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:a}})},pa.prototype.getMicId=function(){return this.micId},pa.prototype.getMicLabel=function(){return this.micLabel};let _a=new pa;var ma=_a;function ga(e,t){return"number"!=typeof e?0:parseFloat(e.toFixed(t)).toString()}class Ea{static getReportKeyFromSSRC(e,t){if(e)return t.ssrc.toString()===e?o.REPORT_KEY_NORMAL:o.REPORT_KEY_SHARE}static isAudioSharing(e){return e&o.WEBRTC_SHARE_AUDIO_MODE}static remoteInboundRTPStatisticParse(e,t,i,a,r){let n=this.getReportKeyFromSSRC(e,t);n&&(n!=o.REPORT_KEY_SHARE||this.isAudioSharing(i))&&void 0!==t.roundTripTime&&(a[n]||(a[n]={}),a[n].rtt=Math.floor(1e3*t.roundTripTime))}static outboundRTPStatisticsParse(e,t,i,a,r){let n=this.getReportKeyFromSSRC(e,t);if(!n)return;if(n==o.REPORT_KEY_SHARE&&!this.isAudioSharing(i))return;a[n]||(a[n]={});const{timestamp:s,bytesSent:d,packetsSent:u,nackCount:l,retransmittedBytesSent:c,retransmittedPacketsSent:h,targetBitrate:f,totalPacketSendDelay:p}=t;r[n]||(r[n]={lastBytesSent:d,lastTimeStamp:s});const{lastTimeStamp:_,lastBytesSent:m}=r[n];a[n].bytesSentPerSecond=Math.floor(s-_?1e3*(d-m)/(s-_):0),a[n].packetsSent=u,a[n].nackCount=l,a[n].retransmittedBytesSent=c,a[n].retransmittedPacketsSent=h,a[n].targetBitrate=f/1e3+"k",Object.assign(r[n],{lastBytesSent:d,lastTimeStamp:s})}static outboundBitrateQosParse(e,t){let i=0;e.forEach(e=>{if("outbound-rtp"===e.type){const{bytesSent:a,timestamp:r}=e,{lastBytesSent:n,lastTimestamp:o}=t[e.ssrc]||{};a&&r&&n&&o&&(i+=this.calculateBitrates(n,o,a,r)),t[e.ssrc]={lastBytesSent:a,lastTimestamp:r}}}),t.bitrate=i.toFixed(1)}static inboundBitrateQosParse(e,t){let i=0;e.forEach(e=>{if("inbound-rtp"===e.type){const{bytesReceived:a,timestamp:r}=e,{lastBytesReceived:n,lastTimestamp:o}=t[e.ssrc]||{};a&&r&&n&&o&&(i+=this.calculateBitrates(n,o,a,r)),t[e.ssrc]={lastBytesReceived:a,lastTimestamp:r}}}),t.bitrate=i.toFixed(1)}static calculateBitrates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e===i||parseInt(t)===parseInt(a)?0:8e3*(i-e)/(a-t)}static mediaSourceStatisticsParse(e,t,i,a,r){var n;let s=t.trackIdentifier==(null==e||null===(n=e.getAudioTracks()[0])||void 0===n?void 0:n.id)?"NORMAL":"SHARE";if(!s)return;if(s==o.REPORT_KEY_SHARE&&!this.isAudioSharing(i))return;a[s]||(a[s]={});const{audioLevel:d,echoReturnLoss:u,echoReturnLossEnhancement:l,totalAudioEnergy:c,totalSamplesDuration:h}=t;a[s].audioLevel=ga(d,2),a[s].echoReturnLoss=u,a[s].echoReturnLossEnhancement=ga(l,2),a[s].totalAudioEnergy=ga(c,2),a[s].totalSamplesDuration=ga(h,1)}static networkInfoStatisticsParse(e,t,i,a,r){let n=0,o=null,s=null;if("candidate-pair"===t.type){const i=e.get(t.remoteCandidateId);t.selected&&i&&(n=i.port,o=i.protocol);const a=e.get(t.localCandidateId);t.selected&&a&&(s=a.candidateType)}else if("transport"===t.type&&t.selectedCandidatePairId){let i=e.get(t.selectedCandidatePairId);const a=e.get(i.remoteCandidateId);a&&(n=a.port,o=a.protocol);const r=e.get(i.localCandidateId);r&&(s=r.candidateType)}n&&o&&(n!==a.port||o!=a.protocol||s!=a.candidateType)&&(a.port=n,a.protocol=o,a.candidateType=s,C.default.directReport("".concat(r," port:").concat(n,", ").concat(r," protocol:").concat(o,", ").concat(r," localcandidateType:").concat(s)))}}const Sa=(e,t)=>T.default.add_monitor("AB"+e);class va{constructor(e,t,i,a){this.audioId=e,this.audioTag=document.createElement("audio"),this.audioTag.id=e,this.audioTag.srcObject=t,this.audioTag.autoplay=!0,this.audioTag.controls=!1,this.pauseCB=a,this._listenHandlePlaying=this._listenHandlePlaying.bind(this),this._listenHandlePause=this._listenHandlePause.bind(this),this._listenHandleCanPlay=this._listenHandleCanPlay.bind(this),this._listenHandleError=this._listenHandleError.bind(this),this._addListener(),document.documentElement.appendChild(this.audioTag),this.setSpeakerDevicePromise(i).catch(e=>{})}destroy(){this._removeListener(),this.pause(),this.setStream(null),this.audioTag&&(this.audioTag.remove(),this.audioTag=null)}_addListener(){this.audioTag&&(this.audioTag.addEventListener("playing",this._listenHandlePlaying),this.audioTag.addEventListener("pause",this._listenHandlePause),this.audioTag.addEventListener("canplay",this._listenHandleCanPlay),this.audioTag.addEventListener("error",this._listenHandleError))}_removeListener(){this.audioTag&&(this.audioTag.removeEventListener("playing",this._listenHandlePlaying),this.audioTag.removeEventListener("pause",this._listenHandlePause),this.audioTag.removeEventListener("canplay",this._listenHandleCanPlay),this.audioTag.removeEventListener("error",this._listenHandleError))}_listenHandlePlaying(){Sa("ASP:"+this.audioId)}_listenHandlePause(){Sa("APP:"+this.audioId),"function"==typeof this.pauseCB&&this.pauseCB.call()}_listenHandleCanPlay(){Sa("ACP:"+this.audioId)}_listenHandleError(e){Sa("APE:"+this.audioId+"-"+(null==e?void 0:e.code)),C.default.error("RTCAudioPlayer tag error: ",e)}isPaused(){return this.audioTag?this.audioTag.paused:void 0}isMuted(){return this.audioTag?this.audioTag.muted:void 0}isSupportSetSpeakerDevice(){return this.audioTag?this.audioTag.setSinkId:void 0}setStream(e){this.audioTag&&this.audioTag.srcObject!=e&&(this.audioTag.srcObject=e)}play(){return this.audioTag&&this.audioTag.play()}pause(){return this.audioTag&&this.audioTag.pause()}mute(){this.audioTag&&(this.audioTag.muted=!0)}unmute(){this.audioTag&&(this.audioTag.muted=!1)}setVolume(e){const t=Math.min(Math.max(0,e),100)/100;this.audioTag&&(this.audioTag.volume=t)}setSpeakerDevicePromise(e){return new Promise((t,i)=>this.audioTag&&this.isSupportSetSpeakerDevice()&&e?this.audioTag.sinkId==e?t():void this.audioTag.setSinkId(e).then(t).catch(e=>{C.default.error("Error when setting sink of audio player",e),i(e)}):t())}}const Ca=(e,t)=>T.default.add_monitor("AB"+e),Aa=(()=>{let e=[],t={},i=Date.now();return a=>{if(a.onlyAudioLevel)t[a.key]||(t[a.key]=[]),t[a.key].push(a.audioLevel);else if(Object.keys(t).forEach(e=>{a.ssrcMap[e]&&(a.ssrcMap[e].zoomAudioLevel=t[e])}),t={},e.push(a),Date.now()-i>14e3){let a=e.reduce((t,i,a)=>{const{rtt:r,ssrcMap:n}=i;let o="";return Object.keys(n).forEach((t,i,s)=>{const{aveAudioLevel:d,audioLevel:u,jitter:l,zoomAudioLevel:c,jitterBufferMinimumDelay:h,concealedSamples:f,concealmentEvents:p,insertedSamplesForDeceleration_in_5s:_,removedSamplesForAcceleration:m,silentConcealedSamples:g,audioPlayerStatus:E,totalAudioEnergy:S,aveJitterBufferDelay_ms:v,aveJitterBuffeTargetrDelay_ms:C,avePacketsReceived_in_s:A,aveBytesReceived_in_s:T,totalProcessingDelay_in_5s:R,packetsDiscarded_in_5s:I,packetsLost_in_5s:b}=n[t];o+="".concat(void 0===r?"":r,"|{[SSRCLOG]}|{").concat(t,"}|").concat(E,"|").concat(S.toFixed(4),"|").concat(c.join(""),"|").concat(ia(Number(u)),"|").concat(ia(Number(d)),"|").concat(1e3*l,"|").concat(v,"|").concat(C,"|").concat(b,"|").concat(A,"|").concat(T,"|").concat(h,"|").concat(I,"|").concat(f,"|").concat(p,"|").concat(_,"|").concat(m,"|").concat(g,"|").concat(R),a===e.length-1&&i===s.length-1||(o+="#")}),t+o},"WCL_AB,{[DOWNLINK]},");i=Date.now(),a+=",{[END]}",I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:a}}),t={},e=[]}}})(),Ta=(()=>{let e=[],t=Date.now();return i=>{if(e.push(i),Date.now()-t>14e3){let i="",a="";const r=e.reduce((t,r,n)=>{let o="";return Object.keys(r).forEach((e,t,n)=>{const{rtt:s="",bytesSentPerSecond:d,packetsSent:u,audioLevelR16Str:l="",audioLevelR16DenoiseStr:c="",targetBitrate:h="",nackCount:f="",retransmittedBytesSent:p="",retransmittedPacketsSent:_="",audioLevel:m="",echoReturnLoss:g="",echoReturnLossEnhancement:E="",totalAudioEnergy:S="",totalSamplesDuration:v=""}=r[e];i+=l,a+=c||l,o+="{".concat(e,"}").concat(s,"|").concat(d,"|").concat(u,"|").concat(h,"|").concat(f,"|").concat(p,"|").concat(_,"|").concat(m,"|").concat(g,"|").concat(E,"|").concat(S,"|").concat(v)}),n===e.length-1?o+=",{[SPEECH_R16]},".concat(i,",").concat(a,",{[END]}"):o+="#",t+o},"WCL_AB,{[UPLINK]},");t=Date.now(),I.default.sendMessageToRwg(n.MONITOR_LOG,{evt:n.RWG_MONITOR_LOG_EVENT,seq:1,body:{data:r}}),e=[]}}})(),Ra={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",iceServers:[],iceTransportPolicy:"all"};class Ia{constructor(e,t,i,a,r,n,s,d){this.callback=s,this.onlyCheck=d,this.publisherCandidate=[],this.subscriberCandidate=[],this.retry=0,this.retryPublish=0,this.cid=e,this.wsUrl=t,this.audioPlayerMap=new Map,this.isRetrying=!1,this.recvOnly=!!i,this.audioStream=null,this.shareAudioStream=null,this.monitorTimer=null,this.audioReportCount=0,this.monitorTimerDuration=1e3,this.monitorInfo={subscriber:{},publisher:{}},this.bitrateInfo={subscriber:{},publisher:{}},this.muted=!1,this.audioMuteStatus=new Map,this.ssrcUserIdMap=new Map,this.published=!1,this.joinAudioAfterConnect=!1,this.audioMode=o.WEBRTC_NO_AUDIO_MODE,this.codecDoAVSync=!!a,this.normalAudioMap=new Map,this.shareAudioMap=new Map,this.audioProfile=o.ORIGINAL_SOUND_OFF,this.syncTimer=null,n&&!this.onlyCheck&&(this.webRTCWorkletManager=new sa(this.setNormalAudioStream.bind(this),n)),this.hasPaused=!1,this.recoverAfter1s=null,this.useWebRTCOnDesktop=r,this.receiveAudioStatus=new Map,document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&this.playAllRemoteAudio()}),this.isMutedBySystem=!1,this.leaveTime=0,this.noPacketsCount=0,this.lastSentPackets=0,this.useIceServers=!1,this.iceServers=[],this.isAudioSentBytesZero=!1}setIceServers(e){this.iceServers=e||[]}setUseIceServers(e){this.useIceServers=e}playAllRemoteAudio(){if(this.isMutedBySystem)return;if(!this.hasPaused||!this.audioMode)return;let e=Array.from(this.audioPlayerMap.values()).map(e=>{if(e.isPaused())return e.play()});Promise.all(e).then(()=>{this.hasPaused=!1}).catch(e=>{this.hasPaused=!0,Ca("REA"),this.notifyUIMessage(n.RECOVER_WEBRTC_AUDIO),C.default.error("Error when playAllRemoteAudio: ",e)})}async reconnect(e){if(!this.isRetrying&&!this.isDestroyed){if(this.stopAVSyncTimer(),this.stopAudioQualityMonitorTimer(),this.destroySocketAndWebRtcConnect(!0),this.retry>=3)return this.isRetrying=!1,C.default.error("Audio Bridge failed to reconnect",e),void this.notifyUIMessage(n.WCL_SIP_WEBSOCKET_CONNECT_ERROR);this.isRetrying=!0,await S.default.sleep(3e3),this.isDestroyed||(Ca("JOIN"+this.retry),this.retry++,this.notifyUIMessage(n.WCL_AUDIO_BRIDGE_RECONNECT_START),await this.join(!0),this.isRetrying=!1)}}async join(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.WEBRTC_NO_AUDIO_MODE;if(i===o.WEBRTC_COMMPUTER_AUDIO_MODE)try{var a,r,s;this.cleanUserEventListener||(this.cleanUserEventListener=Object(S.addUserEventListener)(this.playAllRemoteAudio.bind(this))),null===(a=this.webRTCWorkletManager)||void 0===a||a.createWebRTCWorklet(this.workletPath),null===(r=this.webRTCWorkletManager)||void 0===r||r.changeAudioStatus(!1,!1),null===(s=this.webRTCWorkletManager)||void 0===s||s.startCheckProcess()}catch(e){C.default.error("Error when creating webRTCWorklet",e)}if(this.audioMode=this.audioMode|i,this.signal){var d;if(i!=o.WEBRTC_NO_AUDIO_MODE)this.startAVSyncTimer(),this.startAudioQualityMonitorTimer(),(null===(d=this.signal.socket)||void 0===d?void 0:d.readyState)===WebSocket.OPEN&&this.signal.notify("audiostatus",{status:this.audioMode});return void(i===o.WEBRTC_COMMPUTER_AUDIO_MODE&&this.unmuteAllRemoteAudio())}if(!e&&this.isRetrying)return void this.destroySocketAndWebRtcConnect(e);this.destroySocketAndWebRtcConnect(e),this.signal=new Oa,this.audioMode&&this.startAVSyncTimer();try{let e;t?e=t:(Ca("RTK"),I.default.sendMessageToRwg(n.REQUEST_AUDIO_BRIDGE_TOKEN,{evt:n.WS_CONF_AB_TOKEN_REQ},!1),e=await this.waitForTokenFromRWG(n.PUBSUB_EVT.AUDIO_BRIDGE_WS_TOKEN),Ca("TK")),this.signal.init("".concat(this.wsUrl,"&token=").concat(e,"&").concat(this.onlyCheck?"prob=1":"prob=0"))}catch(e){this.reconnect(e)}this.signal.onopen(async e=>{this.audioMode&&(this.signal.notify("audiostatus",{status:this.audioMode}),this.startAudioQualityMonitorTimer()),this.isOpen=!0,this.retryPublish=0,this.clearAudioPlayerMap(),await this.publish(),this.retry=0,this.audioMode&&this.notifyUIMessage(n.WCL_AUDIO_BRIDGE_RECONNECT_END)}),this.signal.onclose(e=>{!this.audioMode&&Date.now()-this.leaveTime>=15e3?(this.signal.destroy(),this.signal=null,this.reconnect(e)):(C.default.error("socket close, notify UI failover: "+o.WS_CLOSE_FAILOVER),this.notifyUIMessage(n.NOTIFY_UI_FAILOVER,o.WS_CLOSE_FAILOVER))}),this.signal.onerror(e=>{this.isOpen||C.default.error("Audio Bridge WebSocket open error"),!this.audioMode&&Date.now()-this.leaveTime>=15e3?(this.signal.destroy(),this.signal=null,this.reconnect(e)):(C.default.error("socket error, notify UI failover: "+o.WS_ERROR_FAILOVER),Object(Z.NotifyUIError)(n.NOTIFY_UI_FAILOVER,o.WS_ERROR_FAILOVER))}),this.signal.onmessage(e=>{if("closing"===e.method){let t=e.params.reason;return t===o.PUBLISHER_ICEConnectionState_Failed?(t="0"+(this.publisher.firstConnected?"1":"0"),I.default.peerConnectionCannotConnectTimes++):t===o.SUBSCRIBER_ICEConnectionState_Failed&&(t="1"+(this.subscriber.firstConnected?"1":"0"),I.default.peerConnectionCannotConnectTimes++),"00"!==t&&"10"!==t||!this.iceServers.length||this.useIceServers?(C.default.error("received closing from audioBridge, notify UI failover: "+t),I.default.peerConnectionCannotConnectTimes<=5?this.notifyUIMessage(n.NOTIFY_UI_FAILOVER,t):C.default.error("peerConnection cannot connect to audioBridge over 5 times"),this.callback("updateConnectionResult","00"!==t&&"10"!==t),this.callback("destroy"),!0):(this.setUseIceServers(!0),this.reconnect(t),!0)}if("qos"===e.method){let t=e.params;return t.encoding=t.encoding===parseInt(R.f.AUDIO_ENCODE),t.sample_rate=48,t.rate=t.encoding?this.bitrateInfo.publisher.bitrate:this.bitrateInfo.subscriber.bitrate,this.notifyUIMessage(n.AUDIO_QOS_DATA,t),!0}return!1}),this.signal.notifyUImessage(this.notifyUIMessage.bind(this)),this.signal.on_notify("command",e=>{const{data:t}=e||{};if(t)try{const e=JSON.parse(t),{evt:i}=e||{};i===n.WS_CONF_END_INDICATION&&this.destroy(!1)}catch(e){}}),this.signal.UpdateNTP=(e,t,i,a)=>{if(this.useWebRTCOnDesktop&&this.codecDoAVSync){let t=new ArrayBuffer(16),a=e.toString(2),r=parseInt(a.substring(0,a.length-32),2),n=parseInt(a.substring(a.length-32,a.length),2),o=new DataView(t);o.setUint32(0,i,!0),o.setUint32(4,n,!0),o.setUint32(8,r,!0),o.setUint32(12,Date.now(),!0),St({command:"audioDecodeTime",status:1,data:new Uint8Array(t)})}else 512&i?this.shareAudioMap.set(i>>10,{ntptime:e,rtptime:t,abssrc:a}):this.normalAudioMap.set(i>>10,{ntptime:e,rtptime:t,abssrc:a})},this.publisher&&this.removeAudioSender();let u=Object.assign({},Ra);this.useIceServers&&(u.iceServers=this.iceServers),this.publisher=new RTCPeerConnection(u),this.subscriber=new RTCPeerConnection(u),this.normalAudioSender=null,this.shareAudioSender=null,this.publisher.addTransceiver("audio",{direction:"sendrecv"}),this.publisher.addTransceiver("audio",{direction:"sendrecv"}),this.signal.onOffer=async e=>{Ca("RERSDP"),this.updateSsrcUserIdMap(e),await this.subscriber.setRemoteDescription(e),this.subscriberCandidate.forEach(e=>this.subscriber.addIceCandidate(e)),this.subscriberCandidate=[];const t=await this.subscriber.createAnswer();t.sdp=this.updateSdpCodecParameters(t.sdp,"opus",new Map([["stereo",{value:1,operater:"add"}]])),await this.subscriber.setLocalDescription(t),Ca("RELSDP"),await this.rpc("answer",{desc:t})},this.signal.onTrickle=async(e,t)=>{0==t?null!=this.subscriber.remoteDescription?(Ca("RERICE"),this.subscriber.addIceCandidate(e)):(Ca("RERICEF"),this.subscriberCandidate.push(e)):1==t?null!=this.publisher.remoteDescription?(Ca("SERICE"),this.publisher.addIceCandidate(e)):(Ca("SERICEF"),this.publisherCandidate.push(e)):C.default.error("Audio Bridge onTrickle error: role: ".concat(t,", candidate: ").concat(e))},this.publisher.onicecandidate=e=>{let{candidate:t}=e;Ca("SELICE"),this.signal.notify("trickle",{candidate:t,role:1})},this.publisher.onconnectionstatechange=()=>{Ca("PCSC:"+this.publisher.connectionState),this.publisher&&("disconnected"===this.publisher.connectionState?setTimeout(()=>{this.publisher&&"disconnected"===this.publisher.connectionState&&(Object(Z.NotifyUIError)(n.MEDIA_RECONNECT,{mediaType:"audio"}),this.publish(!0))},5e3):"connected"===this.publisher.connectionState&&(I.default.peerConnectionCannotConnectTimes=0,this.changeSDPAfterConnect&&(this.changeSDPAfterConnect=!1,this.resetOfferandAnswer()),this.notifyUIMessage(n.MEDIA_CONNECTED,{mediaType:"audio"}),this.publisher.firstConnected||(this.publisher.firstConnected=!0,this.notifyUIMessage(n.AUDIO_BRIDGE_CAN_SEND_DATA),this.subscriber.firstConnected&&this.callback("updateConnectionResult",!0))))},this.subscriber.onicecandidate=e=>{let{candidate:t}=e;Ca("RELICE"),this.signal.notify("trickle",{candidate:t,role:0})},this.subscriber.ontrack=e=>{Ca("REVT");const t=e.streams[0],i=decodeURIComponent(t.id),a="ab-audio-"+i;e.track.onunmute=()=>{this.hasPaused=!0;let e=this.audioPlayerMap.get(i);e?e.setStream(t):(e=new va(a,t,ma.speakerId,()=>{this.hasPaused=!0,"visible"===document.visibilityState&&null===this.recoverAfter1s&&(this.recoverAfter1s=setTimeout(()=>{this.recoverAfter1s=null,this.playAllRemoteAudio()},1e3))}),this.audioPlayerMap.set(i,e)),"visible"===document.visibilityState&&null===this.recoverAfter1s&&(this.recoverAfter1s=setTimeout(()=>{this.recoverAfter1s=null,this.playAllRemoteAudio()},1e3)),this.receiveAudioStatus.forEach((e,t)=>{this.setShareVolumeLevel(t/10,e.volume,e.isFromMainSession,!1)}),this.isDestroyed&&e.mute(),Ca("REVTP")},e.track.onmute=()=>{Ca("REVTM");const e=this.audioPlayerMap.get(i);e&&e.destroy(),this.audioPlayerMap.delete(i)}},this.subscriber.onconnectionstatechange=()=>{var e;if(Ca("SCSC:"+this.subscriber.connectionState),"connected"===(null===(e=this.subscriber)||void 0===e?void 0:e.connectionState)){if(I.default.peerConnectionCannotConnectTimes=0,this.notifyUIMessage(n.MEDIA_CONNECTED,{mediaType:"audio"}),this.subscriber.firstConnected)return;this.subscriber.firstConnected=!0,this.notifyUIMessage(n.AUDIO_BRIDGE_FIRST_RECV_DATA),this.publisher.firstConnected&&this.callback("updateConnectionResult",!0)}}}notifyUIMessage(e,t){!this.onlyCheck&&I.default.Notify_APPUI&&I.default.Notify_APPUI(e,t)}async enableShareToBO(e){let t=null;try{t=await this.rpc("Enable_Share_To_BO",{enable:e})}catch(e){C.default.error("Error when enable share to BO",e)}t&&2==t.length?this.notifyUIMessage(n.AUDIOBRIDGE_EBABLE_SHARE_TO_BO_SUCCESS,{enable:t[1].enable}):this.notifyUIMessage(n.AUDIOBRIDGE_EBABLE_SHARE_TO_BO_FAILURE,{enable:e})}async enableBroadCastToBO(e){let t=null;try{t=await this.rpc("Enable_Broadcast_To_BO",{enable:e})}catch(e){C.default.error("Error when enable broadcast to bo",e)}t&&2==t.length?this.notifyUIMessage(n.AUDIOBRIDGE_ENABLE_BROADCAST_TO_BO_SUCCESS,{enable:t[1].enable}):this.notifyUIMessage(n.AUDIOBRIDGE_EBABLE_BROADCAST_TO_BO_FAILURE,{enable:e})}leaveAudioWithoutDisconnect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.WEBRTC_NO_AUDIO_MODE;var t,i;(this.audioMode=this.audioMode&~e,this.signal&&this.signal.notify("audiostatus",{status:this.audioMode}),e===o.WEBRTC_COMMPUTER_AUDIO_MODE)?(this.setNormalAudioStream(null),this.muteAllRemoteAudio(),this.cleanUserEventListener&&(this.cleanUserEventListener(),this.cleanUserEventListener=null),this.muted=!1,null===(t=this.webRTCWorkletManager)||void 0===t||t.changeAudioStatus(!1,!0),null===(i=this.webRTCWorkletManager)||void 0===i||i.stopCheckProcess()):e===o.WEBRTC_SHARE_AUDIO_MODE&&this.setShareAudioStream(null);this.audioMode===o.WEBRTC_NO_AUDIO_MODE&&(this.leaveTime=Date.now(),this.stopAudioQualityMonitorTimer(),this.stopAVSyncTimer())}async rpc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.isDestroyed)return C.default.error("audioBridge instance is destroyed, method ".concat(e)),"";try{return this.signal?this.signal.call(e,t):(C.default.error("Audio Bridge RPC error: signal is not available,method: ".concat(e)),"")}catch(i){return C.default.error("Audio Bridge RPC error: method: ".concat(e,", params: ").concat(t),i),""}}async publish(e){if(!this.publisher||!this.isOpen)return;if(e){if(this.retryPublish>=3)return;this.retryPublish++}if(!e){if(this.published)return;this.published=!0}let t=await this.publisher.createOffer({iceRestart:!!e});t.sdp=this.changeOfferSDP(t.sdp),await this.publisher.setLocalDescription(t),this.uid||e||(this.uid=ba()),Ca("SELSDP");const i=await(e?this.rpc("offer",{desc:this.publisher.localDescription}):this.rpc("join",{uid:this.uid,offer:this.publisher.localDescription}));if(i&&2===i.length){const e=i[1];if("answer"===e.type){Ca("SERSDP"),e.sdp=this.changeOfferSDP(e.sdp),this.publisherAnswer=e,await this.publisher.setRemoteDescription(e);let t=this.publisher.getTransceivers();1===t.length?this.normalAudioSender=t[0].sender:2==t.length&&(t[0].mid{this.publisher.addIceCandidate(e),Ca("SERICE")}),this.publisherCandidate=[]}}}async resetOfferandAnswer(){let e=await this.publisher.createOffer();if(e.sdp=this.changeOfferSDP(e.sdp),this.publisherAnswer)return await this.publisher.setLocalDescription(e),this.publisherAnswer.sdp=this.changeOfferSDP(this.publisherAnswer.sdp),await this.publisher.setRemoteDescription(this.publisherAnswer),void this.rpc("Set_AudioProfile",{audioProfile:this.audioProfile});C.default.log("publisher answer is null when reset offer and answer")}waitForTokenFromRWG(e){return new Promise((t,i)=>{A.a.on(e,(e,i)=>{t(i)})})}updateSdpCodecParameters(e,t,i){try{let a=[];const r=e.split("\r\n"),n=new RegExp("^a=rtpmap:([0-9]+) ".concat(t,"/"));for(let e=0;er[e].match(new RegExp("^a=fmtp:".concat(i," (.*)")))||t,null);if(t){const a=new Map(t[1].split(";").map(e=>e.split("=")));i.forEach((e,t)=>{"add"===e.operater?a.set(t,e.value):"sub"===e.operater&&a.delete(t)});let n=r[e].match(/a=fmtp:(\d+)/)[0]+" ";for(const[e,t]of a)n+="".concat(e,"=").concat(t,";");n=n.slice(0,n.length-1),r[e]=n}}return r.join("\r\n")}catch(t){return C.default.error("Error when updateSdpCodecParameters",t),e}}changeOfferSDP(e){try{let t=e.split("m="),i=0,a=[];for(let e=1;e1&&void 0!==arguments[1]&&arguments[1]||(this.recvOnly?this.audioStream=null:this.audioStream=e,this.webRTCWorkletManager&&this.webRTCWorkletManager.setAudioStream(this.audioStream));let t=e;this.webRTCWorkletManager&&(t=this.webRTCWorkletManager.getAudioStream()),e&&(this.muted?this.mute():this.unmute()),this.publishAudioStream(t,this.normalAudioSender,"PAT")}setShareAudioStream(e){this.shareAudioStream=e,this.publishAudioStream(this.shareAudioStream,this.shareAudioSender,"PAST")}publishAudioStream(e,t,i){this.isDestroyed||(t?e?e.getAudioTracks().forEach(e=>{C.default.log("publish track label: "+e.label),Ca("".concat(i,"-").concat(e.id)),t.replaceTrack(e).catch(t=>{Ca("".concat(i,"-Failed-").concat(e.id)),C.default.error("error publishing audio stream",t)})}):(t.replaceTrack(null),Ca("".concat(i,"-null"))):Ca(i+"SE "))}mute(){var e;(this.muted=!0,this.audioStream)&&(Ca("SEVTP"),this.audioStream.getAudioTracks().forEach(e=>{e.enabled=!1}),null===(e=this.webRTCWorkletManager)||void 0===e||e.changeAudioStatus(!0,!1))}unmute(){var e;(this.muted=!1,this.audioStream)&&(Ca("SEVTM"),this.audioStream.getAudioTracks().forEach(e=>{e.enabled=!0}),null===(e=this.webRTCWorkletManager)||void 0===e||e.changeAudioStatus(!1,!1))}stopIncomingAudio(e){e?this.muteAllRemoteAudio():this.unmuteAllRemoteAudio()}muteAllRemoteAudio(){for(const[e,t]of this.audioPlayerMap)t.mute()}unmuteAllRemoteAudio(){for(const[e,t]of this.audioPlayerMap)t.unmute();this.playAllRemoteAudio()}setSpeechVolumeLevel(e,t){for(const[i,a]of this.audioPlayerMap){if(-1!==i.indexOf("OS"))continue;const r=Number(i.split("+")[0]||"0"),n=Number.isNaN(r)||!r?null:r>>10<<10;if(n&&n===e>>10<<10){a.setVolume(t);break}}}async changeSpeaker(t){let i=!0,a="",r=Date.now(),o=[];for(const[r,n]of this.audioPlayerMap){if(!1===n.isSupportSetSpeakerDevice()){i=!1,a="audioplayer.setSinkId is not supported on your device",C.default.error("Error when setting sink of audio player",e);break}let r=n.setSpeakerDevicePromise(t);o.push(r)}try{await Promise.all(o)}catch(e){i=!1,a="Error when setting sink of audio player: "+e.message}i?this.notifyUIMessage(n.AUDIO_SPEAKER_SET_SUCCESS,t||"default"):this.notifyUIMessage(n.AUDIO_SPEAKER_SET_ERROR,a),ma.updateSelectedSpeakerDevices(t,Date.now()-r,i)}setShareVolumeLevel(e,t,i){(!(arguments.length>3&&void 0!==arguments[3])||arguments[3])&&this.receiveAudioStatus.set(10*e+(i?1:0),{volume:t,isFromMainSession:i});let a=i?/(\d+)\+OS/:/(\d+)\+CS/;for(const[i,r]of this.audioPlayerMap){let n=i.match(a);n&&n.length>=2&&n[1]>>10===e&&512&n[1]&&(t?r.unmute():r.mute())}}async set_CC_lang(e){let t=null;try{t=await this.rpc("set_CC_lang",{lang:e})}catch(e){C.default.error("error when setting language",e)}t&&2===t.length?this.notifyUIMessage(n.AUDIOBRIDGE_SET_CC_LANG_SUCCESS,t[1].lang):this.notifyUIMessage(n.AUDIOBRIDGE_SET_CC_LANG_FAILURE,e)}updateSsrcUserIdMap(e){if(e){const{sdp:t=""}=e,i=t.match(/a=ssrc:(.+) cname:(.+)/g);i&&i.forEach(e=>{const t=e.match(/a=ssrc:(.+) cname:(.+)/);if(t&&t[1]&&t[2]){const e=Number(t[2].split("+")[0]||"0"),i=Number.isNaN(e)||!e?null:e>>10<<10,a=Number(t[1]);this.ssrcUserIdMap.set(a,i)}})}}updateUserMuteUnmuteStatus(e){const{update:t,remove:i}=e;t&&t.length>0&&t.forEach(e=>{const{userId:t,muted:i}=e;t&&this.audioMuteStatus.set(t>>10<<10,!!i)}),i&&i.length>0&&i.forEach(e=>{const{userId:t}=e;t&&this.audioMuteStatus.set(t>>10<<10,!0)})}isUserMuted(e){const t=this.ssrcUserIdMap.get(e);if(!t)return!1;const i=this.audioMuteStatus.get(t);return void 0!==i&&!!i}async setAudioProfile(e){if(this.audioMode!==o.WEBRTC_COMMPUTER_AUDIO_MODE&&this.audioMode!=o.WEBRTC_MULTI_AUDIO_MODE)return;let t=this.audioProfile;"backgroundNoiseSuppression"===e.currentSelect?(e.highBitrate?this.audioProfile=o.ORIGINAL_SOUND_OFF_HIGH_BITRATE:this.audioProfile=o.ORIGINAL_SOUND_OFF,ma.changeDenoiseSwitch("Zoom"===e.backgroundNoiseSuppression)):(ma.changeDenoiseSwitch(!1),e.originalSound.highfidelity&&e.originalSound.stereo?this.audioProfile=o.ORIGINAL_SOUND_HIGHFIDELITY_STEREO:e.originalSound.highfidelity?this.audioProfile=o.ORIGINAL_SOUND_HIGHFIDELITY:e.originalSound.stereo?this.audioProfile=o.ORIGINAL_SOUND_STEREO:this.audioProfile=o.ORIGINAL_SOUND_ON),t!==this.audioProfile&&(this.publisher&&"connected"===this.publisher.connectionState?await this.resetOfferandAnswer():this.changeSDPAfterConnect=!0)}clearAudioPlayerMap(){this.muteAllRemoteAudio();for(const[e,t]of this.audioPlayerMap)t.destroy();this.audioPlayerMap.clear(),this.audioMuteStatus.clear()}getAudioPlayer(e){let t=(2+(parseInt(e)>>10<<10)).toString();if(t)for(const[e,i]of this.audioPlayerMap)if(e.includes(t))return this.audioPlayerMap.get(e)}removeAudioSender(){this.normalAudioSender&&(this.publisher.removeTrack(this.normalAudioSender),this.normalAudioSender=null),this.shareAudioSender&&(this.publisher.removeTrack(this.shareAudioSender),this.shareAudioSender=null)}destroySocketAndWebRtcConnect(e){this.published=!1;try{this.removeAudioSender()}catch(e){}this.publisher&&(this.publisher.close(),this.publisher=null),this.subscriber&&(this.subscriber.close(),this.subscriber=null),this.isOpen=!1,e||(this.retry=0),this.retryPublish=0,this.signal&&(this.signal.destroy(),this.signal=null),this.ssrcUserIdMap.clear()}destroy(){Ca("DS"),this.isDestroyed=!0,this.cleanUserEventListener&&(this.cleanUserEventListener(),this.cleanUserEventListener=null),this.stopAudioQualityMonitorTimer(),this.stopAVSyncTimer(),this.webRTCWorkletManager&&(this.webRTCWorkletManager.destroy(),this.webRTCWorkletManager=null),this.setNormalAudioStream(null),this.setShareAudioStream(null),this.clearAudioPlayerMap(),this.destroySocketAndWebRtcConnect(),this.recvOnly=!1}startAudioQualityMonitorTimer(){this.audioReportCount=0,this.stopAudioQualityMonitorTimer(),this.monitorTimer=setInterval(()=>{this._publisherStatsParse(this.audioReportCount),this._subscriberStatsParse(this.audioReportCount),this.audioReportCount++},this.monitorTimerDuration)}stopAudioQualityMonitorTimer(){var e,t,i,a,r,n;this.monitorTimer&&(clearInterval(this.monitorTimer),this.monitorTimer=null,this.audioReportCount=0,this.monitorInfo={subscriber:{port:null===(e=this.monitorInfo)||void 0===e||null===(e=e.subscriber)||void 0===e?void 0:e.port,protocol:null===(t=this.monitorInfo)||void 0===t||null===(t=t.subscriber)||void 0===t?void 0:t.protocol,candidateType:null===(i=this.monitorInfo)||void 0===i||null===(i=i.subscriber)||void 0===i?void 0:i.candidateType},publisher:{port:null===(a=this.monitorInfo)||void 0===a||null===(a=a.publisher)||void 0===a?void 0:a.port,protocol:null===(r=this.monitorInfo)||void 0===r||null===(r=r.publisher)||void 0===r?void 0:r.protocol,candidateType:null===(n=this.monitorInfo)||void 0===n||null===(n=n.publisher)||void 0===n?void 0:n.candidateType}},this.bitrateInfo={publisher:{},subscriber:{}})}publishStream(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.setShareAudioStream(e):this.setNormalAudioStream(e),new Promise((e,t)=>{this.published?e(!0):this.publish().then(()=>{e(!1)})})}stopAVSyncTimer(){this.syncTimer&&(clearInterval(this.syncTimer),this.syncTimer=null)}syncSingleView(e,t){let i=0;if(t){let e=parseInt(t).toString(2),a=e.substring(0,e.length-32),r=e.substring(e.length-32,e.length);a=parseInt(a,2),r=parseInt(r,2),i=1e3*a+232.8*r/1e9}0==I.default.mediaSDKHandle.RenderInMain?e?Tt({command:"audioTimestamp",data:i}):St({command:"audioDecodeTime",status:0,data:i}):e?I.default.mediaSDKHandle.SharingRenderObj&&I.default.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(i):I.default.CurrentSSRCTime!=i&&(I.default.CurrentSSRCTime=i,I.default.audioPlayTime=Date.now())}startAVSyncTimer(){this.stopAVSyncTimer(),this.syncTimer=setInterval(()=>{if(!this.subscriber)return;let e=0;this.subscriber.getReceivers().forEach(t=>{t.getSynchronizationSources().forEach(t=>{e++;let i=this.ssrcUserIdMap.get(t.source),a=null,r=!1;if(a=this.shareAudioMap.get(i>>10),a&&a.abssrc===t.source?r=!0:a=this.normalAudioMap.get(i>>10),a){let e=a.ntptime,n=a.rtptime,o=e+(t.rtpTimestamp-n)*Math.pow(2,32)/48e3;this.codecDoAVSync||i>>10!=I.default.CurrentSSRC>>10&&!r||t.source===a.abssrc&&this.syncSingleView(r,o)}})}),0===e&&(this.syncSingleView(!1,0),this.syncSingleView(!0,0))},500)}async _publisherStatsParse(e){const t=!(e%5),i=this.showQos&&!(e%1);if(!this.publisher)return;if(!t&&!i)return;const a=await this.publisher.getStats();if(!a)return;if(i&&Ea.outboundBitrateQosParse(a,this.bitrateInfo.publisher),!t)return;let r={};const{publisher:n}=this.monitorInfo;if(a.forEach(e=>{if("remote-inbound-rtp"===e.type)Ea.remoteInboundRTPStatisticParse(this.normalAudioSSRC,e,this.audioMode,r,n);else if("outbound-rtp"===e.type)Ea.outboundRTPStatisticsParse(this.normalAudioSSRC,e,this.audioMode,r,n);else if("media-source"===e.type){var t;let i=(null===(t=this.webRTCWorkletManager)||void 0===t?void 0:t.getAudioStream())||this.audioStream;Ea.mediaSourceStatisticsParse(i,e,this.audioMode,r,n)}Ea.networkInfoStatisticsParse(a,e,this.audioMode,n,"publisher")}),this.handleNetworkQuality(0,r[o.REPORT_KEY_NORMAL].rtt),this.handleNoAudioPackets(r[o.REPORT_KEY_NORMAL].packetsSent),this.webRTCWorkletManager&&r.NORMAL){const{resLevelR16Log:e,resLevelR16LogDenoise:t}=this.webRTCWorkletManager.getLevelR16Log();r.NORMAL.audioLevelR16Str=e,r.NORMAL.audioLevelR16DenoiseStr=t}Ta(r)}async _subscriberStatsParse(e){var t;if(!this.subscriber)return;const i=!(e%5),a=!(e%1),r=this.showQos&&!(e%1),n=await this.subscriber.getStats();if(!n)return;let o={ssrcMap:{}};r&&Ea.inboundBitrateQosParse(n,null===(t=this.bitrateInfo)||void 0===t?void 0:t.subscriber);let s=!1;const{subscriber:d}=this.monitorInfo;n.forEach(e=>{i&&(this._subscriberCandidatePairParse(e,o),s=!0,Ea.networkInfoStatisticsParse(n,e,this.audioMode,d,"subscriber")),s=this._subscriberInboundRTPParse(e,o,d,a&&!i)||s}),i&&this.handleNetworkQuality(1,o.rtt),s&&Aa(o)}_subscriberCandidatePairParse(e,t){const{subscriber:i}=this.monitorInfo,{totalRoundTripTime:a,responsesReceived:r,type:n,state:o,nominated:s}=e;if("candidate-pair"===n&&"succeeded"===o&&s){i.prevStatInfo||(i.prevStatInfo={responsesReceived:r,totalRoundTripTime:a},i.ssrcMap={});const{prevStatInfo:e}=i;Object.assign(t,{rtt:Math.floor(1e3*(r===e.responsesReceived?0:(a-e.totalRoundTripTime)/(r-e.responsesReceived)))}),Object.assign(i.prevStatInfo,{totalRoundTripTime:a,responsesReceived:r})}}_subscriberInboundRTPParse(e,t,i,a){const{type:r}=e;let n=void 0;if("inbound-rtp"===r){const{totalAudioEnergy:r,timestamp:s,jitterBufferDelay:d,jitterBufferEmittedCount:u,jitterBufferMinimumDelay:l,jitterBufferTargetDelay:c,ssrc:h,jitter:f,audioLevel:p,packetsLost:_,packetsDiscarded:m,packetsReceived:g,bytesReceived:E,concealedSamples:S,concealmentEvents:v,insertedSamplesForDeceleration:C,removedSamplesForAcceleration:A,silentConcealedSamples:T,totalProcessingDelay:R}=e,I=this.ssrcUserIdMap.get(h);if(Aa({key:"".concat(h,"-").concat(I),audioLevel:ia(p),onlyAudioLevel:!0}),a)return!1;i.ssrcMap||(i.ssrcMap={});let b=i.ssrcMap[h];if(b){if(I){var o;n=!0;const e=Math.sqrt((r-b.totalAudioEnergy)/(s-b.timestamp)).toFixed(4);let i=-1;"number"==typeof p&&(i=p.toFixed(4));const a=this.calculateRate(b.jitterBufferDelay,b.jitterBufferEmittedCount,d,u,1),O=this.calculateRate(b.jitterBufferTargetDelay,b.jitterBufferEmittedCount,c,u,1),D=this.calculateRate(b.packetsReceived,b.timestamp,g,s),w=this.calculateRate(b.bytesReceived,b.timestamp,E,s),y=this.calculateRate(b.totalProcessingDelay,0,R,1,1),M=this.calculateRate(b.packetsDiscarded,0,m,1,1),P=this.calculateRate(b.insertedSamplesForDeceleration,0,C,1,1),N=this.calculateRate(b.packetsLost,0,_,1,1);t.ssrcMap["".concat(h,"-").concat(I)]=Object.assign(t.ssrcMap["".concat(h,"-").concat(I)]||{},{aveAudioLevel:e<1e-4?0:e,audioLevel:i<1e-4?0:i,jitter:f,jitterBufferMinimumDelay:l,concealedSamples:S,concealmentEvents:v,insertedSamplesForDeceleration_in_5s:P,removedSamplesForAcceleration:A,silentConcealedSamples:T,audioPlayerStatus:null!==(o=this.getAudioPlayer(I))&&void 0!==o&&o.isPaused()?0:1,totalAudioEnergy:r,aveJitterBufferDelay_ms:a,aveJitterBuffeTargetrDelay_ms:O,avePacketsReceived_in_s:D,aveBytesReceived_in_s:w,totalProcessingDelay_in_5s:y,packetsDiscarded_in_5s:M,packetsLost_in_5s:N})}}else b=i.ssrcMap[h]={},n=!1;this.isUserMuted(h)||!this.ssrcUserIdMap.has(h)?i.ssrcMap[h]=null:Object.assign(b,{totalAudioEnergy:r,timestamp:s,jitterBufferDelay:d,jitterBufferEmittedCount:u,packetsLost:_,packetsReceived:g,bytesReceived:E,jitterBufferTargetDelay:c,totalProcessingDelay:R,insertedSamplesForDeceleration:C,packetsDiscarded:m})}return n}handleNoAudioPackets(e){this.audioMode!=o.WEBRTC_COMMPUTER_AUDIO_MODE||!this.audioStream||this.muted||(e||0)-this.lastSentPackets!=0||this.isMutedBySystem?(this.audioMode==o.WEBRTC_COMMPUTER_AUDIO_MODE&&this.audioStream&&1==this.isAudioSentBytesZero&&(e||0)-this.lastSentPackets>0&&(Ca("HEALTH_CHECK_RESTORED"),I.default.Notify_APPUI_SAFE(n.AUDIO_STREAM_UNMUTED)),this.isAudioSentBytesZero=!1,this.noPacketsCount=0,this.lastSentPackets=e||0):(this.noPacketsCount++,2===this.noPacketsCount&&0==this.isAudioSentBytesZero&&(Ca("HEALTH_CHECK_FAILED"),Object(Z.NotifyUIError)(n.AUDIO_SENT_BYTES_ZERO,o.RECAPTURE_AUDIO_AFTER_MUTED),this.isAudioSentBytesZero=!0,this.noPacketsCount=0))}handleNetworkQuality(e,t){this.audioMode==o.WEBRTC_COMMPUTER_AUDIO_MODE&&this.audioStream&&t&&(t>5e3?I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE_AUDIO,{isUplink:0===e,networkLevel:o.NET_QUALITY_LEVEL.NET_QUALITY_VERY_BAD,bwLevel:o.NET_BW_LEVEL.NET_BW_LEVEL_VERY_LOW}):t>2e3&&I.default.Notify_APPUI_SAFE(n.NETWORK_QUALITY_CHANGE_AUDIO,{isUplink:0===e,networkLevel:o.NET_QUALITY_LEVEL.NET_QUALITY_BAD,bwLevel:o.NET_BW_LEVEL.NET_BW_LEVEL_LOW}))}calculateRate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e3;return e===i||t===a?0:Math.floor(r*(i-e)/(a-t))}changeDenoiseSwitch(e,t){var i;this.denoiseSwitch=e,this.isHeadSet=t,null===(i=this.webRTCWorkletManager)||void 0===i||i.changeDenoiseSwitch(e,t)}updateQos(e){this.showQos=e.enable,this.signal&&this.signal.notify("qos",{enable:e.enable,encoding:parseInt(e.workerType),pollingInterval:e.pollingInterval})}}function ba(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function Oa(){this.onOffer,this.isDestroyed=!1,this.heartBeatDetection=null,this.onopen=function(e){this._onopen=e},this.onclose=function(e){this._onclose=e},this.onerror=function(e){this._onerror=e},this.onmessage=function(e){this._onmessage=e},this.notifyUImessage=function(e){this.notifyUIMessage=e},this.init=function(e){Ca("INIT: ".concat(e)),this.socket=window.audioBridgeSignal=Object(S.createRlbSocket)(e),this._notifyhandlers={},this.socket.addEventListener("open",()=>{Ca("WSO"),this.lastMessageTimeStamp=performance.now(),this.socket.isRlb||(this.ping(),this.heartBeatDetection&&(clearTimeout(this.heartBeatDetection),this.heartBeatDetection=null),this.heartBeatDetection=setTimeout(function e(){var t;if(this.isDestroyed||1!==(null===(t=this.socket)||void 0===t?void 0:t.readyState))return;let i=performance.now()-this.lastMessageTimeStamp;i>32e3?(Ca("WST"),C.default.error("didn't reveive message from websocket in the last 30s, notify UI failover, duration: "+i),Object(Z.NotifyUIError)(n.NOTIFY_UI_FAILOVER,o.NO_MESSAGE_FAILOVER)):this.heartBeatDetection=setTimeout(e.bind(this),2e3)}.bind(this),2e3)),this._onopen&&this._onopen()}),this.socket.addEventListener("error",e=>{this.isDestroyed||(C.default.directReport("Audio Bridge WebSocket received error"),Ca("WSE"),this._onerror&&this._onerror(e||!0))}),this.socket.addEventListener("close",e=>{this.isDestroyed||(C.default.directReport("Audio Bridge WebSocket close"),Ca("WSC"),this._onclose&&this._onclose(e||!0))}),this.socket.addEventListener("message",async e=>{this.lastMessageTimeStamp=performance.now();const t=JSON.parse(e.data);let i=!1;if(this._onmessage&&(i=this._onmessage(t)),!i)if("offer"===t.method)this.onOffer&&this.onOffer(t.params);else if("trickle"===t.method)this.onTrickle&&this.onTrickle(t.params.candidate,t.params.role);else if("rtcpsr"===t.method)this.UpdateNTP(t.params.ntptime,t.params.rtptime,t.params.ssrc,t.params.abssrc);else if("pong"===t.result){let e=parseInt(performance.now())-t.id;Ca("RTT: "+e)}else{const e=this._notifyhandlers[t.method];e&&e(t.params)}})},this.on_notify=function(e,t){this._notifyhandlers[e]=t},this.notify=function(e,t,i){var a;this.isDestroyed?C.default.error("audioBridge instance is destroyed, method ".concat(e)):this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(JSON.stringify({method:e,params:t,id:i})):C.default.error("Websocket is not open: ".concat(this.socket.readyState,", ").concat(null===(a=this.socket)||void 0===a?void 0:a.url))},this.call=async function(e,t){const i=ba();var a;if(this.socket&&this.socket.readyState===WebSocket.OPEN)return this.socket.send(JSON.stringify({method:e,params:t,id:i})),new Promise((e,t)=>{const a=t=>{const r=JSON.parse(t.data);r.id===i&&(r.error?e(r):e(r.result),this.socket.removeEventListener("message",a))};this.socket.addEventListener("message",a)});C.default.error("Websocket is not open: ".concat(this.socket.readyState,", ").concat(null===(a=this.socket)||void 0===a?void 0:a.url))},this.ping=()=>{this.notify("ping",{},parseInt(performance.now())),this.pingTimeout&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{this.ping()},1e4)},this.destroy=()=>{this.isDestroyed=!0,this.pingTimeout&&(clearTimeout(this.pingTimeout),this.pingTimeout=null),this.heartBeatDetection&&(clearTimeout(this.heartBeatDetection),this.heartBeatDetection=null),this.socket&&this.socket.close&&this.socket.close(3456,"close socket when destroy signal")}}const Da=11;class wa{static async init(e,t){if(!window.navigator.hid||!window.navigator.hid.requestDevice)return!1;const i=this.webHid=new ya(e=>{switch(e.eventName){case"ondevicehookswitch":I.default.Notify_APPUI_SAFE(n.HID_STATUS_OFF_HOOK,"on"===e.hookStatus);break;case"ondevicemuteswitch":I.default.Notify_APPUI_SAFE(n.HID_STATUS_MUTE,e.isMute)}});return await i.open({label:e,muted:t,hookStatus:"off"})}static sendReport(e,t){switch(e){case"hookswitch":this.webHid.sendDeviceReport({command:t?"offHook":"onHook"});break;case"mute":this.webHid.sendDeviceReport({command:t?"muteOn":"muteOff"})}}static async destroy(){await this.webHid.close()}}class ya{constructor(e){this.deviceUsage={mute:{usageId:524297,usageName:"Mute"},offHook:{usageId:524311,usageName:"Off Hook"},ring:{usageId:524312,usageName:"Ring"},hookSwitch:{usageId:720928,usageName:"Hook Switch"},phoneMute:{usageId:720943,usageName:"Phone Mute"}},this.deviceCommand={outputReport:{mute:{reportId:0,usageOffset:-1},offHook:{reportId:0,usageOffset:-1},ring:{reportId:0,itemIndex:-1}},inputReport:{hookSwitch:{reportId:0,usageOffset:-1,isAbsolute:!1},phoneMute:{reportId:0,usageOffset:-1,isAbsolute:!1}}},this.device=null,this.inputReportRetFunc=e}getHexByte(e){let t=Number(e).toString(16);for(;t.length<2;)t="0"+t;return t}getHexByteStr(e){let t="";for(let i=0;ie.usagePage===Da);if(!e||0===Object.keys(e).length)return;if(e.inputReports&&!this.parseInputReports(e.inputReports))return!1;if(e.outputReports)return!!this.parseOutputReports(e.outputReports)}catch(e){console.error("parseDeviceDescriptors error:"+JSON.stringify(e,null," "))}}parseInputReports(e){return e.forEach(e=>{if(!e.items.length||void 0===e.reportId)return;let t=0;e.items.forEach(i=>{void 0!==i.usages&&void 0!==i.reportSize&&void 0!==i.reportCount&&void 0!==i.isAbsolute&&(i.usages.forEach((a,r)=>{switch(a){case this.deviceUsage.hookSwitch.usageId:this.deviceCommand.inputReport.hookSwitch={reportId:e.reportId,usageOffset:t+r*i.reportSize,isAbsolute:i.isAbsolute};break;case this.deviceUsage.phoneMute.usageId:this.deviceCommand.inputReport.phoneMute={reportId:e.reportId,usageOffset:t+r*i.reportSize,isAbsolute:i.isAbsolute}}}),t+=i.reportCount*i.reportSize)})}),0!==this.deviceCommand.inputReport.phoneMute.reportData&&0!==this.deviceCommand.inputReport.hookSwitch}parseOutputReports(e){let t,i,a;e.forEach(e=>{if(!e.items.length||void 0===e.reportId)return;let t=0,i=new Map;e.items.forEach(a=>{void 0!==a.usages&&void 0!==a.reportSize&&void 0!==a.reportCount&&(a.usages.forEach((r,n)=>{switch(r){case this.deviceUsage.mute.usageId:this.deviceCommand.outputReport.mute={reportId:e.reportId,usageOffset:t+n*a.reportSize},i.set(r,t+n*a.reportSize);break;case this.deviceUsage.offHook.usageId:this.deviceCommand.outputReport.offHook={reportId:e.reportId,usageOffset:t+n*a.reportSize},i.set(r,t+n*a.reportSize);break;case this.deviceUsage.ring.usageId:this.deviceCommand.outputReport.ring={reportId:e.reportId,usageOffset:t+n*a.reportSize},i.set(r,t+n*a.reportSize)}}),t+=a.reportCount*a.reportSize)});let a=t;for(let[e,t]of i)this.outputEventGenerators[e]=e=>{let i=new Uint8Array(a/8);if(t>=0&&e){let e=Math.trunc(t/8),a=t%8;i[e]=1<e.label.includes(t.productName))),!this.device){let t=[];try{t=await navigator.hid.requestDevice({filters:[{usagePage:Da}]})}catch(e){C.default.error("hid requestDevice error")}t.length&&(this.device=t.find(t=>e.label.includes(t.productName)))}if(!this.device)return!1;try{return this.device.opened&&await this.device.close(),await this.device.open(),this.parseDeviceDescriptors()?(this.device.oninputreport=await this.handleInputReport.bind(this),this.resetState({muted:e.muted,hookStatus:e.hookStatus}),!0):!1}catch(e){console.error("error content:"+e)}}async close(){try{if(this.resetState({muted:!1,hookStatus:"on"}),!this.device)return;this.device&&this.device.opened&&await this.device.close(),this.device.oninputreport=null,this.device=null}catch(e){console.error(e)}}resetState(e){let{muted:t,hookStatus:i}=e;this.device&&this.device.opened&&(this.device.hookStatus=i,this.device.muted=t,this.device.ring=!1,this.sendDeviceReport({command:"off"===i?"offHook":"onHook"}),this.sendDeviceReport({command:t?"muteOn":"muteOff"}))}async sendDeviceReport(e){if(!(e&&e.command&&this.device&&this.device.opened))return;if("muteOn"===e.command||"muteOff"===e.command){if(!this.outputEventGenerators[this.deviceUsage.mute.usageId])return}else if("onHook"===e.command||"offHook"===e.command){if(!this.outputEventGenerators[this.deviceUsage.offHook.usageId])return}else if(("onRing"===e.command||"offRing"===e.command)&&!this.outputEventGenerators[this.deviceUsage.ring.usageId])return;let t,i,a,r,n,o,s,d,u,l=0,c=null;switch(e.command){case"muteOn":case"muteOff":l=this.deviceCommand.outputReport.mute.reportId;break;case"onHook":case"offHook":l=this.deviceCommand.outputReport.offHook.reportId;break;case"onRing":case"offRing":l=this.deviceCommand.outputReport.ring.reportId;break;default:return}if(0!=l){if(i=this.device.muted,"off"===this.device.hookStatus)t=!0;else{if("on"!==this.device.hookStatus)return;t=!1}switch(a=this.device.ring,e.command){case"muteOn":n=!0;break;case"muteOff":n=!1;break;case"onHook":r=!1;break;case"offHook":r=!0;break;case"onRing":o=!0;break;case"offRing":o=!1;break;default:return}if(this.outputEventGenerators[this.deviceUsage.mute.usageId]&&(d=void 0===n?this.outputEventGenerators[this.deviceUsage.mute.usageId](i):this.outputEventGenerators[this.deviceUsage.mute.usageId](n)),this.outputEventGenerators[this.deviceUsage.offHook.usageId]&&(s=void 0===r?this.outputEventGenerators[this.deviceUsage.offHook.usageId](t):this.outputEventGenerators[this.deviceUsage.offHook.usageId](r)),this.outputEventGenerators[this.deviceUsage.ring.usageId]&&(u=void 0===o?this.outputEventGenerators[this.deviceUsage.ring.usageId](a):this.outputEventGenerators[this.deviceUsage.ring.usageId](o)),l===this.deviceCommand.outputReport.mute.reportId)if(null===c)c=new Uint8Array(d);else for(const[e,t]of d.entries())c[e]|=t;if(l===this.deviceCommand.outputReport.offHook.reportId)if(null===c)c=new Uint8Array(s);else for(const[e,t]of s.entries())c[e]|=t;if(l===this.deviceCommand.outputReport.ring.reportId)if(null===c)c=new Uint8Array(u);else for(const[e,t]of u.entries())c[e]|=t;switch(await this.device.sendReport(l,c),e.command){case"muteOn":this.device.muted=!0;break;case"muteOff":this.device.muted=!1;break;case"onHook":this.device.hookStatus="on";break;case"offHook":this.device.hookStatus="off";break;case"onRing":this.device.ring=!0;break;case"offRing":this.device.ring=!1}}}async sendReplyReport(e,t,i){let a,r,n,o,s=0;if(this.deviceCommand.outputReport.offHook.reportId===this.deviceCommand.outputReport.mute.reportId||e===this.deviceCommand.inputReport.hookSwitch.reportId?s=this.deviceCommand.outputReport.offHook.reportId:e===this.deviceCommand.inputReport.phoneMute.reportId&&(s=this.deviceCommand.outputReport.mute.reportId),this.device&&this.device.opened&&0!==s&&void 0!==t&&void 0!==i){if(this.deviceCommand.outputReport.offHook.reportId===this.deviceCommand.outputReport.mute.reportId){r=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),n=this.outputEventGenerators[this.deviceUsage.offHook.usageId](t),a=new Uint8Array(n);for(const[e,t]of r.entries())a[e]|=t}else s===this.deviceCommand.outputReport.offHook.reportId?(n=this.outputEventGenerators[this.deviceUsage.offHook.usageId](t),a=new Uint8Array(n)):s===this.deviceCommand.outputReport.mute.reportId?(r=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),a=new Uint8Array(r)):s===this.deviceCommand.outputReport.ring.reportId&&(o=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),a=new Uint8Array(o));await this.device.sendReport(s,a)}}handleInputReport(e){let t=this;try{const{data:i,device:a,reportId:r}=e;if(0===r)return;let n=t.deviceCommand.inputReport;if(r!==n.hookSwitch.reportId&&r!==n.phoneMute.reportId)return;let o=!1,s=!1,d=new Uint8Array(i.buffer),u=!0;if(r===n.hookSwitch.reportId){let e=n.hookSwitch,a=Math.trunc(e.usageOffset/8),r=e.usageOffset%8,s=0!=(i.getUint8(a)&1<{const t=await async function(){const e=new Ma.FileWriter({maxDaysToKeepFile:1,fileSizeQuota:10485760});return new Promise(t=>{e.on("initOK",()=>{t(e)})})}();this.logWriterMap.set(e,t),await I.default[Na[e]].waitforInitSuccess();const i=t.createMessagePort();Zt(e,i,"local_log_port",!0,!0),t.startWriteNormalLogFile({filenamePrefix:R.g[e],filenameExtension:".log",timestamp:!1,newLine:!1}),t.on("startWriteNormalLogFileReady",()=>{Zt(e,null,"local_log_ready",!1,!0)})}))}saveLogFileByWorkerType(e){const t=this.logWriterMap.get(e);t&&t.saveLog()}saveAllLogFiles(){Pa.a.selectSaveDir().then(()=>{Object.values(R.f).forEach(e=>{Pa.a.saveLog({filenamePrefix:R.g[e],filenameExtension:".log"})})})}}var ka=a(52);class Ua{constructor(){this.pressureLevel={nominal:0,fair:1,serious:2,critical:3},this.pressureStatisticHelper=new ka.StatisticHelper,this.observer=new PressureObserver(e=>{this.result=this.pressureLevel[e[0].state],T.default.add_monitor("CPC:"+this.result),this.pressureStatisticHelper.update(e[0].state)})}init(){this.initPromise=this.observer.observe("cpu").then(()=>{this.pressureStatisticHelper.start("nominal")}).catch(e=>{(S.default.isWindows()||S.default.isMac()||S.default.isChromeOS())&&C.default.warn("ComputePressure observe error: ",e)}).finally(()=>{this.initPromise=null})}destroy(){if(this.initPromise)this.initPromise.then(()=>{this.observer.unobserve("cpu");const e=this.pressureStatisticHelper.end();C.default.log("CPU pressure report: ".concat(JSON.stringify(e)))});else{this.observer.unobserve("cpu");const e=this.pressureStatisticHelper.end();C.default.log("CPU pressure report: ".concat(JSON.stringify(e)))}}}D()(Ua,"isSupportComputePressure",()=>"function"==typeof PressureObserver);var La=a(1),xa=a.n(La),Wa=a(8),Ba=a.n(Wa);function Ga(e,t){Ha(e,t),t.add(e)}function Fa(e,t,i){Ha(e,t),t.set(e,i)}function Ha(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ka(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var ja=new WeakMap,Ya=new WeakMap,qa=new WeakMap,Xa=new WeakMap,Qa=new WeakMap,za=new WeakMap,Ja=new WeakMap,Za=new WeakMap,$a=new WeakMap,er=new WeakMap,tr=new WeakMap,ir=new WeakMap,ar=new WeakMap,rr=new WeakMap,nr=new WeakMap,or=new WeakMap,sr=new WeakMap,dr=new WeakMap,ur=new WeakMap,lr=new WeakMap,cr=new WeakMap,hr=new WeakMap,fr=new WeakMap,pr=new WeakMap,_r=new WeakMap,mr=new WeakSet,gr=new WeakSet,Er=new WeakSet,Sr=new WeakSet,vr=new WeakSet,Cr=new WeakSet,Ar=new WeakSet,Tr=new WeakSet,Rr=new WeakSet,Ir=new WeakSet,br=new WeakSet,Or=new WeakSet,Dr=new WeakSet,wr=new WeakSet,yr=new WeakSet,Mr=new WeakSet,Pr=new WeakSet,Nr=new WeakSet,Vr=new WeakSet,kr=new WeakSet;function Ur(e){e&&e.forEach(e=>{e.markRenderingStatePending()});const t=Ka(this,yr,zr).call(this,e);if(xa()(this,Za)&&xa()(this,Ja)&&xa()(this,tr))if(xa()(this,ja)&&0!=xa()(this,ja).width&&0!=xa()(this,ja).height&&xa()(this,Ja)&&xa()(this,Ja).getCurrentTexture()&&0!=xa()(this,Ja).getCurrentTexture().width&&0!=xa()(this,Ja).getCurrentTexture().height)try{if(!xa()(this,rr)){const e=xa()(this,_r).byteLength,t=e;Ba()(this,rr,xa()(this,tr).acquireBuffer(t,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,e,!0,!1)),new Float32Array(xa()(this,rr).getMappedRange()).set(xa()(this,_r)),xa()(this,rr).unmap()}const e=Ka(this,Ar,Fr).call(this);for(const[i,a]of t)Ka(this,Pr,Zr).call(this,i,a,e);const i=Ka(this,wr,Qr).call(this,xa()(this,Ja).getCurrentTexture().createView()),a=e.beginRenderPass(i);a.setVertexBuffer(0,xa()(this,rr));for(const[e,i]of t)if(i&&0!=i.length)for(const e of i){e.unlock();if(e.getTextureLayerType()==yi.v.UNKNOWN)continue;const t=e.getTextureType();let i=e.getUVCoords();if(t!==yi.x.CLEAR_COLOR&&!i)continue;const r=xa()(this,ja).width,n=xa()(this,ja).height;let o=e.getViewport();if(!o||Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.w)||Number.isNaN(o.h)||o.x<0||o.y<0)continue;if(o.x+o.w>r){let e=o.x+o.w-r;if(!(e>0&&e<=yi.i))continue;o.w-=e,o.w<=0&&(o.w=1)}if(o.y+o.h>n){let e=o.y+o.h-n;if(!(e>0&&e<=yi.i))continue;o.h-=e,o.h<=0&&(o.h=1)}const s=Ka(this,Mr,Jr).call(this,e);if(!s)continue;if(s.pipelineType!==yi.l.CLEAR_COLOR){let t=e.getUVCoordsBuffer();if(!t){const a=i.byteLength;t=xa()(this,tr).acquireBuffer(a,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,i.byteLength,!1,!1),e.setUVCoordsBuffer(t)}xa()(this,Za).queue.writeBuffer(t,0,i,0,i.length),a.setVertexBuffer(1,t)}a.setViewport(o.x,o.y,o.w,o.h,o.minDepth,o.maxDepth);const d=s.pipeline;a.setPipeline(d);const u=xa()(this,Za).createBindGroup({layout:d.getBindGroupLayout(0),entries:s.entries});a.setBindGroup(0,u),a.draw(6,1,0,0)}a.end(),Ka(this,Tr,Hr).call(this)}catch(e){Object(Pi.h)("[WebGUPRenderer] renderNoMsaa() error:".concat(e.message))}finally{xa()(this,za).recycleInUsedGPUBuffers(t)}else xa()(this,za).recycleInUsedGPUBuffers(t);else xa()(this,za).recycleInUsedGPUBuffers(t)}function Lr(e){if(!xa()(this,Za)||!xa()(this,Ja))return;const t=xa()(this,Za).createBuffer({label:"VertexBuffer",size:xa()(this,_r).byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,mappedAtCreation:!0});new Float32Array(t.getMappedRange()).set(xa()(this,_r)),t.unmap();const i=Ka(this,Ar,Fr).call(this),a=Ka(this,yr,zr).call(this,e);for(const[e,t]of a)Ka(this,Pr,Zr).call(this,e,t,i);const r=Ka(this,kr,tn).call(this,xa()(this,ja)),n=Ka(this,Dr,Xr).call(this,0,r.createView(),xa()(this,Ja).getCurrentTexture().createView()),o=i.beginRenderPass(n);o.setVertexBuffer(0,t);for(const[e,t]of a)if(t&&0!=t.length)for(const e of t){e.unlock();if(e.getTextureLayerType()==yi.v.UNKNOWN)continue;let t=e.getUVCoords();if(!t)continue;let i=e.getUVCoordsBuffer();if(!i){const a=t.byteLength;i=xa()(this,tr).acquireBuffer(a,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,t.byteLength,!1,!0),e.setUVCoordsBuffer(i)}xa()(this,Za).queue.writeBuffer(i,0,t,0,t.length),o.setVertexBuffer(1,i);const a=xa()(this,ja).width,r=xa()(this,ja).height;let n=e.getViewport();if(!n||Number.isNaN(n.x)||Number.isNaN(n.y)||Number.isNaN(n.w)||Number.isNaN(n.h)||n.x<0||n.y<0||n.x+n.w>a||n.y+n.h>r)continue;const s=Ka(this,Mr,Jr).call(this,e,!0);if(!s)continue;o.setViewport(n.x,n.y,n.w,n.h,n.minDepth,n.maxDepth);const d=s.pipeline;o.setPipeline(d);const u=xa()(this,Za).createBindGroup({layout:d.getBindGroupLayout(0),entries:s.entries});o.setBindGroup(0,u),o.draw(6,1,0,0)}o.end(),Ka(this,Tr,Hr).call(this),e.forEach(e=>{e.markRenderingStatePending()})}function xr(e){if(!Array.isArray(e))return;let t=[];for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:null;const a=e.getTextureBufferGroup();if(!xa()(this,Za))return console.warn("[evalYuvTextureGroup] GPUDevice is not ready!"),a&&a.buffer&&a.buffer.unmap(),null;if(!t)return console.warn("[evalYuvTextureGroup] command encoder is invalid!"),a&&a.buffer&&a.buffer.unmap(),null;if(!a)return i||null;"unmapped"!=a.buffer.mapState&&a.buffer.unmap();let r=null,n=null,o=null;const s=e.getWidth(),d=e.getHeight(),u=null!=i&&(s!=i.yPlaneTex.width||d!=i.yPlaneTex.height);let l=!0;i&&(u?(xa()(this,za).destroyTextureGroup(e),l=!0):(r=i.yPlaneTex,n=i.uPlaneTex,o=i.vPlaneTex,l=!1));let c=!1,h="r8unorm";if(a&&a.bufferConfig&&"nv12"==a.bufferConfig.colorFormat&&(h="rg8unorm",c=!0),l){const t=e.getIndex(),i=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,a=xa()(this,ar).assembleTextureConfig(s,d,i,"r8unorm",1),u=xa()(this,ar).assembleTextureConfig(s/2,d/2,i,h,1);r=xa()(this,ar).acquireTexture(a),r&&(r.label="RD(".concat(t,")-YPlaneTexture")),c?(n=xa()(this,ar).acquireTexture(u),n&&(n.label="RD(".concat(t,")-UVPlaneTexture"))):(n=xa()(this,ar).acquireTexture(u),n&&(n.label="RD(".concat(t,")-UPlaneTexture")),o=xa()(this,ar).acquireTexture(u),o&&(o.label="RD(".concat(t,")-VPlaneTexture")))}t.copyBufferToTexture({buffer:a.buffer,offset:a.yPlaneBuffer.offset,bytesPerRow:a.yPlaneBuffer.bytesPerRow,rowsPerImage:a.yPlaneBuffer.rowsPerImage},{texture:r},[s,d,1]),t.copyBufferToTexture({buffer:a.buffer,offset:a.uPlaneBuffer.offset,bytesPerRow:a.uPlaneBuffer.bytesPerRow,rowsPerImage:a.uPlaneBuffer.rowsPerImage},{texture:n},[s/2,d/2,1]),a.vPlaneBuffer.offset>0&&!c&&t.copyBufferToTexture({buffer:a.buffer,offset:a.vPlaneBuffer.offset,bytesPerRow:a.vPlaneBuffer.bytesPerRow,rowsPerImage:a.vPlaneBuffer.rowsPerImage},{texture:o},[s/2,d/2,1]);let f={};return f.yPlaneTex=r,f.uPlaneTex=n,f.vPlaneTex=o,f}function Br(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const a=e.getTextureBufferGroup();if(!xa()(this,Za))return console.warn("[evalRgbaTexture] GPUDevice is not ready!"),a&&a.buffer&&a.buffer.unmap(),null;if(!t)return console.warn("[evalRgbaTexture] command encoder is invalid!"),a&&a.buffer&&a.buffer.unmap(),null;if(!a)return i||null;"unmapped"!=a.buffer.mapState&&a.buffer.unmap();const r=e.getIndex(),n=e.getWidth(),o=e.getHeight(),s=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let d=null;const u=null!=i&&(n!=i.width||o!=i.height);let l=!0;if(i&&(u?(xa()(this,za).destroyTextureGroup(e),l=!0):(d=i,l=!1)),l){const e=xa()(this,ar).assembleTextureConfig(n,o,s,"rgba8unorm",1);d=xa()(this,ar).acquireTexture(e),d&&(d.label="RD(".concat(r,")-rgbaTexture"))}return t.copyBufferToTexture({buffer:a.buffer,offset:0,bytesPerRow:a.bytesPerRow,rowsPerImage:a.rowsPerImage},{texture:d},[n,o,1]),d}function Gr(e,t){return Math.ceil(e/t)*t}function Fr(){return xa()(this,Za)?(xa()(this,er)||Ba()(this,er,xa()(this,Za).createCommandEncoder()),xa()(this,er)):(Object(Pi.h)("GPUDevice is not ready! No available command encoder."),null)}function Hr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;xa()(this,er)&&e?xa()(this,Za).queue.submit([xa()(this,er).finish(),e.finish()]):xa()(this,er)?xa()(this,Za).queue.submit([xa()(this,er).finish()]):e&&xa()(this,Za).queue.submit([e.finish()]),Ba()(this,er,null)}function Kr(e,t){if(!xa()(this,Za))return null;if(!xa()(this,hr)){let i=xa()(this,Za).createBindGroupLayout({label:"CursorTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});if(!i)return null;const a=xa()(this,Za).createPipelineLayout({label:"CursorTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[i]}),r={label:"CursorTexRenderPipeline(".concat(e,")"),layout:a,vertex:{module:xa()(this,Za).createShaderModule({code:yi.e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:yi.e}),entryPoint:"f_main",targets:[{format:xa()(this,$a),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(r.multisample={count:4}),Ba()(this,hr,xa()(this,Za).createRenderPipeline(r))}return xa()(this,hr)}function jr(e,t){if(!xa()(this,Za))return null;if(!xa()(this,cr)){let i=xa()(this,Za).createBindGroupLayout({label:"WatermarkTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}}]});if(!i)return null;const a=xa()(this,Za).createPipelineLayout({label:"WatermarkTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[i]}),r={label:"WatermarkTexRenderPipeline(".concat(e,")"),layout:a,vertex:{module:xa()(this,Za).createShaderModule({code:yi.B}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:yi.B}),entryPoint:"f_main",targets:[{format:xa()(this,$a),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(r.multisample={count:4}),Ba()(this,cr,xa()(this,Za).createRenderPipeline(r))}return xa()(this,cr)}function Yr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!xa()(this,Za)||!e)return null;if(!xa()(this,dr)){const i=xa()(this,Za).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),a={label:"YuvRenderPipeline",layout:xa()(this,Za).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[i]}),vertex:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:xa()(this,$a)}]},primitive:{topology:"triangle-list"}};t&&(a.multisample={count:4}),Ba()(this,dr,xa()(this,Za).createRenderPipeline(a))}return xa()(this,dr)}function qr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!xa()(this,Za)||!e)return null;if(!xa()(this,ur)){const i=xa()(this,Za).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),a={label:"YuvRenderPipeline",layout:xa()(this,Za).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[i]}),vertex:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:xa()(this,$a)}]},primitive:{topology:"triangle-list"}};t&&(a.multisample={count:4}),Ba()(this,ur,xa()(this,Za).createRenderPipeline(a))}return xa()(this,ur)}function Xr(e,t,i){return{label:"renderPass - ".concat(e),colorAttachments:[{view:t,resolveTarget:i,loadOp:"clear",storeOp:"discard"}]}}function Qr(e){return e&&(e.label="canvas-texture-view"),{label:"RenderPassNoMsaa",colorAttachments:[{view:e,loadOp:"clear",storeOp:"store"}]}}function zr(e){let t=new Map;for(let i=0;i1&&void 0!==arguments[1]&&arguments[1],i=null,a=null,r=null,n=null;const o=e.getZIndex(),s=e.getTextureType(),d=e.getColorFormat();if(o==yi.w.VS_BASE){if(s==yi.x.EXTERNAL_TEX){n=yi.l.VIDEO_FRAME,i=this.acquireVideoFrameRenderPipeline(yi.y,t),a=this.acquireVideoFrameSampler();const o=e.getPendingVideoFrame();if(!o||0==o.codedWidth||0==o.codedHeight||!o.format)return e.setPendingVideoFrame(null),null;const s=e.getUniformBuffer();if(!s)return null;r=[{binding:0,resource:a},{binding:1,resource:xa()(this,Za).importExternalTexture({source:o})},{binding:2,resource:{buffer:s}}]}else if(s==yi.x.CLEAR_COLOR){n=yi.l.CLEAR_COLOR,i=this.acquireClearColorRenderPipeline(yi.c);const t=e.getClearColorUniformBuffer();if(!t)return null;r=[{binding:0,resource:{buffer:t}}]}else if(s==yi.x.GPU_TEX_YUV){"i420"==d?(n=yi.l.YUV_I420,i=Ka(this,br,Yr).call(this,yi.z,t)):"nv12"==d&&(n=yi.l.YUV_NV12,i=Ka(this,Or,qr).call(this,yi.A,t)),a=this.acquireYuvTexturesSamplers();const o=e.getUniformBuffer();if(!o)return null;const s=e.getTextureGroup();s&&("i420"==d?r=[{binding:0,resource:a[0]},{binding:1,resource:a[1]},{binding:2,resource:s.yPlaneTex.createView()},{binding:3,resource:s.uPlaneTex.createView()},{binding:4,resource:s.vPlaneTex.createView()},{binding:5,resource:{buffer:o}},{binding:6,resource:{buffer:o}}]:"nv12"==d&&(r=[{binding:0,resource:a[0]},{binding:1,resource:a[1]},{binding:2,resource:s.yPlaneTex.createView()},{binding:3,resource:s.uPlaneTex.createView()},{binding:4,resource:{buffer:o}},{binding:5,resource:{buffer:o}}]))}}else if(o==yi.w.WATERMARK||o==yi.w.MASK){n=yi.l.RGBA_WATERMARK,i=Ka(this,Ir,jr).call(this,o,t),a=this.acquireBlendTextureSampler();const s=e.getTextureGroup();s&&(r=[{binding:0,resource:a},{binding:1,resource:s.createView()}])}else if(o==yi.w.CURSOR){n=yi.l.RGBA_CURSOR,i=Ka(this,Rr,Kr).call(this,o,t),a=this.acquireBlendTextureSampler();const s=e.getUniformBuffer();if(!s)return null;const d=e.getTextureGroup();d&&(r=[{binding:0,resource:a},{binding:1,resource:d.createView()},{binding:2,resource:{buffer:s}}])}if(n===yi.l.CLEAR_COLOR){if(!i||!r)return null}else if(!i||!a||!r||null==n)return null;const u={pipelineType:n,pipeline:i,entries:r};return u}function Zr(e,t,i){for(const a of t){const t=a.getTextureType();t!=yi.x.EXTERNAL_TEX&&t!=yi.x.CLEAR_COLOR&&(e==yi.w.VS_BASE?Ka(this,Nr,$r).call(this,a,i):e!=yi.w.CURSOR&&e!=yi.w.WATERMARK&&e!=yi.w.MASK||Ka(this,Vr,en).call(this,a,i))}}function $r(e,t){let i=e.getTextureGroup();i?e.isNew()&&(i=Ka(this,Sr,Wr).call(this,e,t,i),e.setIsNew(!1)):(i=Ka(this,Sr,Wr).call(this,e,t,null),e.setIsNew(!1)),i&&e.setTextureGroup(i)}function en(e,t){let i=e.getTextureGroup();i?e.isNew()&&(i=Ka(this,vr,Br).call(this,e,t,i),e.setIsNew(!1)):(i=Ka(this,vr,Br).call(this,e,t,null),e.setIsNew(!1)),i&&e.setTextureGroup(i)}function tn(e){if(!e||!xa()(this,Za))return xa()(this,pr)?xa()(this,pr):null;if(xa()(this,pr)){if(xa()(this,pr).width!=e.width||xa()(this,pr).height!=e.height){const t=xa()(this,ar).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,xa()(this,$a),4);Ba()(this,pr,xa()(this,ar).acquireTexture(t))}}else{const t=xa()(this,ar).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,xa()(this,$a),4);Ba()(this,pr,xa()(this,ar).acquireTexture(t))}return xa()(this,pr)}var an=class{constructor(e,t){if(Ga(this,kr),Ga(this,Vr),Ga(this,Nr),Ga(this,Pr),Ga(this,Mr),Ga(this,yr),Ga(this,wr),Ga(this,Dr),Ga(this,Or),Ga(this,br),Ga(this,Ir),Ga(this,Rr),Ga(this,Tr),Ga(this,Ar),Ga(this,Cr),Ga(this,vr),Ga(this,Sr),Ga(this,Er),Ga(this,gr),Ga(this,mr),Fa(this,ja,{writable:!0,value:null}),Fa(this,Ya,{writable:!0,value:0}),Fa(this,qa,{writable:!0,value:0}),Fa(this,Xa,{writable:!0,value:!1}),Fa(this,Qa,{writable:!0,value:!1}),Fa(this,za,{writable:!0,value:null}),Fa(this,Ja,{writable:!0,value:null}),Fa(this,Za,{writable:!0,value:null}),Fa(this,$a,{writable:!0,value:null}),Fa(this,er,{writable:!0,value:null}),Fa(this,tr,{writable:!0,value:null}),Fa(this,ir,{writable:!0,value:null}),Fa(this,ar,{writable:!0,value:null}),Fa(this,rr,{writable:!0,value:null}),Fa(this,nr,{writable:!0,value:null}),Fa(this,or,{writable:!0,value:null}),Fa(this,sr,{writable:!0,value:null}),Fa(this,dr,{writable:!0,value:null}),Fa(this,ur,{writable:!0,value:null}),Fa(this,lr,{writable:!0,value:null}),Fa(this,cr,{writable:!0,value:null}),Fa(this,hr,{writable:!0,value:null}),Fa(this,fr,{writable:!0,value:null}),Fa(this,pr,{writable:!0,value:null}),Fa(this,_r,{writable:!0,value:new Float32Array(12)}),!t)throw new Error("[WebGPURenderer] resMgr is an invalid param! ".concat(t));Ba()(this,ja,e),Ba()(this,za,t),this.initialize(e)}switchMsaa(e){Ba()(this,Qa,e)}isMsaaEnabled(){return xa()(this,Qa)}setCanvas(e){e&&Ba()(this,ja,e)}setDevice(e){e&&Ba()(this,Za,e)}setRenderArgs(e,t){Ba()(this,Ya,e||0),Ba()(this,qa,xa()(this,Ya)?3:t?4:6),Ba()(this,Xa,t||!1)}setTextureIndex(e){Ba()(this,Ya,e||0)}initialize(e){xa()(this,Za)||(Ba()(this,Za,xa()(this,za).acquireGPUDevice()),xa()(this,Za))?(xa()(this,$a)||Ba()(this,$a,xa()(this,za).acquireCanvasFormat()),xa()(this,tr)||Ba()(this,tr,xa()(this,za).acquireGPUBufferMgr()),xa()(this,ir)||Ba()(this,ir,xa()(this,za).acquireGPUBufferPool()),xa()(this,ar)||Ba()(this,ar,xa()(this,za).acquireGPUTextureMgr()),this.configureGPUContext(e),Ka(this,Er,xr).call(this,yi.b)):Object(Pi.h)("[WebGPURenderer] initialize() device is not ready!")}isGPUDeviceReady(){return null!=xa()(this,Za)}render(e){xa()(this,Qa)?Ka(this,gr,Lr).call(this,e):Ka(this,mr,Ur).call(this,e)}updateVertexCoords(e){Ka(this,Er,xr).call(this,e)}createRGBATexture(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;if(t<0)return Object(Pi.h)("[createRGBATexture] ".concat(t," is an invalid index!")),null;if(!xa()(this,tr))return console.warn("[createRGBATexture] buffer manager is not ready!"),null;if(!xa()(this,Za))return console.warn("[createRGBATexture] GPUDevice is not ready!"),null;if(null==r||void 0===r)return console.warn("[createRGBATexture] rgbaData is invalid!"),null;if(!e)return console.warn("[createRGBATexture] command encoder is invalid!"),null;const o=Ka(this,Cr,Gr).call(this,Uint32Array.BYTES_PER_ELEMENT*i,256),s=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,d=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let u=null;const l=null!=n&&(i!=n.width||a!=n.height);let c=!0;if(n&&(l?(xa()(this,ar).recycleTexture(n),c=!0):(u=n,c=!1)),c){const e=xa()(this,ar).assembleTextureConfig(i,a,d,"rgba8unorm",1);u=xa()(this,ar).acquireTexture(e),u&&(u.label="RD(".concat(t,")-rgbaTexture"))}const h=xa()(this,tr).acquireBuffer("".concat(t,"_Y"),s,o*a,!0,!1),f=new Uint8Array(h.getMappedRange()),p=i*Uint32Array.BYTES_PER_ELEMENT;for(let e=0;e=f.length)return console.error("[WebGPURenderer] write yPlane is out of range! yPlaneOffset=".concat(0,", yPlane.height=").concat(i.height,", yPlaneBytesPerRow=").concat(n,", mappedArray.len=").concat(f.length)),null;for(let e=0;ef.length)return null;for(let e=0;e0){if(u+r.height*s>f.length)return null;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:null;if(!xa()(this,Za))return Object(Pi.h)("writeUniformBuffer() GPUDevice is not ready yet."),null;if(!t||0==t.length)return null;let a=i;return a||(a=xa()(this,Za).createBuffer({label:e,size:t.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),xa()(this,Za).queue.writeBuffer(a,0,t,0,t.length),a}acquireBlendTextureSampler(){return xa()(this,Za)?(xa()(this,fr)||Ba()(this,fr,xa()(this,Za).createSampler({})),xa()(this,fr)):null}configureGPUContext(e){xa()(this,Ja)||(Ba()(this,Ja,e.getContext("webgpu")),xa()(this,Ja)?xa()(this,Ja).configure({device:xa()(this,Za),format:xa()(this,$a),alphaMode:"premultiplied"}):Object(Pi.h)("configureGPUContext() webgpuContext is invalid! canvas=".concat(e)))}unconfigureGPUContext(){xa()(this,Ja)&&(xa()(this,Ja).unconfigure(),Ba()(this,Ja,null))}acquireVideoFrameRenderPipeline(e,t){if(!xa()(this,Za)||!e)return null;if(!xa()(this,nr)){const i=xa()(this,Za).createBindGroupLayout({label:"VideoFrameBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),a={label:"VideoFrameRenderPipeline",layout:xa()(this,Za).createPipelineLayout({label:"VideoFramePipelineLayout",bindGroupLayouts:[i]}),vertex:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:xa()(this,$a)}]},primitive:{topology:"triangle-list"}};t&&(a.multisample={count:4}),Ba()(this,nr,xa()(this,Za).createRenderPipeline(a))}return xa()(this,nr)}acquireClearColorRenderPipeline(e){if(!xa()(this,Za)||!e)return null;if(!xa()(this,or)){const t=xa()(this,Za).createBindGroupLayout({label:"ClearColorBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),i={label:"ClearColorRenderPipeline",layout:xa()(this,Za).createPipelineLayout({label:"ClearColorPipelineLayout",bindGroupLayouts:[t]}),vertex:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:e}),entryPoint:"f_main",targets:[{format:xa()(this,$a)}]},primitive:{topology:"triangle-list"}};Ba()(this,or,xa()(this,Za).createRenderPipeline(i))}return xa()(this,or)}acquireVideoFrameSampler(){return xa()(this,Za)?(xa()(this,sr)||Ba()(this,sr,xa()(this,Za).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"})),xa()(this,sr)):null}acquireYuvTexturesSamplers(){if(!xa()(this,Za))return null;if(!xa()(this,lr)){Ba()(this,lr,[]);const e=xa()(this,Za).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"}),t=xa()(this,Za).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"});xa()(this,lr).push(e),xa()(this,lr).push(t)}return xa()(this,lr)}clearAttachedCanvas(){if(!xa()(this,Za)||!xa()(this,Ja)||!xa()(this,rr))return;if(!xa()(this,ja)||0==xa()(this,ja).width||0==xa()(this,ja).height)return;const e=xa()(this,Za).createCommandEncoder(),t=e.beginRenderPass({colorAttachments:[{view:xa()(this,Ja).getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),i=xa()(this,Za).createRenderPipeline({layout:"auto",vertex:{module:xa()(this,Za).createShaderModule({code:yi.d}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:xa()(this,Za).createShaderModule({code:yi.d}),entryPoint:"f_main",targets:[{format:xa()(this,$a)}]},primitive:{topology:"triangle-list"}});t.setVertexBuffer(0,xa()(this,rr)),t.setPipeline(i),t.draw(6),t.end(),xa()(this,Za).queue.submit([e.finish()])}clear(){console.log("WebGPURender.clear")}cleanup(){this.unconfigureGPUContext(),Ba()(this,ja,null),Ba()(this,$a,null),Ba()(this,er,null),Ba()(this,rr,null),Ba()(this,nr,null),Ba()(this,or,null),Ba()(this,sr,null),Ba()(this,dr,null),Ba()(this,ur,null),Ba()(this,lr,null),Ba()(this,cr,null),Ba()(this,hr,null),Ba()(this,fr,null),Ba()(this,pr,null),xa()(this,tr)&&Ba()(this,tr,null),xa()(this,Za)&&Ba()(this,Za,null)}};function rn(e,t){on(e,t),t.add(e)}function nn(e,t,i){on(e,t),t.set(e,i)}function on(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function sn(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var dn=new WeakMap,un=new WeakMap,ln=new WeakMap,cn=new WeakMap,hn=new WeakSet,fn=new WeakSet,pn=new WeakSet,_n=new WeakSet,mn=new WeakSet;function gn(){return!0}function En(){if(xa()(this,ln)){let e={};return e.architecture=xa()(this,ln).architecture,e.vendor=xa()(this,ln).vendor,e}return null}async function Sn(){if(!navigator.gpu)return Ba()(this,dn,yi.C.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();if(!e)return Ba()(this,dn,yi.C.CANNOT_REQ_ADAPTER),!1;return await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(Ba()(this,ln,await e.requestAdapterInfo()),xa()(this,ln)&&console.log("adapter info: ".concat(xa()(this,ln).architecture,", ").concat(xa()(this,ln).vendor))):"info"in e&&Ba()(this,ln,e.info),Ba()(this,dn,yi.C.AVAILABLE),!0):(Ba()(this,dn,yi.C.CANNOT_REQ_DEVICE),!1)}function vn(e){if(!e)return!1;const t=e.vendor;return-1!==yi.g.indexOf(t)}function Cn(e,t,i){return class{static produce(e,t,i){let a=null;return e===yi.j.WEBGPU&&(a=new an(t,i)),a}}.produce(e,t,i)}var An=class{constructor(){rn(this,mn),rn(this,_n),rn(this,pn),rn(this,fn),rn(this,hn),nn(this,dn,{writable:!0,value:yi.C.AVAILABLE}),nn(this,un,{writable:!0,value:yi.j.WEBGL}),nn(this,ln,{writable:!0,value:null}),nn(this,cn,{writable:!0,value:new Map})}async evaluate(e){Ba()(this,un,yi.j.WEBGL);if(!sn(this,hn,gn).call(this))return xa()(this,un);if(!e.allowedOnTargetPlatforms)return xa()(this,un);if(!e.allowedOnTargetBrowsers)return xa()(this,un);if(!await sn(this,pn,Sn).call(this))return xa()(this,un);const t=sn(this,fn,En).call(this);if(!sn(this,_n,vn).call(this,t))return xa()(this,un);let i=new OffscreenCanvas(1,1);return i.getContext("webgpu")?(i=null,Ba()(this,un,yi.j.WEBGPU),xa()(this,un)):(i=null,xa()(this,un))}acquireRenderer(e,t){let i=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&xa()(this,cn).clear(),xa()(this,cn).has(e)&&(i=xa()(this,cn).get(e),i&&(e&&(i.setCanvas(e),i.initialize(e)),t&&i.setDevice(t.acquireGPUDevice()))),null==i&&(i=sn(this,mn,Cn).call(this,xa()(this,un),e,t),i&&xa()(this,cn).set(e,i)),i}rendererReinitialize(){if(xa()(this,cn))for(const[e,t]of xa()(this,cn))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(xa()(this,cn))for(const[e,t]of xa()(this,cn))t&&t.unconfigureGPUContext()}getRendererType(){return xa()(this,un)}setRendererType(e){Ba()(this,un,e)}isWebGPURendererType(){return xa()(this,un)===yi.j.WEBGPU}isWebGLRendererType(){return xa()(this,un)===yi.j.WEBGL}isWebGL2RendererType(){return xa()(this,un)===yi.j.WEBGL_2}cleanup(){for(const[e,t]of xa()(this,cn))t&&t.cleanup();xa()(this,cn).clear()}};function Tn(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function Rn(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var In=new WeakSet,bn=new WeakSet;function On(e){e.forEach(e=>{e.consumePendingGPUEvents()})}function Dn(e){if(!e||0==e.length)return!0;return-1==e.findIndex(e=>{if(!e)return!1;return!!e.getTextureLayerByZIndex(yi.w.VS_BASE)&&e.isRenderingStateReady()})}var wn=class{constructor(){Tn(this,bn),Tn(this,In)}render(e,t){return e?e.isGPUDeviceReady()?t&&0!=t.length?(Rn(this,In,On).call(this,t),void(Rn(this,bn,Dn).call(this,t)||e.render(t))):(console.warn("[RendererController] render displays are not available!"),void Object(Pi.d)("WGPU RendererController_render() displays are not available!")):(console.log("[RendererController] GPU device is not ready!"),void Object(Pi.d)("WGPU RendererController_render() GPU device is not ready!")):(console.warn("[RendererController] renderer is not attached!"),void Object(Pi.d)("WGPU RendererController_render() renderer is not attached!"))}};function yn(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var Mn=new WeakMap,Pn=new WeakMap,Nn=new WeakMap,Vn=new WeakMap,kn=new WeakMap,Un=new WeakMap,Ln=new WeakMap,xn=new WeakMap,Wn=new WeakMap,Bn=new WeakMap,Gn=new WeakMap,Fn=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,jn=new WeakMap,Yn=new WeakMap,qn=new WeakMap,Xn=new WeakMap;var Qn=class{constructor(e,t){yn(this,Mn,{writable:!0,value:0}),yn(this,Pn,{writable:!0,value:-1}),yn(this,Nn,{writable:!0,value:0}),yn(this,Vn,{writable:!0,value:0}),yn(this,kn,{writable:!0,value:-1}),yn(this,Un,{writable:!0,value:null}),yn(this,Ln,{writable:!0,value:-1}),yn(this,xn,{writable:!0,value:null}),yn(this,Wn,{writable:!0,value:null}),yn(this,Bn,{writable:!0,value:null}),yn(this,Gn,{writable:!0,value:!1}),yn(this,Fn,{writable:!0,value:null}),yn(this,Hn,{writable:!0,value:null}),yn(this,Kn,{writable:!0,value:null}),yn(this,jn,{writable:!0,value:null}),yn(this,Yn,{writable:!0,value:null}),yn(this,qn,{writable:!0,value:!1}),yn(this,Xn,{writable:!0,value:""}),Ba()(this,Mn,e),Ba()(this,Pn,t)}getIndex(){return xa()(this,Mn)}lock(){Ba()(this,Gn,!0)}unlock(){Ba()(this,Gn,!1)}isLocked(){return xa()(this,Gn)}getZIndex(){return xa()(this,Pn)}setWidth(e){Ba()(this,Nn,e)}setHeight(e){Ba()(this,Vn,e)}getWidth(){return xa()(this,Nn)}getHeight(){return xa()(this,Vn)}getRawData(){return xa()(this,Un)}setRawData(e){Ba()(this,Un,e)}setIsNew(e){Ba()(this,qn,e)}isNew(){return xa()(this,qn)}setColorFormat(e){Ba()(this,Xn,e)}getColorFormat(){return xa()(this,Xn)}setPendingVideoFrame(e){xa()(this,Fn)&&(xa()(this,Fn).close(),Ba()(this,Fn,null)),Ba()(this,Fn,e)}clearPendingVideoFrame(){xa()(this,Fn)&&(xa()(this,Fn).close(),Ba()(this,Fn,null))}setTextureLayerType(e){Ba()(this,kn,e)}getTextureLayerType(){return xa()(this,kn)}setTextureType(e){Ba()(this,Ln,e)}getTextureType(){return xa()(this,Ln)}getPendingVideoFrame(){return xa()(this,Fn)}getUVCoords(){return xa()(this,Wn)}setUVCoords(e){Ba()(this,Wn,e)}getUVCoordsBuffer(){return xa()(this,jn)}setUVCoordsBuffer(e){Ba()(this,jn,e)}evalViewport(e,t,i,a,r){xa()(this,Bn)||Ba()(this,Bn,{}),xa()(this,Bn).x=Math.floor(e),xa()(this,Bn).w=Math.floor(i),xa()(this,Bn).h=Math.floor(a),xa()(this,kn)==yi.v.BASE_LAYER?xa()(this,Bn).y=Math.floor(r-(t+a)):xa()(this,Bn).y=Math.floor(t),xa()(this,Bn).x<0&&(xa()(this,Bn).x=0),xa()(this,Bn).y<0&&(xa()(this,Bn).y=0),xa()(this,Bn).minDepth=0,xa()(this,Bn).maxDepth=1}setViewport(e){Ba()(this,Bn,e)}getViewport(){return xa()(this,Bn)}getTextureGroup(){return xa()(this,xn)}setTextureGroup(e){Ba()(this,xn,e)}setUniformBuffer(e){Ba()(this,Hn,e)}getUniformBuffer(){return xa()(this,Hn)}setClearColorUniformBuffer(e){Ba()(this,Kn,e)}getClearColorUniformBuffer(){return xa()(this,Kn)}setTextureBufferGroup(e){Ba()(this,Yn,e)}getTextureBufferGroup(){return xa()(this,Yn)}destroyTextureBufferGroup(){xa()(this,Yn)&&Ba()(this,Yn,null)}recycle(e){this.destroyTextureBufferGroup(),e&&e.destroyTextureGroup(this),xa()(this,Fn)&&(xa()(this,Fn).close(),Ba()(this,Fn,null)),xa()(this,Hn)&&(xa()(this,Hn).destroy(),Ba()(this,Hn,null)),xa()(this,Kn)&&(xa()(this,Kn).destroy(),Ba()(this,Kn,null)),Ba()(this,Mn,-1),Ba()(this,Pn,-1),Ba()(this,kn,yi.v.UNKNOWN),Ba()(this,Un,null),Ba()(this,Ln,yi.x.UNKNOWN),Ba()(this,Wn,null),Ba()(this,Bn,null),Ba()(this,Gn,!1),Ba()(this,qn,!1),Ba()(this,Xn,"")}};function zn(e,t){Zn(e,t),t.add(e)}function Jn(e,t,i){Zn(e,t),t.set(e,i)}function Zn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $n(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var eo=new WeakMap,to=new WeakMap,io=new WeakMap,ao=new WeakMap,ro=new WeakMap,no=new WeakMap,oo=new WeakMap,so=new WeakMap,uo=new WeakMap,lo=new WeakMap,co=new WeakMap,ho=new WeakMap,fo=new WeakMap,po=new WeakMap,_o=new WeakMap,mo=new WeakMap,go=new WeakMap,Eo=new WeakMap,So=new WeakMap,vo=new WeakMap,Co=new WeakMap,Ao=new WeakMap,To=new WeakMap,Ro=new WeakMap,Io=new WeakMap,bo=new WeakMap,Oo=new WeakMap,Do=new WeakMap,wo=new WeakMap,yo=new WeakMap,Mo=new WeakMap,Po=new WeakMap,No=new WeakMap,Vo=new WeakMap,ko=new WeakMap,Uo=new WeakMap,Lo=new WeakMap,xo=new WeakMap,Wo=new WeakMap,Bo=new WeakMap,Go=new WeakSet,Fo=new WeakSet,Ho=new WeakSet,Ko=new WeakSet,jo=new WeakSet,Yo=new WeakSet,qo=new WeakSet,Xo=new WeakSet,Qo=new WeakSet,zo=new WeakSet,Jo=new WeakSet,Zo=new WeakSet,$o=new WeakSet,es=new WeakSet,ts=new WeakSet,is=new WeakSet,as=new WeakSet,rs=new WeakSet,ns=new WeakSet,os=new WeakSet,ss=new WeakSet,ds=new WeakSet,us=new WeakSet,ls=new WeakSet,cs=new WeakSet,hs=new WeakSet,fs=new WeakSet,ps=new WeakSet,_s=new WeakSet,ms=new WeakSet;function gs(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if($n(this,Zo,Ds).call(this),!xa()(this,po)||!xa()(this,_o)||!xa()(this,po).isGPUDeviceReady())return void(i instanceof VideoFrame&&i.close());const r=yi.w.VS_BASE,n=$n(this,es,ys).call(this,r),o=n.isLocked();if(o){const r=n.getPendingVideoFrame();!r||r.codedWidth==e&&r.codedHeight==t?i instanceof VideoFrame&&i.close():i instanceof VideoFrame?n.setPendingVideoFrame(i):(a&&$n(this,Ho,Ss).call(this,n,e,t,i),Object(Pi.h)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!"))}else{if(i instanceof VideoFrame){n.getPendingVideoFrame()!=i&&n.setPendingVideoFrame(i)}else a&&$n(this,Ho,Ss).call(this,n,e,t,i),Object(Pi.h)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!");n.setTextureLayerType(yi.v.BASE_LAYER),n.setTextureType(yi.x.EXTERNAL_TEX),n.lock()}this.markRenderingStateReady()}function Es(e,t,i,a,r,n){$n(this,Zo,Ds).call(this);const o=yi.w.VS_BASE,s=$n(this,es,ys).call(this,o);if(s.setTextureLayerType(yi.v.BASE_LAYER),s.setTextureType(yi.x.GPU_TEX_YUV),s.clearPendingVideoFrame(),s.isLocked()){const e=s.getWidth(),a=s.getHeight();e==t&&a==i||(s.setWidth(t),s.setHeight(i),s.setIsNew(!0))}else s.setWidth(t),s.setHeight(i),s.setIsNew(!0),s.lock();const d=$n(this,ls,Bs).call(this,a,t,i,n),u=xa()(this,po).writeToYuvTexturesBufferGroup(d,r);s.setTextureBufferGroup(u)}function Ss(e,t,i,a){const r=$n(this,hs,Fs).call(this,t,i);r.label="RgbaTexBuffer(".concat(e.getIndex(),")-").concat(r.size);let n=e.getTextureBufferGroup();if(n=$n(this,fs,Hs).call(this,e,n,r),!n||!n.buffer)return console.warn("[updateRgbaBaseTexLayer()] texLayer(".concat(e.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();$n(this,Yo,As).call(this,xa()(this,eo),t,i,a,n),this.markRenderingStateReady()}function vs(e,t,i,a,r){const n=yi.w.CURSOR,o=$n(this,es,ys).call(this,n);if(o.setTextureLayerType(yi.v.BLEND_LAYER),o.setTextureType(yi.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),a=o.getHeight();e==t&&a==i||(o.setWidth(t),o.setHeight(i),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(i),o.setIsNew(!0),o.lock();const s=xa()(this,po).writeToRgbaTextureBuffer(e,t,i,a,r);o.setTextureBufferGroup(s)}function Cs(e,t,i,a,r){const n=yi.w.WATERMARK,o=$n(this,es,ys).call(this,n);if(o.setTextureLayerType(yi.v.BLEND_LAYER),o.setTextureType(yi.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),a=o.getHeight();e==t&&a==i||(o.setWidth(t),o.setHeight(i),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(i),o.setIsNew(!0),o.lock();const s=xa()(this,po).writeToRgbaTextureBuffer(e,t,i,a,r);o.setTextureBufferGroup(s)}function As(e,t,i,a,r){const n=yi.w.VS_BASE,o=$n(this,es,ys).call(this,n);if(o.setTextureLayerType(yi.v.BASE_LAYER),o.setTextureType(yi.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),a=o.getHeight();e==t&&a==i||(o.setWidth(t),o.setHeight(i),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(i),o.setIsNew(!0),o.lock();const s=xa()(this,po).writeToRgbaTextureBuffer(e,t,i,a,r);o.setTextureBufferGroup(s)}function Ts(e,t,i){if(!$n(this,_s,js).call(this,e))return;if(!xa()(this,_o))return void console.log("drawVideoFrameBaseTextureLayer() canvas is invalid? canvas=".concat(xa()(this,_o)));const a=yi.w.VS_BASE,r=$n(this,es,ys).call(this,a);let n=r.getUVCoords(),o=$n(this,Qo,Is).call(this,xa()(this,ao),xa()(this,ro),xa()(this,io),xa()(this,uo),i,e.width,e.height);n||(n=new Float32Array(12)),n.set(o,0),r.setUVCoords(n);const s=xa()(this,io).width>xa()(this,io).height,d=xa()(this,_o).width>e.width,u=xa()(this,_o).height>e.height;let l=d?e.width:xa()(this,_o).width,c=u?e.height:xa()(this,_o).height;if(s){const i=Math.abs(t.left)*l,a=Math.abs(t.top)*c,n=e.x+(e.width-i)/2;let o=0;o=e.y>=0?e.y+(e.height-a)/2:0,r.evalViewport(n,o,i,a,xa()(this,_o).height)}else{let t=e.height*xa()(this,io).width/xa()(this,io).height;t>e.width&&(t=e.width);let i=xa()(this,io).height/xa()(this,io).width*t;const a=e.x+e.width/2-t/2;let n=0;if(e.y>0)n=e.y+(e.height-i)/2;else if(0===e.y){n=e.height>i?(e.height-i)/2:0}else n=0;r.evalViewport(a,n,t,i,xa()(this,_o).height)}const h=$n(this,is,Ps).call(this);h&&h.buffer&&r.setUniformBuffer(h.buffer)}function Rs(e,t,i){const a=yi.w.VS_BASE,r=$n(this,es,ys).call(this,a);let n=r.getUVCoords(),o=$n(this,Qo,Is).call(this,xa()(this,ao),xa()(this,ro),xa()(this,io),xa()(this,uo),i,e.width,e.height);n||(n=new Float32Array(12)),n.set(o,0),r.setUVCoords(n);const s=xa()(this,io).width>xa()(this,io).height,d=xa()(this,_o).width>e.width,u=xa()(this,_o).height>e.height;let l=d?e.width:xa()(this,_o).width,c=u?e.height:xa()(this,_o).height;if(s){const i=Math.abs(t.left)*l,a=Math.abs(t.top)*c,n=e.x+(e.width-i)/2;let o=0;o=e.y>=0?e.y+(e.height-a)/2:0,r.evalViewport(n,o,i,a,xa()(this,_o).height)}else{let t=e.height*xa()(this,io).width/xa()(this,io).height;t>e.width&&(t=e.width);let i=xa()(this,io).height/xa()(this,io).width*t;const a=e.x+e.width/2-t/2;let n=0;if(e.y>0)n=e.y+(e.height-i)/2;else if(0===e.y){n=e.height>i?(e.height-i)/2:0}else n=0;r.evalViewport(a,n,t,i,xa()(this,_o).height)}let h=null;h=r.getTextureType()==yi.x.EXTERNAL_TEX?$n(this,is,Ps).call(this):$n(this,as,Ns).call(this,xa()(this,uo)),h&&h.buffer&&r.setUniformBuffer(h.buffer)}function Is(e,t,i,a,r,n,o){const s=this.isUseFillMode({w:i.width,h:i.height,rotation:a}),d={width:n,height:o},u={width:e,height:t};return Object(Yi.c)(s,d,u,i,a,r)}function bs(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=e.width,o=e.height;r&&(n=r.width,o=r.height);let s,d,u,l,c=a==yi.s||a==yi.r?i:t,h=a==yi.s||a==yi.r?t:i,f=c/h*o,p=h/c*n;f>n?(s=0,u=1,d=(o-p)/2/o,l=1-d):(d=0,l=1,s=(n-f)/2/n,u=1-s),s=2*s-1,u=2*u-1,d=1-2*d,l=1-2*l;let _=[{x:u,y:d},{x:u,y:l},{x:s,y:l},{x:u,y:d},{x:s,y:d},{x:s,y:l}];xa()(this,po)&&xa()(this,po).updateVertexCoords(_)}function Os(e,t,i,a,r){var n,o,s,d;if(this.isUseFillMode({w:i,h:a,rotation:r}))n=0,o=0,s=1,d=1;else{var u=r==yi.s||r==yi.r?a:i,l=r==yi.s||r==yi.r?i:a,c=u/l*t;c>e?(n=0,s=1,d=1-(o=(t-l/u*e)/2/t)):(o=0,d=1,s=1-(n=(e-c)/2/e))}return{top:o=1-2*o,left:n=2*n-1,right:s=2*s-1,bottom:d=1-2*d}}function Ds(){xa()(this,po)||Object(Pi.h)("[WebGPURenderDisplay] renderer is not attached!")}function ws(e){if(e<0)throw new Error("[hasZIndexTexLayer] ".concat(e," is an invalid parameter!"));return xa()(this,Wo).has(e)}function ys(e){let t=null;return $n(this,$o,ws).call(this,e)?t=xa()(this,Wo).get(e):(t=new Qn(xa()(this,eo),e),xa()(this,Wo).set(e,t)),t}function Ms(e,t,i){xa()(this,_o)&&(Ba()(this,yo,e),Ba()(this,Vo,e&&i===o.VIDEO_BGRA?1:0),Ba()(this,ko,t),e||Ba()(this,Mo,i))}function Ps(){const e={rotation:xa()(this,uo)};let t=null,i=xa()(this,xo).get(yi.w.VS_BASE);if(i){let a=i.buffer,r=i.uniform;if(r)if("yuvMode"in r)a&&a.destroy(),i=null;else if("rotation"in r){if(r.rotation!=e.rotation){const i=$n(this,os,Us).call(this,e);t=xa()(this,po).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),i,a)}}else a&&a.destroy(),i=null}if(!i){const i=$n(this,os,Us).call(this,e);t=xa()(this,po).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),i)}return t?(i||(i={}),i.uniform=e,i.buffer=t,xa()(this,xo).set(yi.w.VS_BASE,i),i):null}function Ns(e){if(-1==xa()(this,Po))return null;const t={yuvMode:o.VIDEO_I420,colorRange:xa()(this,Po),rotation:e};let i=null,a=xa()(this,xo).get(yi.w.VS_BASE);if(a){const e=a.uniform;if(i=a.buffer,e.yuvMode!=t.yuvMode||e.colorRange!=t.colorRange||e.rotation!=t.rotation){const e=$n(this,ss,Ls).call(this,t);i=xa()(this,po).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),e,i)}}else{a={};const e=$n(this,ss,Ls).call(this,t);i=xa()(this,po).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),e)}return i?(a.uniform=t,a.buffer=i,xa()(this,xo).set(yi.w.VS_BASE,a),a):null}function Vs(){if(!xa()(this,Lo))return null;const e={cursorFlag:xa()(this,ko),cursorInfo:xa()(this,Lo)};let t=null,i=xa()(this,xo).get(yi.w.CURSOR);if(i){const a=i.uniform;if(t=i.buffer,a.cursorFlag!=e.cursorFlag||a.cursorInfo!=e.cursorInfo){const i=$n(this,ds,xs).call(this,e);t=xa()(this,po).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),i,t)}}else{i={};const a=$n(this,ds,xs).call(this,e);t=xa()(this,po).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(xa()(this,eo),")"),a)}return t?(i.uniform=e,i.buffer=t,xa()(this,xo).set(yi.w.CURSOR,i),i):null}function ks(e,t){return Math.ceil(e/t)*t}function Us(e){const t=$n(this,ns,ks).call(this,1*Float32Array.BYTES_PER_ELEMENT,16),i=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return i[0]=e.rotation,i}function Ls(e){const t=$n(this,ns,ks).call(this,3*Float32Array.BYTES_PER_ELEMENT,16),i=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return i[0]=e.yuvMode,i[1]=e.colorRange,i[2]=e.rotation,i}function xs(e){const t=$n(this,ns,ks).call(this,5*Float32Array.BYTES_PER_ELEMENT,16),i=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return i[0]=e.cursorFlag,i[1]=e.cursorInfo.x,i[2]=e.cursorInfo.y,i[3]=e.cursorInfo.w,i[4]=e.cursorInfo.h,i}function Ws(e){if(!e||0==e.length)return null;const t=$n(this,ns,ks).call(this,4*Float32Array.BYTES_PER_ELEMENT,16),i=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i}function Bs(e,t,i,a){let r=t*i,n=e.subarray(0,r),s=0,d=0;a==o.VIDEO_I420?(d=t/2*i/2,s=d):a==o.VIDEO_NV12&&(d=t*i/2,s=0);let u=e.subarray(r,r+d);return{yPlane:{buffer:n,width:t,height:i},crPlane:{buffer:0!=s?e.subarray(r+d,r+d+s):null,width:t/2,height:i/2},cbPlane:{buffer:u,width:t/2,height:i/2}}}function Gs(e,t,i){let a="",r=0,n=0,s=0;i==o.VIDEO_I420?(r=e/2*t/2,n=r,a="i420",s=Uint8Array.BYTES_PER_ELEMENT):i==o.VIDEO_NV12&&(r=e*t/2,n=0,a="nv12",s=Uint16Array.BYTES_PER_ELEMENT);const d=$n(this,ns,ks).call(this,Uint8Array.BYTES_PER_ELEMENT*e,256),u=$n(this,ns,ks).call(this,s*e/2,256);let l=d*t+u*t/2;n>0&&(l+=u*t/2);return{colorFormat:a,size:l,yPlane:{width:d,height:t},uvPlane:{width:u,height:t/2}}}function Fs(e,t){const i=$n(this,ns,ks).call(this,Uint32Array.BYTES_PER_ELEMENT*e,256);return{colorFormat:"rgba",width:i,height:t,size:i*t}}function Hs(e,t,i){if(t)if(t.buffer)if(i.size>t.buffer.size)xa()(this,wo).recycleTextureBufferGroup(e),t.buffer=xa()(this,wo).requestTextureBuffer(i),t.bufferConfig=i;else{"mapped"==t.buffer.mapState?t.bufferArray&&t.bufferArray.byteLength1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!$n(this,_s,js).call(this,e))return;$n(this,Zo,Ds).call(this),$n(this,ts,Ms).call(this,1,xa()(this,Oo),xa()(this,lo));let a=null;a=t?$n(this,Jo,Os).call(this,e.width,e.height,e.width,e.height,yi.p):$n(this,Jo,Os).call(this,e.width,e.height,xa()(this,io).width,xa()(this,io).height,xa()(this,uo)),$n(this,qo,Ts).call(this,e,a,i)}drawRemoteVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!xa()(this,_o))return;if(!$n(this,_s,js).call(this,e))return;$n(this,Zo,Ds).call(this);const i=this.isRgbaMode(xa()(this,lo))?1:0;$n(this,ts,Ms).call(this,i,xa()(this,Oo),xa()(this,lo));const a=$n(this,Jo,Os).call(this,e.width,e.height,xa()(this,io).width,xa()(this,io).height,xa()(this,uo));$n(this,Xo,Rs).call(this,e,a,t)}drawCursor(e,t,i,a,r){if(!xa()(this,Ro)||e&&(a<0||r<0))return;const n=yi.w.CURSOR,o=$n(this,es,ys).call(this,n),s=$n(this,es,ys).call(this,yi.w.VS_BASE);if(o.setUVCoords(s.getUVCoords()),o.evalViewport(t,i,a,r,xa()(this,_o).height),e&&xa()(this,Oo)){const e={x:t/xa()(this,io).width,y:i/xa()(this,io).height,w:a/xa()(this,io).width,h:r/xa()(this,io).height};Ba()(this,Lo,e)}else{const e={x:0,y:0,w:0,h:0};Ba()(this,Lo,e)}const d=$n(this,rs,Vs).call(this);d&&d.buffer&&o.setUniformBuffer(d.buffer)}setMultiView(e){Ba()(this,mo,e)}setFillMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Ba()(this,co,e),Ba()(this,ho,t)}getFillMode(){return xa()(this,co)}setColorRange(e){Ba()(this,Po,e)}getFillModeForResolution(){return xa()(this,ho)}getTextureIndex(){return xa()(this,to)}isUseFillMode(e){let{w:t,h:i,rotation:a}=e;if(!xa()(this,co))return!1;if(!xa()(this,ho))return!0;if(!t||!i)return!1;const r=a===yi.s||a===yi.s?i/t:t/i;return(Array.isArray(xa()(this,ho))?xa()(this,ho):[xa()(this,ho)]).some(e=>Math.abs(r-e)<.01)}setVideoMode(e){Ba()(this,lo,e)}getVideoMode(){return xa()(this,lo)}setWatermarkFlag(e){Ba()(this,go,e),e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))}setWatermarkRepeated(e){Ba()(this,Eo,e)}isWatermarkRepeated(){return!!xa()(this,Eo)}setWatermarkOpacity(e){Ba()(this,So,e||.15)}getWatermarkOpacity(){return xa()(this,So)}setWatermarkPosition(e){Ba()(this,vo,e||16)}getWatermarkPosition(){return xa()(this,vo)}isSetWatermark(){return xa()(this,go)}isRgbaMode(e){return-1!==[o.VIDEO_RGBA,o.VIDEO_BGRA].indexOf(e)}getTextureWidth(){return xa()(this,ao)}getTextureHeight(){return xa()(this,ro)}getCroppingParams(){return xa()(this,io)}recoverTextures(){}updateWatermark(e,t,i){const a=yi.w.WATERMARK,r=$n(this,es,ys).call(this,a);if(!xa()(this,_o)||!xa()(this,po))return $n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!i||i.length!=e*t*4)return xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();if(Object(Yi.g)(xa()(this,wo),e,t))return xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();if(Ba()(this,Co,e),Ba()(this,Ao,t),Ba()(this,go,1),Ba()(this,No,1),!$n(this,$o,ws).call(this,yi.w.VS_BASE)){console.log("[updateWatermark] base layer is not ready, set data to the texture layer for creating texture later."),xa()(this,wo).recycleTextureBufferGroup(r),this.markRenderingStatePending();const a={index:xa()(this,eo),width:e,height:t,data:i};return void r.setRawData(a)}const n=$n(this,es,ys).call(this,yi.w.VS_BASE).getViewport();if(n)try{const a=$n(this,hs,Fs).call(this,e,t);a.label="WatermarkTexBuffer(".concat(r.getIndex(),")-").concat(a.size);let o=r.getTextureBufferGroup();if(o=$n(this,fs,Hs).call(this,r,o,a),!o||!o.buffer)return console.warn("[updateWatermark()] texLayer(".concat(r.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();$n(this,jo,Cs).call(this,xa()(this,eo),e,t,i,o),n&&r.setViewport(n);let s=r.getUVCoords(),d=$n(this,ps,Ks).call(this);s||(s=new Float32Array(12)),s.set(d,0),r.setUVCoords(s),r.setRawData(null),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateWatermark() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateWatermark() error:".concat(e.message)),xa()(this,wo).recycleTextureBufferGroup(r),this.markRenderingStatePending()}else{console.log("[updateWatermark] base layer's viewport is not ready, set data to the texture layer for creating texture later."),xa()(this,wo).recycleTextureBufferGroup(r),this.markRenderingStatePending();const a={index:xa()(this,eo),width:e,height:t,data:i};r.setRawData(a)}}updateCursor(e,t,i){const a=yi.w.CURSOR,r=$n(this,es,ys).call(this,a);if(!xa()(this,_o)||!xa()(this,po))return $n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!i||i.length!=e*t*4)return xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();Ba()(this,Io,e),Ba()(this,bo,t),Ba()(this,Oo,1);try{const a=$n(this,hs,Fs).call(this,e,t);a.label="CursorTexBuffer(".concat(r.getIndex(),")-").concat(a.size);let n=r.getTextureBufferGroup();if(n=$n(this,fs,Hs).call(this,r,n,a),!n||!n.buffer)return void console.warn("[updateCursor()] texLayer(".concat(r.getIndex(),") cannot apply a GPU buffer!"));if("mapped"!=n.buffer.mapState)return void console.error("updateCursor() why buffer state is not mapped!");$n(this,Ko,vs).call(this,xa()(this,eo),e,t,i,n),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateCursor() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateCursor() error:".concat(e.message)),xa()(this,wo).recycleTextureBufferGroup(r),this.markRenderingStatePending()}}updateSelfVideoTextures(e,t,i,a){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;$n(this,Zo,Ds).call(this);const o=$n(this,es,ys).call(this,yi.w.VS_BASE);if(!xa()(this,_o)||!xa()(this,po))return i&&i instanceof VideoFrame&&i.close(),$n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!i||i.length%4!=0)return i&&i instanceof VideoFrame&&i.close(),void this.markRenderingStatePending();if(1!=e||1!=t){if(Ba()(this,ao,e),Ba()(this,ro,t),Ba()(this,uo,n),Object.assign(xa()(this,io),a),!r)return i&&i instanceof VideoFrame&&i.close(),void this.markRenderingStatePending();try{$n(this,Go,gs).call(this,e,t,i),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateSelfVideoTextures() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateSelfVideoTextures() error:".concat(e.message)),this.markRenderingStatePending(),i instanceof VideoFrame&&i.close();$n(this,es,ys).call(this,yi.w.VS_BASE).setPendingVideoFrame(null)}}else{o.setPendingVideoFrame(null),$n(this,ms,Ys).call(this),i&&i instanceof VideoFrame&&i.close();const e=$n(this,us,Ws).call(this,i);if(e)if(xa()(this,po)){let t=o.getClearColorUniformBuffer();t=xa()(this,po).writeUniformBuffer("ClearColorUniformBuffer",e,t),o.setClearColorUniformBuffer(t),o.setTextureType(yi.x.CLEAR_COLOR)}else console.warn("updateSelfVideoTextures() renderer is not attached!");else Object(Pi.h)("updateSelfVideoTextures() cannot create the uniform buffer array.");this.markRenderingStateReady()}}updateRemoteVideoTexturesImageBitmap(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const o=$n(this,es,ys).call(this,yi.w.VS_BASE);if(!xa()(this,po)||!xa()(this,_o))return i&&i instanceof VideoFrame&&i.close(),$n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!i)return i&&i instanceof VideoFrame&&i.close(),void this.markRenderingStatePending();if(Ba()(this,ao,e),Ba()(this,ro,t),Number.isNaN(r)||Ba()(this,uo,r),Object.assign(xa()(this,io),a),!n)return i&&i instanceof VideoFrame&&i.close(),void this.markRenderingStatePending();try{$n(this,Go,gs).call(this,e,t,i),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),this.markRenderingStatePending(),i instanceof VideoFrame&&i.close(),o.setPendingVideoFrame(null)}}updateRemoteVideoTextures(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6?arguments[6]:void 0;const s=yi.w.VS_BASE,d=$n(this,es,ys).call(this,s);if(!xa()(this,_o)||!xa()(this,po))return $n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(!$n(this,_s,js).call(this,o))return xa()(this,wo).recycleTextureBufferGroup(d),void this.markRenderingStatePending();$n(this,Zo,Ds).call(this);const u=this.isRgbaMode(xa()(this,lo));if(e<=0||t<=0||!a||!a.length||a.length!=e*t*3/2&&!u||i&&(i.top<0||i.left<0||i.left+i.width>e||i.top+i.height>t))return xa()(this,wo).recycleTextureBufferGroup(d),void this.markRenderingStatePending();if(u)try{$n(this,Go,gs).call(this,e,t,a,!0);let o=n?0:1;Ba()(this,Po,o),Ba()(this,uo,r),Object.assign(xa()(this,io),i),Ba()(this,ao,e),Ba()(this,ro,t),Ba()(this,no,xa()(this,_o).width),Ba()(this,oo,xa()(this,_o).height)}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),d.setPendingVideoFrame(null),this.markRenderingStatePending()}finally{xa()(this,wo).recycleTextureBufferGroup(d)}else try{const o=$n(this,cs,Gs).call(this,e,t,xa()(this,lo));o.label="YuvVideoTexBuffer(".concat(d.getIndex(),")-").concat(o.size),d.setColorFormat(o.colorFormat);let s=d.getTextureBufferGroup();if(s=$n(this,fs,Hs).call(this,d,s,o),!s||!s.buffer)return console.warn("[updateRemoteVideoTextures()] texLayer(".concat(d.getIndex(),") cannot apply a GPUBuffer!")),void this.markRenderingStatePending();let u=n?0:1;Ba()(this,Po,u),Ba()(this,uo,r),Object.assign(xa()(this,io),i),Ba()(this,ao,e),Ba()(this,ro,t),Ba()(this,no,xa()(this,_o).width),Ba()(this,oo,xa()(this,_o).height),$n(this,Fo,Es).call(this,xa()(this,eo),e,t,a,s,xa()(this,lo)),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message," cs:").concat(e.stack)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),xa()(this,wo).recycleTextureBufferGroup(d),this.markRenderingStatePending()}}drawNextOutputPictureFrame(e,t,i,a,r){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,d=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];const u=yi.w.VS_BASE,l=$n(this,es,ys).call(this,u);if(!xa()(this,_o)||!xa()(this,po))return $n(this,ms,Ys).call(this),void this.markRenderingStatePending();if(Object(Yi.g)(xa()(this,wo),e,t))return xa()(this,wo).recycleTextureBufferGroup(l),void this.markRenderingStatePending();r=r||yi.p;let c=(i=i||{top:0,left:0,width:e,height:t}).width!=xa()(this,io).width||i.height!=xa()(this,io).height,h=i.top!=xa()(this,io).top||i.left!=xa()(this,io).left,f=xa()(this,_o).width!=xa()(this,no)||xa()(this,_o).height!=xa()(this,oo),p=e!=xa()(this,ao)||t!=xa()(this,ro),_=r!=xa()(this,so);if((c||f||_)&&$n(this,zo,bs).call(this,xa()(this,_o),i.width,i.height,r,s),s){const e=Object(Yi.d)(i,r),t=Object(Yi.a)(s,e);l.evalViewport(t.x,t.y,t.width,t.height,xa()(this,_o).height)}else l.evalViewport(0,0,xa()(this,_o).width,xa()(this,_o).height,xa()(this,_o).height);if(c||h||p||_||!l.getUVCoords()){let a=Object(Yi.b)({width:e,height:t},i,xa()(this,_o),r),n=l.getUVCoords();n||(n=new Float32Array(12)),n.set(a),l.setUVCoords(n)}let m=n?0:1;m!=xa()(this,Po)&&Ba()(this,Po,m),Ba()(this,yo,0),Ba()(this,Mo,o.VIDEO_I420),Object.assign(xa()(this,io),i),Ba()(this,ao,e),Ba()(this,ro,t),Ba()(this,so,r),Ba()(this,no,xa()(this,_o).width),Ba()(this,oo,xa()(this,_o).height),l.setColorFormat("i420");try{const i=$n(this,cs,Gs).call(this,e,t,o.VIDEO_I420);if(i.label="YuvShareTexBuffer(".concat(l.getIndex(),")-").concat(i.size),d){let r=l.getTextureBufferGroup();if(r=$n(this,fs,Hs).call(this,l,r,i),!r||!r.buffer)return console.warn("[drawNextOutputPictureFrame()] texLayer(".concat(l.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();$n(this,Fo,Es).call(this,xa()(this,eo),e,t,a,r,o.VIDEO_I420);const n=$n(this,as,Ns).call(this,xa()(this,so));n&&n.buffer&&l.setUniformBuffer(n.buffer)}xa()(this,Oo)?Ba()(this,ko,1):Ba()(this,ko,0),Ba()(this,Ro,1),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] drawNextOutputPictureFrame() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_drawNextOutputPictureFrame() error:".concat(e.message)),xa()(this,wo).recycleTextureBufferGroup(l),this.markRenderingStatePending()}}clearCanvas(e){xa()(this,po)&&xa()(this,po).clearAttachedCanvas()}updateSelfMaskImage(e,t,i){const a=yi.w.MASK,r=$n(this,es,ys).call(this,a);if(!xa()(this,_o))return xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();if(e<=0||t<=0||!i||i.length!=e*t*4)return xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();if(!$n(this,$o,ws).call(this,yi.w.VS_BASE))return console.log("[updateSelfMaskImage] base layer is not ready."),xa()(this,wo).recycleTextureBufferGroup(r),void this.markRenderingStatePending();try{const a=$n(this,hs,Fs).call(this,e,t);let n=r.getTextureBufferGroup();if(n=$n(this,fs,Hs).call(this,r,n,a),!n||!n.buffer)return console.warn("[updateSelfMaskImage()] texLayer(".concat(r.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();if(n.buffer.label="SelfMaskImageTexBuffer(".concat(r.getIndex(),")-").concat(a.size),r.setTextureLayerType(yi.v.BLEND_LAYER),r.setTextureType(yi.x.GPU_TEX_RGBA),r.isLocked()){const i=r.getWidth(),a=r.getHeight();i==e&&a==t||(r.setWidth(e),r.setHeight(t),r.setIsNew(!0))}else r.setWidth(e),r.setHeight(t),r.setIsNew(!0),r.lock();const o=xa()(this,po).writeToRgbaTextureBuffer(xa()(this,eo),e,t,i,n);r.setTextureBufferGroup(o);const s=$n(this,es,ys).call(this,yi.w.VS_BASE),d=s.getViewport();d&&r.setViewport(d),r.setUVCoords(s.getUVCoords()),this.isSetWatermark()&&xa()(this,Co)&&xa()(this,Ao),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateSelfMaskImage() error:".concat(e.message)),Object(Pi.d)("WGPU WebGPURenderDisplay_updateSelfMaskImage() error:".concat(e.message)),xa()(this,wo).recycleTextureBufferGroup(r),this.markRenderingStatePending()}}readPixelsSyncRequest(e,t,i,a){}isAvaiable(){return!0}markRenderingStateReady(){Ba()(this,To,yi.k.READY)}markRenderingStateRendering(){Ba()(this,To,yi.k.RENDERING)}markRenderingStatePending(){Ba()(this,To,yi.k.PENDING)}markRenderingStateIdle(){Ba()(this,To,yi.k.IDLE)}isRenderingStateReady(){return xa()(this,To)===yi.k.READY}isInTargetRenderingState(e){return xa()(this,To)===e}getWatermarkWidth(){return xa()(this,Co)}getWatermarkHeight(){return xa()(this,Ao)}getIndex(){return xa()(this,eo)}getRenderingState(){return xa()(this,To)}recycle(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(const[t,i]of xa()(this,Wo))i&&(xa()(this,wo).recycleTextureBufferGroup(i,e),i.recycle(xa()(this,wo)));Ba()(this,Bo,{top:0,left:0,bottom:0,right:0}),this.markRenderingStateIdle(),xa()(this,Wo).clear(),xa()(this,xo).clear(),this.unbindSsrc()}cleanup(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.recycle(e),this.removeRenderer(),this.detachCanvas(),this.removeGPUResMgr()}clear(){console.log("WebGPURenderDisplay.clear"),this.clearCanvas(),Ba()(this,Ro,0),Ba()(this,Oo,0),this.recycle()}clearDisplay(){console.log("WebGPURenderDisplay.clearDisplay"),this.clearCanvas()}getTextureLayersMap(){return xa()(this,Wo)}getTextureLayerByZIndex(e){return $n(this,es,ys).call(this,e)}getUsedBuffersCount(){let e=0;for(const[t,i]of xa()(this,Wo))i&&i.getTextureBufferGroup()&&i.getTextureBufferGroup().buffer&&e++;return e}consumePendingGPUEvents(){if(xa()(this,go)){const e=$n(this,es,ys).call(this,yi.w.WATERMARK).getRawData();e&&this.updateWatermark(xa()(this,Co),xa()(this,Ao),e.data)}}resizeCanvasTo(e,t){xa()(this,_o)&&(xa()(this,_o).width=e,xa()(this,_o).height=t)}};function Xs(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var Qs=new WeakMap,zs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,$s=new WeakMap;var ed=class{constructor(e,t,i){Xs(this,Qs,{writable:!0,value:0}),Xs(this,zs,{writable:!0,value:null}),Xs(this,Js,{writable:!0,value:null}),Xs(this,Zs,{writable:!0,value:yi.t.AVAILABLE}),Xs(this,$s,{writable:!0,value:null}),Ba()(this,Qs,e),Ba()(this,Zs,t),Ba()(this,$s,i),Ba()(this,zs,[]),Ba()(this,Js,[])}initPool(e){if(e>xa()(this,Qs))throw new Error("initSize=".concat(e," is larger than maxSize=").concat(xa()(this,Qs),", invalid!"));if(e<0)throw new Error("initSize=".concat(e," is smaller than 0, invalid!"));for(let t=0;t=xa()(this,Qs))return;let t=0;if(xa()(this,zs).length+e>=xa()(this,Qs)&&(t=xa()(this,Qs)-xa()(this,zs).length),t>0){const e=xa()(this,zs).length;for(let i=0;i0&&void 0!==arguments[0])||arguments[0])&&this.isPoolEmpty()&&this.expandPool(4);const e=xa()(this,zs).pop();return e&&(e.markRenderingStatePending(),xa()(this,Js).push(e)),e}recycle(e){if(xa()(this,zs).length0&&void 0!==arguments[0])||arguments[0];xa()(this,zs).forEach(t=>{t.cleanup(e)}),xa()(this,Js).forEach(t=>{t.cleanup(e)}),Ba()(this,zs,[]),Ba()(this,Js,[])}isPoolEmpty(){return 0==xa()(this,zs).length}getInUseRenderDisplays(){return xa()(this,Js)}getAllRenderDisplays(){return xa()(this,zs)}isServeForVideoRendering(){return xa()(this,Zs)===yi.t.VIDEO}isServeForShareRendering(){return xa()(this,Zs)===yi.t.SHARE}isServingForNow(e){return xa()(this,Zs)===e}};function td(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var id=new WeakMap,ad=new WeakMap,rd=new WeakMap,nd=new WeakMap,od=new WeakMap;class sd{getVideoRenderDisplay(e,t,i,a){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getSharingRenderDisplay(e,t,i){throw new Error("getSharingRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,i){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}var dd=new WeakMap,ud=new WeakMap;class ld extends sd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),td(this,dd,{writable:!0,value:new Map}),td(this,ud,{writable:!0,value:!1}),Ba()(this,ud,e)}setCanvasAlphaChannelEnability(e){Ba()(this,ud,e)}createVideoRenderDisplay(e,t,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,r=null,n=null,o=null,s=!1;return a&&(r=a.forceNoGL,n=a.contextOptions,o=a.webGLResources,s=a.initMask),new ji.default(e,t,i,r,n,o,s,xa()(this,ud))}getVideoRenderDisplay(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=xa()(this,dd).get(e);if(!n){let a=[];n=[a,[]],xa()(this,dd).set(e,n);let o=new ji.default(e,t,0,void 0,void 0,void 0,void 0,xa()(this,ud));o.setMultiView(!0),r&&r.set(e,o);let s=1;for(;s<=i;s++){const i=new ji.default(e,t,s,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,xa()(this,ud));i.setMultiView(!0),a.push(i)}}let o,s=xa()(this,dd).get(e),d=s[0],u=s[1];if(s&&d[0]&&(o=d.pop(),u.push(o)),!o){const e=s?"".concat(s.length):"undefined",t=d?"".concat(d.length):"undefined";a("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,i){return new ji.default(e,t,0,void 0,i.contextOptions,void 0,void 0,xa()(this,ud))}recycleRenderDisplay(e,t,i){t.setWatermarkFlag(0),t.setVideoMode(o.VIDEO_INVALID),t.clear(i);let a=xa()(this,dd).get(e);if(a){let e=a[0],i=a[1];i&&i.some((function(e,a){if(e===t)return i.splice(a,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=xa()(this,dd).get(i);(!o||o.length<2)&&r("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let s=n.get(t);if(s){s.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:s.shaderProgram,contextgl:s.contextGL,vBuffer:s.vertexPosBuffer,tBuffer:s.texturePosBuffer,waterMarkTextureRef:s.waterMarkTextureRef,repeatedWaterMarkTextureRef:s.repeatedWaterMarkTextureRef})});return i!==t&&(xa()(this,dd).delete(i),xa()(this,dd).set(t,o),n&&(n.delete(i),n.set(t,s))),null}}getRenderDisplayMap(){return xa()(this,dd)}cleanup(e,t){var i;null==t||null===(i=t.cleanup)||void 0===i||i.call(t,null);for(const[e,t]of xa()(this,dd)){const e=t[0],i=t[1];for(const t of e)t.cleanup();for(const e of i)e.cleanup()}Ba()(this,dd,new Map)}cleanupByCanvas(e){if(xa()(this,dd).get(e)){let t=xa()(this,dd).get(e);if(t){let i=t[0],a=t[1];a.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i=[],a=[],xa()(this,dd).delete(e)}}}}var cd=new WeakMap,hd=new WeakMap;class fd extends sd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),td(this,cd,{writable:!0,value:new Map}),td(this,hd,{writable:!0,value:!1}),Ba()(this,hd,e)}setCanvasAlphaChannelEnability(e){Ba()(this,hd,e)}createVideoRenderDisplay(e,t,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,r=null,n=null,o=null,s=!1;return a&&(r=a.forceNoGL,n=a.contextOptions,o=a.webGLResources,s=a.initMask),new $i(e,t,i,r,n,o,s,xa()(this,hd))}getVideoRenderDisplay(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=xa()(this,cd).get(e);if(!n){let a=[];n=[a,[]],xa()(this,cd).set(e,n);let o=new $i(e,t,0,void 0,void 0,void 0,void 0,xa()(this,hd));o.setMultiView(!0),r&&r.set(e,o);let s=1;for(;s<=i;s++){const i=new $i(e,t,s,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,void 0,xa()(this,hd));i.setMultiView(!0),a.push(i)}}let o,s=xa()(this,cd).get(e),d=s[0],u=s[1];if(s&&d[0]&&(o=d.pop(),u.push(o)),!o){const e=s?"".concat(s.length):"undefined",t=d?"".concat(d.length):"undefined";a("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,i){return new $i(e,t,0,void 0,i.contextOptions,void 0,void 0,xa()(this,hd))}recycleRenderDisplay(e,t,i){t.setWatermarkFlag(0),t.setVideoMode(o.VIDEO_INVALID),t.clear(i);let a=xa()(this,cd).get(e);if(a){let e=a[0],i=a[1];i&&i.some((function(e,a){if(e===t)return i.splice(a,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=xa()(this,cd).get(i);(!o||o.length<2)&&r("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let s=n.get(t);if(s){s.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:s.shaderProgram,contextgl:s.contextGL,vBuffer:s.vertexPosBuffer,tBuffer:s.texturePosBuffer,waterMarkTextureRef:s.waterMarkTextureRef,repeatedWaterMarkTextureRef:s.repeatedWaterMarkTextureRef})});return i!==t&&(xa()(this,cd).delete(i),xa()(this,cd).set(t,o),n&&(n.delete(i),n.set(t,s))),null}}getRenderDisplayMap(){return xa()(this,cd)}cleanup(e,t){var i;null==t||null===(i=t.cleanup)||void 0===i||i.call(t);for(const[e,t]of xa()(this,cd)){const e=t[0],i=t[1];for(const t of e)t.cleanup();for(const e of i)e.cleanup()}Ba()(this,cd,new Map)}cleanupByCanvas(e){if(xa()(this,cd).get(e)){let t=xa()(this,cd).get(e);if(t){let i=t[0],a=t[1];a.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i=[],a=[],xa()(this,cd).delete(e)}}}}var pd=new WeakMap,_d=new WeakMap,md=new WeakMap;class gd extends sd{constructor(){super(),td(this,pd,{writable:!0,value:new Map}),td(this,_d,{writable:!0,value:new Map}),td(this,md,{writable:!0,value:null})}setGPUResourceMgr(e){Ba()(this,md,e)}getVideoRenderDisplay(e,t,i,a){let r=xa()(this,pd).get(e);r||(r=new ed(i,yi.t.VIDEO,xa()(this,md)),r.initPool(i),xa()(this,pd).set(e,r));let n=r.pop();return n?(n.setMultiView(!0),n):null}getSharingRenderDisplay(e,t,i){i&&i.clearCache&&xa()(this,_d).clear();let a=xa()(this,_d).get(e);return a||(a=new ed(1,yi.t.SHARE,xa()(this,md)),a.initPool(1),xa()(this,_d).set(e,a)),a.pop()}createVideoRenderDisplay(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r=new qs(i,xa()(this,md));return r.addRenderer(a),r.attachCanvas(e),r}getInUseCanvasRenderDisplayList(e){let t=[],i=null;if(e==yi.t.VIDEO?i=xa()(this,pd):e==yi.t.SHARE&&(i=xa()(this,_d)),i)for(const[e,a]of i){let i={};i.canvas=e,i.renderDisplays=a.getInUseRenderDisplays(),i.renderDisplays.length>0&&t.push(i)}return t}recycleRenderDisplay(e,t){if(e){const t=e.getAttachedCanvas();if(t){let i=xa()(this,pd).get(t);i&&(e.setWatermarkFlag(0),e.setVideoMode(o.VIDEO_INVALID),i.recycle(e));let a=xa()(this,_d).get(t);a&&(e.setWatermarkFlag(0),e.setVideoMode(o.VIDEO_INVALID),a.recycle(e))}}}cleanup(e){var t;let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null==e||null===(t=e.cleanup)||void 0===t||t.call(e,i);for(const[e,t]of xa()(this,pd))t.cleanup(i);for(const[e,t]of xa()(this,_d))t.cleanup(i)}cleanupByCanvas(e){let t=xa()(this,pd).get(e);t&&(t.cleanup(),xa()(this,pd).delete(e));let i=xa()(this,_d).get(e);i&&(i.cleanup(),xa()(this,_d).delete(e))}collectInUseRenderDisplays(e){return this.getInUseCanvasRenderDisplayList(e)}collectInUseRenderDisplaysByCanvas(e,t){let i=null;if(e)if(t==yi.t.VIDEO){i=xa()(this,pd).get(e).getInUseRenderDisplays()}else if(t==yi.t.SHARE){i=xa()(this,_d).get(e).getInUseRenderDisplays()}return i}getRenderDisplayMap(e){let t=null;return e==yi.t.VIDEO?t=xa()(this,pd):e==yi.t.SHARE&&(t=xa()(this,_d)),t}}var Ed=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];td(this,id,{writable:!0,value:null}),td(this,ad,{writable:!0,value:null}),td(this,rd,{writable:!0,value:null}),td(this,nd,{writable:!0,value:null}),td(this,od,{writable:!0,value:!1}),Ba()(this,od,e)}setGPUResourceMgr(e){Ba()(this,nd,e)}isEnableCanvasAlphaChannel(){return xa()(this,od)}setCanvasAlphaChannelEnability(e){Ba()(this,od,e),xa()(this,id)&&xa()(this,id).setCanvasAlphaChannelEnability(e),xa()(this,ad)&&xa()(this,ad).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return xa()(this,id)||Ba()(this,id,new ld(xa()(this,od))),xa()(this,id)}getWebGL2RenderDisplayMgr(){return xa()(this,ad)||Ba()(this,ad,new fd(xa()(this,od))),xa()(this,ad)}getWebGPURenderDisplayMgr(){return xa()(this,rd)||(Ba()(this,rd,new gd),xa()(this,rd).setGPUResourceMgr(xa()(this,nd))),xa()(this,rd)}getVideoRenderDisplay(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=null;return e===yi.j.WEBGL?(xa()(this,id)||Ba()(this,id,new ld(xa()(this,od))),s=xa()(this,id).getVideoRenderDisplay(t,i,a,r,o)):e===yi.j.WEBGL_2?(xa()(this,ad)||Ba()(this,ad,new fd(xa()(this,od))),s=xa()(this,ad).getVideoRenderDisplay(t,i,a,r,o)):e===yi.j.WEBGPU&&(xa()(this,rd)||(Ba()(this,rd,new gd),xa()(this,rd).setGPUResourceMgr(xa()(this,nd))),s=xa()(this,rd).getVideoRenderDisplay(t,i,a,r),s&&(s.addRenderer(n),s.attachCanvas(t),s.setGPUResMgr(xa()(this,nd)))),s}getSharingRenderDisplay(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=null;return e===yi.j.WEBGL?(xa()(this,id)||Ba()(this,id,new ld(xa()(this,od))),n=xa()(this,id).getSharingRenderDisplay(t,i,r)):e===yi.j.WEBGL_2?(xa()(this,ad)||Ba()(this,ad,new fd(xa()(this,od))),n=xa()(this,ad).getSharingRenderDisplay(t,i,r)):e===yi.j.WEBGPU&&(xa()(this,rd)||(Ba()(this,rd,new gd),xa()(this,rd).setGPUResourceMgr(xa()(this,nd))),n=xa()(this,rd).getSharingRenderDisplay(t,i,r),n&&(n.addRenderer(a),n.attachCanvas(t),n.setGPUResMgr(xa()(this,nd)))),n}createVideoRenderDisplay(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=null;return e==yi.j.WEBGL?(xa()(this,id)||Ba()(this,id,new ld(xa()(this,od))),o=xa()(this,id).createVideoRenderDisplay(t,i,a,r,n)):e==yi.j.WEBGL_2?(xa()(this,ad)||Ba()(this,ad,new fd(xa()(this,od))),o=xa()(this,ad).createVideoRenderDisplay(t,i,a,r,n)):e==yi.j.WEBGPU&&(xa()(this,rd)||(Ba()(this,rd,new gd),xa()(this,rd).setGPUResourceMgr(xa()(this,nd))),o=xa()(this,rd).createVideoRenderDisplay(t,i,a,r,n),o.addRenderer(r),o.attachCanvas(t),o.setGPUResMgr(xa()(this,nd))),o}recycleRenderDisplay(e,t,i,a){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e===yi.j.WEBGPU?xa()(this,rd)&&xa()(this,rd).recycleRenderDisplay(i,a,r):e===yi.j.WEBGL?xa()(this,id)&&xa()(this,id).recycleRenderDisplay(t,i,r):e===yi.j.WEBGL_2&&xa()(this,ad)&&xa()(this,ad).recycleRenderDisplay(t,i,r)}collectInUseRenderDisplays(e,t){let i=null;return e===yi.j.WEBGPU&&xa()(this,rd)&&(i=xa()(this,rd).collectInUseRenderDisplays(t)),i}collectInUseRenderDisplaysByCanvas(e,t,i){let a=null;return e===yi.j.WEBGPU&&xa()(this,rd)&&(a=xa()(this,rd).collectInUseRenderDisplaysByCanvas(t,i)),a}getRenderDisplayMap(e,t){if(e===yi.j.WEBGL){if(xa()(this,id))return xa()(this,id).getRenderDisplayMap()}else if(e===yi.j.WEBGPU){if(xa()(this,rd))return xa()(this,rd).getRenderDisplayMap(t)}else if(e===yi.j.WEBGL_2&&xa()(this,ad))return xa()(this,ad).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return xa()(this,id)?xa()(this,id).onRestoredFromContextLost(e,t,i,a,r,n):xa()(this,ad)?xa()(this,ad).onRestoredFromContextLost(e,t,i,a,r,n):null}cleanup(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==xa()(this,id)&&xa()(this,id).cleanup(e,t),xa()(this,ad)&&xa()(this,ad).cleanup(e,t),null!==xa()(this,rd)&&xa()(this,rd).cleanup(t,i)}cleanupByCanvas(e){null!==xa()(this,id)&&xa()(this,id).cleanupByCanvas(e),null!==xa()(this,ad)&&xa()(this,ad).cleanupByCanvas(e),null!==xa()(this,rd)&&xa()(this,rd).cleanupByCanvas(e)}};function Sd(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var vd=new WeakMap,Cd=new WeakMap,Ad=new WeakMap,Td=new WeakMap,Rd=new WeakMap,Id=new WeakMap,bd=new WeakMap;var Od=class{constructor(e){Sd(this,vd,{writable:!0,value:yi.f.VERTEX_BUFFER}),Sd(this,Cd,{writable:!0,value:{}}),Sd(this,Ad,{writable:!0,value:null}),Sd(this,Td,{writable:!0,value:0}),Sd(this,Rd,{writable:!0,value:0}),Sd(this,Id,{writable:!0,value:[]}),Sd(this,bd,{writable:!0,value:new Map}),Ba()(this,Ad,e)}acquireBuffer(e,t,i){let a,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?xa()(this,bd).has(e)?a=xa()(this,bd).get(e):xa()(this,Id).length>0?(a=xa()(this,Id).pop(),xa()(this,bd).set(e,a)):(a=xa()(this,Ad).createBuffer({size:i,usage:t,mappedAtCreation:r}),xa()(this,bd).set(e,a)):a=xa()(this,Ad).createBuffer({size:i,usage:t,mappedAtCreation:r}),a}releaseBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(xa()(this,bd).has(e)){const t=xa()(this,bd).get(e);i?xa()(this,Id).push(t):t.destroy(),xa()(this,bd).delete(e)}else i||-1!=xa()(this,Id).indexOf(t)&&(xa()(this,Id)[index]=xa()(this,Id)[xa()(this,Id).length-1],xa()(this,Id).pop(),t.destroy())}getNumUsedBuffers(){return xa()(this,Td)}getNumFreeBuffers(){return xa()(this,Rd)}cleanup(){xa()(this,Id).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),xa()(this,bd).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),xa()(this,Id).length=0,xa()(this,bd).clear(),Ba()(this,Td,0),Ba()(this,Rd,0)}release(e){e==yi.n.OVERUSE&&(xa()(this,Id).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),xa()(this,Id).length=0,Ba()(this,Rd,0))}getResourceType(){return xa()(this,vd)}collectResourceInfo(){let e=0,t=0,i="";for(const[a,r]of xa()(this,bd))e++,t+=r.size,i+="[GPUBufferMgr] entry{key:".concat(a,", buffer:{label:").concat(r.label," size:").concat(r.size,"}}\n");for(const i of xa()(this,Id))e++,t+=i.size;return i+="[GPUBufferMgr] freeBuffers{size:".concat(xa()(this,Id).length,"}\n"),i+="[GPUBufferMgr] total: count:".concat(e," usedBytes:").concat(t,"\n"),xa()(this,Cd).type=xa()(this,vd),xa()(this,Cd).count=e,xa()(this,Cd).usedBytes=t,xa()(this,Cd).output=i,xa()(this,Cd)}onOccupancyLevelEvaluated(e){console.log("[GPUBufferManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(Pi.d)("WGPU GPUBufferManager_onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}};function Dd(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var wd=new WeakMap,yd=new WeakMap,Md=new WeakMap;var Pd=class{constructor(){Dd(this,wd,{writable:!0,value:yi.f.TEXTURE}),Dd(this,yd,{writable:!0,value:[]}),Dd(this,Md,{writable:!0,value:[]})}acquire(e){let t=null;const i=xa()(this,yd).findIndex(t=>t&&t.width==e.w&&t.height==e.h&&t.format==e.format&&t.usage==e.usage);return i>-1&&(t=xa()(this,yd).splice(i,1)[0]),t&&xa()(this,Md).push(t),t}recycle(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=xa()(this,Md).indexOf(e);-1!=i&&xa()(this,Md).splice(i,1),t?e.destroy():(xa()(this,yd).push(e),e.label="")}pushToAvailablePool(e){e&&xa()(this,yd).push(e)}pushToInUsePool(e){e&&xa()(this,Md).push(e)}release(e){if(e==yi.n.OVERUSE&&xa()(this,yd).length>0){for(const e of xa()(this,yd))e.destroy();xa()(this,yd).length=0}}cleanup(){for(const e of xa()(this,yd))e.destroy();for(const e of xa()(this,Md))e.destroy();xa()(this,yd).length=0,xa()(this,Md).length=0}getAvailablePool(){return xa()(this,yd)}getInUsedPool(){return xa()(this,Md)}getResourceType(){return xa()(this,wd)}};function Nd(e,t){kd(e,t),t.add(e)}function Vd(e,t,i){kd(e,t),t.set(e,i)}function kd(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ud(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var Ld=new WeakMap,xd=new WeakMap,Wd=new WeakMap,Bd=new WeakMap,Gd=new WeakSet,Fd=new WeakSet,Hd=new WeakSet,Kd=new WeakSet,jd=new WeakSet;function Yd(e){let t=xa()(this,Wd).get(e.level),i=null;return t?(i=t.acquire(e),i||(i=Ud(this,Hd,Xd).call(this,e),i?t.pushToInUsePool(i):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e))))):(i=Ud(this,Hd,Xd).call(this,e),i?(t=new Pd,t.pushToInUsePool(i),xa()(this,Wd).set(e.level,t)):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e)))),i}function qd(e){const t=e.zOrder;let i=xa()(this,Bd).get(t);return i?(e.w>i.width||e.h>i.height)&&(i.destroy(),i=Ud(this,Hd,Xd).call(this,e),xa()(this,Bd).set(t,i)):(i=Ud(this,Hd,Xd).call(this,e),xa()(this,Bd).set(t,i)),i}function Xd(e){if(!xa()(this,Ld))return null;if(0==e.w||0==e.h)return null;const t={size:{width:e.w,height:e.h},format:e.format,usage:e.usage};return e.sampleCount>0&&(t.sampleCount=e.sampleCount),xa()(this,Ld).createTexture(t)}function Qd(e){let t=yi.u[yi.u.length-1];for(let i=0;i1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const i=this.assembleTextureConfig(e.width,e.height,e.usage,e.format,e.sampleCount);let a=xa()(this,Wd).get(i.level);if(a)a.recycle(e,t);else if(console.warn("recycleTexture(".concat(e.label,") texture is not found in the map!, destroy:").concat(t)),t)e.destroy();else{const t=new Pd;t.pushToAvailablePool(e),xa()(this,Wd).set(i.level,t)}}cleanup(){for(const[e,t]of xa()(this,Wd))t&&t.cleanup();xa()(this,Wd).clear()}collectResourceInfo(){let e=0,t=0,i="";for(const[a,r]of xa()(this,Wd))if(r){const n=r.getAvailablePool();for(const i of n)e++,"r8unorm"==i.format?t+=i.width*i.height:"rgba8unorm"==i.format&&(t+=i.width*i.height*Uint32Array.BYTES_PER_ELEMENT);const o=r.getInUsedPool();for(const i of o)e++,"r8unorm"==i.format?t+=i.width*i.height:"rgba8unorm"==i.format&&(t+=i.width*i.height*Uint32Array.BYTES_PER_ELEMENT);(n.length>0||o.length>0)&&(i+="[GPUTexturePool] level:".concat(a," pool:{ava_count:").concat(n.length," in_used_count:").concat(o.length,"}\n"))}return i+="[GPUTexturePool] total: count:".concat(e," usedBytes:").concat(t,"\n"),xa()(this,xd).type=yi.f.TEXTURE,xa()(this,xd).count=e,xa()(this,xd).usedBytes=t,xa()(this,xd).output=i,xa()(this,xd)}onOccupancyLevelEvaluated(e){if(console.log("[GPUTextureManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(Pi.d)("WGPU GPUTextureManager_onOccupancyLevelEvaluated() level:".concat(e)),e==yi.n.OVERUSE)for(const[t,i]of xa()(this,Wd))i&&i.release(e)}};function Zd(e,t){eu(e,t),t.add(e)}function $d(e,t,i){eu(e,t),t.set(e,i)}function eu(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tu(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var iu=new WeakMap,au=new WeakMap,ru=new WeakMap,nu=new WeakMap,ou=new WeakSet,su=new WeakSet;function du(e,t,i){if(xa()(this,ru).set(e,t),i){let e=Array.from(xa()(this,ru).entries());e.sort((e,t)=>e[0]-t[0]),xa()(this,ru).clear(),e.forEach(e=>{let[t,i]=e;xa()(this,ru).set(t,i)})}}function uu(e,t){if(!e||0==e.length)return null;let i=0,a=0,r=null;for(const n of e)"mapped"==n.mapState?(i+=1,r||n.size>=t&&(r=n)):a+=1;if(i>0&&0==a||i>=2&&0!=a){if(r){const t=e.indexOf(r);-1!=t&&e.splice(t,1)}return r}return null}var lu=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Zd(this,su),Zd(this,ou),$d(this,iu,{writable:!0,value:yi.f.TEXTURE_BUFFER}),$d(this,au,{writable:!0,value:0}),$d(this,ru,{writable:!0,value:new Map}),$d(this,nu,{writable:!0,value:0}),Ba()(this,au,e),Ba()(this,nu,t)}isUpToThreshold(e,t){if(e!=xa()(this,au)||t<=0)return!1;if(0==xa()(this,nu))return!1;const i=xa()(this,ru).get(t);return!!i&&i.length>=xa()(this,nu)}push(e,t,i){if(e!=xa()(this,au)||!i||t<=0)return!1;let a=null,r=!1;if(xa()(this,ru).has(t)){if(a=xa()(this,ru).get(t),a||(a=[],r=!0),!(a.length1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let i=e.level,a=e.bytesPerRow,r=e.size;if(i!=xa()(this,au)||a<=0)return console.error("[GPUBufferPoolEntry] acquire() level(".concat(i,") or bpr=").concat(a," is invalid!")),null;let n=null,o=!1;if(xa()(this,ru).has(a)){let e=xa()(this,ru).get(a);if(e){const t=e.findIndex(e=>"mapped"==e.mapState&&e.size>=r);t>-1?n=e.splice(t,1)[0]:o=!0}else o=!0}else o=!0;if(o&&!n&&!t){let t=2,o=!1;i>=yi.m[yi.h]&&(o=!0);for(const[i,s]of xa()(this,ru))if((t>0||o)&&i>a){if(n=tu(this,su,uu).call(this,s,r),n){e.bytesPerRow=i;break}t--}}return n}recycle(e,t,i){if(e!=xa()(this,au)||t<=0||!i)return!1;let a=!1;if(xa()(this,ru).has(t)){let e=!1,r=xa()(this,ru).get(t);r||(r=[],e=!0),r.push(i),e&&tu(this,ou,du).call(this,t,r,e),a=!0}else a=this.push(e,t,i);return a}release(e){if(e==yi.n.OVERUSE){for(const[e,t]of xa()(this,ru))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}xa()(this,ru).clear()}}cleanup(){for(const[e,t]of xa()(this,ru))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}xa()(this,ru).clear()}getPool(){return xa()(this,ru)}hasBytesPerRowAsKey(e){return xa()(this,ru).has(e)}getResourceType(){return xa()(this,iu)}getPoolThreshold(){return xa()(this,nu)}canLendBufferCrossLevel(e,t){let i=!0;if(xa()(this,ru).has(t)){const a=xa()(this,ru).get(t);if(a){let t=0,r=0;for(const e of a)"mapped"==e.mapState?t+=1:r+=1;if(e>=yi.m[yi.h])i=t>0;else{const e=t>=2&&0!=r;i=t>0&&0==r||e}}}else i=!1;return i}};function cu(e,t){fu(e,t),t.add(e)}function hu(e,t,i){fu(e,t),t.set(e,i)}function fu(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pu(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var _u=new WeakMap,mu=new WeakMap,gu=new WeakMap,Eu=new WeakMap,Su=new WeakMap,vu=new WeakMap,Cu=new WeakSet,Au=new WeakSet,Tu=new WeakSet,Ru=new WeakSet,Iu=new WeakSet,bu=new WeakSet,Ou=new WeakSet;function Du(e){if(!e)return;const t=e.colorFormat;if("rgba"==t){const t=pu(this,Au,wu).call(this,e.height);t>0&&t0&&t0&&t-1&&t+1<=yi.m.length-1?yi.m[t+1]:e}function Mu(e){if(!e)return 0;let t=0;const i=e.colorFormat;if("rgba"==i?t=e.height:"i420"!=i&&"nv12"!=i||(t=e.yPlane.height),0==t)return 0;let a=0;return a=t<=yi.m[2]?90:t>yi.m[2]&&t<=yi.m[5]?60:15,a}function Pu(e){return e.mapAsync(GPUMapMode.WRITE,0,e.size)}function Nu(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(xa()(this,Su).set(e,t),i){let e=Array.from(xa()(this,Su).entries());e.sort((e,t)=>e[0]-t[0]),xa()(this,Su).clear(),e.forEach(e=>{let[t,i]=e;xa()(this,Su).set(t,i)})}}function Vu(e){if(!e)return null;let t=e.level,i=e.bytesPerRow;e.size;const a=pu(this,Tu,yu).call(this,t);if(a<=t)return null;if(!xa()(this,Su).has(a))return null;const r=xa()(this,Su).get(a);if(!r)return null;if(!r.hasBytesPerRowAsKey(i))return null;if(!r.canLendBufferCrossLevel(t,i))return null;const n={};Object.assign(n,e),n.level=a;const o=r.acquire(n,!0);return o&&(e.level=a,e.bytesPerRow=n.bytesPerRow),o}var ku=class{constructor(e){cu(this,Ou),cu(this,bu),cu(this,Iu),cu(this,Ru),cu(this,Tu),cu(this,Au),cu(this,Cu),hu(this,_u,{writable:!0,value:yi.f.TEXTURE_BUFFER}),hu(this,mu,{writable:!0,value:{}}),hu(this,gu,{writable:!0,value:null}),hu(this,Eu,{writable:!0,value:[]}),hu(this,Su,{writable:!0,value:new Map}),hu(this,vu,{writable:!0,value:0}),Ba()(this,gu,e)}acquire(e){if(!e)throw new Error("acquire() bufferConfig is invalid!");pu(this,Cu,Du).call(this,e);let t=null,i=null;if(0==xa()(this,Su).size){if(xa()(this,gu)){const a=xa()(this,gu).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});let r=!1;if(!i){const t=pu(this,Ru,Mu).call(this,e);i=new lu(e.level,t),r=!0}a&&(Ba()(this,vu,xa()(this,vu)+1),t=a,t.label="".concat(e.label,"-").concat(xa()(this,vu))),pu(this,bu,Nu).call(this,e.level,i,r)}}else if(xa()(this,Su).has(e.level)){i=xa()(this,Su).get(e.level);let a=!1;if(!i){const t=pu(this,Ru,Mu).call(this,e);i=new lu(e.level,t),a=!0}if(t=i.acquire(e),t)t.label="".concat(e.label,"-").concat(xa()(this,vu));else if(t=pu(this,Ou,Vu).call(this,e),!t)if(i.isUpToThreshold(e.level,e.bytesPerRow))console.log("[GPUBufferPool]acquire() next level cant help and pool is up to threshold! Only to wait for a while...");else{const i=xa()(this,gu).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});i&&(Ba()(this,vu,xa()(this,vu)+1),t=i,t.label="".concat(e.label,"-").concat(xa()(this,vu)))}a&&pu(this,bu,Nu).call(this,e.level,i,a)}else{let a=!1;if(t=pu(this,Ou,Vu).call(this,e),t)t.label="".concat(e.label,"-").concat(xa()(this,vu));else{const r=xa()(this,gu).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});if(!i){const t=pu(this,Ru,Mu).call(this,e);i=new lu(e.level,t),a=!0}r&&(Ba()(this,vu,xa()(this,vu)+1),t=r,t.label="".concat(e.label,"-").concat(xa()(this,vu)))}a&&pu(this,bu,Nu).call(this,e.level,i,a)}return t&&xa()(this,Eu).push(t),t}recycle(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return;const a=xa()(this,Eu).indexOf(e);if(-1!=a?xa()(this,Eu).splice(a,1):(console.error("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(i)),Object(Pi.d)("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(i))),t)if(i){"unmapped"!=e.mapState&&e.unmap(),"unmapped"==e.mapState&&pu(this,Iu,Pu).call(this,e).then(()=>{}).catch(t=>{console.warn("mapAsyncBuffer() error:".concat(t)),e.destroy(),e=null});let i=xa()(this,Su).get(t.level);i&&i.recycle(t.level,t.bytesPerRow,e),e.label=""}else e.destroy(),e=null;else e.destroy()}recycleInUsedGPUBuffers(e,t){for(const[i,a]of e)for(const e of a)if(e){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),this.recycle(i.buffer,i.bufferConfig)),e.destroyTextureBufferGroup(t)}}recycleTextureBufferGroup(e,t){if(e&&t){const i=t.acquireGPUBufferPool();if(i){const a=e.getTextureBufferGroup();a&&a.buffer&&(a.bufferArray&&(a.bufferArray=null),i.recycle(a.buffer,a.bufferConfig),e.destroyTextureBufferGroup(t))}}}cleanup(){for(const e of xa()(this,Eu))"unmapped"!=e.mapState&&e.unmap(),e.destroy();xa()(this,Eu).length=0;for(const[e,t]of xa()(this,Su))t&&t.cleanup();xa()(this,Su).clear()}release(e){if(e==yi.n.OVERUSE){for(const[t,i]of xa()(this,Su))i&&i.release(e);xa()(this,Su).clear()}}getResourceType(){return xa()(this,_u)}collectResourceInfo(){let e=0,t=0,i="";for(const[a,r]of xa()(this,Su))if(r){const n=r.getPool();for(const[o,s]of n){e+=s.length;let n=0,d=0;for(const e of s)t+=e.size,"mapped"==e.mapState?n+=1:d+=1;i+="[GPUBufferPool] level:".concat(a," bpr:").concat(o," threshold:").concat(r.getPoolThreshold()," pool:{len:").concat(s.length," ava_count:").concat(n," pending_count:").concat(d,"}\n")}}let a=0;for(const i of xa()(this,Eu))e+=1,t+=i.size,a+=1;return i+="[GPUBufferPool] in_used_count:".concat(a,"\n"),i+="[GPUBufferPool] total: count:".concat(e," usedBytes:").concat(t,"\n"),xa()(this,mu).type=xa()(this,_u),xa()(this,mu).count=e,xa()(this,mu).usedBytes=t,xa()(this,mu).output=i,xa()(this,mu)}onOccupancyLevelEvaluated(e){Object(Pi.d)("WGPU GPUBufferPool_onOccupancyLevelEvaluated() level:".concat(e)),console.log("[GPUBufferPool] onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}getInUsedPoolCount(){return xa()(this,Eu).length}};function Uu(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var Lu=new WeakMap,xu=new WeakMap;var Wu=class{constructor(e){Uu(this,Lu,{writable:!0,value:null}),Uu(this,xu,{writable:!0,value:null}),Ba()(this,Lu,e),e&&Ba()(this,xu,e.features)}getAdapterFeatures(){return xa()(this,xu)}getAdapterLimits(){return xa()(this,Lu)?xa()(this,Lu).limits:null}queryMaxTextureDimension2D(){const e=this.getAdapterLimits();return e?e.maxTextureDimension2D:0}queryMaxBufferSize(){const e=this.getAdapterLimits();return e?e.maxBufferSize:0}queryAdapterFeature(e){return!(!xa()(this,xu)||!e)&&xa()(this,xu).has(e)}isTimestampQuerySupported(){return this.queryAdapterFeature("timestamp-query")}getGPUAdapter(){return xa()(this,Lu)}cleanup(){Ba()(this,Lu,null),Ba()(this,xu,null)}};function Bu(e,t){Fu(e,t),t.add(e)}function Gu(e,t,i){Fu(e,t),t.set(e,i)}function Fu(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Hu(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var Ku=new WeakMap,ju=new WeakMap,Yu=new WeakMap,qu=new WeakMap,Xu=new WeakSet,Qu=new WeakSet,zu=new WeakSet;function Ju(){let e=yi.n.LOW;const t="---WatchDog(".concat(xa()(this,qu),") starts analyzing---\n");console.log("".concat(t));for(const t of xa()(this,ju)){const i=t.collectResourceInfo();console.log("".concat(i.output));const a=Hu(this,Qu,Zu).call(this,i);t.onOccupancyLevelEvaluated(a),a>e&&(e=a)}const i=Hu(this,zu,$u).call(this,e);i!=xa()(this,Ku)&&(clearInterval(xa()(this,Yu)),Ba()(this,Yu,null),Ba()(this,Ku,i),this.monitor())}function Zu(e){let t=yi.n.LOW;return e.type==yi.f.TEXTURE?t=e.usedBytes<=31457280?yi.n.LOW:e.usedBytes<=94371840?yi.n.MEDIUM:e.usedBytes<=157286400?yi.n.HIGH:yi.n.OVERUSE:e.type==yi.f.VERTEX_BUFFER?t=e.usedBytes<=5242880?yi.n.LOW:e.usedBytes<=10485760?yi.n.MEDIUM:e.usedBytes<=15728640?yi.n.HIGH:yi.n.OVERUSE:e.type==yi.f.TEXTURE_BUFFER&&(t=e.usedBytes<=52428800?yi.n.LOW:e.usedBytes<=104857600?yi.n.MEDIUM:e.usedBytes<=209715200?yi.n.HIGH:yi.n.OVERUSE),t}function $u(e){let t=0;switch(e){case yi.n.LOW:t=yi.o.LOW;break;case yi.n.MEDIUM:t=yi.o.MEDIUM;break;case yi.n.HIGH:t=yi.o.HIGH;break;case yi.n.OVERUSE:t=yi.o.OVERUSE;break;default:t=yi.o.MEDIUM}return t}var el=class{constructor(e){Bu(this,zu),Bu(this,Qu),Bu(this,Xu),Gu(this,Ku,{writable:!0,value:yi.o.HIGH}),Gu(this,ju,{writable:!0,value:[]}),Gu(this,Yu,{writable:!0,value:null}),Gu(this,qu,{writable:!0,value:""}),Ba()(this,qu,e)}addObservable(e){xa()(this,ju).push(e)}removeObservable(e){const t=xa()(this,ju).indexOf(e);-1!=t&&xa()(this,ju).splice(t,1)}removeAllObservables(){xa()(this,ju).length=0}monitor(){xa()(this,Yu)||Ba()(this,Yu,setInterval(()=>{Hu(this,Xu,Ju).call(this)},xa()(this,Ku)))}cleanup(){this.removeAllObservables(),clearInterval(xa()(this,Yu)),Ba()(this,Yu,null),Ba()(this,Ku,0)}};function tl(e,t,i){il(e,t),t.set(e,i)}function il(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}var al=new WeakMap,rl=new WeakMap,nl=new WeakMap,ol=new WeakMap,sl=new WeakMap,dl=new WeakMap,ul=new WeakMap,ll=new WeakMap,cl=new WeakMap,hl=new WeakMap,fl=new WeakMap,pl=new WeakSet;function _l(e){return void 0!==e&&"yPlaneTex"in e}var ml=class{constructor(){var e,t;il(e=this,t=pl),t.add(e),tl(this,al,{writable:!0,value:null}),tl(this,rl,{writable:!0,value:null}),tl(this,nl,{writable:!0,value:null}),tl(this,ol,{writable:!0,value:null}),tl(this,sl,{writable:!0,value:null}),tl(this,dl,{writable:!0,value:null}),tl(this,ul,{writable:!0,value:null}),tl(this,ll,{writable:!0,value:null}),tl(this,cl,{writable:!0,value:null}),tl(this,hl,{writable:!0,value:null}),tl(this,fl,{writable:!0,value:""})}addRendererProviderModule(e){Ba()(this,hl,e)}setLabel(e){Ba()(this,fl,e)}async initialize(){if(navigator.gpu){if(!xa()(this,al)&&(Ba()(this,al,await navigator.gpu.requestAdapter()),!xa()(this,al)))return console.error("[WebGPUResManager] initialize() Couldn't request WebGPU adapter."),Object(Pi.h)("WebGPU device was lost: ".concat(info.message," reason=").concat(info.reason)),void Object(Pi.e)("WebGPUDeviceLost");xa()(this,nl)||(Ba()(this,nl,await xa()(this,al).requestDevice()),xa()(this,nl).lost.then(async e=>{"destroyed"!=e.reason&&(console.error("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(Pi.h)("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(Pi.e)("WebGPUDeviceLost")),xa()(this,hl)&&xa()(this,hl).rendererUnconfigureGPUContext(),this.cleanup(),"destroyed"!=e.reason&&(Ba()(this,nl,null),await this.initialize(),xa()(this,hl)&&xa()(this,hl).rendererReinitialize())})),xa()(this,rl)||("function"==typeof xa()(this,al).requestAdapterInfo?Ba()(this,rl,await xa()(this,al).requestAdapterInfo()):"info"in xa()(this,al)&&Ba()(this,rl,xa()(this,al).info)),xa()(this,ol)||Ba()(this,ol,navigator.gpu.getPreferredCanvasFormat()),xa()(this,sl)||Ba()(this,sl,new Od(xa()(this,nl))),xa()(this,dl)||Ba()(this,dl,new Jd(xa()(this,nl))),xa()(this,ul)||Ba()(this,ul,new ku(xa()(this,nl))),xa()(this,ll)||Ba()(this,ll,new Wu(xa()(this,al))),xa()(this,cl)||(Ba()(this,cl,new el(xa()(this,fl))),xa()(this,cl).addObservable(xa()(this,sl)),xa()(this,cl).addObservable(xa()(this,dl)),xa()(this,cl).addObservable(xa()(this,ul)),xa()(this,cl).monitor())}else console.error("[WebGPUResManager] initialize() WebGPU is not supported!")}acquireGPUDevice(){return xa()(this,nl)}acquireCanvasFormat(){return xa()(this,ol)}acquireGPUAdapterInfo(){return xa()(this,rl)}destroyGPUDevice(){xa()(this,nl)&&(xa()(this,nl).destroy(),Ba()(this,nl,null))}acquireGPUBufferMgr(){return xa()(this,sl)}acquireGPUTextureMgr(){return xa()(this,dl)}acquireGPUBufferPool(){return xa()(this,ul)}acquireGPUFeaturesHelper(){return xa()(this,ll)}cleanup(){xa()(this,sl)&&(xa()(this,sl).cleanup(),Ba()(this,sl,null)),xa()(this,dl)&&(xa()(this,dl).cleanup(),Ba()(this,dl,null)),xa()(this,ul)&&(xa()(this,ul).cleanup(),Ba()(this,ul,null)),xa()(this,ll)&&(xa()(this,ll).cleanup(),Ba()(this,ll,null)),xa()(this,cl)&&(xa()(this,cl).cleanup(),Ba()(this,cl,null)),Ba()(this,hl,null),this.destroyGPUDevice()}recycleTextureBufferGroup(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&xa()(this,ul)){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),xa()(this,ul).recycle(i.buffer,i.bufferConfig,t),e.destroyTextureBufferGroup(this))}}recycleInUsedGPUBuffers(e){for(const[t,i]of e)for(const e of i)if(e){const t=e.getTextureBufferGroup();t&&t.buffer&&(t.bufferArray&&(t.bufferArray=null),xa()(this,ul).recycle(t.buffer,t.bufferConfig)),e.destroyTextureBufferGroup(this)}}requestTextureBuffer(e){if(!xa()(this,ul))return null;if(Object(Yi.f)(this,e.size))return Object(Pi.h)("requestTextureBuffer() a buffer size that exceeds the max size of GPUBuffer is required.(size:".concat(e.size,")")),null;const t=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC;return e.usage=t,xa()(this,ul).acquire(e)}destroyTextureGroup(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const i=e.getTextureGroup();if(!i)return;if(!xa()(this,dl))return void Object(Pi.h)("destroyTextureGroup() mGPUTextureMgr is undefined!");const a=e.getTextureType();i&&(a==yi.x.GPU_TEX_YUV||a!=yi.x.GPU_TEX_RGBA&&function(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}(this,pl,_l).call(this,i)?(xa()(this,dl).recycleTexture(i.yPlaneTex,t),xa()(this,dl).recycleTexture(i.uPlaneTex,t),i.vPlaneTex&&xa()(this,dl).recycleTexture(i.vPlaneTex,t)):xa()(this,dl).recycleTexture(i,t),e.setTextureGroup(null))}};function gl(e,t,i){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,i)}var El=new WeakMap,Sl=new WeakMap,vl=new WeakMap,Cl=new WeakMap,Al=new WeakMap;var Tl,Rl=class{constructor(e){gl(this,El,{writable:!0,value:""}),gl(this,Sl,{writable:!0,value:new An}),gl(this,vl,{writable:!0,value:new Ed}),gl(this,Cl,{writable:!0,value:new wn}),gl(this,Al,{writable:!0,value:new ml}),Ba()(this,El,e),xa()(this,Al).addRendererProviderModule(xa()(this,Sl)),xa()(this,Al).setLabel(xa()(this,El)),xa()(this,vl).setGPUResourceMgr(xa()(this,Al))}isEnableCanvasAlphaChannel(){return xa()(this,vl).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){xa()(this,vl).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await xa()(this,Sl).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,i,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const n=xa()(this,Sl).getRendererType(),o=xa()(this,Sl).acquireRenderer(e,xa()(this,Al));return xa()(this,vl).getVideoRenderDisplay(n,e,t,i,a,o,r)}createWebGLVideoRenderDisplay(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return xa()(this,Sl).isWebGL2RendererType()?xa()(this,vl).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,i,null,a):xa()(this,Sl).isWebGLRendererType()?xa()(this,vl).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,i,null,a):null}createVideoRenderDisplay(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r=xa()(this,Sl).getRendererType(),n=xa()(this,Sl).acquireRenderer(e,xa()(this,Al));return xa()(this,vl).createVideoRenderDisplay(r,e,t,i,n,a)}getSharingRenderDisplay(e,t,i){const a=xa()(this,Sl).getRendererType(),r=xa()(this,Sl).acquireRenderer(e,xa()(this,Al),!0);return i||(i={}),i.clearCache=!0,xa()(this,vl).getSharingRenderDisplay(a,e,t,r,i)}recycleRenderDisplay(e,t,i){const a=xa()(this,Sl).getRendererType();xa()(this,vl).recycleRenderDisplay(a,e,t,xa()(this,Al),i)}renderFor(e){if(xa()(this,Sl).isWebGPURendererType()){const t=xa()(this,Sl).getRendererType(),i=xa()(this,vl).collectInUseRenderDisplays(t,e);i&&i.forEach(e=>{const t=xa()(this,Sl).acquireRenderer(e.canvas,xa()(this,Al));xa()(this,Cl).render(t,e.renderDisplays)})}}renderWith(e){if(xa()(this,Sl).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const i=xa()(this,Sl).acquireRenderer(t,xa()(this,Al)),a=[];a.push(e),xa()(this,Cl).render(i,a)}}}getRenderDisplayMap(e){const t=xa()(this,Sl).getRendererType();return xa()(this,vl).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,i,a,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return xa()(this,Sl).isWebGLRendererType()||xa()(this,Sl).isWebGL2RendererType()?xa()(this,vl).onRestoredFromContextLost(e,t,i,a,r,n):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&xa()(this,Sl).isWebGPURendererType()&&e.close()}getRendererProvider(){return xa()(this,Sl)}getRenderDisplayManager(){return xa()(this,vl)}getWebGPUResMgr(){return xa()(this,Al)}cleanup(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];xa()(this,Sl)&&xa()(this,Sl).cleanup(),xa()(this,vl)&&xa()(this,vl).cleanup(e,t,xa()(this,Al),i),i||xa()(this,Al)&&xa()(this,Al).cleanup()}clearOffscreenCanvas(e){xa()(this,vl)&&xa()(this,vl).cleanupByCanvas(e)}},Il=a(22),bl=a(20),Ol=a(12),Dl=a(53),wl=a.n(Dl),yl=a(24),Ml=a(34);function Pl(e){if(!(Object(S.IsSupportTransferableDataChannel)()&&I.default.enableTransferDataChannel)||!e)return null;if("undefined"!=typeof DedicatedWorkerGlobalScope)return null;let t=j.dataTransportMgr;return null==t.mediadatachannel.netthreadworker&&(t.mediadatachannel.netthreadworker=_i(e,"net"),C.default.directReport("transferdatachannel supported")),t.mediadatachannel.netthreadworker}const Nl=null===(Tl=document.currentScript)||void 0===Tl?void 0:Tl.src;const Vl=new class{constructor(){this._isReuseStreamEnabled=!1,this._isStreamInReuseMap=new Map,this.presetedConstraints={audioConstraints:null,videoConstraints:null,audioTimer:null,videoTimer:null},this._deprecatedStream={audio:[],video:[]},this._captureVideoDeferred=null,this.audioConstraints=null,this.audioStream=null,this.isCaptureAudioInProgress=!1,this.audioCaptureElapsedTime=0,this.videoConstraints=null,this.videoStream=null,this.videoStreamTrack=null,this.captureVideoTimer=null,this.checkVideoStreamActiveTimer=null,this.isCaptureVideoInProgress=!1,this.isCapturingAudioFromDefault=!1,this.currentVideoResolution={width:0,height:0},this.streamProcessAbility={isSupportMediaStreamTrackProcessor:S.default.isSupportMediaStreamTrackProcessor(),isSupportVideoTrackReader:S.default.isSupportVideoTrackReader(),isSupportImageCapture:S.default.isSupportImageCapture()},this.mediaStreamTrackProcessor=null,this.reableStream=null,this.videoTrackReader=null,this.videoImageCapture=null,this.videoImageCaptureLocked=!1,this.isAppleGraphic=!1,this.isSupportFullHD=!1,this.facingMode=o.FACE_MODE_UNKNOW,this.VBMFlag=!1,this.audioBridge=null,this.webrtcFlag=!1,this.vbStream=null,this.vb=null,this.isVBEnabled=!1,this.updateVideoStream=null,this.isCaptureAudioFromFile=!1,this.blockUpgradeCapture={},this.videoCaptureSuccessHandler=null,this.videoCaptureFailedHandler=null,this.receivedVideoConstraints=null,this.onVBResolutionChange=null}enableReuseStream(e){this._isReuseStreamEnabled=!!e}_updateStreamInReuse(e,t){t?this._isStreamInReuseMap.set(e,!0):this._isStreamInReuseMap.delete(e)}_isStreamInReuse(e){return!!this._isStreamInReuseMap.get(e)}presetConstraints(e){let{audioConstraints:t,videoConstraints:i}=e;t&&(this.presetedConstraints.audioConstraints=this._getAudioConstraints(t)),i&&(this.presetedConstraints.videoConstraints=this._getVideoConstraints(i))}_clearPresetConstraints(){this.presetedConstraints.audioConstraints=null,this.presetedConstraints.videoConstraints=null}_getPresetAudioConstraints(){const{audioConstraints:e}=this.presetedConstraints;return this._clearPresetConstraints(),!(!e||this.audioStream||this.isCaptureAudioInProgress)&&e}_getPresetVideoConstraints(){const{videoConstraints:e}=this.presetedConstraints;return this._clearPresetConstraints(),!(!e||this.videoStream||this.isCaptureVideoInProgress)&&e}_pushDeprecatedStream(){let{audioStream:e,videoStream:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e&&this._deprecatedStream.audio.push(e),t&&this._deprecatedStream.video.push(t)}_destoryDeprecatedStream(){let{audio:e,video:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e&&(this._deprecatedStream.audio.forEach(e=>{try{this._destoryStream(e)}catch(e){C.default.error("Error when destroying deprecated audio stream",e)}}),this._deprecatedStream.audio=[]),t&&(this._deprecatedStream.video.forEach(e=>{try{this._destoryStream(e)}catch(e){C.default.error("Error when destroying deprecated video stream",e)}}),this._deprecatedStream.video=[])}setStreamProcessAbility(e){let{isSupportMediaStreamTrackProcessor:t,isSupportVideoTrackReader:i,isSupportImageCapture:a}=e;this.streamProcessAbility={...this.streamProcessAbility,...void 0!==t?{isSupportMediaStreamTrackProcessor:t}:{},...void 0!==i?{isSupportVideoTrackReader:i}:{},...void 0!==a?{isSupportImageCapture:a}:{}}}_isFileInputAudioSource(e){return e&&(e.audio instanceof HTMLVideoElement||e.audio instanceof HTMLAudioElement)}_getAudioConstraints(e){let{audioSource:t,isSupportBrowserAec:i,disableAudioAGC:a,disableNoiseSuppression:r,enableOriginalSound:n,enableStereo:o}=e;if(t instanceof HTMLVideoElement||t instanceof HTMLAudioElement)return{audio:t};let s=!1,d=S.default.getOSInfo();return s=i?{deviceId:t?{exact:t}:S.default.browser.isChrome&&"OpenHarmony"!=d.os?{exact:"default"}:void 0,autoGainControl:!a&&!n,noiseSuppression:!r&&!n,latency:0,echoCancellation:!o,channelCount:2,sampleRate:48e3}:{deviceId:t?{exact:t}:S.default.browser.isChrome&&"OpenHarmony"!=d.os?{exact:"default"}:void 0,autoGainControl:!a&&!n,noiseSuppression:!r&&!n,latency:0,echoCancellation:i&&!o,channelCount:2,sampleRate:48e3},s}_isSameAudioConstraintsAsPrev(e){return!this._isFileInputAudioSource(e)&&(!(!this.audioConstraints||!Object(S.deepEqual)(this.audioConstraints,e))&&(!!this.audioStream&&!!this._isStreamHasAudio(this.audioStream)))}_destoryStream(e){let{audioOnly:t,videoOnly:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&!S.default.audioToMediaStreamMananger.isAudioFileStream(e)){let a=[];a=t?e.getAudioTracks():i?e.getVideoTracks():e.getTracks(),a.forEach(e=>{e.stop()})}}_isStreamHasAudio(e){const t=e.getAudioTracks();return t&&t.length>0}_isStreamHasVideo(e){const t=e.getVideoTracks();return t&&t.length>0}destoryAudioMediaStream(){this.audioStream?(this._isFileInputAudioSource(this.audioConstraints)&&S.default.audioToMediaStreamMananger.stopCapture(),this._isReuseStreamEnabled?this._updateStreamInReuse(this.audioStream,!0):(this._updateStreamInReuse(this.audioStream,!1),this._destoryStream(this.audioStream),this.audioStream=null,this.audioConstraints=null,this.audioCaptureElapsedTime=0,this._destoryDeprecatedStream({audio:!0}))):this._destoryDeprecatedStream({audio:!0}),this.enableReuseStream(!1)}shouldCaptureAudio(){return!this.audioStream||this._isStreamInReuse(this.audioStream)}muteUnmuteAudioMediaStream(e){if(this.audioStream){(this.audioStream.getAudioTracks()||[]).forEach(t=>{t.enabled=!e})}}_storeAudioStream(e,t,i){e&&(kl("audio stream is ok"),this.destoryAudioMediaStream(),this.audioStream=e,this.audioConstraints=t,i&&this._setPresetAudioStreamAutoStopTimer())}_setPresetAudioStreamAutoStopTimer(){this._clearPresetAudioStreamAutoStopTimer(),this.presetedConstraints.audioTimer=setTimeout(()=>{this.destoryAudioMediaStream()},1e4)}_clearPresetAudioStreamAutoStopTimer(){this.presetedConstraints.audioTimer&&(clearTimeout(this.presetedConstraints.audioTimer),this.presetedConstraints.audioTimer=null)}addAudioTrackSettingsMonitor(e,t){const i=null==e?void 0:e.getSettings();T.default.add_monitor(t+":"+(null==i?void 0:i.channelCount)+":"+(null==i?void 0:i.echoCancellation)+":"+(null==i?void 0:i.autoGainControl)+":"+(null==i?void 0:i.noiseSuppression))}_handleAudioCaptureSuccess(e,t,i,a){this._clearPresetAudioStreamAutoStopTimer(),a||this._storeAudioStream(e,t),this._updateStreamInReuse(e,!1);let r=e.getAudioTracks()[0];r?(T.default.add_monitor("ATRS:"+r.readyState+":"+r.id),T.default.add_monitor("ATMS:"+r.muted+":"+r.id),this.addAudioTrackSettingsMonitor(r,"NormalAudioCapture"),r.onended=async()=>{if(!await ma.hasPermission("microphone"))return T.default.add_monitor("ATRS:"+r.readyState+":"+r.id+":-R"),void Object(Z.NotifyUIError)(n.AUDIO_STREAM_FAILED,Z.CAPTURE_ERROR_TYPE.PERMISSION_RESET);let e=await navigator.mediaDevices.enumerateDevices(),t=!1;e.forEach(e=>{var i;"audioinput"==e.kind&&(null===(i=e.label)||void 0===i||null===(i=i.replace(/\(\w+:\w+\)|,/gi,""))||void 0===i?void 0:i.trim())==ma.getMicLabel()&&e.deviceId==ma.getMicId()&&(t=!0)}),t?(Object(Z.NotifyUIError)(n.AUDIO_STREAM_FAILED,Z.CAPTURE_ERROR_TYPE.EXCEPTION),T.default.add_monitor("ATRS:"+r.readyState+":"+r.id+":-L")):T.default.add_monitor("ATRS:"+r.readyState+":"+r.id+":-I")},r.muted?(I.default.Notify_APPUI_SAFE(n.AUDIO_STREAM_MUTED,o.REMINDER_AFTER_MUTED),this.audioBridge&&(this.audioBridge.isMutedBySystem=!0)):(I.default.Notify_APPUI_SAFE(n.AUDIO_STREAM_UNMUTED),this.audioBridge&&(this.audioBridge.isMutedBySystem=!1)),r.onmute=()=>{T.default.add_monitor("ATMS:"+r.muted+":"+r.id);const e=this.audioStream.getAudioTracks()[0];e&&e.id===r.id&&(this.audioBridge&&(this.audioBridge.isMutedBySystem=!0),I.default.Notify_APPUI_SAFE(n.AUDIO_STREAM_MUTED,o.RECAPTURE_AUDIO_AFTER_MUTED))},r.onunmute=()=>{T.default.add_monitor("ATMS:"+r.muted+":"+r.id);const e=this.audioStream.getAudioTracks()[0];e&&e.id===r.id&&(this.audioBridge&&(this.audioBridge.muted||this.audioBridge.unmute(),this.audioBridge.isMutedBySystem=!1),I.default.Notify_APPUI_SAFE(n.AUDIO_STREAM_UNMUTED))}):T.default.add_monitor("TN"),i(e)}_genAudioStream(e){try{const t=e.getAudioTracks();if(0===t.length)return null;return new MediaStream(t)}catch(t){return C.default.warn("_genAudioStream",t),this._destoryStream(e,{videoOnly:!0}),e}}_genVideoStream(e){try{const t=e.getVideoTracks();if(0===t.length)return null;return new MediaStream(t)}catch(t){return C.default.warn("_genVideoStream",t),this._destoryStream(e,{audioOnly:!0}),e}}_splitAudioStream(e,t,i,a){const{audio:r,video:n}=t;if(n&&this._isStreamHasVideo(e)){const t=this._genAudioStream(e),o=this._genVideoStream(e);return t?this._handleAudioCaptureSuccess(t,r,i):a(new Error("audio stream do not contains audio track ")),void(o&&(this.videoStream?this._pushDeprecatedStream({videoStream:o}):(this._updateStreamInReuse(o,!0),this._storeVideoStream(o,n,!0))))}this._handleAudioCaptureSuccess(e,r,i)}async _captureFileInputAudioStream(e){const{audio:t}=e;try{if(!await new Promise((e,i)=>{t.currentTime>0&&!t.paused&&!t.ended&&e(!0);const a=()=>{e(!0),t.removeEventListener("timeupdate",a)};t.addEventListener("timeupdate",a),setTimeout(()=>i(!1),1e4)}))throw new Error("audio file playing failed");return S.default.audioToMediaStreamMananger.startCapture(t)}catch(e){console.error(e);const t=new Error("capture stream from file input souce failed");throw t.name="FileInputSouceError",t}}async startCaptureAudio(e){var t,i;let{audioConstraints:a,successHandler:r,errorHandler:n}=e;this.enableReuseStream(!1);const o=!!a&&this._getAudioConstraints(a),s=this._isFileInputAudioSource(o);this.isCaptureAudioFromFile=s;const d=this._isSameAudioConstraintsAsPrev(o),u=this._getPresetVideoConstraints();if(this._clearPresetAudioStreamAutoStopTimer(),d)return this.audioCaptureElapsedTime=-2,void this._handleAudioCaptureSuccess(this.audioStream,o,r,!0);const l={audio:o,video:s?null:u};this.isCaptureAudioInProgress=!0;let c=Date.now();S.default.isIphoneOrIpadSafari()&&(this._captureVideoDeferred&&await this._captureVideoDeferred.promise,this._captureVideoDeferred=new S.Deferred),this.destoryAudioMediaStream(),T.default.add_monitor("RGUMA"),document.removeEventListener("visibilitychange",Ul),this.isCapturingAudioFromDefault="default"===(null==l||null===(t=l.audio)||void 0===t?void 0:t.deviceId)||!(null!=l&&null!==(i=l.audio)&&void 0!==i&&i.deviceId),(s?this._captureFileInputAudioStream(o):navigator.mediaDevices.getUserMedia(l)).then(e=>{if(I.default.ComputerAudioStatus===R.a.ComputerAudio_Null)return C.default.log("getUserMedia successfully but UI has called leave audio"),void e.getAudioTracks().forEach(e=>{e.stop()});this.audioCaptureElapsedTime=Date.now()-c,this._splitAudioStream(e,l,r,n)}).catch(e=>{I.default.ComputerAudioStatus!==R.a.ComputerAudio_Null?(s||ma.updateSelectedMicDevices(o.deviceId&&o.deviceId.exact||"default","getUsermedia failed",Date.now()-c,!1),n(e)):C.default.log("getUserMedia failed but UI has called leave audio")}).finally(()=>{this.isCaptureAudioInProgress=!1,this._captureVideoDeferred&&this._captureVideoDeferred.resolve()})}_isFileInputVideoSource(e){return e&&e.video instanceof HTMLVideoElement}isUsingFileInputVideoSource(){return this._isFileInputVideoSource(this.videoConstraints)}_getFileInputSourceSize(e,t){const i=[90,180,360,720];return t||(t=360),t>720&&(t=720),t<90&&(t=90),-1===i.indexOf(t)&&i.some((e,a)=>e>t&&(t=(e+i[a-1])/2o.MAX_VIDEO_CAPTURE_FPS&&(c=o.MAX_VIDEO_CAPTURE_FPS),co.LOWER_VIDEO_CAPTURE_FPS&&(c=o.LOWER_VIDEO_CAPTURE_FPS),this.webrtcFlag&&(c={min:o.VIDEO_CAPTURE_FPS,max:o.MAX_VIDEO_CAPTURE_FPS,ideal:o.MAX_VIDEO_CAPTURE_FPS});const h=c,f=["user","environment","left","right"];if(this.webrtcFlag)if(i)l=!f.includes(t)||{facingMode:{exact:t},frameRate:h};else{const{width:e,height:i}=this.currentVideoResolution,o=0!=e&&0!=i;let u=o?e:a||640,c=o?i:r||360;u>=1280&&(u=1280,c=720),l={width:{min:u,ideal:u},height:{min:c,ideal:c},deviceId:t?{exact:t}:void 0,frameRate:h,pan:n,tilt:s,zoom:d}}else if(i)l=!t||(f.includes(t)?{facingMode:{exact:t}}:{deviceId:{exact:t}});else if(S.default.browser.isSafari)l=!t||{deviceId:{exact:t}};else{const{width:e,height:i}=this.currentVideoResolution,o=0!=e&&0!=i;let u=o?e:a||640,c=o?i:r||360;u>=1920&&!S.default.get1080pcapacity()&&(u=1280,c=720),l={width:{min:u,ideal:u},height:{min:c,ideal:c},deviceId:t?{exact:t}:void 0,frameRate:h,pan:n,tilt:s,zoom:d}}return l}_getVideoIdealWidthHeight(e){let{videoSource:t,usingFacingMode:i,width:a,height:r}=e;if(t instanceof HTMLVideoElement||this.webrtcFlag)return!0;if(i)return!0;if(S.default.browser.isSafari)return!0;{const{width:e,height:t}=this.currentVideoResolution||{},i=0!=e&&0!=t;let n=i?e:a||640,o=i?t:r||360;return n>=1920&&!S.default.get1080pcapacity()&&(n=1280,o=720),{width:{ideal:n},height:{ideal:o}}}}_updateVideoConstraints(e){return this.videoStreamTrack?this.videoStreamTrack.applyConstraints(e).catch(t=>{const{readyState:i}=this.videoStreamTrack;if(C.default.error("Applying video constraints failed "+i+JSON.stringify(e),t),"ended"===i){const{width:e,height:t}=this.currentVideoResolution,{deviceId:i}=this.videoStreamTrack.getSettings();this.blockUpgradeCapture[i]=!0,this.destoryVideoMediaStream();const a={...this.receivedVideoConstraints};e&&(a.width=e),t&&(a.height=t),this.startCaptureVideo({videoConstraints:a,timeout:null}).catch(e=>{C.default.error("Recapture video failed: ",e),T.default.add_monitor("RECPF")})}return Promise.reject(t)}):Promise.reject(new Error("video stream not exist! update video constraints failed"))}changeVideoResolution(e,t,i){if(this.isUsingFileInputVideoSource())return Promise.reject(new Error("Reject upgrade caputre, reason: using file input video source"));if(this.videoStreamTrack){if(e>=1920&&!this.isSupportFullHD&&(e=1280,t=720),this.videoStreamTrack.getSettings){let a=this.videoStreamTrack.getSettings();if(Math.abs(a.width-e)<50)return Promise.reject(new Error("Reject upgrade caputre, reason: width change less than 50"));if((e>a.width||t>a.height||i>a.frameRate)&&this.blockUpgradeCapture[a.deviceId])return Promise.reject(new Error("Reject upgrade caputre, reason: block upgrade capture"))}T.default.add_monitor("CCWidth"+e);let a=void 0;a=this.webrtcFlag?{min:o.VIDEO_CAPTURE_FPS,max:o.MAX_VIDEO_CAPTURE_FPS,ideal:i}:{max:o.MAX_VIDEO_CAPTURE_FPS,ideal:i};let r={width:{min:e,ideal:e},height:{min:t,ideal:t},frameRate:a,aspectRatio:this.platformType==o.WCL_PLATFORM_TYPE.DESKTOP?{ideal:16/9}:void 0};return this._updateVideoConstraints(r).then(()=>{if(this.currentVideoResolution={width:e,height:t},this.webrtcFlag&&this.isVBEnabled){const e=this.videoStream.getVideoTracks()[0];if(e){const{width:t,height:i}=e.getSettings();return new Promise((e,a)=>{const r=setTimeout(()=>{this.onVBResolutionChange=null,a()},150);this.onVBResolutionChange=a=>{a.width===t&&a.height===i&&(clearTimeout(r),this.onVBResolutionChange=null,e())}})}}})}return Promise.reject(new Error("video stream not exist! change video resolution failed"))}_isSameVideoConstraintsAsPrev(e){return!this._isFileInputVideoSource(e)&&(!(!this.videoConstraints||!Object(S.deepEqual)(this.videoConstraints,e))&&(!!this.videoStream&&!!this._isStreamHasVideo(this.videoStream)))}_clearCaptureVideoTimer(){this.captureVideoTimer&&(clearTimeout(this.captureVideoTimer),this.captureVideoTimer=null)}destoryVideoMediaStream(){this.videoStream?(this._isFileInputVideoSource(this.videoConstraints)&&S.default.videoToMediaStreamManager.stopCapture(),this.vbStream&&this.stopVBStream(),this._isReuseStreamEnabled?this._updateStreamInReuse(this.videoStream,!0):(this._updateStreamInReuse(this.videoStream,!1),this._destoryStream(this.videoStream),this.videoStream=null,this.videoStreamTrack=null,this.videoConstraints=null,this._destoryDeprecatedStream({video:!0}))):this._destoryDeprecatedStream({video:!0}),this._isReuseStreamEnabled||this._clearCaptureVideoTimer(),this.enableReuseStream(!1),this.destoryVideoProcessor(),this._clearCheckVideoStreamActiveTimer()}shouldCaptureVideo(){return!this.videoStream||this._isStreamInReuse(this.videoStream)}_clearCheckVideoStreamActiveTimer(){this.checkVideoStreamActiveTimer&&(clearTimeout(this.checkVideoStreamActiveTimer),this.checkVideoStreamActiveTimer=null)}checkVideoStreamActive(){return new Promise((e,t)=>{this._clearCheckVideoStreamActiveTimer(),this.checkVideoStreamActiveTimer=setTimeout(()=>{this.videoStream?!1===this.videoStream.active?t(new Z.CameraOccupiedError("VideoMediaStram.active equals false")):e(!0):t(!1)},1e3)})}destoryVideoProcessor(){if(this.videoTrackReader){try{this.videoTrackReader.stop()}catch(e){C.default.error("Error when destroying video track reader",e)}this.videoTrackReader=null}if(this.mediaStreamTrackProcessor){if(this.mediaStreamTrackProcessor=null,mt({command:"releaseStream"}),this.reableStream&&this.reableStream.close)try{this.reableStream.close()}catch(e){C.default.error("Error when destroying mediaStreamTrackProcessor",e)}this.reableStream=null}this.videoImageCapture=null,this.unLockImageCapture()}lockImageCapture(){this.videoImageCaptureLocked=!0}unLockImageCapture(){this.videoImageCaptureLocked=!1}isImageCaptureLocked(){return this.videoImageCaptureLocked}_createVideoProcessor(){this.videoStreamTrack?this.streamProcessAbility.isSupportMediaStreamTrackProcessor?(this.mediaStreamTrackProcessor=new MediaStreamTrackProcessor(this.videoStreamTrack),this.reableStream=this.mediaStreamTrackProcessor.readable,mt({command:"releaseStream"}),gt("frameStream",this.reableStream),T.default.add_monitor("VCTP")):this.streamProcessAbility.isSupportVideoTrackReader?(this.videoTrackReader=new VideoTrackReader(this.videoStreamTrack),T.default.add_monitor("VCTR")):this.streamProcessAbility.isSupportImageCapture&&(this.videoImageCapture=new ImageCapture(this.videoStreamTrack),T.default.add_monitor("VCIC")):C.default.error("Video stream track does not exist - cannot create video processor")}_storeVideoStream(e,t,i){e&&(kl("video stream is ok"),this.destoryVideoMediaStream(),this.videoStream=e,this.videoStreamTrack=this.videoStream.getVideoTracks()[0],this.videoConstraints=t,i&&this._setPresetVideoStreamAutoStopTimer())}_setPresetVideoStreamAutoStopTimer(){this._clearPresetVideoStreamAutoStopTimer(),this.presetedConstraints.videoTimer=setTimeout(()=>{this.destoryVideoMediaStream()},1e4)}_clearPresetVideoStreamAutoStopTimer(){this.presetedConstraints.videoTimer&&(clearTimeout(this.presetedConstraints.videoTimer),this.presetedConstraints.videoTimer=null)}_handleVideoCaptureSuccess(e,t,i,a){this._clearPresetVideoStreamAutoStopTimer(),a||this._storeVideoStream(e,t),this.webrtcFlag||this._createVideoProcessor(),this._updateStreamInReuse(e,!1),this.isVBEnabled?this.startVBStream().then(()=>{i(e)}).catch(()=>{}):i(e)}getVideoCapabilities(){if(this.videoStream&&(this.videoStreamTrack||(this.videoStreamTrack=this.videoStream.getVideoTracks()[0]),this.videoStreamTrack)){if(this.videoStreamTrack.getCapabilities)return this.videoStreamTrack.getCapabilities()||{};if(this.videoStreamTrack.getSettings)return this.videoStreamTrack.getSettings()||{}}return{}}getAudioCapabilities(){let e=null,t=null;if(this.audioStream){let i=this.audioStream.getAudioTracks()[0];i&&(e=i.getSettings().deviceId,t=i.label)}return{deviceId:e,elapsed_time:this.audioCaptureElapsedTime,deviceLabel:t}}getAudioDeviceId(){return this.isCapturingAudioFromDefault?null:this.getAudioCapabilities().deviceId}_splitVideoStream(e,t,i,a){const{audio:r,video:n}=t;if(r&&this._isStreamHasAudio(e)){const t=this._genVideoStream(e),o=this._genAudioStream(e);return t?this._handleVideoCaptureSuccess(t,n,i):a(new Error("video stream do not contains video track ")),void(o&&(this.audioStream?this._pushDeprecatedStream({audioStream:o}):(this._updateStreamInReuse(o,!0),this._storeAudioStream(o,r,!0))))}this._handleVideoCaptureSuccess(e,n,i)}async _captureFileInputVideoStream(e){const{video:t}=e;try{if(!await new Promise((e,i)=>{t.currentTime>0&&!t.paused&&!t.ended&&e(!0);const a=()=>{e(!0),t.removeEventListener("timeupdate",a)};t.addEventListener("timeupdate",a),setTimeout(()=>i(!1),1e4)}))throw new Error("video file playing failed");if(!e.width||!e.height){const{width:i,height:a}=_getFileInputSourceSize(t.videoWidth,t.videoHeight);e.width=i,e.height=a}return S.default.videoToMediaStreamManager.startCapture(t,e.width,e.height)}catch(e){console.error(e);const t=new Error("capture stream from file input souce failed");throw t.name="FileInputSouceError",t}}async startCaptureVideo(e){let{videoConstraints:t,timeout:i,successHandler:a=this.videoCaptureSuccessHandler,errorHandler:r=this.videoCaptureFailedHandler}=e;this.videoCaptureSuccessHandler=a,this.videoCaptureFailedHandler=r,this.receivedVideoConstraints=t,this._captureVideoDeferred&&await this._captureVideoDeferred.promise,this.enableReuseStream(!1);const n=!!t&&this._getVideoConstraints(t),s=this._isFileInputVideoSource(n),d=this._isSameVideoConstraintsAsPrev(n),u=this._getPresetAudioConstraints();if(this._clearPresetVideoStreamAutoStopTimer(),T.default.add_monitor("STARTVIDEOCAPTURE:".concat(!!this._captureVideoDeferred,":").concat(d)),d)return void this._handleVideoCaptureSuccess(this.videoStream,n,a,!0);this.destoryVideoMediaStream();const l={audio:s?null:u,video:n};kl("try to getusermedia",l),T.default.add_monitor("VCFC: ".concat(Object(S.replaceComma)(JSON.stringify(l)),"|isFileInputVideoSource:").concat(s));try{this.isCaptureVideoInProgress=!0;let e,d=!1;this._clearCaptureVideoTimer(),i&&(this.captureVideoTimer=setTimeout(()=>{if(!e){d=!0;const e=new Error("GetUserMedia timeout");r(e)}},i));let u=Date.now();if(s)e=await this._captureFileInputVideoStream(n);else try{e=await navigator.mediaDevices.getUserMedia(l)}catch(i){let a=!0;if(i instanceof OverconstrainedError){a=this._getVideoIdealWidthHeight(t),a instanceof Object&&(a=Object.assign({},l.video,a));try{e=await navigator.mediaDevices.getUserMedia(Object.assign({},l,{video:a})),r(i,!0)}catch(e){r(e)}}else r(i)}if(this._clearCaptureVideoTimer(),!e)return;{let t=e.getVideoTracks()[0];if(t&&t.getCapabilities){var c;let e=t.getCapabilities();(null==e||null===(c=e.width)||void 0===c?void 0:c.max)>=1920&&(this.isSupportFullHD=!0)}let i=t.getSettings();const{width:a,height:r,frameRate:n,facingMode:s,deviceId:l}=i||{};this.facingMode="user"===s?o.FACE_MODE_USER:"environment"===s?o.FACE_MODE_ENVIRONMENT:o.FACE_MODE_UNKNOW;const h={width:a,height:r,frameRate:n,facingMode:s};T.default.add_monitor("CapturedVT: ".concat(Object(S.replaceComma)(JSON.stringify(h))));let f=t.label;if(d)return this._destoryStream(e),void ma.updateSelectedCameraDevices(l,f,a,r,n,Date.now()-u,!1);ma.updateSelectedCameraDevices(l,f,a,r,n,Date.now()-u,!0)}this._splitVideoStream(e,l,a,r)}catch(e){r(e)}finally{this.isCaptureVideoInProgress=!1}}playVideoStream(e){if(e){e.setAttribute("muted",""),e.setAttribute("playsinline","");try{e.srcObject=this.videoStream}catch(t){e.src=URL.createObjectURL(this.videoStream)}const t=e.play();return t?t.then(()=>{}).catch(e=>{if(!e.message.includes("The play() request was interrupted")&&!e.message.includes("The fetching process for the media resource was aborted"))throw C.default.warn("Video element playback failed",e),e}):Promise.resolve(void 0)}return Promise.reject(new Error("video dom node not provided!"))}removeVideoStream(e){if(e){(()=>{!e.paused&&e.pause(),e.srcObject&&(e.srcObject=null),e.src&&(e.src=null)})()}}destoryReuseStream(){let{audio:e,video:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.enableReuseStream(!1),e&&this.destoryAudioMediaStream(),t&&this.destoryVideoMediaStream()}async initVB(e){if(!this.vb){const e=Nl.substring(0,Nl.lastIndexOf("/"));let t;this.vb=new wl.a({cdnPath:e}),this.vb.ontimeout3s=()=>{T.default.add_monitor("VBP3S"),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_3S,null)},this.vb.ontimeout10s=()=>{T.default.add_monitor("VBP10S"),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_10S,null)},this.vb.onMessage(e=>{const{cmd:i,payload:a}=e;if(i===yl.VB_EVENT_TYPE.VB_MODEL_READY)t=performance.now();else if(i===yl.VB_EVENT_TYPE.VB_PREDICT_DONE){const i=performance.now()-t;T.default.add_monitor("VBPOK"+i),T.default.add_monitor("TFBE-"+e.payload)}else if(i===yl.VB_EVENT_TYPE.VB_GENERATE_FIRST_FRAME&&this.isVBEnabled&&this.updateVideoStream)this.updateVideoStream(this.vbStream);else if(i===yl.VB_EVENT_TYPE.VB_WORKER_ERROR){switch(a.message){case yl.VB_VIDEOFRAME_COPYTO_ERROR:Object(Z.NotifyUIError)(n.VB_PROCESS_IMAGE_FAIL)}C.default.error("VB module error: ",a)}else i===yl.VB_EVENT_TYPE.VB_RESOLUTION_CHANGE&&this.onVBResolutionChange&&this.onVBResolutionChange(a)}),T.default.add_monitor("CWMSCVB")}this.updateVideoStream=e;try{await this.vb.initialize(),I.default.Notify_APPUI(n.VB_MODEL_PRELOADING_OK,null)}catch(e){C.default.error("VB initialize failed",e),T.default.add_monitor("VBBEF");const{VB_SETTING_PARA_ERROR_TYPE:t}=n;I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,t.FAIL)}}async changeVBImage(e){if(this.isVBEnabled=!0,"blur"===e)this.vb.set_background_blur();else{this.vb.set_background_image(e)||C.default.error("WebRTC change VB background failed")}if(!this.vbStream&&this.videoStream)try{await this.startVBStream()}catch(e){C.default.error("WebRTC startVBStream failed",e)}}startVBStream(){return this.videoStream.getVideoTracks()[0]?(this.vbStream=this.vb.createStream(),this.vb.captureVideo(this.videoStream)):Promise.reject("start vb stream fail")}stopVBStream(){this.vbStream=null,this.vb.stopCapture(!1)}disableVB(){this.isVBEnabled=!1,this.updateVideoStream&&this.updateVideoStream(this.videoStream),this.stopVBStream()}getVideoStream(){return this.isVBEnabled?this.vbStream:this.videoStream}async adjustShareResUnder2K(e){const{height:t,width:i}=e.getSettings(),a=t>=i;if((a?i:t)>1440||(a?t:i)>2560){const t=e.getConstraints();t.height=a?2560:1440,t.width=a?1440:2560;try{await e.applyConstraints(t)}catch(t){kl.error("browser does not support applyConstraints",t),T.default.add_monitor("SVSTACF: ".concat(e.readyState))}}}getScaledResolution(e,t){if(e>t&&e>2560){let i=e/2560,a=t/1440;return i>a?{w:2560,h:Math.floor(t/i)}:{w:Math.floor(e/a),h:1440}}return{w:e,h:t}}},kl=Object(v.a)("sdk");function Ul(){document.hidden||(T.default.add_monitor("RE-CAPTURE"),I.default.Notify_APPUI_SAFE(n.RECAPTURE_AUDIO),document.removeEventListener("visibilitychange",Ul))}let Ll=!1;try{Ll=!1}catch(e){}var xl=0;const Wl=e=>{switch(window.orientation){case 0:xl=1;break;case 90:xl=2;break;case 180:xl=3;break;case-90:default:xl=0}};function Bl(){return S.default.isIphoneOrIpadSafari()}function Gl(e){let t=n.CAPTURE_FAILED_REASON.UNKNOWN_REASON,i="Unknown reason";return"NotAllowedError"===(null==e?void 0:e.name)?"Permission denied by system"===(null==e?void 0:e.message)?(t=n.CAPTURE_FAILED_REASON.SYSTEM_DENIED,i="Permission denied by system"):"Permission denied"===(null==e?void 0:e.message)||null!=e&&e.message.includes("The request is not allowed by the user agent or the platform in the current context")?(t=n.CAPTURE_FAILED_REASON.USER_DENIED,i="Permission denied by user"):"Permission dismissed"===e.message&&(t=n.CAPTURE_FAILED_REASON.USER_DISMISS,i="Permission dismissed by user"):"NotFoundError"===(null==e?void 0:e.name)?"The object can not be found here."===e.message?(t=n.CAPTURE_FAILED_REASON.SYSTEM_DENIED,i="Permission denied by system"):"Requested device not found"===e.message&&(t=n.CAPTURE_FAILED_REASON.NO_DEVICE,i="No device found"):"NotReadableError"!==(null==e?void 0:e.name)&&"TrackStartError"!==(null==e?void 0:e.name)||"Device in use"!==(null==e?void 0:e.message)?"OverconstrainedError"===(null==e?void 0:e.name)&&(t=n.CAPTURE_FAILED_REASON.OVERCONSTRAINED,i="Constraint violation"):(t=n.CAPTURE_FAILED_REASON.DEVICE_IN_USE,i="Device in use"),{errorCode:t,errorMessage:i,error:e}}!function(){try{var e,t,i;null!==(e=screen)&&void 0!==e&&e.orientation,null===(t=window)||void 0===t||t.removeEventListener("orientationchange",Wl),null===(i=window)||void 0===i||i.addEventListener("orientationchange",Wl),Wl()}catch(e){}}(),document.addEventListener("visibilitychange",()=>{let e=S.default.getMachineCapability();T.default.add_monitor("page_visibility:".concat(document.visibilityState)),document.hidden?(e.unvisibilitycount++,e.visibility=!1):e.visibility=!0}),function(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(j.dataTransportMgr)return;let i=new B({type:t?B.THREAD_SUB:B.THREAD_MAIN,remote:t?self:null});j.dataTransportMgr=i,i.monitorlogfn=e,t&&self.addEventListener("message",i._onrecvmainthreadlistener.bind(i))}catch(e){console.error("<<<< InitDataTransportModule",e)}}();var Fl=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(kl("sdkProps",t),T.default.reset(),Vl.webrtcFlag=!1,this._id=(new Date).getTime()+Math.floor(performance.now()),t.parentPath){const e=t.parentPath.endsWith("/")?t.parentPath:t.parentPath+"/";a.p=e}else{const e=null==Nl?void 0:Nl.indexOf("js_media.min.js");e?a.p=null==Nl?void 0:Nl.substring(0,e):kl("could not locate parentPath")}if(this.lateLoadedAssetsHash={},t.globalTracingLogger&&C.default.setInstance(t.globalTracingLogger,Fl.fixVersion),C.default.clearHighFrequencyLogs(),this.isSupportThread="object"==typeof WebAssembly&&"function"==typeof Worker,!this.isSupportThread)throw new Error("Webassemly or worker is not supported on this browser");let i=I.default.sharedBuffer;I.default.reinit(this),i&&(I.default.sharedBuffer=i),this.localLog=null,Ll&&(this.localLog=new Va,this.localLog.init()),ma.init(),this.userId="",this.selfPreviewVideotagList=[],this.sharingCanvasList=[],this.mainSharingCanvas=null,this.annoCanvas=null,this.audioCtx=null,this.sharingAudioCtx=null,this.webrtcAudioNode=null,this.sharingWebrtcAudioNode=null,this.videoRenderArray=[],this.videoCaptureValue=null,this.audioRenderArray=[],this.audioCapture=null,this.deviceInfo=new Map,this.display=[],this.sampleRate=null===(e=this.audioCtx)||void 0===e?void 0:e.sampleRate,this.videoRenderIntervalHandle=null,this.audioDomNode=null,this.audioSpeakerValue=null,this.audionoderecordbuffersize=2048,this.lastresidual=null,this.currentactive=0,this.audioPlay=!1,this.sharingInterval=null,this.sharingIntervalTime=100,this.sharingDisplay=null,this.currentshareactive=0,this.activeSpeakerSsrc=0,this.videorenderinterval=30,this.waterMarkCanvas=null,this.videoCaptureHiddenCanvas=null,this.videoCaptureHiddenCanvasCtx=null,this.isSetCursor=!1,this.logon=!1,this.canvas=null,this.firstSetDelay=!0,this.isSelfViewWithVideo=!1,this.isSupportOffscreenCanvas=S.default.isSupportOffscreenCanvas(),this.isSupportImageCapture=S.default.isSupportImageCapture(),this.isSharingSupportImageCapture=this.isSupportImageCapture,this.isSupportVideoTrackReader=S.default.isSupportVideoTrackReader(),this.isSupportSharingTrackReader=this.isSupportVideoTrackReader,this.isSupportVideoShare=S.default.isSupportVideoShareReceive()&&S.default.isSupportVideoShareSend(),this.isSupportMediaStreamTrackProcessor=S.default.isSupportMediaStreamTrackProcessor(),this.isSupportVideoFrameOrBitmapCapture=S.default.isSupportVideoFrameOrBitmapCapture(),this.isMultipleCanvasForMultipleView=0,this.canISendNextSharingFrame=!0,this.isCaputureNodeConnect=!1,this.isSharingCaptureNodeConnect=!1,this.audioWorkletJsPath=null,this.isSupportChromeWideAEC=S.default.isSupportChromeWideAEC(),this.isSupport2DCanvasDrawFrame=S.default.isSupport2DCanvasDrawFrame(),this.MaskImage=null,this.BgImage=null,this.bgCanvas=null,this.bgCanvasctx=null,this.isCurrentInMaskStatus=!1,this.isCurrentInNoVBPreviewStatus=!1,this.videoNoVBPreviewCanvas=null,this.videoNoVBPreviewCanvasctx=null,this.isVideoNoVBPreviewCanvasScaled=!1,this.maskCoordinate={dx:0,dy:0,dWidth:0,dHeight:0},this.VideoMaskSettingCanvas=null,this.VideoMaskSettingCanvasctx=null,this.PrevVideoMaskSettingCanvas=null,this.VideoMaskCanvasFillMode=0,this.isMaskSettingOn=!1,this.isMaskSettingStarted=!1,this.MaskData=null,this.MaskSettingVideo=null,this.ReadyCapureWidth=640,this.ReadyCapureHeight=360,this.bgImageCroppingParams={sx:0,sy:0,sw:0,sh:0},this.VideoVBSettingCanvas=null,this.isVBSettingOn=!1,this.sMonitorCaptureFrameCount=0,this.vMonitorCaptureFrameCount=0,this.videoCaptureInterval=0,this.isStartVideoCapture=!1,this.videoCaptureWidth=0,this.videoCaptureHeight=0,this.videoCaptureContext=null,this.isCreateVideoWaterMark=!1,this.videoWaterMarkName="",this.sharingWaterMarkName="",this.isCreateSharingWaterMark=!1,this.videoWaterMarkParams={},this.sharingWaterMarkParams={},this.isStartDesktopSharing=!1,this.desktopSharingValue=null,this.desktopCaptureContext=null,this.desktopSharingMediaStram=null,this.desktopSharingCaptureWidth=0,this.desktopSharingCaptureHeight=0,this.sharingCodecInfo={width:0,height:0},this.desktopSharingSend=!1,this.isdesktopCaptureLoadedmetadata=!1,this.captureVideoOutputCanvasDomList=[],this.captureVideoOutPutVideoDom=null,this.shareTrack=null,this.isVideoCaptureLoadedmetadata=!1,this.videoloadmetadataListener=null,this.videoloadedmetadatamonitor=null,this.loadedmetadatamtimeoutcount=0,this.mountoadedmetadatatime=0,this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO={},this.vMonitorCount=0,this.sMonitorCount=0,this.mMonitorCount=0,this.sharingTrackReader,this.sharingMediaStreamTrackProcessor,this.sharingFrameStream,this.isSendVideoOfflineCanvas=!1,I.default.mediaSDKHandle=this,this._preloadMeetingParam=null,this.is32bitbrowser=!1,this.flipSend=!0,this.mtu_size=0,this.sharingImageCapture=null,this.sharingRenderCanvas=null,this.VideoRenderObj=null,this.SharingRenderObj=null,this.rtcConnectionA=null,this.rtcConnectionB=null,this.isLocalP2PSupportedPromise=S.default.checkLocalP2PConnection(),this.isSupportBrowserAec=!0,this.sharingWidthAndHeightInfo={ctiveNodeID:0,height:0,logicHeight:0,logicWidth:0,width:0},this.remoteControl=null,this.isMirrorMyVideo=!1,this.isCanvasScaled=!1,this.isDestroy=!1,this.destoryPromise=null,this.rwgAgentMessageListenerWrapper=this.rwgAgentMessageListener.bind(this),this.bVideoDecodeUsingSAB=S.default.isSupportSharedArrayBuffer(),this.bVideoEncodeUsingSAB=S.default.isSupportSharedArrayBuffer(),this.bAudioEncodeUsingSAB=S.default.isSupportSharedArrayBuffer(),this.bAudioDecodeUsingSAB=S.default.isSupportSharedArrayBuffer(),this.videoDecodeRingBuffer=null,this.videoEncodeRingBuffer=null,this.audioDecodeRingBuffer=null,this.audioEncodeRingBuffer=null,this.bVideoEncodeMainThreadConsumerIntervalEnable=Bl(),this.isSupportOffscreenCanvasForVideoDecode=S.default.isSupportOffscreenCanvas(),this.isMultiView=!1,this.checkWorkletInterval=null,this.persistenceInfo=new Ml.a,this.audioPersistenceInfo=this.persistenceInfo.getAudioSolutionInfo("audio"),t.ivObj&&(I.default.ivObj=t.ivObj),this.lastRealRect={left:0,top:0,width:0,height:0},this.videodecodehardwareflag=null,this.videoencodehardwareflag=null,this.isEnableVideoDecodeHardWareThread=!1,this.hardwareflag=null,this.isEnableHardWareThread=!1,this.isTeslaMode=!1,this.useAudioBridge=!1,this.audioBridge=null,this.replaceCanvasMap={},this.hidAvalible=!1,this.enableHID=!1,this.audioInputLevel=null,this.captureAudioMuted=!1,this.setvideokk=!1,this.isStartWhiteboardSharing=!1,this.ZoomMonitor=T.default.add_monitor.bind(T.default),this.isLandScape=!1,this.captureSize=null,this.platformType=o.WCL_PLATFORM_TYPE.DESKTOP,Object(Z.SetMonitorFn)(this.ZoomMonitor),this.wmscManager=null,this.webrtcConfig={userId:null,webrtcflag:!1,subscribeQosParamsData:{},currentReloadTimes:0,maxReloadTimes:6},this.allpromises=[],this.RenderInMain=o.RENDER_UNSET,this.vcFlag=!1,this.waitingVcChannelReady=!1,Ua.isSupportComputePressure()&&(this.computePressureManager=new Ua),this.renderManager=new Rl("JsMediaSDK"),this.rendererType=-1,this.defaultRendererType=0,this.isWebGPUFeatureEnabled=!1,this.enableVBWasmBackend=0,this.isWebGL2FeatureEnabled=!1,this.isWebTransportAllowed=!0,this.mGPUBlacklist=null,this.mWebCodecConfig=null,this.isWebCodecEncoderOnWhitelist=!1,this.isWebCodecDecoderOnWhitelist=!1,this.isVideoHD=!1,this.vbResource=null,this.vbSettingDomMap={},this.annotationModule=null,this.annotationMgr=null,this.fileAudioPlaybackTag=null,this.initVEPara=null,this.resolveVEwebrtcpromise=null,this.webrtcpromise=new Promise((e,t)=>{this.resolveVEwebrtcpromise=e}),this.initVDPara=null,this.resolveVDwebrtcpromise=null,this.webrtcVDpromise=new Promise((e,t)=>{this.resolveVDwebrtcpromise=e}),this.hadsetpropsbeforeinit=!1,this.networkerpath=null,this.dataChannelController=new J,this.dataChannelController.addTransportListiner(),$(this),ee(this.workrtHealthCheckReport.bind(this))};Fl.buildNumber=9305,Fl.version="15.0.9305",Fl.util=S.default,Fl.fixVersion="Web-Media-EP-20241229",Fl.prototype={JsMediaSDK_Log:function(e){C.default.error("Error in JsMediaSDK",e)},JsMediaSDK_PreLoad:function(e,t,i){var a,r;const{isTeslaMode:n,isGoogleMeetMode:o,enableMultiDecodeVideoWithoutSAB:s,enableVirtualBackgroundWithoutSAB:d,enableDecoderInWorklet:u,enableAudioBridge:l,onDesktop:c,disableStreamingInstantiate:h}=i||{};I.default.decoderinworkletOP=!0,I.default.onDesktop=c,I.default.chromeWideAEC=u,I.default.enableStreamingInstantiate=!h,I.default.enableMultiDecodeVideoWithoutSAB=s,I.default.enableVirtualBackgroundWithoutSAB=d,I.default.enableAudioBridge=l,this.isTeslaMode=!!n,I.default.isGoogleMeetMode=o,e.basePath&&(this.getFilePath=this.makFilePath(e.basePath));let f={audioWorkletPath:(e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e).audioWorkletPath,audioWorkletSIMDPath:e.audioWorkletSIMDPath,audioWorkletProcessPath:e.audioWorkletProcessPath,sharingAudioWorkletPath:e.sharingAudioWorkletPath,audioLevelWorkletPath:e.audioLevelWorkletPath,audioWasm:e.audioWasm,audioSIMDWasm:e.audioSIMDWasm};this.networkerpath=null===(r=e)||void 0===r?void 0:r.netThreadPath,this.setPropsBeforeInit({callback:t,audioWorkletPath:f,fromPreload:!0}),this._preloadMeetingParam=e,kt(),this.handleUnloadEvent(),T.default.add_monitor("JSPLD"),this.vbResource=i,this.computePressureManager&&this.computePressureManager.init(),this.mediasdkConfig=null,this.iceServers=[]},getWebRTCFlag(){return this.webrtcConfig&&this.webrtcConfig.webrtcflag},makFilePath(e){let t=e;return function(){return t?{audioWorkerPath:"".concat(t,"/js_audio_process.min.js"),audioWorkletPath:"".concat(t,"/js_audio_worklet.min.js"),audioWorkletSIMDPath:"".concat(t,"/js_audio_worklet_simd.min.js"),audioWorkletProcessPath:"".concat(t,"/js_audio_worklet_process.min.js"),audioWasm:"".concat(t,"/audio.encode.wasm"),videoWorkerPath:"".concat(t,"/video_s.min.js"),videoMtWorkerPath:"".concat(t,"/video_m.min.js"),videoWasm:"".concat(t,"/video.decode.wasm"),videoMtWasm:"".concat(t,"/video.mt.wasm"),sharingWorkerPath:"".concat(t,"/sharing_s.min.js"),sharingMtWorkerPath:"".concat(t,"/sharing_m.min.js"),videoSIMDWorkerPath:"".concat(t,"/video_simd.min.js"),videoSIMDWasm:"".concat(t,"/video.simd.wasm"),sharingSIMDWorkerPath:"".concat(t,"/sharing_simd.min.js"),videoMSIMDWasm:"".concat(t,"/video.mtsimd.wasm"),sharingMSIMDWorkerPath:"".concat(t,"/sharing_mtsimd.min.js"),videoMSIMDWorkerPath:"".concat(t,"/video_mtsimd.min.js"),audioSIMDWorkletPath:"".concat(t,"/audio_simd.min.js"),audioSIMDWasm:"".concat(t,"/audio.simd.wasm"),vsmiworkerpath:"".concat(t,"/video_share_mtsimd.min.js"),sharingAudioWorkletPath:"".concat(t,"/js_sharing_audio_worklet.min.js"),audioLevelWorkletPath:"".concat(t,"/js_audio_level_worklet_process.min.js"),netThreadPath:"".concat(t,"/net_thread.min.js")}:void 0}},isPreviewVideotag(e){return this.userId&&this.userId>>10==e>>10&&S.default.isSelfPreviewRenderWithVideo()},isSelfUser(e){return this.userId==e},recordSharingParamInfo(){let e=this;A.a.on(n.SHARING_PARAM_INFO_FROM_SOCKET,(t,i)=>{var a;Object.assign(e.sharingWidthAndHeightInfo,i.body),null===(a=e.annotationMgr)||void 0===a||a.updateRemoteSizeInfo(i.body)})},setCallback(e){if(!vi()(e))throw new Error("callback must be function");I.default._Notify_APPUI=e,Object(Z.SetNotifyUIFn)(I.default.Notify_APPUI_SAFE.bind(I.default))},addCallback(e){if(!vi()(e))throw new Error("callback must be function");I.default._callbackList.push(e)},removeCallback(e){const t=I.default._callbackList.indexOf(e);-1!==t&&I.default._callbackList.splice(t,1)},setPropsBeforeInit(e){this.hadsetpropsbeforeinit|=!e.fromPreload;let t=e.featureOptions;if(e.mediaFeatureOptions&&(t=e.mediaFeatureOptions),t){const e=[{bitIndex:Ol.a.HW_ENCODER_FOR_360P.index,readCount:1,defaultVal:Ol.a.HW_ENCODER_FOR_360P.default},{bitIndex:Ol.a.WEBGPU_RENDERER.index,readCount:1,defaultVal:Ol.a.WEBGPU_RENDERER.default},{bitIndex:Ol.a.VB_ON_SAFARI_17.index,readCount:1,defaultVal:Ol.a.VB_ON_SAFARI_17.default},{bitIndex:Ol.a.WEBGL2_RENDERER.index,readCount:1,defaultVal:Ol.a.WEBGL2_RENDERER.default},{bitIndex:Ol.a.AUDIO_ECHO_DETECT.index,readCount:1,defaultVal:Ol.a.AUDIO_ECHO_DETECT.default},{bitIndex:Ol.a.WEBCODEC_DECODE_OPTION.index,readCount:1,defaultVal:Ol.a.WEBCODEC_DECODE_OPTION.default},{bitIndex:Ol.a.HW_WEBCODEC_ON_SAFARI.index,readCount:1,defaultVal:Ol.a.HW_WEBCODEC_ON_SAFARI.default},{bitIndex:Ol.a.HW_DECODE_FOR_360P.index,readCount:1,defaultVal:Ol.a.HW_DECODE_FOR_360P.default},{bitIndex:Ol.a.WEBCODEC_ON_ANDROID_CHROME.index,readCount:1,defaultVal:Ol.a.WEBCODEC_ON_ANDROID_CHROME.default},{bitIndex:Ol.a.WEBCODEC_ENCODE_OPT_1ON1.index,readCount:1,defaultVal:Ol.a.WEBCODEC_ENCODE_OPT_1ON1.default},{bitIndex:Ol.a.CAP_WEBCODEC_SUPPORT.index,readCount:1,defaultVal:Ol.a.CAP_WEBCODEC_SUPPORT.default},{bitIndex:Ol.a.WEBGL_CANVAS_OPTION_OPT.index,readCount:1,defaultVal:Ol.a.WEBGL_CANVAS_OPTION_OPT.default},{bitIndex:Ol.a.DEFAULT_RENDERER.index,readCount:1,defaultVal:Ol.a.DEFAULT_RENDERER.default},{bitIndex:Ol.a.WEB_TRANSPORT_CONTROL.index,readCount:1,defaultVal:Ol.a.WEB_TRANSPORT_CONTROL.default},{bitIndex:Ol.a.ENABLE_TP_RLB_WEBSOCKET.index,readCount:1,defaultVal:Ol.a.ENABLE_TP_RLB_WEBSOCKET.default},{bitIndex:Ol.a.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.index,readCount:1,defaultVal:Ol.a.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.default},{bitIndex:Ol.a.ENABLE_WEBRTC_TURN_SERVERS.index,readCount:1,defaultVal:Ol.a.ENABLE_WEBRTC_TURN_SERVERS.default},{bitIndex:Ol.a.EXTRA_DEVICE_INTERVAL_ENUMERATE.index,readCount:1,defaultVal:Ol.a.EXTRA_DEVICE_INTERVAL_ENUMERATE.default}],i=bl.a.batchRead(t,e);this.isWebGPUFeatureEnabled=!!i.get(Ol.a.WEBGPU_RENDERER.index),this.enableVBWasmBackend=i.get(Ol.a.VB_ON_SAFARI_17.index),this.isWebGL2FeatureEnabled=!!i.get(Ol.a.WEBGL2_RENDERER.index),this.defaultRendererType=i.get(Ol.a.DEFAULT_RENDERER.index),this.isWebTransportAllowed=!!i.get(Ol.a.WEB_TRANSPORT_CONTROL.index),I.default.enable360pHWEnc=i.get(Ol.a.HW_ENCODER_FOR_360P.index),I.default.enableEchoDetection=i.get(Ol.a.AUDIO_ECHO_DETECT.index),I.default.enableHADecOpt=i.get(Ol.a.WEBCODEC_DECODE_OPTION.index),I.default.enableSafariHWCodec=i.get(Ol.a.HW_WEBCODEC_ON_SAFARI.index),I.default.enable360pHWDec=i.get(Ol.a.HW_DECODE_FOR_360P.index),I.default.enableAndroidHWCodec=i.get(Ol.a.WEBCODEC_ON_ANDROID_CHROME.index),I.default.enableOptCopyFrame=i.get(Ol.a.WEBCODEC_ENCODE_OPT_1ON1.index),I.default.disableHWCodec=i.get(Ol.a.CAP_WEBCODEC_SUPPORT.index);let a=i.get(Ol.a.WEBGL_CANVAS_OPTION_OPT.index);I.default.enableTransferDataChannel=i.get(Ol.a.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.index),I.default.enableWebrtcTurnServer=i.get(Ol.a.ENABLE_WEBRTC_TURN_SERVERS.index);let r=i.get(Ol.a.EXTRA_DEVICE_INTERVAL_ENUMERATE.index);b.a.setIsEnableCanvasCtxOptionsOpt(a),ma.receiveABOptionForExtraDeviceDetect(r),S.default.isAndroidBrowser()&&(I.default.enable360pHWDec=I.default.enableAndroidHWCodec);const n=S.default.getOSInfo();C.default.directReport("setPropsBeforeInit, os:".concat(n.os,", version:").concat(n.osVersion,", enableSafariHWCodec:").concat(I.default.enableSafariHWCodec,", enable360pHWDec:").concat(I.default.enable360pHWDec,", enable360pHWEnc:").concat(I.default.enable360pHWEnc,", enableAndroidHWCodec:").concat(I.default.enableAndroidHWCodec,",disableHWCodec:").concat(I.default.disableHWCodec,", enableOptCopyFrame:").concat(I.default.enableOptCopyFrame))}const i=S.default.getGpuInfo();if(e&&e.webMediaBlockConfig){try{const t=JSON.parse(e.webMediaBlockConfig);this.mGPUBlacklist=null==t?void 0:t.GPUBlacklist,this.mWebCodecConfig=null==t?void 0:t.WebCodecConfig,this.mWebCodecConfig?(this.isWebCodecEncoderOnWhitelist=Il.a.isGPUProfileOnWebCodecWhitelist("encoder",this.mWebCodecConfig,i),this.isWebCodecDecoderOnWhitelist=Il.a.isGPUProfileOnWebCodecWhitelist("decoder",this.mWebCodecConfig,i)):(this.isWebCodecEncoderOnWhitelist=0===S.default.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=Il.a.isGPUProfileOnWebCodecWhitelist("decoder",void 0,i))}catch{this.isWebCodecEncoderOnWhitelist=0===S.default.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=Il.a.isGPUProfileOnWebCodecWhitelist("decoder",void 0,i),""===e.webMediaBlockConfig?C.default.log("cannot read empty props.webMediaBlockConfig. encoder:".concat(this.isWebCodecEncoderOnWhitelist," decoder:").concat(this.isWebCodecDecoderOnWhitelist)):C.default.error("failed to read props.webMediaBlockConfig! config=".concat(null==e?void 0:e.webMediaBlockConfig," encoder:").concat(this.isWebCodecEncoderOnWhitelist," decoder:").concat(this.isWebCodecDecoderOnWhitelist))}0}else this.isWebCodecEncoderOnWhitelist=0===S.default.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=Il.a.isGPUProfileOnWebCodecWhitelist("decoder",void 0,i);e&&void 0!==e.rendererType&&(this.rendererType=e.rendererType,this.handleRendererTypeInProps(this.rendererType,this.defaultRendererType,this.mGPUBlacklist).then(e=>{I.default.Notify_APPUI(n.SYNC_RENDERER_TYPE_RESPONSE,e),this.renderManager.getRendererProvider().setRendererType(e.rendererType),this.rendererType=e.rendererType,C.default.log("handleRendererTypeInProps() final rendererType=".concat(e.rendererType," gpuBlacklist=").concat(JSON.stringify(this.mGPUBlacklist))),console.log("handleRendererTypeInProps() final rendererType=".concat(e.rendererType," gpuBlacklist=").concat(JSON.stringify(this.mGPUBlacklist)))})),T.default.add_monitor("props:".concat(e.featureOptions,":").concat(this.isWebGPUFeatureEnabled,":").concat(this.enableVBWasmBackend,":").concat(this.isWebGL2FeatureEnabled,":").concat(this.rendererType,":").concat(I.default.enableEchoDetection)),e.callback&&this.setCallback(e.callback),e.audioWorkletPath&&(this.audioWorkletJsPath=e.audioWorkletPath),e.e2eEncrypt?I.default.e2eencrypt=!0:I.default.e2eencrypt=!1;let a=e.enableWebtransport;if(this.isWebTransportAllowed||(a=!1),this._setWebtransportEnable({enable:a,webtransportPort:e.webtransportPort}),e.bandwidth?e.bandwidth.uplimit>=800?I.default.uplimit=1e3*(e.bandwidth.uplimit-120):I.default.uplimit=0:I.default.uplimit||(I.default.uplimit=0),e&&void 0!==e.useWebRTC){const t=!!e.useWebRTC;Vl.webrtcFlag=t,this.webrtcConfig.webrtcflag=t,Object(S.setIsWebRTCMode)(t),!1===t&&this.wmscManager&&T.default.add_monitor("WMSC_Not_Destory_ERROR")}if(!e.fromPreload&&this.vbResource){const{file:e}=this.vbResource;e&&(this.webrtcConfig.webrtcflag?Vl.initVB(this.updateWebRTCVideoStream.bind(this)):ri(e))}var r,o;(e&&!1===e.isSessionBranding&&(I.default.enableCanvasAlphaChannel=!1),null!=e&&e.mediasdkConfig&&I.default.enableWebrtcTurnServer)&&(this.mediasdkConfig=e.mediasdkConfig,this.iceServers=(null===(r=this.mediasdkConfig)||void 0===r?void 0:r.iceServers)||[],null===(o=this.audioBridge)||void 0===o||o.setIceServers(this.iceServers))},async onRendererTypeSelected(){const e=await this.handleRendererTypeInProps(this.rendererType,this.defaultRendererType,this.mGPUBlacklist);this.renderManager.getRendererProvider().setRendererType(e.rendererType),this.rendererType=e.rendererType},async handleRendererTypeInProps(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e!==yi.j.AUTO&&e!==yi.j.UNDEFINED&&e!==yi.j.WEBGL&&e!==yi.j.WEBGL_2&&e!==yi.j.WEBGPU&&(e=yi.j.AUTO);let a=e,r=0;e!==yi.j.AUTO&&e!==yi.j.UNDEFINED||(a=t);return await S.default.isRendererTypeSupported(a,this.isWebGPUFeatureEnabled,this.isWebGL2FeatureEnabled,i)||(r=1,a=await S.default.evaluateRendererType(this.isWebGPUFeatureEnabled,this.isWebGL2FeatureEnabled,i)),{errNo:r,rendererType:a}},setRWGAgent(e){I.default.rwgAgent=e,this.addEventListenerForRWGAgent(e)},updateQosSubscription:function(e,t,i){var a;if(this.useAudioBridge&&(t===R.f.AUDIO_DECODE||t===R.f.AUDIO_ENCODE))return void(null===(a=this.audioBridge)||void 0===a||a.updateQos({enable:e,workerType:t,pollingInterval:i}));const r=t===R.f.VIDEO_ENCODE||t===R.f.VIDEO_DECODE;if(this.webrtcConfig.webrtcflag&&r){var n;this.wmscManager&&null!==(n=this.wmscManager)&&void 0!==n&&n.isJoinRWGSuccess?this.wmscManager.updateQosSubscription(e,t,i):this.webrtcConfig.subscribeQosParamsData[t]=[e,t,i]}else{let a=!0;this.isSupportVideoShare&&(t==R.f.SHARING_DECODE&&(t=R.f.VIDEO_DECODE,a=!1),t==R.f.SHARING_ENCODE&&(t=R.f.VIDEO_ENCODE,a=!1));Zt(t,{enable:e,workerType:t,pollingInterval:i,isVideo:a},11,!1)}},addEventListenerForRWGAgent(e){e.on("message",this.rwgAgentMessageListenerWrapper)},rwgAgentMessageListener(e){if("string"!=typeof e.data)return;let t=JSON.parse(e.data);if(!this.isDestroy)switch(t.evt){case n.EVT_TYPE_WS_VIDEO_DATACHANNEL_ANSWER:this.setRTCPeerConnectionDatachannelAnswer(t)}},setRTCPeerConnectionDatachannelAnswer(e){if(e.evt===n.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT||e.evt===n.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT){if(kl("rwg answer",e),!e.answer)return;switch(e.answer.type){case R.h.ZOOM_CONNECTION_VIDEO:A.a.trigger(n.PUBSUB_EVT.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT,e);break;case R.h.ZOOM_CONNECTION_AUDIO:A.a.trigger(n.PUBSUB_EVT.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT,e)}}},async initVideoDataChannel(e,t,i){var a;if((null===(a=this.videoDataChannel)||void 0===a?void 0:a.connectionID)==e)return void(t&&this.videoDataChannel.checkEmptyUserIdAndResendMonitor(t));this.isInitVideoDataChannel=!1,this.videoDataChannel&&(this.videoDataChannel.forceClose(),C.default.error("video datachannel cid changed")),this.videoDataChannel=null;let r=Pl(i);T.default.add_monitor("INITVDC"),kl("initVideoDataChannel",e);let o=new wi(this.dataTransportMgr,R.b.VIDEO);o.sendDataChannelController(this.dataChannelController),o._netWorker=r,S.default.browser.isFirefox?o.delaycloseTimeout=15e3:o.delaycloseTimeout=5e3,o.setUserid(t),kl("rtc",o);let s=this;o.onConnectionCreated(async e=>{let t=e.localDescription;if(kl("localDesc",t),s.isDestroy)return;I.default.sendMessageToRwg(n.SEND_MESSAGE_TO_RWG,{evt:n.ZOOM_CONNECTION_VIDEO_OFFER_EVT,offer:{sdp:t.sdp,type:R.h.ZOOM_CONNECTION_VIDEO}},!1);let i=await o.waitForAnswerFromRWG(n.PUBSUB_EVT.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT);if(kl("jsEvent.PUBSUB_EVT.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT",i),e!=o.rtcPeerConnection||o.isDestroyed())return;o.setRemoteDescription(i.answer),o.closeIfTimeout();let a=i.answer.sdp.match(/a=candidate:.+/)[0];kl("received candidate",a),a=a.replace(/^a=/,""),o.addIceCandidate(a),o.onDataChannelOpen(()=>{}),o.onDataChannelClose(()=>{Ce(R.h.ZOOM_CONNECTION_VIDEO,R.d.NET_DATACHANNEL)})}),o.initConnection(e).catch(e=>{kl.warn("initConnection",e),T.default.add_monitor("INITVDCERR",e.message)}),this.videoDataChannel=o},async initAudioDataChannel(e,t,i){var a,r;if((null===(a=this.audioDataChannel)||void 0===a?void 0:a.connectionID)==e)return void(t&&this.audioDataChannel.checkEmptyUserIdAndResendMonitor(t));this.isInitAudioDataChannel=!1,this.audioDataChannel&&(null===(r=this.audioDataChannel)||void 0===r||r.forceClose(),C.default.error("audio datachannel cid changed")),this.audioDataChannel=null;let o=Pl(i);T.default.add_monitor("INITADC"),kl("initAudioDataChannel",e);let s=new wi(this.dataTransportMgr,R.b.AUDIO);s.sendDataChannelController(this.dataChannelController),s._netWorker=o,S.default.browser.isFirefox?s.delaycloseTimeout=15e3:s.delaycloseTimeout=5e3,s.setUserid(t),kl("rtc",s);let d=this;s.onConnectionCreated(async e=>{let t=e.localDescription;if(d.isDestroy)return;kl("localDesc",t),I.default.sendMessageToRwg(n.SEND_MESSAGE_TO_RWG,{evt:n.ZOOM_CONNECTION_VIDEO_OFFER_EVT,offer:{sdp:t.sdp,type:R.h.ZOOM_CONNECTION_AUDIO}},!1);let i=await s.waitForAnswerFromRWG(n.PUBSUB_EVT.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT);if(kl("answer",i),e!=s.rtcPeerConnection||s.isDestroyed())return;s.setRemoteDescription(i.answer),s.closeIfTimeout();let a=i.answer.sdp.match(/a=candidate:.+/)[0];kl("received candidate",a),a=a.replace(/^a=/,""),s.addIceCandidate(a),s.onDataChannelOpen(()=>{}),s.onDataChannelClose(()=>{Ce(R.h.ZOOM_CONNECTION_AUDIO,R.d.NET_DATACHANNEL)})}),s.initConnection(e,"ZoomWebclientAudioDataChannel").catch(e=>{kl.warn("initConnection",e),T.default.add_monitor("INITADCERR",e.message)}),this.audioDataChannel=s},init_Notify_APPUI(e,t){let i=ci[t],a=e?i.success:i.fail;I.default.Notify_APPUI(a,i.callbackDataValue)},_setWebtransportEnable(e){let{enable:t,webtransportPort:i}=e;t?(S.apiSupportUtility.setIsSupportWebtransport(!0),I.default.webtransportPort=i||8802):S.apiSupportUtility.setIsSupportWebtransport(!1)},_previewInitWebtransport(e){let{conId:t,meetingNumber:i,rwgHost:a,webtransportPort:r,workType:n}=e;if(this._setWebtransportEnable({enable:!0,webtransportPort:r}),S.apiSupportUtility.getIsSupportWebtransport()){const e=n===R.f.AUDIO_ENCODE,r=n===R.f.AUDIO_DECODE,o=n===R.f.VIDEO_ENCODE,s=n===R.f.VIDEO_DECODE,d=e||r,u=d?"a":"v",l=e||o?2:1,c="https://".concat(a,":").concat(I.default.webtransportPort,"/wc/media/").concat(i,"?type=").concat(u,"&cid=").concat(t),h="".concat(c,"&mode=").concat(l);d?Ye(c):Xe(c);const f=I.default.SPECIAL_ID;let p="",_=null;e?(p="localAudioEncMGR",_=ge.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS):r?(p="localAudioDecMGR",_=ge.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS):o?(p="localVideoEncMGR",_=ge.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS):s&&(p="localVideoDecMGR",_=ge.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS);let m=I.default[p]&&I.default[p].map.get(f);m?m.postMessage({command:6,webtransportURL:h,_id:this._id}):ge.enqueueMessage({name:_,handler:()=>{m=I.default[p].map.get(f),m.postMessage({command:6,webtransportURL:h,_id:this._id})},direction:ge.direction.SDK_TO_SDK})}},_previewInitMediaWebsocket(e){let{websocketUrl:t,workType:i}=e;const a=I.default.SPECIAL_ID,r=i===R.f.AUDIO_ENCODE,n=i===R.f.AUDIO_DECODE,o=i===R.f.VIDEO_ENCODE,s=i===R.f.VIDEO_DECODE;r||n?je(t):qe(t);let d="",u=null,l=0;r?(l=2,d="localAudioEncMGR",u=ge.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS):n?(l=5,d="localAudioDecMGR",u=ge.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS):o?(l=2,d="localVideoEncMGR",u=ge.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS):s&&(l=5,d="localVideoDecMGR",u=ge.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS);let c=I.default[d]&&I.default[d].map.get(a);c?c.postMessage({command:5,websocket_ip_address:"".concat(t,"&mode=").concat(l)}):ge.enqueueMessage({name:u,handler:()=>{c=I.default[d].map.get(a),c.postMessage({command:5,websocket_ip_address:"".concat(t,"&mode=").concat(l)})},direction:ge.direction.SDK_TO_SDK})},async previewInit(e){let{videoDecode:t,videoDataChannel:i,videoEncodeMediaWss:a,videoDecodeMediaWss:r,videoEncodeWebtransport:n,videoDecodeWebtransport:o,audioDecode:s,audioDataChannel:d,audioBridge:u,audioEncodeMediaWss:l,audioDecodeMediaWss:c,audioEncodeWebtransport:h,audioDecodeWebtransport:f}=e,p=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!Ae(this))return!1;if(t){var _;let{urlParameters:e}=t||{};e=(null===(_=this.getFilePath)||void 0===_?void 0:_.call(this))||e;let i=await S.default.isSDKSupportMultiThread(),a=await S.default.isSDKSupportSIMD(),r=a&&i;await this.onRendererTypeSelected();let n={};n.rendererType=this.rendererType,this.isSupportVideoShare&=r,this.dataChannelController.setVideoShareModel(this.isSupportVideoShare),this.isSupportVideoShare?(n.workerJsFileUrl=e.vsmiworkerpath,n.workerWasmFileUrl=e.videoMSIMDWasm):r?(n.workerJsFileUrl=e.videoMSIMDWorkerPath,n.workerWasmFileUrl=e.videoMSIMDWasm):i?(n.workerJsFileUrl=e.videoMtWorkerPath,n.workerWasmFileUrl=e.videoMtWasm):a?(n.workerJsFileUrl=e.videoSIMDWorkerPath,n.workerWasmFileUrl=e.videoSIMDWasm):(n.workerJsFileUrl=e.videoWorkerPath,n.workerWasmFileUrl=e.videoWasm),n.integrityHelper=new S.IntegrityHelper(n.workerJsFileUrl,this.lateLoadedAssetsHash),Ee.resetVideoDecode(!0),Re(n,this)}if(i&&(p||this.hadsetpropsbeforeinit)){const{conId:e,userid:t}=i;this.initVideoDataChannel(e,t,this.networkerpath)}if(a){const{websocketUrl:e}=a;this._previewInitMediaWebsocket({websocketUrl:e,workType:R.f.VIDEO_ENCODE})}if(r){const{websocketUrl:e}=r;this._previewInitMediaWebsocket({websocketUrl:e,workType:R.f.VIDEO_DECODE})}if(n){const{conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a}=n;this._previewInitWebtransport({conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a,workType:R.f.VIDEO_ENCODE})}if(o){const{conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a}=o;this._previewInitWebtransport({conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a,workType:R.f.VIDEO_DECODE})}if(s){var m;let{urlParameters:e}=s||{};e=(null===(m=this.getFilePath)||void 0===m?void 0:m.call(this))||e;let t={};await S.default.isSDKSupportSIMD()?(t.workerJsFileUrl=e.audioSIMDWorkletPath,t.workerWasmFileUrl=e.audioSIMDWasm):(t.workerJsFileUrl=e.audioWorkerPath,t.workerWasmFileUrl=e.audioWasm),t.integrityHelper=new S.IntegrityHelper(t.workerJsFileUrl,this.lateLoadedAssetsHash),Ee.resetAudioDecode(!0),be(t,this)}if(d&&(p||this.hadsetpropsbeforeinit)){const{conId:e,userid:t}=d;this.initAudioDataChannel(e,t,this.networkerpath)}if(u){if(this.useAudioBridge=!0,!S.default.isSupportPeerConnection())return void C.default.error("no support peer connection");const{nginxHost:e,rwgHost:t,cid:i,abToken:a,isCapturingAudio:r,audioMode:n,supportLocalAB:o,useWebRTCOnDesktop:s}=u;I.default.audioSolution="WEBRTC";let d="wss://".concat(o?t:e,"/ab/signal?rwg=").concat(t,"&cid=").concat(i);if(!this.audioBridge||this.audioBridge.cid!=i){if(this.audioBridge)try{this.audioBridge.destroy(!1),this.audioBridge=null,Vl.audioBridge=null}catch(e){C.default.error("destory webrtc audio error",e)}let e={jsPath:this.audioWorkletJsPath.audioLevelWorkletPath,wasmPath:this.audioWorkletJsPath.audioSIMDWasm};this.audioBridge=new Ia(i,d,!r,this.codecDoAVSync,s||I.default.onDesktop,e,(e,t)=>{var i,a;switch(e){case"destroy":null===(i=this.audioBridge)||void 0===i||i.destroy(),this.audioBridge=null;break;case"updateConnectionResult":null===(a=this.audioPersistenceInfo)||void 0===a||a.updatewebRTCProbResult(t)}}),this.audioBridge.setIceServers(this.iceServers),Vl.audioBridge=this.audioBridge}r&&this.audioBridge.setRecvOnly(!1,Vl.audioStream),this.audioBridge.setCodecDoAVSync(this.codecDoAVSync),await this.audioBridge.join(!1,a,n)}if(l){const{websocketUrl:e}=l;this._previewInitMediaWebsocket({websocketUrl:e,workType:R.f.AUDIO_ENCODE})}if(c){const{websocketUrl:e}=c;this._previewInitMediaWebsocket({websocketUrl:e,workType:R.f.AUDIO_DECODE})}if(h){const{conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a}=h;this._previewInitWebtransport({conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a,workType:R.f.AUDIO_ENCODE})}if(f){const{conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a}=f;this._previewInitWebtransport({conId:e,meetingNumber:t,rwgHost:i,webtransportPort:a,workType:R.f.AUDIO_DECODE})}p||this.hadsetpropsbeforeinit||C.default.directReport("previewinit before setprops")},previewUnInitRtcConnection(){T.default.add_monitor("REINITRTC");try{var e,t;null===(e=this.videoDataChannel)||void 0===e||e.forceClose(),null===(t=this.audioDataChannel)||void 0===t||t.forceClose()}catch(e){kl.error("clear rtcPeerConnectionList err",e)}this.audioBridge&&(this.audioBridge.destroy(!1),this.audioBridge=null,Vl.audioBridge=null);const i=I.default.SPECIAL_ID;[I.default.localVideoEncMGR&&I.default.localVideoEncMGR.map.get(i),I.default.localVideoDecMGR&&I.default.localVideoDecMGR.map.get(i),I.default.localAudioEncMGR&&I.default.localAudioEncMGR.map.get(i),I.default.localAudioDecMGR&&I.default.localAudioDecMGR.map.get(i)].forEach(e=>{e&&(e.postMessage({command:3}),e.postMessage({command:4,_id:this._id}))})},doesSafariSupportWebcodec:()=>!S.default.isMacIntelSafari()&&(S.default.isSafariVersionHigherThan("17.5")&&I.default.enableSafariHWCodec),_enableHardWareDecode(){if(I.default.disableHWCodec&o.WEBCODEC_DECODE_OFF)return!1;return S.default.isAndroidBrowser()?S.default.isChromeVersionHigherThan(124)&&I.default.enableAndroidHWCodec:S.default.isChromeVersionHigherThan(95)||this.doesSafariSupportWebcodec()},async initVideoEncode(e,t,i){var a,r;let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,c=arguments.length>9?arguments[9]:void 0,h=arguments.length>10?arguments[10]:void 0,f=arguments.length>11&&void 0!==arguments[11]&&arguments[11],p=arguments.length>12?arguments[12]:void 0,_=arguments.length>13&&void 0!==arguments[13]&&arguments[13];if((S.default.isAndroidBrowser()&&!S.default.isMTRAndroid()||S.default.isIphoneOrIpadBrowser())&&(f=!0,void 0===h&&(h=!0)),u=S.default.getMaxCountRender(),this.userId=i,!Ae(this))return!1;if(T.default.add_monitor("INITVE"),this.webrtcConfig.webrtcflag&&!_)return this.initVEPara=arguments,this.resolveVEwebrtcpromise(!0),T.default.add_monitor("WMSC_INITVE"),this._initWMSC(t,d,R.f.VIDEO_ENCODE,i);this.isSupportImageCapture=!l&&this.isSupportImageCapture,Vl.setStreamProcessAbility({isSupportImageCapture:this.isSupportImageCapture}),this.setMultiView(u,I.default.enableMultiDecodeVideoWithoutSAB),this.isSupportVideoFrameOrBitmapCapture=this.isSupportImageCapture||this.isSupportVideoTrackReader||this.isSupportMediaStreamTrackProcessor,kl("initVideoEncode"),ma.setUserId(i),Ee.resetVideoEncode(p),this.is32bitbrowser=await S.default.is32bitChrome();let m=await S.default.isSDKSupportMultiThread();S.apiSupportUtility.setIsSupportVirtualBackground(!this.isTeslaMode&&!S.default.isAndroidBrowser()&&!l&&(m||I.default.enableVirtualBackgroundWithoutSAB));const g=S.apiSupportUtility.getIsSupportVirtualBackground()&&!this.webrtcConfig.webrtcflag;let E=await S.default.isSDKSupportSIMD(),v=E&&m,C={},A=!1,b=S.default.graphicName,O=!!b&&b.includes("amd");this.isAppleGraphic=!!b&&(b.includes("apple m1")||b.includes("apple m2")),(S.default.isIphoneOrIpadBrowser()||S.default.isIpadOS()||navigator.hardwareConcurrency&&navigator.hardwareConcurrency>7||await S.default.VP9MachineDetect()&&O&&navigator.hardwareConcurrency&&navigator.hardwareConcurrency>=4)&&c&&(A=!0),(S.default.isIphoneOrIpadSafari()&&!S.default.isSupportVideoFrame()||S.default.isAndroidBrowser()&&S.default.isAndroidVersionLessEqual(10))&&(A=!1),this.isSupportVideoShare&=v,T.default.add_monitor("isMT: "+m),T.default.add_monitor("isenbaleHD: "+c),T.default.add_monitor("ENABLE720:"+A),T.default.add_monitor("ISVSV:"+this.isSupportVideoShare),T.default.add_monitor("graphicname: "+b),this.is32bitbrowser&&T.default.add_monitor("is32chrome: "+this.is32bitbrowser);let D=!(I.default.disableHWCodec&o.WEBCODEC_ENCODE_OFF),w=D&&h;if(m&&(c||f)&&(this.isSupportMediaStreamTrackProcessor&&S.default.isChromeVersionHigherThan(95)&&(!S.default.isAndroidBrowser()||I.default.enableAndroidHWCodec)||this.doesSafariSupportWebcodec())&&this.isWebCodecEncoderOnWhitelist?(this.videoencodehardwareflag=D&&await S.default.IsSupportVideoEncodeHardwareAcceleration(),h=this.videoencodehardwareflag):(this.videoencodehardwareflag=!1,h=!1),T.default.add_monitor("EOWL:"+this.isWebCodecEncoderOnWhitelist),T.default.add_monitor("VIHD:"+this.videoencodehardwareflag),T.default.add_monitor("enableHW: "+h),e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e,this.isSupportVideoShare?(C.workerJsFileUrl=e.vsmiworkerpath,C.workerWasmFileUrl=e.videoMSIMDWasm):v?(C.workerJsFileUrl=e.videoMSIMDWorkerPath,C.workerWasmFileUrl=e.videoMSIMDWasm):m?(C.workerJsFileUrl=e.videoMtWorkerPath,C.workerWasmFileUrl=e.videoMtWasm):E?(C.workerJsFileUrl=e.videoSIMDWorkerPath,C.workerWasmFileUrl=e.videoSIMDWasm):(C.workerJsFileUrl=e.videoWorkerPath,C.workerWasmFileUrl=e.videoWasm),C.integrityHelper=new S.IntegrityHelper(C.workerJsFileUrl,this.lateLoadedAssetsHash),!p){let e=new URL(t).searchParams.get("cid"),a=new URL(t).host;S.apiSupportUtility.getIsSupportWebtransport()&&Xe("https://".concat(a,":").concat(I.default.webtransportPort,"/wc/media/").concat(d,"?type=v&cid=").concat(e)),this.previewInit({videoDataChannel:{conId:e,userid:i}},!0)}let y=1,M=!1,N=!1;const V=g&&m;V&&h?(y=3,M=!0,N=!!w):V||h?(y=2,h&&(M=!0,N=!!w)):(this.isSupportVideoShare||m)&&(y=2);let k=M&&N&&A;S.default.set720pcapacity(k),T.default.add_monitor("CAPTURE720:"+k),T.default.add_monitor("VETNum:"+y),S.default.isAndroidBrowser()&&!S.default.isMTRAndroidWithSAB()?this.platformType=o.WCL_PLATFORM_TYPE.ANDROID:S.default.isIphoneOrIpadBrowser()&&(this.platformType=o.WCL_PLATFORM_TYPE.IPHONE),N=N&&(!this.isAppleGraphic||S.default.isChromeVersionHigherThan(116)&&(!S.default.isAndroidBrowser()||I.default.enableAndroidHWCodec)||this.doesSafariSupportWebcodec()),await this.onRendererTypeSelected(),T.default.add_monitor("SupportWebCodecEncode: "+N);let U={log:n,confId:i,meetingid:s,meetingnumb:d,videodecodethreadnumb:u,isSupportMultiThread:m,videoencodethreadnumb:y,isSupportVirtualBackground:g,isSupportWebCodecEnocde:M,initWebCodecFlag:N,is360penablehwenc:f,enable720p:A,platformType:this.platformType,rendererType:this.rendererType,IsRenderInWorker:this.checkIsRenderInWorker()&&!S.apiSupportUtility.getIsRenderSelfVideoInEncodeWorker(!0),webrtcvideo:this.webrtcConfig.webrtcflag,MaskFlag:!!I.default.rwgAgent,isSafari:null===(r=S.default.browser)||void 0===r?void 0:r.isSafari};if(console.log("VP9?:",await S.default.VP9MachineDetect(),"AMD?:",S.default.isAMDGraphic(),"AMDdecodecheck:",S.default.isGraphicShouldUseHardwareAccelerationDecode(),"isenbaleHD:"+c+" enable720p?:",A,"capacityfor720:",k),Ke(t,U),!Ae(this))return!1;if(await Se(C,this),I.default.extVBPort&&this.addVbReceiver(I.default.extVBPort),this.dataChannelController.setVideoShareModel(this.isSupportVideoShare),p||this.isDestroy)return;let L=this;this.allpromises.push(I.default.videoInitInstance.initSuccessPromise);let x=null;return this.bVideoDecodeUsingSAB&&!this.videoEncodeRingBuffer&&(m?(x=!0,this.videoEncodeRingBuffer=!0):(x=P.getStorageForCapacity(),this.videoEncodeRingBuffer=x)),await I.default.videoInitInstance.initSuccessPromise.then(e=>!!Ae(L)&&(e&&this.bVideoEncodeUsingSAB&&x&&Zt(R.f.VIDEO_ENCODE,{interval:this.bVideoEncodeMainThreadConsumerIntervalEnable,data:m?null:{buffer:x,offset:0,length:x.byteLength}},"VIDEO_ENCODE_SAB",!1,!0),e)).then(e=>(T.default.add_monitor("INITVERET-".concat(L._id,"-").concat(e&&!L.isDestroy)),!!Ae(L)&&(_||this.init_Notify_APPUI(e,R.f.VIDEO_ENCODE),ge.subscribeMessage(ge.nameMap.INIT_VIDEO_ENCODE_SUCCESS),he(R.f.VIDEO_ENCODE),L.waitingVcChannelReady&&L.addChannelForVideo(),e)))},async _initWMSC(e,t,i,a){const r=new Date;return Object(S.getWMSCModule)().then(n=>{let{WMSCManager:o}=n;if(this.webrtcConfig.currentReloadTimes=0,!e||!t||!a||this.isDestroy)return void T.default.add_monitor("WMSC_Stop_Init: ".concat(this.isDestroy));const s=()=>{const e={[R.f.VIDEO_ENCODE]:ge.nameMap.INIT_VIDEO_ENCODE_SUCCESS,[R.f.VIDEO_DECODE]:ge.nameMap.INIT_VIDEO_DECODE_SUCCESS};this.init_Notify_APPUI(!0,i),ge.subscribeMessage(e[i]),T.default.add_monitor("WMSC_".concat(e[i]))};if(!this.wmscManager){const i=new Date;T.default.add_monitor("WMSC_Load_Time: ".concat(i-r));const n=new URL(e).host,s=new URL(e).searchParams.get("cid"),d="wss://".concat(n,"/wc/media/").concat(t,"?type=v&cid=").concat(s,"&mode=16"),u="WMSC_WSS_URL: rwgHost:".concat(n,"|cid: ").concat(s);T.default.add_monitor(u),this.wmscManager=new o({webRTCWebSocketUrl:d,confId:s,nodeId:a,HDVideo:this.isVideoHD,mediaStreamController:Vl,iceServers:this.iceServers})}var d;return this.isDestroy?(T.default.add_monitor("WMSC_Destory_Init: ".concat(this.isDestroy)),void(null===(d=this.wmscManager)||void 0===d||d.destroy())):this.wmscManager.isJoinRWGSuccess?s():this.wmscManager.waitJoinRWGSuccess().then(()=>{if(s(),"{}"!==JSON.stringify(this.webrtcConfig.subscribeQosParamsData)){T.default.add_monitor("WMSC_Update_Qos_Subscription_Async");for(const e in this.webrtcConfig.subscribeQosParamsData){const t=this.webrtcConfig.subscribeQosParamsData[e];this.wmscManager.updateQosSubscription(...t)}this.webrtcConfig.subscribeQosParamsData={}}})}).catch(r=>{const{currentReloadTimes:o,maxReloadTimes:s}=this.webrtcConfig;if(o>=s)return C.default.error("WMSC_JS_LOAD_FAIL_FAILOVER"),void I.default.Notify_APPUI(n.NOTIFY_UI_WMSC_WSS_DISCONNECTED);setTimeout(()=>(C.default.error("WMSCf_IMPORT_FAIL ".concat(this.webrtcConfig.currentReloadTimes),r),this.webrtcConfig.currentReloadTimes+=1,this._initWMSC(e,t,i,a)),1e3)})},async initVideoDecode(e,t,i){var a;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,d=arguments.length>6?arguments[6]:void 0,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:void 0,l=arguments.length>9&&void 0!==arguments[9]&&arguments[9];if((S.default.isAndroidBrowser()&&!S.default.isMTRAndroid()||S.default.isIphoneOrIpadBrowser())&&void 0===u&&(u=!0),this.userId=i,d=S.default.getMaxCountRender(),!Ae(this))return!1;let c=!1;if(this.webrtcConfig.webrtcflag&&!l)return T.default.add_monitor("WMSC_INITVD"),this.initVDPara=arguments,this.resolveVDwebrtcpromise(!0),this._initWMSC(t,s,R.f.VIDEO_DECODE,i).then(()=>{I.default.webrtcVideoInited=!0});I.default.webrtcVideoInited&&(I.default.webrtcVideoInited=!1,c=!0),Ee.resetVideoDecode(!1),kl("initVideoDecode"),T.default.add_monitor("INITVD"),T.default.add_monitor("DOWL:"+this.isWebCodecDecoderOnWhitelist),this.setMultiView(d,I.default.enableMultiDecodeVideoWithoutSAB),d>1&&!I.default.enableMultiDecodeVideoWithoutSAB&&(Object(S.IsSupportWebGLOffscreenCanvas)()||S.default.isWebGL2Supported(this.isWebGL2FeatureEnabled))?this.codecDoAVSync=!0:this.codecDoAVSync=!1,this.is32bitbrowser=await S.default.is32bitChrome();let h=await S.default.isSDKSupportMultiThread(),f=await S.default.isSDKSupportSIMD(),p=f&&h,_={};this.isEnableVideoDecodeHardWareThread=h&&this._enableHardWareDecode(),u&&this.isEnableVideoDecodeHardWareThread?(this.videodecodehardwareflag=await S.default.IsSupportVideoDecodeHardwareAcceleration(I.default.enableHADecOpt),u=this.videodecodehardwareflag):u=!1,this.isSupportVideoShare&=p,T.default.add_monitor("isMT:"+h),T.default.add_monitor("SIMD:"+f),T.default.add_monitor("VDHT:"+this.isEnableVideoDecodeHardWareThread),T.default.add_monitor("VDHW:"+this.videodecodehardwareflag),T.default.add_monitor("SupportWebCodecDecode:".concat(u)),e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e,this.dataChannelController.setVideoShareModel(this.isSupportVideoShare),this.isSupportVideoShare?(_.workerJsFileUrl=e.vsmiworkerpath,_.workerWasmFileUrl=e.videoMSIMDWasm):p?(_.workerJsFileUrl=e.videoMSIMDWorkerPath,_.workerWasmFileUrl=e.videoMSIMDWasm):h?(_.workerJsFileUrl=e.videoMtWorkerPath,_.workerWasmFileUrl=e.videoMtWasm):f?(_.workerJsFileUrl=e.videoSIMDWorkerPath,_.workerWasmFileUrl=e.videoSIMDWasm):(_.workerJsFileUrl=e.videoWorkerPath,_.workerWasmFileUrl=e.videoWasm),_.integrityHelper=new S.IntegrityHelper(_.workerJsFileUrl,this.lateLoadedAssetsHash);let m=new URL(t).searchParams.get("cid"),g=new URL(t).host;S.apiSupportUtility.getIsSupportWebtransport()&&Xe("https://".concat(g,":").concat(I.default.webtransportPort,"/wc/media/").concat(s,"?type=v&cid=").concat(m)),this.previewInit({videoDataChannel:{conId:m,userid:i}},!0);let E=u&&this.isEnableVideoDecodeHardWareThread&&d>1&&navigator.hardwareConcurrency&&navigator.hardwareConcurrency>=4;S.default.setsub1080pcapacity(E);let v=this.platformType;if(S.default.isAndroidBrowser()&&!S.default.isMTRAndroidWithSAB()?v=o.WCL_PLATFORM_TYPE.ANDROID:S.default.isIphoneOrIpadBrowser()&&(v=o.WCL_PLATFORM_TYPE.IPHONE),await this.onRendererTypeSelected(),Ke(t,{log:r,confId:i,meetingid:n,meetingnumb:s,videodecodethreadnumb:d,isFirefox:S.default.browser.isFirefox,isSupportMultiThread:h,isSupportVideoTrackReader:this.isSupportVideoTrackReader,isSupportOffscreenCanvas:this.isSupportOffscreenCanvas,isenablehw:u,isEnableVideoDecodeHardWareThread:this.isEnableVideoDecodeHardWareThread,isEnableHardWareThread:this.isEnableHardWareThread,isTeslaMode:this.isTeslaMode,platformType:v,rendererType:this.rendererType,isWebCodecDecoderOnWhitelist:this.isWebCodecDecoderOnWhitelist,webrtcvideo:this.webrtcConfig.webrtcflag}),!Ae(this))return!1;if(await Re(_,this),!Ae(this))return!1;let A=this;this.allpromises.push(I.default.videoDecInitInstance.initSuccessPromise);let b=null;return this.bVideoDecodeUsingSAB&&!this.videoDecodeRingBuffer&&(h?(b=!0,this.videoDecodeRingBuffer=!0):(b=P.getStorageForCapacity(),this.videoDecodeRingBuffer=b)),await I.default.videoDecInitInstance.initSuccessPromise.then(async e=>!!Ae(A)&&(e&&this.bVideoDecodeUsingSAB&&b&&Zt(R.f.VIDEO_DECODE,h?null:{buffer:b,offset:0,length:b.byteLength},"VIDEO_DECODE_SAB_FROM_DATACHANNEL",!1,!0),e)).then(e=>(T.default.add_monitor("INITVDRET-".concat(A._id,"-").concat(e&&!A.isDestroy)),!!Ae(A)&&(l||this.init_Notify_APPUI(e,R.f.VIDEO_DECODE),ge.subscribeMessage(ge.nameMap.INIT_VIDEO_DECODE_SUCCESS),he(R.f.VIDEO_DECODE),A.waitingVcChannelReady&&A.addChannelForVideo(),e&&c&&C.default.directReport("video fallback to wasm successfully"),e)))},async initAudioEncode(e,t,i){var a;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,d=arguments.length>8?arguments[8]:void 0;if(this.userId=i,kl("initAudioEncode"),!Ae(this))return!1;T.default.add_monitor("INITAE"),ma.setUserId(i),Ee.resetAudioEncode(d),this.is32bitbrowser=await S.default.is32bitChrome();let u={},l=await S.default.isSDKSupportSIMD();if(e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e,l?(u.workerJsFileUrl=e.audioSIMDWorkletPath,u.workerWasmFileUrl=e.audioSIMDWasm):(u.workerJsFileUrl=e.audioWorkerPath,u.workerWasmFileUrl=e.audioWasm),u.integrityHelper=new S.IntegrityHelper(u.workerJsFileUrl,this.lateLoadedAssetsHash),!d){let e=new URL(t).searchParams.get("cid"),a=new URL(t).host;S.apiSupportUtility.getIsSupportWebtransport()&&Ye("https://".concat(a,":").concat(I.default.webtransportPort,"/wc/media/").concat(o,"?type=a&cid=").concat(e)),this.previewInit({audioDataChannel:{conId:e,userid:i}},!0)}if(this.audioCtx||(this.audioCtx=Object(S.createMainAudioContext)()),He(t,{sampleRate:this.audioCtx.sampleRate,userid:i,log:r,meetingid:n,meetingnumb:o,videodecodethreadnumb:s}),!Ae(this))return!1;if(await Ie(u,this),d||this.isDestroy)return;let c=this;this.allpromises.push(I.default.audioEncodeInitInstance.initSuccessPromise);let h=null;return this.bAudioDecodeUsingSAB&&!this.audioEncodeRingBuffer&&(h=P.getStorageForCapacity(100),this.audioEncodeRingBuffer=h),await I.default.audioEncodeInitInstance.initSuccessPromise.then(e=>!c.isDestroy&&(e&&this.bAudioEncodeUsingSAB&&h&&Zt(R.f.AUDIO_ENCODE,{buffer:h,offset:0,length:h.byteLength,bAudioEncodeMainThreadConsumerIntervalEnable:!1},"audioEncodeSAB",!1,!0),e)).then(e=>(T.default.add_monitor("INITAERET-".concat(c._id,"-").concat(e&&!c.isDestroy)),!!Ae(c)&&(this.init_Notify_APPUI(e,R.f.AUDIO_ENCODE),he(R.f.AUDIO_ENCODE),e)))},async initAudioDecode(e,t,i){var a;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;if(this.userId=i,!Ae(this))return!1;Ee.resetAudioDecode(!1),kl("initAudioDecode"),ma.setUserId(i);let d=!1;"WEBRTC"===I.default.audioSolution&&(d=!0),I.default.audioSolution="WASM",T.default.add_monitor("INITAD"),this.is32bitbrowser=await S.default.is32bitChrome();let u=new URL(t).searchParams.get("cid"),l=new URL(t).host,c={};e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e,c.workerJsFileUrl=e.audioWorkerPath,c.workerWasmFileUrl=e.audioWasm,S.apiSupportUtility.getIsSupportWebtransport()&&Ye("https://".concat(l,":").concat(I.default.webtransportPort,"/wc/media/").concat(o,"?type=a&cid=").concat(u)),this.previewInit({audioDataChannel:{conId:u,userid:i}},!0);let h=await S.default.isSDKSupportMultiThread();if(await S.default.isSDKSupportSIMD()?(c.workerJsFileUrl=e.audioSIMDWorkletPath,c.workerWasmFileUrl=e.audioSIMDWasm):(c.workerJsFileUrl=e.audioWorkerPath,c.workerWasmFileUrl=e.audioWasm),c.integrityHelper=new S.IntegrityHelper(c.workerJsFileUrl,this.lateLoadedAssetsHash),this.audioCtx||(this.audioCtx=Object(S.createMainAudioContext)()),He(t,{sampleRate:this.audioCtx.sampleRate,userid:i,log:r,meetingid:n,meetingnumb:o,videodecodethreadnumb:s,isSupportMultiThread:h}),!Ae(this))return!1;if(await be(c,this),!Ae(this))return!1;let f=this;this.allpromises.push(I.default.audioDecInitInstance.initSuccessPromise);let p=null;return this.bAudioDecodeUsingSAB&&!this.audioDecodeRingBuffer&&(p=P.getStorageForCapacity(100),this.audioDecodeRingBuffer=p),await I.default.audioDecInitInstance.initSuccessPromise.then(async e=>!f.isDestroy&&(T.default.add_monitor("ADIP"+!!e),e&&this.bAudioDecodeUsingSAB&&p&&await Zt(R.f.AUDIO_DECODE,{buffer:p,offset:0,length:p.byteLength},"audioDecodeSAB",!1,!0),e)).then(e=>(T.default.add_monitor("INITADRET-".concat(f._id,"-").concat(e&&!f.isDestroy)),!!Ae(f)&&(e&&d&&C.default.directReport("fallback to wasm solution successfully"),this.init_Notify_APPUI(e,R.f.AUDIO_DECODE),he(R.f.AUDIO_DECODE),e)))},async initSharingDecode(e,t,i){var a;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;if(!Ae(this))return!1;T.default.add_monitor("INITSD");let s=await S.default.isSDKSupportSIMD(),d=await S.default.isSDKSupportMultiThread(),u=s&&d;if(this.isSupportVideoShare&=u,this.isSupportVideoShare&&this.webrtcConfig.webrtcflag)try{await this.webrtcVDpromise,await this.initVideoDecode(...this.initVDPara,!0)}catch(e){T.default.add_monitor("INITVDSDF")}if(this.userId=i,this.recordSharingParamInfo(),this.isSupportVideoShare){this.allpromises.push(I.default.sharingDecInitInstance.socketSuccessPromise);let e=this;return await I.default.sharingDecInitInstance.handlerSuccessPromise,await I.default.sharingDecInitInstance.socketSuccessPromise.then(t=>(T.default.add_monitor("INITSDRET-".concat(e._id,"-").concat(t&&!e.isDestroy)),!!Ae(e)&&(this.init_Notify_APPUI(t,R.f.SHARING_DECODE),he(R.f.SHARING_DECODE),t)))}this.dataChannelController.setVideoShareModel(this.isSupportVideoShare),this.is32bitbrowser=await S.default.is32bitChrome(),await this.onRendererTypeSelected(),e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e;let l={};if(u?(l.workerJsFileUrl=e.sharingMSIMDWorkerPath,l.workerWasmFileUrl=e.videoMSIMDWasm):d?(l.workerJsFileUrl=e.sharingMtWorkerPath,l.workerWasmFileUrl=e.videoMtWasm):s?(l.workerJsFileUrl=e.sharingSIMDWorkerPath,l.workerWasmFileUrl=e.videoSIMDWasm):(l.workerJsFileUrl=e.sharingWorkerPath,l.workerWasmFileUrl=e.videoWasm),l.integrityHelper=new S.IntegrityHelper(l.workerJsFileUrl,this.lateLoadedAssetsHash),Fe(t,{log:r,userid:i,meetingid:n,meetingnumb:o,isSupportMultiThread:d,rendererType:this.rendererType,isWebCodecDecoderOnWhitelist:this.isWebCodecDecoderOnWhitelist}),!Ae(this))return!1;if(await Oe(l,this),!Ae(this))return!1;this.allpromises.push(I.default.sharingDecInitInstance.initSuccessPromise);let c=this;return await I.default.sharingDecInitInstance.initSuccessPromise.then(e=>(T.default.add_monitor("INITSDRET-".concat(c._id,"-").concat(e&&!c.isDestroy)),!!Ae(c)&&(this.init_Notify_APPUI(e,R.f.SHARING_DECODE),he(R.f.SHARING_DECODE),e)))},async initSharingEncode(e,t,i){var a;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0;T.default.add_monitor("INITSE");let d=await S.default.isSDKSupportSIMD(),u=await S.default.isSDKSupportMultiThread(),l=d&&u;if(this.isSupportVideoShare&=l,this.isSupportVideoShare&&this.webrtcConfig.webrtcflag)try{await this.webrtcpromise,11==this.initVEPara.length?await this.initVideoEncode(...this.initVEPara,!1,!1,!0):await this.initVideoEncode(...this.initVEPara,!0)}catch(e){T.default.add_monitor("INITVESEF")}if(this.userId=i,!Ae(this))return!1;if(this.isSupportVideoShare){this.allpromises.push(I.default.sharingEncInitInstance.socketSuccessPromise);let e=this;return await I.default.sharingEncInitInstance.handlerSuccessPromise,await I.default.sharingEncInitInstance.socketSuccessPromise.then(t=>(T.default.add_monitor("INITSERET-".concat(e._id,"-").concat(t&&!e.isDestroy)),!!Ae(e)&&(this.init_Notify_APPUI(t,R.f.SHARING_ENCODE),he(R.f.SHARING_ENCODE),S.default.getGpuInfo().isWebGLContextInvalid&&Object(Z.NotifyUIError)(n.WEBGL_CONTEXT_INVALID,{reason:"WebGLContextInvalid"}),t)))}e=(null===(a=this.getFilePath)||void 0===a?void 0:a.call(this))||e,this.is32bitbrowser=await S.default.is32bitChrome(),await this.onRendererTypeSelected();let c={};if(l?(c.workerJsFileUrl=e.sharingMSIMDWorkerPath,c.workerWasmFileUrl=e.videoMSIMDWasm):u?(c.workerJsFileUrl=e.sharingMtWorkerPath,c.workerWasmFileUrl=e.videoMtWasm):d?(c.workerJsFileUrl=e.sharingSIMDWorkerPath,c.workerWasmFileUrl=e.videoSIMDWasm):(c.workerJsFileUrl=e.sharingWorkerPath,c.workerWasmFileUrl=e.videoWasm),c.integrityHelper=new S.IntegrityHelper(c.workerJsFileUrl,this.lateLoadedAssetsHash),Fe(t,{log:r,userid:i,meetingid:o,meetingnumb:s,isSupportMultiThread:u,rendererType:this.rendererType}),!Ae(this))return!1;if(await De(c,this),!Ae(this))return!1;let h=this;return this.allpromises.push(I.default.sharingEncInitInstance.initSuccessPromise),await I.default.sharingEncInitInstance.initSuccessPromise.then(e=>(T.default.add_monitor("INITSERET-".concat(h._id,"-").concat(e&&!h.isDestroy)),!!Ae(h)&&(this.init_Notify_APPUI(e,R.f.SHARING_ENCODE),he(R.f.SHARING_ENCODE),e)))},JsMediaSDK_UnInit:function(){Lt();this.videoRenderArray.length&&this.videoRenderArray.forEach((function(e){e.display&&(e.display.cleanup(),e.display=null)})),I.default._callbackList=[],I.default._Notify_APPUI=null,Object(Z.SetNotifyUIFn)(null)},StartAudioMediaCapture:function(){var e,t,i;Vl.startCaptureAudio({audioConstraints:this.audioCapture?{audioSource:this.audioCapture?this.audioCapture.AudioSelectValue:null,enableOriginalSound:"originalSound"===(null===(e=this.audioCapture)||void 0===e||null===(e=e.audioProfile)||void 0===e?void 0:e.currentSelect),enableStereo:"originalSound"===(null===(t=this.audioCapture)||void 0===t||null===(t=t.audioProfile)||void 0===t?void 0:t.currentSelect)&&(null===(i=this.audioCapture)||void 0===i||null===(i=i.audioProfile)||void 0===i||null===(i=i.originalSound)||void 0===i?void 0:i.stereo),isSupportBrowserAec:this.isSupportBrowserAec,disableAudioAGC:this.disableAudioAGC,disableNoiseSuppression:this.disableNoiseSuppression}:null,successHandler:this.handleAudioCapture.bind(this),errorHandler:this.handleAudioError.bind(this)})},StartDesktopMediaCapture:async function(){if(this.desktopSharingValue.audioOnly){try{const e=await navigator.mediaDevices.getUserMedia({audio:{deviceId:this.desktopSharingValue.deviceId?{exact:this.desktopSharingValue.deviceId}:S.default.browser.isChrome?{exact:"default"}:void 0,echoCancellation:this.desktopSharingValue.echoCancellation,noiseSuppression:this.desktopSharingValue.noiseSuppression,autoGainControl:this.desktopSharingValue.autoGainControl,sampleRate:this.desktopSharingValue.sampleRate||48e3}});this.handleDesktopCapture(e,!0)}catch(e){this.handleCaptureError(e)}return}if(this.desktopSharingValue.sourceId){const e=this.desktopSharingValue.sourceId;try{const t=await navigator.mediaDevices.getUserMedia({audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e}}});this.handleDesktopCapture(t)}catch(e){this.handleCaptureError(e)}return}const e=this.handleDesktopCapture.bind(this),t=this.handleCaptureError.bind(this);if(this.desktopSharingValue.share2ndCamera){const i=this.desktopSharingValue.share2ndCameraParams||{},a=i.VideoSelectValue?{exact:i.VideoSelectValue}:void 0,r=i.frameRate?{ideal:i.frameRate}:void 0,n={deviceId:a,width:i.width||640,height:i.height||360,frameRate:r};let o=!1;i.AudioSelectValue&&(o={noiseSuppression:null==i?void 0:i.noiseSuppression,autoGainControl:null==i?void 0:i.autoGainControl,echoCancellation:null==i?void 0:i.echoCancellation,sampleRate:i.sampleRate||48e3,deviceId:{exact:i.AudioSelectValue}});const s={video:n,audio:o};return void navigator.mediaDevices.getUserMedia(s).then(e,t)}const i=this.desktopSharingValue.videoParams,a=navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints(),r=a&&!!a.displaySurface&&i&&i.displaySurface;if(navigator.mediaDevices.getDisplayMedia){let a=!(!S.default.isSupportSharedArrayBuffer()&&!this.audioBridge||!this.desktopSharingValue.showShareAudioOption)&&{autoGainControl:!1,noiseSuppression:!1,echoCancellation:!S.default.isSupportSharingStereo()},n=this.desktopSharingValue.videoParams||!0;r&&("object"==typeof n?n.displaySurface=i.displaySurface:"boolean"==typeof n&&(n={displaySurface:i.displaySurface}));let o={video:n,audio:a,...this.desktopSharingValue.otherParams};navigator.mediaDevices.getDisplayMedia(o).then(e,t)}},StartVideoMediaCapture:async function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const i=this.videoCaptureValue,a={encode:this.isStartVideoCapture,preview:this.isMaskSettingOn||this.isVBSettingOn};T.default.add_monitor("STARTVIDEOMEDIA:".concat(a.encode,":").concat(a.preview)),Vl.startCaptureVideo({videoConstraints:this.videoCaptureValue?{videoSource:this.videoCaptureValue.VideoSelectValue,usingFacingMode:this.videoCaptureValue.usingFacingMode,width:this.videoCaptureValue.width,height:this.videoCaptureValue.height,pan:this.videoCaptureValue.pan,tilt:this.videoCaptureValue.tilt,zoom:this.videoCaptureValue.zoom,fps:this.videoCaptureValue.fps}:null,timeout:this.videoCaptureValue?this.videoCaptureValue.timeout:null,successHandler:async e=>{var r;if(!Ae(this,"videocapture"))return Vl.enableReuseStream(!1),Vl.destoryVideoMediaStream(),void C.default.error("VideoCaptureException successed sdkinstance has destroyed");if((null===(r=this.videoCaptureValue)||void 0===r?void 0:r.videoCtrl)===(null==i?void 0:i.videoCtrl)&&(this.videoCaptureValue=i),Vl.videoConstraints){const{width:e,height:t}=Vl.videoConstraints;e&&t&&(this.videoCaptureWidth=e instanceof Object?e.ideal:e,this.videoCaptureHeight=t instanceof Object?t.ideal:t)}let s=!1;try{var d;const i=e.getVideoTracks()[0]||{};if(T.default.add_monitor("WMSC_Stream_ Capture_Success: ".concat(null==i?void 0:i.muted,"|").concat(null==i?void 0:i.readyState,"|").concat(!(null===(d=this.videoCaptureValue)||void 0===d||!d.videoCtrl))),this.webrtcConfig.webrtcflag)if(this.wmscManager){var u;t&&I.default.Notify_APPUI(n.MOBILE_CAPTURE_DEVICE_CHANGE,this.userId);const e=Vl.getVideoStream();0,null!==(u=this.wmscManager)&&void 0!==u&&u.vbSettingVideoDom&&(this.wmscManager.vbSettingVideoDom.srcObject=e),await this.handleWebRTCStream("streamCaptureSuccess",e),await this.handleWebrtcVideoCapture(e),s=!0}else{const e="WMSC_Capture_Success_Handle_Fail:".concat(!!this.wmscManager,"|").concat(this.isStartVideoCapture,"|streamCaptureSuccess");T.default.add_monitor(e),C.default.error(e)}else await this.handleWasmVideoCapture(e,a),s=!0;if(T.default.add_monitor("STARTVIDEORET:".concat(s,"|").concat(null==i?void 0:i.muted)),s){T.default.add_monitor("VCMS"),i.onended=async()=>{if(!await ma.hasPermission("camera"))return T.default.add_monitor("VTRS:"+i.readyState+"R"),void Object(Z.NotifyUIError)(n.VIDEO_STREAM_FAILED,Z.CAPTURE_ERROR_TYPE.PERMISSION_RESET);let e=await navigator.mediaDevices.enumerateDevices(),t=!1;e.forEach(e=>{"videoinput"===e.kind&&e.label===i.label&&e.deviceId===i.getSettings().deviceId&&(t=!0)}),t?(T.default.add_monitor("VTRS:"+i.readyState+"I"),Object(Z.NotifyUIError)(n.VIDEO_STREAM_FAILED,Z.CAPTURE_ERROR_TYPE.EXCEPTION)):T.default.add_monitor("VTRS:"+i.readyState+"L"),mt({command:"healthCheck",op:o.HEALTH_CHECK_OPERATOR.STOP,type:o.HEALTH_CHECK_TYPE.VIDEO}),C.default.error("video media track ended")},i.onmute=async()=>{T.default.add_monitor("VTMS:"+i.muted),C.default.directReport("NotifyUIError,event=".concat(n.VIDEO_STREAM_MUTED,",data=").concat(!!this.videoCaptureValue)),this.videoCaptureValue&&(this.videoMuteTimeoutId=setTimeout(()=>{I.default.Notify_APPUI_SAFE(n.VIDEO_STREAM_MUTED),this.videoMuteTimeoutId=0},3e3),I.default.rwgAgent||mt({command:"healthCheck",op:o.HEALTH_CHECK_OPERATOR.PAUSE,type:o.HEALTH_CHECK_TYPE.VIDEO}));await ma.hasPermission("camera")||Object(Z.NotifyUIError)(n.LOST_CAMERA_ACCESS,Z.CAPTURE_ERROR_TYPE.LOST_ACCESS)},i.onunmute=()=>{T.default.add_monitor("VTMS:"+i.muted),C.default.directReport("NotifyUIError,event=".concat(n.VIDEO_STREAM_UNMUTED)),this.webrtcConfig.webrtcflag&&this.wmscManager&&this.wmscManager.playAllVideoTag("videoTrackUnmute"),this.videoMuteTimeoutId?(clearTimeout(this.videoMuteTimeoutId),this.videoMuteTimeoutId=0):I.default.Notify_APPUI_SAFE(n.VIDEO_STREAM_UNMUTED),I.default.rwgAgent||mt({command:"healthCheck",op:o.HEALTH_CHECK_OPERATOR.RESUME,type:o.HEALTH_CHECK_TYPE.VIDEO})},i.muted?(T.default.add_monitor("VTMS:"+i.muted),I.default.Notify_APPUI_SAFE(n.VIDEO_STREAM_MUTED)):(T.default.add_monitor("VTMS:"+i.muted),I.default.Notify_APPUI_SAFE(n.VIDEO_STREAM_UNMUTED));try{let{width:e,height:t}=Vl.currentVideoResolution||{};if(!this.webrtcConfig.webrtcflag&&(S.default.browser.isSafari||S.default.isAndroidBrowser())&&e&&t){let i=e instanceof Object?e.ideal:e,a=t instanceof Object?t.ideal:t;e&&t&&this.Change_Video_Capture_Resolution(i,a,!0)}}catch(e){}}}catch(e){this.handleVideoError(e)}},errorHandler:function(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.handleVideoError(t,i)}})},Start_Audio_Play:function(){this.audioPlay=!0,I.default.AudioNode&&I.default.AudioNode.postCMD("startPlayAudio",null),pe(!0)},Stop_Audio_Play:function(){pe(!1),I.default.AudioNode&&I.default.AudioNode.postCMD("stopPlayAudio",null)},Remove_Audio_Play:function(){pe(!1),this.audioPlay=!1,I.default.AudioNode&&I.default.AudioNode.postCMD("stopPlayAudio",null)},Meeting_Fail_Over:function(e,t){ot(e,t)},Start_Desktop_Audio_Capture:function(){if(this.useAudioBridge){var e;null===(e=this.audioBridge)||void 0===e||e.publishStream(this.desktopSharingMediaStram,!0)}else{let e=this.desktopSharingMediaStram.getAudioTracks();if(this.desktopSharingMediaStram&&e){var t=this.sharingAudioCtx.createMediaStreamSource(this.desktopSharingMediaStram);return this.sharingWebrtcAudioNode=t,this.isSharingCaptureNodeConnect||(this.sharingWebrtcAudioNode.connect(I.default.SharingAudioNode),I.default.SharingAudioNode.postCMD("StartCaptureAudio",null),this.isSharingCaptureNodeConnect=!0),void(this.screenShareAudioPreviewElement&&this.screenShareAudioPreviewElement.play().catch(e=>{C.default.error("Screenshare audio preview play failed",e)}))}}},Start_Audio_Capture:function(){if(Vl.shouldCaptureAudio())this.StartAudioMediaCapture();else{Vl.getAudioCapabilities().deviceId;if(this.audioInputLevel)return this.audioInputLevel.setAudioStream(Vl.audioStream),this.captureAudioMuted||this.audioInputLevel.start(),void(I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting&&(I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,Vl.getAudioDeviceId())));var e;if(this.useAudioBridge)return void(null===(e=this.audioBridge)||void 0===e||e.publishStream(Vl.audioStream).then(e=>{I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting&&(I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,Vl.getAudioDeviceId()))}));if(I.default.AudioNode){this.webrtcAudioNode&&(this.webrtcAudioNode.disconnect(I.default.AudioNode),this.webrtcAudioNode=null);var t=this.audioCtx.createMediaStreamSource(Vl.audioStream);this.webrtcAudioNode=t,this.webrtcAudioNode.connect(I.default.AudioNode),I.default.AudioNode.postCMD("StartCaptureAudio",null),It({command:132,value:!0}),this.isCaputureNodeConnect=!0}I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting&&(I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,Vl.getAudioDeviceId()))}},Stop_Audio_Capture:function(){dt(I.default.SPECIAL_ID,n.AUDIO_STOP)},_startVideoLoadedmetadataMonitor:function(e,t){var i;null!==(i=this.videoloadedmetadatamonitor)&&void 0!==i&&i.stop&&this.videoloadedmetadatamonitor.stop();let a=Math.min(o.LOADEDMETADATAT_IMEOUT+5e3*this.loadedmetadatamtimeoutcount,3e4),r=setTimeout(()=>{var i;(null===(i=this.videoloadedmetadatamonitor)||void 0===i?void 0:i.id)!=t||this.isDestroy||(Object(S.RecordVideoState)(e),this.loadedmetadatamtimeoutcount++,this.videoloadedmetadatamonitor=null,e.readyState>=2?(this._videoloadedmetadata(t,{}),C.default.directReport("video is ready state no loadedmetadata callback")):(T.default.add_monitor("loadmetadatamtimeout:".concat(this.loadedmetadatamtimeoutcount)),this.handleVideoError(new Error("Video loadedmetadata timeout ".concat(this.loadedmetadatamtimeoutcount)))))},a);this.videoloadedmetadatamonitor={id:t,stop:()=>{clearTimeout(r)}}},_addVideoLoadedmetadataListener:function(e){var t;if(!e)return void C.default.error("videodom is null");this.mountoadedmetadatatime=performance.now(),null!==(t=this.videoloadmetadataListener)&&void 0!==t&&t.remove&&(this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null);let i=Date.now();const a=this._videoloadedmetadata.bind(this,i);e.addEventListener("loadedmetadata",a);this.videoloadmetadataListener={id:i,remove:()=>{e.removeEventListener("loadedmetadata",a)}},this._startVideoLoadedmetadataMonitor(e,i)},_videoloadedmetadata:function(e,t){var i,a;if(this.videoloadmetadataListener){if(this.videoloadmetadataListener.id!=e)return;var r;null===(r=this.videoloadmetadataListener)||void 0===r||r.remove(),this.videoloadmetadataListener=null}let o,s;null!==(i=this.videoloadedmetadatamonitor)&&void 0!==i&&i.stop&&(this.videoloadedmetadatamonitor.stop(),this.videoloadedmetadatamonitor=null);let d=this,u=null;if(t?(u=t.target||d.videoCaptureValue.videoCtrl,T.default.add_monitor("VIDEOLOADEDMETADATA:".concat(u==d.videoCaptureValue.videoCtrl))):T.default.add_monitor("VIDEOLOADEDMETADATA:".concat(!0)),!Ae(d,"loadedmetadata"))return C.default.error("VideoCaptureException loadedmetadata JsMediaSDK instance destroyed"),Vl.enableReuseStream(!1),void Vl.destoryVideoMediaStream();var l;(d.isVideoCaptureLoadedmetadata&&C.default.warn("Video capture isVideoCaptureLoadedmetadata is true"),d.isVideoCaptureLoadedmetadata=!0,d.isSupportVideoFrameOrBitmapCapture)?(o=d.videoCaptureWidth,s=d.videoCaptureHeight):(o=d.videoCaptureValue.videoCtrl.videoWidth,s=d.videoCaptureValue.videoCtrl.videoHeight,d.videoCaptureWidth=o,d.videoCaptureHeight=s,null===(l=d.captureVideoOutputCanvasDomList)||void 0===l||l.forEach((function(e){e.width=o,e.height=s})));t&&this.startVideoCaptureSuccess(),null===(a=d.VideoRenderObj)||void 0===a||a.Set_LocalVideo_SSRC(d.videoCaptureValue.ssid),d.webrtcConfig.webrtcflag||(mt({command:"startVideoEncode",width:d.videoCaptureWidth,height:d.videoCaptureHeight,fps:d.videoCaptureValue.fps,ssid:d.videoCaptureValue.ssid,mtu_size:d.mtu_size,isSupportImageCapture:d.isSupportImageCapture,isSupportVideoTrackReader:d.isSupportVideoTrackReader,isSupportMediaStreamTrackProcessor:d.isSupportMediaStreamTrackProcessor,isSupport2DCanvasDrawFrame:d.isSupport2DCanvasDrawFrame,disableOriginalRatio:!!d.videoCaptureValue.disableOriginalRatio}),St({command:"startVideoEncode",ssid:d.videoCaptureValue.ssid,disableOriginalRatio:!!d.videoCaptureValue.disableOriginalRatio}),d.isSupportVideoShare||Ht({command:"startVideoEncode"}),mt({command:"updateVideoPara",width:d.videoCaptureWidth,height:d.videoCaptureHeight,fps:d.GetVideoCaptureFps()})),d.lastRealRect.left=0,d.lastRealRect.top=0,d.lastRealRect.width=d.videoCaptureWidth,d.lastRealRect.height=d.videoCaptureHeight,I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:o,height:s})},startVideoCaptureSuccess:function(){const{deviceId:e,pan:t=null,tilt:i=null,zoom:a=null,facingMode:r=null}=Vl.getVideoCapabilities(),o={currentDeviceID:e,PTZRange:{pan:t,tilt:i,zoom:a}},{usingFacingMode:s=!1}=this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO;s&&(null==r?void 0:r.length)>0&&(o.usingFacingMode=!0,o.VideoSelectValue=r),T.default.add_monitor("START_VIDEO_CAPTURE_SUCCESS_Response:".concat(Object(S.replaceComma)(JSON.stringify(o)))),I.default.Notify_APPUI(n.START_VIDEO_CAPTURE_SUCCESS,o)},handleWebRTCStream:async function(e,t){if(!this.webrtcConfig.webrtcflag)return void T.default.add_monitor("WMSC_WebRTC_Flag_Error:".concat(e));const i=t||Vl.getVideoStream();if(this.videoCaptureValue&&this.videoCaptureValue.videoCtrl&&(this.videoCaptureValue.videoCtrl.srcObject=i,Vl.playVideoStream(this.videoCaptureValue.videoCtrl)),this.wmscManager&&i){var a;this.wmscManager.selfVideoDomMap.size>0&&this.wmscManager.selfVideoDomMap.forEach(t=>{t.srcObject=i,this.wmscManager.playSelfVideo(e,t)});const t=null===(a=i.getVideoTracks()[0])||void 0===a?void 0:a.getSettings(),r=[{stream:i,width:(null==t?void 0:t.width)||640,height:(null==t?void 0:t.height)||360}];Vl.isVBEnabled&&r.push({stream:Vl.videoStream}),T.default.add_monitor("WMSC_Prepare_Send_streams:".concat(e,"|").concat(this.isStartVideoCapture)),this.isStartVideoCapture&&(this.wmscManager.resolutionUpgraded=!1,await this.wmscManager.sendMessageToWMSCAsync({type:"VIDEO_STREAMS",streams:r}))}else{var r;T.default.add_monitor("WMSC_Send_Stream_Fail:".concat(!!this.wmscManager,"|").concat(!!i,"|").concat(!(null===(r=this.videoCaptureValue)||void 0===r||!r.videoCtrl),"|").concat(e))}},Start_Video_Capture:function(){if(!Vl.shouldCaptureVideo()){var e=this;return new Promise((t,i)=>{if(e.isSupportVideoFrameOrBitmapCapture){e._videoloadedmetadata(null);try{e.videoCaptureValue&&e.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&(e.videoCaptureValue.videoCtrl.srcObject=Vl.videoStream),this.selfPreviewVideotagList&&this.selfPreviewVideotagList.length>0&&this.selfPreviewVideotagList.forEach(e=>{e&&(e.srcObject=Vl.videoStream)})}catch(e){C.default.error("Error trying to set srcObject of video tag",e)}S.default.isSelfPreviewRenderWithVideo()&&S.default.isSupportVideoFrameOrBitmapCapture()&&e.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&Vl.playVideoStream(e.videoCaptureValue.videoCtrl),t(!0)}else e.isVideoCaptureLoadedmetadata&&(C.default.error("Video capture isVideoCaptureLoadedmetadata is true"),e.isVideoCaptureLoadedmetadata=!1),this._addVideoLoadedmetadataListener(e.videoCaptureValue.videoCtrl),Vl.checkVideoStreamActive().then(t).catch(i),e.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&Vl.playVideoStream(e.videoCaptureValue.videoCtrl);if(this.webrtcConfig.webrtcflag)if(T.default.add_monitor("WMSC_Start_CAPTURE_REUSE_STREAM"),this.wmscManager)this.handleWebRTCStream("reuseCaptureStream");else{const e="WMSC_Resuse_Stream_Fail:".concat(!!this.wmscManager,"|").concat(this.isStartVideoCapture,"|reuseCaptureStream");T.default.add_monitor(e),C.default.error(e)}T.default.add_monitor("STARTVIDEOSUCCESS"),(e.isSupportVideoFrameOrBitmapCapture||!e.isSupportedVideoFrameOrBitmapCapture&&this.webrtcConfig.webrtcflag)&&this.startVideoCaptureSuccess()})}this.StartVideoMediaCapture()},video_capture_for_webrtc:function(){if(!Vl.shouldCaptureVideo())return new Promise(e=>{this.startVideoCaptureSuccess(),e(!0)})},Stop_Video_Capture:function(){this.webrtcConfig.webrtcflag?(T.default.add_monitor("WMSC_Stop_Video_CAPTURE"),this.Stop_Video_Capture_for_webrtc()):this.Stop_Video_Capture_for_wasm(),this.isStartVideoCapture=!1,this.isVideoCaptureLoadedmetadata=!1,Vl._clearCheckVideoStreamActiveTimer(),this.isMaskSettingOn||this.isVBSettingOn||this.isStartVideoCapture||(Vl.destoryVideoMediaStream(),this.videoCaptureValue=null),clearInterval(this.videoCaptureInterval),this.videoCaptureInterval=0},Stop_Video_Capture_for_wasm:function(){if(mt({command:"stopVideoEncode"}),St({command:"stopVideoEncode"}),Ht({command:"stopVideoEncode"}),this.videoCaptureValue&&this.videoCaptureValue.videoCtrl&&!this.isMaskSettingOn&&!this.isVBSettingOn){var e,t;let i=!1;if(this.videoloadmetadataListener&&Object(S.RecordVideoState)(this.videoCaptureValue.videoCtrl),this.selfPreviewVideotagList.length&&this.selfPreviewVideotagList.forEach(e=>{e===this.videoCaptureValue.videoCtrl&&(i=!0),Vl.removeVideoStream(e)}),i||Vl.removeVideoStream(this.videoCaptureValue.videoCtrl),null!==(e=this.videoloadedmetadatamonitor)&&void 0!==e&&e.stop&&(this.videoloadedmetadatamonitor.stop(),this.videoloadedmetadatamonitor=null),null!==(t=this.videoloadmetadataListener)&&void 0!==t&&t.remove){this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null;let e=performance.now();e-this.mountoadedmetadatatime>5e3&&C.default.error("stop video capture but loadedmetadata not callback after ".concat(Math.round(e-this.mountoadedmetadatatime)," ms"))}}},Stop_Video_Capture_for_webrtc:async function(){var e;null!==(e=this.videoCaptureValue)&&void 0!==e&&e.videoCtrl&&Vl.removeVideoStream(this.videoCaptureValue.videoCtrl),this.wmscManager&&await this.wmscManager.sendMessageToWMSCAsync({type:"VIDEO_STREAMS",streams:[]})},Remove_Video_Capture:function(){clearInterval(this.videoCaptureInterval),this.videoCaptureInterval=0,Vl.destoryVideoMediaStream(),this.videoCaptureValue=null,this.videoCaptureValue.videoCtrl&&this.videoCaptureValue.videoCtrl.pause()},Change_Video_Capture_Resolution:function(e,t){var i;let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=null===I.default||void 0===I.default||null===(i=I.default.localVideoPara)||void 0===i?void 0:i.isSupportWebCodecEnocde;if(S.default.isIpadOS()&&!r)return;let s=!1;if((S.default.isIphoneOrIpadBrowser()||S.default.isIpadOS()||S.default.isAndroidBrowser()&&!S.default.isMTRAndroidWithSAB())&&(s=!0,a||(this.captureSize={width:e,height:t}),!this.isLandScape&&!a))return;if(this.videoCaptureHiddenCanvas&&S.default.isMac()&&S.default.browser.isFirefox)return;if(e>=1920&&this.platformType!=o.WCL_PLATFORM_TYPE.DESKTOP)return;let d=0;d=e>=1920?30:this.videoCaptureValue&&this.videoCaptureValue.fps?this.videoCaptureValue.fps:24,Vl.changeVideoResolution(e,t,d).then(()=>{s||(this.ReadyCapureWidth=e,this.ReadyCapureHeight=t,this.videoCaptureWidth=e,this.videoCaptureHeight=t,I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:e,height:t}),mt({command:"updateVideoPara",width:e,height:t,fps:this.videoCaptureValue&&this.videoCaptureValue.fps?this.videoCaptureValue.fps:24}))}).catch(e=>{C.default.warn("change video resoltuion info:",e)}),!Vl.videoStreamTrack||this.isSupportVideoTrackReader||this.isSupportMediaStreamTrackProcessor||this.Process_Video()},Start_Whiteboard_Sharing:async function(){let e,t;const i=this.desktopSharingValue.canvas;this.whiteboardCanvas=i;this.isdesktopCaptureLoadedmetadata=!0,e=i.width,t=i.height,this.desktopSharingCaptureWidth=e,this.desktopSharingCaptureHeight=t,this.desktopCaptureContext=i.getContext("2d");let a={command:"startSharingEncode",width:e,height:t,fps:8,ssid:this.desktopSharingValue.ssid,isSupportVideoTrackReader:!1,isSupportMediaStreamTrackProcessor:!1,isWhiteboardSharing:!0};mt(a),this.isSupportVideoShare||Ht(a)},Change_Sharing_Capture_Resolution:function(e){if(this.shareTrack){let t;console.log("change sharing capture resolution to",e),t=1==e?{video:!0,frameRate:5}:{width:1280,height:720,frameRate:24},this.shareTrack.applyConstraints(t)}},Start_Desktop_Sharing:function(){if(this.desktopSharingMediaStram){var e=this;return new Promise((t,i)=>{let a=async function(t){let i,r;var o=e.desktopSharingMediaStram.getVideoTracks()[0];if(await Vl.adjustShareResUnder2K(o),e.isSupportSharingTrackReader||e.isSupportMediaStreamTrackProcessor)e.isSupportMediaStreamTrackProcessor?(e.sharingMediaStreamTrackProcessor=new MediaStreamTrackProcessor(o),e.sharingFrameStream=e.sharingMediaStreamTrackProcessor.readable,e.isSupportVideoShare?vt("sharingframeStream",e.sharingFrameStream):Ct("frameStream",e.sharingFrameStream),T.default.add_monitor("SCTP")):e.isSupportSharingTrackReader&&(e.sharingTrackReader=new VideoTrackReader(o),T.default.add_monitor("SCTPR")),e.desktopSharingValue.video&&(i=e.desktopSharingValue.video.videoWidth,r=e.desktopSharingValue.video.videoHeight,e.desktopSharingCaptureWidth=i,e.desktopSharingCaptureHeight=r,e.desktopSharingValue.video.removeEventListener("loadedmetadata",a));else if(e.isSharingSupportImageCapture){e.sharingImageCapture=new ImageCapture(o),T.default.add_monitor("SCIC");let a=await e.sharingImageCapture.grabFrame();e.desktopSharingCaptureWidth=a.width,e.desktopSharingCaptureHeight=a.height,i=a.width,r=a.height;try{e.replaceCanvasMap.sharingPreviewCanvasId=e.desktopSharingValue.rendercanvasID,e.sharingOffscreenCanvas=e.desktopSharingValue.canvas.transferControlToOffscreen();var s=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR)if(u=I.default.localSharingEncMGR.map.get(s)){var d={command:"newSharingPara",rendercanvasID:e.replaceCanvasMap.sharingPreviewCanvasId,data:e.sharingOffscreenCanvas,width:i,height:r,flipSend:e.flipSend,is32bitbrowser:e.is32bitbrowser};u.postMessage(d,[d.data])}}catch(t){var u;s=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR)if(u=I.default.localSharingEncMGR.map.get(s)){d={command:"newSharingPara",flipSend:e.flipSend,is32bitbrowser:e.is32bitbrowser};u.postMessage(d)}}}else e.isdesktopCaptureLoadedmetadata=!0,i=e.desktopSharingValue.video.videoWidth,r=e.desktopSharingValue.video.videoHeight,e.desktopSharingValue.canvas.width=i,e.desktopSharingValue.canvas.height=r,e.desktopSharingCaptureWidth=i,e.desktopSharingCaptureHeight=r,e.desktopCaptureContext=e.desktopSharingValue.canvas.getContext("2d"),e.desktopSharingValue.video.removeEventListener("loadedmetadata",a);e.isSupportVideoShare?Ft({command:"startSharingEncode",width:i,height:r,fps:8,ssid:e.desktopSharingValue.ssid,isSupportVideoTrackReader:e.isSupportSharingTrackReader,isSupportMediaStreamTrackProcessor:e.isSupportMediaStreamTrackProcessor}):Ht({command:"startSharingEncode",width:i,height:r,fps:8,ssid:e.desktopSharingValue.ssid,isSupportVideoTrackReader:e.isSupportSharingTrackReader,isSupportMediaStreamTrackProcessor:e.isSupportMediaStreamTrackProcessor}),I.default.Notify_APPUI(n.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,{width:i,height:r}),mt({command:"startsharingencode"})};if(e.isSupportSharingTrackReader||e.isSupportMediaStreamTrackProcessor)e.desktopSharingValue.video.addEventListener("loadedmetadata",a);else{if(e.isSharingSupportImageCapture)return a(),e.desktopSharingValue.video.srcObject=e.desktopSharingMediaStram,e.desktopSharingValue.video.muted=!0,void t(!0);e.desktopSharingValue.video.addEventListener("loadedmetadata",a),e.desktopSharingValue.video.setAttribute("playsinline",""),e.desktopSharingValue.video.muted=!0}try{e.desktopSharingValue.video.srcObject=e.desktopSharingMediaStram,e.desktopSharingValue.video.muted=!0}catch(t){e.desktopSharingValue.video.src=URL.createObjectURL(e.desktopSharingMediaStram)}e.desktopSharingValue.video.play().catch(e=>{C.default.error("Screenshare video preview play failed",e)}),I.default.isGoogleMeetMode&&e.desktopSharingMediaStram.getAudioTracks().length>0&&(e.screenShareAudioPreviewElement=new Audio,e.screenShareAudioPreviewElement.srcObject=e.desktopSharingMediaStram,e.screenShareAudioPreviewElement.setSinkId(e.audioCtx.sinkId)),t(!0)})}this.StartDesktopMediaCapture()},SharingFrameOutputCallback:function(e){let t,i,a=this;if(null!=e.format&&null!=e.planes)if(t=e.planes[0].stride,i=e.planes[0].rows,t==a.desktopSharingCaptureWidth&&i==a.desktopSharingCaptureHeight||(I.default.Notify_APPUI(n.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,{width:t,height:i}),a.desktopSharingCaptureWidth=t,a.desktopSharingCaptureHeight=i),1e3==a.sMonitorCaptureFrameCount&&(T.default.add_monitor2("SCFOK"),a.sMonitorCaptureFrameCount=0),a.sMonitorCaptureFrameCount++,a.canISendNextSharingFrame){a.canISendNextSharingFrame=!1;var r=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR){var o=I.default.localSharingEncMGR.map.get(r);if(o){var s={command:"encodeSharingFrame",isSupportVideoTrackReader:a.isSupportSharingTrackReader,data:e};o.postMessage(s)}S.default.browserType.version>=90&&("close"in e?e.close():e.destroy())}}else"close"in e?e.close():e.destroy();else if(a.canISendNextSharingFrame){let r;a.canISendNextSharingFrame=!1,e.createImageBitmap().then(o=>{r=o,t=r.width,i=r.height,"close"in e?e.close():e.destroy(),t==a.desktopSharingCaptureWidth&&i==a.desktopSharingCaptureHeight||(I.default.Notify_APPUI(n.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,{width:t,height:i}),a.desktopSharingCaptureWidth=t,a.desktopSharingCaptureHeight=i);var s=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR){var d=I.default.localSharingEncMGR.map.get(s);d&&d.postMessage({command:"encodeSharingFrame",isImageFromSharingFrame:!0,data:r},[r])}}).catch(e=>{C.default.error("Converting sharing frame to image bitmap failed",e)})}else"close"in e?e.close():e.destroy()},Process_Sharing:async function(){if(!this.desktopSharingValue||!this.desktopSharingSend)return;let e,t,i;if(!this.isStartWhiteboardSharing&&this.isSupportSharingTrackReader){try{await this.sharingTrackReader.start(this.SharingFrameOutputCallback.bind(this))}catch(e){}return}if(!this.isStartWhiteboardSharing&&this.isSharingSupportImageCapture)try{let i=await this.sharingImageCapture.grabFrame();e=i.width,t=i.height,1e3==this.sMonitorCaptureFrameCount&&(T.default.add_monitor2("SCFOK"),this.sMonitorCaptureFrameCount=0),this.sMonitorCaptureFrameCount++;var a=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR)if(o=I.default.localSharingEncMGR.map.get(a)){var r={command:"encodeSharingFrame",data:i,isImage:!0};o.postMessage(r,[r.data])}}catch(e){C.default.error("An error occurred when trying to encode a sharing frame using the ImageCapture API",e),T.default.add_monitor3("SICF");var o;a=I.default.SPECIAL_ID;if(I.default.localSharingEncMGR)if(o=I.default.localSharingEncMGR.map.get(a)){r={command:"encodeSharingFrame"};o.postMessage(r)}}else this.isStartWhiteboardSharing?(i=this.whiteboardCanvas,e=i.width,t=i.height):(i=this.desktopSharingValue.video,e=i.videoWidth,t=i.videoHeight);let s=Vl.getScaledResolution(e,t);e=s.w,t=s.h,e==this.desktopSharingCaptureWidth&&t==this.desktopSharingCaptureHeight||(I.default.Notify_APPUI(n.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,{width:e,height:t}),this.desktopSharingCaptureWidth=e,this.desktopSharingCaptureHeight=t);try{if(this.isdesktopCaptureLoadedmetadata&&i){this.isStartWhiteboardSharing||(this.desktopSharingValue.canvas.width=e,this.desktopSharingValue.canvas.height=t);var d=this.desktopCaptureContext;if(!this.is32bitbrowser||this.flipSend){this.isStartWhiteboardSharing||d.drawImage(i,0,0,e,t);var u=d.getImageData(0,0,e,t);1e3==this.sMonitorCaptureFrameCount&&(T.default.add_monitor2("SCFOK"),this.sMonitorCaptureFrameCount=0),this.sMonitorCaptureFrameCount++,$e(I.default.SPECIAL_ID,u.data,u.data.length,0,e,t),this.flipSend=!1}else this.flipSend=!0,$e(I.default.SPECIAL_ID,null,0,0,0,0)}}catch(e){C.default.error("An error occurred when trying to encode a sharing frame",e),T.default.add_monitor3("GIDF"),setTimeout((function(){$e(I.default.SPECIAL_ID,null,0,0,0,0)}),1e3)}},VideoFrameOutputCallback:function(e){let t,i,a,r,o=this;if(null!=e.format&&null!=e.planes){a=o.videoCaptureWidth,r=o.videoCaptureHeight,t=e.cropWidth,i=e.cropHeight,t===a&&i===r||(kl("video width/height changed old => begin",a,r,t,i),I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:t,height:i}),mt({command:"updateVideoPara",width:t,height:i,fps:o.GetVideoCaptureFps()}),o.videoCaptureWidth=t,o.videoCaptureHeight=i),3e3==o.vMonitorCaptureFrameCount&&(T.default.add_monitor2("VCFOK"),o.vMonitorCaptureFrameCount=0),o.vMonitorCaptureFrameCount++;var s=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var d=I.default.localVideoEncMGR.map.get(s);d&&e&&d.postMessage({command:"yuvVideoFrame",data:e}),S.default.browserType.version>=90&&("close"in e?e.close():e.destroy())}}else{let s;e.createImageBitmap().then(d=>{s=d,"close"in e?e.close():e.destroy(),a=o.videoCaptureWidth,r=o.videoCaptureHeight,t=s.width,i=s.height,t===a&&i===r||(kl("video width/height changed old => begin",a,r,t,i),I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:t,height:i}),mt({command:"updateVideoPara",width:t,height:i,fps:o.GetVideoCaptureFps()}),o.videoCaptureWidth=t,o.videoCaptureHeight=i);var u=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR){var l=I.default.localVideoEncMGR.map.get(u);l&&l.postMessage({command:"ImageBitmapFromVideoFrame",data:s},[s])}}).catch(e=>{C.default.error("Converting video frame to image bitmap failed",e)})}},Update_Mask_Texture:function(e,t,i){if(this.VideoMaskSettingCanvas){try{"object"==typeof t&&t.ideal&&(t=t.ideal),"object"==typeof i&&i.ideal&&(i=i.ideal),this.bgCanvas&&this.bgCanvasctx||(this.bgCanvas=document.createElement("canvas"),this.bgCanvasctx=this.bgCanvas.getContext("2d")),this.bgCanvas.width==t&&this.bgCanvas.height==i||(this.bgCanvas.width=t,this.bgCanvas.height=i)}catch(e){globaltracing_error("Update_Mask_Texture, width=$".concat(JSON.stringify(t),", height=").concat(JSON.stringify(i),". "),e),t=this.bgCanvas.width,i=this.bgCanvas.height}if(this.bgCanvasctx.clearRect(0,0,t,i),this.MaskImage&&this.BgImage&&"blur"!==this.BgImage){if(e.dWidth>0&&e.dHeight>0&&this.VideoMaskSettingCanvas.width>0&&this.VideoMaskSettingCanvas.height>0&&t>0&&i>0){let a=e.dx/(this.VideoMaskSettingCanvas.width/t),r=e.dy/(this.VideoMaskSettingCanvas.height/i),n=e.dWidth/(this.VideoMaskSettingCanvas.width/t),o=e.dHeight/(this.VideoMaskSettingCanvas.height/i);this.bgCanvasctx.drawImage(this.MaskImage,a,r,n,o)}let a,r,n,o;this.bgCanvasctx.globalCompositeOperation="source-out",this.Crop_Mask_Bg_16V9(),a=this.bgImageCroppingParams.sx,r=this.bgImageCroppingParams.sy,n=this.bgImageCroppingParams.sw,o=this.bgImageCroppingParams.sh,this.bgCanvasctx.drawImage(this.BgImage,a,r,n,o,0,0,t,i)}}},Crop_Mask_Bg_16V9:function(){let e,t,i,a=0,r=this.BgImage.naturalWidth,n=this.BgImage.naturalHeight;16/9*n>=r?(i=r,a=r/(16/9),e=0,t=(n-a)/2):(i=n*(16/9),a=n,e=(r-i)/2,t=0),this.bgImageCroppingParams.sx=e,this.bgImageCroppingParams.sy=t,this.bgImageCroppingParams.sw=i,this.bgImageCroppingParams.sh=a},Draw_Mask_Frame:function(){if(!this.VideoMaskSettingCanvas)return;this.VideoMaskSettingCanvasctx||(this.VideoMaskSettingCanvasctx=this.VideoMaskSettingCanvas.getContext("2d"));const e=this.VideoMaskCanvasFillMode?Ni(this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height,void 0,void 0,this.VideoMaskSettingCanvas.width/this.VideoMaskSettingCanvas.height):this.videoCaptureValue&&this.videoCaptureValue.disableOriginalRatio?Ni(this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height):null;this.isMirrorMyVideo?(this.isCanvasScaled||(this.VideoMaskSettingCanvasctx.scale(-1,1),this.isCanvasScaled=!0),this.VideoMaskSettingCanvasctx.clearRect(0-this.VideoMaskSettingCanvas.width,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx.drawImage(this.videoCaptureHiddenCanvas,...e?[e.left,e.top,e.width,e.height]:[],0-this.VideoMaskSettingCanvas.width,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height)):(this.isCanvasScaled&&(this.VideoMaskSettingCanvasctx.setTransform(1,0,0,1,0,0),this.isCanvasScaled=!1),this.VideoMaskSettingCanvasctx.clearRect(0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx.drawImage(this.videoCaptureHiddenCanvas,...e?[e.left,e.top,e.width,e.height]:[],0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height))},Draw_No_VB_Preview_Frame:function(){if(!this.videoNoVBPreviewCanvas)return;this.videoNoVBPreviewCanvasctx||(this.videoNoVBPreviewCanvasctx=this.videoNoVBPreviewCanvas.getContext("2d"));const e=this.videoCaptureHiddenCanvas,t=this.videoNoVBPreviewCanvas.width,i=this.videoNoVBPreviewCanvas.height,a=e.width,r=e.height;let n,o,s;a/r>t/i?(n=t/a,o=0,s=(i-r*n)/2):(n=i/r,o=(t-a*n)/2,s=0),this.isMirrorMyVideo?(this.isVideoNoVBPreviewCanvasScaled||(this.videoNoVBPreviewCanvasctx.scale(-1,1),this.isVideoNoVBPreviewCanvasScaled=!0),this.videoNoVBPreviewCanvasctx.clearRect(0-this.videoNoVBPreviewCanvas.width,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,a,r,-o-a*n,s,a*n,r*n)):(this.isVideoNoVBPreviewCanvasScaled&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.isVideoNoVBPreviewCanvasScaled=!1),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,a,r,o,s,a*n,r*n))},DrawNoVBPreviewFromVideo:function(e){if(!this.videoNoVBPreviewCanvas)return;this.videoNoVBPreviewCanvasctx||(this.videoNoVBPreviewCanvasctx=this.videoNoVBPreviewCanvas.getContext("2d"));const t=e.videoWidth?e.videoWidth:640,i=e.videoHeight?e.videoHeight:360,a=this.videoNoVBPreviewCanvas.width,r=this.videoNoVBPreviewCanvas.height;let n,o,s;t/i>a/r?(n=a/t,o=0,s=(r-i*n)/2):(n=r/i,o=(a-t*n)/2,s=0),this.isMirrorMyVideo?(this.isVideoNoVBPreviewCanvasScaled||(this.videoNoVBPreviewCanvasctx.scale(-1,1),this.isVideoNoVBPreviewCanvasScaled=!0),this.videoNoVBPreviewCanvasctx.clearRect(0-this.videoNoVBPreviewCanvas.width,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,t,i,-o-t*n,s,t*n,i*n)):(this.isVideoNoVBPreviewCanvasScaled&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.isVideoNoVBPreviewCanvasScaled=!1),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,t,i,o,s,t*n,i*n))},GetVideoCaptureFps:function(){return this.videoCaptureValue&&this.videoCaptureValue.fps?this.videoCaptureValue.fps:o.VIDEO_CAPTURE_FPS},Process_Video:async function(){if(this.isSupportMediaStreamTrackProcessor)return;if(this.isSupportVideoTrackReader){try{await Vl.videoTrackReader.start(this.VideoFrameOutputCallback.bind(this))}catch(e){}return}if(this.isSupportImageCapture){if(Vl.isImageCaptureLocked())return;Vl.lockImageCapture()}if(!(this.videoCaptureValue&&this.isStartVideoCapture||this.isMaskSettingOn||this.isVBSettingOn))return void Vl.unLockImageCapture();let e,t,i,a,r,s=this;if(i=this.videoCaptureWidth,a=this.videoCaptureHeight,this.isSupportImageCapture){try{let r=await Vl.videoImageCapture.grabFrame();e=r.width,t=r.height,e&&t&&(e!==i||t!==a)&&(kl("video width/height changed old => begin",i,a,e,t),I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:e,height:t}),mt({command:"updateVideoPara",width:e,height:t,fps:this.GetVideoCaptureFps()}),3e3==this.vMonitorCaptureFrameCount&&(T.default.add_monitor2("VCFOK"),this.vMonitorCaptureFrameCount=0),this.vMonitorCaptureFrameCount++,this.videoCaptureWidth=e,this.videoCaptureHeight=t),ni(r)}catch(e){C.default.error("An error occurred when trying to encode a video frame using the ImageCapture API",e),T.default.add_monitor3("VICF"),ni(null)}return void Vl.unLockImageCapture()}const d=Vl.isUsingFileInputVideoSource();if(this.isStartVideoCapture?r=this.videoCaptureValue.videoCtrl:(this.isMaskSettingOn||this.isVBSettingOn)&&(r=this.MaskSettingVideo),Object(S.VideoStreamCanCapture)(r.srcObject)&&(this.isVideoCaptureLoadedmetadata||this.isMaskSettingOn||this.isVBSettingOn)&&r&&r.readyState>=2){var u,l;if((r.paused||r.ended)&&r.play().catch(e=>{C.default.error("Video capture video tag play failed",e)}),this.isSelfViewWithVideo&&this.platformType==o.WCL_PLATFORM_TYPE.IPHONE){let e=xl;Vl.facingMode==o.FACE_MODE_ENVIRONMENT&&(2==xl?e=0:0==xl&&(e=2)),Vl.isUsingFileInputVideoSource()&&(e=0);let t=new VideoFrame(r,{timestamp:0});return void(Et({command:"yuvVideoFrame",data:t,rotation:e},[t])||t.close())}if(S.default.isSupportVideoFrame()&&!s.isCurrentInMaskStatus&&(null!==(u=S.default.browser)&&void 0!==u&&u.isSafari||null!==(l=S.default.browser)&&void 0!==l&&l.isFirefox)){let e=new VideoFrame(r,{timestamp:0}),t=xl;Vl.facingMode==o.FACE_MODE_ENVIRONMENT&&(2==xl?t=0:0==xl&&(t=2)),Vl.isUsingFileInputVideoSource()&&(t=0);let i={command:"yuvVideoFrame",data:e,rotation:t};return s.videoCaptureValue&&s.VideoRenderObj?(s.VideoRenderObj.Update_LocalVideo(e,t,!0),mt(i),e.close()):Et(i,[e])||e.close(),void(s.isVBSettingOn&&s.isCurrentInNoVBPreviewStatus&&s.DrawNoVBPreviewFromVideo(r))}let h,f,p,_;if(e=r.videoWidth?r.videoWidth:640,t=r.videoHeight?r.videoHeight:360,e&&t&&(e!==i||t!==a)&&(kl("video width/height changed old => begin",i,a,e,t),I.default.Notify_APPUI(n.CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT,{width:e,height:t}),this.videoCaptureWidth=e,this.videoCaptureHeight=t,mt({command:"updateVideoPara",width:e,height:t,fps:s.GetVideoCaptureFps()})),(!(!s.isMaskSettingOn||s.videoCaptureValue&&s.videoCaptureValue.disableOriginalRatio)||s.MaskImage&&s.BgImage)&&s.isCurrentInMaskStatus&&s.isCurrentInNoVBPreviewStatus){let i=e/t*s.ReadyCapureHeight,a=t/e*s.ReadyCapureWidth;i>s.ReadyCapureWidth?(h=0,f=(s.ReadyCapureHeight-a)/2):(h=(s.ReadyCapureWidth-i)/2,f=0),p=s.ReadyCapureWidth-2*h,_=s.ReadyCapureHeight-2*f,s.videoCaptureHiddenCanvas.width=s.ReadyCapureWidth,s.videoCaptureHiddenCanvas.height=s.ReadyCapureHeight}else p=e,_=t,h=0,f=0,s.videoCaptureHiddenCanvas.width=e,s.videoCaptureHiddenCanvas.height=t;if(d?S.default.videoToMediaStreamManager.drawCanvas(s.videoCaptureHiddenCanvas,s.videoCaptureHiddenCanvasCtx,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height):s.videoCaptureHiddenCanvasCtx.drawImage(r,0,0,e,t,h,f,p,_),s.isCurrentInMaskStatus&&(s.bgCanvas?s.videoCaptureHiddenCanvasCtx.drawImage(s.bgCanvas,0,0,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height):s.Update_Mask_Texture(this.maskCoordinate,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height),s.VideoMaskSettingCanvas&&s.Draw_Mask_Frame()),s.isCurrentInNoVBPreviewStatus&&s.videoNoVBPreviewCanvas&&s.Draw_No_VB_Preview_Frame(),s.isStartVideoCapture||s.isVBSettingOn){var c=s.videoCaptureHiddenCanvasCtx.getImageData(0,0,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height);let e=c.data;s.lastRealRect.width==s.videoCaptureHiddenCanvas.width&&s.lastRealRect.height==s.videoCaptureHiddenCanvas.height||(s.lastRealRect.left=0,s.lastRealRect.top=0,s.lastRealRect.width=s.videoCaptureHiddenCanvas.width,s.lastRealRect.height=s.videoCaptureHiddenCanvas.height,mt({command:"updateVideoPara",width:s.lastRealRect.width,height:s.lastRealRect.height,fps:s.GetVideoCaptureFps()})),s.videoCaptureValue&&s.VideoRenderObj&&!s.isMultiView&&(c.data instanceof Uint8ClampedArray&&(e=new Uint8Array(c.data.buffer)),s.videoCaptureValue&&void 0!==s.videoCaptureValue.disableOriginalRatio&&s.VideoRenderObj.Set_Cropping_Mode(!!s.videoCaptureValue.disableOriginalRatio),s.VideoRenderObj.Draw_Send_Video_Img(e,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height,s.videoCaptureValue.ssid,o.VIDEO_RGBA,s.lastRealRect)),3e3==s.vMonitorCaptureFrameCount&&(T.default.add_monitor2("VCFOK"),s.vMonitorCaptureFrameCount=0),s.vMonitorCaptureFrameCount++,Ze(I.default.SPECIAL_ID,e,s.videoCaptureHiddenCanvas.width,s.lastRealRect.left,s.lastRealRect.top)}s.videoCaptureHiddenCanvasCtx.clearRect(0,0,s.videoCaptureHiddenCanvas.width,s.videoCaptureHiddenCanvas.height)}},Remove_Sharing_Audio_Capture:function(){var e;if(this.useAudioBridge)null===(e=this.audioBridge)||void 0===e||e.publishStream(null,!0);else if(It({command:"changeAudioShare",isStart:!1}),I.default.ComputerAudioStatus==R.a.ComputerAudio_Null&&xe.clear(),this.sharingWebrtcAudioNode&&I.default.SharingAudioNode){try{this.sharingWebrtcAudioNode.disconnect(I.default.SharingAudioNode)}catch(e){this.JsMediaSDK_Log(e)}this.sharingWebrtcAudioNode=null}},Remove_Audio_Capture:function(e){if(dt(I.default.SPECIAL_ID,n.AUDIO_REMOVE,e),I.default.DesktopAudioStatus==R.a.DesktopAudio_Null&&xe.clear(),this.firstSetDelay=!0,this.webrtcAudioNode&&I.default.AudioNode){try{this.webrtcAudioNode.disconnect(I.default.AudioNode)}catch(e){this.JsMediaSDK_Log(e)}this.webrtcAudioNode=null}},Start_Video_Play:function(){this.videoRenderIntervalHandle||(this.videoRenderIntervalHandle=this.JsMediaSDK_VideoRenderInterval(this.videorenderinterval))},Stop_Video_Play:function(){if(this.UpdateVideoPlayStatus(!1),this.VideoRenderObj&&(this.VideoRenderObj.ClearQueue(),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName})),this.videoRenderIntervalHandle){this.VideoRenderObj.Stop_Draw.bind(this.VideoRenderObj)(),this.videoRenderIntervalHandle=null}},Remove_Video_Play:function(){this.UpdateVideoPlayStatus(!1),this.videoRenderIntervalHandle&&(clearInterval(this.videoRenderIntervalHandle),this.videoRenderIntervalHandle=null),St({command:"removeVideoPlay"})},UpdateVideoPlayStatus(e){_e(e)},EndMedia:function(){try{I.default.rwgAgent&&I.default.rwgAgent.off("message",this.rwgAgentMessageListenerWrapper)}catch(e){C.default.error("rwgAgent.off error",e)}try{var e,t;null===(e=this.videoDataChannel)||void 0===e||e.forceClose(),null===(t=this.audioDataChannel)||void 0===t||t.forceClose()}catch(e){C.default.error("clear rtcPeerConnectionList err",e)}try{Vl.enableReuseStream(!1),Vl.destoryAudioMediaStream(),this.Remove_Audio_Play(),this.Remove_Audio_Capture(),this.Remove_Sharing_Audio_Capture(),this.checkWorkletInterval&&(clearInterval(this.checkWorkletInterval),this.checkWorkletInterval=null),this.Remove_Video_Play(),this.audioCtx&&(this.audioCtx.onstatechange=null,this.audioCtx.close(),this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx=null),this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.sharingAudioCtx=null),this.audioDomNode&&(this.audioDomNode=null)}catch(e){C.default.error("endMedia",e)}try{Vl.enableReuseStream(!1),Vl.destoryVideoMediaStream(),this.EndSharingMediaStream(),this.CloseBoringPeerConnection(),S.default.audioToMediaStreamMananger.destroy(!1)}catch(e){C.default.error("endMedia",e)}try{jt()}catch(e){C.default.error("endMedia",e)}try{this.remoteControl&&this.remoteControl.destroy()}catch(e){C.default.error("endMedia",e)}},EndDesktopAudioMediaStream:function(){if(this.desktopSharingMediaStram){let e=this.desktopSharingMediaStram.getAudioTracks();e.length&&e.forEach((function(e){e.stop()})),this.desktopSharingValue.audioOnly&&!this.desktopSharingMediaStram.getVideoTracks().length&&(this.desktopSharingMediaStram=null)}this.isStartDesktopSharing||(this.desktopSharingValue=null)},EndSharingMediaStream:function(){this.desktopSharingMediaStram&&(this.desktopSharingMediaStram.getTracks().forEach((function(e){e.stop()})),this.desktopSharingMediaStram=null,window.WebQrscanner&&WebQrscanner.qrScanner.stop())},StopSharingCapture:function(){this.EndSharingMediaStream(),this.desktopSharingSend=!1,this.isStartDesktopSharing&&mt({command:"stopsharingencode"}),this.isStartDesktopSharing=!1,this.desktopSharingMediaStram=null,window.WebQrscanner&&WebQrscanner.qrScanner.stop(),this.desktopSharingValue=null},CloseBoringPeerConnection:function(){try{this.rtcConnectionB&&(this.rtcConnectionB.close(),this.rtcConnectionB=null),this.rtcConnectionA&&(this.rtcConnectionA.close(),this.rtcConnectionA=null)}catch(e){kl(e)}},UnMuteAudio:function(){dt(I.default.SPECIAL_ID,n.AUDIO_START),this.enableHID&&this.hidAvalible&&wa.sendReport("mute",!1)},MuteAudio:function(){this.Stop_Audio_Capture(),this.enableHID&&this.hidAvalible&&wa.sendReport("mute",!0)},async selectComputerAudioSpeaker(e,t){var i;let a=S.default.isSupportChromeWideAEC(),r="default"==e?"":e,o=null;var s;if(a&&!this.audioDomNode?this.audioCtx&&(o=this.audioCtx):this.audioDomNode&&(o=this.audioDomNode),!await ma.hasOutputDevice(r))return ma.updateSelectedSpeakerDevices(r,0,!1),C.default.error("Selected output device ID is not available: ".concat(r)),void I.default.Notify_APPUI(n.AUDIO_SPEAKER_SET_ERROR,(null===(s=o)||void 0===s?void 0:s.sinkId)||"default");if(null!==(i=this.fileAudioPlaybackTag)&&void 0!==i&&i.setSinkId&&this.fileAudioPlaybackTag.setSinkId(r).catch(e=>{C.default.error("set audio tag setSinkId error",e)}),this.useAudioBridge){var d;null===(d=this.audioBridge)||void 0===d||d.changeSpeaker(e)}else{var u;if(!o||!o.setSinkId)return T.default.add_monitor("NoAudioPlayer"),C.default.error("no audio player or audio player dont support setSinkId. audioPlayer"),void I.default.Notify_APPUI(n.AUDIO_SPEAKER_SET_ERROR,(null===(u=o)||void 0===u?void 0:u.sinkId)||"default");o.setSinkId(r).then(()=>{var e,i;ma.updateSelectedSpeakerDevices((null===(e=o)||void 0===e?void 0:e.sinkId)||"default",Date.now()-t,!0),"suspended"===o.state&&(T.default.add_monitor("AUDIOCONTEXT:RESUME"),o.resume().catch(e=>{C.default.error("resume audio context failed when setSinkId",e)})),I.default.Notify_APPUI(n.AUDIO_SPEAKER_SET_SUCCESS,(null===(i=o)||void 0===i?void 0:i.sinkId)||"default")}).catch(e=>{C.default.error("An error occurred when trying to set the audio output device",e),T.default.add_monitor("AODF"),ma.updateSelectedSpeakerDevices(r,Date.now()-t,!1),I.default.Notify_APPUI(n.AUDIO_SPEAKER_SET_ERROR,null)})}},handleDesktopCapture:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.desktopSharingMediaStram=e,this.sharingCodecInfo={width:0,height:0};var i=this;let a=this.desktopSharingMediaStram.getAudioTracks()[0];a?(Vl.addAudioTrackSettingsMonitor(a,"DesktopAudioCapture"),t||"Tab audio"===a.label||a.label.includes("HDMI")||(I.default.shareSystemAudio=!0),ma.updateShareAudioDevices(a.id,a.label),I.default.Notify_APPUI(n.SHARING_DESKTOP_STREAM_HAVE_AUDIO,t),a.onended=function(){T.default.add_monitor("ATRS:"+a.readyState+":"+a.id+":-S")},a.onmute=function(){T.default.add_monitor("ATMS:"+a.muted+":"+a.id+":-S")},a.onunmute=function(){T.default.add_monitor("ATMS:"+a.muted+":"+a.id+":-S")}):I.default.Notify_APPUI(n.SHARING_DESKTOP_STREAM_HAVE_NO_AUDIO,null),this.shareTrack=this.desktopSharingMediaStram.getVideoTracks()[0],this.shareTrack?(T.default.add_monitor("OSTS"),this.shareTrack.onended=function(){T.default.add_monitor("SSBB"),I.default.Notify_APPUI(n.USER_STOP_DESKTOP_SHARING,null),i.StopSharingCapture()},this.Start_Desktop_Sharing(),I.default.Notify_APPUI(n.DESKTOP_SHARING_CAPTURE_SUCCESS,null)):C.default.log("shareTrack is null when share screen")},handleCaptureError:function(e){this.handleGetDisplayMediaError("An error occurred when trying to capture sharing",e),this.StopSharingCapture(),T.default.add_monitor("SCCF"),"Permission denied by system"===e.message?I.default.Notify_APPUI(n.DESKTOP_SHARING_SYSTEM_ERROR,null):I.default.Notify_APPUI(n.DESKTOP_SHARING_ERROR,null)},handleAudioCapture:function(){let{deviceId:e,elapsed_time:t,deviceLabel:i}=Vl.getAudioCapabilities();var a;return e&&t&&i&&ma.updateSelectedMicDevices(e,i,t,!0),this.updateFileAudioPlaybackStream(Vl.audioStream),this.useAudioBridge&&!this.audioInputLevel?(null===(a=this.audioBridge)||void 0===a||a.publishStream(Vl.audioStream).then(e=>{I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting&&(I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,Vl.getAudioDeviceId()))}),C.default.log("user grante audio capture"),void I.default.Notify_APPUI(n.USER_GRANT_CAPTURE_AUDIO,e)):this.audioCtx||this.audioInputLevel?(C.default.log("user grante audio capture"),I.default.Notify_APPUI(n.USER_GRANT_CAPTURE_AUDIO,e),void this.Start_Audio_Capture()):(C.default.log("no audio context when join computer audio"),I.default.ComputerAudioStatus=R.a.ComputerAudio_Null,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null),I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_FAILURE,null),void Vl.destoryAudioMediaStream())},handleWasmVideoCapture:function(e,t){let i=this;return new Promise(async(a,r)=>{if(!e)return r(new Error("no stream"));if(i.videoCaptureWidth?i.videoCaptureWidth=i.videoCaptureWidth:i.videoCaptureWidth=640,i.videoCaptureHeight?i.videoCaptureHeight=i.videoCaptureHeight:i.videoCaptureHeight=360,t.encode&&i.isStartVideoCapture){try{a(await i.Start_Video_Capture())}catch(e){C.default.error("media stream is ok, but start video capture fail",e),r(new Error("media stream is ok, but start video capture fail"))}i.isMaskSettingOn&&i.MaskSettingVideo&&Vl.playVideoStream(i.MaskSettingVideo)}else if(t.preview&&(i.isMaskSettingOn||i.isVBSettingOn))try{a(await i.startMaskOrVBSettingVideoCapture(e))}catch(e){kl("startMaskOrVBSettingVideoCapture",e),r(new Error("media stream is ok, but start setting video capture fail"))}else i.isStartVideoCapture||Vl.destoryVideoMediaStream()})},handleWebrtcVideoCapture:function(e){let t=this;return new Promise(async(i,a)=>{if(!e)return a(new Error("no stream"));if(t.isStartVideoCapture)try{i(await t.video_capture_for_webrtc())}catch(e){a(new Error("media stream is ok, but start video capture fail"))}else if(t.isMaskSettingOn||t.isVBSettingOn)try{i(await t.startMaskOrVBSettingVideoCapture(e))}catch(e){kl("startMaskOrVBSettingVideoCapture",e),a(new Error("media stream is ok, but start setting video capture fail"))}else Vl.destoryVideoMediaStream()})},startMaskOrVBSettingVideoCapture:function(e){return new Promise((e,t)=>{try{if(this.isVBSettingOn)if(this.MaskSettingVideo){const e=Vl.playVideoStream(this.MaskSettingVideo);e&&e.then((function(){I.default.Notify_APPUI(n.START_VIDEO_STREAM_IN_VB_SETTING_SUCCESS,null)})).catch((function(e){t(new Error("media stream is ok, but video.play() fail")),C.default.error("An error occurred when trying to play video in Background Setting tab",e),T.default.add_monitor("VBVPF")}))}else I.default.Notify_APPUI(n.START_VIDEO_STREAM_IN_VB_SETTING_SUCCESS,null);else if(this.isMaskSettingOn)if(this.MaskSettingVideo){const e=Vl.playVideoStream(this.MaskSettingVideo);e&&e.then((function(){I.default.Notify_APPUI(n.START_VIDEO_STREAM_IN_MASK_SETTING_SUCCESS,null)})).catch((function(e){t(new Error("media stream is ok, but video.play() fail")),C.default.error("An error occurred when trying to play video in Background Setting tab",e),T.default.add_monitor("MVPF")}))}else I.default.Notify_APPUI(n.START_VIDEO_STREAM_IN_MASK_SETTING_SUCCESS,null);this.webrtcConfig.webrtcflag||(this.addChannelForVideo(),mt({command:"startvideointerval",width:this.videoCaptureValue.width,height:this.videoCaptureValue.height,ssid:this.videoCaptureValue.ssid,mtu_size:this.mtu_size,fps:this.videoCaptureValue.fps,isSupportImageCapture:this.isSupportImageCapture,isSupportVideoTrackReader:this.isSupportVideoTrackReader,isSupportMediaStreamTrackProcessor:this.isSupportMediaStreamTrackProcessor,isSupport2DCanvasDrawFrame:this.isSupport2DCanvasDrawFrame,isVBSettingOn:this.isVBSettingOn,isMaskSettingOn:this.isMaskSettingOn})),e(!0)}catch(e){C.default.error("Starting mask or virtual background failed",e),t(e)}})},handleGetDisplayMediaError:function(e,t){const{name:i}=t,a={AbortError:"error",InvalidStateError:"error",NotAllowedError:"warn",NotFoundError:"warn",NotReadableError:"warn",OverconstrainedError:"warn",TypeError:"error"}[i]||"error";C.default[a](e,t)},handleGetUserMediaError:function(e,t){const{name:i}=t,a={NotAllowedError:"warn",NotFoundError:"warn",NotReadableError:"warn",OverconstrainedError:"warn",SecurityError:"warn",SourceUnavailableError:"warn",PermissionDeniedError:"warn",AbortError:"error",TypeError:"error"}[i]||"error";C.default[a](e,t)},analyserCaptureReason:function(e){let t=Gl(e);I.default.Notify_APPUI(n.AUDIO_CAPTURE_FAILED,t),"NotAllowedError"===(null==e?void 0:e.name)&&"hidden"===document.visibilityState&&(document.removeEventListener("visibilitychange",Ul),document.addEventListener("visibilitychange",Ul)),T.default.add_monitor("HADF: "+(null==e?void 0:e.name)+"-"+(null==t?void 0:t.errorCode))},handleAudioError:function(e){this.handleGetUserMediaError("Error occurred when trying to capture audio",e),this.analyserCaptureReason(e),I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting&&(I.default.ComputerAudioStatus=R.a.ComputerAudio_Null,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null),I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_FAILURE,null))},handleVideoError:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!Ae(this,"videocaptureerror"))return void C.default.error("VideoCaptureException VideoError, JsMediaSDK instance destroyed");if(t)return T.default.add_monitor("GUMF"),void this.handleGetUserMediaError("Error occurred when trying to capture video with normal constraints",e);this.isMaskSettingStarted=!1,this.isCurrentInMaskStatus=!1,this.isCurrentInNoVBPreviewStatus=!1,kl("handleVideoError",e);let i=(null==e?void 0:e.name)||"other error",a="Error ".concat((null==e?void 0:e.message)||"");T.default.add_monitor("STARTVIDEOERR:".concat(i,"-").concat(a));let r=["NotReadableError","SourceUnavailableError"];e instanceof Z.CameraOccupiedError||e.name&&-1!==r.indexOf(e.name)?(T.default.add_monitor("COCPEF"),I.default.Notify_APPUI(n.USER_CAMERA_IS_TAKEN_BY_OTHER_PROGRAMS,e)):(T.default.add_monitor("HVDF"),I.default.Notify_APPUI(n.USER_FORBIDDED_CAPTURE_VIDEO,e)),this.handleGetUserMediaError("Error occurred when trying to capture video",e),this.Stop_Video_Capture()},chromeAecWorkAround:async function(e){if(T.default.add_monitor("ASCAEC"),this.rtcConnectionA||this.rtcConnectionB)return!1;let t=null,i=null,a=new MediaStream;let r,n;t=new RTCPeerConnection,i=new RTCPeerConnection,t.onicecandidate=e=>e.candidate&&i.addIceCandidate(new RTCIceCandidate(e.candidate)),i.onicecandidate=e=>e.candidate&&t.addIceCandidate(new RTCIceCandidate(e.candidate)),i.ontrack=e=>{e.streams[0].getTracks().forEach(e=>{a.addTrack(e)})},t.addStream(e),r=await t.createOffer({offerVideo:!0,offerAudio:!0,offerToReceiveAudio:!1,offerToReceiveVideo:!1});let o=!1,s=null,d=null,u=S.default.getBrowserVersion();try{d=r.sdp,u>=104?(s=r.sdp.replace("SAVPF 111","SAVPF 100 111"),s=s.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:100 L16/48000\na=rtpmap:111 opus/48000/2")):(s=r.sdp.replace("SAVPF 111","SAVPF 10 111"),s=s.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:10 L16/48000\na=rtpmap:111 opus/48000/2")),r.sdp=s,await t.setLocalDescription(r),await i.setRemoteDescription(r)}catch(e){o=!0,r.sdp=d,await t.setLocalDescription(r),await i.setRemoteDescription(r)}return n=await i.createAnswer(),o||(u>=104?(n.sdp=n.sdp.replace("SAVPF 111","SAVPF 100 111"),n.sdp=n.sdp.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:100 L16/48000\na=rtpmap:111 opus/48000/2")):(n.sdp=n.sdp.replace("SAVPF 111","SAVPF 10 111"),n.sdp=n.sdp.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:10 L16/48000\na=rtpmap:111 opus/48000/2"))),await i.setLocalDescription(n),await t.setRemoteDescription(n),this.rtcConnectionA=t,this.rtcConnectionB=i,a},switchCanvasForVideoCapture:function(e){var t=[].concat(e),i=t[0];if(this.captureVideoOutputCanvasDomList=t,this.videoCaptureValue.canvasCtrl=i,!this.isSupportVideoFrameOrBitmapCapture){var a=this.videoCaptureValue.videoCtrl.videoWidth,r=this.videoCaptureValue.videoCtrl.videoHeight;t.forEach((function(e){e.width=a,e.height=r})),this.videoCaptureValue.canvasCtrl.width=a,this.videoCaptureValue.canvasCtrl.height=r,this.videoCaptureContext=i.getContext("2d")}},switchVideoTagForVideoCapture:function(e){var t;if(!this.videoCaptureValue)return;if(e===this.videoCaptureValue.videoCtrl)return;null!==(t=this.videoloadmetadataListener)&&void 0!==t&&t.remove&&(this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null);const i=this.videoCaptureValue.videoCtrl;i&&!this.selfPreviewVideotagList.includes(i)&&Vl.removeVideoStream(i),this.videoCaptureValue.videoCtrl=e,this.captureVideoOutPutVideoDom=e,this.isVideoCaptureLoadedmetadata||(C.default.warn("isVideoCaptureLoadedmetadata is false ,need to reloaded"),this._addVideoLoadedmetadataListener(e)),Vl.playVideoStream(e)},videoDecodeFrameBackSABRingBufferConsumeCallback(e){let t=new V;t.setBuffer(e);let i=t.buffer2Obj();et(i.video_ssrc,i.data,i.video_timestamp,i.video_width,i.video_height,i.rendering_x,i.rendering_y,i.rendering_w,i.rendering_h,i.rotation,i.yuv_limited),this.VideoRenderObj.JsMediaSDK_VideoRender.bind(this.VideoRenderObj)()},CheckCurrentActiveSSRC(e){this.currentactive!=e&&(this.currentactive=e,I.default.CurrentSSRC=this.currentactive,I.default.decoderinworklet?I.default.AudioNode&&I.default.AudioNode.postCMD("currentSSRC",I.default.CurrentSSRC):Rt(I.default.CurrentSSRC))},createVideoElement(){this.MaskSettingVideo||(this.videoCaptureValue&&this.videoCaptureValue.videoCtrl?this.MaskSettingVideo=this.videoCaptureValue.videoCtrl:(this.MaskSettingVideo=function(){let e=document.createElement("video");return e.setAttribute("muted",""),e.setAttribute("playsinline",""),e}(),S.default.browser.isSafari&&(this.MaskSettingVideo.setAttribute("style","position:fixed;top:-10000px;left:-10000px;"),document.body.appendChild(this.MaskSettingVideo))))},changeVideoRenderActiveSsrc(e){if(!this.webrtcConfig.webrtcflag)if(this.RenderInMain==o.RENDER_IN_WORKER){var t=I.default.SPECIAL_ID;if(I.default.localVideoDecMGR){var i=I.default.localVideoDecMGR.map.get(t);if(i){var a={command:"CHANGE_CURRENT_ACTIVE_SSRC",ssrc:e};i.postMessage(a)}}}else this.RenderInMain==o.RENDER_IN_MAIN&&this.VideoRenderObj.Change_Current_SSRC(e)},addChannelForVideo(){var e,t;if(this.vcFlag)return;this.waitingVcChannelReady=!0;let i=I.default.SPECIAL_ID;if(null!==(e=I.default.localVideoDecMGR)&&void 0!==e&&e.map.get(i)&&null!==(t=I.default.localVideoEncMGR)&&void 0!==t&&t.map.get(i)){this.waitingVcChannelReady=!1,this.vcFlag=!0;var a=new MessageChannel;ct(a,a)}},checkIsRenderInWorker(){return this.isMultiView||this.isSupportVideoFrameOrBitmapCapture||I.default.enableVirtualBackgroundWithoutSAB||Object(S.IsSupportWebGLOffscreenCanvas)()&&"undefined"!=typeof SharedArrayBuffer&&S.default.isSafariVersionHigherThan("17.5")},setMultiView(e,t){const i=e>1,a=Object(S.IsSupportWebGLOffscreenCanvas)(),r=!!S.default.isWebGL2Supported(this.isWebGL2FeatureEnabled),n="function"==typeof OffscreenCanvas;this.isMultiView=i&&(a||r),C.default.directReport("JsMediaSDK-SetMultiView() isMultiView:".concat(this.isMultiView||t,",\n docodeThreadNumber:").concat(e,",\n isWebGLSupported:").concat(a,",\n isWebGL2Supported:").concat(r,",\n isOffscreenCanvasSupported:").concat(n,",\n enableMultiDecodeVideoWithoutSAB:").concat(t))},start_capture_video_wasm:function(e){if(xt(I.default.e2eencrypt),this.addChannelForVideo(),this.videoCaptureHiddenCanvas||this.isSupportVideoFrameOrBitmapCapture||(this.videoCaptureHiddenCanvas=S.default.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),this.videoCaptureHiddenCanvasCtx=this.videoCaptureHiddenCanvas.getContext("2d")),!$t())return kl.warn("not isVideoEncodeHandleReady so return"),void T.default.add_monitor("not isVideoEncodeHandleReady so return");if(T.default.add_monitor("STARTVIDEO:".concat(this.isStartVideoCapture)),this.isStartVideoCapture)C.default.warn("video capture is already started, do not call again.");else{if(this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO=Object.assign({},e),this.isStartVideoCapture=!0,this.isSupportVideoTrackReader||this.isSupportMediaStreamTrackProcessor){let t;t=e.canvas instanceof Array?e.canvas[0]:e.canvas,S.default.isSelfPreviewRenderWithVideo()&&S.default.isSupportVideoFrameOrBitmapCapture()?e.video?e.videoCtrl=Object(S.parseDOMParams)(e.video).dom:this.selfPreviewVideotagList.length&&(e.videoCtrl=this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]):(this.MaskSettingVideo||this.createVideoElement(),e.videoCtrl=this.MaskSettingVideo)}else e.canvasCtrlList=[],e.canvasCtrl=this.videoCaptureHiddenCanvas,S.default.isSelfPreviewRenderWithVideo()&&(e.video||this.selfPreviewVideotagList.length)?(e.video?e.videoCtrl=Object(S.parseDOMParams)(e.video).dom:this.selfPreviewVideotagList.length&&(e.videoCtrl=this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]),this.isSelfViewWithVideo=!0):(S.default.browser.isSafari,this.MaskSettingVideo||this.createVideoElement(),e.videoCtrl=this.MaskSettingVideo);this.ReadyCapureWidth=e.width?e.width:640,this.ReadyCapureHeight=e.width?e.height:360,this.captureVideoOutPutVideoDom=e.videoCtrl,this.videoCaptureValue=e,this.videoCaptureValue.ssid&&(I.default.localSsrc=this.videoCaptureValue.ssid),!I.default.rwgAgent&&(!e.fps||24==e.fps)&&navigator.hardwareConcurrency&&navigator.hardwareConcurrency>8&&this.isSupportVideoShare&&(this.videoCaptureValue.fps=30),this.Start_Video_Capture()}},start_capture_video_webrtc:function(e){const{video:t=null,...i}=e;T.default.add_monitor("WMSC_Start_CAPTURE: ".concat(Object(S.replaceComma)(JSON.stringify(i)),"|").concat(!!t)),this.isStartVideoCapture?C.default.warn("video capture is already started, do not call again."):(this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO=Object.assign({},e),this.isStartVideoCapture=!0,e.videoCtrl=e.video?Object(S.parseDOMParams)(e.video).dom:null,this.captureVideoOutPutVideoDom=e.videoCtrl,this.videoCaptureValue=e,this.videoCaptureValue.ssid&&(I.default.localSsrc=this.videoCaptureValue.ssid),this.Start_Video_Capture())},add_render_video_wasm:async function(e){var t=0;if(Object.assign(e,this.videoWaterMarkParams),void 0===e.isMyself&&(e.isMyself=this.userId&&this.userId>>10==e.userId>>10),S.default.isSelfPreviewRenderWithVideo()&&this.videoCaptureValue&&Object(S.Get_Logical_SSrc)(parseInt(e.userId))==Object(S.Get_Logical_SSrc)(this.videoCaptureValue.ssid)&&e.videodom)return Vl.playVideoStream(e.videodom),this.selfPreviewVideotagList.includes(e.videodom)||this.selfPreviewVideotagList.push(e.videodom),void(this.isSupportVideoTrackReader||this.isSupportMediaStreamTrackProcessor?S.default.isSelfPreviewRenderWithVideo()&&S.default.isSupportVideoFrameOrBitmapCapture()&&(this.videoCaptureValue.videoCtrl=e.videodom):S.default.isSelfPreviewRenderWithVideo()&&(this.videoCaptureValue.videoCtrl=e.videodom,this.isSelfViewWithVideo=!0));if(e.ssrc=e.userId,e.canvas=Object(S.parseDOMParams)(e.canvas).dom,e.canvas){if(e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.floor(e.width),e.height=Math.floor(e.height),this.isCreateVideoWaterMark=e.enableWaterMark,this.videoWaterMarkName=this.isCreateVideoWaterMark?e.waterMarkText:"",this.isMultiView||e.isMyself||this.CheckCurrentActiveSSRC(e.ssrc),this.checkIsRenderInWorker()){var i;const t=S.apiSupportUtility.getIsRenderSelfVideoInEncodeWorker(I.default.localSsrc&&Object(S.Get_Logical_SSrc)(e.ssrc)===Object(S.Get_Logical_SSrc)(I.default.localSsrc)),a=t?I.default.localVideoEncMGR:I.default.localVideoDecMGR,r=I.default.SPECIAL_ID,n=null===(i=e.canvas)||void 0===i?void 0:i.id;this.replaceCanvasMap.videoDecodeCanvasIds||(this.replaceCanvasMap.videoDecodeCanvasIds=[]),this.replaceCanvasMap.videoEncodeCanvasIds||(this.replaceCanvasMap.videoEncodeCanvasIds=[]),t?-1===this.replaceCanvasMap.videoEncodeCanvasIds.indexOf(n)&&this.replaceCanvasMap.videoEncodeCanvasIds.push(n):-1===this.replaceCanvasMap.videoDecodeCanvasIds.indexOf(n)&&this.replaceCanvasMap.videoDecodeCanvasIds.push(n);try{if(a){const t=a.map.get(r);if(t){const i=e.canvas.transferControlToOffscreen(),a={command:"renderOfflineCanvas",ssrc:e.ssrc,rendercanvasID:n,canvas:i,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,waterMarkText:e.waterMarkText,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition,x:e.x,y:e.y,width:e.width,height:e.height,zone:e.zone,fillMode:e.fillMode,fillModeForResolution:e.fillModeForResolution};t.postMessage(a,[i])}}}catch(t){if(a){const t=a.map.get(r);if(t){const i={command:"renderOfflineCanvas",rendercanvasID:n,ssrc:e.ssrc,videoWaterMarkName:this.videoWaterMarkName,isCreateVideoWaterMark:this.isCreateVideoWaterMark,waterMarkText:e.waterMarkText,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition,x:e.x,y:e.y,width:e.width,height:e.height,zone:e.zone,fillMode:e.fillMode,fillModeForResolution:e.fillModeForResolution};t.postMessage(i)}}}this.RenderInMain===o.RENDER_UNSET&&(this.RenderInMain=o.RENDER_IN_WORKER),this.currentactive&&this.changeVideoRenderActiveSsrc(this.currentactive)}else{var a;e.isMyself||St({command:"RenderInMain"});const i=null===(a=e.canvas)||void 0===a?void 0:a.id;if(this.videoRenderArray.length)for(t=0;t{this.videoRenderArray.push(Object.assign({},e,{canvas:t}))}),kl("Start_Video_Play"),this.Start_Video_Play(),this.VideoRenderObj.Set_Render_Array(this.videoRenderArray,I.default.enableMultiDecodeVideoWithoutSAB),this.isCreateVideoWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition}),this.RenderInMain===o.RENDER_UNSET&&(this.RenderInMain=o.RENDER_IN_MAIN),this.currentactive&&this.changeVideoRenderActiveSsrc(this.currentactive)}await _e(!0)}else C.default.warn("ADDRENDER:".concat(e.userId,", canvas:").concat(e.canvas))},add_render_video_webrtc:async function(e){this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"NOTIFY_WMSC_VIDEO_TAG_MAPPING",data:{...e,action:"add"}})},stop_render_video_wasm:async function(e){if(S.default.isSelfPreviewRenderWithVideo()&&e.videodom){const t=this.selfPreviewVideotagList.indexOf(e.videodom);t>=0&&(this.selfPreviewVideotagList.splice(t,1),this.videoCaptureValue&&this.videoCaptureValue.videoCtrl===e.videodom&&this.selfPreviewVideotagList.length?this.switchVideoTagForVideoCapture(this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]):this.isStartVideoCapture||Vl.removeVideoStream(e.videodom))}var t;"string"!=typeof e.canvas&&(e.canvas=null===(t=e.canvas)||void 0===t?void 0:t.id);if(this.videoWaterMarkName="",this.isCreateVideoWaterMark=!1,e.ssrc=e.userId,this.checkIsRenderInWorker()){(S.apiSupportUtility.getIsRenderSelfVideoInEncodeWorker(I.default.localSsrc&&Object(S.Get_Logical_SSrc)(e.ssrc)===Object(S.Get_Logical_SSrc)(I.default.localSsrc))?mt:St)({command:"stopVideoRender",ssrc:e.ssrc,canvas:e.canvas,RGBA:e.RGBA,doNotClean:e.doNotClean,x:e.x,y:e.y,zone:e.zone})}if(this.videoRenderArray.length)for(let t=0;t{this.webrtcConfig.webrtcflag?Vl.changeVBImage(e):si(e,"BgImage")}).catch(e=>{T.default.add_monitor("VBCF"),I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,2)})}else this.webrtcConfig.webrtcflag?Vl.isVBEnabled&&Vl.disableVB():si(null,"BgImage");if(t.canvas){const{id:i,dom:a}=Object(S.parseDOMParams)(t.canvas);if(this.webrtcConfig.webrtcflag)this.wmscManager&&(this.wmscManager.vbSettingVideoDom=a);else if(!S.default.isSupportOffscreenCanvas()||S.default.browser.isSafari&&!S.default.isSafariVersionHigherThan("17.4"))e.isCurrentInNoVBPreviewStatus=!0,e.videoNoVBPreviewCanvas=a;else{if(e.VideoVBSettingCanvas=a,!e.VideoVBSettingCanvas||e.VideoVBSettingCanvas.width<=0||e.VideoVBSettingCanvas.height<=0)return T.default.add_monitor("VBCAF"),void I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,3);try{ei(e.VideoVBSettingCanvas.transferControlToOffscreen(),"VBOfflineCanvas",i)}catch(e){ei(null,"VBOfflineCanvas",i)}}}if(e.isSupportVideoFrameOrBitmapCapture||(e.createVideoElement(),e.videoCaptureHiddenCanvas||(e.videoCaptureHiddenCanvas=S.default.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),e.videoCaptureHiddenCanvasCtx=e.videoCaptureHiddenCanvas.getContext("2d"))),Vl.shouldCaptureVideo()){if(!$t()&&!this.webrtcConfig.webrtcflag)return kl.warn("not isVideoEncodeHandleReady so return"),void T.default.add_monitor("not isVideoEncodeHandleReady so return");e.videoCaptureValue?e.videoCaptureValue=Object.assign(e.videoCaptureValue,t):e.videoCaptureValue=t,e.videoCaptureValue.ssid&&(I.default.localSsrc=e.videoCaptureValue.ssid),e.StartVideoMediaCapture()}else e.MaskSettingVideo&&Vl.playVideoStream(e.MaskSettingVideo)}break;case n.UPDATE_VIDEO_VB_BG_IMAGE:if(T.default.add_monitor(t.bgdom?"VBON":"VBOFF"),t.bgdom)if(this.VBMFlag||(this.VBMFlag=!0,T.default.send_monitor_directly(o.VB_CONSTANT)),"blur"==t.bgdom)this.webrtcConfig.webrtcflag?Vl.changeVBImage("blur"):mt({command:"vbbgimagebitmap",data:t.bgdom});else{let e=Object(S.parseDOMParams)(t.bgdom).dom;if(!e||!e.width||!e.height)return T.default.add_monitor("VBGF"),void I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,2);this.BgImage=e,createImageBitmap(e).then(e=>{this.webrtcConfig.webrtcflag?Vl.changeVBImage(e):si(e,"BgImage")}).catch(e=>{T.default.add_monitor("VBCF"),I.default.Notify_APPUI(n.VIDEO_VB_SETTING_PARA_ERROR,2)})}else this.BgImage=null,this.webrtcConfig.webrtcflag?Vl.isVBEnabled&&Vl.disableVB():si(null,"BgImage");break;case n.STOP_VIDEO_VB_SETTING:if((!S.default.isSupportOffscreenCanvas()||S.default.browser.isSafari&&!S.default.isSafariVersionHigherThan("17.4"))&&(this.isCurrentInNoVBPreviewStatus=!1,this.videoNoVBPreviewCanvas&&(this.videoNoVBPreviewCanvasctx&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx=null),this.videoNoVBPreviewCanvas=null),this.isVideoNoVBPreviewCanvasScaled=!1),this.isVBSettingOn=!1,t.isSwitch&&(this.isMaskSettingOn=!0,this.webrtcConfig.webrtcflag||mt({command:"StartMaskSetting",isSwitch:t.isSwitch,enabled:this.isSupportVideoFrameOrBitmapCapture})),this.webrtcConfig.webrtcflag){if(this.wmscManager){const{isConnected:e}=this.wmscManager.vbSettingVideoDom||{};e&&(this.wmscManager.vbSettingVideoDom.srcObject=null),this.wmscManager.vbSettingVideoDom=null}}else mt({command:"finishVBSetting"});this.isStartVideoCapture||this.isMaskSettingOn||this.Stop_Video_Capture(),this.MaskSettingVideo&&this.MaskSettingVideo.pause();break;case n.ADD_VIDEO_VB_SETTING_DOM:{const{id:e,canvas:i,videodom:a}=t;this.vbSettingDomMap[e]={canvas:i,videodom:a}}break;case n.REMOVE_VIDEO_VB_SETTING_DOM:{const{id:e,canvas:i,videodom:a}=t;delete this.vbSettingDomMap[e]}break;case n.VIDEO_MASK_SETTING:{if(this.webrtcConfig.webrtcflag)return;if(this.isMaskSettingStarted)return;this.isMaskSettingStarted=!0;let e=this,i=0,a=0;e.isCurrentInMaskStatus=!0,e.isMaskSettingOn=!0,i=t.width?t.width:640,a=t.height?t.height:360,e.ReadyCapureWidth=i,e.ReadyCapureHeight=a,e.videoCaptureWidth?e.videoCaptureWidth=e.videoCaptureWidth:e.videoCaptureWidth=i,e.videoCaptureHeight?e.videoCaptureHeight=e.videoCaptureHeight:e.videoCaptureHeight=a;let r=0,o=0;if(t.canvas){const{dom:i,id:a}=Object(S.parseDOMParams)(t.canvas);if(e.VideoMaskSettingCanvas=i,e.PrevVideoMaskSettingCanvas=e.VideoMaskSettingCanvas,e.replaceCanvasMap.videoMaskSettingCanvasId=a,!e.VideoMaskSettingCanvas||e.VideoMaskSettingCanvas.width<=0||e.VideoMaskSettingCanvas.height<=0)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,3);r=t.originWidth||e.VideoMaskSettingCanvas.width,o=t.originHeight||e.VideoMaskSettingCanvas.height}if(t.maskdom){let i=Object(S.parseDOMParams)(t.maskdom).dom;if(!i||!i.width||!i.height)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,1);let a=1;0==r||0==o||r==e.VideoMaskSettingCanvas.width&&o==e.VideoMaskSettingCanvas.height||(a=Math.min(1*e.VideoMaskSettingCanvas.width/r,1*e.VideoMaskSettingCanvas.height/o)),e.MaskImage=i,e.maskCoordinate.dx=t.dx?Math.round(t.dx*a):e.maskCoordinate.dx,e.maskCoordinate.dy=t.dy?Math.round(t.dy*a):e.maskCoordinate.dy,e.maskCoordinate.dWidth=t.dWidth?Math.round(t.dWidth*a):e.maskCoordinate.dWidth,e.maskCoordinate.dHeight=t.dHeight?Math.round(t.dHeight*a):e.maskCoordinate.dHeight,e.isSupportVideoFrameOrBitmapCapture&&createImageBitmap(i).then((function(t){di(t,"MaskImage",e.maskCoordinate,e.videoCaptureWidth,e.videoCaptureHeight)})).catch(e=>{I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,1)})}if(t.bgdom){let i=Object(S.parseDOMParams)(t.bgdom).dom;if(!i||!i.naturalWidth||!i.naturalHeight)return T.default.add_monitor("VMGF"),void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,2);e.BgImage=i,e.isSupportVideoFrameOrBitmapCapture&&createImageBitmap(i).then((function(e){oi(e,"BgImage")})).catch(e=>{T.default.add_monitor("VMCF"),I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,2)})}if(e.isSupportVideoFrameOrBitmapCapture||e.createVideoElement(),this.VideoMaskCanvasFillMode=t.fillMode?1:0,mt({command:"StartMaskSetting",fillMode:this.VideoMaskCanvasFillMode,enabled:this.isSupportVideoFrameOrBitmapCapture}),Vl.shouldCaptureVideo()){if(e.videoCaptureHiddenCanvas||e.isSupportVideoFrameOrBitmapCapture||(e.videoCaptureHiddenCanvas=S.default.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),e.videoCaptureHiddenCanvasCtx=e.videoCaptureHiddenCanvas.getContext("2d")),!$t())return kl.warn("not isVideoEncodeHandleReady so return"),void T.default.add_monitor("not isVideoEncodeHandleReady so return");e.videoCaptureValue?e.videoCaptureValue=Object.assign(e.videoCaptureValue,t):e.videoCaptureValue=t,e.videoCaptureValue.ssid&&(I.default.localSsrc=e.videoCaptureValue.ssid),e.StartVideoMediaCapture()}else e.MaskSettingVideo&&Vl.playVideoStream(e.MaskSettingVideo),e.isMaskSettingOn&&I.default.Notify_APPUI(n.START_VIDEO_STREAM_IN_MASK_SETTING_SUCCESS,null);if(e.isSupportVideoFrameOrBitmapCapture||S.default.isSupportVideoFrameOrBitmapCapture()&&S.default.isSelfPreviewRenderWithVideo())try{ei(e.VideoMaskSettingCanvas.transferControlToOffscreen(),"MaskOfflineCanvas",e.replaceCanvasMap.videoMaskSettingCanvasId)}catch(t){ei(null,"MaskOfflineCanvas",e.replaceCanvasMap.videoMaskSettingCanvasId)}else e.Update_Mask_Texture(e.maskCoordinate,e.videoCaptureWidth,e.videoCaptureHeight)}break;case n.UPDATE_MASK_CANVAS_SIZE:{if(this.webrtcConfig.webrtcflag)return;const{id:e,dom:i}=Object(S.parseDOMParams)(t.canvas);if(this.isSupportImageCapture||S.default.isSupportImageCapture()&&S.default.isSelfPreviewRenderWithVideo()){var d=I.default.SPECIAL_ID;if(I.default.localVideoEncMGR)if(p=I.default.localVideoEncMGR.map.get(d)){var u={command:"update_mask_canvas_size",rendercanvasID:e,width:t.width,height:t.height};p.postMessage(u)}}else t.canvas=i,t.canvas&&(t.canvas.width=t.width,t.canvas.height=t.height);break}case n.UPDATE_BG_IMAGE:if(this.webrtcConfig.webrtcflag)return;if(this.isSupportVideoFrameOrBitmapCapture)if(t.bgdom){let e=Object(S.parseDOMParams)(t.bgdom).dom;if(!e||!e.width||!e.height)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,2);this.BgImage=e,createImageBitmap(e).then((function(e){oi(e,"BgImage")})).catch(e=>{I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,2)})}else this.BgImage=null,oi(null,"BgImage");else{if(t.bgdom){let e=Object(S.parseDOMParams)(t.bgdom).dom;if(!e||!e.width||!e.height)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,2);this.BgImage=e}else this.BgImage=null;this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureWidth,this.videoCaptureHeight)}break;case n.UPDATE_MASK_INFO:if(this.webrtcConfig.webrtcflag)return;if(this.maskCoordinate.dx=t.dx,this.maskCoordinate.dy=t.dy,this.maskCoordinate.dWidth=t.dWidth,this.maskCoordinate.dHeight=t.dHeight,this.isSupportVideoFrameOrBitmapCapture)if(t.maskdom){let e=Object(S.parseDOMParams)(t.maskdom).dom;if(!e||!e.width||!e.height)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,1);this.MaskImage=e;let i=this.maskCoordinate,a=this.videoCaptureWidth,r=this.videoCaptureHeight;createImageBitmap(e).then((function(e){di(e,"MaskImage",i,a,r)})).catch(e=>{I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,1)})}else{this.MaskImage=null,di(null,"MaskImage",this.maskCoordinate,this.videoCaptureWidth,this.videoCaptureHeight)}else{if(t.maskdom){let e=Object(S.parseDOMParams)(t.maskdom).dom;if(!e||!e.width||!e.height)return void I.default.Notify_APPUI(n.MASK_SETTING_PARA_ERROR,1);this.MaskImage=e}else this.MaskImage=null;this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureWidth,this.videoCaptureHeight)}break;case n.FINISH_MASK_SETTING:if(this.webrtcConfig.webrtcflag)return;this.isMaskSettingStarted=!1,this.isMaskSettingOn=!1,this.BgImage||(this.isCurrentInMaskStatus=!1),t.isSwitch&&(this.isVBSettingOn=!0,mt({command:"StartVBSetting",isSwitch:t.isSwitch})),this.MaskSettingVideo&&this.MaskSettingVideo.pause(),this.VideoMaskSettingCanvas&&(this.VideoMaskSettingCanvasctx&&(this.VideoMaskSettingCanvasctx.setTransform(1,0,0,1,0,0),this.VideoMaskSettingCanvasctx.clearRect(0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx=null),this.VideoMaskSettingCanvas=null),this.isCanvasScaled=!1,mt({command:"finishMaskSetting"}),this.isStartVideoCapture||this.isVBSettingOn||this.Stop_Video_Capture();break;case n.MIRROR_MY_VIDEO:this.isMirrorMyVideo=t.isMirrorMyVideo,this.webrtcConfig.webrtcflag?this.wmscManager&&this.wmscManager.mirrorSelfVideo(this.isMirrorMyVideo):(mt({command:"mirrorMyVideo",isMirrorMyVideo:this.isMirrorMyVideo}),this.isSupportOffscreenCanvas?(this.VideoRenderObj&&this.VideoRenderObj.setMirrorMyVideoOption(this.isMirrorMyVideo),St({command:"mirrorMyVideo",isMirrorMyVideo:this.isMirrorMyVideo,isSupportOffscreenCanvas:this.isSupportOffscreenCanvas})):(this.VideoRenderObj||(this.VideoRenderObj=new Gi(Object.assign({},{Notify_APPUI:I.default.Notify_APPUI.bind(I.default),isSupportOffscreenCanvas:!1,jsMediaEngine:r,globalTracingLogger:C.default,monitorLoggerFn:T.default.add_monitor,...I.default.enableMultiDecodeVideoWithoutSAB?{videodecodethreadnumb:o.MAX_RENDER_WITHOUT_SAB}:{},renderManager:this.renderManager})),this.activeSpeakerSsrc&&this.VideoRenderObj.setActiveSpeakerSsrc(this.activeSpeakerSsrc)),this.VideoRenderObj.setMirrorMyVideoOption(this.isMirrorMyVideo)));break;case n.NEW_ACTIVE_SPEAKER_SSRC:if(this.webrtcConfig.webrtcflag){var l;null===(l=this.wmscManager)||void 0===l||l.onActiveSpeakerChange(t.ssrc)}else{var c;if(T.default.add_monitor("ACTIVESSRC:".concat(t.ssrc)),Zt(R.f.VIDEO_DECODE,{ssrc:t.ssrc},"newActiveSpeakerSsrc",!1,!0),this.RenderInMain==o.RENDER_IN_MAIN)null===(c=this.VideoRenderObj)||void 0===c||c.setActiveSpeakerSsrc(t.ssrc);this.activeSpeakerSsrc=t.ssrc}break;case n.CANCEL_NEW_ACTIVE_SPEAKER_BEFORE_CALL_BACK:T.default.add_monitor("CANCELACTIVE:".concat(t.ssrc)),St({command:"cancelNewActiveSpeakerSsrcBefreCallback",ssrc:t.ssrc,haddata:t.haddata}),this.activeSpeakerSsrc=0;break;case n.SEND_RENDER_LOG:T.default.add_monitor(t.message);break;case n.UPDATE_VIDEO_QUALITY:if(!I.default.rwgAgent)break;this.userId!=t.userId&&I.default.sendMessageToRwg(n.SUBSCRIBE_VIDEO,{evt:12303,seq:1,body:{subInfoList:[{id:Number(t.userId),size:Number(t.videoQuality),bOn:!1}]}});break;case n.ADD_RENDER_VIDEO:if(T.default.add_monitor("ADDRENDER:".concat(t.userId)),this.webrtcConfig.webrtcflag){var h;const e=parseInt(t.userId),i=null===(h=this.wmscManager)||void 0===h?void 0:h.isSelfVideo(e);if(1===e&&this.wmscManager&&(this.wmscManager.activeSpeakerVideoDom=t.videodom),this.videoCaptureValue&&i)return Vl.isVBEnabled?t.videodom.srcObject=Vl.vbStream:t.videodom.srcObject=Vl.videoStream,this.wmscManager?(this.wmscManager.selfVideoDomMap.set(t.zone,t.videodom),this.wmscManager.mirrorVideoEle(t.videodom,this.wmscManager.isMirror),this.wmscManager.playSelfVideo("addRenderVideo",t.videodom)):(C.default.error("WMSC_Self_Add_Render, ".concat(t.userId)),t.videodom.play().catch(()=>{C.default.error("WMSC_SV_ARP_F: ".concat(t.userId))})),void(this.webrtcConfig.userId=parseInt(t.userId));await this.add_render_video_webrtc(t)}else await this.add_render_video_wasm(t);break;case n.UPDATE_CANVAS_SIZE:{const{id:e,dom:i}=Object(S.parseDOMParams)(t.canvas);if(Object(S.CheckCanvasSize)(t.width,t.height),this.checkIsRenderInWorker()){d=I.default.SPECIAL_ID;var f=null;if(I.default.localVideoEncMGR&&I.default.enableVirtualBackgroundWithoutSAB&&(f=I.default.localVideoEncMGR.map.get(d)),I.default.localVideoDecMGR)if(p=I.default.localVideoDecMGR.map.get(d)){u={command:"update_canvas_size",rendercanvasID:e,width:t.width,height:t.height};p.postMessage(u),f&&f.postMessage(u)}}else t.canvas=i,t.canvas&&(t.canvas.width=t.width,t.canvas.height=t.height);this.UpdateVideoPlayStatus(!0)}break;case n.ZOOM_RENDER:if(T.default.add_monitor("ZOOMRENDER:".concat(t.userId)),"string"!=typeof t.canvas&&(t.canvas=t.canvas.id),this.checkIsRenderInWorker()){const e=S.apiSupportUtility.getIsRenderSelfVideoInEncodeWorker(I.default.localSsrc&&Object(S.Get_Logical_SSrc)(t.userId)===Object(S.Get_Logical_SSrc)(I.default.localSsrc));let i=I.default.SPECIAL_ID;var p=null;if(e&&I.default.localVideoEncMGR?p=I.default.localVideoEncMGR.map.get(i):I.default.localVideoDecMGR&&(p=I.default.localVideoDecMGR.map.get(i)),p){u={command:"zoomrender",ssrc:t.userId,x:t.x,y:t.y,width:t.width,height:t.height,canvas:t.canvas,zone:t.zone,RGBA:t.RGBA};p.postMessage(u)}}if(this.videoRenderArray.length)for(i=0;i{try{if(Vl.isCaptureVideoInProgress)return I.default.Notify_APPUI(n.STOP_VIDEO_CAPTURE_FAILED,null),t(new Error("Too many calls : the device is opening camera now, cannot stop video capture"));v.isStartVideoCapture&&v.Stop_Video_Capture(),I.default.Notify_APPUI(n.STOP_VIDEO_CAPTURE_SUCCESS,null),e(!0)}catch(e){I.default.Notify_APPUI(n.STOP_VIDEO_CAPTURE_FAILED,null),t(e)}I.default.extVBPort&&I.default.extVBPort.postMessage({type:n.UNIFIED_VB_PAUSE})});case n.ADD_RENDER_AUDIO:0==this.audioRenderArray.length&&(this.audioRenderArray.push(t),this.Start_Audio_Play());break;case n.STOP_RENDER_AUDIO:if(this.audioRenderArray.length>0)for(this.Stop_Audio_Play(),i=0;i{let{AnnotationMgr:t}=e;this.annotationModule=t}).catch(e=>{kl.error("Failed to load AnnotationMgr",e)}),this.sharingCanvasList.includes(t.canvas.id)||this.sharingCanvasList.push(t.canvas.id),this.mainSharingCanvas=t.canvas,this.annoCanvas=t.annoCanvas,null===(y=this.annotationMgr)||void 0===y||y.updateCanvas({sharingMainCanvas:this.mainSharingCanvas,annoCanvas:this.annoCanvas}),Object.assign(t,this.sharingWaterMarkParams),this.isSupportVideoShare?At({command:"startSharingRender"}):Tt({command:"startSharingRender"}),this.currentshareactive=t.ssrc,null==this.currentshareactive&&T.default.add_monitor2("SSRC"),this.isCreateSharingWaterMark=t.enableWaterMark,this.sharingWaterMarkName=this.isCreateSharingWaterMark?t.waterMarkText:"",this.isSupportOffscreenCanvas){this.RenderInMain===o.RENDER_UNSET&&(this.RenderInMain=o.RENDER_IN_WORKER);try{d=I.default.SPECIAL_ID;this.replaceCanvasMap.sharingMainCanvasId=t.canvas.id;p=null;if(this.isSupportVideoShare?I.default.localVideoDecMGR&&(p=I.default.localVideoDecMGR.map.get(d)):I.default.localSharingDecMGR&&(p=I.default.localSharingDecMGR.map.get(d)),p){this.sharingRenderCanvas=t.canvas.transferControlToOffscreen(),Object(S.CheckCanvasSize)(t.canvas.width,t.canvas.height);u={command:"sharingRenderCanvas",canvas:this.sharingRenderCanvas,rendercanvasID:this.replaceCanvasMap.sharingMainCanvasId,ssrc:this.currentshareactive,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,isFromMainSession:t.isFromMainSession,watermarkPosition:t.watermarkPosition};p.postMessage(u,[u.canvas])}}catch(e){d=I.default.SPECIAL_ID,p=null;if(this.isSupportVideoShare?I.default.localVideoDecMGR&&(p=I.default.localVideoDecMGR.map.get(d)):I.default.localSharingDecMGR&&(p=I.default.localSharingDecMGR.map.get(d)),p){u={command:"sharingRenderCanvas",rendercanvasID:this.replaceCanvasMap.sharingMainCanvasId,ssrc:this.currentshareactive,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,isFromMainSession:t.isFromMainSession,watermarkPosition:t.watermarkPosition};p.postMessage(u)}}}else this.RenderInMain===o.RENDER_UNSET&&(this.RenderInMain=o.RENDER_IN_MAIN),this.SharingRenderObj||(this.SharingRenderObj=new Ki(Object.assign({},{Notify_APPUI:I.default.Notify_APPUI.bind(I.default),PubSub:A.a,jsMediaEngine:r,globalTracingLogger:C.default,renderManager:this.renderManager}))),this.renderManager.getRendererProvider().isWebGLRendererType()?this.sharingDisplay=new ji.default(t.canvas,t.canvas.id,0,void 0,{preserveDrawingBuffer:!1},void 0,void 0,I.default.enableCanvasAlphaChannel):this.renderManager.getRendererProvider().isWebGL2RendererType()&&(this.sharingDisplay=new $i(t.canvas,t.canvas.id,0,void 0,{preserveDrawingBuffer:!1},void 0,void 0,I.default.enableCanvasAlphaChannel)),this.SharingRenderObj.Set_Render_Display(this.sharingDisplay),this.SharingRenderObj.Change_Current_SSRC(this.currentshareactive,t.isFromMainSession),this.isCreateSharingWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}),this.sharingInterval||(this.sharingInterval=this.JsMediaSDK_SharingRenderInterval(this.sharingIntervalTime,t.isVideoShare)),me(!0);break;case n.STOP_SHARING:if(t.canvas){const e=this.sharingCanvasList.indexOf(t.canvas.id);-1!==e&&this.sharingCanvasList.splice(e,1)}else this.sharingCanvasList=[];if(this.mainSharingCanvas=null,this.annoCanvas=null,0!==this.sharingCanvasList.length)return;me(!1),this.isSupportVideoShare?At({command:"stopSharingRender"}):Tt({command:"stopSharingRender"}),this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.sharingInterval&&(clearInterval(this.sharingInterval),this.sharingInterval=0),this.sharingDisplay&&(this.sharingDisplay.clear(),this.sharingDisplay.cleanup(),this.sharingDisplay=null),this.SharingRenderObj&&(this.SharingRenderObj.ClearQueue(),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName}));break;case n.UPDATE_SHARING_DECODE_PARAM:{var M;let{width:e,height:i,canvas:a}=t;if(a&&a.id&&!this.sharingCanvasList.includes(a.id))return;if(kl("UPDATE_SHARING_DECODE_PARAM",t),this.SharingRenderObj?this.SharingRenderObj.Update_Sharing_Canvas_Size({width:e,height:i}):this.isSupportVideoShare?At({command:"UPDATE_SHARING_CANVAS_SIZE",width:e,height:i}):Tt({command:"UPDATE_SHARING_CANVAS_SIZE",width:e,height:i}),li())return Object(S.CheckCanvasSize)(e,i),kl("isSharingNotClearChromeVersion",li());if(null===(M=this.annotationMgr)||void 0===M||M.updateAnnoCanvasSize(),!I.default.rwgAgent)break;this.isSupportVideoShare?At({command:"SET_OFFSCREENCANVAS_WIDTH_HEIGHT",data:{width:e,height:i}}):await Zt(R.f.SHARING_DECODE,{width:e,height:i},"SET_OFFSCREENCANVAS_WIDTH_HEIGHT",!1,!0);break}case n.CHANGE_FRAME_RATE:case n.CHANGE_VIDEO_RESOLUTION:break;case n.CHANGE_AUDIO_SPEAKER:{if(!t.AudioSelectValue)return void I.default.Notify_APPUI(n.AUDIO_SPEAKER_SET_ERROR,"value.AudioSelectValue is null");let e=Date.now();var P;if(this.useAudioBridge)return void(null===(P=this.audioBridge)||void 0===P||P.changeSpeaker(t.AudioSelectValue));this.selectComputerAudioSpeaker(t.AudioSelectValue,e)}break;case n.AUDIO_DENOISE_SWITCH:ma.changeDenoiseSwitch(t.switch);break;case n.CHANGE_AUDIO_PROFILE:{var N;let e=null===(N=this.audioCapture)||void 0===N?void 0:N.audioProfile;if(!e)break;if(this.audioCapture.audioProfile=t,"backgroundNoiseSuppression"===t.currentSelect){if("backgroundNoiseSuppression"!==e.currentSelect){let e={command:"original_sound_switch",enable:!1,highfidelity:!1,stereo:!1};var V;if(this.useAudioBridge)await(null===(V=this.audioBridge)||void 0===V?void 0:V.setAudioProfile(t));else It(e);Vl.destoryAudioMediaStream(),this.Start_Audio_Capture()}var k;if(e.highBitrate!==t.highBitrate)if(this.useAudioBridge)await(null===(k=this.audioBridge)||void 0===k?void 0:k.setAudioProfile(t));else It({command:"highBitrate",highBitrate:t.highBitrate?1:0});let i="Zoom"===t.backgroundNoiseSuppression;ma.changeDenoiseSwitch(i)}else{var U;let i={command:"original_sound_switch",enable:!0,highfidelity:t.originalSound.highfidelity,stereo:t.originalSound.stereo};var L;if(this.useAudioBridge)await(null===(L=this.audioBridge)||void 0===L?void 0:L.setAudioProfile(t));else It(i);"originalSound"===e.currentSelect&&(null===(U=e.originalSound)||void 0===U?void 0:U.stereo)===t.originalSound.stereo||(Vl.destoryAudioMediaStream(),this.Start_Audio_Capture())}}break;case n.CHANGE_VIDEO_CAPTURE_DEVICE:{var x;let e=Object.assign({},this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO,t);if(!this.isSupportVideoTrackReader&&!this.isSupportMediaStreamTrackProcessor){if(e.canvasCtrlList=[],e.canvas instanceof Array)for(i=0;ikl.error(e));break;case n.CHANGE_AUDIO_MIC:if(this.audioCapture&&t){this.enableHID&&(this.hidAvalible&&(await wa.destroy(),this.hidAvalible=!1),t.microphoneLabel&&(this.hidAvalible=await wa.init(t.microphoneLabel,t.defaultMuted))),Vl.destoryAudioMediaStream(),It({command:132,value:!1});try{this.isCaputureNodeConnect=!1,I.default.ComputerAudioStatus=R.a.ComputerAudio_Connecting,t.audioProfile=this.audioCapture.audioProfile,this.audioCapture=t,this.audioCtx&&this.audioCtx.sampleRate!=this.sampleRate&&(this.sampleRate=this.audioCtx.sampleRate,st(this.sampleRate)),this.Start_Audio_Capture(),Pt()}catch(e){I.default.Notify_APPUI(n.AUDIO_MIC_SET_ERROR,e),this.JsMediaSDK_Log(e)}}else I.default.Notify_APPUI(n.AUDIO_MIC_SET_ERROR,"value is null or not join computer audio before change audio mic");return;case n.WEBRTC_RESTART:t&&(dt(I.default.SPECIAL_ID,n.AUDIO_START),Vl.destoryAudioMediaStream(),this.Remove_Audio_Capture(),this.audioCapture=t,this.Start_Audio_Capture(),Pt());break;case n.LEAVE_COMPUTER_AUDIO:if(Vl.destoryAudioMediaStream(),document.removeEventListener("visibilitychange",Ul),this.setFileAudioPlaybackSwitch(!1),It({command:132,value:!1}),this.audioCapture=null,this.captureAudioMuted=!1,this.hidAvalible&&(await wa.destroy(),this.hidAvalible=!1),I.default.ComputerAudioStatus=R.a.ComputerAudio_Null,this.audioInputLevel)return this.audioInputLevel.destroy(),this.audioInputLevel=null,void I.default.Notify_APPUI(n.LEAVE_COMPUTER_AUDIO_COMPLETE,null);if(this.useAudioBridge)return this.audioBridge&&(this.audioBridge.isMutedBySystem=!1,this.audioBridge.enableBroadCastToBO(!1),this.audioBridge.leaveAudioWithoutDisconnect(o.WEBRTC_COMMPUTER_AUDIO_MODE)),void I.default.Notify_APPUI(n.LEAVE_COMPUTER_AUDIO_COMPLETE,null);if(I.default.ComputerAudioStatus===R.a.ComputerAudio_Connecting)return void I.default.Notify_APPUI(n.LEAVE_COMPUTER_AUDIO_COMPLETE,null);this.Remove_Audio_Capture(),this.Remove_Audio_Play(),this.CloseBoringPeerConnection(),this.checkWorkletInterval&&(clearInterval(this.checkWorkletInterval),this.checkWorkletInterval=null);try{I.default.AudioNode&&(I.default.AudioNode.disconnect(),I.default.AudioNode.postCMD("stopWorklet",!0),I.default.AudioNode.port=null)}catch(e){kl("AudioNode.port",e)}I.default.AudioNode=null,I.default.workletWasmInitSuccess=!1,this.audioCtx&&(this.audioCtx.onstatechange=null,this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx.close(),this.isCaputureNodeConnect=!1),this.audioCtx=null,this.audioPlay=!1,this.audioDomNode=null,I.default.Notify_APPUI(n.LEAVE_COMPUTER_AUDIO_COMPLETE,null);break;case n.JOIN_COMPUTER_AUDIO:if(T.default.add_monitor("JCAA:"+t.checkAutoplay),this.enableHID=t.CaptureAudioInfo.enableHID,this.enableHID&&t.CaptureAudioInfo.microphoneLabel)try{this.hidAvalible=await wa.init(t.CaptureAudioInfo.microphoneLabel,t.CaptureAudioInfo.defaultMuted)}catch(e){C.default.log("auto connect hid fail"),I.default.Notify_APPUI(n.AUDIO_CONNECT_HID_JOIN_FAILED,e)}I.default.ComputerAudioStatus=R.a.ComputerAudio_Connecting;try{t.checkAutoplay&&await S.default.checkAudioAutoPlay()}catch(e){return kl.error("audio auto play",e),C.default.error("check auto play fail",e),I.default.ComputerAudioStatus=R.a.ComputerAudio_Null,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null),I.default.Notify_APPUI(n.AUDIO_AUTO_PLAY_FAILED,e)}if(this.audioInputLevel&&(this.audioInputLevel.destroy(),this.audioInputLevel=null),t.isPreviewMode)return void(t.CaptureAudio?(this.audioCapture=t.CaptureAudioInfo,this.audioInputLevel=new ea({analyserCallback:e=>{I.default.Notify_APPUI_SAFE(n.AUDIO_LEVEL_INDICATOR,{value:e})}}),Vl.shouldCaptureAudio()||I.default.Notify_APPUI(n.USER_GRANT_CAPTURE_AUDIO,null),this.Start_Audio_Capture()):(I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null)));if(!this.isSupportVideoShare&&this.isSupportOffscreenCanvas){var W=new MessageChannel;ht(W,W)}if(this.useAudioBridge=!!t.audioBridge,this.useAudioBridge){ma.setUserId(t.CaptureAudioInfo.ssrc);const{nginxHost:e,rwgHost:i,cid:a,abToken:r,supportLocalAB:s,useWebRTCOnDesktop:d}=t.audioBridge;if(await this.previewInit({audioBridge:{nginxHost:e,rwgHost:i,cid:a,abToken:r,isCapturingAudio:t.CaptureAudio,audioMode:o.WEBRTC_COMMPUTER_AUDIO_MODE,supportLocalAB:s,useWebRTCOnDesktop:d}}),!this.audioBridge){C.default.error("audioBridge instance is null after initialization");break}var B;if(ma.setAudioBridge(this.audioBridge),t.CaptureAudio)this.audioCapture=t.CaptureAudioInfo,null!==(B=t.CaptureAudioInfo)&&void 0!==B&&B.audioProfile&&this.audioBridge.setAudioProfile(t.CaptureAudioInfo.audioProfile),this.Start_Audio_Capture();else I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null);if(S.default.isAndroidBrowser()||S.default.isQuestBrowser()||!S.default.browser.isChrome&&!S.default.isFirefoxVersionHigherThan(116))ma.updateSelectedSpeakerDevices("default",0,!0);else{var G,F;let e=null!==(G=t.speakerInfo)&&void 0!==G&&G.defaultDeviceId?null===(F=t.speakerInfo)||void 0===F?void 0:F.defaultDeviceId:"";this.selectComputerAudioSpeaker(e,Date.now())}return}try{this.Remove_Audio_Play(),this.Remove_Audio_Capture(),this.CloseBoringPeerConnection(),dt(I.default.SPECIAL_ID,n.AUDIO_START),this.audioCtx&&(this.audioCtx.close(),this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx=null,this.isCaputureNodeConnect=!1),this.audioCtx=Object(S.createMainAudioContext)(),S.default.isChromeVersionHigherThan(129)&&!this.audioCtx.onerror&&(this.audioCtx.onerror=()=>{T.default.add_monitor("AUDIOCONTEXT:ERROR")}),this.audioCtx.sampleRate!=this.sampleRate&&(this.sampleRate=this.audioCtx.sampleRate,st(this.sampleRate)),this.disableAudioAGC=t.disableAudioAGC,this.disableNoiseSuppression=t.disableNoiseSuppression,this.disableBrowserAec=t.disableBrowserAec,this.bAudioDecodeUsingSAB&&T.default.add_monitor("ASSAB"),"suspended"===this.audioCtx.state&&this.audioCtx.resume().catch(e=>{C.default.error("audioContext resume fail",e)});v=this;let e=null,i=null;if(I.default.decoderinworklet){await S.default.isSDKSupportSIMD()?(e=this.audioWorkletJsPath.audioWorkletSIMDPath,i=this.audioWorkletJsPath.audioSIMDWasm):(e=this.audioWorkletJsPath.audioWorkletProcessPath,i=this.audioWorkletJsPath.audioWasm)}else e=this.audioWorkletJsPath.audioWorkletPath;if(this.isDestroy)return;let a=null;i&&(a=await S.default.downloadAndCompileWebAssembly(i,"AudioWorklet",T.default,!S.default.browser.isSafari&&I.default.enableStreamingInstantiate)),await this.audioCtx.audioWorklet.addModule(e),I.default.AudioNode=new Ei(v.audioCtx,"zoomAudioWorklet",{processorOptions:{sharedBuffer:S.default.browser.isSafari&&I.default.sharedBuffer?I.default.sharedBuffer:null,userAgent:navigator.userAgent,audioDecodeChannelsNum:S.default.isSupportPlayStereo()?2:1,audioEncodeChannelsNum:S.default.isBrowserSupportStereo()?2:1,wasmModule:a},numberOfOutputs:1,outputChannelCount:[2]}),I.default.AudioNode.onprocessorerror=e=>{T.default.add_monitor("CWFIP"),C.default.error("Exception thrown in AudioWorkletProcessor",e)},S.default.browser.isSafari&&!I.default.sharedBuffer&&I.default.AudioNode.postCMD("diableSharedArrayBuffer"),I.default.decoderinworklet||I.default.AudioNode.postCMD("disableDecoderinworklet"),I.default.decoderinworklet&&(this.codecDoAVSync?I.default.AudioNode.postCMD("codecDoAVSync",!0):I.default.CurrentSSRC&&I.default.AudioNode.postCMD("currentSSRC",I.default.CurrentSSRC),I.default.AudioNode.postCMD("initData",{userid:t.CaptureAudioInfo.ssrc,meetingnumb:I.default.localAudioPara.meetingnumb,meetingid:I.default.localAudioPara.meetingid}),I.default.AudioNode.postCMD("audiowasm")),v.checkWorkletInterval&&(clearInterval(v.checkWorkletInterval),v.checkWorkletInterval=null),v.checkWorkletInterval=setInterval(()=>{I.default.AudioNode&&I.default.AudioNode.postCMD("checkProcess",null)},1e4);let r=S.default.isSupportChromeWideAEC()&&!I.default.shareSystemAudio;if(!S.default.browser.isChrome||S.default.isAndroidBrowser()||S.default.isQuestBrowser())if(I.default.sharedBuffer&&I.default.AudioNode.postCMD("sharedBuffer",S.default.browser.isSafari?null:I.default.sharedBuffer),S.default.isAndroidBrowser()||S.default.isQuestBrowser()){let e=v.audioCtx.createMediaStreamDestination();I.default.AudioNode.connect(e),this.disableBrowserAec?this.isSupportBrowserAec=!1:this.isSupportBrowserAec=await this.isLocalP2PSupportedPromise;let t=e.stream;this.disableBrowserAec||(this.isSupportBrowserAec?t=await v.chromeAecWorkAround(e.stream):ut(I.default.SPECIAL_ID,!1)),v.audioDomNode||(v.audioDomNode=new Audio),v.audioDomNode.srcObject=t,v.audioDomNode.play().catch(e=>{C.default.error("Audio play failed",e)})}else if(S.default.browser.isFirefox&&S.default.isFirefoxVersionHigherThan(116)){let e=v.audioCtx.createMediaStreamDestination();I.default.AudioNode.connect(e);let i=e.stream;v.audioDomNode||(v.audioDomNode=new Audio),v.audioDomNode.srcObject=i;let a=null,r=Date.now();a=t.speakerInfo&&t.speakerInfo.defaultDeviceId?t.speakerInfo.defaultDeviceId:"",this.selectComputerAudioSpeaker(a,r),v.audioDomNode.play().catch(e=>{C.default.error("Audio play failed",e)})}else I.default.AudioNode.connect(v.audioCtx.destination),ma.updateSelectedSpeakerDevices("default",0,!0);else{let e;if(this.disableBrowserAec?this.isSupportBrowserAec=!1:this.isSupportBrowserAec=r||await this.isLocalP2PSupportedPromise,I.default.sharedBuffer&&I.default.AudioNode.postCMD("sharedBuffer",I.default.sharedBuffer),!this.disableBrowserAec)if(this.isSupportBrowserAec){if(!r){let t=v.audioCtx.createMediaStreamDestination();I.default.AudioNode.connect(t),e=t.stream,e=await v.chromeAecWorkAround(t.stream)}}else ut(I.default.SPECIAL_ID,!1);let i=null;i=t.speakerInfo&&t.speakerInfo.defaultDeviceId?t.speakerInfo.defaultDeviceId:"";let a=Date.now();r?I.default.AudioNode.connect(v.audioCtx.destination):(v.audioDomNode||(v.audioDomNode=new Audio),v.audioDomNode.srcObject=e,v.audioDomNode.play().catch(e=>{C.default.error("Audio play failed",e)})),v.selectComputerAudioSpeaker(i,a)}bt({command:"stop_audio_incoming",stopPlayAudio:!1}),It({command:"startAudioEncode",ssid:t.CaptureAudioInfo.ssrc,audioMode:I.default.audioMode}),Kt(I.default.e2eencrypt);var H=new MessageChannel,K=new MessageChannel,j=new MessageChannel;if(I.default.AudioNode.port.postMessage({status:"encodeAudioPort"},[K.port2]),I.default.AudioNode.port.postMessage({status:"decodeAudioPort"},[H.port1]),I.default.AudioNode.port.postMessage({status:"sampleRate",data:v.audioCtx.sampleRate}),lt(H,K,"decodeAudioPort","encodeAudioPort"),I.default.enableEchoDetection&&!I.default.sharedBuffer&<(j,j,"audioWorkerPort","audioWorkerPort"),v.Start_Audio_Play(),this.isSupportOffscreenCanvasForVideoDecode){var Y=new MessageChannel;_t(Y),I.default.decoderinworklet?I.default.AudioNode.port.postMessage({status:"decodeVideoPort"},[Y.port2]):ft(Y)}if(t.CaptureAudio){v.audioCapture=t.CaptureAudioInfo;let e=t.CaptureAudioInfo.audioProfile;if(e)if("backgroundNoiseSuppression"===e.currentSelect){let t="Zoom"===e.backgroundNoiseSuppression;ma.changeDenoiseSwitch(t),It({command:"highBitrate",highBitrate:e.highBitrate?1:0})}else{var q,X;let t={command:"original_sound_switch",enable:!0,highfidelity:null===(q=e.originalSound)||void 0===q?void 0:q.highfidelity,stereo:null===(X=e.originalSound)||void 0===X?void 0:X.stereo};var Q;if(this.useAudioBridge)await(null===(Q=this.audioBridge)||void 0===Q?void 0:Q.setAudioProfile(e));else It(t)}v.Start_Audio_Capture(),this.firstSetDelay&&(this.firstSetDelay=!1,Pt())}else I.default.ComputerAudioStatus=R.a.ComputerAudio_Connected,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null)}catch(e){C.default.error("join audio failed",e),I.default.ComputerAudioStatus=R.a.ComputerAudio_Null,I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_COMPLETE,null),I.default.Notify_APPUI(n.JOIN_COMPUTER_AUDIO_FAILURE,null),kl.error(e),this.JsMediaSDK_Log(e)}break;case n.JOIN_DESKTOP_AUDIO:if(I.default.DesktopAudioStatus!==R.a.DesktopAudio_Null)return void I.default.Notify_APPUI(n.JOIN_DESKTOP_AUDIO_COMPLETE,null);if(I.default.DesktopAudioStatus=R.a.DesktopAudio_Connecting,this.useAudioBridge=!!t.audioBridge,this.useAudioBridge){ma.setUserId(t.CaptureAudioInfo.ssrc);const{nginxHost:e,rwgHost:i,cid:a,abToken:r,supportLocalAB:s,useWebRTCOnDesktop:d}=t.audioBridge;return await this.previewInit({audioBridge:{nginxHost:e,rwgHost:i,cid:a,abToken:r,isCapturingAudio:t.CaptureAudio,audioMode:o.WEBRTC_SHARE_AUDIO_MODE,supportLocalAB:s,useWebRTCOnDesktop:d}}),ma.setAudioBridge(this.audioBridge),this.Start_Desktop_Audio_Capture(),I.default.DesktopAudioStatus=R.a.DesktopAudio_Connected,void I.default.Notify_APPUI(n.JOIN_DESKTOP_AUDIO_COMPLETE,null)}if(S.default.isSupportChromeWideAEC()&&I.default.ComputerAudioStatus!=R.a.ComputerAudio_Null&&!this.audioDomNode&&I.default.shareSystemAudio&&await this.isLocalP2PSupportedPromise){I.default.AudioNode.disconnect();let e=this.audioCtx.createMediaStreamDestination();I.default.AudioNode.connect(e);let t=e.stream;t=await this.chromeAecWorkAround(e.stream),this.audioDomNode||(this.audioDomNode=new Audio),this.audioDomNode.srcObject=t;let i=ma.speakerId,a=Date.now();this.selectComputerAudioSpeaker(i,a),this.audioDomNode.play().catch(e=>{C.default.error("Audio play failed",e)})}try{It({command:"mute",bOn:n.AUDIO_START,sharing:!0}),this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.isSharingCaptureNodeConnect=!1);let e=S.default.getAudioContextConfigure();this.sharingAudioCtx=Object(S.createAudioContext)("MainSharing",e);v=this;let i=this.audioWorkletJsPath.sharingAudioWorkletPath;await this.sharingAudioCtx.audioWorklet.addModule(i),I.default.SharingAudioNode=new Ei(v.sharingAudioCtx,"zoomSharingAudioWorklet",{processorOptions:{sharingEncodeChannelsNum:S.default.isSupportSharingStereo()?2:1}}),I.default.sharedBuffer&&I.default.SharingAudioNode.postCMD("sharedBuffer",I.default.sharedBuffer);let a=new MessageChannel;I.default.SharingAudioNode.port.postMessage({status:"encodeAudioPort"},[a.port1]),pt(a),It({command:"startAudioEncode",ssid:t.CaptureAudioInfo.ssrc,samplerate:this.sharingAudioCtx.sampleRate,isSharing:!0,audioMode:I.default.audioMode,sharingEncodeChannelsNum:S.default.isSupportSharingStereo()?2:1}),Kt(I.default.e2eencrypt),v.Start_Desktop_Audio_Capture()}catch(e){kl.error(e),this.JsMediaSDK_Log(e)}I.default.DesktopAudioStatus=R.a.DesktopAudio_Connected,I.default.Notify_APPUI(n.JOIN_DESKTOP_AUDIO_COMPLETE,null);break;case n.LEAVE_DESKTOP_AUDIO:{if(I.default.DesktopAudioStatus!==R.a.DesktopAudio_Connected)return void I.default.Notify_APPUI(n.LEAVE_DESKTOP_AUDIO_COMPLETE,null);let e=!1;if(t&&t.isPause&&(e=!0),e||this.EndDesktopAudioMediaStream(),this.Remove_Sharing_Audio_Capture(),this.useAudioBridge){var z;null===(z=this.audioBridge)||void 0===z||z.leaveAudioWithoutDisconnect(o.WEBRTC_SHARE_AUDIO_MODE)}else{if(S.default.isSupportChromeWideAEC()&&this.audioDomNode){I.default.AudioNode.disconnect(),this.CloseBoringPeerConnection(),this.audioDomNode=null;let e="default"==ma.speakerId?"":ma.speakerId;I.default.AudioNode.connect(this.audioCtx.destination);let t=Date.now();this.selectComputerAudioSpeaker(e,t)}try{I.default.SharingAudioNode&&(I.default.SharingAudioNode.postCMD("stopWorklet",!0),I.default.SharingAudioNode.port=null,I.default.SharingAudioNode.disconnect(),I.default.SharingAudioNode=null)}catch(e){kl("SharingAudioNode.port",e)}this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.isSharingCaptureNodeConnect=!1),this.sharingAudioCtx=null,this.screenShareAudioPreviewElement&&this.screenShareAudioPreviewElement.pause()}I.default.DesktopAudioStatus=R.a.DesktopAudio_Null,I.default.Notify_APPUI(n.LEAVE_DESKTOP_AUDIO_COMPLETE,null)}break;case n.START_REMOTE_CONTROL:{kl("sdk start remote control 1");let e=this.sharingWidthAndHeightInfo,i=new Ci.a(Object.assign({dom:document},t));return this.remoteControl=i,kl("sharingInfo",e),i.setDstWidthAndHeight(e.logicWidth,e.logicHeight),i.setSrcWidthAndHeight(e.logicWidth,e.logicHeight),i.setSrcScaleWidthAndHeight(t.scaleWidth,t.scaleHeight),i.setSrcOffsetXY(t.srcOffsetX,t.srcOffsetY),i.setRemoteOS(t.os),i.start().then(e=>(I.default.Notify_APPUI(e?n.START_REMOTE_CONTROL_SUCCESS:n.START_REMOTE_CONTROL_FAILED),e&&(i.onPasteTextLengthOverflow((function(){I.default.Notify_APPUI(n.REMOTE_CONTROL_PASTE_TEXT_LENGTH_OVERFLOW)})),i.onReturnCopiedText(e=>{kl(e),I.default.Notify_APPUI(n.REMOTE_CONTROL_COPIED_TEXT_NOTIFY,e)})),e)).catch(e=>(kl(e),I.default.Notify_APPUI(n.START_REMOTE_CONTROL_FAILED),C.default.error("An error occurred when trying to start remote control",e),T.default.add_monitor("RMCTF"),Promise.reject(e)))}case n.CANCEL_REMOTE_CONTROL:return this.remoteControl.destroy().then(e=>(I.default.Notify_APPUI(e?n.CANCEL_REMOTE_CONTROL_SUCCESS:n.CANCEL_REMOTE_CONTROL_FAILED),e));case n.UPDATE_REMOTE_CONTROL_PROPERTIES:this.remoteControl&&(t.scaleWidth&&t.scaleHeight&&this.remoteControl.setSrcScaleWidthAndHeight(t.scaleWidth,t.scaleHeight),(Ii()(t.srcOffsetX)||Ii()(t.srcOffsetY))&&this.remoteControl.setSrcOffsetXYAndSendPDU(t.srcOffsetX,t.srcOffsetY),Ti()(t.isControllerNow)&&this.remoteControl.setIsControlerNow(t.isControllerNow),Ii()(t.os)&&this.remoteControl.setRemoteOS(t.os));break;case n.RESEND_REMOTE_CONTROL_POSITION_PDU:this.remoteControl&&this.remoteControl.sendPostionPDU();break;case n.START_DESKTOP_SHARING:if(this.flipSend=!0,this.canISendNextSharingFrame=!0,t.mode?this.isSharingSupportImageCapture=S.default.isSupportImageCapture():this.isSharingSupportImageCapture=!1,this.isStartDesktopSharing)return;{Wt(I.default.e2eencrypt),this.isStartDesktopSharing=!0,this.desktopSharingSend=!0;const{dom:e,id:i}=Object(S.parseDOMParams)(t.canvas);t.canvas&&(t.rendercanvasID=i),this.isSupportSharingTrackReader||this.isSupportMediaStreamTrackProcessor?t.video=e:(t.video=Object(S.parseDOMParams)(t.video).dom,t.canvas=e),this.desktopSharingValue=t,this.Start_Desktop_Sharing()}break;case n.STOP_DESKTOP_SHARING:if(this.flipSend=!0,this.canISendNextSharingFrame=!0,I.default.shareSystemAudio=!1,this.sharingTrackReader)try{this.sharingTrackReader.stop()}catch(e){}if(!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.StopSharingCapture(),this.isSupportVideoShare?Bt({command:"stopsharing"}):Gt({command:"stopsharing"});break;case n.PAUSE_DESKTOP_SHARING:if(this.flipSend=!0,this.canISendNextSharingFrame=!1,!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.isSupportVideoShare?Bt({command:"pause"}):Gt({command:"pause"});break;case n.RESUME_DESKTOP_SHARING:if(this.flipSend=!0,this.canISendNextSharingFrame=!0,!this.isStartDesktopSharing)return;this.desktopSharingSend=!0,this.isSupportMediaStreamTrackProcessor||this.isSupportSharingTrackReader||this.Process_Sharing(),this.isSupportVideoShare?Bt({command:"resume"}):Gt({command:"resume"});break;case n.START_STOP_REMOTE_CONTROL_CHECK:if(!window.WebQrscanner)return void console.error("qrScanner not loaded");T.default.add_monitor("QRSCAN:".concat(t.enable)),t.enable&&this.desktopSharingMediaStram?WebQrscanner.qrScanner.start(this.desktopSharingValue.video,e=>{I.default.Notify_APPUI_SAFE(n.SEND_REMOTE_CONTROL_QR_CODE,e)},()=>{T.default.add_monitor("QRSCANTIMEOUT")}):WebQrscanner.qrScanner.stop();break;case n.START_SHARING_WHITEBOARD:{this.isStartWhiteboardSharing=!0;const{dom:e,id:i}=Object(S.parseDOMParams)(t.canvas);if(t.canvas&&(t.rendercanvasID=i),this.isStartDesktopSharing)return;Wt(I.default.e2eencrypt),t.video=t.canvas=e,this.isStartDesktopSharing=!0,this.desktopSharingSend=!0,this.desktopSharingValue=t,this.Start_Whiteboard_Sharing()}break;case n.STOP_SHARING_WHITEBOARD:if(this.isStartWhiteboardSharing=!1,!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.isStartDesktopSharing=!1,Gt({command:"stopsharing"});break;case n.CHECK_CHROME_SHARING_EXTENSION:var J=document.createElement("img");J.src="chrome-extension://kgjfgplpablkjnlkjmjdecgdpfankdle/images/trash.png",J.onload=function(){I.default.Notify_APPUI(n.CHECK_CHROME_SHARING_EXTENSION_RESPONSE,!0)},J.onerror=function(){I.default.Notify_APPUI(n.CHECK_CHROME_SHARING_EXTENSION_RESPONSE,!1)};break;case n.COMMAND_SOCKET_MESSAGE_NOTIFY:if(t.evt===n.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT||t.evt===n.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT){if(kl("rwg answer from ui",t),!t.answer)return;switch(t.answer.type){case R.h.ZOOM_CONNECTION_VIDEO:A.a.trigger(n.PUBSUB_EVT.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT,t);break;case R.h.ZOOM_CONNECTION_AUDIO:A.a.trigger(n.PUBSUB_EVT.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT,t)}}else t.evt===n.WS_CONF_AB_TOKEN_RES&&t.body&&t.body.token&&A.a.trigger(n.PUBSUB_EVT.AUDIO_BRIDGE_WS_TOKEN,t.body.token);break;case n.USER_NODE_LIST:fe(t.userList),!this.setvideokk&&t.encryptKey&&(this.setvideokk=!0,Zt(R.f.VIDEO_DECODE,{KK:t.encryptKey},"MAIN_KK",!1,!0),Zt(R.f.VIDEO_ENCODE,{KK:t.encryptKey},"MAIN_KK",!1,!0));break;case n.AUIOD_INTERPRETATION_MUTE:yt(t.mute);break;case n.AUDIO_INTERPRETATION_SELECT_LANGUAGE:wt(t.lang);break;case n.AUDIO_INTERPRETATION_LIST_INFO:Mt(t.interpreterList);break;case n.AUDIO_INTERPRETATION_ENABLE:Ot(t.enable);break;case n.VIDEO_ENABLE_DECODE_HW:t.enable&&this.isEnableVideoDecodeHardWareThread&&(null!==this.videodecodehardwareflag||(this.videodecodehardwareflag=await S.default.IsSupportVideoDecodeHardwareAcceleration(I.default.enableHADecOpt)),t.enable=this.videodecodehardwareflag),St({command:"hwstatus",enable:t.enable});break;case n.VIDEO_ENABLE_ENCODE_HW:if(I.default.disableHWCodec&o.WEBCODEC_ENCODE_OFF)break;t.enable&&this.videoencodehardwareflag&&(!this.isAppleGraphic||S.default.isChromeVersionHigherThan(116)||this.doesSafariSupportWebcodec())?t.enable=!0:t.enable=!1,mt({command:"hwstatus",enable:t.enable});break;case"update_videohd_value":this.isVideoHD=!(null==t||!t.videohd),this.webrtcConfig.webrtcflag?this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"UPDATE_WMSC_PARAMS",data:{HDVideo:this.isVideoHD}}):(T.default.add_monitor("NoVideoHD"),!t.videohd&&this.videoencodehardwareflag&&(S.default.set720pcapacity(!1),T.default.add_monitor("CAPTURE720:"+!1),mt({command:"videohd",videohd:t.videohd})));break;case"update_videofullhd_value":T.default.add_monitor("UVFHD"+t.videofullhd),S.default.set1080pcapacity(t.videofullhd),mt({command:"videofullhd",videofullhd:t.videofullhd});break;case n.SET_DESKTOP_VOLUME:var $;if(this.useAudioBridge)null===($=this.audioBridge)||void 0===$||$.setShareVolumeLevel(t.userid,t.shareVolume,t.isFromMainSession);else bt({command:"setShareVolumeLevel",userid:t.userid,shareVolume:t.shareVolume,isFromMainSession:t.isFromMainSession});break;case n.USER_NODE_LIST_IN_MAIN_SESSION:t.mediaActionType==n.sdkIvTypeKeyEnum.SHARING_DECODE&&(this.isSupportVideoShare?Zt(R.f.VIDEO_DECODE,t,10,!1,!0):Zt(R.f.SHARING_DECODE,t,10,!1,!0)),t.mediaActionType==n.sdkIvTypeKeyEnum.SHARING_ENCODE&&(this.isSupportVideoShare?Zt(R.f.VIDEO_ENCODE,t,10,!1,!0):Zt(R.f.SHARING_ENCODE,t,10,!1,!0)),t.mediaActionType==n.sdkIvTypeKeyEnum.AUDIO_DECODE&&Zt(R.f.AUDIO_DECODE,t,10,!1,!0);break;case n.UPDATE_MEDIA_PARAMS:t.mediaActionType==n.sdkIvTypeKeyEnum.SHARING_DECODE&&(this.isSupportVideoShare?Zt(R.f.VIDEO_DECODE,t,9,!1,!0):Zt(R.f.SHARING_DECODE,t,9,!1,!0)),t.mediaActionType==n.sdkIvTypeKeyEnum.SHARING_ENCODE&&(this.isSupportVideoShare?Zt(R.f.VIDEO_ENCODE,t,9,!1,!0):Zt(R.f.SHARING_ENCODE,t,9,!1,!0)),t.mediaActionType==n.sdkIvTypeKeyEnum.AUDIO_DECODE&&Zt(R.f.AUDIO_DECODE,t,9,!1,!0);break;case n.SHARING_ADD_REV_CHANNEL_TYPE:this.isSupportVideoShare?Zt(R.f.VIDEO_DECODE,t,"SHARING_ADD_REV_CHANNEL_TYPE",!1,!0):Zt(R.f.SHARING_DECODE,t,"SHARING_ADD_REV_CHANNEL_TYPE",!1,!0);break;case n.SHARING_REMOVE_REV_CHANNEL_TYPE:this.isSupportVideoShare?At({command:"SHARING_REMOVE_REV_CHANNEL_TYPE",data:t}):Tt({command:"SHARING_REMOVE_REV_CHANNEL_TYPE",data:t});break;case n.BUILD_MS_CHANNEL_IN_BO:this.isSupportVideoShare?At({command:"BUILD_MS_CHANNEL_IN_BO",data:t}):Tt({command:"BUILD_MS_CHANNEL_IN_BO",data:t});break;case n.SWITCH_WATER_MARK_FLAG:{const{type:e}=t;e?e===R.b.VIDEO?this.SWITCH_VIDEO_WATER_MARK(t):e===R.b.SHARING&&this.SWITCH_SHARING_WATER_MARK(t):(this.SWITCH_VIDEO_WATER_MARK(t),this.SWITCH_SHARING_WATER_MARK(t))}break;case n.AUDIO_CC_SELECT_LANGUAGE:var ee;if(this.useAudioBridge)null===(ee=this.audioBridge)||void 0===ee||ee.set_CC_lang(t.lang);else Dt(t.lang);break;case n.BUILD_MA_CHANNEL_IN_BO:bt({command:"BUILD_MA_CHANNEL_IN_BO",data:t});break;case n.ENABLE_SHARE_TO_BO:var te;if(T.default.add_monitor("ESTB:"+t.enable),this.useAudioBridge)null===(te=this.audioBridge)||void 0===te||te.enableShareToBO(t.enable);else It({command:"ENABLE_SHARE_TO_BO",data:t.enable});break;case n.ENABLE_BROADCAST_TO_BO:var ie;if(T.default.add_monitor("EBTB:"+t.enable),this.useAudioBridge)null===(ie=this.audioBridge)||void 0===ie||ie.enableBroadCastToBO(t.enable);else It({command:"ENABLE_BROADCAST_TO_BO",data:t.enable});break;case n.WEBGL_LOST_REPLACE_CANVAS:{let e=Object(S.parseDOMParams)(t.canvasId).dom;if(t.canvas&&(e=t.canvas),!e)return;let i=null;const a=this.replaceCanvasMap.videoDecodeCanvasIds&&-1!==this.replaceCanvasMap.videoDecodeCanvasIds.indexOf(t.canvasId),r=this.replaceCanvasMap.videoEncodeCanvasIds&&-1!==this.replaceCanvasMap.videoEncodeCanvasIds.indexOf(t.canvasId);if(t.canvasId===this.replaceCanvasMap.videoMaskSettingCanvasId?i=I.default.localVideoEncMGR:t.canvasId===this.replaceCanvasMap.sharingMainCanvasId?i=this.isSupportVideoShare?I.default.localVideoDecMGR:I.default.localSharingDecMGR:t.canvasId===this.replaceCanvasMap.sharingPreviewCanvasId?i=I.default.localSharingEncMGR:(r||a)&&(i=r?I.default.localVideoEncMGR:I.default.localVideoDecMGR,this.lazyReplaceEncodeCanvasTimer&&(clearTimeout(this.lazyReplaceEncodeCanvasTimer),this.lazyReplaceEncodeCanvasTimer=null),this.lazyReplaceEncodeCanvasTimer=setTimeout(()=>{let e=I.default.localVideoEncMGR;if(e){let t=e.map.get(I.default.SPECIAL_ID);t&&t.postMessage({command:"WEBGL_LOST_REPLACE_CANVAS"})}let t=I.default.localSharingEncMGR;if(t){let e=t.map.get(I.default.SPECIAL_ID);e&&e.postMessage({command:"WEBGL_LOST_REPLACE_CANVAS"})}if(this.videoCaptureHiddenCanvas){const{width:e,height:t}=this.videoCaptureHiddenCanvas;S.default.isSupport2dOffscreenCanvas()?this.videoCaptureHiddenCanvas=new OffscreenCanvas(e,t):(this.videoCaptureHiddenCanvas=document.createElement("canvas"),this.videoCaptureHiddenCanvas.width=e,this.videoCaptureHiddenCanvas.height=t),this.videoCaptureHiddenCanvasCtx=this.videoCaptureHiddenCanvas.getContext("2d")}if(this.bgCanvas){const{width:e,height:t}=this.bgCanvas;this.bgCanvas=document.createElement("canvas"),this.bgCanvas.width=e,this.bgCanvas.height=t,this.bgCanvasctx=this.bgCanvas.getContext("2d"),!this.VideoMaskSettingCanvas&&this.PrevVideoMaskSettingCanvas?(this.VideoMaskSettingCanvas=this.PrevVideoMaskSettingCanvas,this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height),this.VideoMaskSettingCanvas=null):this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height)}},500)),i)try{var ae=e.transferControlToOffscreen(),re=i.map.get(I.default.SPECIAL_ID);re&&re.postMessage({command:"WEBGL_LOST_REPLACE_CANVAS",data:{canvasId:t.canvasId,canvas:ae}},[ae])}catch(e){}break}case n.CHANGE_HID_ENABLE:T.default.add_monitor("CHIDE:"+t.enable),this.enableHID=t.enable,t.enable?(this.hidAvalible&&(await wa.destroy(),this.hidAvalible=!1),t.microphoneLabel&&(this.hidAvalible=await wa.init(t.microphoneLabel,t.defaultMuted))):this.hidAvalible&&(await wa.destroy(),this.hidAvalible=!1);break;case n.ENABLE_VIDEO_OBSERVER:St({command:"ENABLE_VIDEO_OBSERVER",data:t.enable,enablefps:!t.fpsdisbale});break;case n.SWITCH_SHARING_TYPE:mt({command:"SWITCH_SHARING_TYPE",data:t.mode});break;case n.SET_OTHER_AUDIO_VOLUME_LEVEL:var ne;if(this.useAudioBridge)null===(ne=this.audioBridge)||void 0===ne||ne.setSpeechVolumeLevel(t.userId,t.volume);I.default.decoderinworklet?I.default.AudioNode&&I.default.AudioNode.postCMD("setSpeechVolumeLevel",{userid:t.userId>>10,volume:t.volume}):bt({command:"setSpeechVolumeLevel",userid:t.userId>>10,volume:t.volume});break;case n.USER_NODE_AUDIO_STATUS_LIST:var oe;if(this.useAudioBridge)null===(oe=this.audioBridge)||void 0===oe||oe.updateUserMuteUnmuteStatus(t);break;case n.MOVE_PTZ_CAMERA:Vl._updateVideoConstraints({advanced:[t]});break;case n.NOTIFY_SDK_JOIN_RWG_SUCCESS:this._SaveSystemInfo(),I.default.clearMessageToRwg();break;case n.ENABLE_REUSE_STREAM:Vl.enableReuseStream(t.enable);break;case n.PRESET_MEDIA_CONSTRAINTS:Vl.presetConstraints(t||{});break;case n.DESTORY_REUSE_STREAM:Vl.destoryReuseStream({audio:t&&t.audio,video:t&&t.video});break;case n.WHITEBOARD_JOIN_MESSAGE:{let e={command:"WHITEBOARD_JOIN_MESSAGE",data:t.message,nodeId:t.nodeId,encryptKey:t.encryptKey,sn:t.sn,dcsId:t.dcsId,EncodedSn:t.EncodedSn};this.isSupportVideoShare?Ft(e):Ht(e)}break;case n.STOP_AUDIO_INCOMING:var se;if(this.useAudioBridge)null===(se=this.audioBridge)||void 0===se||se.stopIncomingAudio(t);else I.default.decoderinworklet?bt({command:"stop_audio_incoming",stopPlayAudio:t}):I.default.AudioNode&&I.default.AudioNode.postCMD("stop_audio_incoming",t);break;case n.MOBILE_ROTATE:if(this.isLandScape=t.isLandScape,!Vl.videoStreamTrack)return;this.isLandScape&&this.captureSize&&this.Change_Video_Capture_Resolution(this.captureSize.width,this.captureSize.height);break;case n.SAVE_LOCAL_LOG:this.localLog&&this.localLog.saveAllLogFiles();break;case n.AUDIO_JOIN_SUCCESS:if(Vl&&Vl.audioStream){let e=Vl.audioStream.getAudioTracks()[0];e&&(e.muted||"live"!==e.readyState)&&Object(Z.NotifyUIError)(n.AUDIO_STREAM_FAILED,Z.CAPTURE_ERROR_TYPE.EXCEPTION)}break;case n.REMOVE_EXPIRED_CANVAS:{const e=I.default.localVideoDecMGR,i=I.default.SPECIAL_ID;if(e){const a=e.map.get(i);if(a){const e={command:"removeExpiredCanvas",rendercanvasID:t.canvasId};a.postMessage(e)}}}break;case n.UI_SUBSCRIBE_VIDEO:this.webrtcConfig.webrtcflag?(T.default.add_monitor("WMSC_UI_S_V: ".concat(Object(S.replaceComma)(JSON.stringify(t)))),this.wmscManager&&Array.isArray(t)&&t.length>0&&this.wmscManager.sendMessageToWMSC({type:"NOTIFY_SDK_SUBSCRIBE_VIDEO",data:t})):I.default.sendMessageToRwg(n.SEND_MESSAGE_TO_RWG,{evt:n.WS_VIDEO_MULTI_SUBSCRIBE_REQ,body:{subInfoList:t}});break;case n.UI_UNSUBSCRIBE_VIDEO:Array.isArray(t)&&t.length>0&&(this.webrtcConfig.webrtcflag&&this.wmscManager?(T.default.add_monitor("WMSC_UI_UNS_V: ".concat(Object(S.replaceComma)(JSON.stringify(t)))),this.wmscManager.sendMessageToWMSC({type:"NOTIFY_SDK_UNSUBSCRIBE_VIDEO",data:t})):I.default.sendMessageToRwg(n.SEND_MESSAGE_TO_RWG,{evt:n.WS_VIDEO_MULTI_UNSUBSCRIBE_REQ,body:{subIDList:t}}));break;case n.ON_HOLD:var de,ue;if(T.default.add_monitor("HOLD:".concat(null==t?void 0:t.hold,":").concat(null==t?void 0:t.userid,":").concat(null==t?void 0:t.reinit)),!t.hold&&this.isSupportVideoShare)null===(de=I.default.sharingDecInitInstance)||void 0===de||de.resetHandleDeferred(),null===(ue=I.default.sharingEncInitInstance)||void 0===ue||ue.resetHandleDeferred();t&&!t.userid&&(t.userid=this.userId),hi(this,t),!t.hold&&t.userid&&(this.userId=t.userid),t.hold&&this.SessionHold(),I.default.videoEncodeSession=null,I.default.videoDecodeSession=null,I.default.sharingDecodeSession=null,I.default.sharingEncodeSession=null,I.default.audioDecodeSession=null,I.default.audioEncodeSession=null;break;case n.SET_ALL_SPEECH_VOLUME:I.default.decoderinworklet?I.default.workletWasmInitSuccess&&I.default.AudioNode?I.default.AudioNode.postCMD(131,{volume:t}):I.default.workletMessageQueue.enqueue({command:131,volume:t}):bt({command:131,volume:t});break;case n.ENABLE_FILE_AUDIO_PLAYBACK_LOCALLY:T.default.add_monitor("ENABLE_FILE_AUDIO_PLAYBACK_LOCALLY: ".concat(t)),this.setFileAudioPlaybackSwitch(t);break;case n.RWG_COMMAND_BYPASS_TO_WCL:pi(this,t);break;case n.REQUEST_PERMISSION:{let e=setTimeout(()=>{I.default.Notify_APPUI_SAFE(n.REQUEST_PERMISSIOM_POP_REMINDER),clearTimeout(e),e=null},t||2e3);try{let t=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0});t.getTracks().forEach(e=>e.stop()),t=null,e&&(clearTimeout(e),e=null),this.requestPermissionCallback(n.REQUEST_PERMISSION_STATUS.GRANTED_AUDIO_VIDEO)}catch(t){try{let t=await navigator.mediaDevices.getUserMedia({audio:!0});e&&(clearTimeout(e),e=null),t.getTracks().forEach(e=>e.stop()),t=null,this.requestPermissionCallback(n.REQUEST_PERMISSION_STATUS.GRANTED_AUDIO)}catch(t){e&&(clearTimeout(e),e=null);const{errorCode:i}=Gl(t);i===n.CAPTURE_FAILED_REASON.USER_DENIED?this.requestPermissionCallback(n.REQUEST_PERMISSION_STATUS.DENIED):i===n.CAPTURE_FAILED_REASON.USER_DISMISS?this.requestPermissionCallback(n.REQUEST_PERMISSION_STATUS.DISMISS):this.requestPermissionCallback(n.REQUEST_PERMISSION_STATUS.EXCEPTION_FAILS)}}break}default:kl("CAN NOT HANDLE THE EVENT!")}},requestPermissionCallback:function(e){I.default.Notify_APPUI_SAFE(n.REQUEST_PERMISSION_RESULT,e)},setFileAudioPlaybackSwitch:function(e){e?(this.fileAudioPlaybackTag||(this.fileAudioPlaybackTag=new Audio),this.updateFileAudioPlaybackStream(Vl.audioStream)):this.fileAudioPlaybackTag&&(this.fileAudioPlaybackTag.pause(),this.fileAudioPlaybackTag=null)},updateFileAudioPlaybackStream:function(e){var t;if(Vl.isCaptureAudioFromFile){if(e&&this.fileAudioPlaybackTag){this.fileAudioPlaybackTag.srcObject!==e&&(this.fileAudioPlaybackTag.srcObject=e);const t="default"===ma.speakerId||null===ma.speakerId?"":ma.speakerId;this.fileAudioPlaybackTag.setSinkId&&this.fileAudioPlaybackTag.sinkId!==t&&this.fileAudioPlaybackTag.setSinkId(t).catch(e=>{C.default.error("fileAudioPlaybackTag setSinkId error when update stream")}),this.fileAudioPlaybackTag.play().catch(e=>{C.default.error("self audio playback failed",e)})}}else null===(t=this.fileAudioPlaybackTag)||void 0===t||t.pause()},SWITCH_VIDEO_WATER_MARK:function(e){this.videoWaterMarkParams=e;const{enableWaterMark:t,waterMarkText:i="",watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n}=e;this.isCreateVideoWaterMark=!!t,this.videoWaterMarkName=this.isCreateVideoWaterMark?i:"",this.VideoRenderObj?(t?this.isCreateVideoWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")):this.VideoRenderObj.Set_WaterMark_Flag(t),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n})):St({command:"SWITCH_WATER_MARK_FLAG",isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n}),S.default.watermark.updateWaterMarkInfo(e)},SWITCH_SHARING_WATER_MARK:function(e){this.sharingWaterMarkParams=e;const{enableWaterMark:t,waterMarkText:i="",watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n}=e;this.isCreateSharingWaterMark=!!t,this.sharingWaterMarkName=this.isCreateSharingWaterMark?i:"",this.SharingRenderObj?(t?this.isCreateSharingWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")):this.SharingRenderObj.Set_WaterMark_Flag(t),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n})):this.isSupportVideoShare?At({command:"SWITCH_SHARING_WATER_MARK_FLAG",isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n}):Tt({command:"SWITCH_WATER_MARK_FLAG",isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:a,watermarkRepeated:r,watermarkPosition:n})},JsMediaSDK_VideoRenderInterval:function(e){return this.VideoRenderObj.Start_Draw.bind(this.VideoRenderObj)(o.SET_INTERVAL_MODE,e)},JsMediaSDK_SharingRenderInterval:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i=this.SharingRenderObj.No_Bindthis_Interval.bind(this.SharingRenderObj),a=setInterval(i,t?20:e);return a},getShareStreamInfo:function(){if(!this.desktopSharingMediaStram)return null;const e=this.desktopSharingMediaStram.getVideoTracks();if(!e.length)return null;if(e[0].getSettings){let t=e[0].getSettings()||null;return t&&this.sharingCodecInfo.width&&this.sharingCodecInfo.height&&(t.width=this.sharingCodecInfo.width,t.height=this.sharingCodecInfo.height),t}return null},onUnload:function(e){const t=this.rendererType==yi.j.WEBGPU;C.default.log("window.onunload:".concat(this._id,", webGPU:").concat(t)),T.default.add_monitor("window.onunload:".concat(this._id,", webGPU:").concat(t)),t&&this.destroy().catch(e=>{})},handleUnloadEvent(){this.unloadHandler=this.onUnload.bind(this),window.addEventListener("unload",this.unloadHandler)},async destroy(){var e;(kl("destroy"),window.removeEventListener("unload",this.unloadHandler),this.destoryPromise)?await this.destoryPromise:(I.default.extVBPort&&I.default.extVBPort.postMessage({type:n.UNIFIED_VB_PAUSE}),null===(e=ie.instance)||void 0===e||e.close(),ee(()=>{}),Object(S.updateAudioProbResult)(),document.removeEventListener("visibilitychange",Ul),this.isDestroy=!0,this.destoryPromise=new Promise(async(e,t)=>{try{var i;C.default.log("DelInstance:".concat(this._id)),I.default._callbackList=[],I.default._Notify_APPUI=null,I.default.localVideoPara.VE=null,I.default.localVideoPara.VD=null,T.default.add_monitor("DelInstance:".concat(this._id)),Object(Z.SetNotifyUIFn)(null),this.wmscManager&&(this.wmscManager.destroy(),this.wmscManager=null),null===(i=this.annotationMgr)||void 0===i||i.destroy(),this.annotationMgr=null;let e=this;Lt(),A.a.clearAllSubscriptions(),ge.clear(),I.default.destroyQueueMessageToRwg(),this.audioInputLevel&&(this.audioInputLevel.destroy(),this.audioInputLevel=null),this.audioBridge&&(this.audioBridge.destroy(!1),this.audioBridge=null,Vl.audioBridge=null),this.EndMedia(),function(){let e=j.dataTransportMgr;Object.keys(e.refs).forEach(t=>{let i=e.refs[t];delete e.refs[t],i.worker.removeEventListener("message",i.listener)}),e.reinit()}(),this.dataChannelController.remoteTransportListener(),function(e){let t=j.dataTransportMgr;t.mediadatachannel.netthreadworker&&(t.mediadatachannel.netthreadworker.destroy(),t.mediadatachannel.netthreadworker=null)}(),this.computePressureManager&&this.computePressureManager.destroy();let t=[I.default.localVideoDecMGR,I.default.localVideoEncMGR,I.default.localSharingDecMGR,I.default.localSharingEncMGR],a=[I.default.localAudioDecMGR,I.default.localAudioEncMGR];Yt([I.default.sharingDecInitInstance,I.default.sharingEncInitInstance,I.default.videoDecInitInstance,I.default.videoInitInstance,I.default.audioDecInitInstance,I.default.audioEncodeInitInstance]),qt(t,a);try{await new Promise((function(t,i){let a=setTimeout(()=>t(),1e3);Promise.all(e.allpromises).finally(()=>{clearTimeout(a),t()})}))}catch(e){console.error(e)}Ce(R.h.ZOOM_CONNECTION_AUDIO,R.d.NET_WEBTRANSPORT),Ce(R.h.ZOOM_CONNECTION_VIDEO,R.d.NET_WEBTRANSPORT),await Xt(this,t,a),this.hidAvalible&&await wa.destroy(),await Qt(t,a)}catch(e){C.default.error("destroy instance ".concat(this._id," error"),e)}e()}),await this.destoryPromise)},async isWebGPURendererType(){return await S.default.evaluateRendererType(this.isWebGPUFeatureEnabled,this.isWebGL2FeatureEnabled)==yi.j.WEBGPU},addVbReceiver(e){mt({command:"addExtVbReceiver"}),I.default.extVBPort&&(I.default.extVBPort.onmessage=null),I.default.extVBPort=e,I.default.frameReceived=0,I.default.frameSent=0,e.onmessage=e=>{const{type:t}=e.data;t===n.UNIFIED_VB_ACK&&I.default.frameReceived++},T.default.add_monitor("EVBA")},removeVbReceiver(){mt({command:"removeExtVbReceiver"}),I.default.extVBPort&&(I.default.extVBPort.postMessage({type:n.UNIFIED_VB_STOP}),I.default.extVBPort.onmessage=null,I.default.extVBPort=null),T.default.add_monitor("EVBR")},SessionHold(){if(!this.VideoRenderObj)return;let e=this.VideoRenderObj.clearColor.map(e=>e/255);for(;this.videoRenderArray.length>0;){let t=this.videoRenderArray.shift();this.StopUserVideoRender(this.VideoRenderObj,[t],e,!0)}},StopUserVideoRender(e,t,i,a){e&&(a&&e.clearUseridRender(t,i),I.default.enableMultiDecodeVideoWithoutSAB&&e.GiveBack_Display(t),e.Set_Render_Array(this.videoRenderArray,I.default.enableMultiDecodeVideoWithoutSAB),0==this.videoRenderArray.length&&(St({command:"stopVideoRender",MFlag:!0}),this.Stop_Video_Play()))},_SaveSystemInfo:function(){try{T.default.add_monitor("JSBN:".concat(Fl.buildNumber,",").concat(Fl.fixVersion)),T.default.add_monitor("NewInstance:".concat(this._id)),C.default.directReport("MediaSDK Version:".concat(Fl.fixVersion)),Vt()}catch(e){kl(e)}},async updateWebRTCVideoStream(e){var t;null!==(t=this.wmscManager)&&void 0!==t&&t.vbSettingVideoDom&&(this.wmscManager.vbSettingVideoDom.srcObject=e),this.isStartVideoCapture&&this.wmscManager.streamId!==e.id&&this.handleWebRTCStream("fromVBModule",e)},onAnnotationPdu:function(e){this.annotationMgr&&this.annotationMgr.onRWGMessage(e)},sendAnnotationPdu:function(e,t){t||(this.isSupportVideoShare?At(e):Tt(e))},beforeReportToGlobalTracing:function(){this.wmscManager&&this.wmscManager.reportWMSCPeerConnectionRawStats()},workrtHealthCheckReport(e,t){var i,a;"net"==e&&(null===(i=this.audioDataChannel)||void 0===i||i.resetDataChannelTransfered(null),null===(a=this.videoDataChannel)||void 0===a||a.resetDataChannelTransfered(null),function(e){ie.instance&&ie.instance.unRegisterWorker(e)}(e));let r="WORKERZOMBIE:".concat(e,":").concat(t);T.default.add_monitor(r),C.default.error(r)},onSharingSizeChange(e){this.sharingCodecInfo.width=e.width,this.sharingCodecInfo.height=e.height},isEnableAutoJoinAudio(){return!(S.default.isMac()&&S.default.browser.isSafari&&!this.audioBridge&&!S.default.isSafariVersionHigherThan("18.0"))}};i.default=Fl}])})); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/js_media.min.js-f70a54867a7b3a7e819e.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/js_sharing_audio_worklet.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/js_sharing_audio_worklet.min.js new file mode 100644 index 0000000..8802929 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/js_sharing_audio_worklet.min.js @@ -0,0 +1,2 @@ +!function(t){var e={};function s(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(i,r,function(e){return t[e]}.bind(null,r));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=9)}({4:function(t,e,s){"use strict";s.d(e,"b",(function(){return r})),s.d(e,"a",(function(){return h}));var i=s(6);class r{constructor(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.STATE_READ_READY=0,this.STATE_READ_INDEX=1,this.STATE_WRITE_READY=2,this.STATE_WRITE_INDEX=3,this.STATE_DATA_COUNT=4,this.STATE_CACHE_SIZE=5,this.STATY_READY_NO=0,this.STATY_READY_YES=1,this.sabState=new Uint32Array(t),this.sabBuffer=new Float32Array(e),this.perFrameLength=s,this.writeChannelNumb=r,this.bufferLen=this.sabBuffer.length,this.supportSpecialOptimization=this.bufferLen%s==0,this.bufferIndex=null,this.supportSpecialOptimization){let t=this.bufferLen/s;this.bufferIndex=[];for(let e=0;ethis.CACHE_SIZE_MAX_VALUE&&(t=this.CACHE_SIZE_MAX_VALUE),t0&&this.setCacheSize(this.getCacheSize()+1)}clear(){this.sabState&&(this.sabState[this.STATE_READ_READY]=0,this.sabState[this.STATE_READ_INDEX]=0,this.sabState[this.STATE_WRITE_READY]=0,this.sabState[this.STATE_WRITE_INDEX]=0,this.sabState[this.STATE_DATA_COUNT]=0),this._counter=0}setWriteReady(){this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES}isReady(){return this.sabState[this.STATE_WRITE_READY]&&this.sabState[this.STATE_READ_READY]}getDataCount(){return Atomics.load(this.sabState,this.STATE_DATA_COUNT)}write(t){if(void 0===t[0]||t[0].length*this.writeChannelNumb!==this.perFrameLength)return;let e=this.sabState[this.STATE_READ_READY];return this.sabState[this.STATE_WRITE_READY]||(this.sabState[this.STATE_WRITE_READY]=this.STATY_READY_YES,this.sabState[this.STATE_WRITE_INDEX]=0),e?this.supportSpecialOptimization?this.writeSpecial(t):this.writeNormal(t):void 0}writeNormal(t){let e=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;s=this.bufferLen&&(e-=this.bufferLen),this.sabState[this.STATE_WRITE_INDEX]=e,Atomics.add(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength)}writeSpecial(t){let e=this.sabState[this.STATE_WRITE_INDEX];for(let s=0;sthis.bufferLen){let s=Math.ceil((e-this.bufferLen)/this.perFrameLength)+1;t=(s*this.perFrameLength+t)%this.bufferLen,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=null;if(this.bufferLen-t>=this.perFrameLength)s=this.sabBuffer.subarray(t,t+this.perFrameLength);else{let e=this.sabBuffer.subarray(t),i=this.sabBuffer.subarray(0,this.perFrameLength-e.length);s=this.placeBuffer,s.set(e),s.set(i,e.length)}return t+=this.perFrameLength,t>=this.bufferLen&&(t-=this.bufferLen),this.sabState[this.STATE_READ_INDEX]=t,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}readSpecial(){let t=this.sabState[this.STATE_READ_INDEX],e=Atomics.load(this.sabState,this.STATE_DATA_COUNT);if(ethis.bufferLen){let s=Math.ceil((e-this.bufferLen)/this.perFrameLength)+1;t=(s+t)%this.bufferIndex.length,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,s*this.perFrameLength)}let s=this.bufferIndex[t];return t=(t+1)%this.bufferIndex.length,this.sabState[this.STATE_READ_INDEX]=t,Atomics.sub(this.sabState,this.STATE_DATA_COUNT,this.perFrameLength),s}}class h{constructor(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=t,this.wframes=e,this.writeChannelNumb=s,this.cap=this.lcm(t,e),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(t,e){return 0===e?t:this.gcd(e,t%e)}lcm(t,e){return t/this.gcd(t,e)*e}push(t){if(null==t[0]||t[0].length*this.writeChannelNumb==this.wframes){for(let e=0;e=this.cap&&(this.woffset=this.woffset%this.cap)}else{var e;console.error("[Audio] critical error in AudioWorklet: data.length:",t.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(e=t[0])||void 0===e?void 0:e.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let t=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),t}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}},6:function(t,e,s){"use strict";s.d(e,"a",(function(){return i}));class i{constructor(){this.cacheSize=0,this.sameCacheSizeCounter=0}shouldSendCacheSize(t){return t===this.cacheSize&&this.sameCacheSizeCounter++,(this.cacheSize!==t||200===this.sameCacheSizeCounter)&&(this.sameCacheSizeCounter=0,this.cacheSize=t,!0)}}},9:function(t,e,s){"use strict";s.r(e);var i=s(4);var r=!1,h=1;const a="undefined"!=typeof SharedArrayBuffer;class n extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"pcm",defaultValue:1}]}constructor(t){super(),this.port.onmessage=this.handleMessage.bind(this),this.isPlaying=!1,this.isCapturing=!1,this.audioEncodePort=null,t&&t.processorOptions&&t.processorOptions.sharingEncodeChannelsNum&&(h=t.processorOptions.sharingEncodeChannelsNum)}handleMessage(t){const{status:e,data:s}=t.data;switch(e){case"StartCaptureAudio":this.isCapturing=!0;break;case"sampleRate":this.sampleRate_=s;break;case"encodeAudioPort":this.audioEncodePort&&this.audioEncodePort.close(),this.audioEncodePort=t.ports[0];break;case"stopWorklet":r=!0;break;default:a?this.handleMessageForSAB(t):console.warn("unhanle commands in audioworklet",e)}}handleMessageForSAB(t){const{status:e,data:s}=t.data;switch(e){case"sharedBuffer":s&&(this.g_sharedbuffer=s),this.g_sharedbuffer&&(this.sharingSAB=new i.b(this.g_sharedbuffer.sharingInputState,this.g_sharedbuffer.sharingInputBuffer,128*h,h));break;default:console.warn("unhanle commands in audioworklet",e)}}process(t,e,s){return!r&&(!!a&&this.SABProcess(t,s))}inputData(t){if(!this.sharingSAB)return!0;this.sharingSAB.write(t[0]),this.audioEncodePort.postMessage({command:2,buffer:!1})}SABProcess(t,e){let s=t[0];return!this.g_sharedbuffer||(s[0]&&this.isCapturing&&this.inputData(t),!0)}}registerProcessor("zoomSharingAudioWorklet",n)}}); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/js_sharing_audio_worklet.min.js-7b1565f53640e47e0b56.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/net_thread.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/net_thread.min.js new file mode 100644 index 0000000..859a630 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/net_thread.min.js @@ -0,0 +1,2 @@ +!function(t){var e={};function s(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(n,r,function(e){return t[e]}.bind(null,r));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=60)}([,,,,,function(t,e,s){"use strict";s.d(e,"j",(function(){return n})),s.d(e,"h",(function(){return r})),s.d(e,"l",(function(){return i})),s.d(e,"sb",(function(){return o})),s.d(e,"qb",(function(){return a})),s.d(e,"ub",(function(){return h})),s.d(e,"Z",(function(){return c})),s.d(e,"d",(function(){return l})),s.d(e,"bb",(function(){return u})),s.d(e,"db",(function(){return d})),s.d(e,"D",(function(){return _})),s.d(e,"ob",(function(){return f})),s.d(e,"H",(function(){return p})),s.d(e,"Eb",(function(){return m})),s.d(e,"n",(function(){return b})),s.d(e,"vb",(function(){return g})),s.d(e,"E",(function(){return v})),s.d(e,"b",(function(){return E})),s.d(e,"zb",(function(){return y})),s.d(e,"S",(function(){return T})),s.d(e,"I",(function(){return S})),s.d(e,"T",(function(){return D})),s.d(e,"xb",(function(){return w})),s.d(e,"f",(function(){return M})),s.d(e,"nb",(function(){return A})),s.d(e,"mb",(function(){return C})),s.d(e,"eb",(function(){return I})),s.d(e,"X",(function(){return k})),s.d(e,"V",(function(){return O})),s.d(e,"a",(function(){return R})),s.d(e,"z",(function(){return N})),s.d(e,"Fb",(function(){return L})),s.d(e,"G",(function(){return B})),s.d(e,"wb",(function(){return U})),s.d(e,"v",(function(){return q})),s.d(e,"u",(function(){return F})),s.d(e,"t",(function(){return x})),s.d(e,"w",(function(){return P})),s.d(e,"U",(function(){return H})),s.d(e,"jb",(function(){return V})),s.d(e,"kb",(function(){return j})),s.d(e,"R",(function(){return W})),s.d(e,"hb",(function(){return G})),s.d(e,"ib",(function(){return Y})),s.d(e,"F",(function(){return Q})),s.d(e,"r",(function(){return K})),s.d(e,"q",(function(){return J})),s.d(e,"y",(function(){return z})),s.d(e,"p",(function(){return X})),s.d(e,"x",(function(){return Z})),s.d(e,"Cb",(function(){return $})),s.d(e,"O",(function(){return tt})),s.d(e,"P",(function(){return et})),s.d(e,"Ab",(function(){return st})),s.d(e,"C",(function(){return nt})),s.d(e,"B",(function(){return rt})),s.d(e,"A",(function(){return it})),s.d(e,"K",(function(){return ot})),s.d(e,"J",(function(){return at})),s.d(e,"L",(function(){return ht})),s.d(e,"o",(function(){return ct})),s.d(e,"s",(function(){return lt})),s.d(e,"gb",(function(){return ut})),s.d(e,"fb",(function(){return dt})),s.d(e,"Db",(function(){return _t})),s.d(e,"Q",(function(){return ft})),s.d(e,"i",(function(){return pt})),s.d(e,"g",(function(){return mt})),s.d(e,"k",(function(){return bt})),s.d(e,"m",(function(){return gt})),s.d(e,"rb",(function(){return vt})),s.d(e,"pb",(function(){return Et})),s.d(e,"tb",(function(){return yt})),s.d(e,"Y",(function(){return Tt})),s.d(e,"cb",(function(){return St})),s.d(e,"ab",(function(){return Dt})),s.d(e,"c",(function(){return wt})),s.d(e,"M",(function(){return Mt})),s.d(e,"Bb",(function(){return At})),s.d(e,"N",(function(){return Ct})),s.d(e,"yb",(function(){return It})),s.d(e,"W",(function(){return kt})),s.d(e,"lb",(function(){return Ot})),s.d(e,"e",(function(){return Rt}));const n=1,r=2,i=3,o=7,a=8,h=9,c=12,l=14,u=15,d=16,_=18,f=20,p=21,m=24,b=26,g=27,v=30,E=31,y=35,T=36,S=37,D=38,w=47,M=48,A=50,C=51,I=52,k=53,O=54,R=56,N=57,L=60,B=61,U=62,q=66.5,F=66.6,x=67,P=68,H=69,V=71,j=72,W=73,G=75,Y=76,Q=78,K=105,J=106,z=107,X=108,Z=109,$=120,tt=121,et=122,st=123,nt=124,rt=125,it=126,ot=127,at=128,ht=129,ct=132,lt=133,ut=135,dt=136,_t=137,ft=151,pt=-1,mt=-2,bt=-3,gt=-5,vt=-7,Et=-8,yt=-9,Tt=-12,St=-14,Dt=-15,wt=-23,Mt=-26,At=-27,Ct=-28,It=-35,kt=-129,Ot=-130,Rt=-131},function(t,e,s){"use strict";s.d(e,"e",(function(){return l})),s.d(e,"b",(function(){return d})),s.d(e,"d",(function(){return _})),s.d(e,"a",(function(){return f})),s.d(e,"c",(function(){return p}));var n=s(7),r=s.n(n),i=s(14),o=s(17),a=s(5),h=s(10),c=s(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},u=t=>{0};class d{constructor(){this.onmessage=u,this.status=d.CLOSED,this.onopen=u,this.onclose=u,this.onwer=null}send(t){}delete(){this.onmessage=u,this.onopen=u,this.onclose=u,this.close()}sendVideo(t,e){}sendWasm(t){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}r()(d,"OPEN",1),r()(d,"CLOSED",2);class _ extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=u,this.sender=u,this.videoSender=u,this.reciver=u,this.wasmSender=u}send(t){this.sender(t)}sendVideo(t,e){this.videoSender(t,e)}sendWasm(t){this.wasmSender(t)}delete(){try{var t,e;this.onmessage=u,this.sender=u,this.videoSender=u,this.reciver=u,this.wasmSender=u;let{consumer:s}=(null===(t=this.sab)||void 0===t?void 0:t.reciver)||{};null==s||s.setDataCallback(u),null==s||s.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=u),null===(e=this.port)||void 0===e||e.close()}catch(t){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(t){let{cmd:e,data:s}=t.data;switch(e){case a.J:this.reciver();break;case a.K:this.onmessage(s,0);break;case a.L:this.status=s,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:t,reciver:e}=this.sab,{sabqueue:s,interval:n}=t||{};s?n?(this.sender=t=>{s.enqueue(t)},this.wasmSender=t=>{s.enqueue(t)},this.videoSender=(t,e)=>{if(!s.enqueueSafe([t,e],!1)){let n=new Uint8Array(e.length+t.length);n.set(t,0),n.set(e,t.length),s.enqueueSafe(n)}}):(this.sender=t=>{s.enqueue(t),this.port.postMessage({cmd:a.J})},this.wasmSender=t=>{s.enqueue(t),this.port.postMessage({cmd:a.J})},this.videoSender=(t,e)=>{if(!s.enqueueSafe([t,e],!1)){let n=new Uint8Array(e.length+t.length);n.set(t,0),n.set(e,t.length),s.enqueueSafe(n)}this.port.postMessage({cmd:a.J})}):(this.sender=t=>{this.port.postMessage({cmd:a.K,data:t},[t.buffer])},this.wasmSender=t=>{let e=new Uint8Array(t.length);e.set(t,0),this.port.postMessage({cmd:a.K,data:e},[e.buffer])},this.videoSender=(t,e)=>{let s=new Uint8Array(e.length+t.length);s.set(t,0),s.set(e,t.length),this.port.postMessage({cmd:a.K,data:s},[s.buffer])});let{sabqueue:r,consumer:h,useCopy:c,interval:l,offset:u}=e||{};if(h&&(h.cancelConsume(),h=null),r){const t=c?t=>{this.onmessage(t,0)}:u?t=>{this.onmessage(t.uint8s,t.begin)}:t=>{this.onmessage(t.uint8s,0)};let s=null,n=f.dataTransportMgr.monitorlogfn;if(l&&n){var d;let t=new i.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});s=t.timeoutReport.bind(t)}h=new o.a(r,t,s),e.consumer=h,l?h.consume(l,c):this.reciver=()=>{h.consumeAll(c)}}}setMsgPort(t){t!=this.port&&(this.port&&(this.port.onmessage=u,this.port.close(),this.port=null),this.port=t,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(t,e){if(null!=t&&t.sab){let{sab:e,useCopy:s,interval:n,offset:r,length:i,useOneElement:a}=t,h=new o.b(r>0?e.buffer:e,void 0,void 0,!!a,r,i,r>0?e:null);this.sab.sender={sabqueue:h,interval:n,useCopy:s,offset:r}}if(null!=e&&e.sab){var s;let{sab:t,useCopy:n,interval:r,offset:i,length:a,useOneElement:h}=e,c=new o.b(i>0?t.buffer:t,void 0,void 0,!!h,i,a,i>0?t:null),{consumer:l}=(null===(s=this.sab)||void 0===s?void 0:s.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:c,interval:r,useCopy:n,offset:i}}this.createSendAndReceive()}setStatus(t){this.port?this.status!=t&&(this.status=t,this.port.postMessage({cmd:a.L,data:t})):console.error("MsgQueueSocket not initialized")}}class f{constructor(t){this.onmessage=u,this.onopen=u,this.onclose=u,this.connect_type=t.connect_type||f.UDP,this.type=t.type,this.id=t.id||Math.floor(performance.now())<<10|t.type,this.sock=t.sock||new d,this.mgr=t.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=t.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=h.b.NO_THREAD,this.local=!!t.local,this._create()}_create(){let t=f.dataTransportMgr;t.transportlists.push(this),!this.local&&t&&t.mainThread&&t.type==c.a.THREAD_SUB&&t.createRemoteTransport(this,t.mainThread)}_close(){let t=f.dataTransportMgr,e=t.transportlists.indexOf(this);-1!=e&&t.transportlists.splice(e,1),!this.local&&t&&t.mainThread&&t.type==c.a.THREAD_SUB&&t.closeRemoteTransport(this,t.mainThread)}_onmessage(t,e){this.onmessage(t,e)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(t){this.sock.send(t)}sendVideo(t,e){this.sock.sendVideo(t,e)}sendWasmData(t){this.sock.sendWasm(t)}setSocket(t){let e=this.sock;this.sock=t,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),e&&e.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(t){if(!(this.sock instanceof _))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(t)}setSabBuffer(t,e){if(!(this.sock instanceof _))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(t,e)}setStatus(t){this.sock instanceof _&&this.sock.setStatus(t)}}r()(f,"UDP",0),r()(f,"TCP",1),r()(f,"RLB_UDP",2),r()(f,"dataTransportMgr",null);class p{constructor(t){this.sock=null,this.onmessage=u}isReady(){return!1}send(){u()}setStatus(t){0}}function m(t,e,s,n){var r;null===(r=c.a.monitorlogfn)||void 0===r||r.call(c.a,t,"".concat(e,",").concat(s,",").concat(n))}},function(t,e,s){var n=s(34);t.exports=function(t,e,s){return(e=n(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,s){"use strict";s.d(e,"p",(function(){return n})),s.d(e,"b",(function(){return r})),s.d(e,"c",(function(){return i})),s.d(e,"d",(function(){return o})),s.d(e,"i",(function(){return a})),s.d(e,"j",(function(){return h})),s.d(e,"k",(function(){return c})),s.d(e,"q",(function(){return l})),s.d(e,"r",(function(){return u})),s.d(e,"s",(function(){return d})),s.d(e,"l",(function(){return _})),s.d(e,"n",(function(){return f})),s.d(e,"e",(function(){return p})),s.d(e,"m",(function(){return m})),s.d(e,"o",(function(){return b})),s.d(e,"g",(function(){return g})),s.d(e,"h",(function(){return v})),s.d(e,"a",(function(){return E})),s.d(e,"f",(function(){return y}));const n=1,r=2,i=3,o=4,a=5,h=6,c=7,l=8,u=9,d=10,_=11,f=129,p=130,m=131,b=132,g=133,v=134,E=135,y=136},,function(t,e,s){"use strict";s.d(e,"a",(function(){return i})),s.d(e,"b",(function(){return o}));var n=s(7),r=s.n(n);class i{constructor(){this.onmessage=()=>{}}addEventListener(){}close(){}}class o{constructor(t){this.transportMap={},this.netthreadworker=null,this.type=t.type,this.mgr=t,this.transportlistsChnagelinster=[]}addEventListener(t){-1==this.transportlistsChnagelinster.indexOf(t)&&this.transportlistsChnagelinster.push(t)}removeEventListener(t){let e=this.transportlistsChnagelinster.indexOf(t);-1!=e&&this.transportlistsChnagelinster.splice(e,1)}addTransport(t,e){t.id in this.transportMap||(this.transportMap[t.id]=t,this.transportlistsChnagelinster.forEach(s=>{s(t,e,1)}))}removeTransport(t){var e;let s=t.id;s in this.transportMap&&(delete this.transportMap[s],null===(e=t.sock)||void 0===e||e.close(),this.transportlistsChnagelinster.forEach(e=>{e(t,t.channel,0)}))}getTransportByType(t){for(let e in this.transportMap){let s=this.transportMap[e],n=s.target_thread==o.SELF_THREAD;if(s.type==t&&n)return s}return null}}r()(o,"NO_THREAD",0),r()(o,"SELF_THREAD",1)},function(t,e,s){"use strict";function n(){this.a=[],this.b=0,this.residue=null}n.prototype.getLength=function(){return this.a.length-this.b},n.prototype.isEmpty=function(){return 0==this.a.length},n.prototype.enqueue=function(t){this.a.push(t)},n.prototype.dequeue=function(){if(0!=this.a.length){var t=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),t}return null},n.prototype.peek=function(){return 0{const t={};for(const e in r)t[r[e]]="WCL_"+e})(),{[r.AUDIO_ENCODE]:"audio.encode",[r.AUDIO_DECODE]:"audio.decode",[r.VIDEO_ENCODE]:"video.encode",[r.VIDEO_DECODE]:"video.decode",[r.SHARING_ENCODE]:"share.encode",[r.SHARING_DECODE]:"share.decode"})},function(t,e,s){"use strict";s.d(e,"b",(function(){return c})),s.d(e,"a",(function(){return l}));var n=s(7),r=s.n(n),i=s(5),o=s(10),a=s(6),h=s(22);function c(t,e,s){if(!t)return;let n=a.a.dataTransportMgr;n.type===l.THREAD_MAIN?(n.setSabBuffer(t,e,s),t.remote.postMessage({cmd:i.gb,transportId:t.id,sender:s,reciver:e})):(t.setSabBuffer(e,s),n.mainThread.postMessage({cmd:i.gb,transportId:t.id,sender:s,reciver:e}))}class l{constructor(t){let e=t||{};this.type=e.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=e.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new o.b(this)}_onrecvmainthreadlistener(t){let{cmd:e,transportId:s,data:n}=t.data,r=this.transportlists.find(t=>t.id===s);if(r||e==i.s)switch(e){case i.s:this.addRemoteTransport(t.data,null);break;case i.fb:r.setMsgPort(n||new o.a);break;case i.gb:r.setSabBuffer(t.data.sender,t.data.reciver);break;case i.o:r.remote=null,this.removeTransport(r)}}_onrecvsubthreadlistener(t,e){let{cmd:s,transportId:n,transportType:r}=e.data,o=this.transportlists.find(t=>t.id===n);switch(s){case i.s:this.addRemoteTransport(e.data,t);break;case i.gb:this.setSabBufferInfo(o,e.data.sender,e.data.reciver);break;case i.o:o.remote=null,this.removeTransport(o)}}createRemoteTransport(t,e){let s={cmd:i.s,transportType:t.type,transportId:t.id};t.portInfo?(s.port=t.portInfo,e.postMessage(s,[t.portInfo])):e.postMessage(s)}closeRemoteTransport(t,e){e.postMessage({cmd:i.o,transportType:t.type,transportId:t.id})}setRemoteTransportSABBUffer(t,e){var s,n,r,o;(null!==(s=t.sabInfo)&&void 0!==s&&s.sender||null!==(n=t.sabInfo)&&void 0!==n&&n.reciver)&&e.postMessage({cmd:i.gb,transportId:t.id,sender:null===(r=t.sabInfo)||void 0===r?void 0:r.sender,reciver:null===(o=t.sabInfo)||void 0===o?void 0:o.reciver})}addRemoteTransport(t,e){let{transportId:s,port:n,transportType:r}=t;let i=this.createMsgSocketTransport(r);i.id=s,i.remote=e,i.portInfo=n,n?i.setMsgPort(i.portInfo):this.bindMessageChannel(i),this.addTransport(i)}addTransport(t){let e=this.getChannelByTransportType(t.type);if(!e)return;let s=e.target_thread||o.b.SELF_THREAD;t.target_thread=s,this.bindTransPortForChannel(t,e)}removeTransport(t){let e=this.transportlists.indexOf(t);-1!=e&&(this.transportlists.splice(e,1),t.remote&&this.closeRemoteTransport(t,t.remote),t.target_thread!=o.b.NO_THREAD&&this.unbindTransPortForChannel(t))}createMsgSocketTransport(t){let e=null;return e=new a.a({mgr:this,sock:new a.d,type:t,local:!0}),e}bindMessageChannel(t){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let e=new MessageChannel;t.portInfo=e.port1,t.remote.postMessage({cmd:i.fb,transportId:t.id,data:e.port2},[e.port2])}setSabBufferInfo(t,e,s){this.type==l.THREAD_MAIN?(t.sabInfo||(t.sabInfo={}),s&&(s.useCopy=!0),e&&(e.useCopy=!0),t.sabInfo={sender:e,reciver:s},t.target_thread!=o.b.NO_THREAD&&(t.target_thread!=o.b.SELF_THREAD?this.setRemoteTransportSABBUffer(t,t.target_thread):t.setSabBuffer(e,s))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(t){if(t instanceof h.a){try{this.checkTransport(t)}catch(t){console.error("addDataChannel error",t)}this.channellists.push(t)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(t){if(!(t instanceof h.a))return void console.error("channel must be a DataChannelWrapper");let e=this.channellists.indexOf(t);-1!==e&&this.channellists.splice(e,1)}removeTransportByRemote(t){let e=[];for(let s=0;s{if(!t.transportlists.includes(e.type))return;let s=t.target_thread||o.b.SELF_THREAD;s==e.target_thread||(this.type==l.THREAD_MAIN&&e.target_thread!=o.b.NO_THREAD&&e.target_thread!=s&&(this.unbindTransPortForChannel(e),this.bindMessageChannel(e)),e.target_thread=s,this.bindTransPortForChannel(e,t))})}bindTransPortForChannel(t,e){t.channel=e;let s=t.target_thread;if(s!=o.b.SELF_THREAD)this.createRemoteTransport(t,s),this.setRemoteTransportSABBUffer(t,s);else{var n,r,i,a;if(t.portInfo&&t.setMsgPort(t.portInfo),null!==(n=t.sabInfo)&&void 0!==n&&n.sender||null!==(r=t.sabInfo)&&void 0!==r&&r.reciver)t.setSabBuffer(null===(i=t.sabInfo)||void 0===i?void 0:i.sender,null===(a=t.sabInfo)||void 0===a?void 0:a.reciver);this.mediadatachannel.addTransport(t,e)}}unbindTransPortForChannel(t){t.target_thread!=o.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(t,t.target_thread):this.mediadatachannel.removeTransport(t)}getChannelByTransportType(t){for(let e=0;ethis.max_timeout&&(this.max_timeout=t),t{s._report(),s._timeoutid=0},this.interval_report_time)}}class o extends class{constructor(t){this._tag=t.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,t.timeout||0),this._callback=t.callback}_report(){let t=Date.now(),e=this.getSamples(t);e||(e=[]);let s="".concat(this._base_time,":").concat(t-this._base_time,":").concat(e.join("|"));this._callback&&this._callback(this._tag,s)}getSamples(t){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(t){super(t),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(t){return[this._count]}}},,function(t,e,s){"use strict";const n=t=>0==(t&t-1);let r=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(t,e){this._instance=t,this.fixVersion=e}getMessageFromErrorOrEvent(t,e){let s=t;return e instanceof ErrorEvent?(e.filename&&(s+=" File: ".concat(e.filename)),(e.lineno||e.colno)&&(s+=" Line: ".concat(e.lineno,":").concat(e.colno)),e.message&&(s+=" Message: ".concat(e.message)),e.error&&(s+="\nStack: ".concat(e.error.stack))):e instanceof Error?(e.fileName&&(s+=" File: ".concat(e.fileName)),(e.lineNumber||e.columnNumber)&&(s+=" Line: ".concat(e.lineNumber,":").concat(e.columnNumber)),e.message&&(s+=" Message: ".concat(e.message)),e.stack&&(s+=" Stack: ".concat(e.stack)),e.name&&(s+=" Name: ".concat(e.name)),e.constraint&&(s+=" Constraint: ".concat(e.constraint))):e instanceof CloseEvent?(e.code&&(s+=" Code: ".concat(e.code)),e.reason&&(s+=" Reason: ".concat(e.reason)),s+=" wasClean: ".concat(e.wasClean)):e instanceof DOMException?(e.message&&(s+=" Message: ".concat(e.message)),e.name&&(s+=" Name: ".concat(e.name))):s+=e?e.toString():"",s}error(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t=this.getMessageFromErrorOrEvent(t,e),this._highFrequencyLogs[t]?this._highFrequencyLogs[t]+=1:this._highFrequencyLogs[t]=1;const s=n(this._highFrequencyLogs[t]);this._instance&&s&&this._instance.error(t,[this.fixVersion])}severityerror(t,e){this._instance&&this._instance.error(JSON.stringify(t),e)}directReport(t,e){var s,n;this._instance&&(e||(e=["MEDIASDK_INFO"]),null===(s=(n=this._instance).directReport)||void 0===s||s.call(n,{msg:t},e))}warn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t=this.getMessageFromErrorOrEvent(t,e),this._instance&&this._instance.warn(t)}log(t){this._instance&&this._instance.log(t)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};e.a=r},function(t,e,s){"use strict";s.d(e,"b",(function(){return i})),s.d(e,"a",(function(){return o})),s.d(e,"c",(function(){return a}));var n=s(11),r=s(16);class i{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t.byteLength,o=arguments.length>6?arguments[6]:void 0;this.offset=r,this._BYTES_PER_ELEMENT=e,this.capacity=(i-8)/e,this.usableCapacity=this.capacity-1,this.buf=t,this.write_ptr=new Uint32Array(this.buf,r,1),this.read_ptr=new Uint32Array(this.buf,r+4,1),this.storageUint8sByteOffset=r+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,i-8),this.byteLength=i,this.label=s,this.usingOneElementBuffer=n,o&&(this.wasmMemory=o),n&&(this.oneElementBuffer=new ArrayBuffer(e)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(t){return this.available_write()>0&&this.push(t),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new n.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let t=this.dataBuffer.dequeue();t&&this.push(t)}let i=this.dataBuffer.getLength();if(t){if(this.available_write()>0&&0==i)return this.push(t),!0;if(!e)return!1;this.dataBuffer.enqueue(t),++i}if(i>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),i>=1e3&&(r.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),s&&s("vqslclear")),i>0&&s){let t=performance.now();(!this.monitorpace||t-this.monitorpace>2e4)&&(this.monitorpace=t,s&&s("vqsl"+i))}return!0}push(t){return t instanceof Array?this._pushArray(t):this._push(t)}_pushArray(t){var e=Atomics.load(this.write_ptr,0);this.checkBuffer();let s=0;t.forEach(t=>{this.storageUint8s.set(t,e*this._BYTES_PER_ELEMENT+8+4+s),s+=t.byteLength}),new Uint32Array(this.buf,this.offset+e*this._BYTES_PER_ELEMENT+8,1)[0]=s;let n=(e+1)%this.capacity;return Atomics.store(this.write_ptr,0,n),!0}_push(t){var e=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(t,e*this._BYTES_PER_ELEMENT+8+4,t.byteLength),new Uint32Array(this.buf,this.offset+e*this._BYTES_PER_ELEMENT+8,1)[0]=t.byteLength;let s=(e+1)%this.capacity;return Atomics.store(this.write_ptr,0,s),!0}addReadPtr(){var t=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(t+1)%this.capacity)}dequeue(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e=Atomics.load(this.read_ptr,0);this.checkBuffer();let s,n,r,i=new Uint32Array(this.buf,this.offset+e*this._BYTES_PER_ELEMENT+8,1);if(t){s=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,i[0]):new Uint8Array(i[0]);let t=new Uint8Array(this.storageUint8s.buffer,e*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,s.byteLength);s.set(t,0)}else s=this.storageUint8s.subarray(e*this._BYTES_PER_ELEMENT+8+4,e*this._BYTES_PER_ELEMENT+8+4+i[0]),n=e*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r=e*this._BYTES_PER_ELEMENT+8+4+i[0]+this.storageUint8sByteOffset;return t&&Atomics.store(this.read_ptr,0,(e+1)%this.capacity),t?s:{bCopyData:t,uint8s:s,begin:n,end:r}}available_read(){var t=Atomics.load(this.read_ptr,0),e=Atomics.load(this.write_ptr,0);return this._available_read(t,e)}available_write(){var t=Atomics.load(this.read_ptr,0),e=Atomics.load(this.write_ptr,0);return this._available_write(t,e)}is_available_write(){var t=Atomics.load(this.read_ptr,0),e=Atomics.load(this.write_ptr,0);return this._is_available_write(t,e)}_available_read(t,e){return(e+this.capacity-t)%this.capacity}_available_write(t,e){return this.usableCapacity-this._available_read(t,e)}_is_available_write(t,e){return this._available_write(t,e)>0}_storage_capacity(){return this.capacity}}class o{constructor(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(t instanceof i))throw new Error("RingBuffer required");this.rb=t,this.dataCallback=e,this.interval=null,this.requestID=null,this.timeout_call=s,this.tick_lasted_time=0,this.timeoutMS=n,this.maxCount=r}setDataCallback(t){this.dataCallback=t}consume(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=e,this.interval=setInterval(()=>{let t=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let e=t-this.tick_lasted_time;e>=this.timeoutMS&&this.timeout_call(e,t)}this.tick_lasted_time=t}this._dequeue()},t),console.log("consume interval ".concat(this.interval)))}consumeAll(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=t,this._dequeue()}_dequeue(){let t=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=t,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class a{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(t){this.obj=t,this.yuvUint8s=t.data}setBuffer(t){!1===t.bCopyData?(this.objUint8s=t.uint8s,this.bCopyData=t.bCopyData,this.begin=t.begin,this.end=t.end):(this.objUint8s=t,this.bCopyData=!0,this.begin=0,this.end=t.byteLength)}buffer2Obj(){let t=new Uint32Array(this.objUint8s.buffer,this.begin,9),e=new DataView(this.objUint8s.buffer,this.begin+40,16),s={};this.keysList.forEach((e,n)=>{s[e]=t[n]}),s[this.timeStampKey]=Number(e.getBigUint64(0,!0));let n,r=Number(e.getBigUint64(8,!0)),i=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,r);return n=(this.bCopyData,i),s.data=n,s}obj2buffer(){let t=new Uint8Array(56),e=this.keysList,s=new Uint32Array(t.buffer,0,9),n=new DataView(t.buffer,40,16);return e.forEach((t,e)=>{s[e]=this.obj[t]}),n.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),n.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[t,this.yuvUint8s]}}},,,,,function(t,e,s){"use strict";var n=s(7),r=s.n(n),i=s(14);function o(t){let e=t||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=e.interval||3e4,this._customer_callback=e.report_call,this._tag=e.tag||"netreport",this._group_interval=e.group_interval||1e3,this._enable_advanced=e.advanced||!1,this._current_count=0,this._qos_report=new i.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}o.prototype._qos_report_timeout=function(t,e,s,n){if(this._customer_callback){let r="".concat(t,",").concat(e,",").concat(s,",").concat(n);this._customer_callback(this._tag+"TimeOut",r)}},o.prototype._report=function(){let t=(new Date).getTime(),e="".concat(t,"-").concat(this._samples.length,"-").concat(this._samples),s="".concat(t,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);e=e.replaceAll(",","|"),s=s.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,e),this._enable_advanced&&this._customer_callback(this._tag+"QOS",s)):console.error("tag:".concat(this._tag,",").concat(e))},o.prototype._group=function(){let t=performance.now();if(t>=this._lasted_group_time+1700){let e=Math.round((t-this._lasted_group_time)/1e3)-1;for(let t=0;t=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=t,this._report(),this._samples=[],this._qos_report_samples=[])},o.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},o.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},o.prototype.sample=function(t){if(this._enable&&(this._current_count++,this._enable_advanced)){if(i.c.IsQosReport(t))return void this._cureen_qos_report++;if(i.c.IsVideoPkg(t)){let e=i.c.GetQOSTime(t),s=performance.now();if(this._lasted_qos_ts){let t=s-this._lasted_sys_ts-(e-this._lasted_qos_ts);t>30&&this._qos_report.timeoutReport(t,s)}this._lasted_qos_ts=e,this._lasted_sys_ts=s,this._lasted_data=t}}};var a=s(8),h=s(12),c=s(5);s.d(e,"b",(function(){return l})),s.d(e,"a",(function(){return u}));class l{constructor(t,e){this.type=t,this.transportlists=[],this.transfered=!!e,this.onmessage=()=>{}}send(){}isReady(){return!1}}class u{constructor(t,e,s,n){this.id=t,this.type=e,this.datachannel=s,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=u.UNINIT,this.target_thread=n,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===u.CONNECTED}send(t){this.datachannel.send(t),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:a.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(t){this.target_thread=null}this._addEventListener()}close(){let t=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:a.a,id:this.id,type:this.type})),this._status!=u.DISCONNECT&&this._clear(),this._status=u.DISCONNECT,null==t||t()}onmessage(t){this.onmessageFn=t}onopen(t){this.connectedFn=t}onclose(t){this.disconnectedFn=t}onerror(t){this.errorFn=t}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==u.UNINIT&&this._onopen()}_onmessage(t){this._recv_statistic.sample(!1),this.onmessageFn(t)}_onopen(t){let e=this._status;var s;(this._status=u.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new o({tag:this.type==h.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new o({tag:this.type==h.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),e!=u.CONNECTED)&&(null===(s=this.connectedFn)||void 0===s||s.call(this))}_onerror(t){var e;null===(e=this.errorFn)||void 0===e||e.call(this,t),this._onclose(t)}_onclose(t){let e=this._status;this._status=u.DISCONNECT;let s=this.disconnectedFn;this._clear(),e!=u.DISCONNECT&&(null==s||s())}_clear(){var t,e;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let s=this.datachannel;this.datachannel=null,null===(t=this._send_statistic)||void 0===t||t.stop(),null===(e=this._recv_statistic)||void 0===e||e.stop(),null==s||s.close()}_mesagelistener(t){let e=t.data;if(e&&e.id==this.id)switch(e.cmd){case c.A:this._onclose();break;case c.C:this._onopen();break;case c.B:this._onerror(e.ev);break;case c.H:this.report_monitor_func(e.tag,e.data)}}}r()(u,"UNINIT",0),r()(u,"CONNECTED",1),r()(u,"DISCONNECT",2)},function(t,e,s){"use strict";s.d(e,"d",(function(){return o})),s.d(e,"b",(function(){return a})),s.d(e,"c",(function(){return c})),s.d(e,"e",(function(){return l})),s.d(e,"a",(function(){return u}));var n=s(12),r=s(6),i=s(13);function o(t){return new r.a({sock:new r.d,type:t,local:!1})}function a(t){try{const e="undefined"!=typeof DedicatedWorkerGlobalScope;if(r.a.dataTransportMgr)return;let s=new i.a({type:e?i.a.THREAD_SUB:i.a.THREAD_MAIN,remote:e?self:null});r.a.dataTransportMgr=s,s.monitorlogfn=t,e&&self.addEventListener("message",s._onrecvmainthreadlistener.bind(s))}catch(t){console.error("<<<< InitDataTransportModule",t)}}function h(t){return r.a.dataTransportMgr.getTransportByType(t)}function c(t){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.addDataChannel(t)}function l(t){if(!r.a.dataTransportMgr)throw new Error("not InitDataTransportModule");r.a.dataTransportMgr.removeDataChannel(t)}class u{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var t;t=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(t)}remoteTransportListener(){var t;t=this._listener,r.a.dataTransportMgr.addTransportListChangeListener(t)}_listenerfn(t,e,s){this.connectSession(e)}setVideoShareModel(t){this.isSupportVideoShare=t}connectSession(t){const{type:e}=t;!t.transfered&&t.isReady()&&(e==n.a.VIDEO&&this.connectVideoSession(t),e==n.a.AUDIO&&this.connectAudioSession(t))}disconnectSession(t){const{type:e}=t;t.transfered||(e==n.a.VIDEO&&this.connectVideoSession(t),e==n.a.AUDIO&&this.connectAudioSession(t))}connectVideoSession(t){let e=new r.c,s=h(r.e.VIDEO_ENCODE)||e,n=h(r.e.VIDEO_DECODE)||e,i=h(r.e.SHARR_DECODE)||e,o=(null==t?void 0:t.isReady())?r.b.OPEN:r.b.CLOSED;s.setStatus(o),n.setStatus(o),this.isSupportVideoShare||i.setStatus(o),t.onmessage(t=>{var e=new Uint8Array(t.data);if((104==e[0]||132==e[0])&&0==e[1]||20==e[0]||130==e[0])s.send(e);else{if(!this.isSupportVideoShare&&(133==e[0]||132==e[0]))return void i.send(e);n.send(e)}});const a=e=>{t.send(e)};s.onmessage=a,n.onmessage=a,i.onmessage=a}connectAudioSession(t){let e=new r.c,s=h(r.e.AUDIO_ENCODE)||e,n=h(r.e.AUDIO_DECODE)||e,i=t.isReady()?r.b.OPEN:r.b.CLOSED;s.setStatus(i),n.setStatus(i),t.onmessage(t=>{var e=new Uint8Array(t.data);108==e[0]&&0==e[1]?s.send(e):n.send(e)});const o=e=>{t.send(e)};s.onmessage=o,n.onmessage=o}notifyTransportStatus(t,e){}}},function(t,e){function s(e){return t.exports=s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,s(e)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,s){"use strict";s.d(e,"a",(function(){return o}));var n=s(7),r=s.n(n),i=s(5);function o(t){a.instance||(a.instance=new a),a.instance.start(t)}class a{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(t,e)=>{}}setTimeoutCallback(t){this.timeoutcallbackfn=t}registerWorker(t,e){if(t in this.monitorworkers){let e=this.monitorworkers[t];e.worker.removeEventListener("message",e.listener),delete this.monitorworkers[t]}let s={id:t,worker:e},n=this._recvheartbeat.bind(this,s);s.listener=n,s.lastedtimestamp=Date.now(),s.worker.addEventListener("message",s.listener),this.monitorworkers[t]=s}unRegisterWorker(t){if(!(t in this.monitorworkers))return;let e=this.monitorworkers[t];delete this.monitorworkers[t],e.worker.removeEventListener("message",e.listener)}_recvheartbeat(t,e){let s=e.data;s.cmd===i.Db&&(t.lastedtimestamp=s.timestamp)}start(t){const e="undefined"!=typeof DedicatedWorkerGlobalScope&&t&&t instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(e)return void(this._interval=setInterval(()=>{t.postMessage({cmd:i.Db,timestamp:Date.now()})},a.INTREVAL_TIME_MS));const s=Math.max(a.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let t=a.instance,e=Object.keys(t.monitorworkers),n=Date.now(),r=this._lasted_timestamp;nr+a.HEART_TIMEOUT_MS?t.timeoutcallbackfn("MAIN",n-r):e.forEach(e=>{var s;let r=t.monitorworkers[e],i=r.lastedtimestamp+(null!==(s=document)&&void 0!==s&&s.hidden?a.MAX_HEART_TIMEOUT_MS:a.HEART_TIMEOUT_MS);n>i&&(t.timeoutcallbackfn(r.id,n-r.lastedtimestamp),r.lastedtimestamp=n)}))},a.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(t=>{let e=this.monitorworkers[t];delete this.monitorworkers[t],e.worker.removeEventListener("message",e.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(t){}}}r()(a,"INTREVAL_TIME_MS",3e3),r()(a,"HEART_TIMEOUT_MS",15e3),r()(a,"MAX_HEART_TIMEOUT_MS",3e4),r()(a,"instance",null)},,,,,,,,,function(t,e,s){var n=s(24).default,r=s(35);t.exports=function(t){var e=r(t,"string");return"symbol"===n(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,s){var n=s(24).default;t.exports=function(t,e){if("object"!==n(t)||null===t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var r=s.call(t,e||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,s){"use strict";s.r(e);var n=s(22),r=s(8),i=s(5),o=s(23),a=s(25);let h="undefined"!=typeof RTCDataChannel;postMessage([h]),Object(o.b)((function(t,e){if(!c.length)return;f(c[0],t,data)})),Object(a.a)(self);self.onmessage=t=>{let e=t.data;switch(e.command){case r.f:p.setVideoShareModel(e.data);break;case r.h:!function(t,e,s,r){let i=new n.a(t,e,s,null);i.transportlists=r,i.open(),i.onmessage(l),i.onopen(u.bind(null,i)),i.onclose(_.bind(null,i)),i.onerror(d.bind(null,i)),i.report_monitor_func=f.bind(null,i),c.push(i)}(e.id,e.type,e.channel,e.transportlists);break;case r.a:!function(t){let e=c.findIndex(e=>e.id==t);if(-1==e)return;let[s]=c.splice(e,1);s.close(),Object(o.e)(s)}(e.id)}};let c=[];function l(t){}function u(t,e){postMessage({cmd:i.C,id:t.id}),t.isReady()&&(Object(o.c)(t),p.connectSession(t))}function d(t,e){postMessage({cmd:i.B,id:t.id,ev:e}),p.disconnectSession(new n.b(t.type,t.transfered)),Object(o.e)(t)}function _(t,e){postMessage({cmd:i.A,id:t.id}),p.disconnectSession(new n.b(t.type,t.transfered)),Object(o.e)(t)}function f(t,e,s){postMessage({cmd:i.H,id:t.id,tag:e,data:s})}let p=new o.a;p.addTransportListiner()}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/net_thread.min.js-8dda81762f5af41a3003.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/pako.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/pako.min.js new file mode 100644 index 0000000..35572be --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/pako.min.js @@ -0,0 +1,2 @@ +(window.webpackJsonpJsMediaSDK_Instance=window.webpackJsonpJsMediaSDK_Instance||[]).push([[2],{104:function(t,e,a){"use strict";a.r(e),a.d(e,"Deflate",(function(){return $e})),a.d(e,"Inflate",(function(){return na})),a.d(e,"constants",(function(){return oa})),a.d(e,"default",(function(){return la})),a.d(e,"deflate",(function(){return ta})),a.d(e,"deflateRaw",(function(){return ea})),a.d(e,"gzip",(function(){return aa})),a.d(e,"inflate",(function(){return ia})),a.d(e,"inflateRaw",(function(){return sa})),a.d(e,"ungzip",(function(){return ra}));function n(t){let e=t.length;for(;--e>=0;)t[e]=0}const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=new Array(576);n(l);const h=new Array(60);n(h);const d=new Array(512);n(d);const _=new Array(256);n(_);const f=new Array(29);n(f);const c=new Array(30);function u(t,e,a,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let w,m,b;function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}n(c);const p=t=>t<256?d[t]:d[256+(t>>>7)],k=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},v=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<{v(t,a[2*e],a[2*e+1])},x=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},z=(t,e,a)=>{const n=new Array(16);let i,s,r=0;for(i=1;i<=15;i++)r=r+a[i-1]<<1,n[i]=r;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=x(n[e]++,e))}},A=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},E=t=>{t.bi_valid>8?k(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},R=(t,e,a,n)=>{const i=2*e,s=2*a;return t[i]{const n=t.heap[a];let i=a<<1;for(;i<=t.heap_len&&(i{let n,r,o,l,h=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+h++],n+=(255&t.pending_buf[t.sym_buf+h++])<<8,r=t.pending_buf[t.sym_buf+h++],0===n?y(t,r,e):(o=_[r],y(t,o+256+1,e),l=i[o],0!==l&&(r-=f[o],v(t,r,l)),n--,o=p(n),y(t,o,a),l=s[o],0!==l&&(n-=c[o],v(t,n,l)))}while(h{const a=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems;let r,o,l,h=-1;for(t.heap_len=0,t.heap_max=573,r=0;r>1;r>=1;r--)Z(t,a,r);l=s;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z(t,a,1),o=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=o,a[2*l]=a[2*r]+a[2*o],t.depth[l]=(t.depth[r]>=t.depth[o]?t.depth[r]:t.depth[o])+1,a[2*r+1]=a[2*o+1]=l,t.heap[1]=l++,Z(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,d,_,f,c,u,w=0;for(f=0;f<=15;f++)t.bl_count[f]=0;for(a[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)d=t.heap[h],f=a[2*a[2*d+1]+1]+1,f>l&&(f=l,w++),a[2*d+1]=f,d>n||(t.bl_count[f]++,c=0,d>=o&&(c=r[d-o]),u=a[2*d],t.opt_len+=u*(f+c),s&&(t.static_len+=u*(i[2*d+1]+c)));if(0!==w){do{for(f=l-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[l]--,w-=2}while(w>0);for(f=l;0!==f;f--)for(d=t.bl_count[f];0!==d;)_=t.heap[--h],_>n||(a[2*_+1]!==f&&(t.opt_len+=(f-a[2*_+1])*a[2*_],a[2*_+1]=f),d--)}})(t,e),z(a,h,t.bl_count)},D=(t,e,a)=>{let n,i,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)i=r,r=e[2*(n+1)+1],++o{let n,i,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),n=0;n<=a;n++)if(i=r,r=e[2*(n+1)+1],!(++o{v(t,0+(n?1:0),3),E(t),k(t,a),k(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a};var F={_tr_init:t=>{O||((()=>{let t,e,a,n,o;const g=new Array(16);for(a=0,n=0;n<28;n++)for(f[n]=a,t=0;t<1<>=7;n<30;n++)for(c[n]=o<<7,t=0;t<1<{let i,s,r=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),S(t,t.l_desc),S(t,t.d_desc),r=(t=>{let e;for(D(t,t.dyn_ltree,t.l_desc.max_code),D(t,t.dyn_dtree,t.d_desc.max_code),S(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*o[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=i&&(i=s)):i=s=a+5,a+4<=i&&-1!==e?I(t,e,a,n):4===t.strategy||s===i?(v(t,2+(n?1:0),3),U(t,l,h)):(v(t,4+(n?1:0),3),((t,e,a,n)=>{let i;for(v(t,e-257,5),v(t,a-1,5),v(t,n-4,4),i=0;i(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=a,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(_[a]+256+1)]++,t.dyn_dtree[2*p(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{v(t,2,3),y(t,256,l),(t=>{16===t.bi_valid?(k(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var L=(t,e,a,n)=>{let i=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{i=i+e[n++]|0,s=s+i|0}while(--r);i%=65521,s%=65521}return i|s<<16|0};const N=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var B=(t,e,a,n)=>{const i=N,s=n+a;t^=-1;for(let a=n;a>>8^i[255&(t^e[a])];return-1^t},C={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},M={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:H,_tr_stored_block:K,_tr_flush_block:j,_tr_tally:P,_tr_align:Y}=F,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:J,Z_FULL_FLUSH:X,Z_FINISH:W,Z_BLOCK:q,Z_OK:Q,Z_STREAM_END:V,Z_STREAM_ERROR:$,Z_DATA_ERROR:tt,Z_BUF_ERROR:et,Z_DEFAULT_COMPRESSION:at,Z_FILTERED:nt,Z_HUFFMAN_ONLY:it,Z_RLE:st,Z_FIXED:rt,Z_DEFAULT_STRATEGY:ot,Z_UNKNOWN:lt,Z_DEFLATED:ht}=M,dt=(t,e)=>(t.msg=C[e],e),_t=t=>2*t-(t>4?9:0),ft=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ct=t=>{let e,a,n,i=t.w_size;e=t.hash_size,n=e;do{a=t.head[--n],t.head[n]=a>=i?a-i:0}while(--e);e=i,n=e;do{a=t.prev[--n],t.prev[n]=a>=i?a-i:0}while(--e)};let ut=(t,e,a)=>(e<{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},mt=(t,e)=>{j(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,wt(t.strm)},bt=(t,e)=>{t.pending_buf[t.pending++]=e},gt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},pt=(t,e,a,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),a),1===t.state.wrap?t.adler=L(t.adler,e,i,a):2===t.state.wrap&&(t.adler=B(t.adler,e,i,a)),t.next_in+=i,t.total_in+=i,i)},kt=(t,e)=>{let a,n,i=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+258;let c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(i>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&sr){if(t.match_start=e,r=n,n>=o)break;c=h[s+r-1],u=h[s+r]}}}while((e=_[e&d])>l&&0!=--i);return r<=t.lookahead?r:t.lookahead},vt=t=>{const e=t.w_size;let a,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),ct(t),n+=e),0===t.strm.avail_in)break;if(a=pt(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=ut(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=ut(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},yt=(t,e)=>{let a,n,i,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,i=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(a=n+t.strm.avail_in),a>i&&(a=i),a>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,wt(t.strm),n&&(n>a&&(n=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,a-=n),a&&(pt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a)}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_wateri&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(pt(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,s=i>t.w_size?t.w_size:i,n=t.strstart-t.block_start,(n>=s||(n||e===W)&&e!==G&&0===t.strm.avail_in&&n<=i)&&(a=n>i?i:n,r=e===W&&0===t.strm.avail_in&&a===n?1:0,K(t,t.block_start,a,r),t.block_start+=a,wt(t.strm)),r?3:1)},xt=(t,e)=>{let a,n;for(;;){if(t.lookahead<262){if(vt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=ut(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-262&&(t.match_length=kt(t,a)),t.match_length>=3)if(n=P(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=ut(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ut(t,t.ins_h,t.window[t.strstart+1]);else n=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===W?(mt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(mt(t,!1),0===t.strm.avail_out)?1:2},zt=(t,e)=>{let a,n,i;for(;;){if(t.lookahead<262){if(vt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=ut(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=P(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=ut(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(mt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=P(t,0,t.window[t.strstart-1]),n&&mt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=P(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===W?(mt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(mt(t,!1),0===t.strm.avail_out)?1:2};function At(t,e,a,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=i}const Et=[new At(0,0,0,0,yt),new At(4,4,8,4,xt),new At(4,5,16,8,xt),new At(4,6,32,32,xt),new At(4,4,16,16,zt),new At(8,16,32,32,zt),new At(8,16,128,128,zt),new At(8,32,128,256,zt),new At(32,128,258,1024,zt),new At(32,258,258,4096,zt)];function Rt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ht,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ft(this.dyn_ltree),ft(this.dyn_dtree),ft(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ft(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ft(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Zt=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||42!==e.status&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&113!==e.status&&666!==e.status?1:0},Ut=t=>{if(Zt(t))return dt(t,$);t.total_in=t.total_out=0,t.data_type=lt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=-2,H(e),Q},St=t=>{const e=Ut(t);var a;return e===Q&&((a=t.state).window_size=2*a.w_size,ft(a.head),a.max_lazy_match=Et[a.level].max_lazy,a.good_match=Et[a.level].good_length,a.nice_match=Et[a.level].nice_length,a.max_chain_length=Et[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e},Dt=(t,e,a,n,i,s)=>{if(!t)return $;let r=1;if(e===at&&(e=6),n<0?(r=0,n=-n):n>15&&(r=2,n-=16),i<1||i>9||a!==ht||n<8||n>15||e<0||e>9||s<0||s>rt||8===n&&1!==r)return dt(t,$);8===n&&(n=9);const o=new Rt;return t.state=o,o.strm=t,o.status=42,o.wrap=r,o.gzhead=null,o.w_bits=n,o.w_size=1<Dt(t,e,ht,15,8,ot),deflateInit2:Dt,deflateReset:St,deflateResetKeep:Ut,deflateSetHeader:(t,e)=>Zt(t)||2!==t.state.wrap?$:(t.state.gzhead=e,Q),deflate:(t,e)=>{if(Zt(t)||e>q||e<0)return t?dt(t,$):$;const a=t.state;if(!t.output||0!==t.avail_in&&!t.input||666===a.status&&e!==W)return dt(t,0===t.avail_out?et:$);const n=a.last_flush;if(a.last_flush=e,0!==a.pending){if(wt(t),0===t.avail_out)return a.last_flush=-1,Q}else if(0===t.avail_in&&_t(e)<=_t(n)&&e!==W)return dt(t,et);if(666===a.status&&0!==t.avail_in)return dt(t,et);if(42===a.status&&0===a.wrap&&(a.status=113),42===a.status){let e=ht+(a.w_bits-8<<4)<<8,n=-1;if(n=a.strategy>=it||a.level<2?0:a.level<6?1:6===a.level?2:3,e|=n<<6,0!==a.strstart&&(e|=32),e+=31-e%31,gt(a,e),0!==a.strstart&&(gt(a,t.adler>>>16),gt(a,65535&t.adler)),t.adler=1,a.status=113,wt(t),0!==a.pending)return a.last_flush=-1,Q}if(57===a.status)if(t.adler=0,bt(a,31),bt(a,139),bt(a,8),a.gzhead)bt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),bt(a,255&a.gzhead.time),bt(a,a.gzhead.time>>8&255),bt(a,a.gzhead.time>>16&255),bt(a,a.gzhead.time>>24&255),bt(a,9===a.level?2:a.strategy>=it||a.level<2?4:0),bt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(bt(a,255&a.gzhead.extra.length),bt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=B(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(bt(a,0),bt(a,0),bt(a,0),bt(a,0),bt(a,0),bt(a,9===a.level?2:a.strategy>=it||a.level<2?4:0),bt(a,3),a.status=113,wt(t),0!==a.pending)return a.last_flush=-1,Q;if(69===a.status){if(a.gzhead.extra){let e=a.pending,n=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+n>a.pending_buf_size;){let i=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>e&&(t.adler=B(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex+=i,wt(t),0!==a.pending)return a.last_flush=-1,Q;e=0,n-=i}let i=new Uint8Array(a.gzhead.extra);a.pending_buf.set(i.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending+=n,a.gzhead.hcrc&&a.pending>e&&(t.adler=B(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let e,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(t.adler=B(t.adler,a.pending_buf,a.pending-n,n)),wt(t),0!==a.pending)return a.last_flush=-1,Q;n=0}e=a.gzindexn&&(t.adler=B(t.adler,a.pending_buf,a.pending-n,n)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let e,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(t.adler=B(t.adler,a.pending_buf,a.pending-n,n)),wt(t),0!==a.pending)return a.last_flush=-1,Q;n=0}e=a.gzindexn&&(t.adler=B(t.adler,a.pending_buf,a.pending-n,n))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(wt(t),0!==a.pending))return a.last_flush=-1,Q;bt(a,255&t.adler),bt(a,t.adler>>8&255),t.adler=0}if(a.status=113,wt(t),0!==a.pending)return a.last_flush=-1,Q}if(0!==t.avail_in||0!==a.lookahead||e!==G&&666!==a.status){let n=0===a.level?yt(a,e):a.strategy===it?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(vt(t),0===t.lookahead)){if(e===G)return 1;break}if(t.match_length=0,a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===W?(mt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(mt(t,!1),0===t.strm.avail_out)?1:2})(a,e):a.strategy===st?((t,e)=>{let a,n,i,s;const r=t.window;for(;;){if(t.lookahead<=258){if(vt(t),t.lookahead<=258&&e===G)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=r[i],n===r[++i]&&n===r[++i]&&n===r[++i])){s=t.strstart+258;do{}while(n===r[++i]&&n===r[++i]&&n===r[++i]&&n===r[++i]&&n===r[++i]&&n===r[++i]&&n===r[++i]&&n===r[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=P(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===W?(mt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(mt(t,!1),0===t.strm.avail_out)?1:2})(a,e):Et[a.level].func(a,e);if(3!==n&&4!==n||(a.status=666),1===n||3===n)return 0===t.avail_out&&(a.last_flush=-1),Q;if(2===n&&(e===J?Y(a):e!==q&&(K(a,0,0,!1),e===X&&(ft(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),wt(t),0===t.avail_out))return a.last_flush=-1,Q}return e!==W?Q:a.wrap<=0?V:(2===a.wrap?(bt(a,255&t.adler),bt(a,t.adler>>8&255),bt(a,t.adler>>16&255),bt(a,t.adler>>24&255),bt(a,255&t.total_in),bt(a,t.total_in>>8&255),bt(a,t.total_in>>16&255),bt(a,t.total_in>>24&255)):(gt(a,t.adler>>>16),gt(a,65535&t.adler)),wt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?Q:V)},deflateEnd:t=>{if(Zt(t))return $;const e=t.state.status;return t.state=null,113===e?dt(t,tt):Q},deflateSetDictionary:(t,e)=>{let a=e.length;if(Zt(t))return $;const n=t.state,i=n.wrap;if(2===i||1===i&&42!==n.status||n.lookahead)return $;if(1===i&&(t.adler=L(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===i&&(ft(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(a-n.w_size,a),0),e=t,a=n.w_size}const s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,vt(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=ut(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,vt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,n.wrap=i,Q},deflateInfo:"pako deflate (from Nodeca project)"};const Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var It=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Ot(a,e)&&(t[e]=a[e])}}return t},Ft=t=>{let e=0;for(let a=0,n=t.length;a=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Nt[254]=Nt[254]=1;var Bt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,n,i,s,r=t.length,o=0;for(i=0;i>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e},Ct=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const s=new Array(2*a);for(i=0,n=0;n4)s[i++]=65533,n+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&n1?s[i++]=65533:e<65536?s[i++]=e:(e-=65536,s[i++]=55296|e>>10&1023,s[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Lt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Nt[t[a]]>e?a:e};var Ht=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Kt=Object.prototype.toString,{Z_NO_FLUSH:jt,Z_SYNC_FLUSH:Pt,Z_FULL_FLUSH:Yt,Z_FINISH:Gt,Z_OK:Jt,Z_STREAM_END:Xt,Z_DEFAULT_COMPRESSION:Wt,Z_DEFAULT_STRATEGY:qt,Z_DEFLATED:Qt}=M;function Vt(t){this.options=It({level:Wt,method:Qt,chunkSize:16384,windowBits:15,memLevel:8,strategy:qt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ht,this.strm.avail_out=0;let a=Tt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Jt)throw new Error(C[a]);if(e.header&&Tt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Bt(e.dictionary):"[object ArrayBuffer]"===Kt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Tt.deflateSetDictionary(this.strm,t),a!==Jt)throw new Error(C[a]);this._dict_set=!0}}function $t(t,e){const a=new Vt(e);if(a.push(t,!0),a.err)throw a.msg||C[a.err];return a.result}Vt.prototype.push=function(t,e){const a=this.strm,n=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?Gt:jt,"string"==typeof t?a.input=Bt(t):"[object ArrayBuffer]"===Kt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),(s===Pt||s===Yt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(i=Tt.deflate(a,s),i===Xt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),i=Tt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Jt;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},Vt.prototype.onData=function(t){this.chunks.push(t)},Vt.prototype.onEnd=function(t){t===Jt&&(this.result=Ft(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var te={Deflate:Vt,deflate:$t,deflateRaw:function(t,e){return(e=e||{}).raw=!0,$t(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,$t(t,e)},constants:M};var ee=function(t,e){let a,n,i,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;const E=t.state;a=t.next_in,z=t.input,n=a+(t.avail_in-5),i=t.next_out,A=t.output,s=i-(e-t.avail_out),r=i+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[i++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<>>=p,c-=p),c<15&&(f+=z[a++]<>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<o){t.msg="invalid distance too far back",E.mode=16209;break t}if(f>>>=p,c-=p,p=i-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=16209;break t}if(y=0,x=_,0===d){if(y+=l-p,p2;)A[i++]=x[y++],A[i++]=x[y++],A[i++]=x[y++],k-=3;k&&(A[i++]=x[y++],k>1&&(A[i++]=x[y++]))}else{y=i-v;do{A[i++]=A[y++],A[i++]=A[y++],A[i++]=A[y++],k-=3}while(k>2);k&&(A[i++]=A[y++],k>1&&(A[i++]=A[y++]))}break}}break}}while(a>3,a-=k,c-=k<<3,f&=(1<{const l=o.bits;let h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;const E=new Uint16Array(16),R=new Uint16Array(16);let Z,U,S,D=null;for(w=0;w<=15;w++)E[w]=0;for(m=0;m=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return i[s++]=20971520,i[s++]=20971520,o.bits=1,0;for(b=1;b0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<15;w++)R[w+1]=R[w]+E[w];for(m=0;m852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<>v)+d]=Z<<24|U<<16|S|0}while(0!==d);for(h=1<>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]]}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<852||2===t&&x>592)return 1;_=z&f,i[_]=p<<24|k<<16|c-s|0}}return 0!==z&&(i[c+z]=w-v<<24|64<<16|0),o.bits=p,0};const{Z_FINISH:oe,Z_BLOCK:le,Z_TREES:he,Z_OK:de,Z_STREAM_END:_e,Z_NEED_DICT:fe,Z_STREAM_ERROR:ce,Z_DATA_ERROR:ue,Z_MEM_ERROR:we,Z_BUF_ERROR:me,Z_DEFLATED:be}=M,ge=16209,pe=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function ke(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ve=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<16180||e.mode>16211?1:0},ye=t=>{if(ve(t))return ce;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=16180,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,de},xe=t=>{if(ve(t))return ce;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ye(t)},ze=(t,e)=>{let a;if(ve(t))return ce;const n=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?ce:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=a,n.wbits=e,xe(t))},Ae=(t,e)=>{if(!t)return ce;const a=new ke;t.state=a,a.strm=t,a.window=null,a.mode=16180;const n=ze(t,e);return n!==de&&(t.state=null),n};let Ee,Re,Ze=!0;const Ue=t=>{if(Ze){Ee=new Int32Array(512),Re=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(re(1,t.lens,0,288,Ee,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;re(2,t.lens,0,32,Re,0,t.work,{bits:5}),Ze=!1}t.lencode=Ee,t.lenbits=9,t.distcode=Re,t.distbits=5},Se=(t,e,a,n)=>{let i;const s=t.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),s.window.set(e.subarray(a-n,a-n+i),s.wnext),(n-=i)?(s.window.set(e.subarray(a-n,a),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whaveAe(t,15),inflateInit2:Ae,inflate:(t,e)=>{let a,n,i,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;const A=new Uint8Array(4);let E,R;const Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ve(t)||!t.output||!t.input&&0!==t.avail_in)return ce;a=t.state,16191===a.mode&&(a.mode=16192),r=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,n=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=de;t:for(;;)switch(a.mode){case 16180:if(0===a.wrap){a.mode=16192;break}for(;d<16;){if(0===o)break t;o--,h+=n[s++]<>>8&255,a.check=B(a.check,A,2,0),h=0,d=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=ge;break}if((15&h)!==be){t.msg="unknown compression method",a.mode=ge;break}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=ge;break}a.dmax=1<>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=B(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=n[s++]<>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=B(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=n[s++]<>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=B(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=n[s++]<>>8&255,a.check=B(a.check,A,2,0)),h=0,d=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(n.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=B(a.check,n,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=n[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y))}while(y&&c>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=16191;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=n[s++]<>>=7&d,d-=7&d,a.mode=16206;break}for(;d<3;){if(0===o)break t;o--,h+=n[s++]<>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Ue(a),a.mode=16199,e===he){h>>>=2,d-=2;break t}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=ge}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=ge;break}if(a.length=65535&h,h=0,d=0,a.mode=16194,e===he)break t;case 16194:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;i.set(n.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break}a.mode=16191;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=n[s++]<>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=ge;break}a.have=0,a.mode=16197;case 16197:for(;a.have>>=3,d-=3}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=re(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=ge;break}a.have=0,a.mode=16198;case 16198:for(;a.have>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=n[s++]<>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=ge;break}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2}else if(17===g){for(R=m+3;d>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3}else{for(R=m+7;d>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=ge;break}for(;c--;)a.lens[a.have++]=y}}if(a.mode===ge)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=ge;break}if(a.lenbits=9,E={bits:a.lenbits},x=re(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=ge;break}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=re(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=ge;break}if(a.mode=16199,e===he)break t;case 16199:a.mode=16200;case 16200:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ee(t,f),r=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,n=t.input,o=t.avail_in,h=a.hold,d=a.bits,16191===a.mode&&(a.back=-1);break}for(a.back=0;z=a.lencode[h&(1<>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=n[s++]<>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=n[s++]<>>=p,d-=p,a.back+=p}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break}if(32&b){a.back=-1,a.mode=16191;break}if(64&b){t.msg="invalid literal/length code",a.mode=ge;break}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=n[s++]<>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=n[s++]<>>=p,d-=p,a.back+=p}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=ge;break}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=ge;break}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=ge;break}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window}else w=i,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{i[r++]=w[u++]}while(--c);0===a.length&&(a.mode=16200);break;case 16205:if(0===l)break t;i[r++]=a.length,l--,a.mode=16200;break;case 16206:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=n[s++]<{if(ve(t))return ce;let e=t.state;return e.window&&(e.window=null),t.state=null,de},inflateGetHeader:(t,e)=>{if(ve(t))return ce;const a=t.state;return 0==(2&a.wrap)?ce:(a.head=e,e.done=!1,de)},inflateSetDictionary:(t,e)=>{const a=e.length;let n,i,s;return ve(t)?ce:(n=t.state,0!==n.wrap&&16190!==n.mode?ce:16190===n.mode&&(i=1,i=L(i,e,a,0),i!==n.check)?ue:(s=Se(t,e,a,a),s?(n.mode=16210,we):(n.havedict=1,de)))},inflateInfo:"pako inflate (from Nodeca project)"};var Te=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Oe=Object.prototype.toString,{Z_NO_FLUSH:Ie,Z_FINISH:Fe,Z_OK:Le,Z_STREAM_END:Ne,Z_NEED_DICT:Be,Z_STREAM_ERROR:Ce,Z_DATA_ERROR:Me,Z_MEM_ERROR:He}=M;function Ke(t){this.options=It({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ht,this.strm.avail_out=0;let a=De.inflateInit2(this.strm,e.windowBits);if(a!==Le)throw new Error(C[a]);if(this.header=new Te,De.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Bt(e.dictionary):"[object ArrayBuffer]"===Oe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=De.inflateSetDictionary(this.strm,e.dictionary),a!==Le)))throw new Error(C[a])}function je(t,e){const a=new Ke(e);if(a.push(t),a.err)throw a.msg||C[a.err];return a.result}Ke.prototype.push=function(t,e){const a=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?Fe:Ie,"[object ArrayBuffer]"===Oe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),s=De.inflate(a,r),s===Be&&i&&(s=De.inflateSetDictionary(a,i),s===Le?s=De.inflate(a,r):s===Me&&(s=Be));a.avail_in>0&&s===Ne&&a.state.wrap>0&&0!==t[a.next_in];)De.inflateReset(a),s=De.inflate(a,r);switch(s){case Ce:case Me:case Be:case He:return this.onEnd(s),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===Ne))if("string"===this.options.to){let t=Mt(a.output,a.next_out),e=a.next_out-t,i=Ct(a.output,t);a.next_out=e,a.avail_out=n-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(i)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==Le||0!==o){if(s===Ne)return s=De.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Ke.prototype.onData=function(t){this.chunks.push(t)},Ke.prototype.onEnd=function(t){t===Le&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ft(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Pe={Inflate:Ke,inflate:je,inflateRaw:function(t,e){return(e=e||{}).raw=!0,je(t,e)},ungzip:je,constants:M};const{Deflate:Ye,deflate:Ge,deflateRaw:Je,gzip:Xe}=te,{Inflate:We,inflate:qe,inflateRaw:Qe,ungzip:Ve}=Pe;var $e=Ye,ta=Ge,ea=Je,aa=Xe,na=We,ia=qe,sa=Qe,ra=Ve,oa=M,la={Deflate:Ye,deflate:Ge,deflateRaw:Je,gzip:Xe,Inflate:We,inflate:qe,inflateRaw:Qe,ungzip:Ve,constants:M}}}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/pako.min.js-f70a54867a7b3a7e819e.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/qrscanner.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/qrscanner.min.js new file mode 100644 index 0000000..d24ec12 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/qrscanner.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.WebQrscanner=e():t.WebQrscanner=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=136)}([function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.getNotFoundInstance=function(){return new e},e.kind="NotFoundException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n;r.d(e,"h",(function(){return i})),r.d(e,"g",(function(){return a})),r.d(e,"n",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"t",(function(){return c})),r.d(e,"k",(function(){return f})),r.d(e,"j",(function(){return h})),r.d(e,"v",(function(){return l})),r.d(e,"o",(function(){return d})),r.d(e,"q",(function(){return p})),r.d(e,"i",(function(){return g})),r.d(e,"m",(function(){return y})),r.d(e,"l",(function(){return w})),r.d(e,"e",(function(){return v})),r.d(e,"x",(function(){return m})),r.d(e,"p",(function(){return C})),r.d(e,"r",(function(){return _})),r.d(e,"s",(function(){return A})),r.d(e,"b",(function(){return E})),r.d(e,"d",(function(){return I})),r.d(e,"u",(function(){return S})),r.d(e,"w",(function(){return T})),r.d(e,"f",(function(){return b})),r.d(e,"c",(function(){return O}));var o,i=[5,7,10,11,12,14,18,20,24,28,36,42,48,56,62,68],a=[[228,48,15,111,62],[23,68,144,134,240,92,254],[28,24,185,166,223,248,116,255,110,61],[175,138,205,12,194,168,39,245,60,97,120],[41,153,158,91,61,42,142,213,97,178,100,242],[156,97,192,252,95,9,157,119,138,45,18,186,83,185],[83,195,100,39,188,75,66,61,241,213,109,129,94,254,225,48,90,188],[15,195,244,9,233,71,168,2,188,160,153,145,253,79,108,82,27,174,186,172],[52,190,88,205,109,39,176,21,155,197,251,223,155,21,5,172,254,124,12,181,184,96,50,193],[211,231,43,97,71,96,103,174,37,151,170,53,75,34,249,121,17,138,110,213,141,136,120,151,233,168,93,255],[245,127,242,218,130,250,162,181,102,120,84,179,220,251,80,182,229,18,2,4,68,33,101,137,95,119,115,44,175,184,59,25,225,98,81,112],[77,193,137,31,19,38,22,153,247,105,122,2,245,133,242,8,175,95,100,9,167,105,214,111,57,121,21,1,253,57,54,101,248,202,69,50,150,177,226,5,9,5],[245,132,172,223,96,32,117,22,238,133,238,231,205,188,237,87,191,106,16,147,118,23,37,90,170,205,131,88,120,100,66,138,186,240,82,44,176,87,187,147,160,175,69,213,92,253,225,19],[175,9,223,238,12,17,220,208,100,29,175,170,230,192,215,235,150,159,36,223,38,200,132,54,228,146,218,234,117,203,29,232,144,238,22,150,201,117,62,207,164,13,137,245,127,67,247,28,155,43,203,107,233,53,143,46],[242,93,169,50,144,210,39,118,202,188,201,189,143,108,196,37,185,112,134,230,245,63,197,190,250,106,185,221,175,64,114,71,161,44,147,6,27,218,51,63,87,10,40,130,188,17,163,31,176,170,4,107,232,7,94,166,224,124,86,47,11,204],[220,228,173,89,251,149,159,56,89,33,147,244,154,36,73,127,213,136,248,180,234,197,158,177,68,122,93,213,15,160,227,236,66,139,153,185,202,167,179,25,220,232,96,210,231,136,223,239,181,241,59,52,172,25,49,232,211,189,64,54,108,153,132,63,96,103,82,186]],s=(n=function(t,e){for(var r=1,n=0;n<255;n++)e[n]=r,t[r]=n,(r*=2)>=256&&(r^=301);return{LOG:t,ALOG:e}}([],[])).LOG,u=n.ALOG;!function(t){t[t.FORCE_NONE=0]="FORCE_NONE",t[t.FORCE_SQUARE=1]="FORCE_SQUARE",t[t.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"}(o||(o={}));var c=129,f=230,h=231,l=235,d=236,p=237,g=238,y=239,w=240,v=254,m=254,C="[)>05",_="[)>06",A="",E=0,I=1,S=2,T=3,b=4,O=5},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.kind="IllegalArgumentException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n=r(11),o=r(26),i=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.getX=function(){return this.x},t.prototype.getY=function(){return this.y},t.prototype.equals=function(e){if(e instanceof t){var r=e;return this.x===r.x&&this.y===r.y}return!1},t.prototype.hashCode=function(){return 31*o.a.floatToIntBits(this.x)+o.a.floatToIntBits(this.y)},t.prototype.toString=function(){return"("+this.x+","+this.y+")"},t.orderBestPatterns=function(t){var e,r,n,o=this.distance(t[0],t[1]),i=this.distance(t[1],t[2]),a=this.distance(t[0],t[2]);if(i>=o&&i>=a?(r=t[0],e=t[1],n=t[2]):a>=i&&a>=o?(r=t[1],e=t[0],n=t[2]):(r=t[2],e=t[0],n=t[1]),this.crossProductZ(e,r,n)<0){var s=e;e=n,n=s}t[0]=e,t[1]=r,t[2]=n},t.distance=function(t,e){return n.a.distance(t.x,t.y,e.x,e.y)},t.crossProductZ=function(t,e,r){var n=e.x,o=e.y;return(r.x-n)*(t.y-o)-(r.y-o)*(t.x-n)},t}();e.a=i},function(t,e,r){"use strict";var n;!function(t){t[t.AZTEC=0]="AZTEC",t[t.CODABAR=1]="CODABAR",t[t.CODE_39=2]="CODE_39",t[t.CODE_93=3]="CODE_93",t[t.CODE_128=4]="CODE_128",t[t.DATA_MATRIX=5]="DATA_MATRIX",t[t.EAN_8=6]="EAN_8",t[t.EAN_13=7]="EAN_13",t[t.ITF=8]="ITF",t[t.MAXICODE=9]="MAXICODE",t[t.PDF_417=10]="PDF_417",t[t.QR_CODE=11]="QR_CODE",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(n||(n={})),e.a=n},function(t,e,r){"use strict";var n=r(8),o=function(){function t(t){void 0===t&&(t=""),this.value=t}return t.prototype.enableDecoding=function(t){return this.encoding=t,this},t.prototype.append=function(t){return"string"==typeof t?this.value+=t.toString():this.encoding?this.value+=n.a.castAsNonUtf8Char(t,this.encoding):this.value+=String.fromCharCode(t),this},t.prototype.appendChars=function(t,e,r){for(var n=e;ee?1:void 0},t.numberOfTrailingZeros=function(t){var e;if(0===t)return 32;var r=31;return 0!==(e=t<<16)&&(r-=16,t=e),0!==(e=t<<8)&&(r-=8,t=e),0!==(e=t<<4)&&(r-=4,t=e),0!==(e=t<<2)&&(r-=2,t=e),r-(t<<1>>>31)},t.numberOfLeadingZeros=function(t){if(0===t)return 32;var e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31},t.toHexString=function(t){return t.toString(16)},t.toBinaryString=function(t){return String(parseInt(String(t),2))},t.bitCount=function(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,t+=t>>>8,63&(t+=t>>>16)},t.truncDivision=function(t,e){return Math.trunc(t/e)},t.parseInt=function(t,e){return void 0===e&&(e=void 0),parseInt(t,e)},t.MIN_VALUE_32_BITS=-2147483648,t.MAX_VALUE=Number.MAX_SAFE_INTEGER,t}();e.a=n},function(t,e,r){"use strict";var n=r(12),o=r(25),i=r(30),a=function(){function t(){}return t.castAsNonUtf8Char=function(t,e){void 0===e&&(e=null);var r=e?e.getName():this.ISO88591;return i.a.decode(new Uint8Array([t]),r)},t.guessEncoding=function(e,r){if(null!=r&&void 0!==r.get(n.a.CHARACTER_SET))return r.get(n.a.CHARACTER_SET).toString();for(var o=e.length,i=!0,a=!0,s=!0,u=0,c=0,f=0,h=0,l=0,d=0,p=0,g=0,y=0,w=0,v=0,m=e.length>3&&239===e[0]&&187===e[1]&&191===e[2],C=0;C0?0==(128&_)?s=!1:u--:0!=(128&_)&&(0==(64&_)?s=!1:(u++,0==(32&_)?c++:(u++,0==(16&_)?f++:(u++,0==(8&_)?h++:s=!1))))),i&&(_>127&&_<160?i=!1:_>159&&(_<192||215===_||247===_)&&v++),a&&(l>0?_<64||127===_||_>252?a=!1:l--:128===_||160===_||_>239?a=!1:_>160&&_<224?(d++,g=0,++p>y&&(y=p)):_>127?(l++,p=0,++g>w&&(w=g)):(p=0,g=0))}return s&&u>0&&(s=!1),a&&l>0&&(a=!1),s&&(m||c+f+h>0)?t.UTF8:a&&(t.ASSUME_SHIFT_JIS||y>=3||w>=3)?t.SHIFT_JIS:i&&a?2===y&&2===d||10*v>=o?t.SHIFT_JIS:t.ISO88591:i?t.ISO88591:a?t.SHIFT_JIS:s?t.UTF8:t.PLATFORM_DEFAULT_ENCODING},t.format=function(t){for(var e=[],r=1;r=0&&(y=g.getNewEncoding(),g.resetEncoderSignal());var w=g.getCodewordCount();g.updateSymbolInfo();var v=g.getSymbolInfo().getDataCapacity();w=t.length)return r;var n;r===a.b?n=[0,1,1,1,1,1.25]:(n=[1,2,2,2,2,2.25])[r]=0;for(var o=0,i=new Uint8Array(6),s=[];;){if(e+o===t.length){h.a.fill(i,0),h.a.fill(s,0);var u=this.findMinimums(n,s,l.a.MAX_VALUE,i),c=this.getMinimumCount(i);if(s[a.b]===u)return a.b;if(1===c){if(i[a.c]>0)return a.c;if(i[a.f]>0)return a.f;if(i[a.u]>0)return a.u;if(i[a.w]>0)return a.w}return a.d}var f=t.charCodeAt(e+o);if(o++,this.isDigit(f)?n[a.b]+=.5:this.isExtendedASCII(f)?(n[a.b]=Math.ceil(n[a.b]),n[a.b]+=2):(n[a.b]=Math.ceil(n[a.b]),n[a.b]++),this.isNativeC40(f)?n[a.d]+=2/3:this.isExtendedASCII(f)?n[a.d]+=8/3:n[a.d]+=4/3,this.isNativeText(f)?n[a.u]+=2/3:this.isExtendedASCII(f)?n[a.u]+=8/3:n[a.u]+=4/3,this.isNativeX12(f)?n[a.w]+=2/3:this.isExtendedASCII(f)?n[a.w]+=13/3:n[a.w]+=10/3,this.isNativeEDIFACT(f)?n[a.f]+=3/4:this.isExtendedASCII(f)?n[a.f]+=4.25:n[a.f]+=3.25,this.isSpecialB256(f)?n[a.c]+=4:n[a.c]++,o>=4){if(h.a.fill(i,0),h.a.fill(s,0),this.findMinimums(n,s,l.a.MAX_VALUE,i),s[a.b]i&&(r=i,h.a.fill(n,0)),r===i&&(n[o]=n[o]+1)}return r},t.getMinimumCount=function(t){for(var e=0,r=0;r<6;r++)e+=t[r];return e||0},t.isDigit=function(t){return t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)},t.isExtendedASCII=function(t){return t>=128&&t<=255},t.isNativeC40=function(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)},t.isNativeText=function(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="a".charCodeAt(0)&&t<="z".charCodeAt(0)},t.isNativeX12=function(t){return this.isX12TermSep(t)||t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)},t.isX12TermSep=function(t){return 13===t||t==="*".charCodeAt(0)||t===">".charCodeAt(0)},t.isNativeEDIFACT=function(t){return t>=" ".charCodeAt(0)&&t<="^".charCodeAt(0)},t.isSpecialB256=function(t){return!1},t.determineConsecutiveDigitCount=function(t,e){void 0===e&&(e=0);for(var r=t.length,n=e;n=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0},t.distance=function(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)},t.sum=function(t){for(var e=0,r=0,n=t.length;r!==n;r++){e+=t[r]}return e},t}();e.a=n},function(t,e,r){"use strict";var n;!function(t){t[t.OTHER=0]="OTHER",t[t.PURE_BARCODE=1]="PURE_BARCODE",t[t.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",t[t.TRY_HARDER=3]="TRY_HARDER",t[t.CHARACTER_SET=4]="CHARACTER_SET",t[t.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",t[t.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",t[t.ASSUME_GS1=7]="ASSUME_GS1",t[t.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",t[t.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",t[t.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"}(n||(n={})),e.a=n},function(t,e,r){"use strict";var n=r(16),o=r(11),i=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(){function t(){}return t.prototype.PDF417Common=function(){},t.getBitCountSum=function(t){return o.a.sum(t)},t.toIntArray=function(e){var r,n;if(null==e||!e.length)return t.EMPTY_INT_ARRAY;var o=new Int32Array(e.length),a=0;try{for(var s=i(e),u=s.next();!u.done;u=s.next()){var c=u.value;o[a++]=c}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o},t.getCodeword=function(e){var r=n.a.binarySearch(t.SYMBOL_TABLE,262143&e);return r<0?-1:(t.CODEWORD_TABLE[r]-1)%t.NUMBER_OF_CODEWORDS},t.NUMBER_OF_CODEWORDS=929,t.MAX_CODEWORDS_IN_BARCODE=t.NUMBER_OF_CODEWORDS-1,t.MIN_ROWS_IN_BARCODE=3,t.MAX_ROWS_IN_BARCODE=90,t.MODULES_IN_CODEWORD=17,t.MODULES_IN_STOP_PATTERN=18,t.BARS_IN_MODULE=8,t.EMPTY_INT_ARRAY=new Int32Array([]),t.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),t.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]),t}();e.a=a},function(t,e,r){"use strict";var n=r(10),o=r(5);function i(t){return Object.keys(o.a).map((function(t){return Number(t)})).filter(Number.isInteger).includes(t)}var a=function(){function t(t,e,r,o,a,s){if(void 0===a&&(a=null),void 0===s&&(s=n.a.currentTimeMillis()),this.text=t,this.rawBytes=e,this.timestamp=s,r instanceof Number&&Array.isArray(o)&&i(a))return r=null==e?0:8*e.length,void this.constructorImpl(t,e,r,o,a,s);if(Array.isArray(o)&&i(a))this.constructorOverload2(t,e,o,a,s);else{if(!("string"==typeof t&&e instanceof Uint8Array&&Array.isArray(r)&&i(o)))throw new Error("No supported overload for the given combination of parameters.");this.constructorOverload1(t,e,r,o)}}return t.prototype.constructorOverload1=function(t,e,r,o){return this.constructorOverload2(t,e,r,o,n.a.currentTimeMillis())},t.prototype.constructorOverload2=function(t,e,r,n,o){return this.constructorImpl(t,e,null==e?0:8*e.length,r,n,o)},t.prototype.constructorImpl=function(t,e,r,o,i,a){this.text=t,this.rawBytes=e,this.numBits=null==r?null==e?0:8*e.length:r,this.resultPoints=o,this.format=i,this.resultMetadata=null,this.timestamp=null==a?n.a.currentTimeMillis():a},t.prototype.getText=function(){return this.text},t.prototype.getRawBytes=function(){return this.rawBytes},t.prototype.getNumBits=function(){return this.numBits},t.prototype.getResultPoints=function(){return this.resultPoints},t.prototype.getBarcodeFormat=function(){return this.format},t.prototype.getResultMetadata=function(){return this.resultMetadata},t.prototype.putMetadata=function(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)},t.prototype.putAllMetadata=function(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))},t.prototype.addResultPoints=function(t){var e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&t.length>0){var r=new Array(e.length+t.length);n.a.arraycopy(e,0,r,0,e.length),n.a.arraycopy(t,0,r,e.length,t.length),this.resultPoints=r}},t.prototype.getTimestamp=function(){return this.timestamp},t.prototype.toString=function(){return this.text},t}();e.a=a},function(t,e,r){"use strict";var n;!function(t){t[t.OTHER=0]="OTHER",t[t.ORIENTATION=1]="ORIENTATION",t[t.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",t[t.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",t[t.ISSUE_NUMBER=4]="ISSUE_NUMBER",t[t.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",t[t.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",t[t.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",t[t.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",t[t.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",t[t.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(n||(n={})),e.a=n},function(t,e,r){"use strict";var n,o=r(10),i=r(3),a=r(73),s=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=function(t){function e(e,r){void 0===e&&(e=void 0),void 0===r&&(r=void 0);var n=t.call(this,r)||this;return n.index=e,n.message=r,n}return s(e,t),e.kind="ArrayIndexOutOfBoundsException",e}(a.a),c=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},f=function(){function t(){}return t.fill=function(t,e){for(var r=0,n=t.length;rr)throw new i.a("fromIndex("+e+") > toIndex("+r+")");if(e<0)throw new u(e);if(r>t)throw new u(r)},t.asList=function(){for(var t=[],e=0;e>1,s=n(r,e[a]);if(s>0)o=a+1;else{if(!(s<0))return a;i=a-1}}return-o-1},t.numberComparator=function(t,e){return t-e},t.sort=function(t){return t.sort()},t}();e.a=f},function(t,e,r){"use strict";var n;!function(t){t[t.ERROR_CORRECTION=0]="ERROR_CORRECTION",t[t.CHARACTER_SET=1]="CHARACTER_SET",t[t.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",t[t.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",t[t.MIN_SIZE=4]="MIN_SIZE",t[t.MAX_SIZE=5]="MAX_SIZE",t[t.MARGIN=6]="MARGIN",t[t.PDF417_COMPACT=7]="PDF417_COMPACT",t[t.PDF417_COMPACTION=8]="PDF417_COMPACTION",t[t.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",t[t.AZTEC_LAYERS=10]="AZTEC_LAYERS",t[t.QR_VERSION=11]="QR_VERSION",t[t.GS1_FORMAT=12]="GS1_FORMAT",t[t.FORCE_C40=13]="FORCE_C40"}(n||(n={})),e.a=n},function(t,e,r){"use strict";var n=r(24),o=r(12),i=r(15),a=r(4),s=r(0),u=function(){function t(){}return t.prototype.decode=function(t,e){try{return this.doDecode(t,e)}catch(d){if(e&&!0===e.get(o.a.TRY_HARDER)&&t.isRotateSupported()){var r=t.rotateCounterClockwise(),n=this.doDecode(r,e),u=n.getResultMetadata(),c=270;null!==u&&!0===u.get(i.a.ORIENTATION)&&(c+=u.get(i.a.ORIENTATION)%360),n.putMetadata(i.a.ORIENTATION,c);var f=n.getResultPoints();if(null!==f)for(var h=r.getHeight(),l=0;l>(h?8:5));r=h?c:15;for(var d=Math.trunc(c/2),p=0;p=c)break;try{f=t.getBlackRow(y,f)}catch(t){continue}for(var w=function(t){if(1===t&&(f.reverse(),e&&!0===e.get(o.a.NEED_RESULT_POINT_CALLBACK))){var r=new Map;e.forEach((function(t,e){return r.set(e,t)})),r.delete(o.a.NEED_RESULT_POINT_CALLBACK),e=r}try{var n=v.decodeRow(y,f,e);if(1===t){n.putMetadata(i.a.ORIENTATION,180);var s=n.getResultPoints();null!==s&&(s[0]=new a.a(u-s[0].getX()-1,s[0].getY()),s[1]=new a.a(u-s[1].getX()-1,s[1].getY()))}return{value:n}}catch(t){}},v=this,m=0;m<2;m++){var C=w(m);if("object"==typeof C)return C.value}}throw new s.a},t.recordPattern=function(t,e,r){for(var n=r.length,o=0;o=i)throw new s.a;for(var a=!t.get(e),u=0,c=e;c0&&o>=0;)e.get(--r)!==i&&(o--,i=!i);if(o>=0)throw new s.a;t.recordPattern(e,r+1,n)},t.patternMatchVariance=function(t,e,r){for(var n=t.length,o=0,i=0,a=0;ah?f-h:h-f;if(l>r)return Number.POSITIVE_INFINITY;u+=l}return u/o},t}();e.a=u},function(t,e,r){"use strict";function n(t,e){void 0===e&&(e=t.constructor);var r=Error.captureStackTrace;r&&r(t,e)}var o,i=(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(e,r){var o,i,a,s=this.constructor,u=t.call(this,e,r)||this;return Object.defineProperty(u,"name",{value:s.name,enumerable:!1,configurable:!0}),o=u,i=s.prototype,(a=Object.setPrototypeOf)?a(o,i):o.__proto__=i,n(u),u}return i(e,t),e}(Error);var s,u=(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),c=function(t){function e(e){void 0===e&&(e=void 0);var r=t.call(this,e)||this;return r.message=e,r}return u(e,t),e.prototype.getKind=function(){return this.constructor.kind},e.kind="Exception",e}(a);e.a=c},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n,o=r(3);!function(t){t[t.TERMINATOR=0]="TERMINATOR",t[t.NUMERIC=1]="NUMERIC",t[t.ALPHANUMERIC=2]="ALPHANUMERIC",t[t.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",t[t.BYTE=4]="BYTE",t[t.ECI=5]="ECI",t[t.KANJI=6]="KANJI",t[t.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",t[t.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",t[t.HANZI=9]="HANZI"}(n||(n={}));var i=function(){function t(e,r,n,o){this.value=e,this.stringValue=r,this.characterCountBitsForVersions=n,this.bits=o,t.FOR_BITS.set(o,this),t.FOR_VALUE.set(e,this)}return t.forBits=function(e){var r=t.FOR_BITS.get(e);if(void 0===r)throw new o.a;return r},t.prototype.getCharacterCountBits=function(t){var e,r=t.getVersionNumber();return e=r<=9?0:r<=26?1:2,this.characterCountBitsForVersions[e]},t.prototype.getValue=function(){return this.value},t.prototype.getBits=function(){return this.bits},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.value===r.value},t.prototype.toString=function(){return this.stringValue},t.FOR_BITS=new Map,t.FOR_VALUE=new Map,t.TERMINATOR=new t(n.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),t.NUMERIC=new t(n.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),t.ALPHANUMERIC=new t(n.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),t.STRUCTURED_APPEND=new t(n.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),t.BYTE=new t(n.BYTE,"BYTE",Int32Array.from([8,16,16]),4),t.ECI=new t(n.ECI,"ECI",Int32Array.from([0,0,0]),7),t.KANJI=new t(n.KANJI,"KANJI",Int32Array.from([8,10,12]),8),t.FNC1_FIRST_POSITION=new t(n.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),t.FNC1_SECOND_POSITION=new t(n.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),t.HANZI=new t(n.HANZI,"HANZI",Int32Array.from([8,10,12]),13),t}();e.a=i},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.kind="WriterException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n=r(24),o=r(10),i=r(16),a=r(6),s=r(3),u=function(){function t(t,e,r,n){if(this.width=t,this.height=e,this.rowSize=r,this.bits=n,null==e&&(e=t),this.height=e,t<1||e<1)throw new s.a("Both dimensions must be greater than 0");null==r&&(r=Math.floor((t+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}return t.parseFromBooleanArray=function(e){for(var r=e.length,n=e[0].length,o=new t(n,r),i=0;ia){if(-1===u)u=i-a;else if(i-a!==u)throw new s.a("row lengths do not match");a=i,c++}f++}else if(e.substring(f,f+r.length)===r)f+=r.length,o[i]=!0,i++;else{if(e.substring(f,f+n.length)!==n)throw new s.a("illegal character encountered: "+e.substring(f));f+=n.length,o[i]=!1,i++}if(i>a){if(-1===u)u=i-a;else if(i-a!==u)throw new s.a("row lengths do not match");c++}for(var h=new t(u,c),l=0;l>>(31&t)&1)},t.prototype.set=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]|=1<<(31&t)&4294967295},t.prototype.unset=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]&=~(1<<(31&t)&4294967295)},t.prototype.flip=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]^=1<<(31&t)&4294967295},t.prototype.xor=function(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new s.a("input matrix dimensions do not match");for(var e=new n.a(Math.floor(this.width/32)+1),r=this.rowSize,o=this.bits,i=0,a=this.height;ithis.height||o>this.width)throw new s.a("The region must fit inside the matrix");for(var a=this.rowSize,u=this.bits,c=e;cs&&(s=u),32*ca){for(h=31;f>>>h==0;)h--;32*c+h>a&&(a=32*c+h)}}}return a=0&&0===e[r];)r--;if(r<0)return null;for(var n=Math.floor(r/t),o=32*Math.floor(r%t),i=e[r],a=31;i>>>a==0;)a--;return o+=a,Int32Array.from([o,n])},t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.getRowSize=function(){return this.rowSize},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.width===r.width&&this.height===r.height&&this.rowSize===r.rowSize&&i.a.equals(this.bits,r.bits)},t.prototype.hashCode=function(){var t=this.width;return t=31*(t=31*(t=31*(t=31*t+this.width)+this.height)+this.rowSize)+i.a.hashCode(this.bits)},t.prototype.toString=function(t,e,r){return void 0===t&&(t="X "),void 0===e&&(e=" "),void 0===r&&(r="\n"),this.buildToString(t,e,r)},t.prototype.buildToString=function(t,e,r){for(var n=new a.a,o=0,i=this.height;o32*this.bits.length){var r=t.makeArray(e);a.a.arraycopy(this.bits,0,r,0,this.bits.length),this.bits=r}},t.prototype.get=function(t){return 0!=(this.bits[Math.floor(t/32)]&1<<(31&t))},t.prototype.set=function(t){this.bits[Math.floor(t/32)]|=1<<(31&t)},t.prototype.flip=function(t){this.bits[Math.floor(t/32)]^=1<<(31&t)},t.prototype.getNextSet=function(t){var e=this.size;if(t>=e)return e;var r=this.bits,n=Math.floor(t/32),o=r[n];o&=~((1<<(31&t))-1);for(var a=r.length;0===o;){if(++n===a)return e;o=r[n]}var s=32*n+i.a.numberOfTrailingZeros(o);return s>e?e:s},t.prototype.getNextUnset=function(t){var e=this.size;if(t>=e)return e;var r=this.bits,n=Math.floor(t/32),o=~r[n];o&=~((1<<(31&t))-1);for(var a=r.length;0===o;){if(++n===a)return e;o=~r[n]}var s=32*n+i.a.numberOfTrailingZeros(o);return s>e?e:s},t.prototype.setBulk=function(t,e){this.bits[Math.floor(t/32)]=e},t.prototype.setRange=function(t,e){if(ethis.size)throw new n.a;if(e!==t){e--;for(var r=Math.floor(t/32),o=Math.floor(e/32),i=this.bits,a=r;a<=o;a++){var s=(2<<(ar?0:31&t));i[a]|=s}}},t.prototype.clear=function(){for(var t=this.bits.length,e=this.bits,r=0;rthis.size)throw new n.a;if(e===t)return!0;e--;for(var o=Math.floor(t/32),i=Math.floor(e/32),a=this.bits,s=o;s<=i;s++){var u=(2<<(so?0:31&t))&4294967295;if((a[s]&u)!==(r?u:0))return!1}return!0},t.prototype.appendBit=function(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++},t.prototype.appendBits=function(t,e){if(e<0||e>32)throw new n.a("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e);for(var r=e;r>0;r--)this.appendBit(1==(t>>r-1&1))},t.prototype.appendBitArray=function(t){var e=t.size;this.ensureCapacity(this.size+e);for(var r=0;r>1&1431655765|(1431655765&i)<<1)>>2&858993459|(858993459&i)<<2)>>4&252645135|(252645135&i)<<4)>>8&16711935|(16711935&i)<<8)>>16&65535|(65535&i)<<16,t[e-o]=i}if(this.size!==32*r){var a=32*r-this.size,s=t[0]>>>a;for(o=1;o>>a}t[r-1]=s}this.bits=t},t.makeArray=function(t){return new Int32Array(Math.floor((t+31)/32))},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.size===r.size&&o.a.equals(this.bits,r.bits)},t.prototype.hashCode=function(){return 31*this.size+o.a.hashCode(this.bits)},t.prototype.toString=function(){for(var t="",e=0,r=this.size;e=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};!function(t){t[t.Cp437=0]="Cp437",t[t.ISO8859_1=1]="ISO8859_1",t[t.ISO8859_2=2]="ISO8859_2",t[t.ISO8859_3=3]="ISO8859_3",t[t.ISO8859_4=4]="ISO8859_4",t[t.ISO8859_5=5]="ISO8859_5",t[t.ISO8859_6=6]="ISO8859_6",t[t.ISO8859_7=7]="ISO8859_7",t[t.ISO8859_8=8]="ISO8859_8",t[t.ISO8859_9=9]="ISO8859_9",t[t.ISO8859_10=10]="ISO8859_10",t[t.ISO8859_11=11]="ISO8859_11",t[t.ISO8859_13=12]="ISO8859_13",t[t.ISO8859_14=13]="ISO8859_14",t[t.ISO8859_15=14]="ISO8859_15",t[t.ISO8859_16=15]="ISO8859_16",t[t.SJIS=16]="SJIS",t[t.Cp1250=17]="Cp1250",t[t.Cp1251=18]="Cp1251",t[t.Cp1252=19]="Cp1252",t[t.Cp1256=20]="Cp1256",t[t.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",t[t.UTF8=22]="UTF8",t[t.ASCII=23]="ASCII",t[t.Big5=24]="Big5",t[t.GB18030=25]="GB18030",t[t.EUC_KR=26]="EUC_KR"}(n||(n={}));var a=function(){function t(e,r,n){for(var o,a,s=[],u=3;u=900)throw new o.a("incorect value");var r=t.VALUES_TO_ECI.get(e);if(void 0===r)throw new o.a("incorect value");return r},t.getCharacterSetECIByName=function(e){var r=t.NAME_TO_ECI.get(e);if(void 0===r)throw new o.a("incorect value");return r},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.getName()===r.getName()},t.VALUE_IDENTIFIER_TO_ECI=new Map,t.VALUES_TO_ECI=new Map,t.NAME_TO_ECI=new Map,t.Cp437=new t(n.Cp437,Int32Array.from([0,2]),"Cp437"),t.ISO8859_1=new t(n.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),t.ISO8859_2=new t(n.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),t.ISO8859_3=new t(n.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),t.ISO8859_4=new t(n.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),t.ISO8859_5=new t(n.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),t.ISO8859_6=new t(n.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),t.ISO8859_7=new t(n.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),t.ISO8859_8=new t(n.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),t.ISO8859_9=new t(n.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),t.ISO8859_10=new t(n.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),t.ISO8859_11=new t(n.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),t.ISO8859_13=new t(n.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),t.ISO8859_14=new t(n.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),t.ISO8859_15=new t(n.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),t.ISO8859_16=new t(n.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),t.SJIS=new t(n.SJIS,20,"SJIS","Shift_JIS"),t.Cp1250=new t(n.Cp1250,21,"Cp1250","windows-1250"),t.Cp1251=new t(n.Cp1251,22,"Cp1251","windows-1251"),t.Cp1252=new t(n.Cp1252,23,"Cp1252","windows-1252"),t.Cp1256=new t(n.Cp1256,24,"Cp1256","windows-1256"),t.UnicodeBigUnmarked=new t(n.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),t.UTF8=new t(n.UTF8,26,"UTF8","UTF-8"),t.ASCII=new t(n.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),t.Big5=new t(n.Big5,28,"Big5"),t.GB18030=new t(n.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),t.EUC_KR=new t(n.EUC_KR,30,"EUC_KR","EUC-KR"),t}();e.a=a},function(t,e,r){"use strict";var n=function(){function t(){}return t.floatToIntBits=function(t){return t},t.isNaN=function(t){return isNaN(t)},t.compare=function(t,e){return t===e?0:te?1:void 0},t.MAX_VALUE=Number.MAX_SAFE_INTEGER,t.NaN=NaN,t}();e.a=n},function(t,e,r){"use strict";var n,o=r(34),i=r(61),a=r(7),s=r(3),u=r(64),c=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),f=function(t){function e(e,r,n){var i=t.call(this)||this;i.primitive=e,i.size=r,i.generatorBase=n;for(var a=new Int32Array(r),s=1,u=0;u=r&&(s^=e,s&=r-1);i.expTable=a;var c=new Int32Array(r);for(u=0;u=0&&(n=t.isRange(s,a,!1))}return r},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var r=t.length;if(0===r)return!1;var n=parseInt(t.charAt(r-1),10);return e.getStandardUPCEANChecksum(t.substring(0,r-1))===n},e.getStandardUPCEANChecksum=function(t){for(var e=t.length,r=0,n=e-1;n>=0;n-=2){if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||o>9)throw new h.a;r+=o}r*=3;for(n=e-2;n>=0;n-=2){var o;if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||o>9)throw new h.a;r+=o}return(1e3-r)%10},e.decodeEnd=function(t,r){return e.findGuardPattern(t,r,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,e,r,n){return this.findGuardPattern(t,e,r,n,new Int32Array(n.length))},e.findGuardPattern=function(t,r,n,o,i){for(var a=t.getSize(),s=0,u=r=n?t.getNextUnset(r):t.getNextSet(r),h=o.length,l=n,d=r;d=0)return a;throw new f.a},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=Int32Array.from([1,1,1]),e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])],e}(c.a),p=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},g=function(){function t(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return t.prototype.decodeRow=function(e,r,n){var i=this.decodeRowStringBuffer,s=this.decodeMiddle(r,n,i),c=i.toString(),f=t.parseExtensionString(c),h=[new u.a((n[0]+n[1])/2,e),new u.a(s,e)],l=new a.a(c,null,0,h,o.a.UPC_EAN_EXTENSION,(new Date).getTime());return null!=f&&l.putAllMetadata(f),l},t.prototype.decodeMiddle=function(e,r,n){var o,i,a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;for(var s=e.getSize(),u=r[1],c=0,h=0;h<5&&u=10&&(c|=1<<4-h),4!==h&&(u=e.getNextSet(u),u=e.getNextUnset(u))}if(5!==n.length)throw new f.a;var w=this.determineCheckDigit(c);if(t.extensionChecksum(n.toString())!==w)throw new f.a;return u},t.extensionChecksum=function(t){for(var e=t.length,r=0,n=e-2;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);r*=3;for(n=e-1;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);return(r*=3)%10},t.prototype.determineCheckDigit=function(t){for(var e=0;e<10;e++)if(t===this.CHECK_DIGIT_ENCODINGS[e])return e;throw new f.a},t.parseExtensionString=function(e){if(5!==e.length)return null;var r=t.parseExtension5String(e);return null==r?null:new Map([[s.a.SUGGESTED_PRICE,r]])},t.parseExtension5String=function(t){var e;switch(t.charAt(0)){case"0":e="£";break;case"5":e="$";break;case"9":switch(t){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}e="";break;default:e=""}var r=parseInt(t.substring(1)),n=r%100;return e+(r/100).toString()+"."+(n<10?"0"+n:n.toString())},t}(),y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},w=function(){function t(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return t.prototype.decodeRow=function(e,r,n){var i=this.decodeRowStringBuffer,s=this.decodeMiddle(r,n,i),c=i.toString(),f=t.parseExtensionString(c),h=[new u.a((n[0]+n[1])/2,e),new u.a(s,e)],l=new a.a(c,null,0,h,o.a.UPC_EAN_EXTENSION,(new Date).getTime());return null!=f&&l.putAllMetadata(f),l},t.prototype.decodeMiddle=function(t,e,r){var n,o,i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=t.getSize(),s=e[1],u=0,c=0;c<2&&s=10&&(u|=1<<1-c),1!==c&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(2!==r.length)throw new f.a;if(parseInt(r.toString())%4!==u)throw new f.a;return s},t.parseExtensionString=function(t){return 2!==t.length?null:new Map([[s.a.ISSUE_NUMBER,parseInt(t)]])},t}(),v=function(){function t(){}return t.decodeRow=function(t,e,r){var n=d.findGuardPattern(e,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new g).decodeRow(t,e,n)}catch(r){return(new w).decodeRow(t,e,n)}},t.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),t}(),m=r(20),C=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_=function(t){function e(){var r=t.call(this)||this;r.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map((function(t){return Int32Array.from(t)}));for(var n=10;n<20;n++){for(var o=e.L_PATTERNS[n-10],i=new Int32Array(o.length),a=0;a=r.getSize()||!r.isRange(A,E,!1))throw new f.a;var I=y.toString();if(I.length<8)throw new h.a;if(!e.checkChecksum(I))throw new m.a;var S=(c[1]+c[0])/2,T=(C[1]+C[0])/2,b=this.getBarcodeFormat(),O=[new u.a(S,t),new u.a(T,t)],R=new a.a(I,null,0,O,b,(new Date).getTime()),N=0;try{var D=v.decodeRow(t,r,C[1]);R.putMetadata(s.a.UPC_EAN_EXTENSION,D.getText()),R.putAllMetadata(D.getResultMetadata()),R.addResultPoints(D.getResultPoints()),N=D.getText().length}catch(t){}var M=null==n?null:n.get(i.a.ALLOWED_EAN_EXTENSIONS);if(null!=M){var P=!1;for(var B in M)if(N.toString()===B){P=!0;break}if(!P)throw new f.a}return b===o.a.EAN_13||o.a.UPC_A,R},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var r=t.length;if(0===r)return!1;var n=parseInt(t.charAt(r-1),10);return e.getStandardUPCEANChecksum(t.substring(0,r-1))===n},e.getStandardUPCEANChecksum=function(t){for(var e=t.length,r=0,n=e-1;n>=0;n-=2){if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||o>9)throw new h.a;r+=o}r*=3;for(n=e-2;n>=0;n-=2){var o;if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||o>9)throw new h.a;r+=o}return(1e3-r)%10},e.decodeEnd=function(t,r){return e.findGuardPattern(t,r,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e}(d);e.a=_},function(t,e,r){"use strict";r(120);var n=r(32);r.d(e,"ArgumentException",(function(){return n.a}));r(64);var o=r(20);r.d(e,"ChecksumException",(function(){return o.a}));r(19);var i=r(2);r.d(e,"FormatException",(function(){return i.a}));r(3),r(31);var a=r(0);r.d(e,"NotFoundException",(function(){return a.a}));r(41),r(59),r(50),r(22),r(5),r(93);var s=r(90);r.d(e,"BinaryBitmap",(function(){return s.a}));var u=r(12);r.d(e,"DecodeHintType",(function(){return u.a}));r(40);var c=r(36);r.d(e,"LuminanceSource",(function(){return c.a}));r(100),r(130),r(131),r(14),r(15),r(132),r(4),r(10),r(6),r(30),r(48),r(16),r(71),r(7),r(24),r(23),r(67),r(25),r(37),r(97),r(46),r(17),r(92),r(78),r(47);var f=r(91);r.d(e,"HybridBinarizer",(function(){return f.a}));r(65),r(8),r(11),r(54),r(27),r(34),r(38),r(69),r(58),r(99),r(88),r(89),r(9),r(63),r(1),r(134),r(57),r(103),r(102),r(115),r(42),r(104),r(39),r(68),r(35),r(21),r(101),r(83),r(72),r(56),r(84),r(70),r(43),r(53),r(133),r(96),r(75),r(113),r(111),r(77),r(62),r(18),r(55),r(79),r(82),r(80),r(81),r(85),r(114),r(66),r(112),r(44),r(98);var h=r(135);r.d(e,"QRCodeMultiReader",(function(){return h.a}))},function(t,e,r){"use strict";var n=r(50),o=r(25),i=function(){function t(){}return t.decode=function(t,e){var r=this.encodingName(e);return this.customDecoder?this.customDecoder(t,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(t,r):new TextDecoder(r).decode(t)},t.shouldDecodeOnFallback=function(e){return!t.isBrowser()&&"ISO-8859-1"===e},t.encode=function(t,e){var r=this.encodingName(e);return this.customEncoder?this.customEncoder(t,r):"undefined"==typeof TextEncoder?this.encodeFallback(t):(new TextEncoder).encode(t)},t.isBrowser=function(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)},t.encodingName=function(t){return"string"==typeof t?t:t.getName()},t.encodingCharacterSet=function(t){return t instanceof o.a?t:o.a.getCharacterSetECIByName(t)},t.decodeFallback=function(e,r){var i=this.encodingCharacterSet(r);if(t.isDecodeFallbackSupported(i)){for(var a="",s=0,u=e.length;s0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=function(){function t(t,e,r){void 0===e&&(e=500),this.reader=t,this.timeBetweenScansMillis=e,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return Object.defineProperty(t.prototype,"hasNavigator",{get:function(){return"undefined"!=typeof navigator},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isMediaDevicesSuported",{get:function(){return this.hasNavigator&&!!navigator.mediaDevices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canEnumerateDevices",{get:function(){return!(!this.isMediaDevicesSuported||!navigator.mediaDevices.enumerateDevices)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timeBetweenDecodingAttempts",{get:function(){return this._timeBetweenDecodingAttempts},set:function(t){this._timeBetweenDecodingAttempts=t<0?0:t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hints",{get:function(){return this._hints},set:function(t){this._hints=t||null},enumerable:!1,configurable:!0}),t.prototype.listVideoInputDevices=function(){return h(this,void 0,void 0,(function(){var t,e,r,n,o,i,a,s,u,c,f,h;return l(this,(function(l){switch(l.label){case 0:if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=l.sent(),e=[];try{for(r=d(t),n=r.next();!n.done;n=r.next())o=n.value,"videoinput"===(i="video"===o.kind?"videoinput":o.kind)&&(a=o.deviceId||o.id,s=o.label||"Video device "+(e.length+1),u=o.groupId,c={deviceId:a,label:s,kind:i,groupId:u},e.push(c))}catch(t){f={error:t}}finally{try{n&&!n.done&&(h=r.return)&&h.call(r)}finally{if(f)throw f.error}}return[2,e]}}))}))},t.prototype.getVideoInputDevices=function(){return h(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.listVideoInputDevices()];case 1:return[2,t.sent().map((function(t){return new f.a(t.deviceId,t.label)}))]}}))}))},t.prototype.findDeviceById=function(t){return h(this,void 0,void 0,(function(){var e;return l(this,(function(r){switch(r.label){case 0:return[4,this.listVideoInputDevices()];case 1:return(e=r.sent())?[2,e.find((function(e){return e.deviceId===t}))]:[2,null]}}))}))},t.prototype.decodeFromInputVideoDevice=function(t,e){return h(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this.decodeOnceFromVideoDevice(t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.decodeOnceFromVideoDevice=function(t,e){return h(this,void 0,void 0,(function(){var r;return l(this,(function(n){switch(n.label){case 0:return this.reset(),r={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.decodeOnceFromConstraints=function(t,e){return h(this,void 0,void 0,(function(){var r;return l(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return r=n.sent(),[4,this.decodeOnceFromStream(r,e)];case 2:return[2,n.sent()]}}))}))},t.prototype.decodeOnceFromStream=function(t,e){return h(this,void 0,void 0,(function(){var r;return l(this,(function(n){switch(n.label){case 0:return this.reset(),[4,this.attachStreamToVideo(t,e)];case 1:return r=n.sent(),[4,this.decodeOnce(r)];case 2:return[2,n.sent()]}}))}))},t.prototype.decodeFromInputVideoDeviceContinuously=function(t,e,r){return h(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,this.decodeFromVideoDevice(t,e,r)];case 1:return[2,n.sent()]}}))}))},t.prototype.decodeFromVideoDevice=function(t,e,r){return h(this,void 0,void 0,(function(){var n;return l(this,(function(o){switch(o.label){case 0:return n={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(n,e,r)];case 1:return[2,o.sent()]}}))}))},t.prototype.decodeFromConstraints=function(t,e,r){return h(this,void 0,void 0,(function(){var n;return l(this,(function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return n=o.sent(),[4,this.decodeFromStream(n,e,r)];case 2:return[2,o.sent()]}}))}))},t.prototype.decodeFromStream=function(t,e,r){return h(this,void 0,void 0,(function(){var n;return l(this,(function(o){switch(o.label){case 0:return this.reset(),[4,this.attachStreamToVideo(t,e)];case 1:return n=o.sent(),[4,this.decodeContinuously(n,r)];case 2:return[2,o.sent()]}}))}))},t.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},t.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},t.prototype.attachStreamToVideo=function(t,e){return h(this,void 0,void 0,(function(){var r;return l(this,(function(n){switch(n.label){case 0:return r=this.prepareVideoElement(e),this.addVideoSource(r,t),this.videoElement=r,this.stream=t,[4,this.playVideoOnLoadAsync(r)];case 1:return n.sent(),[2,r]}}))}))},t.prototype.playVideoOnLoadAsync=function(t){var e=this;return new Promise((function(r,n){return e.playVideoOnLoad(t,(function(){return r()}))}))},t.prototype.playVideoOnLoad=function(t,e){var r=this;this.videoEndedListener=function(){return r.stopStreams()},this.videoCanPlayListener=function(){return r.tryPlayVideo(t)},t.addEventListener("ended",this.videoEndedListener),t.addEventListener("canplay",this.videoCanPlayListener),t.addEventListener("playing",e),this.tryPlayVideo(t)},t.prototype.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&!t.ended&&t.readyState>2},t.prototype.tryPlayVideo=function(t){return h(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:if(this.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,t.play()];case 2:return e.sent(),[3,4];case 3:return e.sent(),console.warn("It was not possible to play the video."),[3,4];case 4:return[2]}}))}))},t.prototype.getMediaElement=function(t,e){var r=document.getElementById(t);if(!r)throw new n.a("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new n.a("element with id '"+t+"' must be an "+e+" element");return r},t.prototype.decodeFromImage=function(t,e){if(!t&&!e)throw new n.a("either imageElement with a src set or an url must be provided");return e&&!t?this.decodeFromImageUrl(e):this.decodeFromImageElement(t)},t.prototype.decodeFromVideo=function(t,e){if(!t&&!e)throw new n.a("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrl(e):this.decodeFromVideoElement(t)},t.prototype.decodeFromVideoContinuously=function(t,e,r){if(void 0===t&&void 0===e)throw new n.a("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrlContinuously(e,r):this.decodeFromVideoElementContinuously(t,r)},t.prototype.decodeFromImageElement=function(t){if(!t)throw new n.a("An image element must be provided.");this.reset();var e=this.prepareImageElement(t);return this.imageElement=e,this.isImageLoaded(e)?this.decodeOnce(e,!1,!0):this._decodeOnLoadImage(e)},t.prototype.decodeFromVideoElement=function(t){var e=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideo(e)},t.prototype.decodeFromVideoElementContinuously=function(t,e){var r=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideoContinuously(r,e)},t.prototype._decodeFromVideoElementSetup=function(t){if(!t)throw new n.a("A video element must be provided.");this.reset();var e=this.prepareVideoElement(t);return this.videoElement=e,e},t.prototype.decodeFromImageUrl=function(t){if(!t)throw new n.a("An URL must be provided.");this.reset();var e=this.prepareImageElement();this.imageElement=e;var r=this._decodeOnLoadImage(e);return e.src=t,r},t.prototype.decodeFromVideoUrl=function(t){if(!t)throw new n.a("An URL must be provided.");this.reset();var e=this.prepareVideoElement(),r=this.decodeFromVideoElement(e);return e.src=t,r},t.prototype.decodeFromVideoUrlContinuously=function(t,e){if(!t)throw new n.a("An URL must be provided.");this.reset();var r=this.prepareVideoElement(),o=this.decodeFromVideoElementContinuously(r,e);return r.src=t,o},t.prototype._decodeOnLoadImage=function(t){var e=this;return new Promise((function(r,n){e.imageLoadedListener=function(){return e.decodeOnce(t,!1,!0).then(r,n)},t.addEventListener("load",e.imageLoadedListener)}))},t.prototype._decodeOnLoadVideo=function(t){return h(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,this.playVideoOnLoadAsync(t)];case 1:return e.sent(),[4,this.decodeOnce(t)];case 2:return[2,e.sent()]}}))}))},t.prototype._decodeOnLoadVideoContinuously=function(t,e){return h(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this.playVideoOnLoadAsync(t)];case 1:return r.sent(),this.decodeContinuously(t,e),[2]}}))}))},t.prototype.isImageLoaded=function(t){return!!t.complete&&0!==t.naturalWidth},t.prototype.prepareImageElement=function(t){var e;return void 0===t&&((e=document.createElement("img")).width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"img")),t instanceof HTMLImageElement&&(e=t),e},t.prototype.prepareVideoElement=function(t){var e;return t||"undefined"==typeof document||((e=document.createElement("video")).width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"video")),t instanceof HTMLVideoElement&&(e=t),e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e},t.prototype.decodeOnce=function(t,e,r){var n=this;void 0===e&&(e=!0),void 0===r&&(r=!0),this._stopAsyncDecode=!1;var o=function(a,c){if(n._stopAsyncDecode)return c(new u.a("Video stream has ended before any code could be detected.")),void(n._stopAsyncDecode=void 0);try{a(n.decode(t))}catch(t){var f=e&&t instanceof u.a,h=t instanceof i.a||t instanceof s.a;if(f||h&&r)return setTimeout(o,n._timeBetweenDecodingAttempts,a,c);c(t)}};return new Promise((function(t,e){return o(t,e)}))},t.prototype.decodeContinuously=function(t,e){var r=this;this._stopContinuousDecode=!1;var n=function(){if(r._stopContinuousDecode)r._stopContinuousDecode=void 0;else try{var o=r.decode(t);e(o,null),setTimeout(n,r.timeBetweenScansMillis)}catch(t){e(null,t);var a=t instanceof i.a||t instanceof s.a,c=t instanceof u.a;(a||c)&&setTimeout(n,r._timeBetweenDecodingAttempts)}};n()},t.prototype.decode=function(t){var e=this.createBinaryBitmap(t);return this.decodeBitmap(e)},t.prototype.createBinaryBitmap=function(t){this.getCaptureCanvasContext(t);t instanceof HTMLVideoElement?this.drawFrameOnCanvas(t):this.drawImageOnCanvas(t);var e=this.getCaptureCanvas(t),r=new c.a(e),n=new a.a(r);return new o.a(n)},t.prototype.getCaptureCanvasContext=function(t){if(!this.captureCanvasContext){var e=this.getCaptureCanvas(t),r=void 0;try{r=e.getContext("2d",{willReadFrequently:!0})}catch(t){r=e.getContext("2d")}this.captureCanvasContext=r}return this.captureCanvasContext},t.prototype.getCaptureCanvas=function(t){if(!this.captureCanvas){var e=this.createCaptureCanvas(t);this.captureCanvas=e}return this.captureCanvas},t.prototype.drawFrameOnCanvas=function(t,e,r){void 0===e&&(e={sx:0,sy:0,sWidth:t.videoWidth,sHeight:t.videoHeight,dx:0,dy:0,dWidth:t.videoWidth,dHeight:t.videoHeight}),void 0===r&&(r=this.captureCanvasContext),r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)},t.prototype.drawImageOnCanvas=function(t,e,r){void 0===e&&(e={sx:0,sy:0,sWidth:t.naturalWidth,sHeight:t.naturalHeight,dx:0,dy:0,dWidth:t.naturalWidth,dHeight:t.naturalHeight}),void 0===r&&(r=this.captureCanvasContext),r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)},t.prototype.decodeBitmap=function(t){return this.reader.decode(t,this._hints)},t.prototype.createCaptureCanvas=function(t){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;var e,r,n=document.createElement("canvas");return void 0!==t&&(t instanceof HTMLVideoElement?(e=t.videoWidth,r=t.videoHeight):t instanceof HTMLImageElement&&(e=t.naturalWidth||t.width,r=t.naturalHeight||t.height)),n.style.width=e+"px",n.style.height=r+"px",n.width=e,n.height=r,n},t.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach((function(t){return t.stop()})),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()},t.prototype.reset=function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()},t.prototype._destroyVideoElement=function(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)},t.prototype._destroyImageElement=function(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)},t.prototype._destroyCaptureCanvas=function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0},t.prototype.addVideoSource=function(t,e){try{t.srcObject=e}catch(r){t.src=URL.createObjectURL(e)}},t.prototype.cleanVideoSource=function(t){try{t.srcObject=null}catch(e){t.src=""}this.videoElement.removeAttribute("src")},t}()},function(t,e,r){"use strict";var n=r(61),o=r(10),i=r(3),a=function(){function t(t,e){if(0===e.length)throw new i.a;this.field=t;var r=e.length;if(r>1&&0===e[0]){for(var n=1;na.length){var s=r;r=a,a=s}var u=new Int32Array(a.length),c=a.length-r.length;o.a.arraycopy(a,0,u,0,c);for(var f=c;f=t.getDegree()&&!n.isZero();){var s=n.getDegree()-t.getDegree(),u=e.multiply(n.getCoefficient(n.getDegree()),a),c=t.multiplyByMonomial(s,u),f=e.buildMonomial(s,u);r=r.addOrSubtract(f),n=n.addOrSubtract(c)}return[r,n]},t.prototype.toString=function(){for(var t="",e=this.getDegree();e>=0;e--){var r=this.getCoefficient(e);if(0!==r){if(r<0?(t+=" - ",r=-r):t.length>0&&(t+=" + "),0===e||1!==r){var n=this.field.log(r);0===n?t+="1":1===n?t+="a":(t+="a^",t+=n)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t},t}();e.a=a},function(t,e,r){"use strict";var n=r(23),o=r(68),i=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(){function t(t){for(var e=[],r=1;r=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},h=function(){function t(t,e){for(var r,n,o=[],i=2;i40)throw new c.a;return t.VERSIONS[e-1]},t.decodeVersionInformation=function(e){for(var r=Number.MAX_SAFE_INTEGER,n=0,i=0;i6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e},t.prototype.toString=function(){return""+this.versionNumber},t.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),t.VERSIONS=[new t(1,new Int32Array(0),new a(7,new s(1,19)),new a(10,new s(1,16)),new a(13,new s(1,13)),new a(17,new s(1,9))),new t(2,Int32Array.from([6,18]),new a(10,new s(1,34)),new a(16,new s(1,28)),new a(22,new s(1,22)),new a(28,new s(1,16))),new t(3,Int32Array.from([6,22]),new a(15,new s(1,55)),new a(26,new s(1,44)),new a(18,new s(2,17)),new a(22,new s(2,13))),new t(4,Int32Array.from([6,26]),new a(20,new s(1,80)),new a(18,new s(2,32)),new a(26,new s(2,24)),new a(16,new s(4,9))),new t(5,Int32Array.from([6,30]),new a(26,new s(1,108)),new a(24,new s(2,43)),new a(18,new s(2,15),new s(2,16)),new a(22,new s(2,11),new s(2,12))),new t(6,Int32Array.from([6,34]),new a(18,new s(2,68)),new a(16,new s(4,27)),new a(24,new s(4,19)),new a(28,new s(4,15))),new t(7,Int32Array.from([6,22,38]),new a(20,new s(2,78)),new a(18,new s(4,31)),new a(18,new s(2,14),new s(4,15)),new a(26,new s(4,13),new s(1,14))),new t(8,Int32Array.from([6,24,42]),new a(24,new s(2,97)),new a(22,new s(2,38),new s(2,39)),new a(22,new s(4,18),new s(2,19)),new a(26,new s(4,14),new s(2,15))),new t(9,Int32Array.from([6,26,46]),new a(30,new s(2,116)),new a(22,new s(3,36),new s(2,37)),new a(20,new s(4,16),new s(4,17)),new a(24,new s(4,12),new s(4,13))),new t(10,Int32Array.from([6,28,50]),new a(18,new s(2,68),new s(2,69)),new a(26,new s(4,43),new s(1,44)),new a(24,new s(6,19),new s(2,20)),new a(28,new s(6,15),new s(2,16))),new t(11,Int32Array.from([6,30,54]),new a(20,new s(4,81)),new a(30,new s(1,50),new s(4,51)),new a(28,new s(4,22),new s(4,23)),new a(24,new s(3,12),new s(8,13))),new t(12,Int32Array.from([6,32,58]),new a(24,new s(2,92),new s(2,93)),new a(22,new s(6,36),new s(2,37)),new a(26,new s(4,20),new s(6,21)),new a(28,new s(7,14),new s(4,15))),new t(13,Int32Array.from([6,34,62]),new a(26,new s(4,107)),new a(22,new s(8,37),new s(1,38)),new a(24,new s(8,20),new s(4,21)),new a(22,new s(12,11),new s(4,12))),new t(14,Int32Array.from([6,26,46,66]),new a(30,new s(3,115),new s(1,116)),new a(24,new s(4,40),new s(5,41)),new a(20,new s(11,16),new s(5,17)),new a(24,new s(11,12),new s(5,13))),new t(15,Int32Array.from([6,26,48,70]),new a(22,new s(5,87),new s(1,88)),new a(24,new s(5,41),new s(5,42)),new a(30,new s(5,24),new s(7,25)),new a(24,new s(11,12),new s(7,13))),new t(16,Int32Array.from([6,26,50,74]),new a(24,new s(5,98),new s(1,99)),new a(28,new s(7,45),new s(3,46)),new a(24,new s(15,19),new s(2,20)),new a(30,new s(3,15),new s(13,16))),new t(17,Int32Array.from([6,30,54,78]),new a(28,new s(1,107),new s(5,108)),new a(28,new s(10,46),new s(1,47)),new a(28,new s(1,22),new s(15,23)),new a(28,new s(2,14),new s(17,15))),new t(18,Int32Array.from([6,30,56,82]),new a(30,new s(5,120),new s(1,121)),new a(26,new s(9,43),new s(4,44)),new a(28,new s(17,22),new s(1,23)),new a(28,new s(2,14),new s(19,15))),new t(19,Int32Array.from([6,30,58,86]),new a(28,new s(3,113),new s(4,114)),new a(26,new s(3,44),new s(11,45)),new a(26,new s(17,21),new s(4,22)),new a(26,new s(9,13),new s(16,14))),new t(20,Int32Array.from([6,34,62,90]),new a(28,new s(3,107),new s(5,108)),new a(26,new s(3,41),new s(13,42)),new a(30,new s(15,24),new s(5,25)),new a(28,new s(15,15),new s(10,16))),new t(21,Int32Array.from([6,28,50,72,94]),new a(28,new s(4,116),new s(4,117)),new a(26,new s(17,42)),new a(28,new s(17,22),new s(6,23)),new a(30,new s(19,16),new s(6,17))),new t(22,Int32Array.from([6,26,50,74,98]),new a(28,new s(2,111),new s(7,112)),new a(28,new s(17,46)),new a(30,new s(7,24),new s(16,25)),new a(24,new s(34,13))),new t(23,Int32Array.from([6,30,54,78,102]),new a(30,new s(4,121),new s(5,122)),new a(28,new s(4,47),new s(14,48)),new a(30,new s(11,24),new s(14,25)),new a(30,new s(16,15),new s(14,16))),new t(24,Int32Array.from([6,28,54,80,106]),new a(30,new s(6,117),new s(4,118)),new a(28,new s(6,45),new s(14,46)),new a(30,new s(11,24),new s(16,25)),new a(30,new s(30,16),new s(2,17))),new t(25,Int32Array.from([6,32,58,84,110]),new a(26,new s(8,106),new s(4,107)),new a(28,new s(8,47),new s(13,48)),new a(30,new s(7,24),new s(22,25)),new a(30,new s(22,15),new s(13,16))),new t(26,Int32Array.from([6,30,58,86,114]),new a(28,new s(10,114),new s(2,115)),new a(28,new s(19,46),new s(4,47)),new a(28,new s(28,22),new s(6,23)),new a(30,new s(33,16),new s(4,17))),new t(27,Int32Array.from([6,34,62,90,118]),new a(30,new s(8,122),new s(4,123)),new a(28,new s(22,45),new s(3,46)),new a(30,new s(8,23),new s(26,24)),new a(30,new s(12,15),new s(28,16))),new t(28,Int32Array.from([6,26,50,74,98,122]),new a(30,new s(3,117),new s(10,118)),new a(28,new s(3,45),new s(23,46)),new a(30,new s(4,24),new s(31,25)),new a(30,new s(11,15),new s(31,16))),new t(29,Int32Array.from([6,30,54,78,102,126]),new a(30,new s(7,116),new s(7,117)),new a(28,new s(21,45),new s(7,46)),new a(30,new s(1,23),new s(37,24)),new a(30,new s(19,15),new s(26,16))),new t(30,Int32Array.from([6,26,52,78,104,130]),new a(30,new s(5,115),new s(10,116)),new a(28,new s(19,47),new s(10,48)),new a(30,new s(15,24),new s(25,25)),new a(30,new s(23,15),new s(25,16))),new t(31,Int32Array.from([6,30,56,82,108,134]),new a(30,new s(13,115),new s(3,116)),new a(28,new s(2,46),new s(29,47)),new a(30,new s(42,24),new s(1,25)),new a(30,new s(23,15),new s(28,16))),new t(32,Int32Array.from([6,34,60,86,112,138]),new a(30,new s(17,115)),new a(28,new s(10,46),new s(23,47)),new a(30,new s(10,24),new s(35,25)),new a(30,new s(19,15),new s(35,16))),new t(33,Int32Array.from([6,30,58,86,114,142]),new a(30,new s(17,115),new s(1,116)),new a(28,new s(14,46),new s(21,47)),new a(30,new s(29,24),new s(19,25)),new a(30,new s(11,15),new s(46,16))),new t(34,Int32Array.from([6,34,62,90,118,146]),new a(30,new s(13,115),new s(6,116)),new a(28,new s(14,46),new s(23,47)),new a(30,new s(44,24),new s(7,25)),new a(30,new s(59,16),new s(1,17))),new t(35,Int32Array.from([6,30,54,78,102,126,150]),new a(30,new s(12,121),new s(7,122)),new a(28,new s(12,47),new s(26,48)),new a(30,new s(39,24),new s(14,25)),new a(30,new s(22,15),new s(41,16))),new t(36,Int32Array.from([6,24,50,76,102,128,154]),new a(30,new s(6,121),new s(14,122)),new a(28,new s(6,47),new s(34,48)),new a(30,new s(46,24),new s(10,25)),new a(30,new s(2,15),new s(64,16))),new t(37,Int32Array.from([6,28,54,80,106,132,158]),new a(30,new s(17,122),new s(4,123)),new a(28,new s(29,46),new s(14,47)),new a(30,new s(49,24),new s(10,25)),new a(30,new s(24,15),new s(46,16))),new t(38,Int32Array.from([6,32,58,84,110,136,162]),new a(30,new s(4,122),new s(18,123)),new a(28,new s(13,46),new s(32,47)),new a(30,new s(48,24),new s(14,25)),new a(30,new s(42,15),new s(32,16))),new t(39,Int32Array.from([6,26,54,82,110,138,166]),new a(30,new s(20,117),new s(4,118)),new a(28,new s(40,47),new s(7,48)),new a(30,new s(43,24),new s(22,25)),new a(30,new s(10,15),new s(67,16))),new t(40,Int32Array.from([6,30,58,86,114,142,170]),new a(30,new s(19,118),new s(6,119)),new a(28,new s(18,47),new s(31,48)),new a(30,new s(34,24),new s(34,25)),new a(30,new s(20,15),new s(61,16)))],t}();e.a=h},function(t,e,r){"use strict";var n=r(6),o=r(50),i=function(){function t(t,e){this.width=t,this.height=e}return t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.isCropSupported=function(){return!1},t.prototype.crop=function(t,e,r,n){throw new o.a("This luminance source does not support cropping.")},t.prototype.isRotateSupported=function(){return!1},t.prototype.rotateCounterClockwise=function(){throw new o.a("This luminance source does not support rotation by 90 degrees.")},t.prototype.rotateCounterClockwise45=function(){throw new o.a("This luminance source does not support rotation by 45 degrees.")},t.prototype.toString=function(){for(var t=new Uint8ClampedArray(this.width),e=new n.a,r=0;r=0&&this.structuredAppendSequenceNumber>=0},t.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},t.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},t}();e.a=n},function(t,e,r){"use strict";var n=r(27),o=r(34),i=r(59),a=r(31),s=function(){function t(t){this.field=t}return t.prototype.decode=function(t,e){for(var r=this.field,a=new o.a(r,t),s=new Int32Array(e),u=!0,c=0;c=(r/2|0);){var h=s,l=c;if(c=f,(s=u).isZero())throw new i.a("r_{i-1} was zero");u=h;for(var d=o.getZero(),p=s.getCoefficient(s.getDegree()),g=o.inverse(p);u.getDegree()>=s.getDegree()&&!u.isZero();){var y=u.getDegree()-s.getDegree(),w=o.multiply(u.getCoefficient(u.getDegree()),g);d=d.addOrSubtract(o.buildMonomial(y,w)),u=u.addOrSubtract(s.multiplyByMonomial(y,w))}if(f=d.multiply(c).addOrSubtract(l),u.getDegree()>=s.getDegree())throw new a.a("Division algorithm failed to reduce polynomial?")}var v=f.getCoefficient(0);if(0===v)throw new i.a("sigmaTilde(0) was zero");var m=o.inverse(v);return[f.multiplyScalar(m),u.multiplyScalar(m)]},t.prototype.findErrorLocations=function(t){var e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);for(var r=new Int32Array(e),n=0,o=this.field,a=1;a=t.FOR_BITS.size)throw new i.a;return t.FOR_BITS.get(e)},t.FOR_BITS=new Map,t.FOR_VALUE=new Map,t.L=new t(n.L,"L",1),t.M=new t(n.M,"M",0),t.Q=new t(n.Q,"Q",3),t.H=new t(n.H,"H",2),t}();e.a=a},function(t,e,r){"use strict";var n,o=r(36),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(e){var r=t.call(this,e.getWidth(),e.getHeight())||this;return r.delegate=e,r}return i(e,t),e.prototype.getRow=function(t,e){for(var r=this.delegate.getRow(t,e),n=this.getWidth(),o=0;o=0;r--)t=this.copyBit(8,r,t);var n=this.bitMatrix.getHeight(),o=0,i=n-7;for(r=n-1;r>=i;r--)o=this.copyBit(8,r,o);for(e=n-8;e=0;o--)for(var i=t-9;i>=n;i--)r=this.copyBit(i,o,r);var a=l.a.decodeVersionInformation(r);if(null!==a&&a.getDimensionForVersion()===t)return this.parsedVersion=a,a;r=0;for(i=5;i>=0;i--)for(o=t-9;o>=n;o--)r=this.copyBit(i,o,r);if(null!==(a=l.a.decodeVersionInformation(r))&&a.getDimensionForVersion()===t)return this.parsedVersion=a,a;throw new g.a},t.prototype.copyBit=function(t,e,r){return(this.isMirror?this.bitMatrix.get(e,t):this.bitMatrix.get(t,e))?r<<1|1:r<<1},t.prototype.readCodewords=function(){var t=this.readFormatInformation(),e=this.readVersion(),r=p.a.values.get(t.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);for(var o=e.buildFunctionPattern(),i=!0,a=new Uint8Array(e.getTotalCodewords()),s=0,u=0,c=0,f=n-1;f>0;f-=2){6===f&&f--;for(var h=0;h=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},m=function(){function t(t,e){this.numDataCodewords=t,this.codewords=e}return t.getDataBlocks=function(e,r,n){var o,i,a,s;if(e.length!==r.getTotalCodewords())throw new w.a;var u=r.getECBlocksForLevel(n),c=0,f=u.getECBlocks();try{for(var h=v(f),l=h.next();!l.done;l=h.next()){c+=(m=l.value).getCount()}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}var d=new Array(c),p=0;try{for(var g=v(f),y=g.next();!y.done;y=g.next())for(var m=y.value,C=0;C=0;){if(d[I].codewords.length===E)break;I--}I++;var S=E-u.getECCodewordsPerBlock(),T=0;for(C=0;C=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},E=function(){function t(){this.rsDecoder=new h.a(f.a.QR_CODE_FIELD_256)}return t.prototype.decodeBooleanArray=function(t,e){return this.decodeBitMatrix(o.a.parseFromBooleanArray(t),e)},t.prototype.decodeBitMatrix=function(t,e){var r=new y(t),n=null;try{return this.decodeBitMatrixParser(r,e)}catch(t){n=t}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();var o=this.decodeBitMatrixParser(r,e);return o.setOther(new _.a(!0)),o}catch(t){if(null!==n)throw n;throw t}},t.prototype.decodeBitMatrixParser=function(t,e){var r,n,o,i,a=t.readVersion(),s=t.readFormatInformation().getErrorCorrectionLevel(),u=t.readCodewords(),c=m.getDataBlocks(u,a,s),f=0;try{for(var h=A(c),l=h.next();!l.done;l=h.next()){f+=(w=l.value).getNumDataCodewords()}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var d=new Uint8Array(f),p=0;try{for(var g=A(c),y=g.next();!y.done;y=g.next()){var w,v=(w=y.value).getCodewords(),_=w.getNumDataCodewords();this.correctErrors(v,_);for(var E=0;E<_;E++)d[p++]=v[E]}}catch(t){o={error:t}}finally{try{y&&!y.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}return C.a.decode(d,a,s,e)},t.prototype.correctErrors=function(t,e){var r=new Int32Array(t);try{this.rsDecoder.decode(r,t.length-e)}catch(t){throw new c.a}for(var n=0;n=c||i>=s)throw new a.a;if(s-i!=c-u&&(c=u+(s-i))>=t.getWidth())throw new a.a;var f=Math.round((c-u+1)/n),h=Math.round((s-i+1)/n);if(f<=0||h<=0)throw new a.a;if(h!==f)throw new a.a;var l=Math.floor(n/2);i+=l;var d=(u+=l)+Math.floor((f-1)*n)-c;if(d>0){if(d>l)throw new a.a;u-=d}var p=i+Math.floor((h-1)*n)-s;if(p>0){if(p>l)throw new a.a;i-=p}for(var g=new o.a(f,h),y=0;y=5&&(n+=t.N1+(u-5)),u=1,c=h)}u>=5&&(n+=t.N1+(u-5))}return n},t.N1=3,t.N2=3,t.N3=40,t.N4=10,t}();e.a=o},function(t,e,r){"use strict";var n,o=r(5),i=r(12),a=r(0),s=r(79),u=r(80),c=r(81),f=r(82),h=r(14),l=r(18),d=r(55),p=r(28),g=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},w=function(t){function e(){var e=t.call(this)||this;return e.decodeMiddleCounters=Int32Array.from([0,0,0,0]),e}return g(e,t),e.prototype.decodeMiddle=function(t,e,r){var n,o,i,a,s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;for(var u=t.getSize(),c=e[1],f=0;f<4&&c=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},E=function(t){function e(){var e=t.call(this)||this;return e.decodeMiddleCounters=new Int32Array(4),e}return _(e,t),e.prototype.decodeMiddle=function(t,r,n){var o,i,a=this.decodeMiddleCounters.map((function(t){return t}));a[0]=0,a[1]=0,a[2]=0,a[3]=0;for(var s=t.getSize(),u=r[1],c=0,f=0;f<6&&u=10&&(c|=1<<5-f)}return e.determineNumSysAndCheckDigit(new C.a(n),c),u},e.prototype.decodeEnd=function(t,r){return e.findGuardPatternWithoutCounters(t,r,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return p.a.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,e){for(var r=0;r<=1;r++)for(var n=0;n<10;n++)if(e===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n])return t.insert(0,"0"+r),void t.append("0"+n);throw a.a.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return o.a.UPC_E},e.convertUPCEtoUPCA=function(t){var e=t.slice(1,7).split("").map((function(t){return t.charCodeAt(0)})),r=new C.a;r.append(t.charAt(0));var n=e[5];switch(n){case 0:case 1:case 2:r.appendChars(e,0,2),r.append(n),r.append("0000"),r.appendChars(e,2,3);break;case 3:r.appendChars(e,0,3),r.append("00000"),r.appendChars(e,3,2);break;case 4:r.appendChars(e,0,4),r.append("00000"),r.append(e[4]);break;default:r.appendChars(e,0,5),r.append("0000"),r.append(n)}return t.length>=8&&r.append(t.charAt(7)),r.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])],e}(p.a),I=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),S=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},T=function(t){function e(e){var r=t.call(this)||this,n=null==e?null:e.get(i.a.POSSIBLE_FORMATS),a=[];return null!=n&&(n.indexOf(o.a.EAN_13)>-1&&a.push(new d.a),n.indexOf(o.a.UPC_A)>-1&&a.push(new m),n.indexOf(o.a.EAN_8)>-1&&a.push(new w),n.indexOf(o.a.UPC_E)>-1&&a.push(new E)),0===a.length&&(a.push(new d.a),a.push(new m),a.push(new w),a.push(new E)),r.readers=a,r}return I(e,t),e.prototype.decodeRow=function(t,e,r){var n,s;try{for(var u=S(this.readers),c=u.next();!c.done;c=u.next()){var f=c.value;try{var l=f.decodeRow(t,e,r),d=l.getBarcodeFormat()===o.a.EAN_13&&"0"===l.getText().charAt(0),p=null==r?null:r.get(i.a.POSSIBLE_FORMATS),g=null==p||p.includes(o.a.UPC_A);if(d&&g){var y=l.getRawBytes(),w=new h.a(l.getText().substring(1),y,l.getResultPoints(),o.a.UPC_A);return w.putAllMetadata(l.getResultMetadata()),w}return l}catch(t){}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}throw new a.a},e.prototype.reset=function(){var t,e;try{for(var r=S(this.readers),n=r.next();!n.done;n=r.next()){n.value.reset()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e}(l.a),b=r(98),O=r(114),R=r(85),N=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),D=function(t){function e(e){var r=t.call(this)||this;r.readers=[];var n=e?e.get(i.a.POSSIBLE_FORMATS):null,a=e&&void 0!==e.get(i.a.ASSUME_CODE_39_CHECK_DIGIT);return n&&((n.includes(o.a.EAN_13)||n.includes(o.a.UPC_A)||n.includes(o.a.EAN_8)||n.includes(o.a.UPC_E))&&r.readers.push(new T(e)),n.includes(o.a.CODE_39)&&r.readers.push(new u.a(a)),n.includes(o.a.CODE_93)&&r.readers.push(new c.a),n.includes(o.a.CODE_128)&&r.readers.push(new s.a),n.includes(o.a.ITF)&&r.readers.push(new f.a),n.includes(o.a.CODABAR)&&r.readers.push(new b.a),n.includes(o.a.RSS_14)&&r.readers.push(new R.a),n.includes(o.a.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),r.readers.push(new O.a))),0===r.readers.length&&(r.readers.push(new T(e)),r.readers.push(new u.a),r.readers.push(new c.a),r.readers.push(new T(e)),r.readers.push(new s.a),r.readers.push(new f.a),r.readers.push(new R.a)),r}return N(e,t),e.prototype.decodeRow=function(t,e,r){for(var n=0;n=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=function(t){function e(){var e=t.call(this)||this;return e.decodeFinderCounters=new Int32Array(4),e.dataCharacterCounters=new Int32Array(8),e.oddRoundingErrors=new Array(4),e.evenRoundingErrors=new Array(4),e.oddCounts=new Array(e.dataCharacterCounters.length/2),e.evenCounts=new Array(e.dataCharacterCounters.length/2),e}return s(e,t),e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,r){for(var n=0;nn&&(n=e[o],r=o);t[r]++},e.decrement=function(t,e){for(var r=0,n=e[0],o=1;o=e.MIN_FINDER_PATTERN_RATIO&&i<=e.MAX_FINDER_PATTERN_RATIO){var a=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;try{for(var c=u(t),f=c.next();!f.done;f=c.next()){var h=f.value;h>s&&(s=h),h3||1!==f))&&(t.pos=o)}e.length()>0&&t.writeCodeword(i.k),this.handleEOD(t,e)},t.prototype.encode=function(t){for(var e=new n.a;t.hasMoreCharacters();){var r=t.getCurrentChar();t.pos++;var a=this.encodeChar(r,e),s=2*Math.floor(e.length()/3),u=t.getCodewordCount()+s;t.updateSymbolInfo(u);var c=t.getSymbolInfo().getDataCapacity()-u;if(!t.hasMoreCharacters()){var f=new n.a;for(e.length()%3==2&&2!==c&&(a=this.backtrackOneCharacter(t,e,f,a));e.length()%3==1&&(a>3||1!==c);)a=this.backtrackOneCharacter(t,e,f,a);break}if(e.length()%3==0)if(o.a.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(i.b);break}}this.handleEOD(t,e)},t.prototype.backtrackOneCharacter=function(t,e,r,n){var o=e.length(),i=e.toString().substring(0,o-n);e.setLengthToZero(),e.append(i),t.pos--;var a=t.getCurrentChar();return n=this.encodeChar(a,r),t.resetSymbolInfo(),n},t.prototype.writeNextTriplet=function(t,e){t.writeCodewords(this.encodeToCodewords(e.toString()));var r=e.toString().substring(3);e.setLengthToZero(),e.append(r)},t.prototype.handleEOD=function(t,e){var r=Math.floor(e.length()/3*2),n=e.length()%3,o=t.getCodewordCount()+r;t.updateSymbolInfo(o);var a=t.getSymbolInfo().getDataCapacity()-o;if(2===n){for(e.append("\0");e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(i.e)}else if(1===a&&1===n){for(;e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(i.e),t.pos--}else{if(0!==n)throw new Error("Unexpected case. Please report!");for(;e.length()>=3;)this.writeNextTriplet(t,e);(a>0||t.hasMoreCharacters())&&t.writeCodeword(i.e)}t.signalEncoderChange(i.b)},t.prototype.encodeChar=function(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0))return e.append(t-65+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t<=127)return e.append(2),e.append(t-96),2;e.append("1");var r=2;return r+=this.encodeChar(t-128,e)},t.prototype.encodeToCodewords=function(t){var e=1600*t.charCodeAt(0)+40*t.charCodeAt(1)+t.charCodeAt(2)+1,r=e/256,o=e%256,i=new n.a;return i.append(r),i.append(o),i.toString()},t}()},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.kind="UnsupportedOperationException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n=function(){function t(){}return t.singletonList=function(t){return[t]},t.sort=function(t,e){t.sort(e.compare)},t.min=function(t,e){return t.sort(e)[0]},t}();e.a=n},function(t,e,r){"use strict";var n=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=function(){function t(){}return t.getRSSvalue=function(e,r,o){var i,a,s=0;try{for(var u=n(e),c=u.next();!c.done;c=u.next()){s+=c.value}}catch(t){i={error:t}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}for(var f=0,h=0,l=e.length,d=0;d=l-d-1&&(g-=t.combins(s-p-(l-d),l-d-2)),l-d-1>1){for(var y=0,w=s-p-(l-d-2);w>r;w--)y+=t.combins(s-p-w-1,l-d-3);g-=y*(l-1-d)}else s-p>r&&g--;f+=g}s-=p}return f},t.combins=function(t,e){var r,n;t-e>e?(n=e,r=t-e):(n=t-e,r=e);for(var o=1,i=1,a=t;a>r;a--)o*=a,i<=n&&(o/=i,i++);for(;i<=n;)o/=i,i++;return o},t}();e.a=o},function(t,e,r){"use strict";var n=r(14),o=r(5),i=r(12),a=r(15),s=r(10),u=r(77),c=r(62),f=function(){function t(){}return t.prototype.decode=function(t,e){void 0===e&&(e=null);var r=null,i=new c.a(t.getBlackMatrix()),f=null,h=null;try{f=(l=i.detectMirror(!1)).getPoints(),this.reportFoundResultPoints(e,f),h=(new u.a).decode(l)}catch(t){r=t}if(null==h)try{var l;f=(l=i.detectMirror(!0)).getPoints(),this.reportFoundResultPoints(e,f),h=(new u.a).decode(l)}catch(t){if(null!=r)throw r;throw t}var d=new n.a(h.getText(),h.getRawBytes(),h.getNumBits(),f,o.a.AZTEC,s.a.currentTimeMillis()),p=h.getByteSegments();null!=p&&d.putMetadata(a.a.BYTE_SEGMENTS,p);var g=h.getECLevel();return null!=g&&d.putMetadata(a.a.ERROR_CORRECTION_LEVEL,g),d},t.prototype.reportFoundResultPoints=function(t,e){if(null!=t){var r=t.get(i.a.NEED_RESULT_POINT_CALLBACK);null!=r&&e.forEach((function(t,e,n){r.foundPossibleResultPoint(t)}))}},t.prototype.reset=function(){},t}();e.a=f},function(t,e,r){"use strict";var n=r(4),o=r(11),i=r(0),a=function(){function t(e,r,n,o){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==r&&(r=t.INIT_SIZE),null==n&&(n=e.getWidth()/2|0),null==o&&(o=e.getHeight()/2|0);var a=r/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=o-a,this.downInit=o+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new i.a}return t.prototype.detect=function(){for(var t=this.leftInit,e=this.rightInit,r=this.upInit,n=this.downInit,o=!1,a=!0,s=!1,u=!1,c=!1,f=!1,h=!1,l=this.width,d=this.height;a;){a=!1;for(var p=!0;(p||!u)&&e=l){o=!0;break}for(var g=!0;(g||!c)&&n=d){o=!0;break}for(var y=!0;(y||!f)&&t>=0;)(y=this.containsBlackPoint(r,n,t,!1))?(t--,a=!0,f=!0):f||t--;if(t<0){o=!0;break}for(var w=!0;(w||!h)&&r>=0;)(w=this.containsBlackPoint(t,e,r,!0))?(r--,a=!0,h=!0):h||r--;if(r<0){o=!0;break}a&&(s=!0)}if(!o&&s){for(var v=e-t,m=null,C=1;null===m&&C=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=function(t){function e(){var e=t.call(this)||this;return e.decodeMiddleCounters=Int32Array.from([0,0,0,0]),e}return s(e,t),e.prototype.decodeMiddle=function(t,r,n){var o,a,s,c,f=this.decodeMiddleCounters;f[0]=0,f[1]=0,f[2]=0,f[3]=0;for(var h=t.getSize(),l=r[1],d=0,p=0;p<6&&l=10&&(d|=1<<5-p)}n=e.determineFirstDigit(n,d),l=i.a.findGuardPattern(t,l,!0,i.a.MIDDLE_PATTERN,new Int32Array(i.a.MIDDLE_PATTERN.length).fill(0))[1];for(p=0;p<6&&l>\n"),t.toString()},t.prototype.setMode=function(t){this.mode=t},t.prototype.setECLevel=function(t){this.ecLevel=t},t.prototype.setVersion=function(t){this.version=t},t.prototype.setMaskPattern=function(t){this.maskPattern=t},t.prototype.setMatrix=function(t){this.matrix=t},t.isValidMaskPattern=function(e){return e>=0&&e=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},w=function(){function t(){}return t.detectMultiple=function(e,r,n){var o=e.getBlackMatrix(),i=t.detect(n,o);return i.length||((o=o.clone()).rotate180(),i=t.detect(n,o)),new g(o,i)},t.detect=function(e,r){for(var n,o,i=new Array,a=0,s=0,u=!1;a0;){if(null==(d=t.findGuardPattern(e,i,--o,n,!1,a,c))){o++;break}g=d}s[0]=new l.a(g[0],o),s[1]=new l.a(g[1],o),u=!0;break}}var f=o+1;if(u){for(var h=0,d=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);ft.SKIPPED_ROW_COUNT_MAX)break;h++}}f-=h+1,s[2]=new l.a(d[0],f),s[3]=new l.a(d[1],f)}return f-o0&&c++h?f-h:h-f;if(l>r)return 1/0;u+=l}return u/o},t.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),t.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),t.MAX_AVG_VARIANCE=.42,t.MAX_INDIVIDUAL_VARIANCE=.8,t.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),t.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),t.MAX_PIXEL_DRIFT=3,t.MAX_PATTERN_DRIFT=5,t.SKIPPED_ROW_COUNT_MAX=25,t.ROW_STEP=5,t.BARCODE_MIN_HEIGHT=10,t}(),v=r(11),m=r(115),C=function(){function t(e,r,n,o,i){e instanceof t?this.constructor_2(e):this.constructor_1(e,r,n,o,i)}return t.prototype.constructor_1=function(t,e,r,n,o){var i=null==e||null==r,a=null==n||null==o;if(i&&a)throw new s.a;i?(e=new l.a(0,n.getY()),r=new l.a(0,o.getY())):a&&(n=new l.a(t.getWidth()-1,e.getY()),o=new l.a(t.getWidth()-1,r.getY())),this.image=t,this.topLeft=e,this.bottomLeft=r,this.topRight=n,this.bottomRight=o,this.minX=Math.trunc(Math.min(e.getX(),r.getX())),this.maxX=Math.trunc(Math.max(n.getX(),o.getX())),this.minY=Math.trunc(Math.min(e.getY(),n.getY())),this.maxY=Math.trunc(Math.max(r.getY(),o.getY()))},t.prototype.constructor_2=function(t){this.image=t.image,this.topLeft=t.getTopLeft(),this.bottomLeft=t.getBottomLeft(),this.topRight=t.getTopRight(),this.bottomRight=t.getBottomRight(),this.minX=t.getMinX(),this.maxX=t.getMaxX(),this.minY=t.getMinY(),this.maxY=t.getMaxY()},t.merge=function(e,r){return null==e?r:null==r?e:new t(e.image,e.topLeft,e.bottomLeft,r.topRight,r.bottomRight)},t.prototype.addMissingRows=function(e,r,n){var o=this.topLeft,i=this.bottomLeft,a=this.topRight,s=this.bottomRight;if(e>0){var u=n?this.topLeft:this.topRight,c=Math.trunc(u.getY()-e);c<0&&(c=0);var f=new l.a(u.getX(),c);n?o=f:a=f}if(r>0){var h=n?this.bottomLeft:this.bottomRight,d=Math.trunc(h.getY()+r);d>=this.image.getHeight()&&(d=this.image.getHeight()-1);var p=new l.a(h.getX(),d);n?i=p:s=p}return new t(this.image,o,i,a,s)},t.prototype.getMinX=function(){return this.minX},t.prototype.getMaxX=function(){return this.maxX},t.prototype.getMinY=function(){return this.minY},t.prototype.getMaxY=function(){return this.maxY},t.prototype.getTopLeft=function(){return this.topLeft},t.prototype.getTopRight=function(){return this.topRight},t.prototype.getBottomLeft=function(){return this.bottomLeft},t.prototype.getBottomRight=function(){return this.bottomRight},t}(),_=function(){function t(t,e,r,n){this.columnCount=t,this.errorCorrectionLevel=n,this.rowCountUpperPart=e,this.rowCountLowerPart=r,this.rowCount=e+r}return t.prototype.getColumnCount=function(){return this.columnCount},t.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},t.prototype.getRowCount=function(){return this.rowCount},t.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},t.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},t}(),A=function(){function t(){this.buffer=""}return t.form=function(t,e){var r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,o,i,a,s){if("%%"===t)return"%";if(void 0!==e[++r]){t=i?parseInt(i.substr(1)):void 0;var u,c=a?parseInt(a.substr(1)):void 0;switch(s){case"s":u=e[r];break;case"c":u=e[r][0];break;case"f":u=parseFloat(e[r]).toFixed(t);break;case"p":u=parseFloat(e[r]).toPrecision(t);break;case"e":u=parseFloat(e[r]).toExponential(t);break;case"x":u=parseInt(e[r]).toString(c||16);break;case"d":u=parseFloat(parseInt(e[r],c||10).toPrecision(t)).toFixed(0)}u="object"==typeof u?JSON.stringify(u):(+u).toString(c);for(var f=parseInt(o),h=o&&o[0]+""=="0"?"0":" ";u.length=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},I=function(){function t(t){this.boundingBox=new C(t),this.codewords=new Array(t.getMaxY()-t.getMinY()+1)}return t.prototype.getCodewordNearby=function(e){var r=this.getCodeword(e);if(null!=r)return r;for(var n=1;n=0&&null!=(r=this.codewords[o]))return r;if((o=this.imageRowToCodewordIndex(e)+n)=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},T=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},b=function(){function t(){this.values=new Map}return t.prototype.setValue=function(t){t=Math.trunc(t);var e=this.values.get(t);null==e&&(e=0),e++,this.values.set(t,e)},t.prototype.getValue=function(){var t,e,r=-1,n=new Array,o=function(t,e){var o=function(){return t},i=function(){return e};i()>r?(r=i(),(n=[]).push(o())):i()===r&&n.push(o())};try{for(var i=S(this.values.entries()),a=i.next();!a.done;a=i.next()){var s=T(a.value,2);o(s[0],s[1])}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return c.a.toIntArray(n)},t.prototype.getConfidence=function(t){return this.values.get(t)},t}(),O=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),R=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},N=function(t){function e(e,r){var n=t.call(this,e)||this;return n._isLeft=r,n}return O(e,t),e.prototype.setRowNumbers=function(){var t,e;try{for(var r=R(this.getCodewords()),n=r.next();!n.done;n=r.next()){var o=n.value;null!=o&&o.setRowNumberAsRowIndicatorColumn()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var e=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(e,t);for(var r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),o=this._isLeft?r.getBottomLeft():r.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.imageRowToCodewordIndex(Math.trunc(o.getY())),s=-1,u=1,c=0,f=i;f=t.getRowCount()||l>f)e[f]=null;else{for(var d=void 0,p=(d=u>2?(u-2)*l:l)>=f,g=1;g<=d&&!p;g++)p=null!=e[f-g];p?e[f]=null:(s=h.getRowNumber(),c=1)}}},e.prototype.getRowHeights=function(){var t,e,r=this.getBarcodeMetadata();if(null==r)return null;this.adjustIncompleteIndicatorColumnRowNumbers(r);var n=new Int32Array(r.getRowCount());try{for(var o=R(this.getCodewords()),i=o.next();!i.done;i=o.next()){var a=i.value;if(null!=a){var s=a.getRowNumber();if(s>=n.length)continue;n[s]++}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var e=this.getBoundingBox(),r=this._isLeft?e.getTopLeft():e.getTopRight(),n=this._isLeft?e.getBottomLeft():e.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.getCodewords(),s=-1,u=1,c=0,f=o;f=t.getRowCount()?a[f]=null:(s=h.getRowNumber(),c=1)}},e.prototype.getBarcodeMetadata=function(){var t,e,r=this.getCodewords(),n=new b,o=new b,i=new b,a=new b;try{for(var s=R(r),u=s.next();!u.done;u=s.next()){var f=u.value;if(null!=f){f.setRowNumberAsRowIndicatorColumn();var h=f.getValue()%30,l=f.getRowNumber();switch(this._isLeft||(l+=2),l%3){case 0:o.setValue(3*h+1);break;case 1:a.setValue(h/3),i.setValue(h%3);break;case 2:n.setValue(h+1)}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}if(0===n.getValue().length||0===o.getValue().length||0===i.getValue().length||0===a.getValue().length||n.getValue()[0]<1||o.getValue()[0]+i.getValue()[0]c.a.MAX_ROWS_IN_BARCODE)return null;var d=new _(n.getValue()[0],o.getValue()[0],i.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(r,d),d},e.prototype.removeIncorrectCodewords=function(t,e){for(var r=0;re.getRowCount())t[r]=null;else switch(this._isLeft||(i+=2),i%3){case 0:3*o+1!==e.getRowCountUpperPart()&&(t[r]=null);break;case 1:Math.trunc(o/3)===e.getErrorCorrectionLevel()&&o%3===e.getRowCountLowerPart()||(t[r]=null);break;case 2:o+1!==e.getColumnCount()&&(t[r]=null)}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+"\n"+t.prototype.toString.call(this)},e}(I),D=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},M=function(){function t(t,e){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=t,this.barcodeColumnCount=t.getColumnCount(),this.boundingBox=e,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return t.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var t,e=c.a.MAX_CODEWORDS_IN_BARCODE;do{t=e,e=this.adjustRowNumbersAndGetCount()}while(e>0&&e0&&i0&&(c[0]=n[r-1],c[4]=s[r-1],c[5]=u[r-1]),r>1&&(c[8]=n[r-2],c[10]=s[r-2],c[11]=u[r-2]),r>=1;n=1&r,t.RATIOS_TABLE[e]||(t.RATIOS_TABLE[e]=new Array(c.a.BARS_IN_MODULE)),t.RATIOS_TABLE[e][c.a.BARS_IN_MODULE-o-1]=Math.fround(i/c.a.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},t.getDecodedValue=function(e){var r=t.getDecodedCodewordValue(t.sampleBitCounts(e));return-1!==r?r:t.getClosestDecodedValue(e)},t.sampleBitCounts=function(t){for(var e=v.a.sum(t),r=new Int32Array(c.a.BARS_IN_MODULE),n=0,o=0,i=0;i1)for(var o=0;o=i)break}u=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},k=function(){function t(){}return t.decode=function(e,r,n,o,i,a,u){for(var c,f=new C(e,r,n,o,i),h=null,l=null,d=!0;;d=!1){if(null!=r&&(h=t.getRowIndicatorColumn(e,f,r,!0,a,u)),null!=o&&(l=t.getRowIndicatorColumn(e,f,o,!1,a,u)),null==(c=t.merge(h,l)))throw s.a.getNotFoundInstance();var p=c.getBoundingBox();if(!d||null==p||!(p.getMinY()f.getMaxY()))break;f=p}c.setBoundingBox(f);var g=c.getBarcodeColumnCount()+1;c.setDetectionResultColumn(0,h),c.setDetectionResultColumn(g,l);for(var y=null!=h,w=1;w<=g;w++){var v=y?w:g-w;if(void 0===c.getDetectionResultColumn(v)){var m=void 0;m=0===v||v===g?new N(f,0===v):new I(f),c.setDetectionResultColumn(v,m);for(var _=-1,A=_,E=f.getMinY();E<=f.getMaxY();E++){if((_=t.getStartColumn(c,v,E,y))<0||_>f.getMaxX()){if(-1===A)continue;_=A}var S=t.detectCodeword(e,f.getMinX(),f.getMaxX(),y,_,E,a,u);null!=S&&(m.setCodeword(E,S),A=_,a=Math.min(a,S.getWidth()),u=Math.max(u,S.getWidth()))}}}return t.createDecoderResult(c)},t.merge=function(e,r){if(null==e&&null==r)return null;var n=t.getBarcodeMetadata(e,r);if(null==n)return null;var o=C.merge(t.adjustBoundingBox(e),t.adjustBoundingBox(r));return new M(n,o)},t.adjustBoundingBox=function(e){var r,n;if(null==e)return null;var o=e.getRowHeights();if(null==o)return null;var i=t.getMax(o),a=0;try{for(var s=x(o),u=s.next();!u.done;u=s.next()){var c=u.value;if(a+=i-c,c>0)break}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}for(var f=e.getCodewords(),h=0;a>0&&null==f[h];h++)a--;var l=0;for(h=o.length-1;h>=0&&(l+=i-o[h],!(o[h]>0));h--);for(h=f.length-1;l>0&&null==f[h];h--)l--;return e.getBoundingBox().addMissingRows(a,l,e.isLeft())},t.getMax=function(t){var e,r,n=-1;try{for(var o=x(t),i=o.next();!i.done;i=o.next()){var a=i.value;n=Math.max(n,a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},t.getBarcodeMetadata=function(t,e){var r,n;return null==t||null==(r=t.getBarcodeMetadata())?null==e?null:e.getBarcodeMetadata():null==e||null==(n=e.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r},t.getRowIndicatorColumn=function(e,r,n,o,i,a){for(var s=new N(r,o),u=0;u<2;u++)for(var c=0===u?1:-1,f=Math.trunc(Math.trunc(n.getX())),h=Math.trunc(Math.trunc(n.getY()));h<=r.getMaxY()&&h>=r.getMinY();h+=c){var l=t.detectCodeword(e,0,e.getWidth(),o,f,h,i,a);null!=l&&(s.setCodeword(h,l),f=o?l.getStartX():l.getEndX())}return s},t.adjustCodewordCount=function(e,r){var n=r[0][1],o=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-t.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===o.length){if(i<1||i>c.a.MAX_CODEWORDS_IN_BARCODE)throw s.a.getNotFoundInstance();n.setValue(i)}else o[0]!==i&&n.setValue(i)},t.createDecoderResult=function(e){var r=t.createBarcodeMatrix(e);t.adjustCodewordCount(e,r);for(var n=new Array,o=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],a=new Array,s=0;s0;){for(var c=0;c=0){if(g>=i.length)continue;i[g][u].setValue(p.getValue())}}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}u++}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}return i},t.isValidBarcodeColumn=function(t,e){return e>=0&&e<=t.getBarcodeColumnCount()+1},t.getStartColumn=function(e,r,n,o){var i,a,s=o?1:-1,u=null;if(t.isValidBarcodeColumn(e,r-s)&&(u=e.getDetectionResultColumn(r-s).getCodeword(n)),null!=u)return o?u.getEndX():u.getStartX();if(null!=(u=e.getDetectionResultColumn(r).getCodewordNearby(n)))return o?u.getStartX():u.getEndX();if(t.isValidBarcodeColumn(e,r-s)&&(u=e.getDetectionResultColumn(r-s).getCodewordNearby(n)),null!=u)return o?u.getEndX():u.getStartX();for(var c=0;t.isValidBarcodeColumn(e,r-s);){r-=s;try{for(var f=(i=void 0,x(e.getDetectionResultColumn(r).getCodewords())),h=f.next();!h.done;h=f.next()){var l=h.value;if(null!=l)return(o?l.getEndX():l.getStartX())+s*c*(l.getEndX()-l.getStartX())}}catch(t){i={error:t}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}c++}return o?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},t.detectCodeword=function(e,r,n,o,i,a,s,u){i=t.adjustCodewordStartColumn(e,r,n,o,i,a);var f,h=t.getModuleBitCount(e,r,n,o,i,a);if(null==h)return null;var l=v.a.sum(h);if(o)f=i+l;else{for(var d=0;d=e)&&u=r:st.CODEWORD_SKEW_SIZE)return i;s+=u}u=-u,o=!o}return s},t.checkCodewordSkew=function(e,r,n){return r-t.CODEWORD_SKEW_SIZE<=e&&e<=n+t.CODEWORD_SKEW_SIZE},t.decodeCodewords=function(e,r,n){if(0===e.length)throw a.a.getFormatInstance();var o=1<n/2+t.MAX_ERRORS||n<0||n>t.MAX_EC_CODEWORDS)throw i.a.getChecksumInstance();return t.errorCorrection.decode(e,n,r)},t.verifyCodewordCount=function(t,e){if(t.length<4)throw a.a.getFormatInstance();var r=t[0];if(r>t.length)throw a.a.getFormatInstance();if(0===r){if(!(e>=1;return e},t.getCodewordBucketNumber=function(t){return t instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(t):this.getCodewordBucketNumber_number(t)},t.getCodewordBucketNumber_number=function(e){return t.getCodewordBucketNumber(t.getBitCountForCodeword(e))},t.getCodewordBucketNumber_Int32Array=function(t){return(t[0]-t[2]+t[4]-t[6]+9)%9},t.toString=function(t){for(var e=new A,r=0;r=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},U=function(){function t(){}return t.prototype.decode=function(e,r){void 0===r&&(r=null);var n=t.decode(e,r,!1);if(null==n||0===n.length||null==n[0])throw s.a.getNotFoundInstance();return n[0]},t.prototype.decodeMultiple=function(t,e){return void 0===e&&(e=null),e?this.decodeMultipleImpl(t,e):this.decodeMultipleOverload1(t)},t.prototype.decodeMultipleOverload1=function(t){return this.decodeMultipleImpl(t,null)},t.prototype.decodeMultipleImpl=function(e,r){void 0===r&&(r=null);try{return t.decode(e,r,!0)}catch(t){if(t instanceof a.a||t instanceof i.a)throw s.a.getNotFoundInstance();throw t}},t.decode=function(e,r,n){var i,a,s=new Array,c=w.detectMultiple(e,r,n);try{for(var f=V(c.getPoints()),l=f.next();!l.done;l=f.next()){var d=l.value,p=k.decode(c.getBits(),d[4],d[5],d[6],d[7],t.getMinCodewordWidth(d),t.getMaxCodewordWidth(d)),g=new u.a(p.getText(),p.getRawBytes(),d,o.a.PDF_417);g.putMetadata(h.a.ERROR_CORRECTION_LEVEL,p.getECLevel());var y=p.getOther();null!=y&&g.putMetadata(h.a.PDF417_EXTRA_METADATA,y),s.push(g)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}return s.map((function(t){return t}))},t.getMaxWidth=function(t,e){return null==t||null==e?0:Math.trunc(Math.abs(t.getX()-e.getX()))},t.getMinWidth=function(t,e){return null==t||null==e?f.a.MAX_VALUE:Math.trunc(Math.abs(t.getX()-e.getX()))},t.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(t.getMaxWidth(e[0],e[4]),t.getMaxWidth(e[6],e[2])*c.a.MODULES_IN_CODEWORD/c.a.MODULES_IN_STOP_PATTERN),Math.max(t.getMaxWidth(e[1],e[5]),t.getMaxWidth(e[7],e[3])*c.a.MODULES_IN_CODEWORD/c.a.MODULES_IN_STOP_PATTERN)))},t.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(t.getMinWidth(e[0],e[4]),t.getMinWidth(e[6],e[2])*c.a.MODULES_IN_CODEWORD/c.a.MODULES_IN_STOP_PATTERN),Math.min(t.getMinWidth(e[1],e[5]),t.getMinWidth(e[7],e[3])*c.a.MODULES_IN_CODEWORD/c.a.MODULES_IN_STOP_PATTERN)))},t.prototype.reset=function(){},t}();e.a=U},function(t,e,r){"use strict";var n=r(5),o=r(23),i=r(12),a=r(0),s=r(14),u=r(15),c=r(10),f=r(20),h=r(27),l=r(38),d=r(2),p=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},g=function(){function t(t,e,r){this.ecCodewords=t,this.ecBlocks=[e],r&&this.ecBlocks.push(r)}return t.prototype.getECCodewords=function(){return this.ecCodewords},t.prototype.getECBlocks=function(){return this.ecBlocks},t}(),y=function(){function t(t,e){this.count=t,this.dataCodewords=e}return t.prototype.getCount=function(){return this.count},t.prototype.getDataCodewords=function(){return this.dataCodewords},t}(),w=function(){function t(t,e,r,n,o,i){var a,s;this.versionNumber=t,this.symbolSizeRows=e,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=o,this.ecBlocks=i;var u=0,c=i.getECCodewords(),f=i.getECBlocks();try{for(var h=p(f),l=h.next();!l.done;l=h.next()){var d=l.value;u+=d.getCount()*(d.getDataCodewords()+c)}}catch(t){a={error:t}}finally{try{l&&!l.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}this.totalCodewords=u}return t.prototype.getVersionNumber=function(){return this.versionNumber},t.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},t.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},t.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},t.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},t.prototype.getTotalCodewords=function(){return this.totalCodewords},t.prototype.getECBlocks=function(){return this.ecBlocks},t.getVersionForDimensions=function(e,r){var n,o;if(0!=(1&e)||0!=(1&r))throw new d.a;try{for(var i=p(t.VERSIONS),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.symbolSizeRows===e&&s.symbolSizeColumns===r)return s}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}throw new d.a},t.prototype.toString=function(){return""+this.versionNumber},t.buildVersions=function(){return[new t(1,10,10,8,8,new g(5,new y(1,3))),new t(2,12,12,10,10,new g(7,new y(1,5))),new t(3,14,14,12,12,new g(10,new y(1,8))),new t(4,16,16,14,14,new g(12,new y(1,12))),new t(5,18,18,16,16,new g(14,new y(1,18))),new t(6,20,20,18,18,new g(18,new y(1,22))),new t(7,22,22,20,20,new g(20,new y(1,30))),new t(8,24,24,22,22,new g(24,new y(1,36))),new t(9,26,26,24,24,new g(28,new y(1,44))),new t(10,32,32,14,14,new g(36,new y(1,62))),new t(11,36,36,16,16,new g(42,new y(1,86))),new t(12,40,40,18,18,new g(48,new y(1,114))),new t(13,44,44,20,20,new g(56,new y(1,144))),new t(14,48,48,22,22,new g(68,new y(1,174))),new t(15,52,52,24,24,new g(42,new y(2,102))),new t(16,64,64,14,14,new g(56,new y(2,140))),new t(17,72,72,16,16,new g(36,new y(4,92))),new t(18,80,80,18,18,new g(48,new y(4,114))),new t(19,88,88,20,20,new g(56,new y(4,144))),new t(20,96,96,22,22,new g(68,new y(4,174))),new t(21,104,104,24,24,new g(56,new y(6,136))),new t(22,120,120,18,18,new g(68,new y(6,175))),new t(23,132,132,20,20,new g(62,new y(8,163))),new t(24,144,144,22,22,new g(62,new y(8,156),new y(2,155))),new t(25,8,18,6,16,new g(7,new y(1,5))),new t(26,8,32,6,14,new g(11,new y(1,10))),new t(27,12,26,10,24,new g(14,new y(1,16))),new t(28,12,36,10,16,new g(18,new y(1,22))),new t(29,16,36,14,16,new g(24,new y(1,32))),new t(30,16,48,14,22,new g(28,new y(1,49)))]},t.VERSIONS=t.buildVersions(),t}(),v=r(3),m=function(){function t(e){var r=e.getHeight();if(r<8||r>144||0!=(1&r))throw new d.a;this.version=t.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new o.a(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return t.prototype.getVersion=function(){return this.version},t.readVersion=function(t){var e=t.getHeight(),r=t.getWidth();return w.getVersionForDimensions(e,r)},t.prototype.readCodewords=function(){var t=new Int8Array(this.version.getTotalCodewords()),e=0,r=4,n=0,o=this.mappingBitMatrix.getHeight(),i=this.mappingBitMatrix.getWidth(),a=!1,s=!1,u=!1,c=!1;do{if(r!==o||0!==n||a)if(r!==o-2||0!==n||0==(3&i)||s)if(r!==o+4||2!==n||0!=(7&i)||u)if(r!==o-2||0!==n||4!=(7&i)||c){do{r=0&&!this.readMappingMatrix.get(n,r)&&(t[e++]=255&this.readUtah(r,n,o,i)),r-=2,n+=2}while(r>=0&&n=0&&n=0);r+=3,n+=1}else t[e++]=255&this.readCorner4(o,i),r-=2,n+=2,c=!0;else t[e++]=255&this.readCorner3(o,i),r-=2,n+=2,u=!0;else t[e++]=255&this.readCorner2(o,i),r-=2,n+=2,s=!0;else t[e++]=255&this.readCorner1(o,i),r-=2,n+=2,a=!0}while(r=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_=function(){function t(t,e){this.numDataCodewords=t,this.codewords=e}return t.getDataBlocks=function(e,r){var n,o,i,a,s=r.getECBlocks(),u=0,c=s.getECBlocks();try{for(var f=C(c),h=f.next();!h.done;h=f.next()){u+=(y=h.value).getCount()}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}var l=new Array(u),d=0;try{for(var p=C(c),g=p.next();!g.done;g=p.next())for(var y=g.value,w=0;w7?w-1:w;l[R].codewords[N]=e[I++]}if(I!==e.length)throw new v.a;return l},t.prototype.getNumDataCodewords=function(){return this.numDataCodewords},t.prototype.getCodewords=function(){return this.codewords},t}(),A=r(99),E=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},I=function(){function t(){this.rsDecoder=new l.a(h.a.DATA_MATRIX_FIELD_256)}return t.prototype.decode=function(t){var e,r,n=new m(t),o=n.getVersion(),i=n.readCodewords(),a=_.getDataBlocks(i,o),s=0;try{for(var u=E(a),c=u.next();!c.done;c=u.next()){s+=c.value.getNumDataCodewords()}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}for(var f=new Uint8Array(s),h=a.length,l=0;la&&(c=a,f[0]=e,f[1]=r,f[2]=n,f[3]=o),c>s&&(c=s,f[0]=r,f[1]=n,f[2]=o,f[3]=e),c>u&&(f[0]=n,f[1]=o,f[2]=e,f[3]=r),f},t.prototype.detectSolid2=function(e){var r=e[0],n=e[1],o=e[2],i=e[3],a=this.transitionsBetween(r,i),s=t.shiftPoint(n,o,4*(a+1)),u=t.shiftPoint(o,n,4*(a+1));return this.transitionsBetween(s,r)this.transitionsBetween(u,h)+this.transitionsBetween(c,h)?f:h:f:this.isValid(h)?h:null},t.prototype.shiftToModuleCenter=function(e){var r=e[0],n=e[1],o=e[2],i=e[3],a=this.transitionsBetween(r,i)+1,s=this.transitionsBetween(o,i)+1,u=t.shiftPoint(r,n,4*s),c=t.shiftPoint(o,n,4*a);1==(1&(a=this.transitionsBetween(u,i)+1))&&(a+=1),1==(1&(s=this.transitionsBetween(c,i)+1))&&(s+=1);var f,h,l=(r.getX()+n.getX()+o.getX()+i.getX())/4,d=(r.getY()+n.getY()+o.getY()+i.getY())/4;return r=t.moveAway(r,l,d),n=t.moveAway(n,l,d),o=t.moveAway(o,l,d),i=t.moveAway(i,l,d),u=t.shiftPoint(r,n,4*s),u=t.shiftPoint(u,i,4*a),f=t.shiftPoint(n,r,4*s),f=t.shiftPoint(f,o,4*a),c=t.shiftPoint(o,i,4*s),c=t.shiftPoint(c,n,4*a),h=t.shiftPoint(i,o,4*s),[u,f,c,h=t.shiftPoint(h,r,4*a)]},t.prototype.isValid=function(t){return t.getX()>=0&&t.getX()0&&t.getY()Math.abs(o-r);if(a){var s=r;r=n,n=s,s=o,o=i,i=s}for(var u=Math.abs(o-r),c=Math.abs(i-n),f=-u/2,h=n0){if(y===i)break;y+=h,f-=u}}return d},t}(),N=function(){function t(){this.decoder=new I}return t.prototype.decode=function(e,r){var o,a;if(void 0===r&&(r=null),null!=r&&r.has(i.a.PURE_BARCODE)){var f=t.extractPureBits(e.getBlackMatrix());o=this.decoder.decode(f),a=t.NO_POINTS}else{var h=new R(e.getBlackMatrix()).detect();o=this.decoder.decode(h.getBits()),a=h.getPoints()}var l=o.getRawBytes(),d=new s.a(o.getText(),l,8*l.length,a,n.a.DATA_MATRIX,c.a.currentTimeMillis()),p=o.getByteSegments();null!=p&&d.putMetadata(u.a.BYTE_SEGMENTS,p);var g=o.getECLevel();return null!=g&&d.putMetadata(u.a.ERROR_CORRECTION_LEVEL,g),d},t.prototype.reset=function(){},t.extractPureBits=function(t){var e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null==e||null==r)throw new a.a;var n=this.moduleSize(e,t),i=e[1],s=r[1],u=e[0],c=(r[0]-u+1)/n,f=(s-i+1)/n;if(c<=0||f<=0)throw new a.a;var h=n/2;i+=h,u+=h;for(var l=new o.a(c,f),d=0;d>1&127):(n<<=10,n+=(i>>2&992)+(i>>1&31))}var a=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=1+(a>>6),this.nbDataBlocks=1+(63&a)):(this.nbLayers=1+(a>>11),this.nbDataBlocks=1+(2047&a))},t.prototype.getRotation=function(t,e){var r=0;t.forEach((function(t,n,o){r=(r<<3)+((t>>e-2<<1)+(1&t))})),r=((1&r)<<11)+(r>>1);for(var n=0;n<4;n++)if(h.a.bitCount(r^this.EXPECTED_CORNER_BITS[n])<=2)return n;throw new c.a},t.prototype.getCorrectedParameterData=function(t,e){var r,n;e?(r=7,n=2):(r=10,n=4);for(var o=r-n,i=new Int32Array(r),a=r-1;a>=0;--a)i[a]=15&t,t>>=4;try{new u.a(s.a.AZTEC_PARAM).decode(i,o)}catch(t){throw new c.a}var f=0;for(a=0;a2){var l=this.distancePoint(h,s)*this.nbCenterLayers/(this.distancePoint(i,e)*(this.nbCenterLayers+2));if(l<.75||l>1.25||!this.isWhiteOrBlackRectangle(s,u,f,h))break}e=s,r=u,o=f,i=h,a=!a}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new c.a;this.compact=5===this.nbCenterLayers;var d=new n.a(e.getX()+.5,e.getY()-.5),p=new n.a(r.getX()+.5,r.getY()+.5),g=new n.a(o.getX()-.5,o.getY()+.5),y=new n.a(i.getX()-.5,i.getY()-.5);return this.expandSquare([d,p,g,y],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},t.prototype.getMatrixCenter=function(){var t,e,r,n;try{t=(f=new a.a(this.image).detect())[0],e=f[1],r=f[2],n=f[3]}catch(i){var o=this.image.getWidth()/2,s=this.image.getHeight()/2;t=this.getFirstDifferent(new l(o+7,s-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new l(o+7,s+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new l(o-7,s+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new l(o-7,s-7),!1,-1,-1).toResultPoint()}var u=i.a.round((t.getX()+n.getX()+e.getX()+r.getX())/4),c=i.a.round((t.getY()+n.getY()+e.getY()+r.getY())/4);try{var f;t=(f=new a.a(this.image,15,u,c).detect())[0],e=f[1],r=f[2],n=f[3]}catch(o){t=this.getFirstDifferent(new l(u+7,c-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new l(u+7,c+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new l(u-7,c+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new l(u-7,c-7),!1,-1,-1).toResultPoint()}return u=i.a.round((t.getX()+n.getX()+e.getX()+r.getX())/4),c=i.a.round((t.getY()+n.getY()+e.getY()+r.getY())/4),new l(u,c)},t.prototype.getMatrixCornerPoints=function(t){return this.expandSquare(t,2*this.nbCenterLayers,this.getDimension())},t.prototype.sampleGrid=function(t,e,r,n,o){var i=f.a.getInstance(),a=this.getDimension(),s=a/2-this.nbCenterLayers,u=a/2+this.nbCenterLayers;return i.sampleGrid(t,a,a,s,s,u,s,u,u,s,u,e.getX(),e.getY(),r.getX(),r.getY(),n.getX(),n.getY(),o.getX(),o.getY())},t.prototype.sampleLine=function(t,e,r){for(var n=0,o=this.distanceResultPoint(t,e),a=o/r,s=t.getX(),u=t.getY(),c=a*(e.getX()-t.getX())/o,f=a*(e.getY()-t.getY())/o,h=0;h.1&&l<.9?0:l<=.1===c?1:-1},t.prototype.getFirstDifferent=function(t,e,r,n){for(var o=t.getX()+r,i=t.getY()+n;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=r,i+=n;for(o-=r,i-=n;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=r;for(o-=r;this.isValid(o,i)&&this.image.get(o,i)===e;)i+=n;return new l(o,i-=n)},t.prototype.expandSquare=function(t,e,r){var o=r/(2*e),i=t[0].getX()-t[2].getX(),a=t[0].getY()-t[2].getY(),s=(t[0].getX()+t[2].getX())/2,u=(t[0].getY()+t[2].getY())/2,c=new n.a(s+o*i,u+o*a),f=new n.a(s-o*i,u-o*a);return i=t[1].getX()-t[3].getX(),a=t[1].getY()-t[3].getY(),s=(t[1].getX()+t[3].getX())/2,u=(t[1].getY()+t[3].getY())/2,[c,new n.a(s+o*i,u+o*a),f,new n.a(s-o*i,u-o*a)]},t.prototype.isValid=function(t,e){return t>=0&&t0&&e=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(){function t(t,e,r,n,o,i,a,s){void 0===a&&(a=0),void 0===s&&(s=0),this.rectangular=t,this.dataCapacity=e,this.errorCodewords=r,this.matrixWidth=n,this.matrixHeight=o,this.dataRegions=i,this.rsBlockData=a,this.rsBlockError=s}return t.lookup=function(t,e,r,n,o){var a,s;void 0===e&&(e=0),void 0===r&&(r=null),void 0===n&&(n=null),void 0===o&&(o=!0);try{for(var c=i(u),f=c.next();!f.done;f=c.next()){var h=f.value;if((1!==e||!h.rectangular)&&((2!==e||h.rectangular)&&(null==r||!(h.getSymbolWidth()n.getWidth()||h.getSymbolHeight()>n.getHeight()))&&t<=h.dataCapacity))return h}}catch(t){a={error:t}}finally{try{f&&!f.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}if(o)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+t);return null},t.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},t.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},t.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},t.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},t.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+2*this.getHorizontalDataRegions()},t.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+2*this.getVerticalDataRegions()},t.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},t.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},t.prototype.getDataCapacity=function(){return this.dataCapacity},t.prototype.getErrorCodewords=function(){return this.errorCodewords},t.prototype.getDataLengthForInterleavedBlock=function(t){return this.rsBlockData},t.prototype.getErrorLengthForInterleavedBlock=function(t){return this.rsBlockError},t}();e.a=a;var s=function(t){function e(){return t.call(this,!1,1558,620,22,22,36,-1,62)||this}return o(e,t),e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e}(a),u=[new a(!1,3,5,8,8,1),new a(!1,5,7,10,10,1),new a(!0,5,7,16,6,1),new a(!1,8,10,12,12,1),new a(!0,10,11,14,6,2),new a(!1,12,12,14,14,1),new a(!0,16,14,24,10,1),new a(!1,18,14,16,16,1),new a(!1,22,18,18,18,1),new a(!0,22,18,16,10,2),new a(!1,30,20,20,20,1),new a(!0,32,24,16,14,2),new a(!1,36,24,22,22,1),new a(!1,44,28,24,24,1),new a(!0,49,28,22,14,2),new a(!1,62,36,14,14,4),new a(!1,86,42,16,16,4),new a(!1,114,48,18,18,4),new a(!1,144,56,20,20,4),new a(!1,174,68,22,22,4),new a(!1,204,84,24,24,4,102,42),new a(!1,280,112,14,14,16,140,56),new a(!1,368,144,16,16,16,92,36),new a(!1,456,192,18,18,16,114,48),new a(!1,576,224,20,20,16,144,56),new a(!1,696,272,22,22,16,174,68),new a(!1,816,336,24,24,16,136,56),new a(!1,1050,408,18,18,36,175,68),new a(!1,1304,496,20,20,36,163,62),new s]},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.kind="ArithmeticException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n=function(){function t(t,e,r,n,o,i,a,s,u){this.a11=t,this.a21=e,this.a31=r,this.a12=n,this.a22=o,this.a32=i,this.a13=a,this.a23=s,this.a33=u}return t.quadrilateralToQuadrilateral=function(e,r,n,o,i,a,s,u,c,f,h,l,d,p,g,y){var w=t.quadrilateralToSquare(e,r,n,o,i,a,s,u);return t.squareToQuadrilateral(c,f,h,l,d,p,g,y).times(w)},t.prototype.transformPoints=function(t){for(var e=t.length,r=this.a11,n=this.a12,o=this.a13,i=this.a21,a=this.a22,s=this.a23,u=this.a31,c=this.a32,f=this.a33,h=0;h32||t>this.available())throw new n.a(""+t);var e=0,r=this.bitOffset,o=this.byteOffset,i=this.bytes;if(r>0){var a=8-r,s=t>8-s<<(c=a-s);e=(i[o]&u)>>c,t-=s,8===(r+=s)&&(r=0,o++)}if(t>0){for(;t>=8;)e=e<<8|255&i[o],o++,t-=8;if(t>0){var c;u=255>>(c=8-t)<>c,r+=t}}return this.bitOffset=r,this.byteOffset=o,e},t.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},t}();e.a=o},function(t,e,r){"use strict";var n=r(39),o=r(7),i=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(){function t(t){this.errorCorrectionLevel=n.a.forBits(t>>3&3),this.dataMask=7&t}return t.numBitsDiffering=function(t,e){return o.a.bitCount(t^e)},t.decodeFormatInformation=function(e,r){var n=t.doDecodeFormatInformation(e,r);return null!==n?n:t.doDecodeFormatInformation(e^t.FORMAT_INFO_MASK_QR,r^t.FORMAT_INFO_MASK_QR)},t.doDecodeFormatInformation=function(e,r){var n,o,a=Number.MAX_SAFE_INTEGER,s=0;try{for(var u=i(t.FORMAT_INFO_DECODE_LOOKUP),c=u.next();!c.done;c=u.next()){var f=c.value,h=f[0];if(h===e||h===r)return new t(f[1]);var l=t.numBitsDiffering(e,h);l=e.length)for(var r=e[e.length-1],o=this.field,i=e.length;i<=t;i++){var a=r.multiply(new n.a(o,Int32Array.from([1,o.exp(i-1+o.getGeneratorBase())])));e.push(a),r=a}return e[t]},t.prototype.encode=function(t,e){if(0===e)throw new i.a("No error correction bytes");var r=t.length-e;if(r<=0)throw new i.a("No data bytes provided");var a=this.buildGenerator(e),s=new Int32Array(r);o.a.arraycopy(t,0,s,0,r);for(var u=new n.a(this.field,s),c=(u=u.multiplyByMonomial(e,1)).divide(a)[1].getCoefficients(),f=e-c.length,h=0;h=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=function(){function t(t,e){this.width=t,this.height=e;for(var r=new Array(e),n=0;n!==e;n++)r[n]=new Uint8Array(t);this.bytes=r}return t.prototype.getHeight=function(){return this.height},t.prototype.getWidth=function(){return this.width},t.prototype.get=function(t,e){return this.bytes[e][t]},t.prototype.getArray=function(){return this.bytes},t.prototype.setNumber=function(t,e,r){this.bytes[e][t]=r},t.prototype.setBoolean=function(t,e,r){this.bytes[e][t]=r?1:0},t.prototype.clear=function(t){var e,r;try{for(var o=i(this.bytes),a=o.next();!a.done;a=o.next()){var s=a.value;n.a.fill(s,t)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;if(this.width!==r.width)return!1;if(this.height!==r.height)return!1;for(var n=0,o=this.height;n=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(){function t(){}return t.calculateMaskPenalty=function(t){return f.a.applyMaskPenaltyRule1(t)+f.a.applyMaskPenaltyRule2(t)+f.a.applyMaskPenaltyRule3(t)+f.a.applyMaskPenaltyRule4(t)},t.encode=function(e,r,a){void 0===a&&(a=null);var s=t.DEFAULT_BYTE_MODE_ENCODING,f=null!==a&&void 0!==a.get(n.a.CHARACTER_SET);f&&(s=a.get(n.a.CHARACTER_SET).toString());var p=this.chooseMode(e,s),g=new o.a;if(p===u.a.BYTE&&(f||t.DEFAULT_BYTE_MODE_ENCODING!==s)){var w=i.a.getCharacterSetECIByName(s);void 0!==w&&this.appendECI(w,g)}this.appendModeInfo(p,g);var v,m=new o.a;if(this.appendBytes(e,p,m,s),null!==a&&void 0!==a.get(n.a.QR_VERSION)){var C=Number.parseInt(a.get(n.a.QR_VERSION).toString(),10);v=c.a.getVersionForNumber(C);var _=this.calculateBitsNeeded(p,g,m,v);if(!this.willFit(_,v,r))throw new y.a("Data too big for requested version")}else v=this.recommendVersion(r,p,g,m);var A=new o.a;A.appendBitArray(g);var E=p===u.a.BYTE?m.getSizeInBytes():e.length;this.appendLengthInfo(E,v,p,A),A.appendBitArray(m);var I=v.getECBlocksForLevel(r),S=v.getTotalCodewords()-I.getTotalECCodewords();this.terminateBits(S,A);var T=this.interleaveWithECBytes(A,v.getTotalCodewords(),S,I.getNumBlocks()),b=new l.a;b.setECLevel(r),b.setMode(p),b.setVersion(v);var O=v.getDimensionForVersion(),R=new h.a(O,O),N=this.chooseMaskPattern(T,r,v,R);return b.setMaskPattern(N),d.a.buildMatrix(T,r,v,N,R),b.setMatrix(R),b},t.recommendVersion=function(t,e,r,n){var o=this.calculateBitsNeeded(e,r,n,c.a.getVersionForNumber(1)),i=this.chooseVersion(o,t),a=this.calculateBitsNeeded(e,r,n,i);return this.chooseVersion(a,t)},t.calculateBitsNeeded=function(t,e,r,n){return e.getSize()+t.getCharacterCountBits(n)+r.getSize()},t.getAlphanumericCode=function(e){return e159)&&(o<224||o>235))return!1}return!0},t.chooseMaskPattern=function(t,e,r,n){for(var o=Number.MAX_SAFE_INTEGER,i=-1,a=0;a=(t+7)/8},t.terminateBits=function(t,e){var r=8*t;if(e.getSize()>r)throw new y.a("data bits cannot fit in the QR Code"+e.getSize()+" > "+r);for(var n=0;n<4&&e.getSize()0)for(n=o;n<8;n++)e.appendBit(!1);var i=t-e.getSizeInBytes();for(n=0;n=r)throw new y.a("Block ID too large");var a=t%r,s=r-a,u=Math.floor(t/r),c=u+1,f=Math.floor(e/r),h=f+1,l=u-f,d=c-h;if(l!==d)throw new y.a("EC bytes mismatch");if(r!==s+a)throw new y.a("RS blocks mismatch");if(t!==(f+l)*s+(h+d)*a)throw new y.a("Total bytes mismatch");n=1<=0&&r<=9},t.appendNumericBytes=function(e,r){for(var n=e.length,o=0;o=33088&&a<=40956?s=a-33088:a>=57408&&a<=60351&&(s=a-49472),-1===s)throw new y.a("Invalid byte sequence");var u=192*(s>>8)+(255&s);e.appendBits(u,13)}},t.appendECI=function(t,e){e.appendBits(u.a.ECI.getBits(),4),e.appendBits(t.getValue(),8)},t.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),t.DEFAULT_BYTE_MODE_ENCODING=i.a.UTF8.getName(),t}();e.a=v},function(t,e,r){"use strict";var n,o=r(19),i=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.kind="IndexOutOfBoundsException",e}(o.a);e.a=a},function(t,e,r){"use strict";var n=function(){function t(t){this.mirrored=t}return t.prototype.isMirrored=function(){return this.mirrored},t.prototype.applyMirroredCorrection=function(t){if(this.mirrored&&null!==t&&!(t.length<3)){var e=t[0];t[0]=t[2],t[2]=e}},t}();e.a=n},function(t,e,r){"use strict";var n=r(24),o=r(3),i=r(8),a=r(23),s=r(111),u=r(69),c=r(27),f=r(113),h=r(7),l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},d=function(){function t(){}return t.encodeBytes=function(e){return t.encode(e,t.DEFAULT_EC_PERCENT,t.DEFAULT_AZTEC_LAYERS)},t.encode=function(e,r,n){var u,c,l,d,p,g=new f.a(e).encode(),y=h.a.truncDivision(g.getSize()*r,100)+11,w=g.getSize()+y;if(n!==t.DEFAULT_AZTEC_LAYERS){if(u=n<0,(c=Math.abs(n))>(u?t.MAX_NB_BITS_COMPACT:t.MAX_NB_BITS))throw new o.a(i.a.format("Illegal value %s for layers",n));var v=(l=t.totalBitsInLayer(c,u))-l%(d=t.WORD_SIZE[c]);if((p=t.stuffBits(g,d)).getSize()+y>v)throw new o.a("Data to large for user specified layer");if(u&&p.getSize()>64*d)throw new o.a("Data to large for user specified layer")}else{d=0,p=null;for(var m=0;;m++){if(m>t.MAX_NB_BITS)throw new o.a("Data too large for an Aztec code");if(c=(u=m<=3)?m+1:m,!(w>(l=t.totalBitsInLayer(c,u)))){null!=p&&d===t.WORD_SIZE[c]||(d=t.WORD_SIZE[c],p=t.stuffBits(g,d));v=l-l%d;if(!(u&&p.getSize()>64*d)&&p.getSize()+y<=v)break}}}var C,_=t.generateCheckWords(p,l,d),A=p.getSize()/d,E=t.generateModeMessage(u,c,A),I=(u?11:14)+4*c,S=new Int32Array(I);if(u){C=I;for(m=0;m=o||t.get(a+u))&&(s|=1<10||n<0||n>10)throw new o.a;return i.firstDigit=r,i.secondDigit=n,i}return d(e,t),e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return 10*this.firstDigit+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e}(u),g=r(0),y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},w=function(){function t(){}return t.parseFieldsInGeneralPurpose=function(e){var r,n,o,i,a,s,u,c;if(!e)return null;if(e.length<2)throw new g.a;var f=e.substring(0,2);try{for(var h=y(t.TWO_DIGIT_DATA_LENGTH),l=h.next();!l.done;l=h.next()){if((E=l.value)[0]===f)return E[1]===t.VARIABLE_LENGTH?t.processVariableAI(2,E[2],e):t.processFixedAI(2,E[1],e)}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}if(e.length<3)throw new g.a;var d=e.substring(0,3);try{for(var p=y(t.THREE_DIGIT_DATA_LENGTH),w=p.next();!w.done;w=p.next()){if((E=w.value)[0]===d)return E[1]===t.VARIABLE_LENGTH?t.processVariableAI(3,E[2],e):t.processFixedAI(3,E[1],e)}}catch(t){o={error:t}}finally{try{w&&!w.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}try{for(var v=y(t.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),m=v.next();!m.done;m=v.next()){if((E=m.value)[0]===d)return E[1]===t.VARIABLE_LENGTH?t.processVariableAI(4,E[2],e):t.processFixedAI(4,E[1],e)}}catch(t){a={error:t}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}if(e.length<4)throw new g.a;var C=e.substring(0,4);try{for(var _=y(t.FOUR_DIGIT_DATA_LENGTH),A=_.next();!A.done;A=_.next()){var E;if((E=A.value)[0]===C)return E[1]===t.VARIABLE_LENGTH?t.processVariableAI(4,E[2],e):t.processFixedAI(4,E[1],e)}}catch(t){u={error:t}}finally{try{A&&!A.done&&(c=_.return)&&c.call(_)}finally{if(u)throw u.error}}throw new g.a},t.processFixedAI=function(e,r,n){if(n.lengththis.information.getSize())return t+4<=this.information.getSize();for(var e=t;ethis.information.getSize()){var e=this.extractNumericValueFromBitArray(t,4);return new p(this.information.getSize(),0===e?p.FNC1:e-1,p.FNC1)}var r=this.extractNumericValueFromBitArray(t,7);return new p(t+7,(r-8)/11,(r-8)%11)},t.prototype.extractNumericValueFromBitArray=function(e,r){return t.extractNumericValueFromBitArray(this.information,e,r)},t.extractNumericValueFromBitArray=function(t,e,r){for(var n=0,o=0;othis.information.getSize())return!1;var e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+7>this.information.getSize())return!1;var r=this.extractNumericValueFromBitArray(t,7);if(r>=64&&r<116)return!0;if(t+8>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(t,8);return n>=232&&n<253},t.prototype.decodeIsoIec646=function(t){var e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new f(t+5,f.FNC1);if(e>=5&&e<15)return new f(t+5,"0"+(e-5));var r,n=this.extractNumericValueFromBitArray(t,7);if(n>=64&&n<90)return new f(t+7,""+(n+1));if(n>=90&&n<116)return new f(t+7,""+(n+7));switch(this.extractNumericValueFromBitArray(t,8)){case 232:r="!";break;case 233:r='"';break;case 234:r="%";break;case 235:r="&";break;case 236:r="'";break;case 237:r="(";break;case 238:r=")";break;case 239:r="*";break;case 240:r="+";break;case 241:r=",";break;case 242:r="-";break;case 243:r=".";break;case 244:r="/";break;case 245:r=":";break;case 246:r=";";break;case 247:r="<";break;case 248:r="=";break;case 249:r=">";break;case 250:r="?";break;case 251:r="_";break;case 252:r=" ";break;default:throw new o.a}return new f(t+8,r)},t.prototype.isStillAlpha=function(t){if(t+5>this.information.getSize())return!1;var e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+6>this.information.getSize())return!1;var r=this.extractNumericValueFromBitArray(t,6);return r>=16&&r<63},t.prototype.decodeAlphanumeric=function(t){var e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new f(t+5,f.FNC1);if(e>=5&&e<15)return new f(t+5,"0"+(e-5));var r,n=this.extractNumericValueFromBitArray(t,6);if(n>=32&&n<58)return new f(t+6,""+(n+33));switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new i.a("Decoding invalid alphanumeric value: "+n)}return new f(t+6,r)},t.prototype.isAlphaTo646ToAlphaLatch=function(t){if(t+1>this.information.getSize())return!1;for(var e=0;e<5&&e+tthis.information.getSize())return!1;for(var e=t;ethis.information.getSize())return!1;for(var e=0;e<4&&e+t1,g,g+n-1),g+=n-1;else for(var w=n-1;w>=0;--w)p[g++]=0!=(y&1<=8?t.readCode(e,r,8):t.readCode(e,r,n)<<8-n},t.convertBoolArrayToByteArray=function(e){for(var r=new Uint8Array((e.length+7)/8),n=0;n","?","[","]","{","}","CTRL_UL"],t.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],t}();e.a=h},function(t,e,r){"use strict";var n=r(0),o=function(){function t(){}return t.checkAndNudgePoints=function(t,e){for(var r=t.getWidth(),o=t.getHeight(),i=!0,a=0;ar||u<-1||u>o)throw new n.a;i=!1,-1===s?(e[a]=0,i=!0):s===r&&(e[a]=r-1,i=!0),-1===u?(e[a+1]=0,i=!0):u===o&&(e[a+1]=o-1,i=!0)}i=!0;for(a=e.length-2;a>=0&&i;a-=2){s=Math.floor(e[a]),u=Math.floor(e[a+1]);if(s<-1||s>r||u<-1||u>o)throw new n.a;i=!1,-1===s?(e[a]=0,i=!0):s===r&&(e[a]=r-1,i=!0),-1===u?(e[a+1]=0,i=!0):u===o&&(e[a+1]=o-1,i=!0)}},t}();e.a=o},function(t,e,r){"use strict";var n,o=r(5),i=r(20),a=r(12),s=r(2),u=r(0),c=r(14),f=r(4),h=r(18),l=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.findStartPattern=function(t){for(var r=t.getSize(),n=t.getNextSet(0),o=0,i=Int32Array.from([0,0,0,0,0,0]),a=n,s=!1,c=n;c=0&&t.isRange(Math.max(0,a-(c-a)/2),a,!1))return Int32Array.from([a,c,l]);a+=i[0]+i[1],(i=i.slice(2,i.length-1))[o-1]=0,i[o]=0,o--}else o++;i[o]=1,s=!s}throw new u.a},e.decodeCode=function(t,r,n){h.a.recordPattern(t,n,r);for(var o=e.MAX_AVG_VARIANCE,i=-1,a=0;a=0)return i;throw new u.a},e.prototype.decodeRow=function(t,r,n){var h,l=n&&!0===n.get(a.a.ASSUME_GS1),d=e.findStartPattern(r),p=d[2],g=0,y=new Uint8Array(20);switch(y[g++]=p,p){case e.CODE_START_A:h=e.CODE_CODE_A;break;case e.CODE_START_B:h=e.CODE_CODE_B;break;case e.CODE_START_C:h=e.CODE_CODE_C;break;default:throw new s.a}for(var w=!1,v=!1,m="",C=d[0],_=d[1],A=Int32Array.from([0,0,0,0,0,0]),E=0,I=0,S=p,T=0,b=!0,O=!1,R=!1;!w;){var N=v;switch(v=!1,E=I,I=e.decodeCode(r,A,_),y[g++]=I,I!==e.CODE_STOP&&(b=!0),I!==e.CODE_STOP&&(S+=++T*I),C=_,_+=A.reduce((function(t,e){return t+e}),0),I){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new s.a}switch(h){case e.CODE_CODE_A:if(I<64)m+=R===O?String.fromCharCode(" ".charCodeAt(0)+I):String.fromCharCode(" ".charCodeAt(0)+I+128),R=!1;else if(I<96)m+=R===O?String.fromCharCode(I-64):String.fromCharCode(I+64),R=!1;else switch(I!==e.CODE_STOP&&(b=!1),I){case e.CODE_FNC_1:l&&(0===m.length?m+="]C1":m+=String.fromCharCode(29));break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!O&&R?(O=!0,R=!1):O&&R?(O=!1,R=!1):R=!0;break;case e.CODE_SHIFT:v=!0,h=e.CODE_CODE_B;break;case e.CODE_CODE_B:h=e.CODE_CODE_B;break;case e.CODE_CODE_C:h=e.CODE_CODE_C;break;case e.CODE_STOP:w=!0}break;case e.CODE_CODE_B:if(I<96)m+=R===O?String.fromCharCode(" ".charCodeAt(0)+I):String.fromCharCode(" ".charCodeAt(0)+I+128),R=!1;else switch(I!==e.CODE_STOP&&(b=!1),I){case e.CODE_FNC_1:l&&(0===m.length?m+="]C1":m+=String.fromCharCode(29));break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!O&&R?(O=!0,R=!1):O&&R?(O=!1,R=!1):R=!0;break;case e.CODE_SHIFT:v=!0,h=e.CODE_CODE_A;break;case e.CODE_CODE_A:h=e.CODE_CODE_A;break;case e.CODE_CODE_C:h=e.CODE_CODE_C;break;case e.CODE_STOP:w=!0}break;case e.CODE_CODE_C:if(I<100)I<10&&(m+="0"),m+=I;else switch(I!==e.CODE_STOP&&(b=!1),I){case e.CODE_FNC_1:l&&(0===m.length?m+="]C1":m+=String.fromCharCode(29));break;case e.CODE_CODE_A:h=e.CODE_CODE_A;break;case e.CODE_CODE_B:h=e.CODE_CODE_B;break;case e.CODE_STOP:w=!0}}N&&(h=h===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var D=_-C;if(_=r.getNextUnset(_),!r.isRange(_,Math.min(r.getSize(),_+(_-C)/2),!1))throw new u.a;if((S-=T*E)%103!==E)throw new i.a;var M=m.length;if(0===M)throw new u.a;M>0&&b&&(m=h===e.CODE_CODE_C?m.substring(0,M-2):m.substring(0,M-1));for(var P=(d[1]+d[0])/2,B=C+D/2,L=y.length,F=new Uint8Array(L),x=0;x=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},d=function(t){function e(e,r){void 0===e&&(e=!1),void 0===r&&(r=!1);var n=t.call(this)||this;return n.usingCheckDigit=e,n.extendedMode=r,n.decodeRowResult="",n.counters=new Int32Array(9),n}return h(e,t),e.prototype.decodeRow=function(t,r,n){var a,u,h,d,p=this.counters;p.fill(0),this.decodeRowResult="";var g,y,w=e.findAsteriskPattern(r,p),v=r.getNextSet(w[1]),m=r.getSize();do{e.recordPattern(r,v,p);var C=e.toNarrowWidePattern(p);if(C<0)throw new s.a;g=e.patternToChar(C),this.decodeRowResult+=g,y=v;try{for(var _=(a=void 0,l(p)),A=_.next();!A.done;A=_.next()){v+=A.value}}catch(t){a={error:t}}finally{try{A&&!A.done&&(u=_.return)&&u.call(_)}finally{if(a)throw a.error}}v=r.getNextSet(v)}while("*"!==g);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var E,I=0;try{for(var S=l(p),T=S.next();!T.done;T=S.next()){I+=T.value}}catch(t){h={error:t}}finally{try{T&&!T.done&&(d=S.return)&&d.call(S)}finally{if(h)throw h.error}}if(v!==m&&2*(v-y-I)i&&(a=d)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}i=a,n=0;for(var c=0,f=0,h=0;hi&&(f|=1<0;h++){var d;if((d=t[h])>i&&(n--,2*d>=c))return-1}return f}}while(n>3);return-1},e.patternToChar=function(t){for(var r=0;r="A"&&i<="Z"))throw new a.a;s=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new a.a;s=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")s=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")s=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")s=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)s="\0";else if("V"===i)s="@";else if("W"===i)s="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new a.a;s=""}break;case"/":if(i>="A"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new a.a;s=":"}}r+=s,n++}else r+=o}return r},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],e.ASTERISK_ENCODING=148,e}(u.a);e.a=d},function(t,e,r){"use strict";var n,o=r(5),i=r(20),a=r(2),s=r(0),u=r(18),c=r(14),f=r(4),h=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},d=function(t){function e(){var e=t.call(this)||this;return e.decodeRowResult="",e.counters=new Int32Array(6),e}return h(e,t),e.prototype.decodeRow=function(t,r,n){var i,a,u,h,d,p,g=this.findAsteriskPattern(r),y=r.getNextSet(g[1]),w=r.getSize(),v=this.counters;v.fill(0),this.decodeRowResult="";do{e.recordPattern(r,y,v);var m=this.toPattern(v);if(m<0)throw new s.a;d=this.patternToChar(m),this.decodeRowResult+=d,p=y;try{for(var C=(i=void 0,l(v)),_=C.next();!_.done;_=C.next()){y+=_.value}}catch(t){i={error:t}}finally{try{_&&!_.done&&(a=C.return)&&a.call(C)}finally{if(i)throw i.error}}y=r.getNextSet(y)}while("*"!==d);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var A=0;try{for(var E=l(v),I=E.next();!I.done;I=E.next()){A+=I.value}}catch(t){u={error:t}}finally{try{I&&!I.done&&(h=E.return)&&h.call(E)}finally{if(u)throw u.error}}if(y===w||!r.get(y))throw new s.a;if(this.decodeRowResult.length<2)throw new s.a;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var S=this.decodeExtended(this.decodeRowResult),T=(g[1]+g[0])/2,b=p+A/2;return new c.a(S,null,0,[new f.a(T,t),new f.a(b,t)],o.a.CODE_93,(new Date).getTime())},e.prototype.findAsteriskPattern=function(t){var r=t.getSize(),n=t.getNextSet(0);this.counters.fill(0);for(var o=this.counters,i=n,a=!1,u=o.length,c=0,f=n;f4)return-1;if(0==(1&u))for(var f=0;f="a"&&o<="d"){if(n>=e-1)throw new a.a;var i=t.charAt(n+1),s="\0";switch(o){case"d":if(!(i>="A"&&i<="Z"))throw new a.a;s=String.fromCharCode(i.charCodeAt(0)+32);break;case"a":if(!(i>="A"&&i<="Z"))throw new a.a;s=String.fromCharCode(i.charCodeAt(0)-64);break;case"b":if(i>="A"&&i<="E")s=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")s=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")s=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)s="\0";else if("V"===i)s="@";else if("W"===i)s="`";else{if(!(i>="X"&&i<="Z"))throw new a.a;s=String.fromCharCode(127)}break;case"c":if(i>="A"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new a.a;s=":"}}r+=s,n++}else r+=o}return r},e.prototype.checkChecksums=function(t){var e=t.length;this.checkOneChecksum(t,e-2,20),this.checkOneChecksum(t,e-1,15)},e.prototype.checkOneChecksum=function(t,r,n){for(var o=1,a=0,s=r-1;s>=0;s--)a+=o*e.ALPHABET_STRING.indexOf(t.charAt(s)),++o>n&&(o=1);if(t.charAt(r)!==e.ALPHABET_STRING[a%47])throw new i.a},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e}(u.a);e.a=d},function(t,e,r){"use strict";var n,o=r(5),i=r(12),a=r(2),s=r(0),u=r(14),c=r(4),f=r(6),h=r(10),l=r(18),d=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),p=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.narrowLineWidth=-1,e}return d(e,t),e.prototype.decodeRow=function(t,r,n){var s,h,l=this.decodeStart(r),d=this.decodeEnd(r),g=new f.a;e.decodeMiddle(r,l[1],d[0],g);var y=g.toString(),w=null;null!=n&&(w=n.get(i.a.ALLOWED_LENGTHS)),null==w&&(w=e.DEFAULT_ALLOWED_LENGTHS);var v=y.length,m=!1,C=0;try{for(var _=p(w),A=_.next();!A.done;A=_.next()){var E=A.value;if(v===E){m=!0;break}E>C&&(C=E)}}catch(t){s={error:t}}finally{try{A&&!A.done&&(h=_.return)&&h.call(_)}finally{if(s)throw s.error}}if(!m&&v>C&&(m=!0),!m)throw new a.a;var I=[new c.a(l[1],t),new c.a(d[0],t)];return new u.a(y,null,0,I,o.a.ITF,(new Date).getTime())},e.decodeMiddle=function(t,r,n,o){var i=new Int32Array(10),a=new Int32Array(5),s=new Int32Array(5);for(i.fill(0),a.fill(0),s.fill(0);r0&&n>=0&&!t.get(n);n--)r--;if(0!==r)throw new s.a},e.skipWhiteSpace=function(t){var e=t.getSize(),r=t.getNextSet(0);if(r===e)throw new s.a;return r},e.prototype.decodeEnd=function(t){t.reverse();try{var r=e.skipWhiteSpace(t),n=void 0;try{n=e.findGuardPattern(t,r,e.END_PATTERN_REVERSED[0])}catch(o){o instanceof s.a&&(n=e.findGuardPattern(t,r,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,n[0]);var o=n[0];return n[0]=t.getSize()-n[1],n[1]=t.getSize()-o,n}finally{t.reverse()}},e.findGuardPattern=function(t,r,n){var o=n.length,i=new Int32Array(o),a=t.getSize(),u=!1,c=0,f=r;i.fill(0);for(var d=r;d=0)return n%10;throw new s.a},e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e}(l.a);e.a=g},function(t,e,r){"use strict";var n;!function(t){t[t.DATA_MASK_000=0]="DATA_MASK_000",t[t.DATA_MASK_001=1]="DATA_MASK_001",t[t.DATA_MASK_010=2]="DATA_MASK_010",t[t.DATA_MASK_011=3]="DATA_MASK_011",t[t.DATA_MASK_100=4]="DATA_MASK_100",t[t.DATA_MASK_101=5]="DATA_MASK_101",t[t.DATA_MASK_110=6]="DATA_MASK_110",t[t.DATA_MASK_111=7]="DATA_MASK_111"}(n||(n={}));var o=function(){function t(t,e){this.value=t,this.isMasked=e}return t.prototype.unmaskBitMatrix=function(t,e){for(var r=0;r0;){for(6===u&&(u-=1);c>=0&&c=n;)e^=r<=0)for(var u=0;u!==a;u++){var c=o[u];c>=0&&t.isEmpty(r.get(c,s))&&t.embedPositionAdjustmentPattern(c-2,s-2,r)}}},t.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),t.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),t.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),t.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),t.VERSION_INFO_POLY=7973,t.TYPE_INFO_POLY=1335,t.TYPE_INFO_MASK_PATTERN=21522,t}();e.a=c},function(t,e,r){"use strict";var n,o=r(45),i=r(60),a=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=function(t){function e(e,r,n){var o=t.call(this,e,r)||this;return o.count=0,o.finderPattern=n,o}return a(e,t),e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e}(i.a),u=r(14),c=r(12),f=r(0),h=r(6),l=r(5),d=r(4),p=r(116),g=r(11),y=r(52),w=r(10),v=r(18),m=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),C=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.possibleLeftPairs=[],e.possibleRightPairs=[],e}return m(e,t),e.prototype.decodeRow=function(t,r,n){var o,i,a,s,u=this.decodePair(r,!1,t,n);e.addOrTally(this.possibleLeftPairs,u),r.reverse();var c=this.decodePair(r,!0,t,n);e.addOrTally(this.possibleRightPairs,c),r.reverse();try{for(var h=C(this.possibleLeftPairs),l=h.next();!l.done;l=h.next()){var d=l.value;if(d.getCount()>1)try{for(var p=(a=void 0,C(this.possibleRightPairs)),g=p.next();!g.done;g=p.next()){var y=g.value;if(y.getCount()>1&&e.checkChecksum(d,y))return e.constructResult(d,y)}}catch(t){a={error:t}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}throw new f.a},e.addOrTally=function(t,e){var r,n;if(null!=e){var o=!1;try{for(var i=C(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.getValue()===e.getValue()){s.incrementCount(),o=!0;break}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}o||t.push(e)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,e){for(var r=4537077*t.getValue()+e.getValue(),n=new String(r).toString(),o=new h.a,i=13-n.length;i>0;i--)o.append("0");o.append(n);var a=0;for(i=0;i<13;i++){var s=o.charAt(i).charCodeAt(0)-"0".charCodeAt(0);a+=0==(1&i)?3*s:s}10===(a=10-a%10)&&(a=0),o.append(a.toString());var c=t.getFinderPattern().getResultPoints(),f=e.getFinderPattern().getResultPoints();return new u.a(o.toString(),null,0,[c[0],c[1],f[0],f[1]],l.a.RSS_14,(new Date).getTime())},e.checkChecksum=function(t,e){var r=(t.getChecksumPortion()+16*e.getChecksumPortion())%79,n=9*t.getFinderPattern().getValue()+e.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n},e.prototype.decodePair=function(t,e,r,n){try{var o=this.findFinderPattern(t,e),i=this.parseFoundFinderPattern(t,r,e,o),a=null==n?null:n.get(c.a.NEED_RESULT_POINT_CALLBACK);if(null!=a){var u=(o[0]+o[1])/2;e&&(u=t.getSize()-1-u),a.foundPossibleResultPoint(new d.a(u,r))}var f=this.decodeDataCharacter(t,i,!0),h=this.decodeDataCharacter(t,i,!1);return new s(1597*f.getValue()+h.getValue(),f.getChecksumPortion()+4*h.getChecksumPortion(),i)}catch(t){return null}},e.prototype.decodeDataCharacter=function(t,r,n){for(var o=this.getDataCharacterCounters(),a=0;a8&&(_=8);var A=Math.floor(s/2);0==(1&s)?(d[A]=_,w[A]=C-_):(p[A]=_,m[A]=C-_)}this.adjustOddEvenCounts(n,h);var E=0,I=0;for(s=d.length-1;s>=0;s--)I*=9,I+=d[s],E+=d[s];var S=0,T=0;for(s=p.length-1;s>=0;s--)S*=9,S+=p[s],T+=p[s];var b=I+3*S;if(n){if(0!=(1&E)||E>12||E<4)throw new f.a;var O=(12-E)/2,R=9-(B=e.OUTSIDE_ODD_WIDEST[O]),N=y.a.getRSSvalue(d,B,!1),D=y.a.getRSSvalue(p,R,!0),M=e.OUTSIDE_EVEN_TOTAL_SUBSET[O],P=e.OUTSIDE_GSUM[O];return new i.a(N*M+D+P,b)}if(0!=(1&T)||T>10||T<4)throw new f.a;O=(10-T)/2,R=9-(B=e.INSIDE_ODD_WIDEST[O]),N=y.a.getRSSvalue(d,B,!0),D=y.a.getRSSvalue(p,R,!1);var B,L=e.INSIDE_ODD_TOTAL_SUBSET[O];P=e.INSIDE_GSUM[O];return new i.a(D*L+N+P,b)},e.prototype.findFinderPattern=function(t,e){var r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;for(var n=t.getSize(),i=!1,a=0;a=0&&i!==t.get(a);)a--;a++;var s=o[0]-a,u=this.getDecodeFinderCounters(),c=new Int32Array(u.length);w.a.arraycopy(u,0,c,1,u.length-1),c[0]=s;var f=this.parseFinderValue(c,e.FINDER_PATTERNS),h=a,l=o[1];return n&&(h=t.getSize()-1-h,l=t.getSize()-1-l),new p.a(f,[a,o[1]],h,l,r)},e.prototype.adjustOddEvenCounts=function(t,e){var r=g.a.sum(new Int32Array(this.getOddCounts())),n=g.a.sum(new Int32Array(this.getEvenCounts())),i=!1,a=!1,s=!1,u=!1;t?(r>12?a=!0:r<4&&(i=!0),n>12?u=!0:n<4&&(s=!0)):(r>11?a=!0:r<5&&(i=!0),n>10?u=!0:n<4&&(s=!0));var c=r+n-e,h=(1&r)==(t?1:0),l=1==(1&n);if(1===c)if(h){if(l)throw new f.a;a=!0}else{if(!l)throw new f.a;u=!0}else if(-1===c)if(h){if(l)throw new f.a;i=!0}else{if(!l)throw new f.a;s=!0}else{if(0!==c)throw new f.a;if(h){if(!l)throw new f.a;rt.length||r<0||e+r>t.length||e+r<0)throw new i.a;if(0!==r)for(var n=0;n0&&this.grow(t)},e.prototype.grow=function(t){var e=this.buf.length<<1;if(e-t<0&&(e=t),e<0){if(t<0)throw new d;e=f.a.MAX_VALUE}this.buf=o.a.copyOfUint8Array(this.buf,e)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,e,r){if(e<0||e>t.length||r<0||e+r-t.length>0)throw new i.a;this.ensureCapacity(this.count+r),p.a.arraycopy(t,e,this.buf,this.count,r),this.count+=r},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return o.a.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?"string"==typeof t?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e}(c);e.a=y},function(t,e,r){"use strict";var n=r(16),o=function(){function t(t,e,r){this.codewords=t,this.numcols=e,this.numrows=r,this.bits=new Uint8Array(e*r),n.a.fill(this.bits,2)}return t.prototype.getNumrows=function(){return this.numrows},t.prototype.getNumcols=function(){return this.numcols},t.prototype.getBits=function(){return this.bits},t.prototype.getBit=function(t,e){return 1===this.bits[e*this.numcols+t]},t.prototype.setBit=function(t,e,r){this.bits[e*this.numcols+t]=r?1:0},t.prototype.noBit=function(t,e){return 2===this.bits[e*this.numcols+t]},t.prototype.place=function(){var t=0,e=4,r=0;do{e===this.numrows&&0===r&&this.corner1(t++),e===this.numrows-2&&0===r&&this.numcols%4!=0&&this.corner2(t++),e===this.numrows-2&&0===r&&this.numcols%8==4&&this.corner3(t++),e===this.numrows+4&&2===r&&this.numcols%8==0&&this.corner4(t++);do{e=0&&this.noBit(r,e)&&this.utah(e,r,t++),e-=2,r+=2}while(e>=0&&r=0&&r=0);e+=3,r++}while(e0;u--)0!==s&&0!==i[u]?a[u]=a[u-1]^o.a[(o.n[s]+o.n[i[u]])%255]:a[u]=a[u-1];0!==s&&0!==i[0]?a[0]=o.a[(o.n[s]+o.n[i[0]])%255]:a[0]=0}var c=[];for(n=0;n=e.MINIMUM_DIMENSION&&o>=e.MINIMUM_DIMENSION){var a=r.getMatrix(),s=n>>e.BLOCK_SIZE_POWER;0!=(n&e.BLOCK_SIZE_MASK)&&s++;var u=o>>e.BLOCK_SIZE_POWER;0!=(o&e.BLOCK_SIZE_MASK)&&u++;var c=e.calculateBlackPoints(a,s,u,n,o),f=new i.a(n,o);e.calculateThresholdForBlock(a,s,u,n,o,c,f),this.matrix=f}else this.matrix=t.prototype.getBlackMatrix.call(this);return this.matrix},e.prototype.createBinarizer=function(t){return new e(t)},e.calculateThresholdForBlock=function(t,r,n,o,i,a,s){for(var u=i-e.BLOCK_SIZE,c=o-e.BLOCK_SIZE,f=0;fu&&(h=u);for(var l=e.cap(f,2,n-3),d=0;dc&&(p=c);for(var g=e.cap(d,2,r-3),y=0,w=-2;w<=2;w++){var v=a[l+w];y+=v[g-2]+v[g-1]+v[g]+v[g+1]+v[g+2]}var m=y/25;e.thresholdBlock(t,p,h,m,o,s)}}},e.cap=function(t,e,r){return tr?r:t},e.thresholdBlock=function(t,r,n,o,i,a){for(var s=0,u=n*i+r;sa&&(f=a);for(var h=0;hs&&(l=s);for(var d=0,p=255,g=0,y=0,w=f*o+l;yg&&(g=m)}if(g-p>e.MIN_DYNAMIC_RANGE)for(y++,w+=o;y>2*e.BLOCK_SIZE_POWER;if(g-p<=e.MIN_DYNAMIC_RANGE&&(C=p/2,c>0&&h>0)){var _=(u[c-1][h]+2*u[c][h-1]+u[c-1][h-1])/4;p<_&&(C=_)}u[c][h]=C}}return u},e.BLOCK_SIZE_POWER=3,e.BLOCK_SIZE=1<>e.LUMINANCE_SHIFT]++;var c=e.estimateBlackPoint(s);if(o<3)for(u=0;u>e.LUMINANCE_SHIFT]++}var l=e.estimateBlackPoint(i),d=t.getMatrix();for(s=0;si&&(o=a,i=t[a]),t[a]>n&&(n=t[a]);var u=0,c=0;for(a=0;ac&&(u=a,c=p)}if(o>u){var h=o;o=u,u=h}if(u-o<=r/16)throw new s.a;var l=u-1,d=-1;for(a=u-1;a>o;a--){var p,g=a-o;(p=g*g*(u-a)*(n-t[a]))>d&&(l=a,d=p)}return l<>10;o[a]=u}else{i=0,a=0;for(var c=t.length;i>10;o[a]=255-u}}return o},e.prototype.getRow=function(t,e){if(t<0||t>=this.getHeight())throw new a.a("Requested row is outside the image: "+t);var r=this.getWidth(),n=t*r;return null===e?e=this.buffer.slice(n,n+r):(e.length0;){var n=t.splice(0,8).splice(0,7).map((function(t){return t0);return s.length()>0&&r.append(s.toString()),new o.a(t,r.toString(),0===u.length?null:u,null)},t.decodeAsciiSegment=function(t,e,r){var o=!1;do{var i=t.readBits(8);if(0===i)throw new c.a;if(i<=128)return o&&(i+=128),e.append(String.fromCharCode(i-1)),n.ASCII_ENCODE;if(129===i)return n.PAD_ENCODE;if(i<=229){var a=i-130;a<10&&e.append("0"),e.append(""+a)}else switch(i){case 230:return n.C40_ENCODE;case 231:return n.BASE256_ENCODE;case 232:e.append(String.fromCharCode(29));break;case 233:case 234:break;case 235:o=!0;break;case 236:e.append("[)>05"),r.insert(0,"");break;case 237:e.append("[)>06"),r.insert(0,"");break;case 238:return n.ANSIX12_ENCODE;case 239:return n.TEXT_ENCODE;case 240:return n.EDIFACT_ENCODE;case 241:break;default:if(254!==i||0!==t.available())throw new c.a}}while(t.available()>0);return n.ASCII_ENCODE},t.decodeC40Segment=function(t,e){var r=!1,n=[],o=0;do{if(8===t.available())return;var i=t.readBits(8);if(254===i)return;this.parseTwoBytes(i,t.readBits(8),n);for(var a=0;a<3;a++){var s=n[a];switch(o){case 0:if(s<3)o=s+1;else{if(!(s0)},t.decodeTextSegment=function(t,e){var r=!1,n=[],o=0;do{if(8===t.available())return;var i=t.readBits(8);if(254===i)return;this.parseTwoBytes(i,t.readBits(8),n);for(var a=0;a<3;a++){var s=n[a];switch(o){case 0:if(s<3)o=s+1;else{if(!(s0)},t.decodeAnsiX12Segment=function(t,e){var r=[];do{if(8===t.available())return;var n=t.readBits(8);if(254===n)return;this.parseTwoBytes(n,t.readBits(8),r);for(var o=0;o<3;o++){var i=r[o];switch(i){case 0:e.append("\r");break;case 1:e.append("*");break;case 2:e.append(">");break;case 3:e.append(" ");break;default:if(i<14)e.append(String.fromCharCode(i+44));else{if(!(i<40))throw new c.a;e.append(String.fromCharCode(i+51))}}}}while(t.available()>0)},t.parseTwoBytes=function(t,e,r){var n=(t<<8)+e-1,o=Math.floor(n/1600);r[0]=o,n-=1600*o,o=Math.floor(n/40),r[1]=o,r[2]=n-40*o},t.decodeEdifactSegment=function(t,e){do{if(t.available()<=16)return;for(var r=0;r<4;r++){var n=t.readBits(6);if(31===n){var o=8-t.getBitOffset();return void(8!==o&&t.readBits(o))}0==(32&n)&&(n|=64),e.append(String.fromCharCode(n))}}while(t.available()>0)},t.decodeBase256Segment=function(t,e,r){var n,o=1+t.getByteOffset(),i=this.unrandomize255State(t.readBits(8),o++);if((n=0===i?t.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(t.readBits(8),o++))<0)throw new c.a;for(var a=new Uint8Array(n),h=0;h=0?r:r+256},t.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],t.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],t.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],t.TEXT_SHIFT2_SET_CHARS=t.C40_SHIFT2_SET_CHARS,t.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)],t}();e.a=h},function(t,e,r){"use strict";var n=r(12),o=r(5),i=r(42),a=r(53),s=r(44),u=r(58),c=r(0),f=r(57),h=r(41),l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},d=function(){function t(){}return t.prototype.decode=function(t,e){return this.setHints(e),this.decodeInternal(t)},t.prototype.decodeWithState=function(t){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(t)},t.prototype.setHints=function(t){this.hints=t;var e=null!=t&&void 0!==t.get(n.a.TRY_HARDER),r=null==t?null:t.get(n.a.POSSIBLE_FORMATS),c=new Array;if(null!=r){var h=r.some((function(t){return t===o.a.UPC_A||t===o.a.UPC_E||t===o.a.EAN_13||t===o.a.EAN_8||t===o.a.CODABAR||t===o.a.CODE_39||t===o.a.CODE_93||t===o.a.CODE_128||t===o.a.ITF||t===o.a.RSS_14||t===o.a.RSS_EXPANDED}));h&&!e&&c.push(new s.a(t)),r.includes(o.a.QR_CODE)&&c.push(new i.a),r.includes(o.a.DATA_MATRIX)&&c.push(new u.a),r.includes(o.a.AZTEC)&&c.push(new a.a),r.includes(o.a.PDF_417)&&c.push(new f.a),h&&e&&c.push(new s.a(t))}0===c.length&&(e||c.push(new s.a(t)),c.push(new i.a),c.push(new u.a),c.push(new a.a),c.push(new f.a),e&&c.push(new s.a(t))),this.readers=c},t.prototype.reset=function(){var t,e;if(null!==this.readers)try{for(var r=l(this.readers),n=r.next();!n.done;n=r.next()){n.value.reset()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.decodeInternal=function(t){var e,r;if(null===this.readers)throw new h.a("No readers where selected, nothing can be read.");try{for(var n=l(this.readers),o=n.next();!o.done;o=n.next()){var i=o.value;try{return i.decode(t,this.hints)}catch(t){if(t instanceof h.a)continue}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}throw new c.a("No MultiFormat Readers were able to detect the code.")},t}();e.a=d},function(t,e,r){"use strict";var n=r(67),o=r(25),i=r(37),a=r(8),s=r(2),u=r(6),c=r(30),f=r(21),h=function(){function t(){}return t.decode=function(e,r,a,c){var h=new n.a(e),l=new u.a,d=new Array,p=-1,g=-1;try{var y=null,w=!1,v=void 0;do{if(h.available()<4)v=f.a.TERMINATOR;else{var m=h.readBits(4);v=f.a.forBits(m)}switch(v){case f.a.TERMINATOR:break;case f.a.FNC1_FIRST_POSITION:case f.a.FNC1_SECOND_POSITION:w=!0;break;case f.a.STRUCTURED_APPEND:if(h.available()<16)throw new s.a;p=h.readBits(8),g=h.readBits(8);break;case f.a.ECI:var C=t.parseECIValue(h);if(null===(y=o.a.getCharacterSetECIByValue(C)))throw new s.a;break;case f.a.HANZI:var _=h.readBits(4),A=h.readBits(v.getCharacterCountBits(r));_===t.GB2312_SUBSET&&t.decodeHanziSegment(h,l,A);break;default:var E=h.readBits(v.getCharacterCountBits(r));switch(v){case f.a.NUMERIC:t.decodeNumericSegment(h,l,E);break;case f.a.ALPHANUMERIC:t.decodeAlphanumericSegment(h,l,E,w);break;case f.a.BYTE:t.decodeByteSegment(h,l,E,y,d,c);break;case f.a.KANJI:t.decodeKanjiSegment(h,l,E);break;default:throw new s.a}}}while(v!==f.a.TERMINATOR)}catch(t){throw new s.a}return new i.a(e,l.toString(),0===d.length?null:d,null===a?null:a.toString(),p,g)},t.decodeHanziSegment=function(t,e,r){if(13*r>t.available())throw new s.a;for(var n=new Uint8Array(2*r),o=0;r>0;){var i=t.readBits(13),u=i/96<<8&4294967295|i%96;u+=u<959?41377:42657,n[o]=u>>8&255,n[o+1]=255&u,o+=2,r--}try{e.append(c.a.decode(n,a.a.GB2312))}catch(t){throw new s.a(t)}},t.decodeKanjiSegment=function(t,e,r){if(13*r>t.available())throw new s.a;for(var n=new Uint8Array(2*r),o=0;r>0;){var i=t.readBits(13),u=i/192<<8&4294967295|i%192;u+=u<7936?33088:49472,n[o]=u>>8,n[o+1]=u,o+=2,r--}try{e.append(c.a.decode(n,a.a.SHIFT_JIS))}catch(t){throw new s.a(t)}},t.decodeByteSegment=function(t,e,r,n,o,i){if(8*r>t.available())throw new s.a;for(var u,f=new Uint8Array(r),h=0;h=t.ALPHANUMERIC_CHARS.length)throw new s.a;return t.ALPHANUMERIC_CHARS[e]},t.decodeAlphanumericSegment=function(e,r,n,o){for(var i=r.length();n>1;){if(e.available()<11)throw new s.a;var a=e.readBits(11);r.append(t.toAlphaNumericChar(Math.floor(a/45))),r.append(t.toAlphaNumericChar(a%45)),n-=2}if(1===n){if(e.available()<6)throw new s.a;r.append(t.toAlphaNumericChar(e.readBits(6)))}if(o)for(var u=i;u=3;){if(e.available()<10)throw new s.a;var o=e.readBits(10);if(o>=1e3)throw new s.a;r.append(t.toAlphaNumericChar(Math.floor(o/100))),r.append(t.toAlphaNumericChar(Math.floor(o/10)%10)),r.append(t.toAlphaNumericChar(o%10)),n-=3}if(2===n){if(e.available()<7)throw new s.a;var i=e.readBits(7);if(i>=100)throw new s.a;r.append(t.toAlphaNumericChar(Math.floor(i/10))),r.append(t.toAlphaNumericChar(i%10))}else if(1===n){if(e.available()<4)throw new s.a;var a=e.readBits(4);if(a>=10)throw new s.a;r.append(t.toAlphaNumericChar(a))}},t.parseECIValue=function(t){var e=t.readBits(8);if(0==(128&e))return 127&e;if(128==(192&e))return(63&e)<<8&4294967295|t.readBits(8);if(192==(224&e))return(31&e)<<16&4294967295|t.readBits(16);throw new s.a},t.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",t.GB2312_SUBSET=1,t}();e.a=h},function(t,e,r){"use strict";(function(t){var n,o,i=r(2),a=r(25),s=r(37),u=r(103),c=r(16),f=r(6),h=r(7),l=r(119),d=r(87),p=r(30);function g(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==t)return t.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}function y(t){if(void 0===o&&(o=g()),null===o)throw new Error("BigInt is not supported!");return o(t)}!function(t){t[t.ALPHA=0]="ALPHA",t[t.LOWER=1]="LOWER",t[t.MIXED=2]="MIXED",t[t.PUNCT=3]="PUNCT",t[t.ALPHA_SHIFT=4]="ALPHA_SHIFT",t[t.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(n||(n={}));var w=function(){function t(){}return t.decode=function(e,r){var n=new f.a(""),o=a.a.ISO8859_1;n.enableDecoding(o);for(var c=1,h=e[c++],l=new u.a;ce[0])throw i.a.getFormatInstance();for(var o=new Int32Array(t.NUMBER_OF_SEQUENCE_CODEWORDS),a=0;a0){for(var l=0;l<6;++l)a.write(Number(y(u)>>y(8*(5-l))));u=0,s=0}}o===r[0]&&h0){for(l=0;l<6;++l)a.write(Number(y(u)>>y(8*(5-l))));u=0,s=0}}}return i.append(p.a.decode(a.toByteArray(),n)),o},t.numericCompaction=function(e,r,n){for(var o=0,i=!1,a=new Int32Array(t.MAX_NUMERIC_CODEWORDS);r0&&(n.append(t.decodeBase900toBase10(a,o)),o=0)}return r},t.decodeBase900toBase10=function(e,r){for(var n=y(0),o=0;o@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",t.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",t.EXP900=g()?function(){var t=[];t[0]=y(1);var e=y(900);t[1]=e;for(var r=2;r<16;r++)t[r]=t[r-1]*e;return t}():[],t.NUMBER_OF_SEQUENCE_CODEWORDS=2,t}();e.a=w}).call(this,r(138))},function(t,e,r){"use strict";var n=function(){function t(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return t.prototype.getSegmentIndex=function(){return this.segmentIndex},t.prototype.setSegmentIndex=function(t){this.segmentIndex=t},t.prototype.getFileId=function(){return this.fileId},t.prototype.setFileId=function(t){this.fileId=t},t.prototype.getOptionalData=function(){return this.optionalData},t.prototype.setOptionalData=function(t){this.optionalData=t},t.prototype.isLastSegment=function(){return this.lastSegment},t.prototype.setLastSegment=function(t){this.lastSegment=t},t.prototype.getSegmentCount=function(){return this.segmentCount},t.prototype.setSegmentCount=function(t){this.segmentCount=t},t.prototype.getSender=function(){return this.sender||null},t.prototype.setSender=function(t){this.sender=t},t.prototype.getAddressee=function(){return this.addressee||null},t.prototype.setAddressee=function(t){this.addressee=t},t.prototype.getFileName=function(){return this.fileName},t.prototype.setFileName=function(t){this.fileName=t},t.prototype.getFileSize=function(){return this.fileSize},t.prototype.setFileSize=function(t){this.fileSize=t},t.prototype.getChecksum=function(){return this.checksum},t.prototype.setChecksum=function(t){this.checksum=t},t.prototype.getTimestamp=function(){return this.timestamp},t.prototype.setTimestamp=function(t){this.timestamp=t},t}();e.a=n},function(t,e,r){"use strict";var n=r(5),o=r(17),i=r(23),a=r(39),s=r(72),u=r(3),c=r(31),f=function(){function t(){}return t.prototype.encode=function(e,r,i,c,f){if(0===e.length)throw new u.a("Found empty contents");if(r!==n.a.QR_CODE)throw new u.a("Can only encode QR_CODE, but got "+r);if(i<0||c<0)throw new u.a("Requested dimensions are too small: "+i+"x"+c);var h=a.a.L,l=t.QUIET_ZONE_SIZE;null!==f&&(void 0!==f.get(o.a.ERROR_CORRECTION)&&(h=a.a.fromString(f.get(o.a.ERROR_CORRECTION).toString())),void 0!==f.get(o.a.MARGIN)&&(l=Number.parseInt(f.get(o.a.MARGIN).toString(),10)));var d=s.a.encode(e,h,f);return t.renderResult(d,i,c,l)},t.renderResult=function(t,e,r,n){var o=t.getMatrix();if(null===o)throw new c.a;for(var a=o.getWidth(),s=o.getHeight(),u=a+2*n,f=s+2*n,h=Math.max(e,u),l=Math.max(r,f),d=Math.min(Math.floor(h/u),Math.floor(l/f)),p=Math.floor((h-a*d)/2),g=Math.floor((l-s*d)/2),y=new i.a(h,l),w=0,v=g;w=2)t.writeCodeword(this.encodeASCIIDigits(t.getMessage().charCodeAt(t.pos),t.getMessage().charCodeAt(t.pos+1))),t.pos+=2;else{var e=t.getCurrentChar(),r=o.a.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(r!==this.getEncodingMode())switch(r){case n.c:return t.writeCodeword(n.j),void t.signalEncoderChange(n.c);case n.d:return t.writeCodeword(n.k),void t.signalEncoderChange(n.d);case n.w:t.writeCodeword(n.i),t.signalEncoderChange(n.w);break;case n.u:t.writeCodeword(n.m),t.signalEncoderChange(n.u);break;case n.f:t.writeCodeword(n.l),t.signalEncoderChange(n.f);break;default:throw new Error("Illegal mode: "+r)}else o.a.isExtendedASCII(e)?(t.writeCodeword(n.v),t.writeCodeword(e-128+1),t.pos++):(t.writeCodeword(e+1),t.pos++)}},t.prototype.encodeASCIIDigits=function(t,e){if(o.a.isDigit(t)&&o.a.isDigit(e))return 10*(t-48)+(e-48)+130;throw new Error("not digits: "+t+e)},t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(8),o=r(6),i=r(9),a=r(1),s=function(){function t(){}return t.prototype.getEncodingMode=function(){return a.c},t.prototype.encode=function(t){var e=new o.a;for(e.append(0);t.hasMoreCharacters();){var r=t.getCurrentChar();if(e.append(r),t.pos++,i.a.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(a.b);break}}var s=e.length()-1,u=t.getCodewordCount()+s+1;t.updateSymbolInfo(u);var c=t.getSymbolInfo().getDataCapacity()-u>0;if(t.hasMoreCharacters()||c)if(s<=249)e.setCharAt(0,n.a.getCharAt(s));else{if(!(s<=1555))throw new Error("Message length not in valid ranges: "+s);e.setCharAt(0,n.a.getCharAt(Math.floor(s/250)+249)),e.insert(1,n.a.getCharAt(s%250))}var f=0;for(r=e.length();f=4){t.writeCodewords(this.encodeToCodewords(e.toString()));var s=e.toString().substring(4);if(e.setLengthToZero(),e.append(s),a.a.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(i.b);break}}}e.append(n.a.getCharAt(31)),this.handleEOD(t,e)},t.prototype.handleEOD=function(t,e){try{var r=e.length();if(0===r)return;if(1===r){t.updateSymbolInfo();var n=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),o=t.getRemainingCharacters();if(o>n&&(t.updateSymbolInfo(t.getCodewordCount()+1),n=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()),o<=n&&n<=2)return}if(r>4)throw new Error("Count must not exceed 4");var a=r-1,s=this.encodeToCodewords(e.toString()),u=!t.hasMoreCharacters()&&a<=2;if(a<=2)t.updateSymbolInfo(t.getCodewordCount()+a),(n=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount())>=3&&(u=!1,t.updateSymbolInfo(t.getCodewordCount()+s.length));u?(t.resetSymbolInfo(),t.pos-=a):t.writeCodewords(s)}finally{t.signalEncoderChange(i.b)}},t.prototype.encodeChar=function(t,e){t>=" ".charCodeAt(0)&&t<="?".charCodeAt(0)?e.append(t):t>="@".charCodeAt(0)&&t<="^".charCodeAt(0)?e.append(n.a.getCharAt(t-64)):a.a.illegalCharacter(n.a.getCharAt(t))},t.prototype.encodeToCodewords=function(t){var e=t.length;if(0===e)throw new Error("StringBuilder must not be empty");var r=(t.charAt(0).charCodeAt(0)<<18)+((e>=2?t.charAt(1).charCodeAt(0):0)<<12)+((e>=3?t.charAt(2).charCodeAt(0):0)<<6)+(e>=4?t.charAt(3).charCodeAt(0):0),n=r>>16&255,i=r>>8&255,a=255&r,s=new o.a;return s.append(n),e>=2&&s.append(i),e>=3&&s.append(a),s.toString()},t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(6),o=r(63),i=function(){function t(t){this.msg=t,this.pos=0,this.skipAtEnd=0;for(var e=t.split("").map((function(t){return t.charCodeAt(0)})),r=new n.a,o=0,i=e.length;othis.symbolInfo.getDataCapacity())&&(this.symbolInfo=o.a.lookup(t,this.shape,this.minSize,this.maxSize,!0))},t.prototype.resetSymbolInfo=function(){this.symbolInfo=null},t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n,o=r(8),i=r(6),a=r(49),s=r(9),u=r(1),c=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.getEncodingMode=function(){return u.w},e.prototype.encode=function(t){for(var e=new i.a;t.hasMoreCharacters();){var r=t.getCurrentChar();if(t.pos++,this.encodeChar(r,e),e.length()%3==0)if(this.writeNextTriplet(t,e),s.a.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(u.b);break}}this.handleEOD(t,e)},e.prototype.encodeChar=function(t,e){switch(t){case 13:e.append(0);break;case"*".charCodeAt(0):e.append(1);break;case">".charCodeAt(0):e.append(2);break;case" ".charCodeAt(0):e.append(3);break;default:t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)?e.append(t-48+4):t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)?e.append(t-65+14):s.a.illegalCharacter(o.a.getCharAt(t))}return 1},e.prototype.handleEOD=function(t,e){t.updateSymbolInfo();var r=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),n=e.length();t.pos-=n,(t.getRemainingCharacters()>1||r>1||t.getRemainingCharacters()!==r)&&t.writeCodeword(u.x),t.getNewEncoding()<0&&t.signalEncoderChange(u.b)},e}(a.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n,o=r(49),i=r(1),a=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.getEncodingMode=function(){return i.u},e.prototype.encodeChar=function(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="a".charCodeAt(0)&&t<="z".charCodeAt(0))return e.append(t-97+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t>="[".charCodeAt(0)&&t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t==="`".charCodeAt(0))return e.append(2),e.append(0),2;if(t<="Z".charCodeAt(0))return e.append(2),e.append(t-65+1),2;if(t<=127)return e.append(2),e.append(t-123+27),2;e.append("1");var r=2;return r+=this.encodeChar(t-128,e)},e}(o.a)},function(t,e,r){"use strict";var n=function(){function t(){}return t.prototype.isCompact=function(){return this.compact},t.prototype.setCompact=function(t){this.compact=t},t.prototype.getSize=function(){return this.size},t.prototype.setSize=function(t){this.size=t},t.prototype.getLayers=function(){return this.layers},t.prototype.setLayers=function(t){this.layers=t},t.prototype.getCodeWords=function(){return this.codeWords},t.prototype.setCodeWords=function(t){this.codeWords=t},t.prototype.getMatrix=function(){return this.matrix},t.prototype.setMatrix=function(t){this.matrix=t},t}();e.a=n},function(t,e,r){"use strict";var n,o=r(31),i=r(76),a=r(66),s=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e.prototype.encodeCompressedGtin=function(t,e){t.append("(01)");var r=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,e,r)},e.prototype.encodeCompressedGtinWithoutAI=function(t,r,n){for(var o=0;o<4;++o){var i=this.getGeneralDecoder().extractNumericValueFromBitArray(r+10*o,10);i/100==0&&t.append("0"),i/10==0&&t.append("0"),t.append(i)}e.appendCheckDigit(t,n)},e.appendCheckDigit=function(t,e){for(var r=0,n=0;n<13;n++){var o=t.charAt(n+e).charCodeAt(0)-"0".charCodeAt(0);r+=0==(1&n)?3*o:o}10===(r=10-r%10)&&(r=0),t.append(r)},e.GTIN_SIZE=40,e}(a.a),c=r(6),f=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),h=function(t){function e(e){return t.call(this,e)||this}return f(e,t),e.prototype.parseInformation=function(){var t=new c.a;t.append("(01)");var r=t.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(n),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,r),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e}(u),l=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),d=function(t){function e(e){return t.call(this,e)||this}return l(e,t),e.prototype.parseInformation=function(){var t=new c.a;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e}(a.a),p=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),g=function(t){function e(e){return t.call(this,e)||this}return p(e,t),e.prototype.encodeCompressedWeight=function(t,e,r){var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e,r);this.addWeightCode(t,n);for(var o=this.checkWeight(n),i=1e5,a=0;a<5;++a)o/i==0&&t.append("0"),i/=10;t.append(o)},e}(u),y=r(0),w=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),v=function(t){function e(e){return t.call(this,e)||this}return w(e,t),e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+g.GTIN_SIZE+e.WEIGHT_SIZE)throw new y.a;var t=new c.a;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+g.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e}(g),m=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),C=function(t){function e(e){return t.call(this,e)||this}return m(e,t),e.prototype.addWeightCode=function(t,e){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e}(v),_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=function(t){function e(e){return t.call(this,e)||this}return _(e,t),e.prototype.addWeightCode=function(t,e){e<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e}(v),E=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),I=function(t){function e(e){return t.call(this,e)||this}return E(e,t),e.prototype.parseInformation=function(){if(this.getInformation().getSize()"},e}(a),f=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),h=function(t){function e(e,r,n){var o=t.call(this,e,0,0)||this;return o.binaryShiftStart=r,o.binaryShiftByteCount=n,o}return f(e,t),e.prototype.appendTo=function(t,e){for(var r=0;r62?t.appendBits(this.binaryShiftByteCount-31,16):0===r?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(e[this.binaryShiftStart+r],8)},e.prototype.addBinaryShift=function(t,r){return new e(this,t,r)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e}(c);function l(t,e,r){return new c(t,e,r)}var d=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],p=new c(null,0,0),g=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])],y=r(16),w=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};var v=function(t){var e,r;try{for(var n=w(t),o=n.next();!o.done;o=n.next()){var i=o.value;y.a.fill(i,-1)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return t[0][4]=0,t[1][4]=0,t[1][0]=28,t[3][4]=0,t[2][4]=0,t[2][0]=15,t}(y.a.createInt32Array(6,6)),m=r(8),C=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_=function(){function t(t,e,r,n){this.token=t,this.mode=e,this.binaryShiftByteCount=r,this.bitCount=n}return t.prototype.getMode=function(){return this.mode},t.prototype.getToken=function(){return this.token},t.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},t.prototype.getBitCount=function(){return this.bitCount},t.prototype.latchAndAppend=function(e,r){var n=this.bitCount,o=this.token;if(e!==this.mode){var i=g[this.mode][e];o=l(o,65535&i,i>>16),n+=i>>16}var a=2===e?4:5;return new t(o=l(o,r,a),e,0,n+a)},t.prototype.shiftAndAppend=function(e,r){var n=this.token,o=2===this.mode?4:5;return n=l(n,v[this.mode][e],o),new t(n=l(n,r,5),this.mode,0,this.bitCount+o+5)},t.prototype.addBinaryShiftChar=function(e){var r=this.token,n=this.mode,o=this.bitCount;if(4===this.mode||2===this.mode){var i=g[n][0];r=l(r,65535&i,i>>16),o+=i>>16,n=0}var a=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,s=new t(r,n,this.binaryShiftByteCount+1,o+a);return 2078===s.binaryShiftByteCount&&(s=s.endBinaryShift(e+1)),s},t.prototype.endBinaryShift=function(e){if(0===this.binaryShiftByteCount)return this;var r=this.token;return new t(r=function(t,e,r){return new h(t,e,r)}(r,e-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)},t.prototype.isBetterThanOrEqualTo=function(e){var r=this.bitCount+(g[this.mode][e.mode]>>16);return this.binaryShiftByteCounte.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(r+=10),r<=e.bitCount},t.prototype.toBitArray=function(t){for(var e,r,n=[],o=this.endBinaryShift(t.length).token;null!==o;o=o.getPrevious())n.unshift(o);var a=new i.a;try{for(var s=C(n),u=s.next();!u.done;u=s.next()){u.value.appendTo(a,t)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return a},t.prototype.toString=function(){return m.a.format("%s bits=%d bytes=%d",d[this.mode],this.bitCount,this.binaryShiftByteCount)},t.calculateBinaryShiftCost=function(t){return t.binaryShiftByteCount>62?21:t.binaryShiftByteCount>31?20:t.binaryShiftByteCount>0?10:0},t.INITIAL_STATE=new t(p,0,0,0),t}();var A=function(t){var e=m.a.getCharCode(" "),r=m.a.getCharCode("."),n=m.a.getCharCode(",");t[0][e]=1;for(var o=m.a.getCharCode("Z"),i=m.a.getCharCode("A"),a=i;a<=o;a++)t[0][a]=a-i+2;t[1][e]=1;var s=m.a.getCharCode("z"),u=m.a.getCharCode("a");for(a=u;a<=s;a++)t[1][a]=a-u+2;t[2][e]=1;var c=m.a.getCharCode("9"),f=m.a.getCharCode("0");for(a=f;a<=c;a++)t[2][a]=a-f+2;t[2][n]=12,t[2][r]=13;for(var h=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""],l=0;l","?","[","]","{","}"];for(l=0;l0&&(t[4][m.a.getCharCode(d[l])]=l);return t}(y.a.createInt32Array(5,256)),E=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},I=function(){function t(t){this.text=t}return t.prototype.encode=function(){for(var e=m.a.getCharCode(" "),r=m.a.getCharCode("\n"),n=o.a.singletonList(_.INITIAL_STATE),i=0;i0?(n=t.updateStateListForPair(n,i,a),i++):n=this.updateStateListForChar(n,i)}return o.a.min(n,(function(t,e){return t.getBitCount()-e.getBitCount()})).toBitArray(this.text)},t.prototype.updateStateListForChar=function(e,r){var n,o,i=[];try{for(var a=E(e),s=a.next();!s.done;s=a.next()){var u=s.value;this.updateStateForChar(u,r,i)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return t.simplifyStates(i)},t.prototype.updateStateForChar=function(t,e,r){for(var n=255&this.text[e],o=A[t.getMode()][n]>0,i=null,a=0;a<=4;a++){var s=A[a][n];if(s>0){if(null==i&&(i=t.endBinaryShift(e)),!o||a===t.getMode()||2===a){var u=i.latchAndAppend(a,s);r.push(u)}if(!o&&v[t.getMode()][a]>=0){var c=i.shiftAndAppend(a,s);r.push(c)}}}if(t.getBinaryShiftByteCount()>0||0===A[t.getMode()][n]){var f=t.addBinaryShiftChar(e);r.push(f)}},t.updateStateListForPair=function(t,e,r){var n,o,i=[];try{for(var a=E(t),s=a.next();!s.done;s=a.next()){var u=s.value;this.updateStateForPair(u,e,r,i)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return this.simplifyStates(i)},t.updateStateForPair=function(t,e,r,n){var o=t.endBinaryShift(e);if(n.push(o.latchAndAppend(4,r)),4!==t.getMode()&&n.push(o.shiftAndAppend(4,r)),3===r||4===r){var i=o.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(i)}if(t.getBinaryShiftByteCount()>0){var a=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);n.push(a)}},t.simplifyStates=function(t){var e,r,n,o,i=[];try{for(var a=E(t),s=a.next();!s.done;s=a.next()){var u=s.value,c=!0,f=function(t){if(t.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(t)&&(i=i.filter((function(e){return e!==t})))};try{for(var h=(n=void 0,E(i)),l=h.next();!l.done;l=h.next()){if("break"===f(l.value))break}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}c&&i.push(u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t}();e.a=I},function(t,e,r){"use strict";var n,o=r(5),i=r(11),a=r(0),s=r(14),u=r(10),c=r(45),f=r(60),h=r(116),l=r(52),d=r(24),p=function(){function t(){}return t.buildBitArray=function(t){var e=2*t.length-1;null==t[t.length-1].getRightChar()&&(e-=1);for(var r=12*e,n=new d.a(r),o=0,i=t[0].getRightChar().getValue(),a=11;a>=0;--a)0!=(i&1<=0;--c)0!=(u&1<=0;--c)0!=(f&1<=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},C=function(t){function e(){var r=null!==t&&t.apply(this,arguments)||this;return r.pairs=new Array(e.MAX_PAIRS),r.rows=new Array,r.startEnd=[2],r}return v(e,t),e.prototype.decodeRow=function(t,r,n){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,r))}catch(t){}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,r))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,e){for(var r,n=!1;!n;)try{this.pairs.push(this.retrieveNextPair(e,this.pairs,t))}catch(t){if(t instanceof a.a){if(!this.pairs.length)throw new a.a;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(t,!1),r){var o=this.checkRowsBoolean(!1);if(null!=o)return o;if(null!=(o=this.checkRowsBoolean(!0)))return o}throw new a.a},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var e=null;try{e=this.checkRows(new Array,0)}catch(t){console.log(t)}return t&&(this.rows=this.rows.reverse()),e},e.prototype.checkRows=function(t,r){for(var n,o,i=r;ia.length)){for(var s=!0,u=0;ut){i=a.isEquivalent(this.pairs);break}o=a.isEquivalent(this.pairs),n++}i||o||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new w(this.pairs,t,r)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,e){var r,n,o,i,a,s;try{for(var u=m(e),c=u.next();!c.done;c=u.next()){var f=c.value;if(f.getPairs().length!==t.length){try{for(var h=(o=void 0,m(f.getPairs())),l=h.next();!l.done;l=h.next()){var d=l.value,p=!1;try{for(var g=(a=void 0,m(t)),w=g.next();!w.done;w=g.next()){var v=w.value;if(y.equals(d,v)){p=!0;break}}}catch(t){a={error:t}}finally{try{w&&!w.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}p||!1}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}},e.isPartialRow=function(t,e){var r,n,o,i,a,s;try{for(var u=m(e),c=u.next();!c.done;c=u.next()){var f=c.value,h=!0;try{for(var l=(o=void 0,m(t)),d=l.next();!d.done;d=l.next()){var p=d.value,g=!1;try{for(var y=(a=void 0,m(f.getPairs())),w=y.next();!w.done;w=y.next()){var v=w.value;if(p.equals(v)){g=!0;break}}}catch(t){a={error:t}}finally{try{w&&!w.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}if(!g){h=!1;break}}}catch(t){o={error:t}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}if(h)return!0}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var e=p.buildBitArray(t),r=Object(g.a)(e).parseInformation(),n=t[0].getFinderPattern().getResultPoints(),i=t[t.length-1].getFinderPattern().getResultPoints(),a=[n[0],n[1],i[0],i[1]];return new s.a(r,null,null,a,o.a.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),e=t.getLeftChar(),r=t.getRightChar();if(null===r)return!1;for(var n=r.getChecksumPortion(),o=2,i=1;i=0)i=n;else if(this.isEmptyPair(r))i=0;else{i=r[r.length-1].getFinderPattern().getStartEnd()[1]}var u=r.length%2!=0;this.startFromEven&&(u=!u);for(var c=!1;i=0&&!t.get(s);)s--;s++,o=this.startEnd[0]-s,i=s,a=this.startEnd[1]}else i=this.startEnd[0],o=(a=t.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];var c,f=this.getDecodeFinderCounters();u.a.arraycopy(f,0,f,1,f.length-1),f[0]=o;try{c=this.parseFinderValue(f,e.FINDER_PATTERNS)}catch(t){return null}return new h.a(c,[i,a],i,a,r)},e.prototype.decodeDataCharacter=function(t,r,n,o){for(var s=this.getDataCharacterCounters(),u=0;u.3)throw new a.a;var y=this.getOddCounts(),w=this.getEvenCounts(),v=this.getOddRoundingErrors(),m=this.getEvenRoundingErrors();for(c=0;c8){if(C>8.7)throw new a.a;_=8}var A=c/2;0==(1&c)?(y[A]=_,v[A]=C-_):(w[A]=_,m[A]=C-_)}this.adjustOddEvenCounts(17);var E=4*r.getValue()+(n?0:2)+(o?0:1)-1,I=0,S=0;for(c=y.length-1;c>=0;c--){if(e.isNotA1left(r,n,o)){var T=e.WEIGHTS[E][2*c];S+=y[c]*T}I+=y[c]}var b=0;for(c=w.length-1;c>=0;c--)if(e.isNotA1left(r,n,o)){T=e.WEIGHTS[E][2*c+1];b+=w[c]*T}var O=S+b;if(0!=(1&I)||I>13||I<4)throw new a.a;var R=(13-I)/2,N=e.SYMBOL_WIDEST[R],D=9-N,M=l.a.getRSSvalue(y,N,!0),P=l.a.getRSSvalue(w,D,!1),B=M*e.EVEN_TOTAL_SUBSET[R]+P+e.GSUM[R];return new f.a(B,O)},e.isNotA1left=function(t,e,r){return!(0===t.getValue()&&e&&r)},e.prototype.adjustOddEvenCounts=function(t){var r=i.a.sum(new Int32Array(this.getOddCounts())),n=i.a.sum(new Int32Array(this.getEvenCounts())),o=!1,s=!1;r>13?s=!0:r<4&&(o=!0);var u=!1,c=!1;n>13?c=!0:n<4&&(u=!0);var f=r+n-t,h=1==(1&r),l=0==(1&n);if(1===f)if(h){if(l)throw new a.a;s=!0}else{if(!l)throw new a.a;c=!0}else if(-1===f)if(h){if(l)throw new a.a;o=!0}else{if(!l)throw new a.a;u=!0}else{if(0!==f)throw new a.a;if(h){if(!l)throw new a.a;r=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=function(){function t(t,e){if(0===e.length)throw new i.a;this.field=t;var r=e.length;if(r>1&&0===e[0]){for(var n=1;nn.length){var o=r;r=n,n=o}var s=new Int32Array(n.length),u=n.length-r.length;a.a.arraycopy(n,0,s,0,u);for(var c=u;c=0;e--){var r=this.getCoefficient(e);0!==r&&(r<0?(t.append(" - "),r=-r):t.length()>0&&t.append(" + "),0!==e&&1===r||t.append(r),0!==e&&(1===e?t.append("x"):(t.append("x^"),t.append(e))))}return t.toString()},t}(),f=r(13),h=r(64),l=function(){function t(){}return t.prototype.add=function(t,e){return(t+e)%this.modulus},t.prototype.subtract=function(t,e){return(this.modulus+t-e)%this.modulus},t.prototype.exp=function(t){return this.expTable[t]},t.prototype.log=function(t){if(0===t)throw new i.a;return this.logTable[t]},t.prototype.inverse=function(t){if(0===t)throw new h.a;return this.expTable[this.modulus-this.logTable[t]-1]},t.prototype.multiply=function(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.modulus-1)]},t.prototype.getSize=function(){return this.modulus},t.prototype.equals=function(t){return t===this},t}(),d=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),p=function(t){function e(e,r){var n=t.call(this)||this;n.modulus=e,n.expTable=new Int32Array(e),n.logTable=new Int32Array(e);for(var o=1,i=0;i=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y=function(){function t(){this.field=p.PDF417_GF}return t.prototype.decode=function(t,e,r){for(var n,i,a=new c(this.field,t),s=new Int32Array(e),u=!1,f=e;f>0;f--){var h=a.evaluateAt(this.field.exp(f));s[e-f]=h,0!==h&&(u=!0)}if(!u)return 0;var l=this.field.getOne();if(null!=r)try{for(var d=g(r),p=d.next();!p.done;p=d.next()){var y=p.value,w=this.field.exp(t.length-1-y),v=new c(this.field,new Int32Array([this.field.subtract(0,w),1]));l=l.multiply(v)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}var m=new c(this.field,s),C=this.runEuclideanAlgorithm(this.field.buildMonomial(e,1),m,e),_=C[0],A=C[1],E=this.findErrorLocations(_),I=this.findErrorMagnitudes(A,_,E);for(f=0;f=Math.round(r/2);){var c=i,f=s;if(s=u,(i=a).isZero())throw o.a.getChecksumInstance();a=c;for(var h=this.field.getZero(),l=i.getCoefficient(i.getDegree()),d=this.field.inverse(l);a.getDegree()>=i.getDegree()&&!a.isZero();){var p=a.getDegree()-i.getDegree(),g=this.field.multiply(a.getCoefficient(a.getDegree()),d);h=h.add(this.field.buildMonomial(p,g)),a=a.subtract(i.multiplyByMonomial(p,g))}u=h.multiply(s).subtract(f).negative()}var y=u.getCoefficient(0);if(0===y)throw o.a.getChecksumInstance();var w=this.field.inverse(y);return[u.multiply(w),a.multiply(w)]},t.prototype.findErrorLocations=function(t){for(var e=t.getDegree(),r=new Int32Array(e),n=0,i=1;i=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},g=function(){function t(t,e,r,n,o,i,a){this.image=t,this.startX=e,this.startY=r,this.width=n,this.height=o,this.moduleSize=i,this.resultPointCallback=a,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return t.prototype.find=function(){for(var t=this.startX,e=this.height,r=t+this.width,n=this.startY+e/2,o=new Int32Array(3),i=this.image,a=0;a=r)return!1;return!0},t.prototype.crossCheckVertical=function(e,r,n,o){var i=this.image,a=i.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var u=e;u>=0&&i.get(r,u)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return NaN;for(;u>=0&&!i.get(r,u)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return NaN;for(u=e+1;un)return NaN;for(;un)return NaN;var c=s[0]+s[1]+s[2];return 5*Math.abs(c-o)>=2*o?NaN:this.foundPatternCross(s)?t.centerFromEnd(s,u):NaN},t.prototype.handlePossibleCenter=function(e,r,n){var o,i,a=e[0]+e[1]+e[2],s=t.centerFromEnd(e,n),u=this.crossCheckVertical(r,s,2*e[1],a);if(!isNaN(u)){var c=(e[0]+e[1]+e[2])/3;try{for(var f=p(this.possibleCenters),h=f.next();!h.done;h=f.next()){var l=h.value;if(l.aboutEquals(c,u,s))return l.combineEstimate(u,s,c)}}catch(t){o={error:t}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}var g=new d(s,u,c);this.possibleCenters.push(g),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(g)}return null},t}(),y=r(118),w=function(){function t(t){this.image=t}return t.prototype.getImage=function(){return this.image},t.prototype.getResultPointCallback=function(){return this.resultPointCallback},t.prototype.detect=function(t){this.resultPointCallback=null==t?null:t.get(u.a.NEED_RESULT_POINT_CALLBACK);var e=new y.a(this.image,this.resultPointCallback).find(t);return this.processFinderPatternInfo(e)},t.prototype.processFinderPatternInfo=function(e){var r=e.getTopLeft(),n=e.getTopRight(),o=e.getBottomLeft(),a=this.calculateModuleSize(r,n,o);if(a<1)throw new c.a("No pattern found in proccess finder.");var s=t.computeDimension(r,n,o,a),u=h.a.getProvisionalVersionForDimension(s),f=u.getDimensionForVersion()-7,l=null;if(u.getAlignmentPatternCenters().length>0)for(var d=n.getX()-r.getX()+o.getX(),p=n.getY()-r.getY()+o.getY(),g=1-3/f,y=Math.floor(r.getX()+g*(d-r.getX())),w=Math.floor(r.getY()+g*(p-r.getY())),v=4;v<=16;v<<=1)try{l=this.findAlignmentInRegion(a,y,w,v);break}catch(t){if(!(t instanceof c.a))throw t}var m,C=t.createTransform(r,n,o,l,s),_=t.sampleGrid(this.image,C,s);return m=null===l?[o,r,n]:[o,r,n,l],new i.a(_,m)},t.createTransform=function(t,e,r,n,o){var i,a,u,c,f=o-3.5;return null!==n?(i=n.getX(),a=n.getY(),c=u=f-3):(i=e.getX()-t.getX()+r.getX(),a=e.getY()-t.getY()+r.getY(),u=f,c=f),s.a.quadrilateralToQuadrilateral(3.5,3.5,f,3.5,u,c,3.5,f,t.getX(),t.getY(),e.getX(),e.getY(),i,a,r.getX(),r.getY())},t.sampleGrid=function(t,e,r){return a.a.getInstance().sampleGridWithTransform(t,r,r,e)},t.computeDimension=function(t,e,r,n){var i=o.a.round(f.a.distance(t,e)/n),a=o.a.round(f.a.distance(t,r)/n),s=Math.floor((i+a)/2)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw new c.a("Dimensions could be not found.")}return s},t.prototype.calculateModuleSize=function(t,e,r){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,r))/2},t.prototype.calculateModuleSizeOneWay=function(t,e){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},t.prototype.sizeOfBlackWhiteBlackRunBothWays=function(t,e,r,n){var o=this.sizeOfBlackWhiteBlackRun(t,e,r,n),i=1,a=t-(r-t);a<0?(i=t/(t-a),a=0):a>=this.image.getWidth()&&(i=(this.image.getWidth()-1-t)/(a-t),a=this.image.getWidth()-1);var s=Math.floor(e-(n-e)*i);return i=1,s<0?(i=e/(e-s),s=0):s>=this.image.getHeight()&&(i=(this.image.getHeight()-1-e)/(s-e),s=this.image.getHeight()-1),a=Math.floor(t+(a-t)*i),(o+=this.sizeOfBlackWhiteBlackRun(t,e,a,s))-1},t.prototype.sizeOfBlackWhiteBlackRun=function(t,e,r,n){var i=Math.abs(n-e)>Math.abs(r-t);if(i){var a=t;t=e,e=a,a=r,r=n,n=a}for(var s=Math.abs(r-t),u=Math.abs(n-e),c=-s/2,f=t0){if(g===n)break;g+=h,c-=s}}return 2===l?o.a.distance(r+f,n,t,e):NaN},t.prototype.findAlignmentInRegion=function(t,e,r,n){var o=Math.floor(n*t),i=Math.max(0,e-o),a=Math.min(this.image.getWidth()-1,e+o);if(a-i<3*t)throw new c.a("Alignment top exceeds estimated module size.");var s=Math.max(0,r-o),u=Math.min(this.image.getHeight()-1,r+o);if(u-s<3*t)throw new c.a("Alignment bottom exceeds estimated module size.");return new g(this.image,i,s,a-i,u-s,t,this.resultPointCallback).find()},t}();e.a=w},function(t,e,r){"use strict";var n,o=r(12),i=r(0),a=r(4),s=r(16),u=function(){function t(){}return t.MAX_VALUE=293,t}(),c=r(26),f=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),h=function(t){function e(e,r,n,o){var i=t.call(this,e,r)||this;return i.estimatedModuleSize=n,i.count=o,void 0===o&&(i.count=1),i}return f(e,t),e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,e,r){if(Math.abs(e-this.getY())<=t&&Math.abs(r-this.getX())<=t){var n=Math.abs(t-this.estimatedModuleSize);return n<=1||n<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,r,n){var o=this.count+1;return new e((this.count*this.getX()+r)/o,(this.count*this.getY()+t)/o,(this.count*this.estimatedModuleSize+n)/o,o)},e}(a.a),l=r(86),d=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=function(){function t(){}return t.prototype.compare=function(t,e){return c.a.compare(t.getEstimatedModuleSize(),e.getEstimatedModuleSize())},t}(),g=function(){function t(t,e){e?this.constructorOverload2(t,e):this.constructorOverload1(t)}return t.prototype.constructorOverload1=function(t){this.constructorOverload2(t,null)},t.prototype.constructorOverload2=function(t,e){this.image=t,this.possibleCenters=new Array,this.crossCheckStateCount=Int32Array.from({length:5}),this.resultPointCallback=e},t.prototype.getImage=function(){return this.image},t.prototype.getPossibleCenters=function(){return this.possibleCenters},t.prototype.find=function(e){var r=null!=e&&e.has(o.a.TRY_HARDER),n=this.image.getHeight(),i=this.image.getWidth(),s=Math.trunc(3*n/(4*t.MAX_MODULES));(sc[2]&&(f+=p-c[2]-s,d=i-1)}h=0,this.clearCounts(c)}else this.shiftCounts2(c),h=3;else c[++h]++;else c[h]++;if(t.foundPatternCross(c))this.handlePossibleCenter(c,f,i)&&(s=c[0],this.hasSkipped&&(u=this.haveMultiplyConfirmedCenters()))}var g=this.selectBestPatterns();return a.a.orderBestPatterns(g),new l.a(g)},t.centerFromEnd=function(t,e){return e-t[4]-t[3]-t[2]/2},t.foundPatternCross=function(t){for(var e=0,r=0;r<5;r++){var n=t[r];if(0===n)return!1;e+=n}if(e<7)return!1;var o=e/7,i=o/2;return Math.abs(o-t[0])=o&&r>=o&&this.image.get(r-o,e-o);)n[2]++,o++;if(0===n[2])return!1;for(;e>=o&&r>=o&&!this.image.get(r-o,e-o);)n[1]++,o++;if(0===n[1])return!1;for(;e>=o&&r>=o&&this.image.get(r-o,e-o);)n[0]++,o++;if(0===n[0])return!1;var i=this.image.getHeight(),a=this.image.getWidth();for(o=1;e+o=0&&i.get(r,u);)s[2]++,u--;if(u<0)return c.a.NaN;for(;u>=0&&!i.get(r,u)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return c.a.NaN;for(;u>=0&&i.get(r,u)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return c.a.NaN;for(u=e+1;u=n)return c.a.NaN;for(;u=n)return c.a.NaN;var f=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(f-o)>=2*o?c.a.NaN:t.foundPatternCross(s)?t.centerFromEnd(s,u):c.a.NaN},t.prototype.crossCheckHorizontal=function(e,r,n,o){for(var i=this.image,a=i.getWidth(),s=this.getCrossCheckStateCount(),u=e;u>=0&&i.get(u,r);)s[2]++,u--;if(u<0)return c.a.NaN;for(;u>=0&&!i.get(u,r)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return c.a.NaN;for(;u>=0&&i.get(u,r)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return c.a.NaN;for(u=e+1;u=n)return c.a.NaN;for(;u=n)return c.a.NaN;var f=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(f-o)>=o?c.a.NaN:t.foundPatternCross(s)?t.centerFromEnd(s,u):c.a.NaN},t.prototype.handlePossibleCenterX=function(t,e,r,n){return this.handlePossibleCenter(t,e,r)},t.prototype.handlePossibleCenter=function(e,r,n){var o=e[0]+e[1]+e[2]+e[3]+e[4],i=t.centerFromEnd(e,n),a=this.crossCheckVertical(r,i,e[2],o);if(!c.a.isNaN(a)&&(i=this.crossCheckHorizontal(Math.trunc(i),Math.trunc(a),e[2],o),!c.a.isNaN(i)&&this.crossCheckDiagonal(Math.trunc(a),Math.trunc(i)))){for(var s=o/7,u=!1,f=0;f=t.CENTER_QUORUM){if(null!=n)return this.hasSkipped=!0,Math.trunc((Math.abs(n.getX()-a.getX())-Math.abs(n.getY()-a.getY()))/2);n=a}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return 0},t.prototype.haveMultiplyConfirmedCenters=function(){var e,r,n,o,i=0,a=0,s=this.possibleCenters.length;try{for(var u=d(this.possibleCenters),c=u.next();!c.done;c=u.next()){(g=c.value).getCount()>=t.CENTER_QUORUM&&(i++,a+=g.getEstimatedModuleSize())}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}if(i<3)return!1;var f=a/s,h=0;try{for(var l=d(this.possibleCenters),p=l.next();!p.done;p=l.next()){var g=p.value;h+=Math.abs(g.getEstimatedModuleSize()-f)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return h<=.05*a},t.squaredDistance=function(t,e){var r=t.getX()-e.getX(),n=t.getY()-e.getY();return r*r+n*n},t.prototype.selectBestPatterns=function(){if(this.possibleCenters.length<3)throw i.a.getNotFoundInstance();this.possibleCenters.sort(t.moduleComparator.compare);for(var e=u.MAX_VALUE,r=Float64Array.from({length:3}),n=new h[3],o=0;o1.4*c)){r[0]=d,r[1]=t.squaredDistance(l,g),r[2]=t.squaredDistance(a,g),s.a.sort(r);var y=Math.abs(r[2]-2*r[1])+Math.abs(r[2]-2*r[0]);yr||i+u>n)throw new s.a("Crop rectangle does not fit within image data.");return c&&f.reverseHorizontal(a,u),f}u(e,t),e.prototype.getRow=function(t,e){if(t<0||t>=this.getHeight())throw new s.a("Requested row is outside the image: "+t);var r=this.getWidth();(null==e||e.length>16&255,g=d>>7&510,y=255&d;h[l]=(p+g+y)/4&255}c.luminances=h}else c.luminances=e;if(void 0===o&&(c.dataWidth=r),void 0===i&&(c.dataHeight=n),void 0===a&&(c.left=0),void 0===u&&(c.top=0),c.left+r>c.dataWidth||c.top+n>c.dataHeight)throw new s.a("Crop rectangle does not fit within image data.");return c}u(e,t),e.prototype.getRow=function(t,e){if(t<0||t>=this.getHeight())throw new s.a("Requested row is outside the image: "+t);var r=this.getWidth();(null==e||e.length=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(){function t(t){this.charset=t,this.name=t.name}return t.prototype.canEncode=function(t){try{return null!=g.a.encode(t,this.charset)}catch(t){return!1}},t}(),m=function(){function t(t,e,r){var n,o,i,a,s,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map((function(t){return new v(c.a.forName(t))})),this.encoders=[];var f=[];f.push(new v(p.a.ISO_8859_1));for(var h=null!=e&&e.name.startsWith("UTF"),l=0;l=this.bytes.length)return!1;for(var r=0;r=this.length())throw new Error(""+t);if(this.isECI(t))throw new Error("value at "+t+" is not a character but an ECI");return this.isFNC1(t)?this.fnc1:this.bytes[t]},t.prototype.subSequence=function(t,e){if(t<0||t>e||e>this.length())throw new Error(""+t);for(var r=new _.a,n=t;n=this.length())throw new Error(""+t);return this.bytes[t]>255&&this.bytes[t]<=999},t.prototype.isFNC1=function(t){if(t<0||t>=this.length())throw new Error(""+t);return 1e3===this.bytes[t]},t.prototype.getECIValue=function(t){if(t<0||t>=this.length())throw new Error(""+t);if(!this.isECI(t))throw new Error("value at "+t+" is not an ECI but a character");return this.bytes[t]-256},t.prototype.addEdge=function(t,e,r){(null==t[e][r.encoderIndex]||t[e][r.encoderIndex].cachedTotalSize>r.cachedTotalSize)&&(t[e][r.encoderIndex]=r)},t.prototype.addEdges=function(t,e,r,n,o,i){var a=t.charAt(n).charCodeAt(0),s=0,u=e.length();e.getPriorityEncoderIndex()>=0&&(a===i||e.canEncode(a,e.getPriorityEncoderIndex()))&&(u=(s=e.getPriorityEncoderIndex())+1);for(var c=s;c=0;i--)f.unshift(255&l[i])}(null===h.previous?0:h.previous.encoderIndex)!==h.encoderIndex&&f.unshift(256+e.getECIValue(h.encoderIndex)),h=h.previous}var d=[];for(i=0;i=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},T=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},b=function(){for(var t=[],e=0;e","?","@","[","\\","]","^","_"],R=function(){function t(){}return t.isExtendedASCII=function(t,e){return t!==e&&t>=128&&t<=255},t.isInC40Shift1Set=function(t){return t<=31},t.isInC40Shift2Set=function(t,e){var r,n;try{for(var o=S(O),i=o.next();!i.done;i=o.next()){if(i.value.charCodeAt(0)===t)return!0}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return t===e},t.isInTextShift1Set=function(t){return this.isInC40Shift1Set(t)},t.isInTextShift2Set=function(t,e){return this.isInC40Shift2Set(t,e)},t.encodeHighLevel=function(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=-1),void 0===n&&(n=0);var o=0;return t.startsWith(d.p)&&t.endsWith(d.s)?(o=5,t=t.substring(d.p.length,t.length-2)):t.startsWith(d.r)&&t.endsWith(d.s)&&(o=6,t=t.substring(d.r.length,t.length-2)),decodeURIComponent(escape(String.fromCharCode.apply(String,b(this.encode(t,e,r,n,o)))))},t.encode=function(t,e,r,n,o){return this.encodeMinimally(new M(t,e,r,n,o)).getBytes()},t.addEdge=function(t,e){var r=e.fromPosition+e.characterLength;(null===t[r][e.getEndMode()]||t[r][e.getEndMode()].cachedTotalSize>e.cachedTotalSize)&&(t[r][e.getEndMode()]=e)},t.getNumberOfC40Words=function(e,r,n,o){for(var i=0,a=r;a=128&&(n&&l.a.isNativeC40(u-128)||!n&&l.a.isNativeText(u-128))?i+=3:i+=4}else i+=2;if(i%3==0||(i-2)%3==0&&a+1===e.length())return o[0]=a-r+1,Math.ceil(i/3)}return o[0]=0,0},t.addEdges=function(e,r,n,i){var a,s;if(e.isECI(n))this.addEdge(r,new D(e,o.ASCII,n,1,i));else{var u,c=e.charAt(n);if(null===i||i.getEndMode()!==o.EDF){l.a.isDigit(c)&&e.haveNCharacters(n,2)&&l.a.isDigit(e.charAt(n+1))?this.addEdge(r,new D(e,o.ASCII,n,2,i)):this.addEdge(r,new D(e,o.ASCII,n,1,i));var f=[o.C40,o.TEXT];try{for(var h=S(f),d=h.next();!d.done;d=h.next()){var p=d.value,g=[];t.getNumberOfC40Words(e,n,p===o.C40,g)>0&&this.addEdge(r,new D(e,p,n,g[0],i))}}catch(t){a={error:t}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}e.haveNCharacters(n,3)&&l.a.isNativeX12(e.charAt(n))&&l.a.isNativeX12(e.charAt(n+1))&&l.a.isNativeX12(e.charAt(n+2))&&this.addEdge(r,new D(e,o.X12,n,3,i)),this.addEdge(r,new D(e,o.B256,n,1,i))}for(u=0;u<3;u++){var y=n+u;if(!e.haveNCharacters(y,1)||!l.a.isNativeEDIFACT(e.charAt(y)))break;this.addEdge(r,new D(e,o.EDF,n,u+1,i))}3===u&&e.haveNCharacters(n,4)&&l.a.isNativeEDIFACT(e.charAt(n+3))&&this.addEdge(r,new D(e,o.EDF,n,4,i))}},t.encodeMinimally=function(t){var e=t.length(),r=Array(e+1).fill(null).map((function(){return Array(6).fill(0)}));this.addEdges(t,r,0,null);for(var n=1;n<=e;n++){for(var o=0;o<6;o++)null!==r[n][o]&&n=1&&o<=3?s.cachedTotalSize+1:s.cachedTotalSize;u0&&(r+=this.prepend(D.getBytes(232),n));for(var u=0;u=0;r--)e.unshift(t[r]);return t.length},t.prototype.randomize253State=function(t){var e=129+(149*t%253+1);return e<=254?e:e-254},t.prototype.applyRandomPattern=function(t,e,r){for(var n=0;n0&&this.getCodewordsRemaining(this.cachedTotalSize+t)<=2-t)return o.ASCII}if(this.mode===o.C40||this.mode===o.TEXT||this.mode===o.X12){if(this.fromPosition+this.characterLength>=this.input.length()&&0===this.getCodewordsRemaining(this.cachedTotalSize))return o.ASCII;var t;if(1===(t=this.getLastASCII())&&0===this.getCodewordsRemaining(this.cachedTotalSize+1))return o.ASCII}return this.mode},t.prototype.getMode=function(){return this.mode},t.prototype.getLastASCII=function(){var t=this.input.length(),e=this.fromPosition+this.characterLength;return t-e>4||e>=t?0:t-e==1?R.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?0:1:t-e==2?R.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())||R.isExtendedASCII(this.input.charAt(e+1),this.input.getFNC1Character())?0:l.a.isDigit(this.input.charAt(e))&&l.a.isDigit(this.input.charAt(e+1))?1:2:t-e==3?l.a.isDigit(this.input.charAt(e))&&l.a.isDigit(this.input.charAt(e+1))&&!R.isExtendedASCII(this.input.charAt(e+2),this.input.getFNC1Character())||l.a.isDigit(this.input.charAt(e+1))&&l.a.isDigit(this.input.charAt(e+2))&&!R.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?2:0:l.a.isDigit(this.input.charAt(e))&&l.a.isDigit(this.input.charAt(e+1))&&l.a.isDigit(this.input.charAt(e+2))&&l.a.isDigit(this.input.charAt(e+3))?2:0},t.prototype.getMinSymbolSize=function(t){var e,r,n,o,i,a;switch(this.input.getShapeHint()){case 1:try{for(var s=S(this.squareCodewordCapacities),u=s.next();!u.done;u=s.next()){if((d=u.value)>=t)return d}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}break;case 2:try{for(var c=S(this.rectangularCodewordCapacities),f=c.next();!f.done;f=c.next()){if((d=f.value)>=t)return d}}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}try{for(var h=S(this.allCodewordCapacities),l=h.next();!l.done;l=h.next()){var d;if((d=l.value)>=t)return d}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}return this.allCodewordCapacities[this.allCodewordCapacities.length-1]},t.prototype.getCodewordsRemaining=function(t){return this.getMinSymbolSize(t)-t},t.getBytes=function(t,e){var r=new Uint8Array(e?2:1);return r[0]=t,e&&(r[1]=e),r},t.prototype.setC40Word=function(t,e,r,n,o){var i=1600*(255&r)+40*(255&n)+(255&o)+1;t[e]=i/256,t[e+1]=i%256},t.prototype.getX12Value=function(t){return 13===t?0:42===t?1:62===t?2:32===t?3:t>=48&&t<=57?t-44:t>=65&&t<=90?t-51:t},t.prototype.getX12Words=function(){if(this.characterLength%3!=0)throw new Error("X12 words must be a multiple of 3");for(var t=new Uint8Array(this.characterLength/3*2),e=0;e=33&&r<=47?r-33:r>=48&&r<=57?r-44:r>=58&&r<=64?r-43:r>=65&&r<=90?r-64:r>=91&&r<=95?r-69:96===r?0:r>=97&&r<=122?r-83:r>=123&&r<=127?r-96:r},t.prototype.getC40Words=function(t,e){for(var r=[],n=0;n>16&255,e[o+1]=s>>8&255,e[o+2]=255&s}return e},t.prototype.getLatchBytes=function(){switch(this.getPreviousMode()){case o.ASCII:case o.B256:switch(this.mode){case o.B256:return t.getBytes(231);case o.C40:return t.getBytes(230);case o.TEXT:return t.getBytes(239);case o.X12:return t.getBytes(238);case o.EDF:return t.getBytes(240)}break;case o.C40:case o.TEXT:case o.X12:if(this.mode!==this.getPreviousMode())switch(this.mode){case o.ASCII:return t.getBytes(254);case o.B256:return t.getBytes(254,231);case o.C40:return t.getBytes(254,230);case o.TEXT:return t.getBytes(254,239);case o.X12:return t.getBytes(254,238);case o.EDF:return t.getBytes(254,240)}break;case o.EDF:if(this.mode!==o.EDF)throw new Error("Cannot switch from EDF to "+this.mode)}return new Uint8Array(0)},t.prototype.getDataBytes=function(){switch(this.mode){case o.ASCII:return this.input.isECI(this.fromPosition)?t.getBytes(241,this.input.getECIValue(this.fromPosition)+1):R.isExtendedASCII(this.input.charAt(this.fromPosition),this.input.getFNC1Character())?t.getBytes(235,this.input.charAt(this.fromPosition)-127):2===this.characterLength?t.getBytes(10*this.input.charAt(this.fromPosition)+this.input.charAt(this.fromPosition+1)+130):this.input.isFNC1(this.fromPosition)?t.getBytes(232):t.getBytes(this.input.charAt(this.fromPosition)+1);case o.B256:return t.getBytes(this.input.charAt(this.fromPosition));case o.C40:return this.getC40Words(!0,this.input.getFNC1Character());case o.TEXT:return this.getC40Words(!1,this.input.getFNC1Character());case o.X12:return this.getX12Words();case o.EDF:return this.getEDFBytes()}},t}(),M=function(t){function e(e,r,n,o,i){var a=t.call(this,e,r,n)||this;return a.shape=o,a.macroId=i,a}return I(e,t),e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e}(A),P=r(63);r(110),r(109),function(){function t(){}t.prototype.encode=function(t,e,r,n,o){if(void 0===o&&(o=null),""===t.trim())throw new Error("Found empty contents");if(e!==i.a.DATA_MATRIX)throw new Error("Can only encode DATA_MATRIX, but got "+e);if(r<0||n<0)throw new Error("Requested dimensions can't be negative: "+r+"x"+n);var a,u=0,d=null,p=null;if(null!=o){var g=o.get(s.a.DATA_MATRIX_SHAPE);null!=g&&(u=g);var y=o.get(s.a.MIN_SIZE);null!=y&&(d=y);var w=o.get(s.a.MAX_SIZE);null!=w&&(p=w)}if(null!=o&&o.has(s.a.DATA_MATRIX_COMPACT)&&Boolean(o.get(s.a.DATA_MATRIX_COMPACT).toString())){var v=o.has(s.a.GS1_FORMAT)&&Boolean(o.get(s.a.GS1_FORMAT).toString()),m=null;o.has(s.a.CHARACTER_SET)&&(m=c.a.forName(o.get(s.a.CHARACTER_SET).toString())),a=R.encodeHighLevel(t,m,v?29:-1,u)}else{var C=null!=o&&o.has(s.a.FORCE_C40)&&Boolean(o.get(s.a.FORCE_C40).toString());a=l.a.encodeHighLevel(t,u,d,p,C)}var _=P.a.lookup(a.length,u,d,p,!0),A=h.a.encodeECC200(a,_),E=new f.a(A,_.getSymbolDataWidth(),_.getSymbolDataHeight());return E.place(),this.encodeLowLevel(E,_,r,n)},t.prototype.encodeLowLevel=function(t,e,r,n){for(var o=e.getSymbolDataWidth(),i=e.getSymbolDataHeight(),a=new u.a(e.getSymbolWidth(),e.getSymbolHeight()),s=0,c=0;c=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},A=function(t){function e(e,r){return t.call(this,e,r)||this}return C(e,t),e.prototype.selectMultipleBestPatterns=function(){var t=this.getPossibleCenters(),r=t.length;if(r<3)throw g.a.getNotFoundInstance();if(3===r)return[t];h.a.sort(t,new E);for(var n=[],o=0;oe.DIFF_MODSIZE_CUTOFF&&u>=e.DIFF_MODSIZE_CUTOFF_PERCENT)break;for(var c=a+1;ce.DIFF_MODSIZE_CUTOFF&&l>=e.DIFF_MODSIZE_CUTOFF_PERCENT)break;var d=[i,s,f];m.a.orderBestPatterns(d);var p=new v.a(d),y=m.a.distance(p.getTopLeft(),p.getBottomLeft()),w=m.a.distance(p.getTopRight(),p.getBottomLeft()),C=m.a.distance(p.getTopLeft(),p.getTopRight()),_=(y+C)/(2*i.getEstimatedModuleSize());if(!(_>e.MAX_MODULE_COUNT_PER_EDGE||_=.1)){var A=Math.sqrt(y*y+C*C);Math.abs((w-A)/Math.min(w,A))>=.1||n.push(d)}}}}}}if(n.length>0)return n;throw g.a.getNotFoundInstance()},e.prototype.findMulti=function(t){var r,n,o=null!=t&&t.has(p.a.TRY_HARDER),i=this.getImage(),a=i.getHeight(),s=i.getWidth(),u=Math.trunc(3*a/(4*e.MAX_MODULES));(u0?1:0},t}(),I=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),S=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},T=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.detectMulti=function(t){var r,n,o=this.getImage(),i=null==t?null:t.get(p.a.NEED_RESULT_POINT_CALLBACK),a=new A(o,i).findMulti(t);if(0===a.length)throw g.a.getNotFoundInstance();var u=[];try{for(var c=S(a),f=c.next();!f.done;f=c.next()){var h=f.value;try{u.push(this.processFinderPatternInfo(h))}catch(t){if(!(t instanceof s.a))throw t}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return 0===u.length?e.EMPTY_DETECTOR_RESULTS:u},e.EMPTY_DETECTOR_RESULTS=[],e}(y.a),b=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),O=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.decodeMultiple=function(t,e){return void 0===e&&(e=null),e?this.decodeMultipleImpl(t,e):this.decodeMultipleOverload1(t)},e.prototype.decodeMultipleOverload1=function(t){return this.decodeMultipleImpl(t,null)},e.prototype.decodeMultipleImpl=function(t,r){var n,a,f=[],h=new T(t.getBlackMatrix()).detectMulti(r);try{for(var l=O(h),d=l.next();!d.done;d=l.next()){var p=d.value;try{var g=this.getDecoder().decodeBitMatrix(p.getBits(),r),y=p.getPoints();g.getOther()instanceof i.a&&g.getOther().applyMirroredCorrection(y);var w=new u.a(g.getText(),g.getRawBytes(),y,o.a.QR_CODE),v=g.getByteSegments();null!=v&&w.putMetadata(c.a.BYTE_SEGMENTS,v);var m=g.getECLevel();null!=m&&w.putMetadata(c.a.ERROR_CORRECTION_LEVEL,m),g.hasStructuredAppend()&&(w.putMetadata(c.a.STRUCTURED_APPEND_SEQUENCE,g.getStructuredAppendSequenceNumber()),w.putMetadata(c.a.STRUCTURED_APPEND_PARITY,g.getStructuredAppendParity())),f.push(w)}catch(t){if(!(t instanceof s.a))throw t}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}return 0===f.length?e.EMPTY_RESULT_ARRAY:f=e.processStructuredAppend(f)},e.processStructuredAppend=function(t){var r,n,i,a,s,l,p=[],g=[];try{for(var y=O(t),w=y.next();!w.done;w=y.next()){var v=w.value;v.getResultMetadata().has(c.a.STRUCTURED_APPEND_SEQUENCE)?g.push(v):p.push(v)}}catch(t){r={error:t}}finally{try{w&&!w.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}if(0===g.length)return t;h.a.sort(g,new N);var m=new d.a,C=new f.a,_=new f.a;try{for(var A=O(g),E=A.next();!E.done;E=A.next()){var I=E.value;m.append(I.getText());var S=I.getRawBytes();C.writeBytesOffset(S,0,S.length);var T=I.getResultMetadata().get(c.a.BYTE_SEGMENTS);if(null!=T)try{for(var b=(s=void 0,O(T)),R=b.next();!R.done;R=b.next()){var D=R.value;_.writeBytesOffset(D,0,D.length)}}catch(t){s={error:t}}finally{try{R&&!R.done&&(l=b.return)&&l.call(b)}finally{if(s)throw s.error}}}}catch(t){i={error:t}}finally{try{E&&!E.done&&(a=A.return)&&a.call(A)}finally{if(i)throw i.error}}var M=new u.a(m.toString(),C.toByteArray(),e.NO_POINTS,o.a.QR_CODE);return _.size()>0&&M.putMetadata(c.a.BYTE_SEGMENTS,h.a.singletonList(_.toByteArray())),p.push(M),p},e.EMPTY_RESULT_ARRAY=[],e.NO_POINTS=new Array,e}(a.a),N=(e.a=R,function(){function t(){}return t.prototype.compare=function(t,e){var r=t.getResultMetadata().get(c.a.STRUCTURED_APPEND_SEQUENCE),n=e.getResultMetadata().get(c.a.STRUCTURED_APPEND_SEQUENCE);return l.a.compare(r,n)},t}())},function(t,e,r){const n=r(137);t.exports=n},function(t,e,r){"use strict";r.r(e),r.d(e,"qrScanner",(function(){return u}));var n=r(29);const o=Math.PI/180;class i extends n.LuminanceSource{static makeBufferFromCanvasImageData(t){const e=t.getContext("2d");if(!e)throw new Error("Couldn't get canvas context.");const r=e.getImageData(0,0,t.width,t.height);return i.toGrayscaleBuffer(r.data,t.width,t.height)}static toGrayscaleBuffer(t,e,r){const n=new Uint8ClampedArray(e*r);for(let e=0,r=0,o=t.length;e>10}n[r]=o}return n}constructor(t){super(t.width,t.height),this.canvas=t,this.buffer=i.makeBufferFromCanvasImageData(t),this.tempCanvasElement=null}getRow(t,e){if(t<0||t>=this.getHeight())throw new IllegalArgumentException("Requested row is outside the image: "+t);const r=this.getWidth(),n=t*r;return null===e?e=this.buffer.slice(n,n+r):(e.length0&&!t.paused&&t.readyState>2}static getMediaElement(t,e){const r=document.getElementById(t);if(!r)throw new n.ArgumentException("element with id '".concat(t,"' not found"));if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new n.ArgumentException("element with id '".concat(t,"' must be an ").concat(e," element"));return r}static createVideoElement(t){if(t instanceof HTMLVideoElement)return t;if("string"==typeof t)return s.getMediaElement(t,"video");if(!t&&"undefined"!=typeof document){const t=document.createElement("video");return t.width=200,t.height=200,t}throw new Error("Couldn't get videoElement from videoSource!")}static prepareImageElement(t){if(t instanceof HTMLImageElement)return t;if("string"==typeof t)return s.getMediaElement(t,"img");if(void 0===t){const t=document.createElement("img");return t.width=200,t.height=200,t}throw new Error("Couldn't get imageElement from imageSource!")}static prepareVideoElement(t){const e=s.createVideoElement(t);return e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e}static isImageLoaded(t){return!!t.complete&&0!==t.naturalWidth}static createBinaryBitmapFromCanvas(t){const e=new i(t),r=new n.HybridBinarizer(e);return new n.BinaryBitmap(r)}static drawImageOnCanvas(t,e){const{width:r,height:n}=t.canvas;let{width:o,height:i}=s.getMediaElementDimensions(e);t.drawImage(e,0,0,o,i,0,0,r,n)}static getMediaElementDimensions(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimensions!")}static createCaptureCanvas(t){if(!t)throw new n.ArgumentException("Cannot create a capture canvas without a media element.");if("undefined"==typeof document)throw new Error('The page "Document" is undefined, make sure you\'re running in a browser.');const e=document.createElement("canvas");let{width:r,height:o}=s.getMediaElementDimensions(t);return r*o<=2583552&&(r*=2,o*=2),e.style.width=r+"px",e.style.height=o+"px",e.width=r,e.height=o,e}static async tryPlayVideo(t){if(t&&t.ended)return console.error("Trying to play video that has ended."),!1;if(s.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),!0;try{return await t.play(),!0}catch(t){return console.warn("It was not possible to play the video.",t),!1}}static createCanvasFromMediaElement(t){const e=s.createCaptureCanvas(t),r=e.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return s.drawImageOnCanvas(r,t),e}static createBinaryBitmapFromMediaElem(t){const e=s.createCanvasFromMediaElement(t);return s.createBinaryBitmapFromCanvas(e)}static destroyImageElement(t){t.src="",t.removeAttribute("src"),t=void 0}static cleanVideoSource(t){if(t){try{t.srcObject=null}catch(e){t.src=""}t&&t.removeAttribute("src")}}static async playVideoOnLoadAsync(t,e){return!!await s.tryPlayVideo(t)||new Promise((r,n)=>{const o=setTimeout(()=>{s.isVideoPlaying(t)||(n(!1),t.removeEventListener("canplay",i))},e),i=()=>{s.tryPlayVideo(t).then(e=>{clearTimeout(o),t.removeEventListener("canplay",i),r(e)})};t.addEventListener("canplay",i)})}static async attachStreamToVideo(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;const n=s.prepareVideoElement(e);return s.addVideoSource(n,t),await s.playVideoOnLoadAsync(n,r),n}static _waitImageLoad(t){return new Promise((e,r)=>{const n=setTimeout(()=>{s.isImageLoaded(t)||(t.removeEventListener("load",o),r())},1e4),o=()=>{clearTimeout(n),t.removeEventListener("load",o),e()};t.addEventListener("load",o)})}static checkCallbackFnOrThrow(t){if(!t)throw new n.ArgumentException("`callbackFn` is a required parameter, you cannot capture results without it.")}static disposeMediaStream(t){t.getVideoTracks().forEach(t=>t.stop()),t=void 0}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.reader=new n.QRCodeMultiReader,this.hints=new Map,this.hints.set(n.DecodeHintType.TRY_HARDER,!0),this.options={...a,...t}}decode(t){const e=s.createCanvasFromMediaElement(t);return this.decodeFromCanvas(e)}decodeBitmap(t){return this.reader.decodeMultiple(t,this.hints)}decodeFromCanvas(t){const e=s.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(e)}async decodeFromImageElement(t){if(!t)throw new n.ArgumentException("An image element must be provided.");const e=s.prepareImageElement(t);return await this._decodeOnLoadImage(e)}async decodeFromImageUrl(t){if(!t)throw new n.ArgumentException("An URL must be provided.");const e=s.prepareImageElement();e.src=t;try{return await this.decodeFromImageElement(e)}finally{s.destroyImageElement(e)}}async decodeFromStream(t,e,r){s.checkCallbackFnOrThrow(r);const n=this.options.tryPlayVideoTimeout,o=await s.attachStreamToVideo(t,e,n),i=this.scan(o,r,()=>{s.disposeMediaStream(t),s.cleanVideoSource(o)}),a=t.getVideoTracks(),u={...i,stop(){i.stop()},async streamVideoConstraintsApply(t,e){const r=e?a.filter(e):a;for(const e of r)await e.applyConstraints(t)},streamVideoConstraintsGet:t=>a.find(t).getConstraints(),streamVideoSettingsGet:t=>a.find(t).getSettings(),streamVideoCapabilitiesGet:t=>a.find(t).getCapabilities()};if(s.mediaStreamIsTorchCompatible(t)){const t=a&&a.find(t=>s.mediaStreamIsTorchCompatibleTrack(t)),e=async e=>{await s.mediaStreamSetTorch(t,e)};u.switchTorch=e;const r=()=>{i.stop(),e(!1)};u.stop=r}return u}async decodeFromVideoElement(t,e){if(s.checkCallbackFnOrThrow(e),!t)throw new n.ArgumentException("A video element must be provided.");const r=s.prepareVideoElement(t),o=this.options.tryPlayVideoTimeout;return await s.playVideoOnLoadAsync(r,o),this.scan(r,e)}async decodeFromVideoUrl(t,e){if(s.checkCallbackFnOrThrow(e),!t)throw new n.ArgumentException("An URL must be provided.");const r=s.prepareVideoElement();r.src=t;const o=this.options.tryPlayVideoTimeout;await s.playVideoOnLoadAsync(r,o);return this.scan(r,e,()=>{s.cleanVideoSource(r)})}async decodeOnceFromVideoElement(t){if(!t)throw new n.ArgumentException("A video element must be provided.");const e=s.prepareVideoElement(t),r=this.options.tryPlayVideoTimeout;return await s.playVideoOnLoadAsync(e,r),await this.scanOneResult(e)}async decodeOnceFromVideoUrl(t){if(!t)throw new n.ArgumentException("An URL must be provided.");const e=s.prepareVideoElement();e.src=t;const r=this.decodeOnceFromVideoElement(e);try{return await r}finally{s.cleanVideoSource(e)}}scanOneResult(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return new Promise((i,a)=>{this.scan(t,(t,s,u)=>{if(t)return i(t),void u.stop();if(s){if(s instanceof n.NotFoundException&&e)return;if(s instanceof n.ChecksumException&&r)return;if(s instanceof n.FormatException&&o)return;u.stop(),a(s)}})})}scan(t,e,r){s.checkCallbackFnOrThrow(e);let o=s.createCaptureCanvas(t),i=o.getContext("2d");if(!i)throw new Error("Couldn't create canvas for visual element scan.");const a=()=>{i=void 0,o=void 0};let u,c=!1;const f={stop:()=>{c=!0,clearTimeout(u),a(),r&&r()}},h=()=>{if(!c)try{s.drawImageOnCanvas(i,t);const r=this.decodeFromCanvas(o);e(r,void 0,f),u=setTimeout(h,this.options.delayBetweenScanSuccess)}catch(t){e(void 0,t,f);const o=t instanceof n.ChecksumException,i=t instanceof n.FormatException,s=t instanceof n.NotFoundException;if(o||i||s)return void(u=setTimeout(h,this.options.delayBetweenScanAttempts));a(),r&&r(t)}};return h(),f}async _decodeOnLoadImage(t){return s.isImageLoaded(t)||await s._waitImageLoad(t),this.decode(t)}}const u=new class{constructor(){this.codeReader=new s,this.task=null,this.qrCodeList=[],this.timer=null,this.TIMEOUT_DURATION=6e4}clearScanTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}setScanTimer(t){this.clearScanTimer(),this.timer=setTimeout(()=>{this.stop(),t&&t()},this.TIMEOUT_DURATION)}start(t,e,r){this.stop(),this.codeReader.decodeFromVideoElement(t,(t,r)=>{if(r)return;const n=t.map(t=>t.text).filter(t=>!this.qrCodeList.includes(t));n.length>0&&(this.qrCodeList.push(...n),e&&e(n))}).then(t=>{this.stop(),this.setScanTimer(r),this.task=t})}stop(){this.clearScanTimer(),this.task&&(this.task.stop(),this.task=null,this.qrCodeList=[])}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])})); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/qrscanner.min.js-c7ac9cf8bb345e4696bb.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/sharing_m.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_m.min.js new file mode 100644 index 0000000..f8926eb --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_m.min.js @@ -0,0 +1,50 @@ +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=57)}([function(e,t,r){var i=r(37),n=r(32);e.exports=function(e,t){var r=n(e,t,"get");return i(e,r)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(38),n=r(32);e.exports=function(e,t,r){var s=n(e,t,"set");return i(e,s,r),r},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"C",(function(){return i})),r.d(t,"j",(function(){return n})),r.d(t,"t",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"v",(function(){return o})),r.d(t,"x",(function(){return h})),r.d(t,"p",(function(){return u})),r.d(t,"s",(function(){return l})),r.d(t,"q",(function(){return c})),r.d(t,"r",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"w",(function(){return g})),r.d(t,"g",(function(){return m})),r.d(t,"y",(function(){return _})),r.d(t,"z",(function(){return v})),r.d(t,"A",(function(){return b})),r.d(t,"B",(function(){return w})),r.d(t,"e",(function(){return y})),r.d(t,"d",(function(){return x})),r.d(t,"c",(function(){return T})),r.d(t,"f",(function(){return R})),r.d(t,"n",(function(){return E})),r.d(t,"o",(function(){return S})),r.d(t,"m",(function(){return A})),r.d(t,"l",(function(){return k})),r.d(t,"h",(function(){return M})),r.d(t,"u",(function(){return C})),r.d(t,"i",(function(){return P}));const i={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},n={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},s={AVAILABLE:0,VIDEO:1,SHARE:2},a={IDLE:0,PENDING:1,READY:2,RENDERING:3},o={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},h={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},u=0,l=1,c=2,d=3,f=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],p=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},m=["intel","nvidia","apple","amd","qualcomm","arm"],_="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n struct FsUniforms {\n rotation: f32,\n };\n\n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n\n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n",v="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(6) var vertexUniforms: FsUniforms;\n\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n\n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var vPlaneTex: texture_2d;\n @group(0) @binding(5) var uniforms: FsUniforms;\n // @group(0) @binding(7) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n return color;\n }\n",b="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(5) var vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var uniforms: FsUniforms;\n // @group(0) @binding(5) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n\n return color;\n }\n",w="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n",y="\n\n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n\n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d;\n @group(0) @binding(2) var uniforms: FsUniforms;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n\n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n\n return color;\n }\n",x="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4 {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n",T="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n\n struct ClearColorUniforms {\n clearColor: vec4,\n };\n\n @group(0) @binding(0) var uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4 {\n return uniforms.clearColor;\n }\n",R={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},E={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},S={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},A=[60,120,180,360,540,720,1080,2160],k={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},M=6,C=[180,360,540,720,1080,2160],P=5},function(e,t,r){"use strict";var i=r(5),n=r(16);new Error;const s=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,h=null;function u(e,t){var r,i;if(!function(e){const t=performance.now();return(!s.has(e)||t-s.get(e)>5e3)&&(s.set(e,t),!0)}(e))return;let u;try{u=a("object"==typeof t?JSON.stringify(t):t)}catch(e){u=a(t)}null===(r=h)||void 0===r||r("NEM-".concat(e,"-").concat(u)),n.a.error("NotifyUIError,event=".concat(e,",data=").concat(u)),null===(i=o)||void 0===i||i(e,t)}var l=r(15);function c(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function p(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function g(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const r=await new Promise((e,t)=>{const r=i=>{let n=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===n.command?(y("DE"),self.removeEventListener("message",r),e(n.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===n.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),y("DS"),postMessage({status:i.E,url:wasmUrl})});let n=await WebAssembly.instantiate(r,e);n.instance?(self.wasmModuleToShare=n.module,t(n.instance)):(self.wasmModuleToShare=r,t(n))}catch(e){y("IF"),b("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}r.d(t,"d",(function(){return c})),r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"c",(function(){return g})),r.d(t,"q",(function(){return m})),r.d(t,"i",(function(){return v})),r.d(t,"u",(function(){return b})),r.d(t,"t",(function(){return w})),r.d(t,"o",(function(){return y})),r.d(t,"n",(function(){return x})),r.d(t,"v",(function(){return T})),r.d(t,"w",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"s",(function(){return A})),r.d(t,"k",(function(){return k})),r.d(t,"m",(function(){return M})),r.d(t,"r",(function(){return L})),r.d(t,"l",(function(){return I})),r.d(t,"x",(function(){return W})),r.d(t,"b",(function(){return N})),r.d(t,"h",(function(){return F})),r.d(t,"y",(function(){return V})),r.d(t,"a",(function(){return z})),r.d(t,"j",(function(){return H}));const _="function"!=typeof importScripts;function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_?n.a.error(e,t):b(e,t)}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var r,n,s,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(r=t)||void 0===r?void 0:r.message)+" Stack: "+(null!==(n=null===(s=t)||void 0===s||null===(s=s.error)||void 0===s?void 0:s.stack)&&void 0!==n?n:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:i.G,errorMessage:e,errorEvent:t})}function w(e){postMessage({status:i.G,errorMessage:e,level:"low"})}function y(e){postMessage({status:i.zb,data:e})}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:i.f,data:e});postMessage({status:i.f,data:e})}function T(e){postMessage({status:i.M,canvasId:e,replaceCanvas:!1})}function R(e){postMessage({status:i.N,canvasId:e})}function E(e){_?u(l.k,e):postMessage({status:i.Bb,where:e})}function S(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function A(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(r){t=null==e?void 0:e.getContext("2d")}return t||b("get2DContextFromCanvas return null"),t}class k{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let r=0;r0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new S;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class M{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),i=r>e?r:e;if(i+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(i)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){b("Error in YuvWrap.recycle: ".concat(e))}}}function C(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function P(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const U=["","MOZ_","OP_","WEBKIT_"];function L(e,t){for(var r=0;r0&&(t+="&index="+e);let r={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:C,onclose:P,group:this,index:e},i=new O(r);await i.connect(),this.transportArray[e]=i}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const D=new Map,B=[90,180,360,720,1080],G=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,r)=>{const i=this.ssrcInfoMap.get(r);i&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))})}_notifyFPS(e,t){postMessage({status:i.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function W(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:n,r_h:s,rotation:a,ssrc:o}=e;let h=1==a||3==a,u=h?s:n,l=h?n:s;const c=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!D.get(c)||D.get(c).width!==u||D.get(c).height!==l){const e={width:u,height:l,ssrc:c,quality:f};D.set(c,e),r?r(e):postMessage({status:i.v,data:e})}t&&G.updateSSRCInfo(c,Date.now())}function N(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function F(e,t,r,i,n){if(!n&&!i||1==e)return!1;let s=i&&t>=640,a=n&&t>=1280;return 2!=e||640==t&&480==r?s||a:((s||a)&&v("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}function V(e,t){e?e.send(t):b("websocket is null",new Error("message type ".concat(t[0])))}function z(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function H(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,r){"use strict";r.d(t,"y",(function(){return i})),r.d(t,"Y",(function(){return n})),r.d(t,"L",(function(){return s})),r.d(t,"K",(function(){return a})),r.d(t,"J",(function(){return o})),r.d(t,"v",(function(){return h})),r.d(t,"q",(function(){return u})),r.d(t,"r",(function(){return l})),r.d(t,"w",(function(){return c})),r.d(t,"x",(function(){return d})),r.d(t,"u",(function(){return f})),r.d(t,"X",(function(){return p})),r.d(t,"P",(function(){return g})),r.d(t,"Q",(function(){return m})),r.d(t,"O",(function(){return _})),r.d(t,"M",(function(){return v})),r.d(t,"s",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"n",(function(){return y})),r.d(t,"l",(function(){return x})),r.d(t,"m",(function(){return T})),r.d(t,"db",(function(){return R})),r.d(t,"B",(function(){return E})),r.d(t,"C",(function(){return S})),r.d(t,"W",(function(){return A})),r.d(t,"ab",(function(){return k})),r.d(t,"V",(function(){return M})),r.d(t,"Z",(function(){return C})),r.d(t,"N",(function(){return P})),r.d(t,"h",(function(){return U})),r.d(t,"g",(function(){return L})),r.d(t,"f",(function(){return I})),r.d(t,"A",(function(){return O})),r.d(t,"z",(function(){return D})),r.d(t,"S",(function(){return B})),r.d(t,"R",(function(){return G})),r.d(t,"e",(function(){return W})),r.d(t,"o",(function(){return N})),r.d(t,"T",(function(){return F})),r.d(t,"U",(function(){return V})),r.d(t,"G",(function(){return z})),r.d(t,"E",(function(){return H})),r.d(t,"H",(function(){return j})),r.d(t,"I",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"bb",(function(){return q})),r.d(t,"c",(function(){return K})),r.d(t,"b",(function(){return Q})),r.d(t,"cb",(function(){return Z})),r.d(t,"d",(function(){return J})),r.d(t,"t",(function(){return $})),r.d(t,"D",(function(){return ee})),r.d(t,"p",(function(){return te})),r.d(t,"a",(function(){return re})),r.d(t,"j",(function(){return ie})),r.d(t,"i",(function(){return ne}));const i=1e3,n=5,s=43,a=44,o=45,h=0,u=1,l=146,c=2,d=7,f=9,p=17,g=10,m=11,_=12,v=102,b=107,w=0,y=1,x=2,T=3,R=65,E=0,S=1,A=-1,k=0,M=1,C=2,P=3,U=1,L=2,I=3,O={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},D={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,G=20,W=15,N=10,F=8294400,V=5,z=0,H=1,j=2,Y=15,X=5,q=400,K=7,Q=8,Z={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,re=1,ie=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),ne={PAUSE:0,RESUME:1,STOP:2}},function(e,t,r){"use strict";r.d(t,"j",(function(){return i})),r.d(t,"h",(function(){return n})),r.d(t,"l",(function(){return s})),r.d(t,"sb",(function(){return a})),r.d(t,"qb",(function(){return o})),r.d(t,"ub",(function(){return h})),r.d(t,"Z",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"bb",(function(){return c})),r.d(t,"db",(function(){return d})),r.d(t,"D",(function(){return f})),r.d(t,"ob",(function(){return p})),r.d(t,"H",(function(){return g})),r.d(t,"Eb",(function(){return m})),r.d(t,"n",(function(){return _})),r.d(t,"vb",(function(){return v})),r.d(t,"E",(function(){return b})),r.d(t,"b",(function(){return w})),r.d(t,"zb",(function(){return y})),r.d(t,"S",(function(){return x})),r.d(t,"I",(function(){return T})),r.d(t,"T",(function(){return R})),r.d(t,"xb",(function(){return E})),r.d(t,"f",(function(){return S})),r.d(t,"nb",(function(){return A})),r.d(t,"mb",(function(){return k})),r.d(t,"eb",(function(){return M})),r.d(t,"X",(function(){return C})),r.d(t,"V",(function(){return P})),r.d(t,"a",(function(){return U})),r.d(t,"z",(function(){return L})),r.d(t,"Fb",(function(){return I})),r.d(t,"G",(function(){return O})),r.d(t,"wb",(function(){return D})),r.d(t,"v",(function(){return B})),r.d(t,"u",(function(){return G})),r.d(t,"t",(function(){return W})),r.d(t,"w",(function(){return N})),r.d(t,"U",(function(){return F})),r.d(t,"jb",(function(){return V})),r.d(t,"kb",(function(){return z})),r.d(t,"R",(function(){return H})),r.d(t,"hb",(function(){return j})),r.d(t,"ib",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"r",(function(){return q})),r.d(t,"q",(function(){return K})),r.d(t,"y",(function(){return Q})),r.d(t,"p",(function(){return Z})),r.d(t,"x",(function(){return J})),r.d(t,"Cb",(function(){return $})),r.d(t,"O",(function(){return ee})),r.d(t,"P",(function(){return te})),r.d(t,"Ab",(function(){return re})),r.d(t,"C",(function(){return ie})),r.d(t,"B",(function(){return ne})),r.d(t,"A",(function(){return se})),r.d(t,"K",(function(){return ae})),r.d(t,"J",(function(){return oe})),r.d(t,"L",(function(){return he})),r.d(t,"o",(function(){return ue})),r.d(t,"s",(function(){return le})),r.d(t,"gb",(function(){return ce})),r.d(t,"fb",(function(){return de})),r.d(t,"Db",(function(){return fe})),r.d(t,"Q",(function(){return pe})),r.d(t,"i",(function(){return ge})),r.d(t,"g",(function(){return me})),r.d(t,"k",(function(){return _e})),r.d(t,"m",(function(){return ve})),r.d(t,"rb",(function(){return be})),r.d(t,"pb",(function(){return we})),r.d(t,"tb",(function(){return ye})),r.d(t,"Y",(function(){return xe})),r.d(t,"cb",(function(){return Te})),r.d(t,"ab",(function(){return Re})),r.d(t,"c",(function(){return Ee})),r.d(t,"M",(function(){return Se})),r.d(t,"Bb",(function(){return Ae})),r.d(t,"N",(function(){return ke})),r.d(t,"yb",(function(){return Me})),r.d(t,"W",(function(){return Ce})),r.d(t,"lb",(function(){return Pe})),r.d(t,"e",(function(){return Ue}));const i=1,n=2,s=3,a=7,o=8,h=9,u=12,l=14,c=15,d=16,f=18,p=20,g=21,m=24,_=26,v=27,b=30,w=31,y=35,x=36,T=37,R=38,E=47,S=48,A=50,k=51,M=52,C=53,P=54,U=56,L=57,I=60,O=61,D=62,B=66.5,G=66.6,W=67,N=68,F=69,V=71,z=72,H=73,j=75,Y=76,X=78,q=105,K=106,Q=107,Z=108,J=109,$=120,ee=121,te=122,re=123,ie=124,ne=125,se=126,ae=127,oe=128,he=129,ue=132,le=133,ce=135,de=136,fe=137,pe=151,ge=-1,me=-2,_e=-3,ve=-5,be=-7,we=-8,ye=-9,xe=-12,Te=-14,Re=-15,Ee=-23,Se=-26,Ae=-27,ke=-28,Me=-35,Ce=-129,Pe=-130,Ue=-131},function(e,t,r){"use strict";r.d(t,"e",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"d",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"c",(function(){return g}));var i=r(7),n=r.n(i),s=r(14),a=r(17),o=r(5),h=r(10),u=r(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},c=e=>{0};class d{constructor(){this.onmessage=c,this.status=d.CLOSED,this.onopen=c,this.onclose=c,this.onwer=null}send(e){}delete(){this.onmessage=c,this.onopen=c,this.onclose=c,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}n()(d,"OPEN",1),n()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(c),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=c),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(r,0);break;case o.L:this.status=r,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:r,interval:i}=e||{};r?i?(this.sender=e=>{r.enqueue(e)},this.wasmSender=e=>{r.enqueue(e)},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}}):(this.sender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),this.port.postMessage({cmd:o.K,data:r},[r.buffer])});let{sabqueue:n,consumer:h,useCopy:u,interval:l,offset:c}=t||{};if(h&&(h.cancelConsume(),h=null),n){const e=u?e=>{this.onmessage(e,0)}:c?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=p.dataTransportMgr.monitorlogfn;if(l&&i){var d;let e=new s.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});r=e.timeoutReport.bind(e)}h=new a.a(n,e,r),t.consumer=h,l?h.consume(l,u):this.reciver=()=>{h.consumeAll(u)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=c,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:r,interval:i,offset:n,length:s,useOneElement:o}=e,h=new a.b(n>0?t.buffer:t,void 0,void 0,!!o,n,s,n>0?t:null);this.sab.sender={sabqueue:h,interval:i,useCopy:r,offset:n}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:n,offset:s,length:o,useOneElement:h}=t,u=new a.b(s>0?e.buffer:e,void 0,void 0,!!h,s,o,s>0?e:null),{consumer:l}=(null===(r=this.sab)||void 0===r?void 0:r.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:u,interval:n,useCopy:i,offset:s}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(e){this.onmessage=c,this.onopen=c,this.onclose=c,this.connect_type=e.connect_type||p.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=h.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=p.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=p.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}n()(p,"UDP",0),n()(p,"TCP",1),n()(p,"RLB_UDP",2),n()(p,"dataTransportMgr",null);class g{constructor(e){this.sock=null,this.onmessage=c}isReady(){return!1}send(){c()}setStatus(e){0}}function m(e,t,r,i){var n;null===(n=u.a.monitorlogfn)||void 0===n||n.call(u.a,e,"".concat(t,",").concat(r,",").concat(i))}},function(e,t,r){var i=r(34);e.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"p",(function(){return i})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return h})),r.d(t,"k",(function(){return u})),r.d(t,"q",(function(){return l})),r.d(t,"r",(function(){return c})),r.d(t,"s",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"n",(function(){return p})),r.d(t,"e",(function(){return g})),r.d(t,"m",(function(){return m})),r.d(t,"o",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"h",(function(){return b})),r.d(t,"a",(function(){return w})),r.d(t,"f",(function(){return y}));const i=1,n=2,s=3,a=4,o=5,h=6,u=7,l=8,c=9,d=10,f=11,p=129,g=130,m=131,_=132,v=133,b=134,w=135,y=136},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return a})),r.d(t,"g",(function(){return o})),r.d(t,"f",(function(){return h})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c})),r.d(t,"c",(function(){return d}));var i=r(3),n=r(2);function s(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function a(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}function o(e,t,r){if(!e||t<0||r<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(r));let n=!1,s=0;const a=e.acquireGPUFeaturesHelper();return a&&(s=a.queryMaxTextureDimension2D(),s>0&&(n=t>s||r>s)),n&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s)),Object(i.o)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s))),n}function h(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let r=!1,n=0;const s=e.acquireGPUFeaturesHelper();return s&&(n=s.queryMaxBufferSize(),n>0&&(r=t>n)),r&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n)),Object(i.o)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n))),r}function u(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===n.s||t===n.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function l(e,t){let r=0,i=0,n=0,s=0;const a=t.width/t.height;return e.width/e.height>a?(i=e.height,r=i*a,n=(e.width-r)/2,s=0):(r=e.width,i=r/a,n=0,s=(e.height-i)/2),r<=e.canvas.width&&(n=(e.canvas.width-r)/2),i<=e.canvas.height&&(s=(e.canvas.height-i)/2),{x:n,y:s,width:r,height:i}}function c(e,t,r,i){if(!e||!t||!r)return null;const s=t.width/t.height;let a=t.width,o=t.height;if(t.width>e.width||t.height>e.height){const r=e.width/t.width,i=e.height/t.height,n=Math.min(r,i);a*=n,o*=n}let h=0,u=0;e.width/e.height>s?(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a,h>e.width&&(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o)):(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o,u>e.height&&(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a));let l=0,c=0,d=0,f=0;i==n.p?(l=1-(l+(o-1)/e.height),c=t.left/e.width,f=1-t.top/e.height,d=c+a/e.width):i==n.s?(c=1-(l+(o-1)/e.height),d=1-t.top/e.height,l=t.left/e.width,f=c+a/e.width):i==n.q?(l=t.top/e.height,c=t.left/e.width,f=l+(o-1)/e.height,d=c+a/e.width):i==n.r&&(c=t.top/e.height,d=l+(o-1)/e.height,l=t.left/e.width,f=c+a/e.width);let p=[],g=[{x:d,y:f},{x:d,y:l},{x:c,y:l},{x:d,y:f},{x:c,y:f},{x:c,y:l}];for(let e=0;ee){const t=i.height*e;u=a/r.height,l=(Math.round((i.width-t)/2)+s)/r.width,d=u+(i.height-1)/r.height,c=l+t/r.width}else{const t=i.width/e;u=(Math.round((i.height-t)/2)+a)/r.height,l=s/r.width,d=u+(t-1)/r.height,c=l+i.width/r.width}o==n.p?(u=1-(u+(i.height-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+i.width/r.width):o==n.s?(l=1-(u+(i.height-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+i.width/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(i.height-1)/r.height,c=l+i.width/r.width):o==n.r&&(l=i.top/r.height,c=u+(i.height-1)/r.height,u=i.left/r.width,d=l+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,h=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,n=r.height/i.height,s=Math.min(e,n);t*=s,h*=s}let f=0,p=0;r.width/r.height>e?(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t,f>r.width&&(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h)):(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h,p>r.height&&(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t)),o==n.p?(u=1-(u+(h-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+t/r.width,i.height>i.width&&(l=a(l,2),c=s(c,2))):o==n.s?(l=1-(u+(h-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+t/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(h-1)/r.height,c=l+t/r.width):o==n.r&&(l=i.top/r.height,c=u+(h-1)/r.height,u=i.left/r.width,d=l+t/r.width)}let f=[],p=[{x:c,y:d},{x:c,y:u},{x:l,y:u},{x:c,y:d},{x:l,y:d},{x:l,y:u}];for(let e=0;e{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(r=>{r(e,t,1)}))}removeTransport(e){var t;let r=e.id;r in this.transportMap&&(delete this.transportMap[r],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let r=this.transportMap[t],i=r.target_thread==a.SELF_THREAD;if(r.type==e&&i)return r}return null}}n()(a,"NO_THREAD",0),n()(a,"SELF_THREAD",1)},function(e,t,r){"use strict";function i(){this.a=[],this.b=0,this.residue=null}i.prototype.getLength=function(){return this.a.length-this.b},i.prototype.isEmpty=function(){return 0==this.a.length},i.prototype.enqueue=function(e){this.a.push(e)},i.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},i.prototype.peek=function(){return 0{const e={};for(const t in n)e[n[t]]="WCL_"+t})(),{[n.AUDIO_ENCODE]:"audio.encode",[n.AUDIO_DECODE]:"audio.decode",[n.VIDEO_ENCODE]:"video.encode",[n.VIDEO_DECODE]:"video.decode",[n.SHARING_ENCODE]:"share.encode",[n.SHARING_DECODE]:"share.decode"})},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l}));var i=r(7),n=r.n(i),s=r(5),a=r(10),o=r(6),h=r(22);function u(e,t,r){if(!e)return;let i=o.a.dataTransportMgr;i.type===l.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,n=this.transportlists.find(e=>e.id===r);if(n||t==s.s)switch(t){case s.s:this.addRemoteTransport(e.data,null);break;case s.fb:n.setMsgPort(i||new a.a);break;case s.gb:n.setSabBuffer(e.data.sender,e.data.reciver);break;case s.o:n.remote=null,this.removeTransport(n)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i,transportType:n}=t.data,a=this.transportlists.find(e=>e.id===i);switch(r){case s.s:this.addRemoteTransport(t.data,e);break;case s.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case s.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let r={cmd:s.s,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransport(e,t){t.postMessage({cmd:s.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var r,i,n,a;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:s.gb,transportId:e.id,sender:null===(n=e.sabInfo)||void 0===n?void 0:n.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:n}=e;let s=this.createMsgSocketTransport(n);s.id=r,s.remote=t,s.portInfo=i,i?s.setMsgPort(s.portInfo):this.bindMessageChannel(s),this.addTransport(s)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let r=t.target_thread||a.b.SELF_THREAD;e.target_thread=r,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,r){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),r&&(r.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:r},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,r))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof h.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof h.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let r=0;r{if(!e.transportlists.includes(t.type))return;let r=e.target_thread||a.b.SELF_THREAD;r==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=r&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=r,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let r=e.target_thread;if(r!=a.b.SELF_THREAD)this.createRemoteTransport(e,r),this.setRemoteTransportSABBUffer(e,r);else{var i,n,s,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(n=e.sabInfo)&&void 0!==n&&n.reciver)e.setSabBuffer(null===(s=e.sabInfo)||void 0===s?void 0:s.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{r._report(),r._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let r="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,r)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,r){"use strict";r.d(t,"c",(function(){return i})),r.d(t,"f",(function(){return n})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"k",(function(){return o})),r.d(t,"g",(function(){return h})),r.d(t,"h",(function(){return u})),r.d(t,"b",(function(){return l})),r.d(t,"j",(function(){return c})),r.d(t,"i",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"d",(function(){return p}));const i=3,n=6,s=34,a=38,o=-51,h="SHARING_PARAM_INFO_FROM_SOCKET",u=121,l="AUDIO_QOS_DATA",c="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},p="EXPOSE_VB_FRAME"},function(e,t,r){"use strict";const i=e=>0==(e&e-1);let n=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(r+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(r+=" Message: ".concat(t.message)),t.error&&(r+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(r+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(r+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+=" Stack: ".concat(t.stack)),t.name&&(r+=" Name: ".concat(t.name)),t.constraint&&(r+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(r+=" Code: ".concat(t.code)),t.reason&&(r+=" Reason: ".concat(t.reason)),r+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(r+=" Message: ".concat(t.message)),t.name&&(r+=" Name: ".concat(t.name))):r+=t?t.toString():"",r}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const r=i(this._highFrequencyLogs[e]);this._instance&&r&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var r,i;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(r=(i=this._instance).directReport)||void 0===r||r.call(i,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=n},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o}));var i=r(11),n=r(16);class s{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=n,this._BYTES_PER_ELEMENT=t,this.capacity=(s-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,n,1),this.read_ptr=new Uint32Array(this.buf,n+4,1),this.storageUint8sByteOffset=n+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,s-8),this.byteLength=s,this.label=r,this.usingOneElementBuffer=i,a&&(this.wasmMemory=a),i&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new i.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let s=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==s)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++s}if(s>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),s>=1e3&&(n.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),r&&r("vqslclear")),s>0&&r){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,r&&r("vqsl"+s))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let r=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+r),r+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=r;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let r,i,n,s=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,s[0]):new Uint8Array(s[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r.byteLength);r.set(e,0)}else r=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+s[0]),i=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n=t*this._BYTES_PER_ELEMENT+8+4+s[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:i,end:n}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof s))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=r,this.tick_lasted_time=0,this.timeoutMS=i,this.maxCount=n}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),r={};this.keysList.forEach((t,i)=>{r[t]=e[i]}),r[this.timeStampKey]=Number(t.getBigUint64(0,!0));let i,n=Number(t.getBigUint64(8,!0)),s=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,n);return i=(this.bCopyData,s),r.data=i,r}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,r=new Uint32Array(e.buffer,0,9),i=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{r[t]=this.obj[e]}),i.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),i.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},function(e,t,r){"use strict";var i,n,s,a,o,h;function u(){}function l(e){let t=new Uint8Array(e.data);t.length<4||n&&a(t,n,s)}function c(e){}function d(e){}function f(e,t,r){n&&a(e,n,t,r)}function p(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(o=i,h=s,e){r.meetingNumber=r.meetingNumber+"",r.meetingId=r.meetingId+"",n=a?e(r.userId,r.meetingNumber,r.meetingId,0,0,!1,0,!0):e(r.userId,r.meetingNumber,r.meetingId,0,0,0,!1,!1,!0);let i=o(r.encryptKey);return t(n,i,r.encryptKey.length,r.encryptType),h(i),n}return 0}function g(e,t,r,n){i=e(t,u,l,c,d),a=r,s=n}function m(e,t){if(n&&t.body){if(t.body.add){let r=0,i=t.body.add;for(;r7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;if(null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost())this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGLRestoreTimeout")},1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext()}catch(e){Object(n.i)("webgl restoreContext exception",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webglcanvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl","experimental-webgl","moz-webgl","webkit-3d"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(i));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,i),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a),this.shaderProgram=a},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(4),n=r(3),s=r(9),a=r(19);let o=new Map,h=[];function u(e){e.preventDefault()}function l(e,t,r,n,s,a,o){let h=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGL2RestoreTimeout")},1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){Object(n.i)("webgl restoreContext exception2",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost2 event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webgl2canvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL2=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl2"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && \n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask* mask.a+ c*(1.0-mask.a);\n }\n }\n\n if (waterMarkFlag!=1) {\n c.a = 1.0;\n }\n\n outputColor = c;\n }\n "),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(r));var i=e.createProgram();e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(7),n=r.n(i),s=r(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new s.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,r,i){if(this._customer_callback){let n="".concat(e,",").concat(t,",").concat(r,",").concat(i);this._customer_callback(this._tag+"TimeOut",n)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),r="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),r=r.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",r)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(s.c.IsQosReport(e))return void this._cureen_qos_report++;if(s.c.IsVideoPkg(e)){let t=s.c.GetQOSTime(e),r=performance.now();if(this._lasted_qos_ts){let e=r-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,r)}this._lasted_qos_ts=t,this._lasted_sys_ts=r,this._lasted_data=e}}};var o=r(8),h=r(12),u=r(5);r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return c}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class c{constructor(e,t,r,i){this.id=e,this.type=t,this.datachannel=r,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=c.UNINIT,this.target_thread=i,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===c.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=c.DISCONNECT&&this._clear(),this._status=c.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==c.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var r;(this._status=c.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==h.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==h.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=c.CONNECTED)&&(null===(r=this.connectedFn)||void 0===r||r.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=c.DISCONNECT;let r=this.disconnectedFn;this._clear(),t!=c.DISCONNECT&&(null==r||r())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let r=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==r||r.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case u.A:this._onclose();break;case u.C:this._onopen();break;case u.B:this._onerror(t.ev);break;case u.H:this.report_monitor_func(t.tag,t.data)}}}n()(c,"UNINIT",0),n()(c,"CONNECTED",1),n()(c,"DISCONNECT",2)},function(e,t,r){"use strict";r.d(t,"d",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"a",(function(){return c}));var i=r(12),n=r(6),s=r(13);function a(e){return new n.a({sock:new n.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(n.a.dataTransportMgr)return;let r=new s.a({type:t?s.a.THREAD_SUB:s.a.THREAD_MAIN,remote:t?self:null});n.a.dataTransportMgr=r,r.monitorlogfn=e,t&&self.addEventListener("message",r._onrecvmainthreadlistener.bind(r))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function h(e){return n.a.dataTransportMgr.getTransportByType(e)}function u(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.removeDataChannel(e)}class c{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,r){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new n.c,r=h(n.e.VIDEO_ENCODE)||t,i=h(n.e.VIDEO_DECODE)||t,s=h(n.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?n.b.OPEN:n.b.CLOSED;r.setStatus(a),i.setStatus(a),this.isSupportVideoShare||s.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])r.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void s.send(t);i.send(t)}});const o=t=>{e.send(t)};r.onmessage=o,i.onmessage=o,s.onmessage=o}connectAudioSession(e){let t=new n.c,r=h(n.e.AUDIO_ENCODE)||t,i=h(n.e.AUDIO_DECODE)||t,s=e.isReady()?n.b.OPEN:n.b.CLOSED;r.setStatus(s),i.setStatus(s),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?r.send(t):i.send(t)});const a=t=>{e.send(t)};r.onmessage=a,i.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var i=r(7),n=r.n(i),s=r(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let r={id:e,worker:t},i=this._recvheartbeat.bind(this,r);r.listener=i,r.lastedtimestamp=Date.now(),r.worker.addEventListener("message",r.listener),this.monitorworkers[e]=r}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let r=t.data;r.cmd===s.Db&&(e.lastedtimestamp=r.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:s.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const r=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),i=Date.now(),n=this._lasted_timestamp;in+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",i-n):t.forEach(t=>{var r;let n=e.monitorworkers[t],s=n.lastedtimestamp+(null!==(r=document)&&void 0!==r&&r.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);i>s&&(e.timeoutcallbackfn(n.id,i-n.lastedtimestamp),n.lastedtimestamp=i)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}n()(o,"INTREVAL_TIME_MS",3e3),n()(o,"HEART_TIMEOUT_MS",15e3),n()(o,"MAX_HEART_TIMEOUT_MS",3e4),n()(o,"instance",null)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));class i{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c}));var i=r(11);function n(){this.ssrcQueueMap=new Map,n.prototype.AddQueue=function(e){var t=new i.a;return this.ssrcQueueMap.set(e,t),t},n.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},n.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},n.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},n.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},n.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var s=function(){this.frames=0,this.ntp=new i.a};s.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;s30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;sbtoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){n()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(s(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const r=this.textEncoder.encode(e);this.processList.push(r),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(s(t.buffer)),this.writeLog(this.EOL);const r=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(s(this.mergeBuffer(r).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=r(3);r.d(t,"a",(function(){return l}));class h{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,r){if(t){var i=new Uint8Array(r?t+1:t),n=Object(o.d)().subarray(e+0,e+t);return i.set(n,0,t),r&&(i[t]=10),i}return e.data}writeWasmLog(e,t){const r=this.getTime(),i=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(r,i):(this.writeLog(r),this.writeLog(i),this.writeLog("\n"))}}class u extends h{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=r=>{"local_log_port"===r.data.command?this.port||(this.port=r.data.data):"local_log_ready"===r.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new u:null}},function(e,t,r){"use strict";t.a=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:r,opacity:i,name:n}=e;t.fillStyle="rgba(0, 0, 0, ".concat(i,")"),t.fillText(n,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(i,")"),t.fillText(n,r.x+1,r.y+1)}_getTransformInfo(e){let t,{canvas:r,position:i}=e;if(1===i)t={x:r.width/2,y:0,rateRadio:0,maxWidth:r.width};else if(2===i)t={x:r.width/2,y:r.height,rateRadio:0,maxWidth:r.width};else if(4===i)t={x:0,y:r.height/2,rateRadio:Math.PI/2,maxWidth:r.height};else if(8===i)t={x:r.width,y:r.height/2,rateRadio:-Math.PI/2,maxWidth:r.height};else{const e=-21*Math.PI/180;t={x:r.width/2,y:r.height/2,rateRadio:e,maxWidth:Math.min(r.width/Math.cos(e),-r.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:r,name:i,textWidth:n}=e;const s=this._getPaddingWidth({ctx:r,position:t,name:i});return 1===t?{x:-n.width/2,y:s}:2===t||4===t||8===t?{x:-n.width/2,y:-s}:{x:-n.width/2,y:r.measureText(i[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:r,name:i}=e;return[1,2,4,8].includes(r)?32:t.measureText(i[0]).width}_setBaseLine(e){let{ctx:t,position:r}=e;t.textBaseline=1===r?"top":2===r||4===r||8===r?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;let h=this._getTransformInfo({canvas:t,position:a});var u=t.getContext("2d");let l;if(u.clearRect(0,0,t.width,t.height),u.translate(h.x,h.y),u.rotate(h.rateRadio),this._setBaseLine({ctx:u,position:a}),u.lineWidth=1,u.imageSmoothingEnabled=!0,1==r.length){const e=h.maxWidth/r.length;u.font=e+"px 'Segoe UI'",l=u.measureText(r)}else{let e=16;for(u.font=e+"px 'Segoe UI'",l=u.measureText(r);l.widthh.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r}))if(e>16)e-=1,u.font=e+"px 'Segoe UI'",l=u.measureText(r);else{const e=r;for(;r.length>5&&l.width>h.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r+"..."});)r=r.slice(0,r.length-1),l=u.measureText(r+"...");e!==r&&(r+="...")}}const c=this._calcTextPos({position:a,ctx:u,name:r,textWidth:l});var d;if(this._drawWatermarkWithShadow({ctx:u,name:r,opacity:s,textPos:c}),o)d=t.toDataURL();else{var f=u.getImageData(0,0,u.canvas.width,u.canvas.height);d=new Uint8Array(f.data.buffer)}return u.rotate(-h.rateRadio),u.translate(-h.x,-h.y),d}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;const h=t.getContext("2d");h.clearRect(0,0,t.width,t.height),h.translate(i/2,n/2),h.rotate(-21*Math.PI/180),h.imageSmoothingEnabled=!0;h.font="".concat(32,"px 'Segoe UI'"),h.textBaseline="top";const u=h.measureText(r),l=.37*u.width;let c,d=0,f=-n;do{let e=d%2==0?l-i:-i;do{h.fillStyle="rgba(0, 0, 0, ".concat(s,")"),h.fillText(r,e,f),h.fillStyle="rgba(255, 255, 255, ".concat(s,")"),h.fillText(r,e+1,f+1),e+=u.width+l}while(e=this._last_update_time+this._init_report_interval&&(this._report(),this.capture_fps_history=[],this.close_frames_history=[],this._last_update_time=e,this._init_report_intervalthis._report_interval&&(this._init_report_interval=this._report_interval)))},n.prototype.closeSample=function(){this.close_frames++,this.close_total_frames++},n.prototype.setCloseTotalFrames=function(e){this.close_total_frames=e},n.prototype.captureTicket=function(){this._enabled&&this.capture_ticket_count++},n.prototype.captureSample=function(){if(!this._enabled)return;this.capture_fps++,this.capture_total_fps++;let e=performance.now();if(this.last_capture_time){let t=e-this.last_capture_time;t>this.threshold&&this.capture_timeout_report.timeoutReport(t,e)}this.last_capture_time=e},n.prototype.ref=function(){this.ref_counts++},n.prototype.unref=function(){this.unref_counts++},n.prototype.start=function(){this._enabled||(0!=this._last_update_time&&(clearTimeout(this._last_update_time),this._last_update_time=0,this._report()),this.capture_fps=0,this.capture_fps_history=[],this.capture_total_fps=0,this.close_frames=0,this.close_frames_history=[],this.close_total_frames=0,this.capture_ticket_count=0,this._last_update_time=performance.now(),this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enabled=!0)},n.prototype.stop=function(){this._enabled&&(this._enabled=!1,this._interval_id&&clearInterval(this._interval_id),this._interval_id=0,(this.close_frames>0||this.capture_fps>0||this.capture_fps_history.length>0||this.close_frames_history>0)&&(this._timeout_id=setTimeout(this._timeout_report.bind(this),3e3)))}},function(e,t){e.exports=function(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(0),n=r.n(i),s=r(1),a=r.n(s),o=r(3),h=r(2);function u(e,t){c(e,t),t.add(e)}function l(e,t,r){c(e,t),t.set(e,r)}function c(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function d(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var f=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,_=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,T=new WeakMap,R=new WeakMap,E=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap,C=new WeakMap,P=new WeakMap,U=new WeakMap,L=new WeakMap,I=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,G=new WeakSet,W=new WeakSet,N=new WeakSet,F=new WeakSet,V=new WeakSet,z=new WeakSet,H=new WeakSet,j=new WeakSet,Y=new WeakSet,X=new WeakSet,q=new WeakSet,K=new WeakSet,Q=new WeakSet,Z=new WeakSet,J=new WeakSet,$=new WeakSet,ee=new WeakSet,te=new WeakSet,re=new WeakSet,ie=new WeakSet;function ne(e){e&&e.forEach(e=>{e.markRenderingStatePending()});const t=d(this,J,ve).call(this,e);if(n()(this,w)&&n()(this,b)&&n()(this,T))if(n()(this,f)&&0!=n()(this,f).width&&0!=n()(this,f).height&&n()(this,b)&&n()(this,b).getCurrentTexture()&&0!=n()(this,b).getCurrentTexture().width&&0!=n()(this,b).getCurrentTexture().height)try{if(!n()(this,S)){const e=n()(this,B).byteLength,t=e;a()(this,S,n()(this,T).acquireBuffer(t,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,e,!0,!1)),new Float32Array(n()(this,S).getMappedRange()).set(n()(this,B)),n()(this,S).unmap()}const e=d(this,H,le).call(this);for(const[r,i]of t)d(this,ee,we).call(this,r,i,e);const r=d(this,Z,_e).call(this,n()(this,b).getCurrentTexture().createView()),i=e.beginRenderPass(r);i.setVertexBuffer(0,n()(this,S));for(const[e,r]of t)if(r&&0!=r.length)for(const e of r){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;const t=e.getTextureType();let r=e.getUVCoords();if(t!==h.x.CLEAR_COLOR&&!r)continue;const s=n()(this,f).width,a=n()(this,f).height;let o=e.getViewport();if(!o||Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.w)||Number.isNaN(o.h)||o.x<0||o.y<0)continue;if(o.x+o.w>s){let e=o.x+o.w-s;if(!(e>0&&e<=h.i))continue;o.w-=e,o.w<=0&&(o.w=1)}if(o.y+o.h>a){let e=o.y+o.h-a;if(!(e>0&&e<=h.i))continue;o.h-=e,o.h<=0&&(o.h=1)}const u=d(this,$,be).call(this,e);if(!u)continue;if(u.pipelineType!==h.l.CLEAR_COLOR){let t=e.getUVCoordsBuffer();if(!t){const i=r.byteLength;t=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,r.byteLength,!1,!1),e.setUVCoordsBuffer(t)}n()(this,w).queue.writeBuffer(t,0,r,0,r.length),i.setVertexBuffer(1,t)}i.setViewport(o.x,o.y,o.w,o.h,o.minDepth,o.maxDepth);const l=u.pipeline;i.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});i.setBindGroup(0,c),i.draw(6,1,0,0)}i.end(),d(this,j,ce).call(this)}catch(e){Object(o.u)("[WebGUPRenderer] renderNoMsaa() error:".concat(e.message))}finally{n()(this,v).recycleInUsedGPUBuffers(t)}else n()(this,v).recycleInUsedGPUBuffers(t);else n()(this,v).recycleInUsedGPUBuffers(t)}function se(e){if(!n()(this,w)||!n()(this,b))return;const t=n()(this,w).createBuffer({label:"VertexBuffer",size:n()(this,B).byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,mappedAtCreation:!0});new Float32Array(t.getMappedRange()).set(n()(this,B)),t.unmap();const r=d(this,H,le).call(this),i=d(this,J,ve).call(this,e);for(const[e,t]of i)d(this,ee,we).call(this,e,t,r);const s=d(this,ie,Te).call(this,n()(this,f)),a=d(this,Q,me).call(this,0,s.createView(),n()(this,b).getCurrentTexture().createView()),o=r.beginRenderPass(a);o.setVertexBuffer(0,t);for(const[e,t]of i)if(t&&0!=t.length)for(const e of t){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;let t=e.getUVCoords();if(!t)continue;let r=e.getUVCoordsBuffer();if(!r){const i=t.byteLength;r=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,t.byteLength,!1,!0),e.setUVCoordsBuffer(r)}n()(this,w).queue.writeBuffer(r,0,t,0,t.length),o.setVertexBuffer(1,r);const i=n()(this,f).width,s=n()(this,f).height;let a=e.getViewport();if(!a||Number.isNaN(a.x)||Number.isNaN(a.y)||Number.isNaN(a.w)||Number.isNaN(a.h)||a.x<0||a.y<0||a.x+a.w>i||a.y+a.h>s)continue;const u=d(this,$,be).call(this,e,!0);if(!u)continue;o.setViewport(a.x,a.y,a.w,a.h,a.minDepth,a.maxDepth);const l=u.pipeline;o.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});o.setBindGroup(0,c),o.draw(6,1,0,0)}o.end(),d(this,j,ce).call(this),e.forEach(e=>{e.markRenderingStatePending()})}function ae(e){if(!Array.isArray(e))return;let t=[];for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalYuvTextureGroup] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalYuvTextureGroup] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();let s=null,a=null,o=null;const h=e.getWidth(),u=e.getHeight(),l=null!=r&&(h!=r.yPlaneTex.width||u!=r.yPlaneTex.height);let c=!0;r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(s=r.yPlaneTex,a=r.uPlaneTex,o=r.vPlaneTex,c=!1));let d=!1,f="r8unorm";if(i&&i.bufferConfig&&"nv12"==i.bufferConfig.colorFormat&&(f="rg8unorm",d=!0),c){const t=e.getIndex(),r=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,i=n()(this,E).assembleTextureConfig(h,u,r,"r8unorm",1),l=n()(this,E).assembleTextureConfig(h/2,u/2,r,f,1);s=n()(this,E).acquireTexture(i),s&&(s.label="RD(".concat(t,")-YPlaneTexture")),d?(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UVPlaneTexture"))):(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UPlaneTexture")),o=n()(this,E).acquireTexture(l),o&&(o.label="RD(".concat(t,")-VPlaneTexture")))}t.copyBufferToTexture({buffer:i.buffer,offset:i.yPlaneBuffer.offset,bytesPerRow:i.yPlaneBuffer.bytesPerRow,rowsPerImage:i.yPlaneBuffer.rowsPerImage},{texture:s},[h,u,1]),t.copyBufferToTexture({buffer:i.buffer,offset:i.uPlaneBuffer.offset,bytesPerRow:i.uPlaneBuffer.bytesPerRow,rowsPerImage:i.uPlaneBuffer.rowsPerImage},{texture:a},[h/2,u/2,1]),i.vPlaneBuffer.offset>0&&!d&&t.copyBufferToTexture({buffer:i.buffer,offset:i.vPlaneBuffer.offset,bytesPerRow:i.vPlaneBuffer.bytesPerRow,rowsPerImage:i.vPlaneBuffer.rowsPerImage},{texture:o},[h/2,u/2,1]);let p={};return p.yPlaneTex=s,p.uPlaneTex=a,p.vPlaneTex=o,p}function he(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalRgbaTexture] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalRgbaTexture] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();const s=e.getIndex(),a=e.getWidth(),o=e.getHeight(),h=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let u=null;const l=null!=r&&(a!=r.width||o!=r.height);let c=!0;if(r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(u=r,c=!1)),c){const e=n()(this,E).assembleTextureConfig(a,o,h,"rgba8unorm",1);u=n()(this,E).acquireTexture(e),u&&(u.label="RD(".concat(s,")-rgbaTexture"))}return t.copyBufferToTexture({buffer:i.buffer,offset:0,bytesPerRow:i.bytesPerRow,rowsPerImage:i.rowsPerImage},{texture:u},[a,o,1]),u}function ue(e,t){return Math.ceil(e/t)*t}function le(){return n()(this,w)?(n()(this,x)||a()(this,x,n()(this,w).createCommandEncoder()),n()(this,x)):(Object(o.u)("GPUDevice is not ready! No available command encoder."),null)}function ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;n()(this,x)&&e?n()(this,w).queue.submit([n()(this,x).finish(),e.finish()]):n()(this,x)?n()(this,w).queue.submit([n()(this,x).finish()]):e&&n()(this,w).queue.submit([e.finish()]),a()(this,x,null)}function de(e,t){if(!n()(this,w))return null;if(!n()(this,I)){let r=n()(this,w).createBindGroupLayout({label:"CursorTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"CursorTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"CursorTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,I,n()(this,w).createRenderPipeline(s))}return n()(this,I)}function fe(e,t){if(!n()(this,w))return null;if(!n()(this,L)){let r=n()(this,w).createBindGroupLayout({label:"WatermarkTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"WatermarkTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"WatermarkTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,L,n()(this,w).createRenderPipeline(s))}return n()(this,L)}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,C)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,C,n()(this,w).createRenderPipeline(i))}return n()(this,C)}function ge(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,P)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,P,n()(this,w).createRenderPipeline(i))}return n()(this,P)}function me(e,t,r){return{label:"renderPass - ".concat(e),colorAttachments:[{view:t,resolveTarget:r,loadOp:"clear",storeOp:"discard"}]}}function _e(e){return e&&(e.label="canvas-texture-view"),{label:"RenderPassNoMsaa",colorAttachments:[{view:e,loadOp:"clear",storeOp:"store"}]}}function ve(e){let t=new Map;for(let r=0;r1&&void 0!==arguments[1]&&arguments[1],r=null,i=null,s=null,a=null;const o=e.getZIndex(),u=e.getTextureType(),l=e.getColorFormat();if(o==h.w.VS_BASE){if(u==h.x.EXTERNAL_TEX){a=h.l.VIDEO_FRAME,r=this.acquireVideoFrameRenderPipeline(h.y,t),i=this.acquireVideoFrameSampler();const o=e.getPendingVideoFrame();if(!o||0==o.codedWidth||0==o.codedHeight||!o.format)return e.setPendingVideoFrame(null),null;const u=e.getUniformBuffer();if(!u)return null;s=[{binding:0,resource:i},{binding:1,resource:n()(this,w).importExternalTexture({source:o})},{binding:2,resource:{buffer:u}}]}else if(u==h.x.CLEAR_COLOR){a=h.l.CLEAR_COLOR,r=this.acquireClearColorRenderPipeline(h.c);const t=e.getClearColorUniformBuffer();if(!t)return null;s=[{binding:0,resource:{buffer:t}}]}else if(u==h.x.GPU_TEX_YUV){"i420"==l?(a=h.l.YUV_I420,r=d(this,q,pe).call(this,h.z,t)):"nv12"==l&&(a=h.l.YUV_NV12,r=d(this,K,ge).call(this,h.A,t)),i=this.acquireYuvTexturesSamplers();const n=e.getUniformBuffer();if(!n)return null;const o=e.getTextureGroup();o&&("i420"==l?s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:o.vPlaneTex.createView()},{binding:5,resource:{buffer:n}},{binding:6,resource:{buffer:n}}]:"nv12"==l&&(s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:{buffer:n}},{binding:5,resource:{buffer:n}}]))}}else if(o==h.w.WATERMARK||o==h.w.MASK){a=h.l.RGBA_WATERMARK,r=d(this,X,fe).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getTextureGroup();n&&(s=[{binding:0,resource:i},{binding:1,resource:n.createView()}])}else if(o==h.w.CURSOR){a=h.l.RGBA_CURSOR,r=d(this,Y,de).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getUniformBuffer();if(!n)return null;const u=e.getTextureGroup();u&&(s=[{binding:0,resource:i},{binding:1,resource:u.createView()},{binding:2,resource:{buffer:n}}])}if(a===h.l.CLEAR_COLOR){if(!r||!s)return null}else if(!r||!i||!s||null==a)return null;const c={pipelineType:a,pipeline:r,entries:s};return c}function we(e,t,r){for(const i of t){const t=i.getTextureType();t!=h.x.EXTERNAL_TEX&&t!=h.x.CLEAR_COLOR&&(e==h.w.VS_BASE?d(this,te,ye).call(this,i,r):e!=h.w.CURSOR&&e!=h.w.WATERMARK&&e!=h.w.MASK||d(this,re,xe).call(this,i,r))}}function ye(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,F,oe).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,F,oe).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function xe(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,V,he).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,V,he).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function Te(e){if(!e||!n()(this,w))return n()(this,D)?n()(this,D):null;if(n()(this,D)){if(n()(this,D).width!=e.width||n()(this,D).height!=e.height){const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}}else{const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}return n()(this,D)}var Re=class{constructor(e,t){if(u(this,ie),u(this,re),u(this,te),u(this,ee),u(this,$),u(this,J),u(this,Z),u(this,Q),u(this,K),u(this,q),u(this,X),u(this,Y),u(this,j),u(this,H),u(this,z),u(this,V),u(this,F),u(this,N),u(this,W),u(this,G),l(this,f,{writable:!0,value:null}),l(this,p,{writable:!0,value:0}),l(this,g,{writable:!0,value:0}),l(this,m,{writable:!0,value:!1}),l(this,_,{writable:!0,value:!1}),l(this,v,{writable:!0,value:null}),l(this,b,{writable:!0,value:null}),l(this,w,{writable:!0,value:null}),l(this,y,{writable:!0,value:null}),l(this,x,{writable:!0,value:null}),l(this,T,{writable:!0,value:null}),l(this,R,{writable:!0,value:null}),l(this,E,{writable:!0,value:null}),l(this,S,{writable:!0,value:null}),l(this,A,{writable:!0,value:null}),l(this,k,{writable:!0,value:null}),l(this,M,{writable:!0,value:null}),l(this,C,{writable:!0,value:null}),l(this,P,{writable:!0,value:null}),l(this,U,{writable:!0,value:null}),l(this,L,{writable:!0,value:null}),l(this,I,{writable:!0,value:null}),l(this,O,{writable:!0,value:null}),l(this,D,{writable:!0,value:null}),l(this,B,{writable:!0,value:new Float32Array(12)}),!t)throw new Error("[WebGPURenderer] resMgr is an invalid param! ".concat(t));a()(this,f,e),a()(this,v,t),this.initialize(e)}switchMsaa(e){a()(this,_,e)}isMsaaEnabled(){return n()(this,_)}setCanvas(e){e&&a()(this,f,e)}setDevice(e){e&&a()(this,w,e)}setRenderArgs(e,t){a()(this,p,e||0),a()(this,g,n()(this,p)?3:t?4:6),a()(this,m,t||!1)}setTextureIndex(e){a()(this,p,e||0)}initialize(e){n()(this,w)||(a()(this,w,n()(this,v).acquireGPUDevice()),n()(this,w))?(n()(this,y)||a()(this,y,n()(this,v).acquireCanvasFormat()),n()(this,T)||a()(this,T,n()(this,v).acquireGPUBufferMgr()),n()(this,R)||a()(this,R,n()(this,v).acquireGPUBufferPool()),n()(this,E)||a()(this,E,n()(this,v).acquireGPUTextureMgr()),this.configureGPUContext(e),d(this,N,ae).call(this,h.b)):Object(o.u)("[WebGPURenderer] initialize() device is not ready!")}isGPUDeviceReady(){return null!=n()(this,w)}render(e){n()(this,_)?d(this,W,se).call(this,e):d(this,G,ne).call(this,e)}updateVertexCoords(e){d(this,N,ae).call(this,e)}createRGBATexture(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;if(t<0)return Object(o.u)("[createRGBATexture] ".concat(t," is an invalid index!")),null;if(!n()(this,T))return console.warn("[createRGBATexture] buffer manager is not ready!"),null;if(!n()(this,w))return console.warn("[createRGBATexture] GPUDevice is not ready!"),null;if(null==s||void 0===s)return console.warn("[createRGBATexture] rgbaData is invalid!"),null;if(!e)return console.warn("[createRGBATexture] command encoder is invalid!"),null;const h=d(this,z,ue).call(this,Uint32Array.BYTES_PER_ELEMENT*r,256),u=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,l=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let c=null;const f=null!=a&&(r!=a.width||i!=a.height);let p=!0;if(a&&(f?(n()(this,E).recycleTexture(a),p=!0):(c=a,p=!1)),p){const e=n()(this,E).assembleTextureConfig(r,i,l,"rgba8unorm",1);c=n()(this,E).acquireTexture(e),c&&(c.label="RD(".concat(t,")-rgbaTexture"))}const g=n()(this,T).acquireBuffer("".concat(t,"_Y"),u,h*i,!0,!1),m=new Uint8Array(g.getMappedRange()),_=r*Uint32Array.BYTES_PER_ELEMENT;for(let e=0;e=g.length)return console.error("[WebGPURenderer] write yPlane is out of range! yPlaneOffset=".concat(0,", yPlane.height=").concat(r.height,", yPlaneBytesPerRow=").concat(a,", mappedArray.len=").concat(g.length)),null;for(let e=0;eg.length)return null;for(let e=0;e0){if(l+s.height*h>g.length)return null;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:null;if(!n()(this,w))return Object(o.u)("writeUniformBuffer() GPUDevice is not ready yet."),null;if(!t||0==t.length)return null;let i=r;return i||(i=n()(this,w).createBuffer({label:e,size:t.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),n()(this,w).queue.writeBuffer(i,0,t,0,t.length),i}acquireBlendTextureSampler(){return n()(this,w)?(n()(this,O)||a()(this,O,n()(this,w).createSampler({})),n()(this,O)):null}configureGPUContext(e){n()(this,b)||(a()(this,b,e.getContext("webgpu")),n()(this,b)?n()(this,b).configure({device:n()(this,w),format:n()(this,y),alphaMode:"premultiplied"}):Object(o.u)("configureGPUContext() webgpuContext is invalid! canvas=".concat(e)))}unconfigureGPUContext(){n()(this,b)&&(n()(this,b).unconfigure(),a()(this,b,null))}acquireVideoFrameRenderPipeline(e,t){if(!n()(this,w)||!e)return null;if(!n()(this,A)){const r=n()(this,w).createBindGroupLayout({label:"VideoFrameBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"VideoFrameRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"VideoFramePipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,A,n()(this,w).createRenderPipeline(i))}return n()(this,A)}acquireClearColorRenderPipeline(e){if(!n()(this,w)||!e)return null;if(!n()(this,k)){const t=n()(this,w).createBindGroupLayout({label:"ClearColorBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),r={label:"ClearColorRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"ClearColorPipelineLayout",bindGroupLayouts:[t]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};a()(this,k,n()(this,w).createRenderPipeline(r))}return n()(this,k)}acquireVideoFrameSampler(){return n()(this,w)?(n()(this,M)||a()(this,M,n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"})),n()(this,M)):null}acquireYuvTexturesSamplers(){if(!n()(this,w))return null;if(!n()(this,U)){a()(this,U,[]);const e=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"}),t=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"});n()(this,U).push(e),n()(this,U).push(t)}return n()(this,U)}clearAttachedCanvas(){if(!n()(this,w)||!n()(this,b)||!n()(this,S))return;if(!n()(this,f)||0==n()(this,f).width||0==n()(this,f).height)return;const e=n()(this,w).createCommandEncoder(),t=e.beginRenderPass({colorAttachments:[{view:n()(this,b).getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),r=n()(this,w).createRenderPipeline({layout:"auto",vertex:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}});t.setVertexBuffer(0,n()(this,S)),t.setPipeline(r),t.draw(6),t.end(),n()(this,w).queue.submit([e.finish()])}clear(){console.log("WebGPURender.clear")}cleanup(){this.unconfigureGPUContext(),a()(this,f,null),a()(this,y,null),a()(this,x,null),a()(this,S,null),a()(this,A,null),a()(this,k,null),a()(this,M,null),a()(this,C,null),a()(this,P,null),a()(this,U,null),a()(this,L,null),a()(this,I,null),a()(this,O,null),a()(this,D,null),n()(this,T)&&a()(this,T,null),n()(this,w)&&a()(this,w,null)}};function Ee(e,t){Ae(e,t),t.add(e)}function Se(e,t,r){Ae(e,t),t.set(e,r)}function Ae(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ke(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Me=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,Le=new WeakSet,Ie=new WeakSet,Oe=new WeakSet,De=new WeakSet,Be=new WeakSet;function Ge(){return!0}function We(){if(n()(this,Pe)){let e={};return e.architecture=n()(this,Pe).architecture,e.vendor=n()(this,Pe).vendor,e}return null}async function Ne(){if(!navigator.gpu)return a()(this,Me,h.C.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();if(!e)return a()(this,Me,h.C.CANNOT_REQ_ADAPTER),!1;return await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(a()(this,Pe,await e.requestAdapterInfo()),n()(this,Pe)&&console.log("adapter info: ".concat(n()(this,Pe).architecture,", ").concat(n()(this,Pe).vendor))):"info"in e&&a()(this,Pe,e.info),a()(this,Me,h.C.AVAILABLE),!0):(a()(this,Me,h.C.CANNOT_REQ_DEVICE),!1)}function Fe(e){if(!e)return!1;const t=e.vendor;return-1!==h.g.indexOf(t)}function Ve(e,t,r){return class{static produce(e,t,r){let i=null;return e===h.j.WEBGPU&&(i=new Re(t,r)),i}}.produce(e,t,r)}var ze=class{constructor(){Ee(this,Be),Ee(this,De),Ee(this,Oe),Ee(this,Ie),Ee(this,Le),Se(this,Me,{writable:!0,value:h.C.AVAILABLE}),Se(this,Ce,{writable:!0,value:h.j.WEBGL}),Se(this,Pe,{writable:!0,value:null}),Se(this,Ue,{writable:!0,value:new Map})}async evaluate(e){a()(this,Ce,h.j.WEBGL);if(!ke(this,Le,Ge).call(this))return n()(this,Ce);if(!e.allowedOnTargetPlatforms)return n()(this,Ce);if(!e.allowedOnTargetBrowsers)return n()(this,Ce);if(!await ke(this,Oe,Ne).call(this))return n()(this,Ce);const t=ke(this,Ie,We).call(this);if(!ke(this,De,Fe).call(this,t))return n()(this,Ce);let r=new OffscreenCanvas(1,1);return r.getContext("webgpu")?(r=null,a()(this,Ce,h.j.WEBGPU),n()(this,Ce)):(r=null,n()(this,Ce))}acquireRenderer(e,t){let r=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&n()(this,Ue).clear(),n()(this,Ue).has(e)&&(r=n()(this,Ue).get(e),r&&(e&&(r.setCanvas(e),r.initialize(e)),t&&r.setDevice(t.acquireGPUDevice()))),null==r&&(r=ke(this,Be,Ve).call(this,n()(this,Ce),e,t),r&&n()(this,Ue).set(e,r)),r}rendererReinitialize(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.unconfigureGPUContext()}getRendererType(){return n()(this,Ce)}setRendererType(e){a()(this,Ce,e)}isWebGPURendererType(){return n()(this,Ce)===h.j.WEBGPU}isWebGLRendererType(){return n()(this,Ce)===h.j.WEBGL}isWebGL2RendererType(){return n()(this,Ce)===h.j.WEBGL_2}cleanup(){for(const[e,t]of n()(this,Ue))t&&t.cleanup();n()(this,Ue).clear()}};function He(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function je(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Ye=new WeakSet,Xe=new WeakSet;function qe(e){e.forEach(e=>{e.consumePendingGPUEvents()})}function Ke(e){if(!e||0==e.length)return!0;return-1==e.findIndex(e=>{if(!e)return!1;return!!e.getTextureLayerByZIndex(h.w.VS_BASE)&&e.isRenderingStateReady()})}var Qe=class{constructor(){He(this,Xe),He(this,Ye)}render(e,t){return e?e.isGPUDeviceReady()?t&&0!=t.length?(je(this,Ye,qe).call(this,t),void(je(this,Xe,Ke).call(this,t)||e.render(t))):(console.warn("[RendererController] render displays are not available!"),void Object(o.o)("WGPU RendererController_render() displays are not available!")):(console.log("[RendererController] GPU device is not ready!"),void Object(o.o)("WGPU RendererController_render() GPU device is not ready!")):(console.warn("[RendererController] renderer is not attached!"),void Object(o.o)("WGPU RendererController_render() renderer is not attached!"))}},Ze=r(20),Je=r(21),$e=r(7),et=r.n($e),tt=r(4);function rt(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var it=new WeakMap,nt=new WeakMap,st=new WeakMap,at=new WeakMap,ot=new WeakMap,ht=new WeakMap,ut=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,_t=new WeakMap,vt=new WeakMap,bt=new WeakMap,wt=new WeakMap;var yt=class{constructor(e,t){rt(this,it,{writable:!0,value:0}),rt(this,nt,{writable:!0,value:-1}),rt(this,st,{writable:!0,value:0}),rt(this,at,{writable:!0,value:0}),rt(this,ot,{writable:!0,value:-1}),rt(this,ht,{writable:!0,value:null}),rt(this,ut,{writable:!0,value:-1}),rt(this,lt,{writable:!0,value:null}),rt(this,ct,{writable:!0,value:null}),rt(this,dt,{writable:!0,value:null}),rt(this,ft,{writable:!0,value:!1}),rt(this,pt,{writable:!0,value:null}),rt(this,gt,{writable:!0,value:null}),rt(this,mt,{writable:!0,value:null}),rt(this,_t,{writable:!0,value:null}),rt(this,vt,{writable:!0,value:null}),rt(this,bt,{writable:!0,value:!1}),rt(this,wt,{writable:!0,value:""}),a()(this,it,e),a()(this,nt,t)}getIndex(){return n()(this,it)}lock(){a()(this,ft,!0)}unlock(){a()(this,ft,!1)}isLocked(){return n()(this,ft)}getZIndex(){return n()(this,nt)}setWidth(e){a()(this,st,e)}setHeight(e){a()(this,at,e)}getWidth(){return n()(this,st)}getHeight(){return n()(this,at)}getRawData(){return n()(this,ht)}setRawData(e){a()(this,ht,e)}setIsNew(e){a()(this,bt,e)}isNew(){return n()(this,bt)}setColorFormat(e){a()(this,wt,e)}getColorFormat(){return n()(this,wt)}setPendingVideoFrame(e){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),a()(this,pt,e)}clearPendingVideoFrame(){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null))}setTextureLayerType(e){a()(this,ot,e)}getTextureLayerType(){return n()(this,ot)}setTextureType(e){a()(this,ut,e)}getTextureType(){return n()(this,ut)}getPendingVideoFrame(){return n()(this,pt)}getUVCoords(){return n()(this,ct)}setUVCoords(e){a()(this,ct,e)}getUVCoordsBuffer(){return n()(this,_t)}setUVCoordsBuffer(e){a()(this,_t,e)}evalViewport(e,t,r,i,s){n()(this,dt)||a()(this,dt,{}),n()(this,dt).x=Math.floor(e),n()(this,dt).w=Math.floor(r),n()(this,dt).h=Math.floor(i),n()(this,ot)==h.v.BASE_LAYER?n()(this,dt).y=Math.floor(s-(t+i)):n()(this,dt).y=Math.floor(t),n()(this,dt).x<0&&(n()(this,dt).x=0),n()(this,dt).y<0&&(n()(this,dt).y=0),n()(this,dt).minDepth=0,n()(this,dt).maxDepth=1}setViewport(e){a()(this,dt,e)}getViewport(){return n()(this,dt)}getTextureGroup(){return n()(this,lt)}setTextureGroup(e){a()(this,lt,e)}setUniformBuffer(e){a()(this,gt,e)}getUniformBuffer(){return n()(this,gt)}setClearColorUniformBuffer(e){a()(this,mt,e)}getClearColorUniformBuffer(){return n()(this,mt)}setTextureBufferGroup(e){a()(this,vt,e)}getTextureBufferGroup(){return n()(this,vt)}destroyTextureBufferGroup(){n()(this,vt)&&a()(this,vt,null)}recycle(e){this.destroyTextureBufferGroup(),e&&e.destroyTextureGroup(this),n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),n()(this,gt)&&(n()(this,gt).destroy(),a()(this,gt,null)),n()(this,mt)&&(n()(this,mt).destroy(),a()(this,mt,null)),a()(this,it,-1),a()(this,nt,-1),a()(this,ot,h.v.UNKNOWN),a()(this,ht,null),a()(this,ut,h.x.UNKNOWN),a()(this,ct,null),a()(this,dt,null),a()(this,ft,!1),a()(this,bt,!1),a()(this,wt,"")}},xt=r(9);function Tt(e,t){Et(e,t),t.add(e)}function Rt(e,t,r){Et(e,t),t.set(e,r)}function Et(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function St(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var At=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ct=new WeakMap,Pt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ot=new WeakMap,Dt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,er=new WeakMap,tr=new WeakMap,rr=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,ar=new WeakMap,or=new WeakMap,hr=new WeakMap,ur=new WeakMap,lr=new WeakMap,cr=new WeakMap,dr=new WeakMap,fr=new WeakSet,pr=new WeakSet,gr=new WeakSet,mr=new WeakSet,_r=new WeakSet,vr=new WeakSet,br=new WeakSet,wr=new WeakSet,yr=new WeakSet,xr=new WeakSet,Tr=new WeakSet,Rr=new WeakSet,Er=new WeakSet,Sr=new WeakSet,Ar=new WeakSet,kr=new WeakSet,Mr=new WeakSet,Cr=new WeakSet,Pr=new WeakSet,Ur=new WeakSet,Lr=new WeakSet,Ir=new WeakSet,Or=new WeakSet,Dr=new WeakSet,Br=new WeakSet,Gr=new WeakSet,Wr=new WeakSet,Nr=new WeakSet,Fr=new WeakSet,Vr=new WeakSet;function zr(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(St(this,Rr,ei).call(this),!n()(this,Nt)||!n()(this,Ft)||!n()(this,Nt).isGPUDeviceReady())return void(r instanceof VideoFrame&&r.close());const s=h.w.VS_BASE,a=St(this,Sr,ri).call(this,s),u=a.isLocked();if(u){const n=a.getPendingVideoFrame();!n||n.codedWidth==e&&n.codedHeight==t?r instanceof VideoFrame&&r.close():r instanceof VideoFrame?a.setPendingVideoFrame(r):(i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!"))}else{if(r instanceof VideoFrame){a.getPendingVideoFrame()!=r&&a.setPendingVideoFrame(r)}else i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!");a.setTextureLayerType(h.v.BASE_LAYER),a.setTextureType(h.x.EXTERNAL_TEX),a.lock()}this.markRenderingStateReady()}function Hr(e,t,r,i,s,a){St(this,Rr,ei).call(this);const o=h.w.VS_BASE,u=St(this,Sr,ri).call(this,o);if(u.setTextureLayerType(h.v.BASE_LAYER),u.setTextureType(h.x.GPU_TEX_YUV),u.clearPendingVideoFrame(),u.isLocked()){const e=u.getWidth(),i=u.getHeight();e==t&&i==r||(u.setWidth(t),u.setHeight(r),u.setIsNew(!0))}else u.setWidth(t),u.setHeight(r),u.setIsNew(!0),u.lock();const l=St(this,Dr,di).call(this,i,t,r,a),c=n()(this,Nt).writeToYuvTexturesBufferGroup(l,s);u.setTextureBufferGroup(c)}function jr(e,t,r,i){const s=St(this,Gr,pi).call(this,t,r);s.label="RgbaTexBuffer(".concat(e.getIndex(),")-").concat(s.size);let a=e.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,e,a,s),!a||!a.buffer)return console.warn("[updateRgbaBaseTexLayer()] texLayer(".concat(e.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,vr,qr).call(this,n()(this,At),t,r,i,a),this.markRenderingStateReady()}function Yr(e,t,r,i,s){const a=h.w.CURSOR,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Xr(e,t,r,i,s){const a=h.w.WATERMARK,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function qr(e,t,r,i,s){const a=h.w.VS_BASE,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BASE_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Kr(e,t,r){if(!St(this,Fr,_i).call(this,e))return;if(!n()(this,Ft))return void console.log("drawVideoFrameBaseTextureLayer() canvas is invalid? canvas=".concat(n()(this,Ft)));const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}const p=St(this,kr,ni).call(this);p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Qr(e,t,r){const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}let p=null;p=s.getTextureType()==h.x.EXTERNAL_TEX?St(this,kr,ni).call(this):St(this,Mr,si).call(this,n()(this,Ot)),p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Zr(e,t,r,i,n,s,a){const o=this.isUseFillMode({w:r.width,h:r.height,rotation:i}),h={width:s,height:a},u={width:e,height:t};return Object(xt.c)(o,h,u,r,i,n)}function Jr(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=e.width,o=e.height;s&&(a=s.width,o=s.height);let u,l,c,d,f=i==h.s||i==h.r?r:t,p=i==h.s||i==h.r?t:r,g=f/p*o,m=p/f*a;g>a?(u=0,c=1,l=(o-m)/2/o,d=1-l):(l=0,d=1,u=(a-g)/2/a,c=1-u),u=2*u-1,c=2*c-1,l=1-2*l,d=1-2*d;let _=[{x:c,y:l},{x:c,y:d},{x:u,y:d},{x:c,y:l},{x:u,y:l},{x:u,y:d}];n()(this,Nt)&&n()(this,Nt).updateVertexCoords(_)}function $r(e,t,r,i,n){var s,a,o,u;if(this.isUseFillMode({w:r,h:i,rotation:n}))s=0,a=0,o=1,u=1;else{var l=n==h.s||n==h.r?i:r,c=n==h.s||n==h.r?r:i,d=l/c*t;d>e?(s=0,o=1,u=1-(a=(t-c/l*e)/2/t)):(a=0,u=1,o=1-(s=(e-d)/2/e))}return{top:a=1-2*a,left:s=2*s-1,right:o=2*o-1,bottom:u=1-2*u}}function ei(){n()(this,Nt)||Object(o.u)("[WebGPURenderDisplay] renderer is not attached!")}function ti(e){if(e<0)throw new Error("[hasZIndexTexLayer] ".concat(e," is an invalid parameter!"));return n()(this,cr).has(e)}function ri(e){let t=null;return St(this,Er,ti).call(this,e)?t=n()(this,cr).get(e):(t=new yt(n()(this,At),e),n()(this,cr).set(e,t)),t}function ii(e,t,r){n()(this,Ft)&&(a()(this,rr,e),a()(this,ar,e&&r===tt.N?1:0),a()(this,or,t),e||a()(this,ir,r))}function ni(){const e={rotation:n()(this,Ot)};let t=null,r=n()(this,lr).get(h.w.VS_BASE);if(r){let i=r.buffer,s=r.uniform;if(s)if("yuvMode"in s)i&&i.destroy(),r=null;else if("rotation"in s){if(s.rotation!=e.rotation){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,i)}}else i&&i.destroy(),r=null}if(!r){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r)}return t?(r||(r={}),r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.VS_BASE,r),r):null}function si(e){if(-1==n()(this,nr))return null;const t={yuvMode:tt.V,colorRange:n()(this,nr),rotation:e};let r=null,i=n()(this,lr).get(h.w.VS_BASE);if(i){const e=i.uniform;if(r=i.buffer,e.yuvMode!=t.yuvMode||e.colorRange!=t.colorRange||e.rotation!=t.rotation){const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e,r)}}else{i={};const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e)}return r?(i.uniform=t,i.buffer=r,n()(this,lr).set(h.w.VS_BASE,i),i):null}function ai(){if(!n()(this,ur))return null;const e={cursorFlag:n()(this,or),cursorInfo:n()(this,ur)};let t=null,r=n()(this,lr).get(h.w.CURSOR);if(r){const i=r.uniform;if(t=r.buffer,i.cursorFlag!=e.cursorFlag||i.cursorInfo!=e.cursorInfo){const r=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,t)}}else{r={};const i=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),i)}return t?(r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.CURSOR,r),r):null}function oi(e,t){return Math.ceil(e/t)*t}function hi(e){const t=St(this,Pr,oi).call(this,1*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.rotation,r}function ui(e){const t=St(this,Pr,oi).call(this,3*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.yuvMode,r[1]=e.colorRange,r[2]=e.rotation,r}function li(e){const t=St(this,Pr,oi).call(this,5*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.cursorFlag,r[1]=e.cursorInfo.x,r[2]=e.cursorInfo.y,r[3]=e.cursorInfo.w,r[4]=e.cursorInfo.h,r}function ci(e){if(!e||0==e.length)return null;const t=St(this,Pr,oi).call(this,4*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function di(e,t,r,i){let n=t*r,s=e.subarray(0,n),a=0,o=0;i==tt.V?(o=t/2*r/2,a=o):i==tt.Z&&(o=t*r/2,a=0);let h=e.subarray(n,n+o);return{yPlane:{buffer:s,width:t,height:r},crPlane:{buffer:0!=a?e.subarray(n+o,n+o+a):null,width:t/2,height:r/2},cbPlane:{buffer:h,width:t/2,height:r/2}}}function fi(e,t,r){let i="",n=0,s=0,a=0;r==tt.V?(n=e/2*t/2,s=n,i="i420",a=Uint8Array.BYTES_PER_ELEMENT):r==tt.Z&&(n=e*t/2,s=0,i="nv12",a=Uint16Array.BYTES_PER_ELEMENT);const o=St(this,Pr,oi).call(this,Uint8Array.BYTES_PER_ELEMENT*e,256),h=St(this,Pr,oi).call(this,a*e/2,256);let u=o*t+h*t/2;s>0&&(u+=h*t/2);return{colorFormat:i,size:u,yPlane:{width:o,height:t},uvPlane:{width:h,height:t/2}}}function pi(e,t){const r=St(this,Pr,oi).call(this,Uint32Array.BYTES_PER_ELEMENT*e,256);return{colorFormat:"rgba",width:r,height:t,size:r*t}}function gi(e,t,r){if(t)if(t.buffer)if(r.size>t.buffer.size)n()(this,tr).recycleTextureBufferGroup(e),t.buffer=n()(this,tr).requestTextureBuffer(r),t.bufferConfig=r;else{"mapped"==t.buffer.mapState?t.bufferArray&&t.bufferArray.byteLength1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this),St(this,Ar,ii).call(this,1,n()(this,$t),n()(this,Dt));let i=null;i=t?St(this,Tr,$r).call(this,e.width,e.height,e.width,e.height,h.p):St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot)),St(this,br,Kr).call(this,e,i,r)}drawRemoteVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,Ft))return;if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this);const r=this.isRgbaMode(n()(this,Dt))?1:0;St(this,Ar,ii).call(this,r,n()(this,$t),n()(this,Dt));const i=St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot));St(this,wr,Qr).call(this,e,i,t)}drawCursor(e,t,r,i,s){if(!n()(this,Qt)||e&&(i<0||s<0))return;const o=h.w.CURSOR,u=St(this,Sr,ri).call(this,o),l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(u.setUVCoords(l.getUVCoords()),u.evalViewport(t,r,i,s,n()(this,Ft).height),e&&n()(this,$t)){const e={x:t/n()(this,Mt).width,y:r/n()(this,Mt).height,w:i/n()(this,Mt).width,h:s/n()(this,Mt).height};a()(this,ur,e)}else{const e={x:0,y:0,w:0,h:0};a()(this,ur,e)}const c=St(this,Cr,ai).call(this);c&&c.buffer&&u.setUniformBuffer(c.buffer)}setMultiView(e){a()(this,Vt,e)}setFillMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a()(this,Bt,e),a()(this,Gt,t)}getFillMode(){return n()(this,Bt)}setColorRange(e){a()(this,nr,e)}getFillModeForResolution(){return n()(this,Gt)}getTextureIndex(){return n()(this,kt)}isUseFillMode(e){let{w:t,h:r,rotation:i}=e;if(!n()(this,Bt))return!1;if(!n()(this,Gt))return!0;if(!t||!r)return!1;const s=i===h.s||i===h.s?r/t:t/r;return(Array.isArray(n()(this,Gt))?n()(this,Gt):[n()(this,Gt)]).some(e=>Math.abs(s-e)<.01)}setVideoMode(e){a()(this,Dt,e)}getVideoMode(){return n()(this,Dt)}setWatermarkFlag(e){a()(this,zt,e),e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))}setWatermarkRepeated(e){a()(this,Ht,e)}isWatermarkRepeated(){return!!n()(this,Ht)}setWatermarkOpacity(e){a()(this,jt,e||.15)}getWatermarkOpacity(){return n()(this,jt)}setWatermarkPosition(e){a()(this,Yt,e||16)}getWatermarkPosition(){return n()(this,Yt)}isSetWatermark(){return n()(this,zt)}isRgbaMode(e){return-1!==[tt.ab,tt.N].indexOf(e)}getTextureWidth(){return n()(this,Ct)}getTextureHeight(){return n()(this,Pt)}getCroppingParams(){return n()(this,Mt)}recoverTextures(){}updateWatermark(e,t,r){const i=h.w.WATERMARK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(a()(this,Xt,e),a()(this,qt,t),a()(this,zt,1),a()(this,sr,1),!St(this,Er,ti).call(this,h.w.VS_BASE)){console.log("[updateWatermark] base layer is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};return void s.setRawData(i)}const u=St(this,Sr,ri).call(this,h.w.VS_BASE).getViewport();if(u)try{const i=St(this,Gr,pi).call(this,e,t);i.label="WatermarkTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateWatermark()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,_r,Xr).call(this,n()(this,At),e,t,r,a),u&&s.setViewport(u);let o=s.getUVCoords(),h=St(this,Nr,mi).call(this);o||(o=new Float32Array(12)),o.set(h,0),s.setUVCoords(o),s.setRawData(null),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateWatermark() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateWatermark() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}else{console.log("[updateWatermark] base layer's viewport is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};s.setRawData(i)}}updateCursor(e,t,r){const i=h.w.CURSOR,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();a()(this,Zt,e),a()(this,Jt,t),a()(this,$t,1);try{const i=St(this,Gr,pi).call(this,e,t);i.label="CursorTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return void console.warn("[updateCursor()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!"));if("mapped"!=a.buffer.mapState)return void console.error("updateCursor() why buffer state is not mapped!");St(this,mr,Yr).call(this,n()(this,At),e,t,r,a),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateCursor() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateCursor() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}updateSelfVideoTextures(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;St(this,Rr,ei).call(this);const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Ft)||!n()(this,Nt))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length%4!=0)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(1!=e||1!=t){if(a()(this,Ct,e),a()(this,Pt,t),a()(this,Ot,u),Object.assign(n()(this,Mt),i),!s)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateSelfVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfVideoTextures() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close();St(this,Sr,ri).call(this,h.w.VS_BASE).setPendingVideoFrame(null)}}else{l.setPendingVideoFrame(null),St(this,Vr,vi).call(this),r&&r instanceof VideoFrame&&r.close();const e=St(this,Or,ci).call(this,r);if(e)if(n()(this,Nt)){let t=l.getClearColorUniformBuffer();t=n()(this,Nt).writeUniformBuffer("ClearColorUniformBuffer",e,t),l.setClearColorUniformBuffer(t),l.setTextureType(h.x.CLEAR_COLOR)}else console.warn("updateSelfVideoTextures() renderer is not attached!");else Object(o.u)("updateSelfVideoTextures() cannot create the uniform buffer array.");this.markRenderingStateReady()}}updateRemoteVideoTexturesImageBitmap(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Nt)||!n()(this,Ft))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(a()(this,Ct,e),a()(this,Pt,t),Number.isNaN(s)||a()(this,Ot,s),Object.assign(n()(this,Mt),i),!u)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close(),l.setPendingVideoFrame(null)}}updateRemoteVideoTextures(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6?arguments[6]:void 0;const c=h.w.VS_BASE,d=St(this,Sr,ri).call(this,c);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(!St(this,Fr,_i).call(this,l))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();St(this,Rr,ei).call(this);const f=this.isRgbaMode(n()(this,Dt));if(e<=0||t<=0||!i||!i.length||i.length!=e*t*3/2&&!f||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();if(f)try{St(this,fr,zr).call(this,e,t,i,!0);let o=u?0:1;a()(this,nr,o),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height)}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),d.setPendingVideoFrame(null),this.markRenderingStatePending()}finally{n()(this,tr).recycleTextureBufferGroup(d)}else try{const o=St(this,Br,fi).call(this,e,t,n()(this,Dt));o.label="YuvVideoTexBuffer(".concat(d.getIndex(),")-").concat(o.size),d.setColorFormat(o.colorFormat);let h=d.getTextureBufferGroup();if(h=St(this,Wr,gi).call(this,d,h,o),!h||!h.buffer)return console.warn("[updateRemoteVideoTextures()] texLayer(".concat(d.getIndex(),") cannot apply a GPUBuffer!")),void this.markRenderingStatePending();let l=u?0:1;a()(this,nr,l),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),St(this,pr,Hr).call(this,n()(this,At),e,t,i,h,n()(this,Dt)),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message," cs:").concat(e.stack)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(d),this.markRenderingStatePending()}}drawNextOutputPictureFrame(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];const d=h.w.VS_BASE,f=St(this,Sr,ri).call(this,d);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(f),void this.markRenderingStatePending();s=s||h.p;let p=(r=r||{top:0,left:0,width:e,height:t}).width!=n()(this,Mt).width||r.height!=n()(this,Mt).height,g=r.top!=n()(this,Mt).top||r.left!=n()(this,Mt).left,m=n()(this,Ft).width!=n()(this,Ut)||n()(this,Ft).height!=n()(this,Lt),_=e!=n()(this,Ct)||t!=n()(this,Pt),v=s!=n()(this,It);if((p||m||v)&&St(this,xr,Jr).call(this,n()(this,Ft),r.width,r.height,s,l),l){const e=Object(xt.d)(r,s),t=Object(xt.a)(l,e);f.evalViewport(t.x,t.y,t.width,t.height,n()(this,Ft).height)}else f.evalViewport(0,0,n()(this,Ft).width,n()(this,Ft).height,n()(this,Ft).height);if(p||g||_||v||!f.getUVCoords()){let i=Object(xt.b)({width:e,height:t},r,n()(this,Ft),s),a=f.getUVCoords();a||(a=new Float32Array(12)),a.set(i),f.setUVCoords(a)}let b=u?0:1;b!=n()(this,nr)&&a()(this,nr,b),a()(this,rr,0),a()(this,ir,tt.V),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,It,s),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),f.setColorFormat("i420");try{const r=St(this,Br,fi).call(this,e,t,tt.V);if(r.label="YuvShareTexBuffer(".concat(f.getIndex(),")-").concat(r.size),c){let s=f.getTextureBufferGroup();if(s=St(this,Wr,gi).call(this,f,s,r),!s||!s.buffer)return console.warn("[drawNextOutputPictureFrame()] texLayer(".concat(f.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,pr,Hr).call(this,n()(this,At),e,t,i,s,tt.V);const a=St(this,Mr,si).call(this,n()(this,It));a&&a.buffer&&f.setUniformBuffer(a.buffer)}n()(this,$t)?a()(this,or,1):a()(this,or,0),a()(this,Qt,1),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] drawNextOutputPictureFrame() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_drawNextOutputPictureFrame() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(f),this.markRenderingStatePending()}}clearCanvas(e){n()(this,Nt)&&n()(this,Nt).clearAttachedCanvas()}updateSelfMaskImage(e,t,r){const i=h.w.MASK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(!St(this,Er,ti).call(this,h.w.VS_BASE))return console.log("[updateSelfMaskImage] base layer is not ready."),n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();try{const i=St(this,Gr,pi).call(this,e,t);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateSelfMaskImage()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();if(a.buffer.label="SelfMaskImageTexBuffer(".concat(s.getIndex(),")-").concat(i.size),s.setTextureLayerType(h.v.BLEND_LAYER),s.setTextureType(h.x.GPU_TEX_RGBA),s.isLocked()){const r=s.getWidth(),i=s.getHeight();r==e&&i==t||(s.setWidth(e),s.setHeight(t),s.setIsNew(!0))}else s.setWidth(e),s.setHeight(t),s.setIsNew(!0),s.lock();const o=n()(this,Nt).writeToRgbaTextureBuffer(n()(this,At),e,t,r,a);s.setTextureBufferGroup(o);const u=St(this,Sr,ri).call(this,h.w.VS_BASE),l=u.getViewport();l&&s.setViewport(l),s.setUVCoords(u.getUVCoords()),this.isSetWatermark()&&n()(this,Xt)&&n()(this,qt),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateSelfMaskImage() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfMaskImage() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}readPixelsSyncRequest(e,t,r,i){}isAvaiable(){return!0}markRenderingStateReady(){a()(this,Kt,h.k.READY)}markRenderingStateRendering(){a()(this,Kt,h.k.RENDERING)}markRenderingStatePending(){a()(this,Kt,h.k.PENDING)}markRenderingStateIdle(){a()(this,Kt,h.k.IDLE)}isRenderingStateReady(){return n()(this,Kt)===h.k.READY}isInTargetRenderingState(e){return n()(this,Kt)===e}getWatermarkWidth(){return n()(this,Xt)}getWatermarkHeight(){return n()(this,qt)}getIndex(){return n()(this,At)}getRenderingState(){return n()(this,Kt)}recycle(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(const[t,r]of n()(this,cr))r&&(n()(this,tr).recycleTextureBufferGroup(r,e),r.recycle(n()(this,tr)));a()(this,dr,{top:0,left:0,bottom:0,right:0}),this.markRenderingStateIdle(),n()(this,cr).clear(),n()(this,lr).clear(),this.unbindSsrc()}cleanup(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.recycle(e),this.removeRenderer(),this.detachCanvas(),this.removeGPUResMgr()}clear(){console.log("WebGPURenderDisplay.clear"),this.clearCanvas(),a()(this,Qt,0),a()(this,$t,0),this.recycle()}clearDisplay(){console.log("WebGPURenderDisplay.clearDisplay"),this.clearCanvas()}getTextureLayersMap(){return n()(this,cr)}getTextureLayerByZIndex(e){return St(this,Sr,ri).call(this,e)}getUsedBuffersCount(){let e=0;for(const[t,r]of n()(this,cr))r&&r.getTextureBufferGroup()&&r.getTextureBufferGroup().buffer&&e++;return e}consumePendingGPUEvents(){if(n()(this,zt)){const e=St(this,Sr,ri).call(this,h.w.WATERMARK).getRawData();e&&this.updateWatermark(n()(this,Xt),n()(this,qt),e.data)}}resizeCanvasTo(e,t){n()(this,Ft)&&(n()(this,Ft).width=e,n()(this,Ft).height=t)}};function wi(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var yi=new WeakMap,xi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Ei=new WeakMap;var Si=class{constructor(e,t,r){wi(this,yi,{writable:!0,value:0}),wi(this,xi,{writable:!0,value:null}),wi(this,Ti,{writable:!0,value:null}),wi(this,Ri,{writable:!0,value:h.t.AVAILABLE}),wi(this,Ei,{writable:!0,value:null}),a()(this,yi,e),a()(this,Ri,t),a()(this,Ei,r),a()(this,xi,[]),a()(this,Ti,[])}initPool(e){if(e>n()(this,yi))throw new Error("initSize=".concat(e," is larger than maxSize=").concat(n()(this,yi),", invalid!"));if(e<0)throw new Error("initSize=".concat(e," is smaller than 0, invalid!"));for(let t=0;t=n()(this,yi))return;let t=0;if(n()(this,xi).length+e>=n()(this,yi)&&(t=n()(this,yi)-n()(this,xi).length),t>0){const e=n()(this,xi).length;for(let r=0;r0&&void 0!==arguments[0])||arguments[0])&&this.isPoolEmpty()&&this.expandPool(4);const e=n()(this,xi).pop();return e&&(e.markRenderingStatePending(),n()(this,Ti).push(e)),e}recycle(e){if(n()(this,xi).length0&&void 0!==arguments[0])||arguments[0];n()(this,xi).forEach(t=>{t.cleanup(e)}),n()(this,Ti).forEach(t=>{t.cleanup(e)}),a()(this,xi,[]),a()(this,Ti,[])}isPoolEmpty(){return 0==n()(this,xi).length}getInUseRenderDisplays(){return n()(this,Ti)}getAllRenderDisplays(){return n()(this,xi)}isServeForVideoRendering(){return n()(this,Ri)===h.t.VIDEO}isServeForShareRendering(){return n()(this,Ri)===h.t.SHARE}isServingForNow(e){return n()(this,Ri)===e}};function Ai(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ki=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Pi=new WeakMap,Ui=new WeakMap;class Li{getVideoRenderDisplay(e,t,r,i){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getSharingRenderDisplay(e,t,r){throw new Error("getSharingRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,r){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}var Ii=new WeakMap,Oi=new WeakMap;class Di extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Ii,{writable:!0,value:new Map}),Ai(this,Oi,{writable:!0,value:!1}),a()(this,Oi,e)}setCanvasAlphaChannelEnability(e){a()(this,Oi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Ze.a(e,t,r,s,a,o,h,n()(this,Oi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Ii).get(e);if(!a){let i=[];a=[i,[]],n()(this,Ii).set(e,a);let o=new Ze.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Oi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Ze.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,n()(this,Oi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Ii).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Ze.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Oi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Ii).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Ii).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Ii).delete(r),n()(this,Ii).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Ii)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t,null);for(const[e,t]of n()(this,Ii)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Ii,new Map)}cleanupByCanvas(e){if(n()(this,Ii).get(e)){let t=n()(this,Ii).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Ii).delete(e)}}}}var Bi=new WeakMap,Gi=new WeakMap;class Wi extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Bi,{writable:!0,value:new Map}),Ai(this,Gi,{writable:!0,value:!1}),a()(this,Gi,e)}setCanvasAlphaChannelEnability(e){a()(this,Gi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Je.a(e,t,r,s,a,o,h,n()(this,Gi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Bi).get(e);if(!a){let i=[];a=[i,[]],n()(this,Bi).set(e,a);let o=new Je.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Gi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Je.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,void 0,n()(this,Gi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Bi).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Je.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Gi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Bi).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Bi).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Bi).delete(r),n()(this,Bi).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Bi)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t);for(const[e,t]of n()(this,Bi)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Bi,new Map)}cleanupByCanvas(e){if(n()(this,Bi).get(e)){let t=n()(this,Bi).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Bi).delete(e)}}}}var Ni=new WeakMap,Fi=new WeakMap,Vi=new WeakMap;class zi extends Li{constructor(){super(),Ai(this,Ni,{writable:!0,value:new Map}),Ai(this,Fi,{writable:!0,value:new Map}),Ai(this,Vi,{writable:!0,value:null})}setGPUResourceMgr(e){a()(this,Vi,e)}getVideoRenderDisplay(e,t,r,i){let s=n()(this,Ni).get(e);s||(s=new Si(r,h.t.VIDEO,n()(this,Vi)),s.initPool(r),n()(this,Ni).set(e,s));let a=s.pop();return a?(a.setMultiView(!0),a):null}getSharingRenderDisplay(e,t,r){r&&r.clearCache&&n()(this,Fi).clear();let i=n()(this,Fi).get(e);return i||(i=new Si(1,h.t.SHARE,n()(this,Vi)),i.initPool(1),n()(this,Fi).set(e,i)),i.pop()}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=new bi(r,n()(this,Vi));return s.addRenderer(i),s.attachCanvas(e),s}getInUseCanvasRenderDisplayList(e){let t=[],r=null;if(e==h.t.VIDEO?r=n()(this,Ni):e==h.t.SHARE&&(r=n()(this,Fi)),r)for(const[e,i]of r){let r={};r.canvas=e,r.renderDisplays=i.getInUseRenderDisplays(),r.renderDisplays.length>0&&t.push(r)}return t}recycleRenderDisplay(e,t){if(e){const t=e.getAttachedCanvas();if(t){let r=n()(this,Ni).get(t);r&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),r.recycle(e));let i=n()(this,Fi).get(t);i&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),i.recycle(e))}}}cleanup(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null==e||null===(t=e.cleanup)||void 0===t||t.call(e,r);for(const[e,t]of n()(this,Ni))t.cleanup(r);for(const[e,t]of n()(this,Fi))t.cleanup(r)}cleanupByCanvas(e){let t=n()(this,Ni).get(e);t&&(t.cleanup(),n()(this,Ni).delete(e));let r=n()(this,Fi).get(e);r&&(r.cleanup(),n()(this,Fi).delete(e))}collectInUseRenderDisplays(e){return this.getInUseCanvasRenderDisplayList(e)}collectInUseRenderDisplaysByCanvas(e,t){let r=null;if(e)if(t==h.t.VIDEO){r=n()(this,Ni).get(e).getInUseRenderDisplays()}else if(t==h.t.SHARE){r=n()(this,Fi).get(e).getInUseRenderDisplays()}return r}getRenderDisplayMap(e){let t=null;return e==h.t.VIDEO?t=n()(this,Ni):e==h.t.SHARE&&(t=n()(this,Fi)),t}}var Hi=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ai(this,ki,{writable:!0,value:null}),Ai(this,Mi,{writable:!0,value:null}),Ai(this,Ci,{writable:!0,value:null}),Ai(this,Pi,{writable:!0,value:null}),Ai(this,Ui,{writable:!0,value:!1}),a()(this,Ui,e)}setGPUResourceMgr(e){a()(this,Pi,e)}isEnableCanvasAlphaChannel(){return n()(this,Ui)}setCanvasAlphaChannelEnability(e){a()(this,Ui,e),n()(this,ki)&&n()(this,ki).setCanvasAlphaChannelEnability(e),n()(this,Mi)&&n()(this,Mi).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),n()(this,ki)}getWebGL2RenderDisplayMgr(){return n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),n()(this,Mi)}getWebGPURenderDisplayMgr(){return n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),n()(this,Ci)}getVideoRenderDisplay(e,t,r,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),l=n()(this,ki).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),l=n()(this,Mi).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),l=n()(this,Ci).getVideoRenderDisplay(t,r,i,s),l&&(l.addRenderer(o),l.attachCanvas(t),l.setGPUResMgr(n()(this,Pi)))),l}getSharingRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),o=n()(this,ki).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),o=n()(this,Mi).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),o=n()(this,Ci).getSharingRenderDisplay(t,r,s),o&&(o.addRenderer(i),o.attachCanvas(t),o.setGPUResMgr(n()(this,Pi)))),o}createVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=null;return e==h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),u=n()(this,ki).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),u=n()(this,Mi).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),u=n()(this,Ci).createVideoRenderDisplay(t,r,i,s,o),u.addRenderer(s),u.attachCanvas(t),u.setGPUResMgr(n()(this,Pi))),u}recycleRenderDisplay(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e===h.j.WEBGPU?n()(this,Ci)&&n()(this,Ci).recycleRenderDisplay(r,i,s):e===h.j.WEBGL?n()(this,ki)&&n()(this,ki).recycleRenderDisplay(t,r,s):e===h.j.WEBGL_2&&n()(this,Mi)&&n()(this,Mi).recycleRenderDisplay(t,r,s)}collectInUseRenderDisplays(e,t){let r=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(r=n()(this,Ci).collectInUseRenderDisplays(t)),r}collectInUseRenderDisplaysByCanvas(e,t,r){let i=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(i=n()(this,Ci).collectInUseRenderDisplaysByCanvas(t,r)),i}getRenderDisplayMap(e,t){if(e===h.j.WEBGL){if(n()(this,ki))return n()(this,ki).getRenderDisplayMap()}else if(e===h.j.WEBGPU){if(n()(this,Ci))return n()(this,Ci).getRenderDisplayMap(t)}else if(e===h.j.WEBGL_2&&n()(this,Mi))return n()(this,Mi).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,ki)?n()(this,ki).onRestoredFromContextLost(e,t,r,i,s,a):n()(this,Mi)?n()(this,Mi).onRestoredFromContextLost(e,t,r,i,s,a):null}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==n()(this,ki)&&n()(this,ki).cleanup(e,t),n()(this,Mi)&&n()(this,Mi).cleanup(e,t),null!==n()(this,Ci)&&n()(this,Ci).cleanup(t,r)}cleanupByCanvas(e){null!==n()(this,ki)&&n()(this,ki).cleanupByCanvas(e),null!==n()(this,Mi)&&n()(this,Mi).cleanupByCanvas(e),null!==n()(this,Ci)&&n()(this,Ci).cleanupByCanvas(e)}};function ji(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var Yi=new WeakMap,Xi=new WeakMap,qi=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;var $i=class{constructor(e){ji(this,Yi,{writable:!0,value:h.f.VERTEX_BUFFER}),ji(this,Xi,{writable:!0,value:{}}),ji(this,qi,{writable:!0,value:null}),ji(this,Ki,{writable:!0,value:0}),ji(this,Qi,{writable:!0,value:0}),ji(this,Zi,{writable:!0,value:[]}),ji(this,Ji,{writable:!0,value:new Map}),a()(this,qi,e)}acquireBuffer(e,t,r){let i,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?n()(this,Ji).has(e)?i=n()(this,Ji).get(e):n()(this,Zi).length>0?(i=n()(this,Zi).pop(),n()(this,Ji).set(e,i)):(i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),n()(this,Ji).set(e,i)):i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),i}releaseBuffer(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Ji).has(e)){const t=n()(this,Ji).get(e);r?n()(this,Zi).push(t):t.destroy(),n()(this,Ji).delete(e)}else r||-1!=n()(this,Zi).indexOf(t)&&(n()(this,Zi)[index]=n()(this,Zi)[n()(this,Zi).length-1],n()(this,Zi).pop(),t.destroy())}getNumUsedBuffers(){return n()(this,Ki)}getNumFreeBuffers(){return n()(this,Qi)}cleanup(){n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Ji).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,n()(this,Ji).clear(),a()(this,Ki,0),a()(this,Qi,0)}release(e){e==h.n.OVERUSE&&(n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,a()(this,Qi,0))}getResourceType(){return n()(this,Yi)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Ji))e++,t+=s.size,r+="[GPUBufferMgr] entry{key:".concat(i,", buffer:{label:").concat(s.label," size:").concat(s.size,"}}\n");for(const r of n()(this,Zi))e++,t+=r.size;return r+="[GPUBufferMgr] freeBuffers{size:".concat(n()(this,Zi).length,"}\n"),r+="[GPUBufferMgr] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,Xi).type=n()(this,Yi),n()(this,Xi).count=e,n()(this,Xi).usedBytes=t,n()(this,Xi).output=r,n()(this,Xi)}onOccupancyLevelEvaluated(e){console.log("[GPUBufferManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUBufferManager_onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}};function en(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var tn=new WeakMap,rn=new WeakMap,nn=new WeakMap;var sn=class{constructor(){en(this,tn,{writable:!0,value:h.f.TEXTURE}),en(this,rn,{writable:!0,value:[]}),en(this,nn,{writable:!0,value:[]})}acquire(e){let t=null;const r=n()(this,rn).findIndex(t=>t&&t.width==e.w&&t.height==e.h&&t.format==e.format&&t.usage==e.usage);return r>-1&&(t=n()(this,rn).splice(r,1)[0]),t&&n()(this,nn).push(t),t}recycle(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=n()(this,nn).indexOf(e);-1!=r&&n()(this,nn).splice(r,1),t?e.destroy():(n()(this,rn).push(e),e.label="")}pushToAvailablePool(e){e&&n()(this,rn).push(e)}pushToInUsePool(e){e&&n()(this,nn).push(e)}release(e){if(e==h.n.OVERUSE&&n()(this,rn).length>0){for(const e of n()(this,rn))e.destroy();n()(this,rn).length=0}}cleanup(){for(const e of n()(this,rn))e.destroy();for(const e of n()(this,nn))e.destroy();n()(this,rn).length=0,n()(this,nn).length=0}getAvailablePool(){return n()(this,rn)}getInUsedPool(){return n()(this,nn)}getResourceType(){return n()(this,tn)}};function an(e,t){hn(e,t),t.add(e)}function on(e,t,r){hn(e,t),t.set(e,r)}function hn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function un(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakSet,gn=new WeakSet,mn=new WeakSet,_n=new WeakSet,vn=new WeakSet;function bn(e){let t=n()(this,dn).get(e.level),r=null;return t?(r=t.acquire(e),r||(r=un(this,mn,yn).call(this,e),r?t.pushToInUsePool(r):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e))))):(r=un(this,mn,yn).call(this,e),r?(t=new sn,t.pushToInUsePool(r),n()(this,dn).set(e.level,t)):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e)))),r}function wn(e){const t=e.zOrder;let r=n()(this,fn).get(t);return r?(e.w>r.width||e.h>r.height)&&(r.destroy(),r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)):(r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)),r}function yn(e){if(!n()(this,ln))return null;if(0==e.w||0==e.h)return null;const t={size:{width:e.w,height:e.h},format:e.format,usage:e.usage};return e.sampleCount>0&&(t.sampleCount=e.sampleCount),n()(this,ln).createTexture(t)}function xn(e){let t=h.u[h.u.length-1];for(let r=0;r1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=this.assembleTextureConfig(e.width,e.height,e.usage,e.format,e.sampleCount);let i=n()(this,dn).get(r.level);if(i)i.recycle(e,t);else if(console.warn("recycleTexture(".concat(e.label,") texture is not found in the map!, destroy:").concat(t)),t)e.destroy();else{const t=new sn;t.pushToAvailablePool(e),n()(this,dn).set(r.level,t)}}cleanup(){for(const[e,t]of n()(this,dn))t&&t.cleanup();n()(this,dn).clear()}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,dn))if(s){const n=s.getAvailablePool();for(const r of n)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);const a=s.getInUsedPool();for(const r of a)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);(n.length>0||a.length>0)&&(r+="[GPUTexturePool] level:".concat(i," pool:{ava_count:").concat(n.length," in_used_count:").concat(a.length,"}\n"))}return r+="[GPUTexturePool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,cn).type=h.f.TEXTURE,n()(this,cn).count=e,n()(this,cn).usedBytes=t,n()(this,cn).output=r,n()(this,cn)}onOccupancyLevelEvaluated(e){if(console.log("[GPUTextureManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUTextureManager_onOccupancyLevelEvaluated() level:".concat(e)),e==h.n.OVERUSE)for(const[t,r]of n()(this,dn))r&&r.release(e)}};function En(e,t){An(e,t),t.add(e)}function Sn(e,t,r){An(e,t),t.set(e,r)}function An(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function kn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Mn=new WeakMap,Cn=new WeakMap,Pn=new WeakMap,Un=new WeakMap,Ln=new WeakSet,In=new WeakSet;function On(e,t,r){if(n()(this,Pn).set(e,t),r){let e=Array.from(n()(this,Pn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Pn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Pn).set(t,r)})}}function Dn(e,t){if(!e||0==e.length)return null;let r=0,i=0,n=null;for(const s of e)"mapped"==s.mapState?(r+=1,n||s.size>=t&&(n=s)):i+=1;if(r>0&&0==i||r>=2&&0!=i){if(n){const t=e.indexOf(n);-1!=t&&e.splice(t,1)}return n}return null}var Bn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;En(this,In),En(this,Ln),Sn(this,Mn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Sn(this,Cn,{writable:!0,value:0}),Sn(this,Pn,{writable:!0,value:new Map}),Sn(this,Un,{writable:!0,value:0}),a()(this,Cn,e),a()(this,Un,t)}isUpToThreshold(e,t){if(e!=n()(this,Cn)||t<=0)return!1;if(0==n()(this,Un))return!1;const r=n()(this,Pn).get(t);return!!r&&r.length>=n()(this,Un)}push(e,t,r){if(e!=n()(this,Cn)||!r||t<=0)return!1;let i=null,s=!1;if(n()(this,Pn).has(t)){if(i=n()(this,Pn).get(t),i||(i=[],s=!0),!(i.length1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r=e.level,i=e.bytesPerRow,s=e.size;if(r!=n()(this,Cn)||i<=0)return console.error("[GPUBufferPoolEntry] acquire() level(".concat(r,") or bpr=").concat(i," is invalid!")),null;let a=null,o=!1;if(n()(this,Pn).has(i)){let e=n()(this,Pn).get(i);if(e){const t=e.findIndex(e=>"mapped"==e.mapState&&e.size>=s);t>-1?a=e.splice(t,1)[0]:o=!0}else o=!0}else o=!0;if(o&&!a&&!t){let t=2,o=!1;r>=h.m[h.h]&&(o=!0);for(const[r,h]of n()(this,Pn))if((t>0||o)&&r>i){if(a=kn(this,In,Dn).call(this,h,s),a){e.bytesPerRow=r;break}t--}}return a}recycle(e,t,r){if(e!=n()(this,Cn)||t<=0||!r)return!1;let i=!1;if(n()(this,Pn).has(t)){let e=!1,s=n()(this,Pn).get(t);s||(s=[],e=!0),s.push(r),e&&kn(this,Ln,On).call(this,t,s,e),i=!0}else i=this.push(e,t,r);return i}release(e){if(e==h.n.OVERUSE){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}}cleanup(){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}getPool(){return n()(this,Pn)}hasBytesPerRowAsKey(e){return n()(this,Pn).has(e)}getResourceType(){return n()(this,Mn)}getPoolThreshold(){return n()(this,Un)}canLendBufferCrossLevel(e,t){let r=!0;if(n()(this,Pn).has(t)){const i=n()(this,Pn).get(t);if(i){let t=0,n=0;for(const e of i)"mapped"==e.mapState?t+=1:n+=1;if(e>=h.m[h.h])r=t>0;else{const e=t>=2&&0!=n;r=t>0&&0==n||e}}}else r=!1;return r}};function Gn(e,t){Nn(e,t),t.add(e)}function Wn(e,t,r){Nn(e,t),t.set(e,r)}function Nn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Vn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,qn=new WeakSet,Kn=new WeakSet,Qn=new WeakSet,Zn=new WeakSet,Jn=new WeakSet,$n=new WeakSet,es=new WeakSet;function ts(e){if(!e)return;const t=e.colorFormat;if("rgba"==t){const t=Fn(this,Kn,rs).call(this,e.height);t>0&&t0&&t0&&t-1&&t+1<=h.m.length-1?h.m[t+1]:e}function ns(e){if(!e)return 0;let t=0;const r=e.colorFormat;if("rgba"==r?t=e.height:"i420"!=r&&"nv12"!=r||(t=e.yPlane.height),0==t)return 0;let i=0;return i=t<=h.m[2]?90:t>h.m[2]&&t<=h.m[5]?60:15,i}function ss(e){return e.mapAsync(GPUMapMode.WRITE,0,e.size)}function as(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Yn).set(e,t),r){let e=Array.from(n()(this,Yn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Yn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Yn).set(t,r)})}}function os(e){if(!e)return null;let t=e.level,r=e.bytesPerRow;e.size;const i=Fn(this,Qn,is).call(this,t);if(i<=t)return null;if(!n()(this,Yn).has(i))return null;const s=n()(this,Yn).get(i);if(!s)return null;if(!s.hasBytesPerRowAsKey(r))return null;if(!s.canLendBufferCrossLevel(t,r))return null;const a={};Object.assign(a,e),a.level=i;const o=s.acquire(a,!0);return o&&(e.level=i,e.bytesPerRow=a.bytesPerRow),o}var hs=class{constructor(e){Gn(this,es),Gn(this,$n),Gn(this,Jn),Gn(this,Zn),Gn(this,Qn),Gn(this,Kn),Gn(this,qn),Wn(this,Vn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Wn(this,zn,{writable:!0,value:{}}),Wn(this,Hn,{writable:!0,value:null}),Wn(this,jn,{writable:!0,value:[]}),Wn(this,Yn,{writable:!0,value:new Map}),Wn(this,Xn,{writable:!0,value:0}),a()(this,Hn,e)}acquire(e){if(!e)throw new Error("acquire() bufferConfig is invalid!");Fn(this,qn,ts).call(this,e);let t=null,r=null;if(0==n()(this,Yn).size){if(n()(this,Hn)){const i=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});let s=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),s=!0}i&&(a()(this,Xn,n()(this,Xn)+1),t=i,t.label="".concat(e.label,"-").concat(n()(this,Xn))),Fn(this,$n,as).call(this,e.level,r,s)}}else if(n()(this,Yn).has(e.level)){r=n()(this,Yn).get(e.level);let i=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}if(t=r.acquire(e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else if(t=Fn(this,es,os).call(this,e),!t)if(r.isUpToThreshold(e.level,e.bytesPerRow))console.log("[GPUBufferPool]acquire() next level cant help and pool is up to threshold! Only to wait for a while...");else{const r=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});r&&(a()(this,Xn,n()(this,Xn)+1),t=r,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}else{let i=!1;if(t=Fn(this,es,os).call(this,e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else{const s=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}s&&(a()(this,Xn,n()(this,Xn)+1),t=s,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}return t&&n()(this,jn).push(t),t}recycle(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return;const i=n()(this,jn).indexOf(e);if(-1!=i?n()(this,jn).splice(i,1):(console.error("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r)),Object(o.o)("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r))),t)if(r){"unmapped"!=e.mapState&&e.unmap(),"unmapped"==e.mapState&&Fn(this,Jn,ss).call(this,e).then(()=>{}).catch(t=>{console.warn("mapAsyncBuffer() error:".concat(t)),e.destroy(),e=null});let r=n()(this,Yn).get(t.level);r&&r.recycle(t.level,t.bytesPerRow,e),e.label=""}else e.destroy(),e=null;else e.destroy()}recycleInUsedGPUBuffers(e,t){for(const[r,i]of e)for(const e of i)if(e){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),this.recycle(r.buffer,r.bufferConfig)),e.destroyTextureBufferGroup(t)}}recycleTextureBufferGroup(e,t){if(e&&t){const r=t.acquireGPUBufferPool();if(r){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),r.recycle(i.buffer,i.bufferConfig),e.destroyTextureBufferGroup(t))}}}cleanup(){for(const e of n()(this,jn))"unmapped"!=e.mapState&&e.unmap(),e.destroy();n()(this,jn).length=0;for(const[e,t]of n()(this,Yn))t&&t.cleanup();n()(this,Yn).clear()}release(e){if(e==h.n.OVERUSE){for(const[t,r]of n()(this,Yn))r&&r.release(e);n()(this,Yn).clear()}}getResourceType(){return n()(this,Vn)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Yn))if(s){const n=s.getPool();for(const[a,o]of n){e+=o.length;let n=0,h=0;for(const e of o)t+=e.size,"mapped"==e.mapState?n+=1:h+=1;r+="[GPUBufferPool] level:".concat(i," bpr:").concat(a," threshold:").concat(s.getPoolThreshold()," pool:{len:").concat(o.length," ava_count:").concat(n," pending_count:").concat(h,"}\n")}}let i=0;for(const r of n()(this,jn))e+=1,t+=r.size,i+=1;return r+="[GPUBufferPool] in_used_count:".concat(i,"\n"),r+="[GPUBufferPool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,zn).type=n()(this,Vn),n()(this,zn).count=e,n()(this,zn).usedBytes=t,n()(this,zn).output=r,n()(this,zn)}onOccupancyLevelEvaluated(e){Object(o.o)("WGPU GPUBufferPool_onOccupancyLevelEvaluated() level:".concat(e)),console.log("[GPUBufferPool] onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}getInUsedPoolCount(){return n()(this,jn).length}};function us(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ls=new WeakMap,cs=new WeakMap;var ds=class{constructor(e){us(this,ls,{writable:!0,value:null}),us(this,cs,{writable:!0,value:null}),a()(this,ls,e),e&&a()(this,cs,e.features)}getAdapterFeatures(){return n()(this,cs)}getAdapterLimits(){return n()(this,ls)?n()(this,ls).limits:null}queryMaxTextureDimension2D(){const e=this.getAdapterLimits();return e?e.maxTextureDimension2D:0}queryMaxBufferSize(){const e=this.getAdapterLimits();return e?e.maxBufferSize:0}queryAdapterFeature(e){return!(!n()(this,cs)||!e)&&n()(this,cs).has(e)}isTimestampQuerySupported(){return this.queryAdapterFeature("timestamp-query")}getGPUAdapter(){return n()(this,ls)}cleanup(){a()(this,ls,null),a()(this,cs,null)}};function fs(e,t){gs(e,t),t.add(e)}function ps(e,t,r){gs(e,t),t.set(e,r)}function gs(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ms(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var _s=new WeakMap,vs=new WeakMap,bs=new WeakMap,ws=new WeakMap,ys=new WeakSet,xs=new WeakSet,Ts=new WeakSet;function Rs(){let e=h.n.LOW;const t="---WatchDog(".concat(n()(this,ws),") starts analyzing---\n");console.log("".concat(t));for(const t of n()(this,vs)){const r=t.collectResourceInfo();console.log("".concat(r.output));const i=ms(this,xs,Es).call(this,r);t.onOccupancyLevelEvaluated(i),i>e&&(e=i)}const r=ms(this,Ts,Ss).call(this,e);r!=n()(this,_s)&&(clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,r),this.monitor())}function Es(e){let t=h.n.LOW;return e.type==h.f.TEXTURE?t=e.usedBytes<=31457280?h.n.LOW:e.usedBytes<=94371840?h.n.MEDIUM:e.usedBytes<=157286400?h.n.HIGH:h.n.OVERUSE:e.type==h.f.VERTEX_BUFFER?t=e.usedBytes<=5242880?h.n.LOW:e.usedBytes<=10485760?h.n.MEDIUM:e.usedBytes<=15728640?h.n.HIGH:h.n.OVERUSE:e.type==h.f.TEXTURE_BUFFER&&(t=e.usedBytes<=52428800?h.n.LOW:e.usedBytes<=104857600?h.n.MEDIUM:e.usedBytes<=209715200?h.n.HIGH:h.n.OVERUSE),t}function Ss(e){let t=0;switch(e){case h.n.LOW:t=h.o.LOW;break;case h.n.MEDIUM:t=h.o.MEDIUM;break;case h.n.HIGH:t=h.o.HIGH;break;case h.n.OVERUSE:t=h.o.OVERUSE;break;default:t=h.o.MEDIUM}return t}var As=class{constructor(e){fs(this,Ts),fs(this,xs),fs(this,ys),ps(this,_s,{writable:!0,value:h.o.HIGH}),ps(this,vs,{writable:!0,value:[]}),ps(this,bs,{writable:!0,value:null}),ps(this,ws,{writable:!0,value:""}),a()(this,ws,e)}addObservable(e){n()(this,vs).push(e)}removeObservable(e){const t=n()(this,vs).indexOf(e);-1!=t&&n()(this,vs).splice(t,1)}removeAllObservables(){n()(this,vs).length=0}monitor(){n()(this,bs)||a()(this,bs,setInterval(()=>{ms(this,ys,Rs).call(this)},n()(this,_s)))}cleanup(){this.removeAllObservables(),clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,0)}};function ks(e,t,r){Ms(e,t),t.set(e,r)}function Ms(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}var Cs=new WeakMap,Ps=new WeakMap,Us=new WeakMap,Ls=new WeakMap,Is=new WeakMap,Os=new WeakMap,Ds=new WeakMap,Bs=new WeakMap,Gs=new WeakMap,Ws=new WeakMap,Ns=new WeakMap,Fs=new WeakSet;function Vs(e){return void 0!==e&&"yPlaneTex"in e}var zs=class{constructor(){var e,t;Ms(e=this,t=Fs),t.add(e),ks(this,Cs,{writable:!0,value:null}),ks(this,Ps,{writable:!0,value:null}),ks(this,Us,{writable:!0,value:null}),ks(this,Ls,{writable:!0,value:null}),ks(this,Is,{writable:!0,value:null}),ks(this,Os,{writable:!0,value:null}),ks(this,Ds,{writable:!0,value:null}),ks(this,Bs,{writable:!0,value:null}),ks(this,Gs,{writable:!0,value:null}),ks(this,Ws,{writable:!0,value:null}),ks(this,Ns,{writable:!0,value:""})}addRendererProviderModule(e){a()(this,Ws,e)}setLabel(e){a()(this,Ns,e)}async initialize(){if(navigator.gpu){if(!n()(this,Cs)&&(a()(this,Cs,await navigator.gpu.requestAdapter()),!n()(this,Cs)))return console.error("[WebGPUResManager] initialize() Couldn't request WebGPU adapter."),Object(o.u)("WebGPU device was lost: ".concat(info.message," reason=").concat(info.reason)),void Object(o.p)("WebGPUDeviceLost");n()(this,Us)||(a()(this,Us,await n()(this,Cs).requestDevice()),n()(this,Us).lost.then(async e=>{"destroyed"!=e.reason&&(console.error("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.u)("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.p)("WebGPUDeviceLost")),n()(this,Ws)&&n()(this,Ws).rendererUnconfigureGPUContext(),this.cleanup(),"destroyed"!=e.reason&&(a()(this,Us,null),await this.initialize(),n()(this,Ws)&&n()(this,Ws).rendererReinitialize())})),n()(this,Ps)||("function"==typeof n()(this,Cs).requestAdapterInfo?a()(this,Ps,await n()(this,Cs).requestAdapterInfo()):"info"in n()(this,Cs)&&a()(this,Ps,n()(this,Cs).info)),n()(this,Ls)||a()(this,Ls,navigator.gpu.getPreferredCanvasFormat()),n()(this,Is)||a()(this,Is,new $i(n()(this,Us))),n()(this,Os)||a()(this,Os,new Rn(n()(this,Us))),n()(this,Ds)||a()(this,Ds,new hs(n()(this,Us))),n()(this,Bs)||a()(this,Bs,new ds(n()(this,Cs))),n()(this,Gs)||(a()(this,Gs,new As(n()(this,Ns))),n()(this,Gs).addObservable(n()(this,Is)),n()(this,Gs).addObservable(n()(this,Os)),n()(this,Gs).addObservable(n()(this,Ds)),n()(this,Gs).monitor())}else console.error("[WebGPUResManager] initialize() WebGPU is not supported!")}acquireGPUDevice(){return n()(this,Us)}acquireCanvasFormat(){return n()(this,Ls)}acquireGPUAdapterInfo(){return n()(this,Ps)}destroyGPUDevice(){n()(this,Us)&&(n()(this,Us).destroy(),a()(this,Us,null))}acquireGPUBufferMgr(){return n()(this,Is)}acquireGPUTextureMgr(){return n()(this,Os)}acquireGPUBufferPool(){return n()(this,Ds)}acquireGPUFeaturesHelper(){return n()(this,Bs)}cleanup(){n()(this,Is)&&(n()(this,Is).cleanup(),a()(this,Is,null)),n()(this,Os)&&(n()(this,Os).cleanup(),a()(this,Os,null)),n()(this,Ds)&&(n()(this,Ds).cleanup(),a()(this,Ds,null)),n()(this,Bs)&&(n()(this,Bs).cleanup(),a()(this,Bs,null)),n()(this,Gs)&&(n()(this,Gs).cleanup(),a()(this,Gs,null)),a()(this,Ws,null),this.destroyGPUDevice()}recycleTextureBufferGroup(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&n()(this,Ds)){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),n()(this,Ds).recycle(r.buffer,r.bufferConfig,t),e.destroyTextureBufferGroup(this))}}recycleInUsedGPUBuffers(e){for(const[t,r]of e)for(const e of r)if(e){const t=e.getTextureBufferGroup();t&&t.buffer&&(t.bufferArray&&(t.bufferArray=null),n()(this,Ds).recycle(t.buffer,t.bufferConfig)),e.destroyTextureBufferGroup(this)}}requestTextureBuffer(e){if(!n()(this,Ds))return null;if(Object(xt.f)(this,e.size))return Object(o.u)("requestTextureBuffer() a buffer size that exceeds the max size of GPUBuffer is required.(size:".concat(e.size,")")),null;const t=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC;return e.usage=t,n()(this,Ds).acquire(e)}destroyTextureGroup(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=e.getTextureGroup();if(!r)return;if(!n()(this,Os))return void Object(o.u)("destroyTextureGroup() mGPUTextureMgr is undefined!");const i=e.getTextureType();r&&(i==h.x.GPU_TEX_YUV||i!=h.x.GPU_TEX_RGBA&&function(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,Fs,Vs).call(this,r)?(n()(this,Os).recycleTexture(r.yPlaneTex,t),n()(this,Os).recycleTexture(r.uPlaneTex,t),r.vPlaneTex&&n()(this,Os).recycleTexture(r.vPlaneTex,t)):n()(this,Os).recycleTexture(r,t),e.setTextureGroup(null))}};function Hs(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var js=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,qs=new WeakMap,Ks=new WeakMap;t.a=class{constructor(e){Hs(this,js,{writable:!0,value:""}),Hs(this,Ys,{writable:!0,value:new ze}),Hs(this,Xs,{writable:!0,value:new Hi}),Hs(this,qs,{writable:!0,value:new Qe}),Hs(this,Ks,{writable:!0,value:new zs}),a()(this,js,e),n()(this,Ks).addRendererProviderModule(n()(this,Ys)),n()(this,Ks).setLabel(n()(this,js)),n()(this,Xs).setGPUResourceMgr(n()(this,Ks))}isEnableCanvasAlphaChannel(){return n()(this,Xs).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){n()(this,Xs).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await n()(this,Ys).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=n()(this,Ys).getRendererType(),o=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).getVideoRenderDisplay(a,e,t,r,i,o,s)}createWebGLVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):n()(this,Ys).isWebGLRendererType()?n()(this,Xs).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):null}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=n()(this,Ys).getRendererType(),a=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).createVideoRenderDisplay(s,e,t,r,a,i)}getSharingRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType(),s=n()(this,Ys).acquireRenderer(e,n()(this,Ks),!0);return r||(r={}),r.clearCache=!0,n()(this,Xs).getSharingRenderDisplay(i,e,t,s,r)}recycleRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType();n()(this,Xs).recycleRenderDisplay(i,e,t,n()(this,Ks),r)}renderFor(e){if(n()(this,Ys).isWebGPURendererType()){const t=n()(this,Ys).getRendererType(),r=n()(this,Xs).collectInUseRenderDisplays(t,e);r&&r.forEach(e=>{const t=n()(this,Ys).acquireRenderer(e.canvas,n()(this,Ks));n()(this,qs).render(t,e.renderDisplays)})}}renderWith(e){if(n()(this,Ys).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const r=n()(this,Ys).acquireRenderer(t,n()(this,Ks)),i=[];i.push(e),n()(this,qs).render(r,i)}}}getRenderDisplayMap(e){const t=n()(this,Ys).getRendererType();return n()(this,Xs).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,Ys).isWebGLRendererType()||n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).onRestoredFromContextLost(e,t,r,i,s,a):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&n()(this,Ys).isWebGPURendererType()&&e.close()}getRendererProvider(){return n()(this,Ys)}getRenderDisplayManager(){return n()(this,Xs)}getWebGPUResMgr(){return n()(this,Ks)}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];n()(this,Ys)&&n()(this,Ys).cleanup(),n()(this,Xs)&&n()(this,Xs).cleanup(e,t,n()(this,Ks),r),r||n()(this,Ks)&&n()(this,Ks).cleanup()}clearOffscreenCanvas(e){n()(this,Xs)&&n()(this,Xs).cleanupByCanvas(e)}}},function(e,t,r){var i=r(24).default,n=r(35);e.exports=function(e){var t=n(e,"string");return"symbol"===i(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(24).default;e.exports=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(15),n=r(4),s=r(5),a=r(2),o=r(30),h=r(27),u=r(3);function l(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new h.a,this.sharingQueue=new h.a,this.WaterMarkRGBA=new o.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=n.B,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null}l.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},l.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},l.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},l.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},l.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},l.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},l.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let r=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-r,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},l.prototype.JsMediaSDK_SharingRender=function(){var e,t,r;if(this.sharingDisplay)if(!1!==(null===(e=(t=this.sharingDisplay).isAvaiable)||void 0===e?void 0:e.call(t))){null===(r=this.statisticObj)||void 0===r||r.sample();var n=this.Get_Decoded_Sharing_Frame(this.currentshareactive,this.isFromMainSession),o=this.Get_Decoded_Mouse_Frame(this.currentshareactive,this.isFromMainSession);if(n){let e,t;this.lRTimeStamp=n.ntptime,n.yuvdata instanceof u.m?(e=n.yuvdata.yuvdata,t=n.yuvdata):(e=n.yuvdata,t=null),this.sharingWidthAndHeightInfo.logicWidth==n.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==n.logic_h||(this.PubSub?PubSub.publish(i.g,{body:{width:n.logic_w,height:n.logic_h,logicWidth:n.logic_w,logicHeight:n.logic_h}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=n.logic_w,this.sharingWidthAndHeightInfo.logicHeight=n.logic_h);var h=n.logic_h,l=n.logic_w,c=n.r_h,d=n.r_w;this.xratio=d/l,this.yratio=c/h;var f={top:n.r_x,left:n.r_y,height:n.r_h,width:n.r_w};this.currentSharingHeight==n.r_h&&this.currentSharingWidth==n.r_w&&this.currentSharingLogicHeight==n.logic_h&&this.currentSharingLogicWidth==n.logic_w||(this.Notify_APPUI?this.Notify_APPUI(i.f,{body:{height:n.logic_h,width:n.logic_w,logicHeight:n.logic_h,logicWidth:n.logic_w}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.currentSharingHeight=n.r_h,this.currentSharingWidth=n.r_w,this.currentSharingLogicHeight=n.logic_h,this.currentSharingLogicWidth=n.logic_w);const r=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:n.r_w,a=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:n.r_h;this.Should_Update_Watermark(this.sharingDisplay,r,a)&&this.Update_Display_Watermark(this.sharingDisplay,r,a),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:s.X,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOutputPictureFrame(n.width,n.height,f,e,null,n.yuv_limited),t&&t.recycle(),n.dataptr&&Module._free(n.dataptr)}else if(this.brefresh&&(this.brefresh=!1,0!=this.sharingDisplay.getTextureWidth()&&0!=this.sharingDisplay.getTextureHeight()&&0!==this.currentSharingWidth&&0!==this.currentSharingHeight)){const e=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:this.currentSharingWidth,t=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:this.currentSharingHeight;this.Should_Update_Watermark(this.sharingDisplay,e,t)&&this.Update_Display_Watermark(this.sharingDisplay,e,t),this.sharingDisplay.drawNextOutputPictureFrame(this.sharingDisplay.getTextureWidth(),this.sharingDisplay.getTextureHeight(),this.sharingDisplay.getCroppingParams(),null,this.picRotation,!0,null,!1),n=!0}o&&(this.Cursorx=o.r_x*this.xratio,this.Cursory=o.r_y*this.yratio,this.CursorWidth=o.width*this.xratio,this.CursorHeight=o.height*this.yratio,this.sharingDisplay.updateCursor(o.width,o.height,o.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:s.X,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.drawCursor(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight)),n&&this.renderManager.renderFor(a.t.SHARE)}else{var p,g;null===(p=(g=this.sharingDisplay).restoreContext)||void 0===p||p.call(g)}else Object(u.u)("JsMediaSDK_SharingRender error, display is null")},l.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},l.prototype.updateOffscreenCanvasSize=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!r)return console.log("drop logic w/h");try{let r=this.sharingDisplay.getAttachedCanvas();r&&r instanceof OffscreenCanvas&&(r.width=e,r.height=t,this.brefresh=!0)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},l.prototype.Set_Render_Display=function(e){this.sharingDisplay=e},l.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},l.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:r,sharingWaterMarkName:i,watermarkOpacity:n,watermarkRepeated:s,watermarkPosition:a}=e;r||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=r,this.sharingWaterMarkName=i,void 0!==s&&(this.isWaterMarkRepeatedEnable=!!s),void 0!==n&&(this.waterMarkOpacity=n),void 0!==a&&(this.watermarkPosition=a)},l.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},l.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.setWatermarkFlag(e?1:0)},l.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const c=function(e,t){if(e<640&&e){const r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};l.prototype.Update_Display_Watermark=function(e,t,r){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const i=t<512||r<288?16:this.watermarkPosition,n=this.Should_Watermark_Repeated(t,r),s=c(t,r);t=s.width,r=s.height;const a=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i});e.updateWatermark(t,r,a)},l.prototype.Should_Update_Watermark=function(e,t,r){if(!this.isCreateSharingWaterMark)return!1;let i=!1;const n=c(t,r);n.width===e.getWatermarkWidth()&&n.height===e.getWatermarkHeight()||(i=!0);const s=this.Should_Watermark_Repeated(t,r);e.isSetWatermark()||(i=!0),s!==e.isWatermarkRepeated()&&(i=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(i=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const a=t<512||r<288?16:this.watermarkPosition;return a!==e.getWatermarkPosition()&&(i=!0,e.setWatermarkPosition(a)),i},l.prototype.Update_Sharing_Canvas_Size=function(e){let{width:t,height:r}=e;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(r)}},l.prototype.ClearQueue=function(){try{let e=this.sharingQueue.ssrcQueueMap;for(let[t,r]of e)for(;!r.isEmpty();){let e=r.dequeue();e.yuvdata&&e.yuvdata instanceof u.m&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},l.prototype.Get_Decoded_Sharing_Frame=function(e,t){if(!this.sharingQueue)return null;var r=this.GetLogicalSSRCPart(e,t),i=this.sharingQueue.GetQueue(r);return i?i.dequeue():null},l.prototype.Get_Decoded_Mouse_Frame=function(e,t){if(this.mouseQueue){var r=this.GetLogicalSSRCPart(e,t),i=this.mouseQueue.GetQueue(r);return i?i.dequeue():null}},l.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var r=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||r!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(i.e,this.currentshareactive):postMessage({status:s.F,ssrc:this.currentshareactive}));var n=this.sharingQueue.GetQueue(r);n||(n=this.sharingQueue.AddQueue(r)),n.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var a=this.sharingQueue.GetQueueLength(r),o=a-t;for(this.maxQueueLength=t;o>=0;){let t=this.Get_Decoded_Sharing_Frame(e.ssrc,e.isFromMainSession);t.yuvdata instanceof u.m&&t.yuvdata.recycle(),t.dataptr&&Module._free(t.dataptr),o--}}},l.prototype.Get_Current_QueueLength=function(){if(!this.sharingQueue)return;let e=this.currentshareactive;var t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)},l.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),r=this.mouseQueue.GetQueue(t);r||(r=this.mouseQueue.AddQueue(t)),r.enqueue(e);for(var i=this.mouseQueue.GetQueueLength(t)-10;i>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc,e.isFromMainSession),i--}},l.prototype.GetLogicalSSRCPart=function(e,t){let r=e>>10;return t&&(r|=1<<23),r},l.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},l.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(u.u)(e,t)},l.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):Object(u.t)(e)},l.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},l.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval(()=>{this.No_Bindthis_Interval()},20)):(this.Start_Draw(),this.startRAFHealthCheck())},l.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},l.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval(()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(n.C),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))},2e3)},l.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)},t.a=l},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channel_Agent",(function(){return Dt})),r.d(t,"Open_Sharing_WebSocket_Connect",(function(){return Bt})),r.d(t,"sharing_websocket_on_open",(function(){return Gt})),r.d(t,"sharing_websocket_on_message",(function(){return Wt})),r.d(t,"sharing_websocket_on_close",(function(){return Nt})),r.d(t,"sharing_websocket_on_error",(function(){return Ft})),r.d(t,"JsMediaSDK_Log",(function(){return Vt})),r.d(t,"Recieve_Wb_Packet",(function(){return zt})),r.d(t,"Send_Wb_Rtp_Packet",(function(){return Ht})),r.d(t,"wcl_trace_log",(function(){return jt})),r.d(t,"sharing_qos_monitor",(function(){return Qt})),r.d(t,"responseSharingQosData",(function(){return Zt})),r.d(t,"frame_callback_video_mode",(function(){return $t})),r.d(t,"frame_callback_mouse_video_mode",(function(){return er})),r.d(t,"Send_Data",(function(){return tr})),r.d(t,"decode_callback",(function(){return rr})),r.d(t,"SubScribeUpdateSharing",(function(){return ir})),r.d(t,"IsSupportMultiThread",(function(){return ar})),r.d(t,"hardcodecpunumber",(function(){return or})),r.d(t,"LimitWebCodecsEncoderTo360_js",(function(){return hr})),r.d(t,"LimitWebCodecsDecoderTo360_js",(function(){return ur})),r.d(t,"UserAgentIsTesla_js",(function(){return lr})),r.d(t,"IsSupportMultiThreadForWebcodec",(function(){return cr})),r.d(t,"getGraphicName",(function(){return dr})),r.d(t,"getVendorName",(function(){return fr})),r.d(t,"GetCscThreadNum",(function(){return pr})),r.d(t,"GetEncThreadNum",(function(){return gr})),r.d(t,"Sharing_Decode",(function(){return mr})),r.d(t,"GetLogLevel_js",(function(){return _r})),r.d(t,"Send_Data_Codec",(function(){return vr})),r.d(t,"LOG_OUT",(function(){return br})),r.d(t,"Utf8ArrayToStr",(function(){return wr})),r.d(t,"Write_App_Log",(function(){return yr})),r.d(t,"Pace_Sender",(function(){return Rr})),r.d(t,"Compute_WebSocket_Speed",(function(){return Er})),r.d(t,"Compute_Capture_Delay",(function(){return Sr})),r.d(t,"APP_Troubleshoting_Info",(function(){return Ar})),r.d(t,"Sharing_Capture",(function(){return kr})),r.d(t,"Update_WebSokcet_Speed",(function(){return Mr})),r.d(t,"SAVE_IV",(function(){return Cr})),r.d(t,"getWasmMemory",(function(){return Pr})),r.d(t,"freeWasmMemory",(function(){return Ur})),r.d(t,"MCMMonitor_Sharing_LOG",(function(){return Wr})),r.d(t,"Send_Out_Qos",(function(){return Nr})),r.d(t,"BigLog_js",(function(){return jr})),r.d(t,"Set_Share_Mode_js",(function(){return Yr})),r.d(t,"checkWebCodecWhitelist_js",(function(){return Jr})),r.d(t,"UserWebCodecController_js",(function(){return $r}));var i=r(3),n=r(4),s=r(5),a=r(36),o=r(12),h=r(15),u=r(29),l=r(14),c=r(31),d=r(18),f=r(33),p=r(19),g=r(8),m=r(11),_=r(26),v=r(13),b=r(23),w=r(6),y=r(25);const x=r(46);var T,R,E,S,A,k,M,C,P,U,L,I,O,D,B,G,W,N,F,V;self.wasmSuccessEvent=s.Z,self.wasmFailEvent=s.Y,self.downloadAndInstantiateWebAssembly=i.q,self.onunhandledrejection=e=>{Object(i.u)("Unhandled rejection in worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)};var z,H,j,Y,X,q,K,Q,Z,J=new Map,$=!1,ee=!1,te=0,re=0,ie=0,ne=!1;const se=new f.a("sharing");var ae,oe,he,ue=null,le=new _.a(s.W,!0);self.onWasmModuleReady=()=>{T=Module.cwrap("_Sharing_Encode","number",["number","number","number","number","number","number"]),k=Module.cwrap("_Sharing_Encode_Mouse_Data","number",["number","number","number"]),R=Module.cwrap("_Sharing_Encode_Uninit","number",["number"]),E=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","array","number"]),S=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","number","number"]),A=Module.cwrap("_Sharing_Encode_Init","number",["number","string","string","number","number","number","boolean","boolean","boolean"]),M=Module.cwrap("_Sharing_Set_Data_Encryption","number",["number","number"]),F=Module.cwrap("_Request_Sharing_Qos_Data","number",["number","boolean","boolean"]),C=Module.cwrap("_Sharing_Pause_Encode","number",["number"]),Module.cwrap("_Sharing_Stop_Encode","number",["number"]),P=Module.cwrap("_Sharing_Resume_Encode","number",["number"]),U=Module.cwrap("_Sharing_Websocket_Speed","number",["number","number"]),L=Module.cwrap("_Add_Sharing_Cooker_info","number",["number","number","number","number"]),O=Module.cwrap("_Get_Sharing_Meat_Weight","number",["number"]),I=Module.cwrap("_Remove_Sharing_Cooker_Info","number",["number","number"]),D=Module.cwrap("_Set_Sharing_Encryption_Key_Directly","number",["number","number","number","number"]),B=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),G=Module.cwrap("_Add_Rev_Channel","number",["number","number","number","number"]),W=Module.cwrap("_Remove_Rev_Channel","number",["number","number"]),N=Module.cwrap("_update_sharing_uplink_bandwidth_limitation_by_server","number",["number","number"]),V=Module.cwrap("_set_annotation_action","number",["number","number","number","number"]),H=Module.cwrap("_collect_sharing_monitor_info","number",["number","boolean","boolean"]),j=Module.cwrap("_Change_Connect_Type_For_Sharing","number",["number","number"]),Y=Module.cwrap("_request_nack_t_periodically_for_sharing_qos","number",["number"]),ae=Module.cwrap("_Jpeg_Init","number",[]),Module.cwrap("_Jpeg_Uninit","number",["number"]),oe=Module.cwrap("_Jpeg_HeardInfo","number",["number","number","number"]),he=Module.cwrap("_Jpeg_Decode","number",["number","number","number","number","number","number"]),Module._malloc=function(){let e=Module.asm.malloc.apply(null,arguments);if(!e&&!ne){ne=!0,Object(i.o)("MEMERR:SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));let e=new Error("memry malloc error SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));Object(i.u)("memry malloc error",e)}return e},"undefined"!=typeof _malloc&&(_malloc=Module._malloc)};var ce,de,fe,pe,ge,me,_e,ve,be,we,ye,xe,Te,Re,Ee,Se,Ae,ke=0,Me=null,Ce=0,Pe=0,Ue=0,Le=null,Ie=null,Oe=null,De=null,Be=!1,Ge=!1,We=!1,Ne=null,Fe=!1,Ve=0,ze=0,He=0,je=0,Ye=new m.a,Xe=new m.a,qe=!1,Ke=0,Qe=0,Ze=0,Je=null,$e=null,et=!1,tt=!1,rt=null,it=null,nt=null,st=null,at=null,ot=!0,ht=!1,ut=new m.a,lt=n.L,ct=!1,dt=!1,ft=1,pt=!1,gt=0,mt=0,_t=!1,vt=n.d.DESKTOP_SOURCE,bt=0,wt=null,yt=null,xt=0,Tt=null,Rt=0,Et=null,St=0,At=0,kt=!1,Mt=[],Ct=[],Pt=[];function Ut(e,t){postMessage({status:s.H,data:"".concat(e,":").concat(t)})}function Lt(e,t){Object(i.o)("".concat(e,":").concat(t,":F"))}var It=new l.b({tag:"WCL_M,ASRENDER_ERR",interval:1e4,reportcallback:function(e,t,r,i){Ut(e,"".concat(t,",").concat(r,",").concat(i))}}),Ot=new c.a({tag:"WCL,AS",report_call:Ut});function Dt(){function e(e){let t=null,r=n.db,s=null,a=e.onmessage,o=e.onopen,h=e.onclose;e.onmessage=r=>{t=(new Date).getTime(),a.call(e,r)},e.onopen=i=>{t=(new Date).getTime(),function(){if(s)return;s=setInterval(()=>{var i;(new Date).getTime()-t>=1e3*r&&(clearInterval(s),s=null,null===(i=e.socket)||void 0===i||i.close())},1e3)}(),o.call(e,i,e)},e.onclose=t=>{try{clearInterval(s)}catch(e){Object(i.u)("WebSocket closed",e)}h.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,r,i,n,s){this.websocketaddress=t,this.onopen=r,this.onmessage=i,this.onerror=n,this.onclose=s,e(this)},this.connect=function(e,t,r,n,a){var o=this;Object(i.o)("SB"),o.init(e,t,r,n,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex+=1,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(i.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(i.o)("SCLOSE"),o.socket.close()},o.socket.onclose=function(e){Object(i.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:s.ab}),Object(i.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){ht||1!=Le.socket.readyState?(ke+=e.length,Xe.enqueue(e),Rr()):Le.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function Bt(e,t,r,n,s){Object(i.o)("WSURL:false:".concat(e));var a=new Dt;return a.connect(e,t,r,n,s),a}function Gt(){postMessage({status:s.bb})}Ot.threshold=300;function Wt(t){let r=new Uint8Array(t.data);if(!(r.length<4))if(37!==r[0]){if(102!=r[0]){if(r[0]==n.t.SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME){if(!$||!Ie||vt!=n.d.UAC_SOURCE)return;let t,i=0;if(t=x.inflate(e.from(r.subarray(4,r.length)),{windowBits:31}),i=t.length,i>xt&&(yt&&Module._free(yt),xt=3*i/2,yt=Module._malloc(xt)),!yt)return xt=0,void console.error("Couldn't allocate memory");writeArrayToMemory(t,yt);let s=oe(wt,yt,i);if(!s)return;let a=65535&s,o=s>>16&65535,h=a*o*4;if(h>Rt&&(Tt&&Module._free(Tt),Rt=h,Tt=Module._malloc(h)),!Tt)return Rt=0,void console.error("Couldn't allocate memory");if(bt++,s=he(wt,yt,i,o,a,Tt),0!=s)return;return ni(o,a),1!=xe&&(xe=1),void T(Ie,Tt,h,o,a,xe)}if(r[0]!=n.t.SHARE_REMOTE_CONTROL_UAC_MOUSE)if(111!=r[0])if(109!=r[0]){if(0==r[0])Le&&Le.send(r);else if(Ie)if(Ge){if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);Ye.enqueue(e);let r=Ye.dequeue();for(;r;)E(Ie,r,r.length),r=Ye.dequeue()}}else mr(t.data);else if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);0!=e[0]&&Ye.enqueue(e)}}else Oe&&E(Oe,r,r.length);else 1==r[4]?(Object(i.o)("UAC_START"),bt=0,wt||(wt=ae()),vt=n.d.UAC_SOURCE):(Object(i.o)("UAC_STOP"),Object(i.o)("UAC_ASCAPTURE:".concat(bt)),vt=n.d.DESKTOP_SOURCE,We=!0,Tt&&Module._free(Tt),Tt=null,Rt=0,yt&&Module._free(yt),yt=null,xt=0,Et&&Module._free(Et),Et=null,St=0);else if(Ie&&$&&vt==n.d.UAC_SOURCE){if(r.length>St&&(Et&&Module._free(Et),St=3*r.length/2,Et=Module._malloc(St)),!Et)return void(St=0);writeArrayToMemory(r,Et),k(Ie,Et,r.length)}}}else postMessage({status:s.Q,data:r})}function Nt(e){Vt("sharing_websocket_on_close")}function Ft(e){Vt("sharing_websocket_on_error")}function Vt(e){console.log(e)}function zt(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.Cb,data:r},[r.buffer])}function Ht(e,t,r){var n=new Uint8Array(r+8),s=Object(i.d)().subarray(t+0,t+r);n.set(s,8),n[0]=109;var a=new Uint32Array(1);a[0]=e;var o=new Uint8Array(a.buffer);n.set(o,4),Object(i.y)(Le,n),le.setRtpPackets()}function jt(e,t){zr&&zr.writeWasmLog(e,t)}var Yt,Xt,qt={sharingqosIntervalId:0,sharingmonitorPanelFlag:!1,panelpollingInterval:0},Kt=!0;function Qt(){const e=()=>{if(ht&&!Kt&&Ie)F(Ie,!0);else if(!ht&&(!et||tt)){let e=kt?d.e():Ie;e&&F(e,!1)}};qt.sharingqosIntervalId&&clearInterval(qt.sharingqosIntervalId),qt.sharingmonitorPanelFlag&&(qt.sharingqosIntervalId=setInterval(e,qt.panelpollingInterval||n.y))}function Zt(e,t,r,i,n,s,a,o,u){if(qt.sharingmonitorPanelFlag){const l={width:e,height:t,fps:r,rtt:i,jitter:n,avg_loss:s,max_loss:a,bandwidth:o,rate:u};postMessage({status:h.i,data:l})}}var Jt=new Map;function $t(e,t,r,n,a,o,h,u,l,c,d,f,p,g){let m=!(g==Ie);kt=m,Jt.get(n)||(Jt.set(n,!0),postMessage({status:s.U,ssrc:n}));var _=Object(i.d)().subarray(e+0,e+t),v=Object(i.g)().subarray(r,r+8),b=0;for(let e=0;e<8;e++)b+=v[e]*Math.pow(256,e);var w=n,y=a,x=o;if(et){if(!tt)return;if(t>Yt)return void It.timeoutReport(0,performance.now());let e=new i.m(Xt);if(e.storeSync(_)){var T={yuvdata:e,ntptime:b,ssrc:w,width:y,height:x,r_x:h,r_y:u,r_w:l,r_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m};at&&at.Put_Sharing_Data_From_Queue(T,5)}}else{let e=new Uint8Array(_);postMessage({status:s.S,data:e,sharing_timestamp:b,sharing_ssrc:w,sharing_width:y,sharing_height:x,rendering_x:h,rendering_y:u,rendering_w:l,rendering_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m},[e.buffer])}}function er(e,t,r,n,a,o,h,u,l,c,d,f){var p=new Uint8Array(t),g=Object(i.d)().subarray(e+0,e+t);p.set(g,0,t);var m=n,_=a,v=o;let b=!(f==Ie);if(et){var w={type:"mouse_data",buffer:p,ntptime:r,ssrc:m,width:_,height:v,r_x:h,r_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b};at&&at.Put_Mouse_Data_Into_Queue(w)}else postMessage({status:s.I,data:p,mouse_timestamp:r,mouse_ssrc:m,mouse_width:_,mouse_height:v,mouse_x:h,mouse_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b},[p.buffer])}function tr(e,t,r){if(!(t<4)){var n,s=new Uint8Array(t),a=Object(i.d)().subarray(e+0,e+t);if(s.set(a,0,t),133!=s[0]&&77!=s[0]||le.setRtpPackets(),r==Ie)Object(i.y)(Le,s);else Object(i.y)(null===(n=d.h)||void 0===n?void 0:n.socket,s)}}function rr(e,t,r){let i=!(r==Ie);postMessage({status:s.T,ssrc:e,size:t,isFromMainSession:i})}function ir(e){le.setSubForMe(e)}function nr(e,t,r,i){if(ht||++te%24e4==0&&postMessage({status:s.H,data:"WCL_M,RTCPSN"+te}),t&&r){if(dt&&(77==e[0]||79==e[0])&&!ct){lt=n.K;for(var a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(n);break;case 12:case 13:s=e[r++],t+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[r++],a=e[r++],t+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&a)<<0)}return t}function yr(){Le.socket.bufferedAmount,Xe.getLength(),Sr()}var xr=0,Tr=150;function Rr(){if(0!==xr?(Tr=performance.now()-xr)>=150&&(xr=performance.now()):xr=performance.now(),Le.socket.bufferedAmount>2e4)return;if(Tr>=150&&We&&(Xe.getLength(),ke-2e4<0))We=!We,Te&&Ee?(Ne&&(Ne=null),Ee.read().then((function(e){let{done:t,value:r}=e;if(t)return void console.log("Stream is done!!!");let i={data:r};1e3==mt&&(postMessage({status:s.R}),mt=0),mt++,Br(i)}))):Ne?(kr(Ne),Ne=null):postMessage({status:s.ob});else{let e=performance.now();if(re&&ie&&He&&e-re>3e3){if(re=e,vt!=n.d.DESKTOP_SOURCE)return;T(Ie,He,ie,Ve,ze,xe)}}if(Xe.getLength()>20&&!qe){qe=!0,Ke=0;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=28,Qe=(new Date).getTime(),e[1]=0,Le.socket.send(t)}if(qe&&20==Ke){qe=!1;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=29,e[1]=(new Date).getTime()-Qe,Le.socket.send(t)}let e=Xe.dequeue();for(;e;){if(Ke++,Le.socket.send(e),Er(e),ke-=e.length,Le.socket.bufferedAmount>2e4)return void yr();e=Xe.dequeue()}yr()}function Er(e){var t;if(Me){var r=(new Date).getTime()/1e3;if((t=r-Me)>10){var i=Ce-Le.socket.bufferedAmount;0==Le.socket.bufferedAmount?(Ue=Ue?.8*Ue+16e4:8e5,Ie&&U(Ie,Ue)):(Pe=8*i/(1*t),Ue=Ue?.8*Ue+.2*Pe:8e5,Ie&&U(Ie,Ue)),Ce-=i,Me=r}}else Ce=0,Me=(new Date).getTime()/1e3,Ie&&U(Ie,8e5);Ce+=e.length}function Sr(){var e=ke+Ce-1e4;return 0==je||e<=0?0:je>0?e/je:void 0}function Ar(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.b,data:wr(r)})}function kr(e){!Be&&e?postMessage({status:s.ob,data:e.data},[e.data.buffer]):postMessage({status:s.ob})}function Mr(e){je=je?(je+e)/2:e}function Cr(e,t){ve||(ve=setInterval((function(){Ie&&O(Ie)}),6e4));let r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),be=r,postMessage({status:s.a,data:r})}function Pr(e){if(!e)return 0;let t=Module._malloc(e.length);return Object(i.g)().subarray(t,t+e.length).set(e,0,e.length),t}function Ur(e){e&&Module._free(e)}function Lr(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.v)(n)}function Ir(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.w)(n)}function Or(e){try{Je.canvas.width===e.width&&Je.canvas.height===e.height||(Je.canvas.width=e.width,Je.canvas.height=e.height)}catch(e){Object(i.u)("Error when updating OffScreenCanvas size",e)}}function Dr(e){let t={rect:{x:0,y:0,width:0,height:0}};return e.visibleRect.left%2!=0?t.rect.x=e.visibleRect.left-1:t.rect.x=e.visibleRect.left,e.visibleRect.top%2!=0?t.rect.y=e.visibleRect.top-1:t.rect.y=e.visibleRect.top,e.visibleRect.width%2!=0?t.rect.width=e.visibleRect.width-1:t.rect.width=e.visibleRect.width,e.visibleRect.height%2!=0?t.rect.height=e.visibleRect.height-1:t.rect.height=e.visibleRect.height,t}async function Br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.d.DESKTOP_SOURCE;if(t>> Set_Share_Mode_js")}self.addEventListener("message",(function(e){var t,r=e.data;switch(r.command){case g.p:Object(i.o)("STARTMEDIA:".concat(function(e){let t=e.confId,r=e.isPreviewMode?1:0;return r|=Qr()?2:0,"".concat(t,":").concat(r)}(r)));try{if(z||(z=setInterval(()=>{let e=kt?d.e():Ie;$&&e&&H(e,!!ht)},1e3)),r.isPreviewMode)break;Qr()||(Kr=!1,Object(i.o)("RSTHOLD")),function(e){Hr=e._id,Q=e.graphicalname,Z=e.vendorname,ce=e.meetingnumb+"",de=e.meetingid,ft=e.multiThreadNum,At=e.uplimit?e.uplimit:0,ht=!!e.encode,me=e.confId,Ge=ht,Be=!!e.isChromeOrEdge,dt=ft>1,se.setCanvasAlphaChannelEnability(e.isEnableCanvasAlphaChannel),p.a.setIsEnableCanvasCtxOptionsOpt(e.isEnableCanvasCtxOptionsOpt)}(r),Xr||(zr&&zr.init({workerType:ht?o.b.SHARING_ENCODE:o.b.SHARING_DECODE}),Xr=!0),function(e){se.getRendererProvider().setRendererType(e.rendererType),se.getRendererProvider().isWebGPURendererType()&&se.getWebGPUResMgr().initialize()}(r),function(e){if(ei||ht||((ei=Object(b.d)(w.e.SHARR_DECODE)).onmessage=Fr,ei.onopen=()=>{X=!0,Vr()},ei.onclose=()=>{X=!1,Vr()},(ti.sender||ti.reciver)&&Object(v.b)(ei,ti.sender,ti.reciver)),!e.websocket_ip_address)return;let t=e.websocket_ip_address+"&mode=1";ht&&(t=e.websocket_ip_address.slice(0,e.websocket_ip_address.length-42)+"s"+e.websocket_ip_address.slice(e.websocket_ip_address.length-41,e.websocket_ip_address.length)+"&mode=2"),Object(i.j)(Le,t)&&(Le=Bt(t,Gt,Wt,Ft,Nt))}(r),ht||(Xt||(Yt=15728640,Xt=new i.k(5,Yt)),qr()),postMessage({status:Ie||ht?s.db:s.cb})}catch(e){postMessage({status:s.cb}),Object(i.u)("sharing startr media error",e)}break;case g.b:z&&(clearInterval(z),z=null),Ie&&R(Ie),Ie=null,De&&R(De),De=null,function(){try{let e=ei;ei=null,X=!1,ti={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}(),close();break;case"ENCRYPT":Fe=r.encrypt,Ie&&M(Ie,Fe?1:0);break;case g.l:qt.panelpollingInterval=r.data.pollingInterval,qt.sharingmonitorPanelFlag=r.data.enable,Qt();break;case"startSharingEncode":$=!0,r.isSupportVideoTrackReader?(xe=2,!0):(xe=1,!1),Te=!!r.isSupportMediaStreamTrackProcessor,dt&<==n.L?function(e){if(dt&&!ct){lt=n.K;for(var t=0;t{let t=parseInt(e.userid);if(e.bremove)return void(Ie&&I(Ie,t));let r=e.sn;if(16!=r.length&&32!=r.length)return;let i=Pr(r);if(Ie){let e=!1;ht&&me!=t||(e=!0),e&&L(Ie,t,i,r.length)}Ur(i),ht&&me==t&&r});break}case"SET_OFFSCREENCANVAS_WIDTH_HEIGHT":{let{width:e,height:t}=r.data;at&&(at.setOnlyAcceptUISize(!0),at.updateOffscreenCanvasSize(e,t,!0));break}case"BUILD_MS_CHANNEL_IN_BO":d.c(Bt,r.data,nr,E);break;case"SHARING_REMOVE_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASD:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.f(ii,e):Ie&&ii(Ie,e.ssrc)}break;case"SHARING_ADD_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASC:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.e()?d.a(ri,e):Mt.push(e):Ie?ri(Ie,e.ssrc,e.streamIndex,e.videoMode):Ct.push(e)}break;case g.r:{let e=r.data;if(e.isFromMainSession)De=d.d(A,D,e.updateParams,Pr,Ur),Mt.length>0&&(Object(i.u)("retry add recv channel for master share"),Mt.forEach(e=>{d.a(ri,e)}),Mt=[]),j(De,X?0:2);else if(Se=e,Ge)Ie&&Gr(Ie,Se.updateParams.userId,Se.updateParams.sn,Se.updateParams.encryptKey,Se.updateParams.encryptType);else if(Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t)}}break;case g.s:{let e=r.data;if(e.isFromMainSession)d.b(B,e);else if(Ie&&e.body){if(e.body.add){let t=0,r=e.body.add;for(;t{Y(Ie)},50)),ee||(ee=!0,"function"==typeof SharedArrayBuffer&&wasmMemory.buffer instanceof SharedArrayBuffer&&function(){const e=8+1500*(n.bb+1);q||(null!=(q=Module._malloc(e))?(Atomics.store(Object(i.f)().subarray(q/4,q/4+e),0,0),Atomics.store(Object(i.f)().subarray(q/4,q/4+e),1,0),ti.reciver={sab:wasmMemory,offset:q,length:e,interval:10,useCopy:!1,useOneElement:!1},Object(v.b)(ei,null,ti.reciver)):console.log("malloc failed"))}());break;case"WHITEBOARD_JOIN_MESSAGE":if(Oe||Gr(Oe=A(r.nodeId,"1","1",0,0,0,!1,!0,!1),r.nodeId,r.sn,r.encryptKey,2),!J.get(r.dcsId)){J.set(r.dcsId,!0);let e=Pr(r.EncodedSn);B(Oe,r.dcsId,e,r.EncodedSn.length),Ur(e),M(Oe,1)}if(Oe){V(Oe,0,r.dcsId,0);let e=Pr(r.data);V(Oe,1,e,r.data.length),Ur(e)}break;case"audioTimestamp":at&&at.SetcATimeStamp(r.data);break;case"vsport":Ae&&(Ae.close(),Ae=null),(Ae=e.ports[0]).onmessage=function(e){at&&at.SetcATimeStamp(e.data)};break;case g.e:{let e=r.data||{},n=!!e.hold;Object(i.o)("HOLD:".concat(n,":").concat(e.userid,":").concat(e.reinit)),n?function(e){if(Kr)return;if(me&&e.userid&&e.userid>>10!=me>>10)return void Object(i.o)("HOLDINVALID");Kr=!0,ht&&Zr();let t=Ie;Ie=null,t&&R(t),Oe&&(R(Oe),Oe=null),J.clear()}(e):(t=e,Kr&&(Kr=!1,t.reinit&&(me=t.userid,Ie||0==Hr||(qr(),postMessage({status:Ie||ht?s.db:s.cb})))))}break;case"SEND_ANNOTATION_PDU":var m;r.data instanceof Uint8Array&&(r.isPresenter||null===(m=Le)||void 0===m||m.send(r.data));break;case g.g:!function(e){let t=e.content_type,r=e.cmd,n=e.type;"PDU"==t&&(r=Object(i.a)(r),4==n&&Wt({data:r.buffer}))}(r.data)}}));var Xr=!1;function qr(){if(!Qr())return;if(_e==me&&Ie)return;Ie&&(R(Ie),Ie=null),Ie=A(me,ce,de,0,0,At,!1,!1,!0);let e=Se;if(e&&Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t),_e=me}Ct.length>0&&(Object(i.u)("retry add recv channel for share decode"),Ct.forEach(e=>{ri(Ie,e.ssrc,e.streamIndex,e.videoMode)}),Ct=[])}var Kr=!1;function Qr(){return!Kr}function Zr(){Ot.stop(),ve&&(clearInterval(ve),ve=null),Ie&&(Xe=new m.a),Ze&&(clearInterval(Ze),Ze=0),We=!1,ke=0,ot=!0,xr=0,ie=0,re=0,pt=!0,Kt=!1,$=!1,vt=n.d.DESKTOP_SOURCE,lt!=n.L&&setTimeout((function(){pt&&(PThread.terminateAllThreads(),ct=!1,lt=n.L,gt=0,console.log("terminate multiple threads"))}),6e5),le.stopCheck()}function Jr(){return-1}function $r(){return!1}var ei=null,ti={};function ri(e,t,r,n){-1!=Pt.findIndex(r=>r.handle==e&&r.ssrc==t)&&(ii(e,t),Object(i.u)("Duplicate add sharing recv ".concat(t))),G(e,t,r,n),Object(i.o)("ASCHANNEL:".concat(t,":").concat(r)),Pt.push({ssrc:t,index:r,videoMode:n,handle:e})}function ii(e,t){let r=Pt.findIndex(r=>r.handle==e&&r.ssrc==t);-1!=r&&Pt.splice(r,1),W(e,t),Object(i.o)("RMASCHANNEL:".concat(t))}function ni(e,t){return(Ve!=e||ze!=t)&&(postMessage({status:s.w,width:e,height:t}),Ve=e,ze=t,!0)}Object(b.b)(),Object(y.a)(self)}.call(this,r(41).Buffer)},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=r(43),n=r(44),s=r(45);function a(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(h.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(i)return N(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=h.from(t,i)),h.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,a=1,o=e.length,h=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,h/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var l=-1;for(s=r;so&&(r=o-h),s=r;s>=0;s--){for(var c=!0,d=0;dn&&(i=n):i=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function E(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[n+1]))&&(h=(31&u)<<6|63&s)>127&&(l=h);break;case 3:s=e[n+1],a=e[n+2],128==(192&s)&&128==(192&a)&&(h=(15&u)<<12|(63&s)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=e[n+1],a=e[n+2],o=e[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,i,n){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(i,n),l=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,i,n,s){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function L(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function I(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function O(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,i,s){return s||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,s){return s||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}h.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},h.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*t)),i},h.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},h.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+n]=e/s&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},h.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(42))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){for(var t,r=u(e),i=r[0],a=r[1],o=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,a)),h=0,l=a>0?i-4:i,c=0;c>16&255,o[h++]=t>>8&255,o[h++]=255&t;2===a&&(t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4,o[h++]=255&t);1===a&&(t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2,o[h++]=t>>8&255,o[h++]=255&t);return o},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(t=e[r-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,s,a=[],o=t;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,i,n){var s,a,o=8*n-i-1,h=(1<>1,l=-7,c=r?n-1:0,d=r?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-l)-1,f>>=-l,l+=o;l>0;s=256*s+e[t+c],c+=d,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=i;l>0;a=256*a+e[t+c],c+=d,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=u}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))<1&&(a--,h*=2),(t+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(t*h-1)*Math.pow(2,n),a+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Deflate",(function(){return $t})),r.d(t,"Inflate",(function(){return ir})),r.d(t,"constants",(function(){return or})),r.d(t,"default",(function(){return hr})),r.d(t,"deflate",(function(){return er})),r.d(t,"deflateRaw",(function(){return tr})),r.d(t,"gzip",(function(){return rr})),r.d(t,"inflate",(function(){return nr})),r.d(t,"inflateRaw",(function(){return sr})),r.d(t,"ungzip",(function(){return ar}));function i(e){let t=e.length;for(;--t>=0;)e[t]=0}const n=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new Array(576);i(h);const u=new Array(60);i(u);const l=new Array(512);i(l);const c=new Array(256);i(c);const d=new Array(29);i(d);const f=new Array(30);function p(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let g,m,_;function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}i(f);const b=e=>e<256?l[e]:l[256+(e>>>7)],w=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},y=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<{y(e,r[2*t],r[2*t+1])},T=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},R=(e,t,r)=>{const i=new Array(16);let n,s,a=0;for(n=1;n<=15;n++)a=a+r[n-1]<<1,i[n]=a;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=T(i[t]++,t))}},E=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},S=e=>{e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},A=(e,t,r,i)=>{const n=2*t,s=2*r;return e[n]{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n{let i,a,o,h,u=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+u++],i+=(255&e.pending_buf[e.sym_buf+u++])<<8,a=e.pending_buf[e.sym_buf+u++],0===i?x(e,a,t):(o=c[a],x(e,o+256+1,t),h=n[o],0!==h&&(a-=d[o],y(e,a,h)),i--,o=b(i),x(e,o,r),h=s[o],0!==h&&(i-=f[o],y(e,i,h)))}while(u{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)k(e,r,a);h=s;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],k(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,r[2*h]=r[2*a]+r[2*o],e.depth[h]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,r[2*a+1]=r[2*o+1]=h,e.heap[1]=h++,k(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let u,l,c,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=r[2*r[2*l+1]+1]+1,d>h&&(d=h,g++),r[2*l+1]=d,l>i||(e.bl_count[d]++,f=0,l>=o&&(f=a[l-o]),p=r[2*l],e.opt_len+=p*(d+f),s&&(e.static_len+=p*(n[2*l+1]+f)));if(0!==g){do{for(d=h-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[h]--,g-=2}while(g>0);for(d=h;0!==d;d--)for(l=e.bl_count[d];0!==l;)c=e.heap[--u],c>i||(r[2*c+1]!==d&&(e.opt_len+=(d-r[2*c+1])*r[2*c],r[2*c+1]=d),l--)}})(e,t),R(r,u,e.bl_count)},P=(e,t,r)=>{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++o{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++o{y(e,0+(i?1:0),3),S(e),w(e,r),w(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var O={_tr_init:e=>{L||((()=>{let e,t,r,i,o;const v=new Array(16);for(r=0,i=0;i<28;i++)for(d[i]=r,e=0;e<1<>=7;i<30;i++)for(f[i]=o<<7,e=0;e<1<{let n,s,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),C(e,e.l_desc),C(e,e.d_desc),a=(e=>{let t;for(P(e,e.dyn_ltree,e.l_desc.max_code),P(e,e.dyn_dtree,e.d_desc.max_code),C(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==t?I(e,t,r,i):4===e.strategy||s===n?(y(e,2+(i?1:0),3),M(e,h,u)):(y(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(y(e,t-257,5),y(e,r-1,5),y(e,i-4,4),n=0;n(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(c[r]+256+1)]++,e.dyn_dtree[2*b(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{y(e,2,3),x(e,256,h),(e=>{16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var D=(e,t,r,i)=>{let n=65535&e|0,s=e>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,s=s+n|0}while(--a);n%=65521,s%=65521}return n|s<<16|0};const B=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var G=(e,t,r,i)=>{const n=B,s=i+r;e^=-1;for(let r=i;r>>8^n[255&(e^t[r])];return-1^e},W={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},N={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:V,_tr_flush_block:z,_tr_tally:H,_tr_align:j}=O,{Z_NO_FLUSH:Y,Z_PARTIAL_FLUSH:X,Z_FULL_FLUSH:q,Z_FINISH:K,Z_BLOCK:Q,Z_OK:Z,Z_STREAM_END:J,Z_STREAM_ERROR:$,Z_DATA_ERROR:ee,Z_BUF_ERROR:te,Z_DEFAULT_COMPRESSION:re,Z_FILTERED:ie,Z_HUFFMAN_ONLY:ne,Z_RLE:se,Z_FIXED:ae,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:he,Z_DEFLATED:ue}=N,le=(e,t)=>(e.msg=W[t],t),ce=e=>2*e-(e>4?9:0),de=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fe=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let pe=(e,t,r)=>(t<{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},me=(e,t)=>{z(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ge(e.strm)},_e=(e,t)=>{e.pending_buf[e.pending++]=t},ve=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},be=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=D(e.adler,t,n,r):2===e.state.wrap&&(e.adler=G(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},we=(e,t)=>{let r,i,n=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const h=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,l=e.w_mask,c=e.prev,d=e.strstart+258;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(r=t,u[r+a]===p&&u[r+a-1]===f&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sa){if(e.match_start=t,a=i,i>=o)break;f=u[s+a-1],p=u[s+a]}}}while((t=c[t&l])>h&&0!=--n);return a<=e.lookahead?a:e.lookahead},ye=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-262)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fe(e),i+=t),0===e.strm.avail_in)break;if(r=be(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=pe(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=pe(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},xe=(e,t)=>{let r,i,n,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,ge(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(be(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_watern&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(be(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,s=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=s||(i||t===K)&&t!==Y&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===K&&0===e.strm.avail_in&&r===i?1:0,V(e,e.block_start,r,a),e.block_start+=r,ge(e.strm)),a?3:1)},Te=(e,t)=>{let r,i;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=we(e,r)),e.match_length>=3)if(i=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=pe(e,e.ins_h,e.window[e.strstart+1]);else i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2},Re=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(me(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=H(e,0,e.window[e.strstart-1]),i&&me(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const Se=[new Ee(0,0,0,0,xe),new Ee(4,4,8,4,Te),new Ee(4,5,16,8,Te),new Ee(4,6,32,32,Te),new Ee(4,4,16,16,Re),new Ee(8,16,32,32,Re),new Ee(8,16,128,128,Re),new Ee(8,32,128,256,Re),new Ee(32,128,258,1024,Re),new Ee(32,258,258,4096,Re)];function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ue,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),de(this.dyn_ltree),de(this.dyn_dtree),de(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),de(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),de(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ke=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||42!==t.status&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&113!==t.status&&666!==t.status?1:0},Me=e=>{if(ke(e))return le(e,$);e.total_in=e.total_out=0,e.data_type=he;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=-2,F(t),Z},Ce=e=>{const t=Me(e);var r;return t===Z&&((r=e.state).window_size=2*r.w_size,de(r.head),r.max_lazy_match=Se[r.level].max_lazy,r.good_match=Se[r.level].good_length,r.nice_match=Se[r.level].nice_length,r.max_chain_length=Se[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Pe=(e,t,r,i,n,s)=>{if(!e)return $;let a=1;if(t===re&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==ue||i<8||i>15||t<0||t>9||s<0||s>ae||8===i&&1!==a)return le(e,$);8===i&&(i=9);const o=new Ae;return e.state=o,o.strm=e,o.status=42,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Pe(e,t,ue,15,8,oe),deflateInit2:Pe,deflateReset:Ce,deflateResetKeep:Me,deflateSetHeader:(e,t)=>ke(e)||2!==e.state.wrap?$:(e.state.gzhead=t,Z),deflate:(e,t)=>{if(ke(e)||t>Q||t<0)return e?le(e,$):$;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===r.status&&t!==K)return le(e,0===e.avail_out?te:$);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ge(e),0===e.avail_out)return r.last_flush=-1,Z}else if(0===e.avail_in&&ce(t)<=ce(i)&&t!==K)return le(e,te);if(666===r.status&&0!==e.avail_in)return le(e,te);if(42===r.status&&0===r.wrap&&(r.status=113),42===r.status){let t=ue+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=ne||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ve(r,t),0!==r.strstart&&(ve(r,e.adler>>>16),ve(r,65535&e.adler)),e.adler=1,r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(57===r.status)if(e.adler=0,_e(r,31),_e(r,139),_e(r,8),r.gzhead)_e(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),_e(r,255&r.gzhead.time),_e(r,r.gzhead.time>>8&255),_e(r,r.gzhead.time>>16&255),_e(r,r.gzhead.time>>24&255),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(_e(r,255&r.gzhead.extra.length),_e(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=G(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,3),r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ge(e),0!==r.pending)return r.last_flush=-1,Z;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ge(e),0!==r.pending))return r.last_flush=-1,Z;_e(r,255&e.adler),_e(r,e.adler>>8&255),e.adler=0}if(r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(0!==e.avail_in||0!==r.lookahead||t!==Y&&666!==r.status){let i=0===r.level?xe(r,t):r.strategy===ne?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ye(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===se?((e,t)=>{let r,i,n,s;const a=e.window;for(;;){if(e.lookahead<=258){if(ye(e),e.lookahead<=258&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=e.strstart+258;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):Se[r.level].func(r,t);if(3!==i&&4!==i||(r.status=666),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Z;if(2===i&&(t===X?j(r):t!==Q&&(V(r,0,0,!1),t===q&&(de(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ge(e),0===e.avail_out))return r.last_flush=-1,Z}return t!==K?Z:r.wrap<=0?J:(2===r.wrap?(_e(r,255&e.adler),_e(r,e.adler>>8&255),_e(r,e.adler>>16&255),_e(r,e.adler>>24&255),_e(r,255&e.total_in),_e(r,e.total_in>>8&255),_e(r,e.total_in>>16&255),_e(r,e.total_in>>24&255)):(ve(r,e.adler>>>16),ve(r,65535&e.adler)),ge(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Z:J)},deflateEnd:e=>{if(ke(e))return $;const t=e.state.status;return e.state=null,113===t?le(e,ee):Z},deflateSetDictionary:(e,t)=>{let r=t.length;if(ke(e))return $;const i=e.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return $;if(1===n&&(e.adler=D(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(de(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ye(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=pe(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,ye(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,i.wrap=n,Z},deflateInfo:"pako deflate (from Nodeca project)"};const Le=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ie=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Le(r,t)&&(e[t]=r[t])}}return e},Oe=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Be[254]=Be[254]=1;var Ge=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,s,a=e.length,o=0;for(n=0;n>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},We=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const s=new Array(2*r);for(n=0,i=0;i4)s[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i1?s[n++]=65533:t<65536?s[n++]=t:(t-=65536,s[n++]=55296|t>>10&1023,s[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&De)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Be[e[r]]>t?r:t};var Fe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ve=Object.prototype.toString,{Z_NO_FLUSH:ze,Z_SYNC_FLUSH:He,Z_FULL_FLUSH:je,Z_FINISH:Ye,Z_OK:Xe,Z_STREAM_END:qe,Z_DEFAULT_COMPRESSION:Ke,Z_DEFAULT_STRATEGY:Qe,Z_DEFLATED:Ze}=N;function Je(e){this.options=Ie({level:Ke,method:Ze,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Ue.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Xe)throw new Error(W[r]);if(t.header&&Ue.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ge(t.dictionary):"[object ArrayBuffer]"===Ve.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Ue.deflateSetDictionary(this.strm,e),r!==Xe)throw new Error(W[r]);this._dict_set=!0}}function $e(e,t){const r=new Je(t);if(r.push(e,!0),r.err)throw r.msg||W[r.err];return r.result}Je.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?Ye:ze,"string"==typeof e?r.input=Ge(e):"[object ArrayBuffer]"===Ve.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(s===He||s===je)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=Ue.deflate(r,s),n===qe)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Ue.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Xe;if(0!==r.avail_out){if(s>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Je.prototype.onData=function(e){this.chunks.push(e)},Je.prototype.onEnd=function(e){e===Xe&&(this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var et={Deflate:Je,deflate:$e,deflateRaw:function(e,t){return(t=t||{}).raw=!0,$e(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,$e(e,t)},constants:N};var tt=function(e,t){let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R,E;const S=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,s=n-(t-e.avail_out),a=n+(e.avail_out-257),o=S.dmax,h=S.wsize,u=S.whave,l=S.wnext,c=S.window,d=S.hold,f=S.bits,p=S.lencode,g=S.distcode,m=(1<>>24,d>>>=b,f-=b,b=v>>>16&255,0===b)E[n++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=p[(65535&v)+(d&(1<>>=b,f-=b),f<15&&(d+=R[r++]<>>24,d>>>=b,f-=b,b=v>>>16&255,!(16&b)){if(0==(64&b)){v=g[(65535&v)+(d&(1<o){e.msg="invalid distance too far back",S.mode=16209;break e}if(d>>>=b,f-=b,b=n-s,y>b){if(b=y-b,b>u&&S.sane){e.msg="invalid distance too far back",S.mode=16209;break e}if(x=0,T=c,0===l){if(x+=h-b,b2;)E[n++]=T[x++],E[n++]=T[x++],E[n++]=T[x++],w-=3;w&&(E[n++]=T[x++],w>1&&(E[n++]=T[x++]))}else{x=n-y;do{E[n++]=E[x++],E[n++]=E[x++],E[n++]=E[x++],w-=3}while(w>2);w&&(E[n++]=E[x++],w>1&&(E[n++]=E[x++]))}break}}break}}while(r>3,r-=w,f-=w<<3,d&=(1<{const h=o.bits;let u,l,c,d,f,p,g=0,m=0,_=0,v=0,b=0,w=0,y=0,x=0,T=0,R=0,E=null;const S=new Uint16Array(16),A=new Uint16Array(16);let k,M,C,P=null;for(g=0;g<=15;g++)S[g]=0;for(m=0;m=1&&0===S[v];v--);if(b>v&&(b=v),0===v)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(_=1;_0&&(0===e||1!==v))return-1;for(A[1]=0,g=1;g<15;g++)A[g+1]=A[g]+S[g];for(m=0;m852||2===e&&T>592)return 1;for(;;){k=g-y,a[m]+1=p?(M=P[a[m]-p],C=E[a[m]-p]):(M=96,C=0),u=1<>y)+l]=k<<24|M<<16|C|0}while(0!==l);for(u=1<>=1;if(0!==u?(R&=u-1,R+=u):R=0,m++,0==--S[g]){if(g===v)break;g=t[r+a[m]]}if(g>b&&(R&d)!==c){for(0===y&&(y=b),f+=_,w=g-y,x=1<852||2===e&&T>592)return 1;c=R&d,n[c]=b<<24|w<<16|f-s|0}}return 0!==R&&(n[f+R]=g-y<<24|64<<16|0),o.bits=b,0};const{Z_FINISH:ot,Z_BLOCK:ht,Z_TREES:ut,Z_OK:lt,Z_STREAM_END:ct,Z_NEED_DICT:dt,Z_STREAM_ERROR:ft,Z_DATA_ERROR:pt,Z_MEM_ERROR:gt,Z_BUF_ERROR:mt,Z_DEFLATED:_t}=N,vt=16209,bt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function wt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<16180||t.mode>16211?1:0},xt=e=>{if(yt(e))return ft;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,lt},Tt=e=>{if(yt(e))return ft;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xt(e)},Rt=(e,t)=>{let r;if(yt(e))return ft;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ft:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Tt(e))},Et=(e,t)=>{if(!e)return ft;const r=new wt;e.state=r,r.strm=e,r.window=null,r.mode=16180;const i=Rt(e,t);return i!==lt&&(e.state=null),i};let St,At,kt=!0;const Mt=e=>{if(kt){St=new Int32Array(512),At=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(at(1,e.lens,0,288,St,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;at(2,e.lens,0,32,At,0,e.work,{bits:5}),kt=!1}e.lencode=St,e.lenbits=9,e.distcode=At,e.distbits=5},Ct=(e,t,r,i)=>{let n;const s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(t.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(t.subarray(r-i,r-i+n),s.wnext),(i-=n)?(s.window.set(t.subarray(r-i,r),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveEt(e,15),inflateInit2:Et,inflate:(e,t)=>{let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R=0;const E=new Uint8Array(4);let S,A;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yt(e)||!e.output||!e.input&&0!==e.avail_in)return ft;r=e.state,16191===r.mode&&(r.mode=16192),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,d=h,T=lt;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=vt;break}if((15&u)!==_t){e.msg="unknown compression method",r.mode=vt;break}if(u>>>=4,l-=4,x=8+(15&u),0===r.wbits&&(r.wbits=x),x>15||x>r.wbits){e.msg="invalid window size",r.mode=vt;break}r.dmax=1<>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=G(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>o&&(f=o),f&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(s,s+f),x)),512&r.flags&&4&r.wrap&&(r.check=G(r.check,i,f,s)),o-=f,s+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;f=0;do{x=i[s+f++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&f>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>=7&l,l-=7&l,r.mode=16206;break}for(;l<3;){if(0===o)break e;o--,u+=i[s++]<>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Mt(r),r.mode=16199,t===ut){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=vt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=vt;break}if(r.length=65535&u,u=0,l=0,r.mode=16194,t===ut)break e;case 16194:r.mode=16195;case 16195:if(f=r.length,f){if(f>o&&(f=o),f>h&&(f=h),0===f)break e;n.set(i.subarray(s,s+f),a),o-=f,s+=f,h-=f,a+=f,r.length-=f;break}r.mode=16191;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[s++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vt;break}r.have=0,r.mode=16197;case 16197:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},T=at(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid code lengths set",r.mode=vt;break}r.have=0,r.mode=16198;case 16198:for(;r.have>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=m,l-=m,r.lens[r.have++]=v;else{if(16===v){for(A=m+2;l>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=vt;break}x=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===v){for(A=m+3;l>>=m,l-=m,x=0,f=3+(7&u),u>>>=3,l-=3}else{for(A=m+7;l>>=m,l-=m,x=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vt;break}for(;f--;)r.lens[r.have++]=x}}if(r.mode===vt)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=vt;break}if(r.lenbits=9,S={bits:r.lenbits},T=at(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid literal/lengths set",r.mode=vt;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},T=at(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,T){e.msg="invalid distances set",r.mode=vt;break}if(r.mode=16199,t===ut)break e;case 16199:r.mode=16200;case 16200:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,tt(e,d),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;R=r.lencode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,r.length=v,0===_){r.mode=16205;break}if(32&_){r.back=-1,r.mode=16191;break}if(64&_){e.msg="invalid literal/length code",r.mode=vt;break}r.extra=15&_,r.mode=16201;case 16201:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;R=r.distcode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,64&_){e.msg="invalid distance code",r.mode=vt;break}r.offset=v,r.extra=15&_,r.mode=16203;case 16203:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vt;break}r.mode=16204;case 16204:if(0===h)break e;if(f=d-h,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vt;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),g=r.window}else g=n,p=a-r.offset,f=r.length;f>h&&(f=h),h-=f,r.length-=f;do{n[a++]=g[p++]}while(--f);0===r.length&&(r.mode=16200);break;case 16205:if(0===h)break e;n[a++]=r.length,h--,r.mode=16200;break;case 16206:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[s++]<{if(yt(e))return ft;let t=e.state;return t.window&&(t.window=null),e.state=null,lt},inflateGetHeader:(e,t)=>{if(yt(e))return ft;const r=e.state;return 0==(2&r.wrap)?ft:(r.head=t,t.done=!1,lt)},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,s;return yt(e)?ft:(i=e.state,0!==i.wrap&&16190!==i.mode?ft:16190===i.mode&&(n=1,n=D(n,t,r,0),n!==i.check)?pt:(s=Ct(e,t,r,r),s?(i.mode=16210,gt):(i.havedict=1,lt)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ut=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Lt=Object.prototype.toString,{Z_NO_FLUSH:It,Z_FINISH:Ot,Z_OK:Dt,Z_STREAM_END:Bt,Z_NEED_DICT:Gt,Z_STREAM_ERROR:Wt,Z_DATA_ERROR:Nt,Z_MEM_ERROR:Ft}=N;function Vt(e){this.options=Ie({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Pt.inflateInit2(this.strm,t.windowBits);if(r!==Dt)throw new Error(W[r]);if(this.header=new Ut,Pt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ge(t.dictionary):"[object ArrayBuffer]"===Lt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Pt.inflateSetDictionary(this.strm,t.dictionary),r!==Dt)))throw new Error(W[r])}function zt(e,t){const r=new Vt(t);if(r.push(e),r.err)throw r.msg||W[r.err];return r.result}Vt.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Ot:It,"[object ArrayBuffer]"===Lt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),s=Pt.inflate(r,a),s===Gt&&n&&(s=Pt.inflateSetDictionary(r,n),s===Dt?s=Pt.inflate(r,a):s===Nt&&(s=Gt));r.avail_in>0&&s===Bt&&r.state.wrap>0&&0!==e[r.next_in];)Pt.inflateReset(r),s=Pt.inflate(r,a);switch(s){case Wt:case Nt:case Gt:case Ft:return this.onEnd(s),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||s===Bt))if("string"===this.options.to){let e=Ne(r.output,r.next_out),t=r.next_out-e,n=We(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(s!==Dt||0!==o){if(s===Bt)return s=Pt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Vt.prototype.onData=function(e){this.chunks.push(e)},Vt.prototype.onEnd=function(e){e===Dt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Ht={Inflate:Vt,inflate:zt,inflateRaw:function(e,t){return(t=t||{}).raw=!0,zt(e,t)},ungzip:zt,constants:N};const{Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt}=et,{Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt}=Ht;var $t=jt,er=Yt,tr=Xt,rr=qt,ir=Kt,nr=Qt,sr=Zt,ar=Jt,or=N,hr={Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt,Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt,constants:N}},,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var i=r(40);Object.keys(i).forEach(e=>self[e]=i[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/sharing_m.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1;var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +let data = `class webcodecDecodeWorkerMessageChannel{static handleVDMSCMessage(e){let t=e.data;switch(t.cmd){case"init":{let e=t.id,o=t.context;WebcodecDecoders[e]||(WebcodecDecoders[e]=new WebcodecDecoder(e)),WebcodecDecoders[e].init(o)}break;case"configure":{let e=t.id,o=t.buffer,a=t.extraDataLen,d=t.Width,i=t.Height,r=t.ssrc,c=new Uint8Array(a),n=GROWABLE_HEAP_U8().subarray(o,o+a);return c.set(n),_free(o),WebcodecDecoders[e].configure(c,d,i,r),"configured"==WebcodecDecoders[e].videoDecoder.state?0:-1}case"decode":{let e=t.id,o=t.buffer,a=t.vclBufferSize,d=t.NewIDR,i=(t.vclNalCount,GROWABLE_HEAP_U8().subarray(o,o+a)),r=new Uint8Array(a);r.set(i),WebcodecDecoders[e].decode(r,d)}}}constructor(){this.decodeMSCManager=[]}addMSC(e){this.decodeMSCManager.push(e),e.onmessage=webcodecDecodeWorkerMessageChannel.handleVDMSCMessage}}const FRAME_ENC_SUCCEED=0,FRAME_ENC_OVERTIME=1,FRAME_ENC_FAILED=2,FRAME_DEC_SUCCEED=0,FRAME_DEC_OVERTIME=1,FRAME_DEC_FAILED=2,MONITOR_TIMEOUT_MS=3e4,MAX_TIMEOUT_MS=40,TIMEOUT_UP_STEP=20,SLOW_START_TIMEOUT=100,MAX_CACHE_SIZE=20,WEBCODEC_ERROR=3;function globalTracingError(e,t){postMessage({cmd:"globalTracingError",data:e,error:t})}function globalTraingReport(e,t){postMessage({cmd:"GlobalTracingDT",data:e,error:t})}function printError(e){postMessage({cmd:"printError",data:e})}class WebCodecPerformanceStatus{constructor({encode:e,id:t}){this.inputIndex=0,this.outputIndex=0,this.timeoutIndex=0,this.records=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.timeout_id=-1,this.enabled=!1,this.startTs=0,this.isFailed=!1,this.sumDelay=0,this.maxDelay=0,this.minDelay=1e6,this.encode=e,this.id=t||0}_report(){let e=performance.now();this.enabled=!1;let t=Math.round(e-this.startTs),o=1e3*this.inputIndex/t,a=1e3*this.outputIndex/t,d=this.sumDelay/(this.outputIndex||1),i=this.timeoutIndex/(this.inputIndex||1);postMessage({cmd:"webcodecperformance",id:this.id,encode:this.encode,avgDelay:d,inputIndex:this.inputIndex,inavgFps:o,outputIndex:this.outputIndex,outavgFps:a,failed:this.isFailed,ratio:i,elapsed:t})}start(){-1==this.timeout_id&&(this.enabled=!0,this.startTs=performance.now(),this.timeout_id=setTimeout((()=>{this._report()}),3e4))}stop(e){this.isFailed=e,-1!=this.timeout_id&&clearTimeout(this.timeout_id),this._report()}inputInc(){this.inputIndex++,this.enabled&&(this.records[this.inputIndex%20]=performance.now())}outputInc(){if(this.outputIndex++,!this.enabled)return;let e=performance.now()-this.records[this.outputIndex%20];this.sumDelay+=e}}var Module={},initializedJS=!1,pendingNotifiedProxyingQueues=[],enableVBWasmBackend=0,codecMRG=new CodecMRG;Module.codecMRG=codecMRG;var multiThreadFlag,model,tfjsUrl,prob,mask,firstpayload,afnModel,frame=null,modelArtifacts={},IOhandle={};IOhandle.load=function(){return modelArtifacts},IOhandle.save=function(){};var baseModel,afnModelArtifacts={},afnIOHandle={},baseModelArtifacts={},baseIOHandle={};let tfInitPromise,webcodecDecodeFlag=!1,webcodecEncodeFlag=!1;afnIOHandle.load=function(){return afnModelArtifacts},afnIOHandle.save=function(){},baseIOHandle.load=function(){return baseModelArtifacts},baseIOHandle.save=function(){};var decHAOption,dualModelOKCount=0,tfLoad=!1;let webcodecDecodeWorkerMSC,decodeThreadSSRC,wasmDecodeWorkerMSC=null;function initTf(e){tfLoad||(importScripts(e),tfLoad=!0,tfInitPromise=tf.setBackend("webgl").then((e=>{if(!e)return Promise.reject("init tf fail 1")})).catch((()=>{if(!enableVBWasmBackend)return postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 2");const t=e.substr(0,e.lastIndexOf("/")+1);return importScripts(t+"tf-backend-wasm.min.js"),tf.wasm.setWasmPaths(t),tf.setBackend("wasm").then((e=>{if(!e)return postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 3")}),(()=>(postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 4"))))})))}function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var chunk,err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var o=new WebAssembly.Instance(Module.wasmModule,e);return t(o),Module.wasmModule=null,o.exports},self.addEventListener("unhandledrejection",(function(e){let t="";const o=e?.reason;(o instanceof Error||o instanceof ErrorEvent)&&(t+=" Message: "+o?.message+" Stack: "+(o?.error?.stack??o?.stack)),globalTracingError("Unhandled Rejection: "+JSON.stringify(e?.reason??e)+t)})),self.addEventListener("error",(e=>{globalTracingError("Message: "+e?.message+" Stack:"+e?.error?.stack)})),self.onmessage=e=>{try{if("load"===e.data.cmd){Module.wasmModule=e.data.wasmModule;for(const t of e.data.handlers)Module[t]=function(){postMessage({cmd:"callHandler",handler:t,args:[...arguments]})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,Module.isTeslaMode=e.data.isTeslaMode,Module.is360penablehwenc=!!e.data.is360penablehwenc,Module.is360penablehwdec=!!e.data.is360penablehwdec,Module.isAndroid=e.data.isAndroid,"string"==typeof e.data.urlOrBlob)importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}}else if("run"===e.data.cmd){Module.__performance_now_clock_drift=performance.now()-e.data.time,Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(pendingNotifiedProxyingQueues.forEach((e=>{Module.executeNotifiedProxyingQueue(e)})),pendingNotifiedProxyingQueues=[],initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(e){if("unwind"!=e){if(!(e instanceof Module.ExitStatus))throw e;Module.keepRuntimeAlive()||Module.__emscripten_thread_exit(e.status)}}}else if("cancel"===e.data.cmd)Module._pthread_self()&&Module.__emscripten_thread_exit(-1);else if("setimmediate"===e.data.target);else if("processProxyingQueue"===e.data.cmd)initializedJS?Module.executeNotifiedProxyingQueue(e.data.queue):pendingNotifiedProxyingQueues.push(e.data.queue);else if("videoframe"===e.data.cmd)frame&&(frame.close(),postMessage({cmd:"video_un_ref"})),frame=e.data.data;else if("vdmsc1"===e.data.cmd)wasmDecodeWorkerMSC=e.ports[0];else if("vdmsc2"===e.data.cmd)webcodecDecodeWorkerMSC||(webcodecDecodeWorkerMSC=new webcodecDecodeWorkerMessageChannel),webcodecDecodeWorkerMSC.addMSC(e.ports[0]);else if("VideoEncodeConfigure"===e.data.cmd){var o=e.data.Width,a=e.data.Height,d=e.data.id,i=e.data.Bitrate,r=e.data.Framerate,c=e.data.buffer;Module.codecMRG.configEncodeWebCodec(d,i,r,o,a,c)}else if("VideoEncodeInit"===e.data.cmd){d=e.data.id;var n=e.data.context;Module.codecMRG.initEncodeWebCodec(d,n)}else if("VideoEncode"===e.data.cmd){var s=e.data.videoFrameId,l=e.data.dataLength,u=(d=e.data.id,e.data.NewIDR),f=e.data.rawData,h=e.data.timeout;Module.codecMRG.encodeVideoFrame(d,s,u,f,l,h)}else if("CloseVideoEncode"===e.data.cmd)Module.codecMRG.closeVideoEncode();else if("multiThreadFlag"===e.data.cmd)multiThreadFlag=e.data.multiThreadFlag;else if("vbObj0"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;var m=e.data.modelJSON;if(modelArtifacts.modelTopology=m.modelTopology,modelArtifacts.format=m.format,modelArtifacts.generatedBy=m.generatedBy,modelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(var p=0;p{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(IOhandle).then((function(e){model=e,postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=tf.tensor4d(t,[1,144,256,3],"float32");model.predict(o),postMessage({cmd:"vbPredictDone"})}))}))}else if("vbObj1"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;m=e.data.modelJSON;if(afnModelArtifacts.modelTopology=m.modelTopology,afnModelArtifacts.format=m.format,afnModelArtifacts.generatedBy=m.generatedBy,afnModelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(p=0;p{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(afnIOHandle).then((function(e){afnModel=e,0==dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=new Float32Array(110592),a=new Float32Array(36864),d=tf.tensor4d(t,[1,144,256,3],"float32"),i=tf.tensor4d(o,[1,144,256,3],"float32"),r=tf.tensor4d(a,[1,144,256,1],"float32");afnModel.predict([d,i,r]),2==++dualModelOKCount&&postMessage({cmd:"vbPredictDone"})}))}))}else if("vbObj2"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;m=e.data.modelJSON;if(baseModelArtifacts.modelTopology=m.modelTopology,baseModelArtifacts.format=m.format,baseModelArtifacts.generatedBy=m.generatedBy,baseModelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(p=0;p{tf.loadGraphModel(baseIOHandle).then((function(e){baseModel=e,0==dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=tf.tensor4d(t,[1,144,256,3],"float32");baseModel.predict(o),2==++dualModelOKCount&&postMessage({cmd:"vbPredictDone"})}))}))}else if("vbFlag"==e.data.cmd)enableVBWasmBackend=e.data.enableVBWasmBackend;else if("vb"==e.data.cmd)multiThreadFlag=!1;else if("webcodec"==e.data.cmd)noExitRuntime=!0,decHAOption=e.data.decHAOption;else if("webcodecfailed"==e.data.cmd){let t=e.data.encode,o=e.data.id;t?codecMRG?.webcodecFailed(o):WebcodecDecoders[o].failed()}else err("worker.js received unknown command "+e.data.cmd),err(e.data)}catch(e){throw postMessage({cmd:"tCrashed",data:e.toString()}),Module.__emscripten_thread_crashed,e}};var WebcodecDecoders=[];function WebcodecDecoder(e){this.id=e,this.videoDecoder=null,this.context=null,this.decodeOutputIndex=0,this.videoFrameBuffer=[],this.ssrc=0,this.continuoustimeout=0,this.timeoutcount=0,this.timeout=MAX_TIMEOUT_MS,this.webcodecStatus=new WebCodecPerformanceStatus({encode:!1,id:e}),this.paintFrameToCanvas=function(e){this.webcodecStatus.outputInc(),this.timeout_id?(this.continuoustimeout=0,postMessage({cmd:"decoded_webcodec",data:e,id:this.id,frameIndex:this.decodeOutputIndex,ssrc:this.ssrc},[e]),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_SUCCEED,this.decodeOutputIndex),this.closeTimeout(),this.decodeOutputIndex++):e.close()},this.onDecoderError=function(e){globalTracingError("onDecoderError",e),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0),this.closeTimeout()}}function InitVideoDecoder_js(e,t){return wasmDecodeWorkerMSC?(wasmDecodeWorkerMSC.postMessage({cmd:"init",id:e,context:t}),0):-1}function VideoDecoderConfigure_js(e,t,o,a,d){if(wasmDecodeWorkerMSC){let r=_malloc(o);if(!r)return-1;var i=GROWABLE_HEAP_U8().subarray(t,t+o);return writeArrayToMemory(i,r),wasmDecodeWorkerMSC.postMessage({cmd:"configure",id:e,buffer:r,extraDataLen:o,Width:a,Height:d,ssrc:decodeThreadSSRC}),0}return-1}function VideoDecoder_js(e,t,o,a,d){return wasmDecodeWorkerMSC?(wasmDecodeWorkerMSC.postMessage({cmd:"decode",id:e,buffer:t,vclBufferSize:o,NewIDR:a,vclNalCount:d}),0):-1}function GetEncThreadNum(){return 1}function GetCscThreadNum(){return 1}function js_info_from_wcl(e,t,o){var a=new Uint8Array(o),d=GROWABLE_HEAP_I8().subarray(t+0,t+o);a.set(d,0,o),postMessage({cmd:"js_info_from_wcl",data:a},[a.buffer])}function decode_callback(e,t){postMessage({cmd:"size",ssrc:e,size:t})}function frame_callback(e,t,o,a,d,i,r,c,n,s,l,u){var f=a;f=f>>10<<10,postMessage({cmd:"decoded",status:0,yuvdataptr:e,yuvdata:e,yuvlength:t,ntptime:0,ssrc:f,width:d,height:i,r_x:r,r_y:c,r_w:n,r_h:s,rotation:l,yuv_limited:u})}function frame_callback_webcodec(e,t,o,a,d,i,r,c,n,s,l,u){postMessage({cmd:"decoded_webcodec_render",status:0,id:e,iFrameNum:t,timestamp:o,ssrc:a,format_width:d,format_height:i,rendering_x:r,rendering_y:c,rendering_width:n,rendering_height:s,rotation:l,yuv_limited:u})}WebcodecDecoder.prototype.failed=function(){this.webcodecStatus.stop(!0),this.closeTimeout()},WebcodecDecoder.prototype.init=function(e){this.videoDecoder=new VideoDecoder({output:this.paintFrameToCanvas.bind(this),error:this.onDecoderError.bind(this)}),this.videoDecoder||globalTracingError("error creating VideoDecoder"),this.context=e,this.webcodecStatus.start()},WebcodecDecoder.prototype.configure=function(e,t,o,a){try{this.ssrc=a;let d={codec:"avc1.640028",description:e,codedWidth:t,codedHeight:o,optimizeForLatency:!0,hardwareAcceleration:decHAOption||"prefer-hardware"};this.videoDecoder.configure(d),this.closeTimeout()}catch(e){globalTracingError("Error configuring VideoDecoder",e),this.context&&Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0)}},WebcodecDecoder.prototype.decode=function(e,t){try{1==t?(chunk=new EncodedVideoChunk({type:"key",timestamp:0,duration:0,data:e}),firstpayload=0):chunk=new EncodedVideoChunk({type:"delta",timestamp:0,duration:0,data:e}),webcodecDecodeFlag||(webcodecDecodeFlag=!0,globalTraingReport("webcodec decode start")),this.videoDecoder.decode(chunk),this.webcodecStatus.inputInc(),this.checkTimoutRatio(),this.closeTimeout(),this.startTimeout()}catch(e){globalTracingError("Error decoding in WebcodecDecoder",e),this.context&&Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0)}return 0},WebcodecDecoder.prototype.getTimeout=function(){this.continuoustimeout>1?this.webcodecStatus.inputIndex<5?this.timeout=100:this.timeout+=20:this.timeout=MAX_TIMEOUT_MS},WebcodecDecoder.prototype.startTimeout=function(){UserWebCodecController_js()&&(this.getTimeout(),this.timeout_id=setTimeout((()=>{this.timeout_id=0,this.continuoustimeout++,this.webcodecStatus.timeoutIndex++,Module._OnVideoFrameOutputCallback(this.context,1,0),this.checkAvailability()}),this.timeout))},WebcodecDecoder.prototype.closeTimeout=function(){this.timeout_id&&(clearTimeout(this.timeout_id),this.timeout_id=0)},WebcodecDecoder.prototype.checkTimoutRatio=function(){if(this.webcodecStatus.inputIndex%50)return;let e=this.webcodecStatus.timeoutIndex-this.timeoutcount;this.timeoutcount=this.webcodecStatus.timeoutIndex,e>=15&&(globalTracingError("webcodec decode timed out ratio: "+Math.round(100*e/50)),this.closeTimeout(),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0))},WebcodecDecoder.prototype.checkAvailability=function(){this.webcodecStatus.inputIndex-this.webcodecStatus.outputIndex>=20&&setTimeout((()=>{this.webcodecStatus.inputIndex-this.webcodecStatus.outputIndex>=20&&(globalTracingError("webcodec decode failed exceeded maximum cache frame"),this.closeTimeout(),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0))}),1e3)};var encodereclaim=0;function WebcodecEncoder(e){this.id=e,this.handle=null,this.context=null,this.bsBuffer=null,this.timeoutid=-1,this.encodereclaimcount=0,this.webcodecStatus=new WebCodecPerformanceStatus({encode:!0,id:e})}function CodecMRG(){this.decodeCodecHandles=new Map,this.encodeCodecHandles=new Map}function UserAgentIsTesla_js(){return Module.isTeslaMode}function LimitWebCodecsEncoderTo360_js(){return Module.is360penablehwenc}function LimitWebCodecsDecoderTo360_js(){return Module.is360penablehwdec}function js_info_from_wcl_video_data(e,t,o,a,d,i){var r=new Uint8Array(o+4),c=GROWABLE_HEAP_I8().subarray(t+0,t+o);r[0]=a,r[1]=d,r.set(c,4,o),postMessage({cmd:"js_info_from_wcl_video_data",ssrc:e,data:r,is_sent_by_data:i},[r.buffer])}function processed_capture_data_callback(e,t,o,a,d,i,r,c,n,s){postMessage({cmd:"processed_capture_data_callback",ssrc:e,data:t,len_of_data:o,format_width:a,format_height:d,valid_x:i,valid_y:r,valid_width:c,valid_height:n,yuv_limited:s})}function SAVE_IV(e,t){postMessage({cmd:"SAVE_IV",ptr:e,len:t})}function change_capture_resolution(e){postMessage({cmd:"change_capture_resolution",type:e})}function APP_Troubleshoting_Info(e,t){postMessage({cmd:"APP_Troubleshoting_Info",data:e,len:t})}function IsSupportMultiThread(){return multiThreadFlag?1:0}function hardcodecpunumber(){return navigator.hardwareConcurrency||1}function setCurrentThreadSsrc_js(e){decodeThreadSSRC=e}function execute(e,t,o,a){if(model)try{var d=new Float32Array(GROWABLE_HEAP_U8().buffer,e,t),i=tf.tensor4d(d,[1,144,256,3],"float32"),r=model.predict(i),c=Float32Array.from(r.as1D(36864).arraySync());return GROWABLE_HEAP_F32().set(c,o>>2),i.dispose(),r.dispose(),0}catch(e){return globalTracingError("Multi Thread VB error",e),-1}}function execute_base(e,t,o,a){return tf.tidy((()=>{var d=new Float32Array(wasmMemory.buffer,e,t),i=tf.tensor4d(d,[1,144,256,3],"float32"),r=baseModel.predict(i);1==r[1].size?(mask=Float32Array.from(r[0].as1D(36864).arraySync()),prob=Float32Array.from(r[1].as1D(1).arraySync())):(mask=Float32Array.from(r[1].as1D(36864).arraySync()),prob=Float32Array.from(r[0].as1D(1).arraySync()));let c=new Float32Array(wasmMemory.buffer);c.set(mask,o>>2),c.set(prob,a>>2)})),0}function execute_afn(e,t,o,a,d){return tf.tidy((()=>{var i=new Float32Array(GROWABLE_HEAP_U8().buffer,e,a),r=new Float32Array(GROWABLE_HEAP_U8().buffer,t,a),c=new Float32Array(GROWABLE_HEAP_U8().buffer,o,a/3),n=tf.tensor4d(i,[1,144,256,3],"float32"),s=tf.tensor4d(r,[1,144,256,3],"float32"),l=tf.tensor4d(c,[1,144,256,1],"float32"),u=afnModel.predict([n,s,l]);mask=Float32Array.from(u.as1D(36864).arraySync()),GROWABLE_HEAP_F32().set(mask,d>>2)})),0}function MCMMonitor_Video_LOG(e,t){var o=new Uint8Array(t),a=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(a),postMessage({cmd:"MCM_VIDEO_LOG",data:o},[o.buffer])}function wcl_trace_log(e,t){var o=new Uint8Array(t),a=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(a,0,t),postMessage({cmd:"wcl_trace_log",data:o},[o.buffer])}function WebCodecsEncoderFail_js(e,t){postMessage({cmd:"WCEF",data:e,code:t})}function WebCodecsDecoderFail_js(e){postMessage({cmd:"WCDF",data:e})}function UserWebCodecController_js(){return Module.isAndroid}WebcodecEncoder.prototype.EncodedVideoChunkOutputCallback=function(e){if(this.webcodecStatus.outputInc(),this.webcodecStatus.inputIndex==this.webcodecStatus.outputIndex&&-1!=this.timeoutid){this._stopTimeout();var t=e.byteLength,o=GROWABLE_HEAP_U8().subarray(this.bsBuffer,this.bsBuffer+t);e.copyTo(o),Module._OnEncodedVideoChunkOutputCallback(this.context,0,t)}},WebcodecEncoder.prototype.onEncoderError=function(e){let t=e&&-1!==e.toString().indexOf("reclaimed")&&++this.encodereclaimcount<2;t?(postMessage({cmd:"reclaimed",data:0}),encodereclaim=1):postMessage({cmd:"reclaimed",data:-1}),frame&&(frame.close(),frame=null),t?globalTracingError("VideoEncoder reclaimed"):(WebCodecsEncoderFail_js(this.id,3),globalTracingError("VideoEncoder error",e),Module._OnEncodedVideoChunkOutputCallback(this.context,2,0),codecMRG.closeVideoEncode())},WebcodecEncoder.prototype.init=function(e,t){this.id=e,this.context=t,this.handle=new VideoEncoder({output:this.EncodedVideoChunkOutputCallback.bind(this),error:this.onEncoderError.bind(this)}),this.webcodecStatus.start()},WebcodecEncoder.prototype.configure=function(e,t,o,a,d){try{if(encodereclaim&&(this.handle=new VideoEncoder({output:this.EncodedVideoChunkOutputCallback.bind(this),error:this.onEncoderError.bind(this)}),encodereclaim=0),this.handle){var i={codec:"avc1.640028",bitrate:e,width:o,height:a,avc:{format:"annexb"},framerate:t,hardwareAcceleration:"no-preference",latencyMode:"realtime",bitrateMode:"constant",scalabilityMode:"L1T2"};this.handle.configure(i),this.bsBuffer=d}}catch(e){this.onEncoderError(e)}},WebcodecEncoder.prototype.encode=function(e,t,o,a,d){if(this._startTimeout(t,d),this.handle){var i={keyFrame:!1};1==t&&(i.keyFrame=!0),webcodecEncodeFlag||(webcodecEncodeFlag=!0,globalTraingReport("webcodec encode start")),this.webcodecStatus.inputIndex%200==0&&postMessage({cmd:"THWEC"}),this.webcodecStatus.inputInc(),this.handle.encode(frame,i),frame.close(),frame=null,postMessage({cmd:"video_un_ref"})}},WebcodecEncoder.prototype._stopTimeout=function(){-1!=this.timeoutid&&(clearTimeout(this.timeoutid),this.timeoutid=-1)},WebcodecEncoder.prototype._startTimeout=function(e,t){this._stopTimeout(),this.timeoutid=setTimeout((()=>{this.timeoutid=-1,this.context&&Module._OnEncodedVideoChunkOutputCallback(this.context,1,0),this.webcodecStatus.timeoutIndex++}),t)},WebcodecEncoder.prototype.close=function(){"closed"!=this.handle.state&&(this.handle.close(),this.handle=null),codecMRG.clear_encodestate()},WebcodecEncoder.prototype.failed=function(){this.webcodecStatus.stop(!0)},CodecMRG.prototype.initEncodeWebCodec=function(e,t){var o=this.encodeCodecHandles.get(e);o||(o=new WebcodecEncoder(e),this.encodeCodecHandles.set(e,o)),o.init(e,t)},CodecMRG.prototype.configEncodeWebCodec=function(e,t,o,a,d,i){var r=this.encodeCodecHandles.get(e);r&&r.configure(t,o,a,d,i)},CodecMRG.prototype.encodeVideoFrame=function(e,t,o,a,d,i){var r=this.encodeCodecHandles.get(e);r&&r.encode(t,o,a,d,i)},CodecMRG.prototype.webcodecFailed=function(e){var t=this.encodeCodecHandles.get(e);t&&t.failed()},CodecMRG.prototype.closeVideoEncode=function(){var e=this.encodeCodecHandles.get(0);e&&e.close()},CodecMRG.prototype.clear_encodestate=function(){this.encodeCodecHandles&&this.encodeCodecHandles.clear()};` + return URL.createObjectURL(new Blob([data],{type:"application/javascript", label:"sharing.thread"})) +} +Module["mainScriptUrlOrBlob"] = String.raw`function GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP16}function GROWABLE_HEAP_U16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU16}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var ENVIRONMENT_IS_PTHREAD=Module["ENVIRONMENT_IS_PTHREAD"]||false;var _scriptDir=typeof document!="undefined"&&document.currentScript?document.currentScript.src:undefined;if(ENVIRONMENT_IS_WORKER){_scriptDir=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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.buffer instanceof SharedArrayBuffer?heapOrArray.slice(idx,endPtr):heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;if(ENVIRONMENT_IS_PTHREAD){buffer=Module["buffer"]}function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||67108864;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module["wasmMemory"];buffer=Module["buffer"]}else{if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2097152e3/65536,"shared":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag");if(ENVIRONMENT_IS_NODE){err("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)")}throw Error("bad memory")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;if(ENVIRONMENT_IS_PTHREAD)return;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="video.mt.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;registerTLSInit(Module["asm"]["_emscripten_tls_init"]);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){removeRunDependency("wasm-instantiate")}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency("wasm-instantiate")}function receiveInstantiationResult(result){receiveInstance(result["instance"],result["module"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={365788:$0=>{console.log("Video Version: ",$0)},365825:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},365859:$0=>{change_capture_resolution($0)},365894:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},365971:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},366041:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_webcodec($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},366120:($0,$1)=>{decode_callback($0,$1)},366149:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},366183:($0,$1,$2,$3)=>{Video_Controller_Encode_Data2($0,$1,$2,$3)},366231:($0,$1)=>{SAVE_IV($0,$1)},366249:($0,$1,$2,$3)=>{Video_Controller_Encode_Data($0,$1,$2,$3)},366296:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},366353:$0=>{Exit_Thread($0)},366371:$0=>{return Before_Create_Thread($0)},366408:$0=>{return Before_Create_Thread($0)},366445:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},366479:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},366519:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},366549:$0=>{SubScribeUpdateVideo($0)},366577:()=>{return Date.now()/1e3},366604:()=>{return Date.now()%1e3},366631:($0,$1)=>{send_data($0,$1)},366654:$0=>{SubScribeUpdateVideo($0)},366682:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},366743:($0,$1)=>{SAVE_IV($0,$1)},366761:()=>{return Date.now()},366784:($0,$1)=>{Update_Required_Bandwidth($0,$1)},366820:$0=>{Update_Video_Hd_Info($0)},366850:$0=>{console.log("Sharing Version: ",$0)},366889:($0,$1,$2,$3)=>{Send_Multi_Data($0,$1,$2,$3)},366923:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},366945:($0,$1,$2)=>{Send_Data($0,$1,$2)},366969:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},366997:($0,$1,$2)=>{Send_Data($0,$1,$2)},367021:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367049:($0,$1,$2)=>{Send_Data($0,$1,$2)},367073:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},367111:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},367148:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367179:($0,$1,$2)=>{Send_Data($0,$1,$2)},367206:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367236:($0,$1,$2)=>{Send_Data($0,$1,$2)},367263:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)=>{frame_callback_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)},367354:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_mouse_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},367441:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},367473:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},367518:$0=>{SubScribeUpdateSharing($0)},367548:($0,$1)=>{Send_Data($0,$1)},367571:$0=>{Update_WebSokcet_Speed($0)},367603:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},367666:($0,$1)=>{SAVE_IV($0,$1)},367684:$0=>{console.error("tjDecompressHeader3 error %d ",$0)},367737:$0=>{console.error("tjDecompress2 error %d ",$0)},367784:($0,$1,$2,$3)=>{Sharing_Decode_Channel_Change($0,$1,$2,$3)},367831:($0,$1)=>{Update_Required_Bandwidth($0,$1)},367867:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},367898:($0,$1)=>{Recieve_Wb_Packet($0,$1)},367925:$0=>{release_video_receiving_channle($0)},367965:()=>{videocodec_create_helpthread()},367999:()=>{console.error("_do_sharing_controller_decode: start")},368055:()=>{console.error("_do_sharing_controller_decode: waiting msg ")},368118:$0=>{console.error("_do_sharing_controller_decode: ",$0)},368173:($0,$1,$2)=>{console.error("_do_sharing_controller_decode: Try_Analysis ",$0,$1,$2)},368248:()=>{console.error("_do_sharing_controller_decode: main session _Set_Sharing_Encryption_Key_Directly ")},368349:()=>{console.error("_do_sharing_controller_decode: _Set_Sharing_Encryption_Key_Directly ")},368437:()=>{console.error("SHARING_DECODE_NETWORK_INFO WCLSharing is null")},368503:()=>{console.error("SHARING_DECODE_REQUEST_CHECK_ONE_TYPE WCLSharing is null")},368579:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA WCLSharing is null",$0,$1)},368652:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA type unknwon",$0,$1)},368719:($0,$1)=>{wcl_sharing_inited($0,$1)},368748:($0,$1,$2,$3,$4)=>{video_data_from_qos($0,$1,$2,$3,$4)},368793:($0,$1,$2,$3,$4,$5)=>{video_as_data_from_qos($0,$1,$2,$3,$4,$5)},368845:($0,$1)=>{wcl_trace_log($0,$1)},368869:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},368909:($0,$1)=>{COMMIT_PRINT($0,$1)},368931:()=>{videoencode_create_helpthread()},368966:($0,$1)=>{LOG_OUT($0,$1)},368987:($0,$1)=>{wcl_trace_log($0,$1)}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function killThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];delete PThread.pthreads[pthread_ptr];worker.terminate();__emscripten_thread_free_data(pthread_ptr);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0}function cancelThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];worker.postMessage({"cmd":"cancel"})}function cleanupThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];assert(worker);PThread.returnWorkerToPool(worker)}function spawnThread(threadParams){var worker=PThread.getNewWorker();if(!worker){return 6}PThread.runningWorkers.push(worker);PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={"cmd":"run","start_routine":threadParams.startRoutine,"arg":threadParams.arg,"pthread_ptr":threadParams.pthread_ptr};worker.runPthread=()=>{msg.time=performance.now();worker.postMessage(msg,threadParams.transferList);delete worker.runPthread};if(worker.loaded){worker.runPthread()}return 0}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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,GROWABLE_HEAP_I8(),ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}GROWABLE_HEAP_I32()[buf>>2]=stat.dev;GROWABLE_HEAP_I32()[buf+8>>2]=stat.ino;GROWABLE_HEAP_I32()[buf+12>>2]=stat.mode;GROWABLE_HEAP_U32()[buf+16>>2]=stat.nlink;GROWABLE_HEAP_I32()[buf+20>>2]=stat.uid;GROWABLE_HEAP_I32()[buf+24>>2]=stat.gid;GROWABLE_HEAP_I32()[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+40>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+44>>2]=tempI64[1];GROWABLE_HEAP_I32()[buf+48>>2]=4096;GROWABLE_HEAP_I32()[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+56>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+60>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+72>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+76>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+88>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+92>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+104>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=GROWABLE_HEAP_U8().slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;if(!implicit){if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw"unwind"}else{}}_proc_exit(status)}var _exit=exitJS;function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}var PThread={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){if(ENVIRONMENT_IS_PTHREAD){PThread.initWorker()}else{PThread.initMainThread()}},initMainThread:function(){},initWorker:function(){noExitRuntime=false},setExitStatus:function(status){EXITSTATUS=status},terminateAllThreads:function(){for(var worker of Object.values(PThread.pthreads)){PThread.returnWorkerToPool(worker)}for(var worker of PThread.unusedWorkers){worker.terminate()}PThread.unusedWorkers=[]},returnWorkerToPool:function(worker){var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0;__emscripten_thread_free_data(pthread_ptr)},receiveObjectTransfer:function(data){},threadInitTLS:function(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=e=>{var d=e["data"];var cmd=d["cmd"];if(worker.pthread_ptr)PThread.currentProxiedOperationCallerThread=worker.pthread_ptr;if(d["targetThread"]&&d["targetThread"]!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];if(targetWorker){targetWorker.postMessage(d,d["transferList"])}else{err('Internal error! Worker sent a message "'+cmd+'" to target pthread '+d["targetThread"]+", but that thread no longer exists!")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd==="processProxyingQueue"){executeNotifiedProxyingQueue(d["queue"])}else if(cmd==="spawnThread"){spawnThread(d)}else if(cmd==="cleanupThread"){cleanupThread(d["thread"])}else if(cmd==="killThread"){killThread(d["thread"])}else if(cmd==="cancelThread"){cancelThread(d["thread"])}else if(cmd==="loaded"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread()}}else if(cmd==="print"){out("Thread "+d["threadId"]+": "+d["text"])}else if(cmd==="printErr"){err("Thread "+d["threadId"]+": "+d["text"])}else if(cmd==="alert"){alert("Thread "+d["threadId"]+": "+d["text"])}else if(d.target==="setimmediate"){worker.postMessage(d)}else if(cmd==="callHandler"){Module[d["handler"]](...d["args"])}else if(cmd){err("worker sent an unknown command "+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=e=>{var message="worker sent an error!";err(message+" "+e.filename+":"+e.lineno+": "+e.message);throw e};var handlers=[];var knownHandlers=["onExit","onAbort","print","printErr"];for(var handler of knownHandlers){if(Module.hasOwnProperty(handler)){handlers.push(handler)}}worker.postMessage({"cmd":"load","handlers":handlers,"urlOrBlob":Module["mainScriptUrlOrBlob"]||_scriptDir,"wasmMemory":wasmMemory,"wasmModule":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile("video.mt.worker.js");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}return PThread.unusedWorkers.pop()}};Module["PThread"]=PThread;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(GROWABLE_HEAP_I32()[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function establishStackSpace(){var pthread_ptr=_pthread_self();var stackTop=GROWABLE_HEAP_I32()[pthread_ptr+52>>2];var stackSize=GROWABLE_HEAP_I32()[pthread_ptr+56>>2];var stackMax=stackTop-stackSize;_emscripten_stack_set_limits(stackTop,stackMax);stackRestore(stackTop)}Module["establishStackSpace"]=establishStackSpace;function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,0,returnCode);try{_exit(returnCode)}catch(e){handleException(e)}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function invokeEntryPoint(ptr,arg){var result=getWasmTableEntry(ptr)(arg);if(keepRuntimeAlive()){PThread.setExitStatus(result)}else{__emscripten_thread_exit(result)}}Module["invokeEntryPoint"]=invokeEntryPoint;function registerTLSInit(tlsInitFunc){PThread.tlsInitFunctions.push(tlsInitFunc)}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function _AdapterWhiteListCheck(){return checkWebCodecWhitelist_js()}function _CloseVideoEncoder(id){CloseVideoEncoder_js(id)}function _CreateGltPlatform(){err("missing function: CreateGltPlatform");abort(-1)}function _DestroyGltPlatform(){err("missing function: DestroyGltPlatform");abort(-1)}function _EncodeVideoFrameID(type,numb){return EncodeVideoFrameID_js(type,numb)}function _GetEncoderState(id){return GetEncoderState_js(id)}function _GetLogLevel(){return GetLogLevel_js()}function _InitVideoDecoder(id,context){return InitVideoDecoder_js(id,context)}function _InitVideoEncoder(id,context){return InitVideoEncoder_js(id,context)}function _LimitWebCodecsDecoderTo360(){return LimitWebCodecsDecoderTo360_js()}function _LimitWebCodecsEncoderTo360(){return LimitWebCodecsEncoderTo360_js()}function _Set_Share_Mode(flag){return Set_Share_Mode_js(flag)}function _UserAgentIsTesla(){return UserAgentIsTesla_js()}function _VideoDecoder(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount){return VideoDecoder_js(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount)}function _VideoDecoderConfigure(id,extradata,extraDataLen,Width,Height){return VideoDecoderConfigure_js(id,extradata,extraDataLen,Width,Height)}function _VideoEncoderConfigure(id,Bitrate,Framerate,Width,Height,bsBuffer){return VideoEncoderConfigure_js(id,Bitrate,Framerate,Width,Height,bsBuffer)}function _WebCodecsDecoderFail(m_iID){WebCodecsDecoderFail_js(m_iID)}function _WebCodecsEncoderFail(m_iID,code){WebCodecsEncoderFail_js(m_iID,code)}function _WebCodecsVideoEncoder(id,videoFrameId,NewIDR,rawData,dataLength,timeout){return VideoEncoder_js(id,videoFrameId,NewIDR,rawData,dataLength,timeout)}function __ZN11cpt_generic6thread4joinEv(){err("missing function: _ZN11cpt_generic6thread4joinEv");abort(-1)}function __ZN11cpt_generic6threadD1Ev(){err("missing function: _ZN11cpt_generic6threadD1Ev");abort(-1)}function __ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE(){err("missing function: _ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE");abort(-1)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){GROWABLE_HEAP_U32()[this.ptr+4>>2]=type};this.get_type=function(){return GROWABLE_HEAP_U32()[this.ptr+4>>2]};this.set_destructor=function(destructor){GROWABLE_HEAP_U32()[this.ptr+8>>2]=destructor};this.get_destructor=function(){return GROWABLE_HEAP_U32()[this.ptr+8>>2]};this.set_refcount=function(refcount){GROWABLE_HEAP_I32()[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;GROWABLE_HEAP_I8()[this.ptr+12>>0]=caught};this.get_caught=function(){return GROWABLE_HEAP_I8()[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;GROWABLE_HEAP_I8()[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return GROWABLE_HEAP_I8()[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){Atomics.add(GROWABLE_HEAP_I32(),this.ptr+0>>2,1)};this.release_ref=function(){var prev=Atomics.sub(GROWABLE_HEAP_I32(),this.ptr+0>>2,1);return prev===1};this.set_adjusted_ptr=function(adjustedPtr){GROWABLE_HEAP_U32()[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return GROWABLE_HEAP_U32()[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return GROWABLE_HEAP_U32()[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function ___emscripten_init_main_thread_js(tb){__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,!ENVIRONMENT_IS_WEB);PThread.threadInitTLS()}function ___emscripten_thread_cleanup(thread){if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({"cmd":"cleanupThread","thread":thread})}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){if(typeof SharedArrayBuffer=="undefined"){err("Current environment does not support SharedArrayBuffer, pthreads are not available!");return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine:startRoutine,pthread_ptr:pthread_ptr,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd="spawnThread";postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,nfds,readfds,writefds,exceptfds,timeout);try{var total=0;var srcReadLow=readfds?GROWABLE_HEAP_I32()[readfds>>2]:0,srcReadHigh=readfds?GROWABLE_HEAP_I32()[readfds+4>>2]:0;var srcWriteLow=writefds?GROWABLE_HEAP_I32()[writefds>>2]:0,srcWriteHigh=writefds?GROWABLE_HEAP_I32()[writefds+4>>2]:0;var srcExceptLow=exceptfds?GROWABLE_HEAP_I32()[exceptfds>>2]:0,srcExceptHigh=exceptfds?GROWABLE_HEAP_I32()[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?GROWABLE_HEAP_I32()[readfds>>2]:0)|(writefds?GROWABLE_HEAP_I32()[writefds>>2]:0)|(exceptfds?GROWABLE_HEAP_I32()[exceptfds>>2]:0);var allHigh=(readfds?GROWABLE_HEAP_I32()[readfds+4>>2]:0)|(writefds?GROWABLE_HEAP_I32()[writefds+4>>2]:0)|(exceptfds?GROWABLE_HEAP_I32()[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;GROWABLE_HEAP_I32()[readfds+4>>2]=dstReadHigh}if(writefds){GROWABLE_HEAP_I32()[writefds>>2]=dstWriteLow;GROWABLE_HEAP_I32()[writefds+4>>2]=dstWriteHigh}if(exceptfds){GROWABLE_HEAP_I32()[exceptfds>>2]=dstExceptLow;GROWABLE_HEAP_I32()[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}GROWABLE_HEAP_I32()[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(GROWABLE_HEAP_U16()[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=GROWABLE_HEAP_I32()[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[GROWABLE_HEAP_I32()[sa+8>>2],GROWABLE_HEAP_I32()[sa+12>>2],GROWABLE_HEAP_I32()[sa+16>>2],GROWABLE_HEAP_I32()[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(7,1,fd,buf);try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(8,1,buf,size);try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(10,1,path,buf);try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(11,1,dirfd,path,mode);try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(12,1,dirfd,path,buf,flags);try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(13,1,dirfd,path,flags,varargs);SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(14,1,fdPtr);try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();GROWABLE_HEAP_I32()[fdPtr>>2]=res.readable_fd;GROWABLE_HEAP_I32()[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(15,1,fds,nfds,timeout);try{var nonzero=0;for(var i=0;i>2];var events=GROWABLE_HEAP_I16()[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;GROWABLE_HEAP_I16()[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(16,1,domain,type,protocol);try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_stat64(path,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(17,1,path,buf);try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __emscripten_default_pthread_stack_size(){return 2097152}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function executeNotifiedProxyingQueue(queue){Atomics.store(GROWABLE_HEAP_I32(),queue>>2,1);if(_pthread_self()){__emscripten_proxy_execute_task_queue(queue)}Atomics.compareExchange(GROWABLE_HEAP_I32(),queue>>2,1,0)}Module["executeNotifiedProxyingQueue"]=executeNotifiedProxyingQueue;function __emscripten_notify_task_queue(targetThreadId,currThreadId,mainThreadId,queue){if(targetThreadId==currThreadId){setTimeout(()=>executeNotifiedProxyingQueue(queue))}else if(ENVIRONMENT_IS_PTHREAD){postMessage({"targetThread":targetThreadId,"cmd":"processProxyingQueue","queue":queue})}else{var worker=PThread.pthreads[targetThreadId];if(!worker){return}worker.postMessage({"cmd":"processProxyingQueue","queue":queue})}return 1}function __emscripten_set_offscreencanvas_size(target,width,height){return-1}function __emscripten_throw_longjmp(){throw Infinity}function readI53FromI64(ptr){return GROWABLE_HEAP_U32()[ptr>>2]+GROWABLE_HEAP_I32()[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);GROWABLE_HEAP_I32()[tmPtr>>2]=date.getUTCSeconds();GROWABLE_HEAP_I32()[tmPtr+4>>2]=date.getUTCMinutes();GROWABLE_HEAP_I32()[tmPtr+8>>2]=date.getUTCHours();GROWABLE_HEAP_I32()[tmPtr+12>>2]=date.getUTCDate();GROWABLE_HEAP_I32()[tmPtr+16>>2]=date.getUTCMonth();GROWABLE_HEAP_I32()[tmPtr+20>>2]=date.getUTCFullYear()-1900;GROWABLE_HEAP_I32()[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;GROWABLE_HEAP_I32()[tmPtr+28>>2]=yday}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);GROWABLE_HEAP_I32()[tmPtr>>2]=date.getSeconds();GROWABLE_HEAP_I32()[tmPtr+4>>2]=date.getMinutes();GROWABLE_HEAP_I32()[tmPtr+8>>2]=date.getHours();GROWABLE_HEAP_I32()[tmPtr+12>>2]=date.getDate();GROWABLE_HEAP_I32()[tmPtr+16>>2]=date.getMonth();GROWABLE_HEAP_I32()[tmPtr+20>>2]=date.getFullYear()-1900;GROWABLE_HEAP_I32()[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;GROWABLE_HEAP_I32()[tmPtr+28>>2]=yday;GROWABLE_HEAP_I32()[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;GROWABLE_HEAP_I32()[tmPtr+32>>2]=dst}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,GROWABLE_HEAP_I8(),ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);GROWABLE_HEAP_U32()[timezone>>2]=stdTimezoneOffset*60;GROWABLE_HEAP_I32()[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;GROWABLE_HEAP_U32()[tzname+4>>2]=summerNamePtr}else{GROWABLE_HEAP_U32()[tzname>>2]=summerNamePtr;GROWABLE_HEAP_U32()[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=GROWABLE_HEAP_U8()[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?GROWABLE_HEAP_I32()[buf]:GROWABLE_HEAP_F64()[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function runMainThreadEmAsm(code,sigPtr,argbuf,sync){var args=readEmAsmArgs(sigPtr,argbuf);if(ENVIRONMENT_IS_PTHREAD){return _emscripten_proxy_to_main_thread_js.apply(null,[-1-code,sync].concat(args))}return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int_sync_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,1)}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}function _emscripten_check_blocking_allowed(){if(ENVIRONMENT_IS_WORKER)return;warnOnce("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;if(ENVIRONMENT_IS_PTHREAD){_emscripten_get_now=()=>performance.now()-Module["__performance_now_clock_drift"]}else _emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var outerArgs=arguments;return withStackSave(()=>{var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){postMessage({status:-35,cmd:-35})}}function _emscripten_resize_heap(requestedSize){var oldSize=GROWABLE_HEAP_U8().length;requestedSize=requestedSize>>>0;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+1/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}function _emscripten_unwind_to_js_event_loop(){throw"unwind"}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)GROWABLE_HEAP_I8()[buffer>>0]=0}function _environ_get(__environ,environ_buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(18,1,__environ,environ_buf);var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;GROWABLE_HEAP_U32()[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(19,1,penviron_count,penviron_buf_size);var strings=getEnvStrings();GROWABLE_HEAP_U32()[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});GROWABLE_HEAP_U32()[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(20,1,fd);try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;var curr=FS.read(stream,GROWABLE_HEAP_I8(),ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(22,1,fd,offset_low,offset_high,whence,newOffset);try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[newOffset>>2]=tempI64[0],GROWABLE_HEAP_I32()[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;var curr=FS.write(stream,GROWABLE_HEAP_I8(),ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(23,1,fd,iov,iovcnt,pnum);try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);GROWABLE_HEAP_U32()[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _setCurrentThreadSsrc(ssrc){setCurrentThreadSsrc_js(ssrc)}function __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];function __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}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=GROWABLE_HEAP_I32()[tm+40>>2];var date={tm_sec:GROWABLE_HEAP_I32()[tm>>2],tm_min:GROWABLE_HEAP_I32()[tm+4>>2],tm_hour:GROWABLE_HEAP_I32()[tm+8>>2],tm_mday:GROWABLE_HEAP_I32()[tm+12>>2],tm_mon:GROWABLE_HEAP_I32()[tm+16>>2],tm_year:GROWABLE_HEAP_I32()[tm+20>>2],tm_wday:GROWABLE_HEAP_I32()[tm+24>>2],tm_yday:GROWABLE_HEAP_I32()[tm+28>>2],tm_isdst:GROWABLE_HEAP_I32()[tm+32>>2],tm_gmtoff:GROWABLE_HEAP_I32()[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function _zlt_tfjs_execute_afn(input_img,input_ref,input_msk,len,output_buffer){return execute_afn(input_img,input_ref,input_msk,len,output_buffer)}function _zlt_tfjs_execute_base_cls(input_buffer,len,output_buffer,output_len){return execute_base(input_buffer,len,output_buffer,output_len)}async function _zlt_tfjs_init(){}function _zoom_wcl_get_cpu_num(){return hardcodecpunumber()}function _zoom_wcl_get_csc_thread_num(){return 1}function _zoom_wcl_support_multi_thread(){return IsSupportMultiThread()}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}PThread.init();var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var proxiedFunctionTable=[null,_proc_exit,exitOnMainThread,pthreadCreateProxied,___syscall__newselect,___syscall_connect,___syscall_fcntl64,___syscall_fstat64,___syscall_getcwd,___syscall_ioctl,___syscall_lstat64,___syscall_mkdirat,___syscall_newfstatat,___syscall_openat,___syscall_pipe,___syscall_poll,___syscall_socket,___syscall_stat64,_environ_get,_environ_sizes_get,_fd_close,_fd_read,_fd_seek,_fd_write];var asmLibraryArg={"AdapterWhiteListCheck":_AdapterWhiteListCheck,"CloseVideoEncoder":_CloseVideoEncoder,"CreateGltPlatform":_CreateGltPlatform,"DestroyGltPlatform":_DestroyGltPlatform,"EncodeVideoFrameID":_EncodeVideoFrameID,"GetEncoderState":_GetEncoderState,"GetLogLevel":_GetLogLevel,"InitVideoDecoder":_InitVideoDecoder,"InitVideoEncoder":_InitVideoEncoder,"LimitWebCodecsDecoderTo360":_LimitWebCodecsDecoderTo360,"LimitWebCodecsEncoderTo360":_LimitWebCodecsEncoderTo360,"Set_Share_Mode":_Set_Share_Mode,"UserAgentIsTesla":_UserAgentIsTesla,"VideoDecoder":_VideoDecoder,"VideoDecoderConfigure":_VideoDecoderConfigure,"VideoEncoderConfigure":_VideoEncoderConfigure,"WebCodecsDecoderFail":_WebCodecsDecoderFail,"WebCodecsEncoderFail":_WebCodecsEncoderFail,"WebCodecsVideoEncoder":_WebCodecsVideoEncoder,"_ZN11cpt_generic6thread4joinEv":__ZN11cpt_generic6thread4joinEv,"_ZN11cpt_generic6threadD1Ev":__ZN11cpt_generic6threadD1Ev,"_ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE":__ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE,"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__emscripten_init_main_thread_js":___emscripten_init_main_thread_js,"__emscripten_thread_cleanup":___emscripten_thread_cleanup,"__pthread_create_js":___pthread_create_js,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_default_pthread_stack_size":__emscripten_default_pthread_stack_size,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_emscripten_notify_task_queue":__emscripten_notify_task_queue,"_emscripten_set_offscreencanvas_size":__emscripten_set_offscreencanvas_size,"_emscripten_throw_longjmp":__emscripten_throw_longjmp,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_asm_const_int_sync_on_main_thread":_emscripten_asm_const_int_sync_on_main_thread,"emscripten_check_blocking_allowed":_emscripten_check_blocking_allowed,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_receive_on_main_thread_js":_emscripten_receive_on_main_thread_js,"emscripten_resize_heap":_emscripten_resize_heap,"emscripten_unwind_to_js_event_loop":_emscripten_unwind_to_js_event_loop,"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_ii":invoke_ii,"invoke_iii":invoke_iii,"invoke_iiii":invoke_iiii,"invoke_vi":invoke_vi,"invoke_viii":invoke_viii,"memory":wasmMemory,"setCurrentThreadSsrc":_setCurrentThreadSsrc,"strftime":_strftime,"strftime_l":_strftime_l,"zlt_tfjs_execute_afn":_zlt_tfjs_execute_afn,"zlt_tfjs_execute_base_cls":_zlt_tfjs_execute_base_cls,"zlt_tfjs_init":_zlt_tfjs_init,"zoom_wcl_get_cpu_num":_zoom_wcl_get_cpu_num,"zoom_wcl_get_csc_thread_num":_zoom_wcl_get_csc_thread_num,"zoom_wcl_support_multi_thread":_zoom_wcl_support_multi_thread};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Video_Init=Module["__Video_Init"]=function(){return(__Video_Init=Module["__Video_Init"]=Module["asm"]["_Video_Init"]).apply(null,arguments)};var __Video_UnInit=Module["__Video_UnInit"]=function(){return(__Video_UnInit=Module["__Video_UnInit"]=Module["asm"]["_Video_UnInit"]).apply(null,arguments)};var __Video_Decode=Module["__Video_Decode"]=function(){return(__Video_Decode=Module["__Video_Decode"]=Module["asm"]["_Video_Decode"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __Video_Try_Analysis=Module["__Video_Try_Analysis"]=function(){return(__Video_Try_Analysis=Module["__Video_Try_Analysis"]=Module["asm"]["_Video_Try_Analysis"]).apply(null,arguments)};var __signal_video_controller_encode_pdu_info=Module["__signal_video_controller_encode_pdu_info"]=function(){return(__signal_video_controller_encode_pdu_info=Module["__signal_video_controller_encode_pdu_info"]=Module["asm"]["_signal_video_controller_encode_pdu_info"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __Video_Encode_YUV=Module["__Video_Encode_YUV"]=function(){return(__Video_Encode_YUV=Module["__Video_Encode_YUV"]=Module["asm"]["_Video_Encode_YUV"]).apply(null,arguments)};var __Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=function(){return(__Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=Module["asm"]["_Video_VirtualBackground_Special_Action"]).apply(null,arguments)};var __Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=function(){return(__Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=Module["asm"]["_Qos_Sender_Send_Data_In_Main_Thread"]).apply(null,arguments)};var __Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=function(){return(__Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=Module["asm"]["_Video_Websocket_Speed"]).apply(null,arguments)};var __Video_Start_Encode=Module["__Video_Start_Encode"]=function(){return(__Video_Start_Encode=Module["__Video_Start_Encode"]=Module["asm"]["_Video_Start_Encode"]).apply(null,arguments)};var __signal_video_controller_enocde_start_or_stop_encode=Module["__signal_video_controller_enocde_start_or_stop_encode"]=function(){return(__signal_video_controller_enocde_start_or_stop_encode=Module["__signal_video_controller_enocde_start_or_stop_encode"]=Module["asm"]["_signal_video_controller_enocde_start_or_stop_encode"]).apply(null,arguments)};var __Video_Stop_Encode=Module["__Video_Stop_Encode"]=function(){return(__Video_Stop_Encode=Module["__Video_Stop_Encode"]=Module["asm"]["_Video_Stop_Encode"]).apply(null,arguments)};var __Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=function(){return(__Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=Module["asm"]["_Request_Video_Qos_Data"]).apply(null,arguments)};var __signal_video_controller_enocde_request_check_one_type=Module["__signal_video_controller_enocde_request_check_one_type"]=function(){return(__signal_video_controller_enocde_request_check_one_type=Module["__signal_video_controller_enocde_request_check_one_type"]=Module["asm"]["_signal_video_controller_enocde_request_check_one_type"]).apply(null,arguments)};var __Video_Update_Format=Module["__Video_Update_Format"]=function(){return(__Video_Update_Format=Module["__Video_Update_Format"]=Module["asm"]["_Video_Update_Format"]).apply(null,arguments)};var __Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=function(){return(__Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=Module["asm"]["_Video_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=function(){return(__Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=Module["asm"]["_Add_Video_Cooker_info"]).apply(null,arguments)};var __signal_video_controller_encode_cooker_info=Module["__signal_video_controller_encode_cooker_info"]=function(){return(__signal_video_controller_encode_cooker_info=Module["__signal_video_controller_encode_cooker_info"]=Module["asm"]["_signal_video_controller_encode_cooker_info"]).apply(null,arguments)};var __Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=function(){return(__Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=Module["asm"]["_Remove_Video_Cooker_Info"]).apply(null,arguments)};var __Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=function(){return(__Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=Module["asm"]["_Get_Video_Meat_Weight"]).apply(null,arguments)};var __Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=function(){return(__Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=Module["asm"]["_Set_Max_Receiving_Channel_Num"]).apply(null,arguments)};var __update_sync_time=Module["__update_sync_time"]=function(){return(__update_sync_time=Module["__update_sync_time"]=Module["asm"]["_update_sync_time"]).apply(null,arguments)};var __release_video_receiving_channel=Module["__release_video_receiving_channel"]=function(){return(__release_video_receiving_channel=Module["__release_video_receiving_channel"]=Module["asm"]["_release_video_receiving_channel"]).apply(null,arguments)};var __change_hw_status=Module["__change_hw_status"]=function(){return(__change_hw_status=Module["__change_hw_status"]=Module["asm"]["_change_hw_status"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).apply(null,arguments)};var __update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=function(){return(__update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_video_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __create_vb_thread=Module["__create_vb_thread"]=function(){return(__create_vb_thread=Module["__create_vb_thread"]=Module["asm"]["_create_vb_thread"]).apply(null,arguments)};var __create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=function(){return(__create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=Module["asm"]["_create_vb_no_sab_thread"]).apply(null,arguments)};var __signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=function(){return(__signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=Module["asm"]["_signal_vb_thread_blur"]).apply(null,arguments)};var __signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=function(){return(__signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=Module["asm"]["_signal_vb_thread_bg"]).apply(null,arguments)};var __signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=function(){return(__signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=Module["asm"]["_signal_vb_thread_video_yuv"]).apply(null,arguments)};var __signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=function(){return(__signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=Module["asm"]["_signal_vb_thread_video_rgba"]).apply(null,arguments)};var __signal_vb_thread_close=Module["__signal_vb_thread_close"]=function(){return(__signal_vb_thread_close=Module["__signal_vb_thread_close"]=Module["asm"]["_signal_vb_thread_close"]).apply(null,arguments)};var __update_video_cropping_mode=Module["__update_video_cropping_mode"]=function(){return(__update_video_cropping_mode=Module["__update_video_cropping_mode"]=Module["asm"]["_update_video_cropping_mode"]).apply(null,arguments)};var __collect_video_monitor_info=Module["__collect_video_monitor_info"]=function(){return(__collect_video_monitor_info=Module["__collect_video_monitor_info"]=Module["asm"]["_collect_video_monitor_info"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __Create_HW_Encode=Module["__Create_HW_Encode"]=function(){return(__Create_HW_Encode=Module["__Create_HW_Encode"]=Module["asm"]["_Create_HW_Encode"]).apply(null,arguments)};var __Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=function(){return(__Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=Module["asm"]["_Sharing_Encode_Init"]).apply(null,arguments)};var __Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=function(){return(__Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=Module["asm"]["_Sharing_Encode_Try_Analysis"]).apply(null,arguments)};var __signal_sharing_controller_encode_pdu_info=Module["__signal_sharing_controller_encode_pdu_info"]=function(){return(__signal_sharing_controller_encode_pdu_info=Module["__signal_sharing_controller_encode_pdu_info"]=Module["asm"]["_signal_sharing_controller_encode_pdu_info"]).apply(null,arguments)};var __Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=function(){return(__Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=Module["asm"]["_Sharing_Encode_Uninit"]).apply(null,arguments)};var __Sharing_Encode=Module["__Sharing_Encode"]=function(){return(__Sharing_Encode=Module["__Sharing_Encode"]=Module["asm"]["_Sharing_Encode"]).apply(null,arguments)};var __signal_sharing_controller_encode_yuv=Module["__signal_sharing_controller_encode_yuv"]=function(){return(__signal_sharing_controller_encode_yuv=Module["__signal_sharing_controller_encode_yuv"]=Module["asm"]["_signal_sharing_controller_encode_yuv"]).apply(null,arguments)};var __Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=function(){return(__Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=Module["asm"]["_Sharing_Encode_Mouse_Data"]).apply(null,arguments)};var __signal_sharing_controller_encode_mouse_data=Module["__signal_sharing_controller_encode_mouse_data"]=function(){return(__signal_sharing_controller_encode_mouse_data=Module["__signal_sharing_controller_encode_mouse_data"]=Module["asm"]["_signal_sharing_controller_encode_mouse_data"]).apply(null,arguments)};var __Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=function(){return(__Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=Module["asm"]["_Request_Sharing_Qos_Data"]).apply(null,arguments)};var __signal_sharing_controller_enocde_request_check_one_type=Module["__signal_sharing_controller_enocde_request_check_one_type"]=function(){return(__signal_sharing_controller_enocde_request_check_one_type=Module["__signal_sharing_controller_enocde_request_check_one_type"]=Module["asm"]["_signal_sharing_controller_enocde_request_check_one_type"]).apply(null,arguments)};var __signal_sharing_controller_decode_request_check_one_type=Module["__signal_sharing_controller_decode_request_check_one_type"]=function(){return(__signal_sharing_controller_decode_request_check_one_type=Module["__signal_sharing_controller_decode_request_check_one_type"]=Module["asm"]["_signal_sharing_controller_decode_request_check_one_type"]).apply(null,arguments)};var __Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=function(){return(__Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=Module["asm"]["_Sharing_Set_Data_Encryption"]).apply(null,arguments)};var __Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=function(){return(__Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=Module["asm"]["_Sharing_Pause_Encode"]).apply(null,arguments)};var __Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=function(){return(__Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=Module["asm"]["_Sharing_Resume_Encode"]).apply(null,arguments)};var __Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=function(){return(__Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=Module["asm"]["_Sharing_Stop_Encode"]).apply(null,arguments)};var __Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=function(){return(__Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=Module["asm"]["_Sharing_Websocket_Speed"]).apply(null,arguments)};var __Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=function(){return(__Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=Module["asm"]["_Add_Sharing_Cooker_info"]).apply(null,arguments)};var __Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=function(){return(__Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=Module["asm"]["_Remove_Sharing_Cooker_Info"]).apply(null,arguments)};var __Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=function(){return(__Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=Module["asm"]["_Get_Sharing_Meat_Weight"]).apply(null,arguments)};var __Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=function(){return(__Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=Module["asm"]["_Set_Sharing_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Add_Rev_Channel=Module["__Add_Rev_Channel"]=function(){return(__Add_Rev_Channel=Module["__Add_Rev_Channel"]=Module["asm"]["_Add_Rev_Channel"]).apply(null,arguments)};var __Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=function(){return(__Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=Module["asm"]["_Remove_Rev_Channel"]).apply(null,arguments)};var __update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=function(){return(__update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_sharing_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var __collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=function(){return(__collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=Module["asm"]["_collect_sharing_monitor_info"]).apply(null,arguments)};var __set_annotation_action=Module["__set_annotation_action"]=function(){return(__set_annotation_action=Module["__set_annotation_action"]=Module["asm"]["_set_annotation_action"]).apply(null,arguments)};var __request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=function(){return(__request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=Module["asm"]["_request_nack_t_periodically_for_sharing_qos"]).apply(null,arguments)};var __Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=function(){return(__Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=Module["asm"]["_Change_Connect_Type_For_Sharing"]).apply(null,arguments)};var __Jpeg_Init=Module["__Jpeg_Init"]=function(){return(__Jpeg_Init=Module["__Jpeg_Init"]=Module["asm"]["_Jpeg_Init"]).apply(null,arguments)};var __Jpeg_Uninit=Module["__Jpeg_Uninit"]=function(){return(__Jpeg_Uninit=Module["__Jpeg_Uninit"]=Module["asm"]["_Jpeg_Uninit"]).apply(null,arguments)};var __Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=function(){return(__Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=Module["asm"]["_Jpeg_HeardInfo"]).apply(null,arguments)};var __Jpeg_Decode=Module["__Jpeg_Decode"]=function(){return(__Jpeg_Decode=Module["__Jpeg_Decode"]=Module["asm"]["_Jpeg_Decode"]).apply(null,arguments)};var __signal_video_controller_encode_init_info=Module["__signal_video_controller_encode_init_info"]=function(){return(__signal_video_controller_encode_init_info=Module["__signal_video_controller_encode_init_info"]=Module["asm"]["_signal_video_controller_encode_init_info"]).apply(null,arguments)};var __signal_video_controller_encode_yuv=Module["__signal_video_controller_encode_yuv"]=function(){return(__signal_video_controller_encode_yuv=Module["__signal_video_controller_encode_yuv"]=Module["asm"]["_signal_video_controller_encode_yuv"]).apply(null,arguments)};var __signal_video_controller_encode_rgba=Module["__signal_video_controller_encode_rgba"]=function(){return(__signal_video_controller_encode_rgba=Module["__signal_video_controller_encode_rgba"]=Module["asm"]["_signal_video_controller_encode_rgba"]).apply(null,arguments)};var __signal_video_controller_encode_hw_info=Module["__signal_video_controller_encode_hw_info"]=function(){return(__signal_video_controller_encode_hw_info=Module["__signal_video_controller_encode_hw_info"]=Module["asm"]["_signal_video_controller_encode_hw_info"]).apply(null,arguments)};var __signal_video_controller_change_connect_type=Module["__signal_video_controller_change_connect_type"]=function(){return(__signal_video_controller_change_connect_type=Module["__signal_video_controller_change_connect_type"]=Module["asm"]["_signal_video_controller_change_connect_type"]).apply(null,arguments)};var __create_video_encode_thread=Module["__create_video_encode_thread"]=function(){return(__create_video_encode_thread=Module["__create_video_encode_thread"]=Module["asm"]["_create_video_encode_thread"]).apply(null,arguments)};var __singal_video_controller_fec_info=Module["__singal_video_controller_fec_info"]=function(){return(__singal_video_controller_fec_info=Module["__singal_video_controller_fec_info"]=Module["asm"]["_singal_video_controller_fec_info"]).apply(null,arguments)};var __singal_video_controller_bandwidth_alloc=Module["__singal_video_controller_bandwidth_alloc"]=function(){return(__singal_video_controller_bandwidth_alloc=Module["__singal_video_controller_bandwidth_alloc"]=Module["asm"]["_singal_video_controller_bandwidth_alloc"]).apply(null,arguments)};var __signal_video_share_flag=Module["__signal_video_share_flag"]=function(){return(__signal_video_share_flag=Module["__signal_video_share_flag"]=Module["asm"]["_signal_video_share_flag"]).apply(null,arguments)};var __signal_video_controller_encode_uninit=Module["__signal_video_controller_encode_uninit"]=function(){return(__signal_video_controller_encode_uninit=Module["__signal_video_controller_encode_uninit"]=Module["asm"]["_signal_video_controller_encode_uninit"]).apply(null,arguments)};var __create_video_decode_thread=Module["__create_video_decode_thread"]=function(){return(__create_video_decode_thread=Module["__create_video_decode_thread"]=Module["asm"]["_create_video_decode_thread"]).apply(null,arguments)};var __signal_video_controller_decode_init_info=Module["__signal_video_controller_decode_init_info"]=function(){return(__signal_video_controller_decode_init_info=Module["__signal_video_controller_decode_init_info"]=Module["asm"]["_signal_video_controller_decode_init_info"]).apply(null,arguments)};var __signal_video_controller_decode_close=Module["__signal_video_controller_decode_close"]=function(){return(__signal_video_controller_decode_close=Module["__signal_video_controller_decode_close"]=Module["asm"]["_signal_video_controller_decode_close"]).apply(null,arguments)};var __signal_video_controller_decode_hw_info=Module["__signal_video_controller_decode_hw_info"]=function(){return(__signal_video_controller_decode_hw_info=Module["__signal_video_controller_decode_hw_info"]=Module["asm"]["_signal_video_controller_decode_hw_info"]).apply(null,arguments)};var __signal_video_controller_decode_uninit=Module["__signal_video_controller_decode_uninit"]=function(){return(__signal_video_controller_decode_uninit=Module["__signal_video_controller_decode_uninit"]=Module["asm"]["_signal_video_controller_decode_uninit"]).apply(null,arguments)};var __proxy_videocodec_create_helpthread=Module["__proxy_videocodec_create_helpthread"]=function(){return(__proxy_videocodec_create_helpthread=Module["__proxy_videocodec_create_helpthread"]=Module["asm"]["_proxy_videocodec_create_helpthread"]).apply(null,arguments)};var __create_sharing_encode_thread=Module["__create_sharing_encode_thread"]=function(){return(__create_sharing_encode_thread=Module["__create_sharing_encode_thread"]=Module["asm"]["_create_sharing_encode_thread"]).apply(null,arguments)};var __signal_sharing_controller_encode_init_info=Module["__signal_sharing_controller_encode_init_info"]=function(){return(__signal_sharing_controller_encode_init_info=Module["__signal_sharing_controller_encode_init_info"]=Module["asm"]["_signal_sharing_controller_encode_init_info"]).apply(null,arguments)};var __signal_sharing_controller_encode_uninit=Module["__signal_sharing_controller_encode_uninit"]=function(){return(__signal_sharing_controller_encode_uninit=Module["__signal_sharing_controller_encode_uninit"]=Module["asm"]["_signal_sharing_controller_encode_uninit"]).apply(null,arguments)};var __create_sharing_decode_thread=Module["__create_sharing_decode_thread"]=function(){return(__create_sharing_decode_thread=Module["__create_sharing_decode_thread"]=Module["asm"]["_create_sharing_decode_thread"]).apply(null,arguments)};var __signal_sharing_controller_decode_init_info=Module["__signal_sharing_controller_decode_init_info"]=function(){return(__signal_sharing_controller_decode_init_info=Module["__signal_sharing_controller_decode_init_info"]=Module["asm"]["_signal_sharing_controller_decode_init_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_meeting_key=Module["__signal_sharing_controller_decode_meeting_key"]=function(){return(__signal_sharing_controller_decode_meeting_key=Module["__signal_sharing_controller_decode_meeting_key"]=Module["asm"]["_signal_sharing_controller_decode_meeting_key"]).apply(null,arguments)};var __signal_sharing_controller_decode_pdu_info=Module["__signal_sharing_controller_decode_pdu_info"]=function(){return(__signal_sharing_controller_decode_pdu_info=Module["__signal_sharing_controller_decode_pdu_info"]=Module["asm"]["_signal_sharing_controller_decode_pdu_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_meeting_cooker=Module["__signal_sharing_controller_decode_meeting_cooker"]=function(){return(__signal_sharing_controller_decode_meeting_cooker=Module["__signal_sharing_controller_decode_meeting_cooker"]=Module["asm"]["_signal_sharing_controller_decode_meeting_cooker"]).apply(null,arguments)};var __signal_sharing_controller_decode_roster_info=Module["__signal_sharing_controller_decode_roster_info"]=function(){return(__signal_sharing_controller_decode_roster_info=Module["__signal_sharing_controller_decode_roster_info"]=Module["asm"]["_signal_sharing_controller_decode_roster_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_rev_channel=Module["__signal_sharing_controller_decode_rev_channel"]=function(){return(__signal_sharing_controller_decode_rev_channel=Module["__signal_sharing_controller_decode_rev_channel"]=Module["asm"]["_signal_sharing_controller_decode_rev_channel"]).apply(null,arguments)};var __singal_sharing_controller_decode_close=Module["__singal_sharing_controller_decode_close"]=function(){return(__singal_sharing_controller_decode_close=Module["__singal_sharing_controller_decode_close"]=Module["asm"]["_singal_sharing_controller_decode_close"]).apply(null,arguments)};var __signal_sharing_controller_decode_uninit=Module["__signal_sharing_controller_decode_uninit"]=function(){return(__signal_sharing_controller_decode_uninit=Module["__signal_sharing_controller_decode_uninit"]=Module["asm"]["_signal_sharing_controller_decode_uninit"]).apply(null,arguments)};var __Qos_Init=Module["__Qos_Init"]=function(){return(__Qos_Init=Module["__Qos_Init"]=Module["asm"]["_Qos_Init"]).apply(null,arguments)};var __Qos_UnInit=Module["__Qos_UnInit"]=function(){return(__Qos_UnInit=Module["__Qos_UnInit"]=Module["asm"]["_Qos_UnInit"]).apply(null,arguments)};var __Qos_Start_Send=Module["__Qos_Start_Send"]=function(){return(__Qos_Start_Send=Module["__Qos_Start_Send"]=Module["asm"]["_Qos_Start_Send"]).apply(null,arguments)};var __Qos_Stop_Send=Module["__Qos_Stop_Send"]=function(){return(__Qos_Stop_Send=Module["__Qos_Stop_Send"]=Module["asm"]["_Qos_Stop_Send"]).apply(null,arguments)};var __Qos_Change_Connect_Type_Or_Video_Share=Module["__Qos_Change_Connect_Type_Or_Video_Share"]=function(){return(__Qos_Change_Connect_Type_Or_Video_Share=Module["__Qos_Change_Connect_Type_Or_Video_Share"]=Module["asm"]["_Qos_Change_Connect_Type_Or_Video_Share"]).apply(null,arguments)};var __Qos_Send_Data_Packet=Module["__Qos_Send_Data_Packet"]=function(){return(__Qos_Send_Data_Packet=Module["__Qos_Send_Data_Packet"]=Module["asm"]["_Qos_Send_Data_Packet"]).apply(null,arguments)};var __Qos_Send_Data_Multi_Packet=Module["__Qos_Send_Data_Multi_Packet"]=function(){return(__Qos_Send_Data_Multi_Packet=Module["__Qos_Send_Data_Multi_Packet"]=Module["asm"]["_Qos_Send_Data_Multi_Packet"]).apply(null,arguments)};var __Qos_Data_From_Rwg=Module["__Qos_Data_From_Rwg"]=function(){return(__Qos_Data_From_Rwg=Module["__Qos_Data_From_Rwg"]=Module["asm"]["_Qos_Data_From_Rwg"]).apply(null,arguments)};var __Qos_AS_Data_From_Rwg=Module["__Qos_AS_Data_From_Rwg"]=function(){return(__Qos_AS_Data_From_Rwg=Module["__Qos_AS_Data_From_Rwg"]=Module["asm"]["_Qos_AS_Data_From_Rwg"]).apply(null,arguments)};var __Qos_Smooth_Send_Periodically_For_Qos=Module["__Qos_Smooth_Send_Periodically_For_Qos"]=function(){return(__Qos_Smooth_Send_Periodically_For_Qos=Module["__Qos_Smooth_Send_Periodically_For_Qos"]=Module["asm"]["_Qos_Smooth_Send_Periodically_For_Qos"]).apply(null,arguments)};var __Qos_Request_Nack_T_Periodically_For_Qos=Module["__Qos_Request_Nack_T_Periodically_For_Qos"]=function(){return(__Qos_Request_Nack_T_Periodically_For_Qos=Module["__Qos_Request_Nack_T_Periodically_For_Qos"]=Module["asm"]["_Qos_Request_Nack_T_Periodically_For_Qos"]).apply(null,arguments)};var __Qos_Update_Required_Bandwidth=Module["__Qos_Update_Required_Bandwidth"]=function(){return(__Qos_Update_Required_Bandwidth=Module["__Qos_Update_Required_Bandwidth"]=Module["asm"]["_Qos_Update_Required_Bandwidth"]).apply(null,arguments)};var __Qos_Update_Video_Hd_Info=Module["__Qos_Update_Video_Hd_Info"]=function(){return(__Qos_Update_Video_Hd_Info=Module["__Qos_Update_Video_Hd_Info"]=Module["asm"]["_Qos_Update_Video_Hd_Info"]).apply(null,arguments)};var __Qos_Reset_As_Qos_Buffer=Module["__Qos_Reset_As_Qos_Buffer"]=function(){return(__Qos_Reset_As_Qos_Buffer=Module["__Qos_Reset_As_Qos_Buffer"]=Module["asm"]["_Qos_Reset_As_Qos_Buffer"]).apply(null,arguments)};var __Qos_Add_Recv_SSRC=Module["__Qos_Add_Recv_SSRC"]=function(){return(__Qos_Add_Recv_SSRC=Module["__Qos_Add_Recv_SSRC"]=Module["asm"]["_Qos_Add_Recv_SSRC"]).apply(null,arguments)};var __Qos_Remove_Recv_SSRC=Module["__Qos_Remove_Recv_SSRC"]=function(){return(__Qos_Remove_Recv_SSRC=Module["__Qos_Remove_Recv_SSRC"]=Module["asm"]["_Qos_Remove_Recv_SSRC"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=function(){return(_OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=Module["asm"]["OnVideoFrameOutputCallback"]).apply(null,arguments)};var _OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=function(){return(_OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=Module["asm"]["OnEncodedVideoChunkOutputCallback"]).apply(null,arguments)};var _pthread_self=Module["_pthread_self"]=function(){return(_pthread_self=Module["_pthread_self"]=Module["asm"]["pthread_self"]).apply(null,arguments)};var _saveSetjmp=Module["_saveSetjmp"]=function(){return(_saveSetjmp=Module["_saveSetjmp"]=Module["asm"]["saveSetjmp"]).apply(null,arguments)};var __emscripten_tls_init=Module["__emscripten_tls_init"]=function(){return(__emscripten_tls_init=Module["__emscripten_tls_init"]=Module["asm"]["_emscripten_tls_init"]).apply(null,arguments)};var __emscripten_thread_init=Module["__emscripten_thread_init"]=function(){return(__emscripten_thread_init=Module["__emscripten_thread_init"]=Module["asm"]["_emscripten_thread_init"]).apply(null,arguments)};var __emscripten_thread_crashed=Module["__emscripten_thread_crashed"]=function(){return(__emscripten_thread_crashed=Module["__emscripten_thread_crashed"]=Module["asm"]["_emscripten_thread_crashed"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=function(){return(_emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=Module["asm"]["emscripten_main_thread_process_queued_calls"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _emscripten_main_browser_thread_id=Module["_emscripten_main_browser_thread_id"]=function(){return(_emscripten_main_browser_thread_id=Module["_emscripten_main_browser_thread_id"]=Module["asm"]["emscripten_main_browser_thread_id"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module["_emscripten_run_in_main_runtime_thread_js"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module["_emscripten_run_in_main_runtime_thread_js"]=Module["asm"]["emscripten_run_in_main_runtime_thread_js"]).apply(null,arguments)};var _emscripten_dispatch_to_thread_=Module["_emscripten_dispatch_to_thread_"]=function(){return(_emscripten_dispatch_to_thread_=Module["_emscripten_dispatch_to_thread_"]=Module["asm"]["emscripten_dispatch_to_thread_"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var __emscripten_proxy_execute_task_queue=Module["__emscripten_proxy_execute_task_queue"]=function(){return(__emscripten_proxy_execute_task_queue=Module["__emscripten_proxy_execute_task_queue"]=Module["asm"]["_emscripten_proxy_execute_task_queue"]).apply(null,arguments)};var __emscripten_thread_free_data=Module["__emscripten_thread_free_data"]=function(){return(__emscripten_thread_free_data=Module["__emscripten_thread_free_data"]=Module["asm"]["_emscripten_thread_free_data"]).apply(null,arguments)};var __emscripten_thread_exit=Module["__emscripten_thread_exit"]=function(){return(__emscripten_thread_exit=Module["__emscripten_thread_exit"]=Module["asm"]["_emscripten_thread_exit"]).apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return(_setThrew=Module["_setThrew"]=Module["asm"]["setThrew"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module["_emscripten_stack_set_limits"]=function(){return(_emscripten_stack_set_limits=Module["_emscripten_stack_set_limits"]=Module["asm"]["emscripten_stack_set_limits"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiii"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiijii=Module["dynCall_iiijii"]=function(){return(dynCall_iiijii=Module["dynCall_iiijii"]=Module["asm"]["dynCall_iiijii"]).apply(null,arguments)};var dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=function(){return(dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiij"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=function(){return(dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=Module["asm"]["dynCall_iiiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiiij"]).apply(null,arguments)};var dynCall_viiiiiij=Module["dynCall_viiiiiij"]=function(){return(dynCall_viiiiiij=Module["dynCall_viiiiiij"]=Module["asm"]["dynCall_viiiiiij"]).apply(null,arguments)};var dynCall_viji=Module["dynCall_viji"]=function(){return(dynCall_viji=Module["dynCall_viji"]=Module["asm"]["dynCall_viji"]).apply(null,arguments)};var dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=function(){return(dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=Module["asm"]["dynCall_iiiiiiji"]).apply(null,arguments)};var dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=function(){return(dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=Module["asm"]["dynCall_iiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiij"]).apply(null,arguments)};var dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=function(){return(dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiij"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_jiiiiii=Module["dynCall_jiiiiii"]=function(){return(dynCall_jiiiiii=Module["dynCall_jiiiiii"]=Module["asm"]["dynCall_jiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}Module["keepRuntimeAlive"]=keepRuntimeAlive;Module["wasmMemory"]=wasmMemory;Module["cwrap"]=cwrap;Module["ExitStatus"]=ExitStatus;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){initRuntime();postMessage({"cmd":"loaded"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); +` +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var objectUrl = URL.createObjectURL((new Blob([Module["mainScriptUrlOrBlob"]],{type:"application/javascript"}))) +Module["mainScriptUrlOrBlob"]=new Blob([Module["mainScriptUrlOrBlob"]],{type:"application/javascript"}); +(function wasmWaitForMemory(){ +let that = self; +return new Promise((resolve, reject) => { +postMessage({ status: 'WFMO' }) +const listenForWasmMemory = (e) => { +let data = e.data; +if (data.command === 'wasmMemory') { +Module['wasmMemory'] = data.data; +that.removeEventListener('message', listenForWasmMemory); +resolve(); +} +} +that.addEventListener('message', listenForWasmMemory); +}) +})().then(()=>{ +importScripts(objectUrl); +URL.revokeObjectURL(objectUrl); +}); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/sharing_mtsimd.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_mtsimd.min.js new file mode 100644 index 0000000..59e63ed --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_mtsimd.min.js @@ -0,0 +1,50 @@ +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=59)}([function(e,t,r){var i=r(37),n=r(32);e.exports=function(e,t){var r=n(e,t,"get");return i(e,r)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(38),n=r(32);e.exports=function(e,t,r){var s=n(e,t,"set");return i(e,s,r),r},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"C",(function(){return i})),r.d(t,"j",(function(){return n})),r.d(t,"t",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"v",(function(){return o})),r.d(t,"x",(function(){return h})),r.d(t,"p",(function(){return u})),r.d(t,"s",(function(){return l})),r.d(t,"q",(function(){return c})),r.d(t,"r",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"w",(function(){return g})),r.d(t,"g",(function(){return m})),r.d(t,"y",(function(){return _})),r.d(t,"z",(function(){return v})),r.d(t,"A",(function(){return b})),r.d(t,"B",(function(){return w})),r.d(t,"e",(function(){return y})),r.d(t,"d",(function(){return x})),r.d(t,"c",(function(){return T})),r.d(t,"f",(function(){return R})),r.d(t,"n",(function(){return E})),r.d(t,"o",(function(){return S})),r.d(t,"m",(function(){return A})),r.d(t,"l",(function(){return k})),r.d(t,"h",(function(){return M})),r.d(t,"u",(function(){return C})),r.d(t,"i",(function(){return P}));const i={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},n={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},s={AVAILABLE:0,VIDEO:1,SHARE:2},a={IDLE:0,PENDING:1,READY:2,RENDERING:3},o={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},h={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},u=0,l=1,c=2,d=3,f=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],p=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},m=["intel","nvidia","apple","amd","qualcomm","arm"],_="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n struct FsUniforms {\n rotation: f32,\n };\n\n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n\n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n",v="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(6) var vertexUniforms: FsUniforms;\n\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n\n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var vPlaneTex: texture_2d;\n @group(0) @binding(5) var uniforms: FsUniforms;\n // @group(0) @binding(7) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n return color;\n }\n",b="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(5) var vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var uniforms: FsUniforms;\n // @group(0) @binding(5) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n\n return color;\n }\n",w="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n",y="\n\n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n\n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d;\n @group(0) @binding(2) var uniforms: FsUniforms;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n\n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n\n return color;\n }\n",x="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4 {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n",T="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n\n struct ClearColorUniforms {\n clearColor: vec4,\n };\n\n @group(0) @binding(0) var uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4 {\n return uniforms.clearColor;\n }\n",R={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},E={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},S={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},A=[60,120,180,360,540,720,1080,2160],k={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},M=6,C=[180,360,540,720,1080,2160],P=5},function(e,t,r){"use strict";var i=r(5),n=r(16);new Error;const s=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,h=null;function u(e,t){var r,i;if(!function(e){const t=performance.now();return(!s.has(e)||t-s.get(e)>5e3)&&(s.set(e,t),!0)}(e))return;let u;try{u=a("object"==typeof t?JSON.stringify(t):t)}catch(e){u=a(t)}null===(r=h)||void 0===r||r("NEM-".concat(e,"-").concat(u)),n.a.error("NotifyUIError,event=".concat(e,",data=").concat(u)),null===(i=o)||void 0===i||i(e,t)}var l=r(15);function c(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function p(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function g(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const r=await new Promise((e,t)=>{const r=i=>{let n=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===n.command?(y("DE"),self.removeEventListener("message",r),e(n.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===n.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),y("DS"),postMessage({status:i.E,url:wasmUrl})});let n=await WebAssembly.instantiate(r,e);n.instance?(self.wasmModuleToShare=n.module,t(n.instance)):(self.wasmModuleToShare=r,t(n))}catch(e){y("IF"),b("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}r.d(t,"d",(function(){return c})),r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"c",(function(){return g})),r.d(t,"q",(function(){return m})),r.d(t,"i",(function(){return v})),r.d(t,"u",(function(){return b})),r.d(t,"t",(function(){return w})),r.d(t,"o",(function(){return y})),r.d(t,"n",(function(){return x})),r.d(t,"v",(function(){return T})),r.d(t,"w",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"s",(function(){return A})),r.d(t,"k",(function(){return k})),r.d(t,"m",(function(){return M})),r.d(t,"r",(function(){return L})),r.d(t,"l",(function(){return I})),r.d(t,"x",(function(){return W})),r.d(t,"b",(function(){return N})),r.d(t,"h",(function(){return F})),r.d(t,"y",(function(){return V})),r.d(t,"a",(function(){return z})),r.d(t,"j",(function(){return H}));const _="function"!=typeof importScripts;function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_?n.a.error(e,t):b(e,t)}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var r,n,s,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(r=t)||void 0===r?void 0:r.message)+" Stack: "+(null!==(n=null===(s=t)||void 0===s||null===(s=s.error)||void 0===s?void 0:s.stack)&&void 0!==n?n:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:i.G,errorMessage:e,errorEvent:t})}function w(e){postMessage({status:i.G,errorMessage:e,level:"low"})}function y(e){postMessage({status:i.zb,data:e})}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:i.f,data:e});postMessage({status:i.f,data:e})}function T(e){postMessage({status:i.M,canvasId:e,replaceCanvas:!1})}function R(e){postMessage({status:i.N,canvasId:e})}function E(e){_?u(l.k,e):postMessage({status:i.Bb,where:e})}function S(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function A(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(r){t=null==e?void 0:e.getContext("2d")}return t||b("get2DContextFromCanvas return null"),t}class k{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let r=0;r0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new S;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class M{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),i=r>e?r:e;if(i+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(i)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){b("Error in YuvWrap.recycle: ".concat(e))}}}function C(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function P(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const U=["","MOZ_","OP_","WEBKIT_"];function L(e,t){for(var r=0;r0&&(t+="&index="+e);let r={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:C,onclose:P,group:this,index:e},i=new O(r);await i.connect(),this.transportArray[e]=i}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const D=new Map,B=[90,180,360,720,1080],G=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,r)=>{const i=this.ssrcInfoMap.get(r);i&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))})}_notifyFPS(e,t){postMessage({status:i.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function W(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:n,r_h:s,rotation:a,ssrc:o}=e;let h=1==a||3==a,u=h?s:n,l=h?n:s;const c=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!D.get(c)||D.get(c).width!==u||D.get(c).height!==l){const e={width:u,height:l,ssrc:c,quality:f};D.set(c,e),r?r(e):postMessage({status:i.v,data:e})}t&&G.updateSSRCInfo(c,Date.now())}function N(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function F(e,t,r,i,n){if(!n&&!i||1==e)return!1;let s=i&&t>=640,a=n&&t>=1280;return 2!=e||640==t&&480==r?s||a:((s||a)&&v("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}function V(e,t){e?e.send(t):b("websocket is null",new Error("message type ".concat(t[0])))}function z(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function H(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,r){"use strict";r.d(t,"y",(function(){return i})),r.d(t,"Y",(function(){return n})),r.d(t,"L",(function(){return s})),r.d(t,"K",(function(){return a})),r.d(t,"J",(function(){return o})),r.d(t,"v",(function(){return h})),r.d(t,"q",(function(){return u})),r.d(t,"r",(function(){return l})),r.d(t,"w",(function(){return c})),r.d(t,"x",(function(){return d})),r.d(t,"u",(function(){return f})),r.d(t,"X",(function(){return p})),r.d(t,"P",(function(){return g})),r.d(t,"Q",(function(){return m})),r.d(t,"O",(function(){return _})),r.d(t,"M",(function(){return v})),r.d(t,"s",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"n",(function(){return y})),r.d(t,"l",(function(){return x})),r.d(t,"m",(function(){return T})),r.d(t,"db",(function(){return R})),r.d(t,"B",(function(){return E})),r.d(t,"C",(function(){return S})),r.d(t,"W",(function(){return A})),r.d(t,"ab",(function(){return k})),r.d(t,"V",(function(){return M})),r.d(t,"Z",(function(){return C})),r.d(t,"N",(function(){return P})),r.d(t,"h",(function(){return U})),r.d(t,"g",(function(){return L})),r.d(t,"f",(function(){return I})),r.d(t,"A",(function(){return O})),r.d(t,"z",(function(){return D})),r.d(t,"S",(function(){return B})),r.d(t,"R",(function(){return G})),r.d(t,"e",(function(){return W})),r.d(t,"o",(function(){return N})),r.d(t,"T",(function(){return F})),r.d(t,"U",(function(){return V})),r.d(t,"G",(function(){return z})),r.d(t,"E",(function(){return H})),r.d(t,"H",(function(){return j})),r.d(t,"I",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"bb",(function(){return q})),r.d(t,"c",(function(){return K})),r.d(t,"b",(function(){return Q})),r.d(t,"cb",(function(){return Z})),r.d(t,"d",(function(){return J})),r.d(t,"t",(function(){return $})),r.d(t,"D",(function(){return ee})),r.d(t,"p",(function(){return te})),r.d(t,"a",(function(){return re})),r.d(t,"j",(function(){return ie})),r.d(t,"i",(function(){return ne}));const i=1e3,n=5,s=43,a=44,o=45,h=0,u=1,l=146,c=2,d=7,f=9,p=17,g=10,m=11,_=12,v=102,b=107,w=0,y=1,x=2,T=3,R=65,E=0,S=1,A=-1,k=0,M=1,C=2,P=3,U=1,L=2,I=3,O={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},D={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,G=20,W=15,N=10,F=8294400,V=5,z=0,H=1,j=2,Y=15,X=5,q=400,K=7,Q=8,Z={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,re=1,ie=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),ne={PAUSE:0,RESUME:1,STOP:2}},function(e,t,r){"use strict";r.d(t,"j",(function(){return i})),r.d(t,"h",(function(){return n})),r.d(t,"l",(function(){return s})),r.d(t,"sb",(function(){return a})),r.d(t,"qb",(function(){return o})),r.d(t,"ub",(function(){return h})),r.d(t,"Z",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"bb",(function(){return c})),r.d(t,"db",(function(){return d})),r.d(t,"D",(function(){return f})),r.d(t,"ob",(function(){return p})),r.d(t,"H",(function(){return g})),r.d(t,"Eb",(function(){return m})),r.d(t,"n",(function(){return _})),r.d(t,"vb",(function(){return v})),r.d(t,"E",(function(){return b})),r.d(t,"b",(function(){return w})),r.d(t,"zb",(function(){return y})),r.d(t,"S",(function(){return x})),r.d(t,"I",(function(){return T})),r.d(t,"T",(function(){return R})),r.d(t,"xb",(function(){return E})),r.d(t,"f",(function(){return S})),r.d(t,"nb",(function(){return A})),r.d(t,"mb",(function(){return k})),r.d(t,"eb",(function(){return M})),r.d(t,"X",(function(){return C})),r.d(t,"V",(function(){return P})),r.d(t,"a",(function(){return U})),r.d(t,"z",(function(){return L})),r.d(t,"Fb",(function(){return I})),r.d(t,"G",(function(){return O})),r.d(t,"wb",(function(){return D})),r.d(t,"v",(function(){return B})),r.d(t,"u",(function(){return G})),r.d(t,"t",(function(){return W})),r.d(t,"w",(function(){return N})),r.d(t,"U",(function(){return F})),r.d(t,"jb",(function(){return V})),r.d(t,"kb",(function(){return z})),r.d(t,"R",(function(){return H})),r.d(t,"hb",(function(){return j})),r.d(t,"ib",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"r",(function(){return q})),r.d(t,"q",(function(){return K})),r.d(t,"y",(function(){return Q})),r.d(t,"p",(function(){return Z})),r.d(t,"x",(function(){return J})),r.d(t,"Cb",(function(){return $})),r.d(t,"O",(function(){return ee})),r.d(t,"P",(function(){return te})),r.d(t,"Ab",(function(){return re})),r.d(t,"C",(function(){return ie})),r.d(t,"B",(function(){return ne})),r.d(t,"A",(function(){return se})),r.d(t,"K",(function(){return ae})),r.d(t,"J",(function(){return oe})),r.d(t,"L",(function(){return he})),r.d(t,"o",(function(){return ue})),r.d(t,"s",(function(){return le})),r.d(t,"gb",(function(){return ce})),r.d(t,"fb",(function(){return de})),r.d(t,"Db",(function(){return fe})),r.d(t,"Q",(function(){return pe})),r.d(t,"i",(function(){return ge})),r.d(t,"g",(function(){return me})),r.d(t,"k",(function(){return _e})),r.d(t,"m",(function(){return ve})),r.d(t,"rb",(function(){return be})),r.d(t,"pb",(function(){return we})),r.d(t,"tb",(function(){return ye})),r.d(t,"Y",(function(){return xe})),r.d(t,"cb",(function(){return Te})),r.d(t,"ab",(function(){return Re})),r.d(t,"c",(function(){return Ee})),r.d(t,"M",(function(){return Se})),r.d(t,"Bb",(function(){return Ae})),r.d(t,"N",(function(){return ke})),r.d(t,"yb",(function(){return Me})),r.d(t,"W",(function(){return Ce})),r.d(t,"lb",(function(){return Pe})),r.d(t,"e",(function(){return Ue}));const i=1,n=2,s=3,a=7,o=8,h=9,u=12,l=14,c=15,d=16,f=18,p=20,g=21,m=24,_=26,v=27,b=30,w=31,y=35,x=36,T=37,R=38,E=47,S=48,A=50,k=51,M=52,C=53,P=54,U=56,L=57,I=60,O=61,D=62,B=66.5,G=66.6,W=67,N=68,F=69,V=71,z=72,H=73,j=75,Y=76,X=78,q=105,K=106,Q=107,Z=108,J=109,$=120,ee=121,te=122,re=123,ie=124,ne=125,se=126,ae=127,oe=128,he=129,ue=132,le=133,ce=135,de=136,fe=137,pe=151,ge=-1,me=-2,_e=-3,ve=-5,be=-7,we=-8,ye=-9,xe=-12,Te=-14,Re=-15,Ee=-23,Se=-26,Ae=-27,ke=-28,Me=-35,Ce=-129,Pe=-130,Ue=-131},function(e,t,r){"use strict";r.d(t,"e",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"d",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"c",(function(){return g}));var i=r(7),n=r.n(i),s=r(14),a=r(17),o=r(5),h=r(10),u=r(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},c=e=>{0};class d{constructor(){this.onmessage=c,this.status=d.CLOSED,this.onopen=c,this.onclose=c,this.onwer=null}send(e){}delete(){this.onmessage=c,this.onopen=c,this.onclose=c,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}n()(d,"OPEN",1),n()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(c),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=c),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(r,0);break;case o.L:this.status=r,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:r,interval:i}=e||{};r?i?(this.sender=e=>{r.enqueue(e)},this.wasmSender=e=>{r.enqueue(e)},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}}):(this.sender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),this.port.postMessage({cmd:o.K,data:r},[r.buffer])});let{sabqueue:n,consumer:h,useCopy:u,interval:l,offset:c}=t||{};if(h&&(h.cancelConsume(),h=null),n){const e=u?e=>{this.onmessage(e,0)}:c?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=p.dataTransportMgr.monitorlogfn;if(l&&i){var d;let e=new s.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});r=e.timeoutReport.bind(e)}h=new a.a(n,e,r),t.consumer=h,l?h.consume(l,u):this.reciver=()=>{h.consumeAll(u)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=c,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:r,interval:i,offset:n,length:s,useOneElement:o}=e,h=new a.b(n>0?t.buffer:t,void 0,void 0,!!o,n,s,n>0?t:null);this.sab.sender={sabqueue:h,interval:i,useCopy:r,offset:n}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:n,offset:s,length:o,useOneElement:h}=t,u=new a.b(s>0?e.buffer:e,void 0,void 0,!!h,s,o,s>0?e:null),{consumer:l}=(null===(r=this.sab)||void 0===r?void 0:r.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:u,interval:n,useCopy:i,offset:s}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(e){this.onmessage=c,this.onopen=c,this.onclose=c,this.connect_type=e.connect_type||p.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=h.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=p.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=p.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}n()(p,"UDP",0),n()(p,"TCP",1),n()(p,"RLB_UDP",2),n()(p,"dataTransportMgr",null);class g{constructor(e){this.sock=null,this.onmessage=c}isReady(){return!1}send(){c()}setStatus(e){0}}function m(e,t,r,i){var n;null===(n=u.a.monitorlogfn)||void 0===n||n.call(u.a,e,"".concat(t,",").concat(r,",").concat(i))}},function(e,t,r){var i=r(34);e.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"p",(function(){return i})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return h})),r.d(t,"k",(function(){return u})),r.d(t,"q",(function(){return l})),r.d(t,"r",(function(){return c})),r.d(t,"s",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"n",(function(){return p})),r.d(t,"e",(function(){return g})),r.d(t,"m",(function(){return m})),r.d(t,"o",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"h",(function(){return b})),r.d(t,"a",(function(){return w})),r.d(t,"f",(function(){return y}));const i=1,n=2,s=3,a=4,o=5,h=6,u=7,l=8,c=9,d=10,f=11,p=129,g=130,m=131,_=132,v=133,b=134,w=135,y=136},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return a})),r.d(t,"g",(function(){return o})),r.d(t,"f",(function(){return h})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c})),r.d(t,"c",(function(){return d}));var i=r(3),n=r(2);function s(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function a(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}function o(e,t,r){if(!e||t<0||r<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(r));let n=!1,s=0;const a=e.acquireGPUFeaturesHelper();return a&&(s=a.queryMaxTextureDimension2D(),s>0&&(n=t>s||r>s)),n&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s)),Object(i.o)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s))),n}function h(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let r=!1,n=0;const s=e.acquireGPUFeaturesHelper();return s&&(n=s.queryMaxBufferSize(),n>0&&(r=t>n)),r&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n)),Object(i.o)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n))),r}function u(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===n.s||t===n.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function l(e,t){let r=0,i=0,n=0,s=0;const a=t.width/t.height;return e.width/e.height>a?(i=e.height,r=i*a,n=(e.width-r)/2,s=0):(r=e.width,i=r/a,n=0,s=(e.height-i)/2),r<=e.canvas.width&&(n=(e.canvas.width-r)/2),i<=e.canvas.height&&(s=(e.canvas.height-i)/2),{x:n,y:s,width:r,height:i}}function c(e,t,r,i){if(!e||!t||!r)return null;const s=t.width/t.height;let a=t.width,o=t.height;if(t.width>e.width||t.height>e.height){const r=e.width/t.width,i=e.height/t.height,n=Math.min(r,i);a*=n,o*=n}let h=0,u=0;e.width/e.height>s?(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a,h>e.width&&(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o)):(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o,u>e.height&&(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a));let l=0,c=0,d=0,f=0;i==n.p?(l=1-(l+(o-1)/e.height),c=t.left/e.width,f=1-t.top/e.height,d=c+a/e.width):i==n.s?(c=1-(l+(o-1)/e.height),d=1-t.top/e.height,l=t.left/e.width,f=c+a/e.width):i==n.q?(l=t.top/e.height,c=t.left/e.width,f=l+(o-1)/e.height,d=c+a/e.width):i==n.r&&(c=t.top/e.height,d=l+(o-1)/e.height,l=t.left/e.width,f=c+a/e.width);let p=[],g=[{x:d,y:f},{x:d,y:l},{x:c,y:l},{x:d,y:f},{x:c,y:f},{x:c,y:l}];for(let e=0;ee){const t=i.height*e;u=a/r.height,l=(Math.round((i.width-t)/2)+s)/r.width,d=u+(i.height-1)/r.height,c=l+t/r.width}else{const t=i.width/e;u=(Math.round((i.height-t)/2)+a)/r.height,l=s/r.width,d=u+(t-1)/r.height,c=l+i.width/r.width}o==n.p?(u=1-(u+(i.height-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+i.width/r.width):o==n.s?(l=1-(u+(i.height-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+i.width/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(i.height-1)/r.height,c=l+i.width/r.width):o==n.r&&(l=i.top/r.height,c=u+(i.height-1)/r.height,u=i.left/r.width,d=l+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,h=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,n=r.height/i.height,s=Math.min(e,n);t*=s,h*=s}let f=0,p=0;r.width/r.height>e?(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t,f>r.width&&(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h)):(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h,p>r.height&&(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t)),o==n.p?(u=1-(u+(h-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+t/r.width,i.height>i.width&&(l=a(l,2),c=s(c,2))):o==n.s?(l=1-(u+(h-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+t/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(h-1)/r.height,c=l+t/r.width):o==n.r&&(l=i.top/r.height,c=u+(h-1)/r.height,u=i.left/r.width,d=l+t/r.width)}let f=[],p=[{x:c,y:d},{x:c,y:u},{x:l,y:u},{x:c,y:d},{x:l,y:d},{x:l,y:u}];for(let e=0;e{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(r=>{r(e,t,1)}))}removeTransport(e){var t;let r=e.id;r in this.transportMap&&(delete this.transportMap[r],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let r=this.transportMap[t],i=r.target_thread==a.SELF_THREAD;if(r.type==e&&i)return r}return null}}n()(a,"NO_THREAD",0),n()(a,"SELF_THREAD",1)},function(e,t,r){"use strict";function i(){this.a=[],this.b=0,this.residue=null}i.prototype.getLength=function(){return this.a.length-this.b},i.prototype.isEmpty=function(){return 0==this.a.length},i.prototype.enqueue=function(e){this.a.push(e)},i.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},i.prototype.peek=function(){return 0{const e={};for(const t in n)e[n[t]]="WCL_"+t})(),{[n.AUDIO_ENCODE]:"audio.encode",[n.AUDIO_DECODE]:"audio.decode",[n.VIDEO_ENCODE]:"video.encode",[n.VIDEO_DECODE]:"video.decode",[n.SHARING_ENCODE]:"share.encode",[n.SHARING_DECODE]:"share.decode"})},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l}));var i=r(7),n=r.n(i),s=r(5),a=r(10),o=r(6),h=r(22);function u(e,t,r){if(!e)return;let i=o.a.dataTransportMgr;i.type===l.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,n=this.transportlists.find(e=>e.id===r);if(n||t==s.s)switch(t){case s.s:this.addRemoteTransport(e.data,null);break;case s.fb:n.setMsgPort(i||new a.a);break;case s.gb:n.setSabBuffer(e.data.sender,e.data.reciver);break;case s.o:n.remote=null,this.removeTransport(n)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i,transportType:n}=t.data,a=this.transportlists.find(e=>e.id===i);switch(r){case s.s:this.addRemoteTransport(t.data,e);break;case s.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case s.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let r={cmd:s.s,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransport(e,t){t.postMessage({cmd:s.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var r,i,n,a;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:s.gb,transportId:e.id,sender:null===(n=e.sabInfo)||void 0===n?void 0:n.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:n}=e;let s=this.createMsgSocketTransport(n);s.id=r,s.remote=t,s.portInfo=i,i?s.setMsgPort(s.portInfo):this.bindMessageChannel(s),this.addTransport(s)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let r=t.target_thread||a.b.SELF_THREAD;e.target_thread=r,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,r){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),r&&(r.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:r},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,r))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof h.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof h.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let r=0;r{if(!e.transportlists.includes(t.type))return;let r=e.target_thread||a.b.SELF_THREAD;r==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=r&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=r,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let r=e.target_thread;if(r!=a.b.SELF_THREAD)this.createRemoteTransport(e,r),this.setRemoteTransportSABBUffer(e,r);else{var i,n,s,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(n=e.sabInfo)&&void 0!==n&&n.reciver)e.setSabBuffer(null===(s=e.sabInfo)||void 0===s?void 0:s.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{r._report(),r._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let r="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,r)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,r){"use strict";r.d(t,"c",(function(){return i})),r.d(t,"f",(function(){return n})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"k",(function(){return o})),r.d(t,"g",(function(){return h})),r.d(t,"h",(function(){return u})),r.d(t,"b",(function(){return l})),r.d(t,"j",(function(){return c})),r.d(t,"i",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"d",(function(){return p}));const i=3,n=6,s=34,a=38,o=-51,h="SHARING_PARAM_INFO_FROM_SOCKET",u=121,l="AUDIO_QOS_DATA",c="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},p="EXPOSE_VB_FRAME"},function(e,t,r){"use strict";const i=e=>0==(e&e-1);let n=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(r+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(r+=" Message: ".concat(t.message)),t.error&&(r+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(r+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(r+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+=" Stack: ".concat(t.stack)),t.name&&(r+=" Name: ".concat(t.name)),t.constraint&&(r+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(r+=" Code: ".concat(t.code)),t.reason&&(r+=" Reason: ".concat(t.reason)),r+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(r+=" Message: ".concat(t.message)),t.name&&(r+=" Name: ".concat(t.name))):r+=t?t.toString():"",r}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const r=i(this._highFrequencyLogs[e]);this._instance&&r&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var r,i;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(r=(i=this._instance).directReport)||void 0===r||r.call(i,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=n},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o}));var i=r(11),n=r(16);class s{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=n,this._BYTES_PER_ELEMENT=t,this.capacity=(s-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,n,1),this.read_ptr=new Uint32Array(this.buf,n+4,1),this.storageUint8sByteOffset=n+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,s-8),this.byteLength=s,this.label=r,this.usingOneElementBuffer=i,a&&(this.wasmMemory=a),i&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new i.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let s=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==s)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++s}if(s>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),s>=1e3&&(n.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),r&&r("vqslclear")),s>0&&r){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,r&&r("vqsl"+s))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let r=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+r),r+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=r;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let r,i,n,s=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,s[0]):new Uint8Array(s[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r.byteLength);r.set(e,0)}else r=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+s[0]),i=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n=t*this._BYTES_PER_ELEMENT+8+4+s[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:i,end:n}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof s))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=r,this.tick_lasted_time=0,this.timeoutMS=i,this.maxCount=n}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),r={};this.keysList.forEach((t,i)=>{r[t]=e[i]}),r[this.timeStampKey]=Number(t.getBigUint64(0,!0));let i,n=Number(t.getBigUint64(8,!0)),s=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,n);return i=(this.bCopyData,s),r.data=i,r}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,r=new Uint32Array(e.buffer,0,9),i=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{r[t]=this.obj[e]}),i.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),i.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},function(e,t,r){"use strict";var i,n,s,a,o,h;function u(){}function l(e){let t=new Uint8Array(e.data);t.length<4||n&&a(t,n,s)}function c(e){}function d(e){}function f(e,t,r){n&&a(e,n,t,r)}function p(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(o=i,h=s,e){r.meetingNumber=r.meetingNumber+"",r.meetingId=r.meetingId+"",n=a?e(r.userId,r.meetingNumber,r.meetingId,0,0,!1,0,!0):e(r.userId,r.meetingNumber,r.meetingId,0,0,0,!1,!1,!0);let i=o(r.encryptKey);return t(n,i,r.encryptKey.length,r.encryptType),h(i),n}return 0}function g(e,t,r,n){i=e(t,u,l,c,d),a=r,s=n}function m(e,t){if(n&&t.body){if(t.body.add){let r=0,i=t.body.add;for(;r7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;if(null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost())this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGLRestoreTimeout")},1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext()}catch(e){Object(n.i)("webgl restoreContext exception",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webglcanvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl","experimental-webgl","moz-webgl","webkit-3d"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(i));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,i),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a),this.shaderProgram=a},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(4),n=r(3),s=r(9),a=r(19);let o=new Map,h=[];function u(e){e.preventDefault()}function l(e,t,r,n,s,a,o){let h=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGL2RestoreTimeout")},1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){Object(n.i)("webgl restoreContext exception2",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost2 event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webgl2canvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL2=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl2"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && \n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask* mask.a+ c*(1.0-mask.a);\n }\n }\n\n if (waterMarkFlag!=1) {\n c.a = 1.0;\n }\n\n outputColor = c;\n }\n "),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(r));var i=e.createProgram();e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(7),n=r.n(i),s=r(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new s.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,r,i){if(this._customer_callback){let n="".concat(e,",").concat(t,",").concat(r,",").concat(i);this._customer_callback(this._tag+"TimeOut",n)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),r="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),r=r.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",r)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(s.c.IsQosReport(e))return void this._cureen_qos_report++;if(s.c.IsVideoPkg(e)){let t=s.c.GetQOSTime(e),r=performance.now();if(this._lasted_qos_ts){let e=r-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,r)}this._lasted_qos_ts=t,this._lasted_sys_ts=r,this._lasted_data=e}}};var o=r(8),h=r(12),u=r(5);r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return c}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class c{constructor(e,t,r,i){this.id=e,this.type=t,this.datachannel=r,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=c.UNINIT,this.target_thread=i,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===c.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=c.DISCONNECT&&this._clear(),this._status=c.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==c.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var r;(this._status=c.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==h.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==h.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=c.CONNECTED)&&(null===(r=this.connectedFn)||void 0===r||r.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=c.DISCONNECT;let r=this.disconnectedFn;this._clear(),t!=c.DISCONNECT&&(null==r||r())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let r=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==r||r.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case u.A:this._onclose();break;case u.C:this._onopen();break;case u.B:this._onerror(t.ev);break;case u.H:this.report_monitor_func(t.tag,t.data)}}}n()(c,"UNINIT",0),n()(c,"CONNECTED",1),n()(c,"DISCONNECT",2)},function(e,t,r){"use strict";r.d(t,"d",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"a",(function(){return c}));var i=r(12),n=r(6),s=r(13);function a(e){return new n.a({sock:new n.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(n.a.dataTransportMgr)return;let r=new s.a({type:t?s.a.THREAD_SUB:s.a.THREAD_MAIN,remote:t?self:null});n.a.dataTransportMgr=r,r.monitorlogfn=e,t&&self.addEventListener("message",r._onrecvmainthreadlistener.bind(r))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function h(e){return n.a.dataTransportMgr.getTransportByType(e)}function u(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.removeDataChannel(e)}class c{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,r){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new n.c,r=h(n.e.VIDEO_ENCODE)||t,i=h(n.e.VIDEO_DECODE)||t,s=h(n.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?n.b.OPEN:n.b.CLOSED;r.setStatus(a),i.setStatus(a),this.isSupportVideoShare||s.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])r.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void s.send(t);i.send(t)}});const o=t=>{e.send(t)};r.onmessage=o,i.onmessage=o,s.onmessage=o}connectAudioSession(e){let t=new n.c,r=h(n.e.AUDIO_ENCODE)||t,i=h(n.e.AUDIO_DECODE)||t,s=e.isReady()?n.b.OPEN:n.b.CLOSED;r.setStatus(s),i.setStatus(s),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?r.send(t):i.send(t)});const a=t=>{e.send(t)};r.onmessage=a,i.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var i=r(7),n=r.n(i),s=r(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let r={id:e,worker:t},i=this._recvheartbeat.bind(this,r);r.listener=i,r.lastedtimestamp=Date.now(),r.worker.addEventListener("message",r.listener),this.monitorworkers[e]=r}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let r=t.data;r.cmd===s.Db&&(e.lastedtimestamp=r.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:s.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const r=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),i=Date.now(),n=this._lasted_timestamp;in+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",i-n):t.forEach(t=>{var r;let n=e.monitorworkers[t],s=n.lastedtimestamp+(null!==(r=document)&&void 0!==r&&r.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);i>s&&(e.timeoutcallbackfn(n.id,i-n.lastedtimestamp),n.lastedtimestamp=i)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}n()(o,"INTREVAL_TIME_MS",3e3),n()(o,"HEART_TIMEOUT_MS",15e3),n()(o,"MAX_HEART_TIMEOUT_MS",3e4),n()(o,"instance",null)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));class i{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c}));var i=r(11);function n(){this.ssrcQueueMap=new Map,n.prototype.AddQueue=function(e){var t=new i.a;return this.ssrcQueueMap.set(e,t),t},n.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},n.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},n.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},n.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},n.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var s=function(){this.frames=0,this.ntp=new i.a};s.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;s30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;sbtoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){n()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(s(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const r=this.textEncoder.encode(e);this.processList.push(r),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(s(t.buffer)),this.writeLog(this.EOL);const r=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(s(this.mergeBuffer(r).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=r(3);r.d(t,"a",(function(){return l}));class h{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,r){if(t){var i=new Uint8Array(r?t+1:t),n=Object(o.d)().subarray(e+0,e+t);return i.set(n,0,t),r&&(i[t]=10),i}return e.data}writeWasmLog(e,t){const r=this.getTime(),i=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(r,i):(this.writeLog(r),this.writeLog(i),this.writeLog("\n"))}}class u extends h{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=r=>{"local_log_port"===r.data.command?this.port||(this.port=r.data.data):"local_log_ready"===r.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new u:null}},function(e,t,r){"use strict";t.a=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:r,opacity:i,name:n}=e;t.fillStyle="rgba(0, 0, 0, ".concat(i,")"),t.fillText(n,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(i,")"),t.fillText(n,r.x+1,r.y+1)}_getTransformInfo(e){let t,{canvas:r,position:i}=e;if(1===i)t={x:r.width/2,y:0,rateRadio:0,maxWidth:r.width};else if(2===i)t={x:r.width/2,y:r.height,rateRadio:0,maxWidth:r.width};else if(4===i)t={x:0,y:r.height/2,rateRadio:Math.PI/2,maxWidth:r.height};else if(8===i)t={x:r.width,y:r.height/2,rateRadio:-Math.PI/2,maxWidth:r.height};else{const e=-21*Math.PI/180;t={x:r.width/2,y:r.height/2,rateRadio:e,maxWidth:Math.min(r.width/Math.cos(e),-r.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:r,name:i,textWidth:n}=e;const s=this._getPaddingWidth({ctx:r,position:t,name:i});return 1===t?{x:-n.width/2,y:s}:2===t||4===t||8===t?{x:-n.width/2,y:-s}:{x:-n.width/2,y:r.measureText(i[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:r,name:i}=e;return[1,2,4,8].includes(r)?32:t.measureText(i[0]).width}_setBaseLine(e){let{ctx:t,position:r}=e;t.textBaseline=1===r?"top":2===r||4===r||8===r?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;let h=this._getTransformInfo({canvas:t,position:a});var u=t.getContext("2d");let l;if(u.clearRect(0,0,t.width,t.height),u.translate(h.x,h.y),u.rotate(h.rateRadio),this._setBaseLine({ctx:u,position:a}),u.lineWidth=1,u.imageSmoothingEnabled=!0,1==r.length){const e=h.maxWidth/r.length;u.font=e+"px 'Segoe UI'",l=u.measureText(r)}else{let e=16;for(u.font=e+"px 'Segoe UI'",l=u.measureText(r);l.widthh.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r}))if(e>16)e-=1,u.font=e+"px 'Segoe UI'",l=u.measureText(r);else{const e=r;for(;r.length>5&&l.width>h.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r+"..."});)r=r.slice(0,r.length-1),l=u.measureText(r+"...");e!==r&&(r+="...")}}const c=this._calcTextPos({position:a,ctx:u,name:r,textWidth:l});var d;if(this._drawWatermarkWithShadow({ctx:u,name:r,opacity:s,textPos:c}),o)d=t.toDataURL();else{var f=u.getImageData(0,0,u.canvas.width,u.canvas.height);d=new Uint8Array(f.data.buffer)}return u.rotate(-h.rateRadio),u.translate(-h.x,-h.y),d}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;const h=t.getContext("2d");h.clearRect(0,0,t.width,t.height),h.translate(i/2,n/2),h.rotate(-21*Math.PI/180),h.imageSmoothingEnabled=!0;h.font="".concat(32,"px 'Segoe UI'"),h.textBaseline="top";const u=h.measureText(r),l=.37*u.width;let c,d=0,f=-n;do{let e=d%2==0?l-i:-i;do{h.fillStyle="rgba(0, 0, 0, ".concat(s,")"),h.fillText(r,e,f),h.fillStyle="rgba(255, 255, 255, ".concat(s,")"),h.fillText(r,e+1,f+1),e+=u.width+l}while(e=this._last_update_time+this._init_report_interval&&(this._report(),this.capture_fps_history=[],this.close_frames_history=[],this._last_update_time=e,this._init_report_intervalthis._report_interval&&(this._init_report_interval=this._report_interval)))},n.prototype.closeSample=function(){this.close_frames++,this.close_total_frames++},n.prototype.setCloseTotalFrames=function(e){this.close_total_frames=e},n.prototype.captureTicket=function(){this._enabled&&this.capture_ticket_count++},n.prototype.captureSample=function(){if(!this._enabled)return;this.capture_fps++,this.capture_total_fps++;let e=performance.now();if(this.last_capture_time){let t=e-this.last_capture_time;t>this.threshold&&this.capture_timeout_report.timeoutReport(t,e)}this.last_capture_time=e},n.prototype.ref=function(){this.ref_counts++},n.prototype.unref=function(){this.unref_counts++},n.prototype.start=function(){this._enabled||(0!=this._last_update_time&&(clearTimeout(this._last_update_time),this._last_update_time=0,this._report()),this.capture_fps=0,this.capture_fps_history=[],this.capture_total_fps=0,this.close_frames=0,this.close_frames_history=[],this.close_total_frames=0,this.capture_ticket_count=0,this._last_update_time=performance.now(),this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enabled=!0)},n.prototype.stop=function(){this._enabled&&(this._enabled=!1,this._interval_id&&clearInterval(this._interval_id),this._interval_id=0,(this.close_frames>0||this.capture_fps>0||this.capture_fps_history.length>0||this.close_frames_history>0)&&(this._timeout_id=setTimeout(this._timeout_report.bind(this),3e3)))}},function(e,t){e.exports=function(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(0),n=r.n(i),s=r(1),a=r.n(s),o=r(3),h=r(2);function u(e,t){c(e,t),t.add(e)}function l(e,t,r){c(e,t),t.set(e,r)}function c(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function d(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var f=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,_=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,T=new WeakMap,R=new WeakMap,E=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap,C=new WeakMap,P=new WeakMap,U=new WeakMap,L=new WeakMap,I=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,G=new WeakSet,W=new WeakSet,N=new WeakSet,F=new WeakSet,V=new WeakSet,z=new WeakSet,H=new WeakSet,j=new WeakSet,Y=new WeakSet,X=new WeakSet,q=new WeakSet,K=new WeakSet,Q=new WeakSet,Z=new WeakSet,J=new WeakSet,$=new WeakSet,ee=new WeakSet,te=new WeakSet,re=new WeakSet,ie=new WeakSet;function ne(e){e&&e.forEach(e=>{e.markRenderingStatePending()});const t=d(this,J,ve).call(this,e);if(n()(this,w)&&n()(this,b)&&n()(this,T))if(n()(this,f)&&0!=n()(this,f).width&&0!=n()(this,f).height&&n()(this,b)&&n()(this,b).getCurrentTexture()&&0!=n()(this,b).getCurrentTexture().width&&0!=n()(this,b).getCurrentTexture().height)try{if(!n()(this,S)){const e=n()(this,B).byteLength,t=e;a()(this,S,n()(this,T).acquireBuffer(t,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,e,!0,!1)),new Float32Array(n()(this,S).getMappedRange()).set(n()(this,B)),n()(this,S).unmap()}const e=d(this,H,le).call(this);for(const[r,i]of t)d(this,ee,we).call(this,r,i,e);const r=d(this,Z,_e).call(this,n()(this,b).getCurrentTexture().createView()),i=e.beginRenderPass(r);i.setVertexBuffer(0,n()(this,S));for(const[e,r]of t)if(r&&0!=r.length)for(const e of r){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;const t=e.getTextureType();let r=e.getUVCoords();if(t!==h.x.CLEAR_COLOR&&!r)continue;const s=n()(this,f).width,a=n()(this,f).height;let o=e.getViewport();if(!o||Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.w)||Number.isNaN(o.h)||o.x<0||o.y<0)continue;if(o.x+o.w>s){let e=o.x+o.w-s;if(!(e>0&&e<=h.i))continue;o.w-=e,o.w<=0&&(o.w=1)}if(o.y+o.h>a){let e=o.y+o.h-a;if(!(e>0&&e<=h.i))continue;o.h-=e,o.h<=0&&(o.h=1)}const u=d(this,$,be).call(this,e);if(!u)continue;if(u.pipelineType!==h.l.CLEAR_COLOR){let t=e.getUVCoordsBuffer();if(!t){const i=r.byteLength;t=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,r.byteLength,!1,!1),e.setUVCoordsBuffer(t)}n()(this,w).queue.writeBuffer(t,0,r,0,r.length),i.setVertexBuffer(1,t)}i.setViewport(o.x,o.y,o.w,o.h,o.minDepth,o.maxDepth);const l=u.pipeline;i.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});i.setBindGroup(0,c),i.draw(6,1,0,0)}i.end(),d(this,j,ce).call(this)}catch(e){Object(o.u)("[WebGUPRenderer] renderNoMsaa() error:".concat(e.message))}finally{n()(this,v).recycleInUsedGPUBuffers(t)}else n()(this,v).recycleInUsedGPUBuffers(t);else n()(this,v).recycleInUsedGPUBuffers(t)}function se(e){if(!n()(this,w)||!n()(this,b))return;const t=n()(this,w).createBuffer({label:"VertexBuffer",size:n()(this,B).byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,mappedAtCreation:!0});new Float32Array(t.getMappedRange()).set(n()(this,B)),t.unmap();const r=d(this,H,le).call(this),i=d(this,J,ve).call(this,e);for(const[e,t]of i)d(this,ee,we).call(this,e,t,r);const s=d(this,ie,Te).call(this,n()(this,f)),a=d(this,Q,me).call(this,0,s.createView(),n()(this,b).getCurrentTexture().createView()),o=r.beginRenderPass(a);o.setVertexBuffer(0,t);for(const[e,t]of i)if(t&&0!=t.length)for(const e of t){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;let t=e.getUVCoords();if(!t)continue;let r=e.getUVCoordsBuffer();if(!r){const i=t.byteLength;r=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,t.byteLength,!1,!0),e.setUVCoordsBuffer(r)}n()(this,w).queue.writeBuffer(r,0,t,0,t.length),o.setVertexBuffer(1,r);const i=n()(this,f).width,s=n()(this,f).height;let a=e.getViewport();if(!a||Number.isNaN(a.x)||Number.isNaN(a.y)||Number.isNaN(a.w)||Number.isNaN(a.h)||a.x<0||a.y<0||a.x+a.w>i||a.y+a.h>s)continue;const u=d(this,$,be).call(this,e,!0);if(!u)continue;o.setViewport(a.x,a.y,a.w,a.h,a.minDepth,a.maxDepth);const l=u.pipeline;o.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});o.setBindGroup(0,c),o.draw(6,1,0,0)}o.end(),d(this,j,ce).call(this),e.forEach(e=>{e.markRenderingStatePending()})}function ae(e){if(!Array.isArray(e))return;let t=[];for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalYuvTextureGroup] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalYuvTextureGroup] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();let s=null,a=null,o=null;const h=e.getWidth(),u=e.getHeight(),l=null!=r&&(h!=r.yPlaneTex.width||u!=r.yPlaneTex.height);let c=!0;r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(s=r.yPlaneTex,a=r.uPlaneTex,o=r.vPlaneTex,c=!1));let d=!1,f="r8unorm";if(i&&i.bufferConfig&&"nv12"==i.bufferConfig.colorFormat&&(f="rg8unorm",d=!0),c){const t=e.getIndex(),r=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,i=n()(this,E).assembleTextureConfig(h,u,r,"r8unorm",1),l=n()(this,E).assembleTextureConfig(h/2,u/2,r,f,1);s=n()(this,E).acquireTexture(i),s&&(s.label="RD(".concat(t,")-YPlaneTexture")),d?(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UVPlaneTexture"))):(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UPlaneTexture")),o=n()(this,E).acquireTexture(l),o&&(o.label="RD(".concat(t,")-VPlaneTexture")))}t.copyBufferToTexture({buffer:i.buffer,offset:i.yPlaneBuffer.offset,bytesPerRow:i.yPlaneBuffer.bytesPerRow,rowsPerImage:i.yPlaneBuffer.rowsPerImage},{texture:s},[h,u,1]),t.copyBufferToTexture({buffer:i.buffer,offset:i.uPlaneBuffer.offset,bytesPerRow:i.uPlaneBuffer.bytesPerRow,rowsPerImage:i.uPlaneBuffer.rowsPerImage},{texture:a},[h/2,u/2,1]),i.vPlaneBuffer.offset>0&&!d&&t.copyBufferToTexture({buffer:i.buffer,offset:i.vPlaneBuffer.offset,bytesPerRow:i.vPlaneBuffer.bytesPerRow,rowsPerImage:i.vPlaneBuffer.rowsPerImage},{texture:o},[h/2,u/2,1]);let p={};return p.yPlaneTex=s,p.uPlaneTex=a,p.vPlaneTex=o,p}function he(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalRgbaTexture] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalRgbaTexture] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();const s=e.getIndex(),a=e.getWidth(),o=e.getHeight(),h=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let u=null;const l=null!=r&&(a!=r.width||o!=r.height);let c=!0;if(r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(u=r,c=!1)),c){const e=n()(this,E).assembleTextureConfig(a,o,h,"rgba8unorm",1);u=n()(this,E).acquireTexture(e),u&&(u.label="RD(".concat(s,")-rgbaTexture"))}return t.copyBufferToTexture({buffer:i.buffer,offset:0,bytesPerRow:i.bytesPerRow,rowsPerImage:i.rowsPerImage},{texture:u},[a,o,1]),u}function ue(e,t){return Math.ceil(e/t)*t}function le(){return n()(this,w)?(n()(this,x)||a()(this,x,n()(this,w).createCommandEncoder()),n()(this,x)):(Object(o.u)("GPUDevice is not ready! No available command encoder."),null)}function ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;n()(this,x)&&e?n()(this,w).queue.submit([n()(this,x).finish(),e.finish()]):n()(this,x)?n()(this,w).queue.submit([n()(this,x).finish()]):e&&n()(this,w).queue.submit([e.finish()]),a()(this,x,null)}function de(e,t){if(!n()(this,w))return null;if(!n()(this,I)){let r=n()(this,w).createBindGroupLayout({label:"CursorTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"CursorTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"CursorTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,I,n()(this,w).createRenderPipeline(s))}return n()(this,I)}function fe(e,t){if(!n()(this,w))return null;if(!n()(this,L)){let r=n()(this,w).createBindGroupLayout({label:"WatermarkTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"WatermarkTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"WatermarkTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,L,n()(this,w).createRenderPipeline(s))}return n()(this,L)}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,C)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,C,n()(this,w).createRenderPipeline(i))}return n()(this,C)}function ge(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,P)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,P,n()(this,w).createRenderPipeline(i))}return n()(this,P)}function me(e,t,r){return{label:"renderPass - ".concat(e),colorAttachments:[{view:t,resolveTarget:r,loadOp:"clear",storeOp:"discard"}]}}function _e(e){return e&&(e.label="canvas-texture-view"),{label:"RenderPassNoMsaa",colorAttachments:[{view:e,loadOp:"clear",storeOp:"store"}]}}function ve(e){let t=new Map;for(let r=0;r1&&void 0!==arguments[1]&&arguments[1],r=null,i=null,s=null,a=null;const o=e.getZIndex(),u=e.getTextureType(),l=e.getColorFormat();if(o==h.w.VS_BASE){if(u==h.x.EXTERNAL_TEX){a=h.l.VIDEO_FRAME,r=this.acquireVideoFrameRenderPipeline(h.y,t),i=this.acquireVideoFrameSampler();const o=e.getPendingVideoFrame();if(!o||0==o.codedWidth||0==o.codedHeight||!o.format)return e.setPendingVideoFrame(null),null;const u=e.getUniformBuffer();if(!u)return null;s=[{binding:0,resource:i},{binding:1,resource:n()(this,w).importExternalTexture({source:o})},{binding:2,resource:{buffer:u}}]}else if(u==h.x.CLEAR_COLOR){a=h.l.CLEAR_COLOR,r=this.acquireClearColorRenderPipeline(h.c);const t=e.getClearColorUniformBuffer();if(!t)return null;s=[{binding:0,resource:{buffer:t}}]}else if(u==h.x.GPU_TEX_YUV){"i420"==l?(a=h.l.YUV_I420,r=d(this,q,pe).call(this,h.z,t)):"nv12"==l&&(a=h.l.YUV_NV12,r=d(this,K,ge).call(this,h.A,t)),i=this.acquireYuvTexturesSamplers();const n=e.getUniformBuffer();if(!n)return null;const o=e.getTextureGroup();o&&("i420"==l?s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:o.vPlaneTex.createView()},{binding:5,resource:{buffer:n}},{binding:6,resource:{buffer:n}}]:"nv12"==l&&(s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:{buffer:n}},{binding:5,resource:{buffer:n}}]))}}else if(o==h.w.WATERMARK||o==h.w.MASK){a=h.l.RGBA_WATERMARK,r=d(this,X,fe).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getTextureGroup();n&&(s=[{binding:0,resource:i},{binding:1,resource:n.createView()}])}else if(o==h.w.CURSOR){a=h.l.RGBA_CURSOR,r=d(this,Y,de).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getUniformBuffer();if(!n)return null;const u=e.getTextureGroup();u&&(s=[{binding:0,resource:i},{binding:1,resource:u.createView()},{binding:2,resource:{buffer:n}}])}if(a===h.l.CLEAR_COLOR){if(!r||!s)return null}else if(!r||!i||!s||null==a)return null;const c={pipelineType:a,pipeline:r,entries:s};return c}function we(e,t,r){for(const i of t){const t=i.getTextureType();t!=h.x.EXTERNAL_TEX&&t!=h.x.CLEAR_COLOR&&(e==h.w.VS_BASE?d(this,te,ye).call(this,i,r):e!=h.w.CURSOR&&e!=h.w.WATERMARK&&e!=h.w.MASK||d(this,re,xe).call(this,i,r))}}function ye(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,F,oe).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,F,oe).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function xe(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,V,he).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,V,he).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function Te(e){if(!e||!n()(this,w))return n()(this,D)?n()(this,D):null;if(n()(this,D)){if(n()(this,D).width!=e.width||n()(this,D).height!=e.height){const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}}else{const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}return n()(this,D)}var Re=class{constructor(e,t){if(u(this,ie),u(this,re),u(this,te),u(this,ee),u(this,$),u(this,J),u(this,Z),u(this,Q),u(this,K),u(this,q),u(this,X),u(this,Y),u(this,j),u(this,H),u(this,z),u(this,V),u(this,F),u(this,N),u(this,W),u(this,G),l(this,f,{writable:!0,value:null}),l(this,p,{writable:!0,value:0}),l(this,g,{writable:!0,value:0}),l(this,m,{writable:!0,value:!1}),l(this,_,{writable:!0,value:!1}),l(this,v,{writable:!0,value:null}),l(this,b,{writable:!0,value:null}),l(this,w,{writable:!0,value:null}),l(this,y,{writable:!0,value:null}),l(this,x,{writable:!0,value:null}),l(this,T,{writable:!0,value:null}),l(this,R,{writable:!0,value:null}),l(this,E,{writable:!0,value:null}),l(this,S,{writable:!0,value:null}),l(this,A,{writable:!0,value:null}),l(this,k,{writable:!0,value:null}),l(this,M,{writable:!0,value:null}),l(this,C,{writable:!0,value:null}),l(this,P,{writable:!0,value:null}),l(this,U,{writable:!0,value:null}),l(this,L,{writable:!0,value:null}),l(this,I,{writable:!0,value:null}),l(this,O,{writable:!0,value:null}),l(this,D,{writable:!0,value:null}),l(this,B,{writable:!0,value:new Float32Array(12)}),!t)throw new Error("[WebGPURenderer] resMgr is an invalid param! ".concat(t));a()(this,f,e),a()(this,v,t),this.initialize(e)}switchMsaa(e){a()(this,_,e)}isMsaaEnabled(){return n()(this,_)}setCanvas(e){e&&a()(this,f,e)}setDevice(e){e&&a()(this,w,e)}setRenderArgs(e,t){a()(this,p,e||0),a()(this,g,n()(this,p)?3:t?4:6),a()(this,m,t||!1)}setTextureIndex(e){a()(this,p,e||0)}initialize(e){n()(this,w)||(a()(this,w,n()(this,v).acquireGPUDevice()),n()(this,w))?(n()(this,y)||a()(this,y,n()(this,v).acquireCanvasFormat()),n()(this,T)||a()(this,T,n()(this,v).acquireGPUBufferMgr()),n()(this,R)||a()(this,R,n()(this,v).acquireGPUBufferPool()),n()(this,E)||a()(this,E,n()(this,v).acquireGPUTextureMgr()),this.configureGPUContext(e),d(this,N,ae).call(this,h.b)):Object(o.u)("[WebGPURenderer] initialize() device is not ready!")}isGPUDeviceReady(){return null!=n()(this,w)}render(e){n()(this,_)?d(this,W,se).call(this,e):d(this,G,ne).call(this,e)}updateVertexCoords(e){d(this,N,ae).call(this,e)}createRGBATexture(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;if(t<0)return Object(o.u)("[createRGBATexture] ".concat(t," is an invalid index!")),null;if(!n()(this,T))return console.warn("[createRGBATexture] buffer manager is not ready!"),null;if(!n()(this,w))return console.warn("[createRGBATexture] GPUDevice is not ready!"),null;if(null==s||void 0===s)return console.warn("[createRGBATexture] rgbaData is invalid!"),null;if(!e)return console.warn("[createRGBATexture] command encoder is invalid!"),null;const h=d(this,z,ue).call(this,Uint32Array.BYTES_PER_ELEMENT*r,256),u=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,l=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let c=null;const f=null!=a&&(r!=a.width||i!=a.height);let p=!0;if(a&&(f?(n()(this,E).recycleTexture(a),p=!0):(c=a,p=!1)),p){const e=n()(this,E).assembleTextureConfig(r,i,l,"rgba8unorm",1);c=n()(this,E).acquireTexture(e),c&&(c.label="RD(".concat(t,")-rgbaTexture"))}const g=n()(this,T).acquireBuffer("".concat(t,"_Y"),u,h*i,!0,!1),m=new Uint8Array(g.getMappedRange()),_=r*Uint32Array.BYTES_PER_ELEMENT;for(let e=0;e=g.length)return console.error("[WebGPURenderer] write yPlane is out of range! yPlaneOffset=".concat(0,", yPlane.height=").concat(r.height,", yPlaneBytesPerRow=").concat(a,", mappedArray.len=").concat(g.length)),null;for(let e=0;eg.length)return null;for(let e=0;e0){if(l+s.height*h>g.length)return null;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:null;if(!n()(this,w))return Object(o.u)("writeUniformBuffer() GPUDevice is not ready yet."),null;if(!t||0==t.length)return null;let i=r;return i||(i=n()(this,w).createBuffer({label:e,size:t.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),n()(this,w).queue.writeBuffer(i,0,t,0,t.length),i}acquireBlendTextureSampler(){return n()(this,w)?(n()(this,O)||a()(this,O,n()(this,w).createSampler({})),n()(this,O)):null}configureGPUContext(e){n()(this,b)||(a()(this,b,e.getContext("webgpu")),n()(this,b)?n()(this,b).configure({device:n()(this,w),format:n()(this,y),alphaMode:"premultiplied"}):Object(o.u)("configureGPUContext() webgpuContext is invalid! canvas=".concat(e)))}unconfigureGPUContext(){n()(this,b)&&(n()(this,b).unconfigure(),a()(this,b,null))}acquireVideoFrameRenderPipeline(e,t){if(!n()(this,w)||!e)return null;if(!n()(this,A)){const r=n()(this,w).createBindGroupLayout({label:"VideoFrameBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"VideoFrameRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"VideoFramePipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,A,n()(this,w).createRenderPipeline(i))}return n()(this,A)}acquireClearColorRenderPipeline(e){if(!n()(this,w)||!e)return null;if(!n()(this,k)){const t=n()(this,w).createBindGroupLayout({label:"ClearColorBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),r={label:"ClearColorRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"ClearColorPipelineLayout",bindGroupLayouts:[t]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};a()(this,k,n()(this,w).createRenderPipeline(r))}return n()(this,k)}acquireVideoFrameSampler(){return n()(this,w)?(n()(this,M)||a()(this,M,n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"})),n()(this,M)):null}acquireYuvTexturesSamplers(){if(!n()(this,w))return null;if(!n()(this,U)){a()(this,U,[]);const e=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"}),t=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"});n()(this,U).push(e),n()(this,U).push(t)}return n()(this,U)}clearAttachedCanvas(){if(!n()(this,w)||!n()(this,b)||!n()(this,S))return;if(!n()(this,f)||0==n()(this,f).width||0==n()(this,f).height)return;const e=n()(this,w).createCommandEncoder(),t=e.beginRenderPass({colorAttachments:[{view:n()(this,b).getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),r=n()(this,w).createRenderPipeline({layout:"auto",vertex:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}});t.setVertexBuffer(0,n()(this,S)),t.setPipeline(r),t.draw(6),t.end(),n()(this,w).queue.submit([e.finish()])}clear(){console.log("WebGPURender.clear")}cleanup(){this.unconfigureGPUContext(),a()(this,f,null),a()(this,y,null),a()(this,x,null),a()(this,S,null),a()(this,A,null),a()(this,k,null),a()(this,M,null),a()(this,C,null),a()(this,P,null),a()(this,U,null),a()(this,L,null),a()(this,I,null),a()(this,O,null),a()(this,D,null),n()(this,T)&&a()(this,T,null),n()(this,w)&&a()(this,w,null)}};function Ee(e,t){Ae(e,t),t.add(e)}function Se(e,t,r){Ae(e,t),t.set(e,r)}function Ae(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ke(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Me=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,Le=new WeakSet,Ie=new WeakSet,Oe=new WeakSet,De=new WeakSet,Be=new WeakSet;function Ge(){return!0}function We(){if(n()(this,Pe)){let e={};return e.architecture=n()(this,Pe).architecture,e.vendor=n()(this,Pe).vendor,e}return null}async function Ne(){if(!navigator.gpu)return a()(this,Me,h.C.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();if(!e)return a()(this,Me,h.C.CANNOT_REQ_ADAPTER),!1;return await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(a()(this,Pe,await e.requestAdapterInfo()),n()(this,Pe)&&console.log("adapter info: ".concat(n()(this,Pe).architecture,", ").concat(n()(this,Pe).vendor))):"info"in e&&a()(this,Pe,e.info),a()(this,Me,h.C.AVAILABLE),!0):(a()(this,Me,h.C.CANNOT_REQ_DEVICE),!1)}function Fe(e){if(!e)return!1;const t=e.vendor;return-1!==h.g.indexOf(t)}function Ve(e,t,r){return class{static produce(e,t,r){let i=null;return e===h.j.WEBGPU&&(i=new Re(t,r)),i}}.produce(e,t,r)}var ze=class{constructor(){Ee(this,Be),Ee(this,De),Ee(this,Oe),Ee(this,Ie),Ee(this,Le),Se(this,Me,{writable:!0,value:h.C.AVAILABLE}),Se(this,Ce,{writable:!0,value:h.j.WEBGL}),Se(this,Pe,{writable:!0,value:null}),Se(this,Ue,{writable:!0,value:new Map})}async evaluate(e){a()(this,Ce,h.j.WEBGL);if(!ke(this,Le,Ge).call(this))return n()(this,Ce);if(!e.allowedOnTargetPlatforms)return n()(this,Ce);if(!e.allowedOnTargetBrowsers)return n()(this,Ce);if(!await ke(this,Oe,Ne).call(this))return n()(this,Ce);const t=ke(this,Ie,We).call(this);if(!ke(this,De,Fe).call(this,t))return n()(this,Ce);let r=new OffscreenCanvas(1,1);return r.getContext("webgpu")?(r=null,a()(this,Ce,h.j.WEBGPU),n()(this,Ce)):(r=null,n()(this,Ce))}acquireRenderer(e,t){let r=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&n()(this,Ue).clear(),n()(this,Ue).has(e)&&(r=n()(this,Ue).get(e),r&&(e&&(r.setCanvas(e),r.initialize(e)),t&&r.setDevice(t.acquireGPUDevice()))),null==r&&(r=ke(this,Be,Ve).call(this,n()(this,Ce),e,t),r&&n()(this,Ue).set(e,r)),r}rendererReinitialize(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.unconfigureGPUContext()}getRendererType(){return n()(this,Ce)}setRendererType(e){a()(this,Ce,e)}isWebGPURendererType(){return n()(this,Ce)===h.j.WEBGPU}isWebGLRendererType(){return n()(this,Ce)===h.j.WEBGL}isWebGL2RendererType(){return n()(this,Ce)===h.j.WEBGL_2}cleanup(){for(const[e,t]of n()(this,Ue))t&&t.cleanup();n()(this,Ue).clear()}};function He(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function je(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Ye=new WeakSet,Xe=new WeakSet;function qe(e){e.forEach(e=>{e.consumePendingGPUEvents()})}function Ke(e){if(!e||0==e.length)return!0;return-1==e.findIndex(e=>{if(!e)return!1;return!!e.getTextureLayerByZIndex(h.w.VS_BASE)&&e.isRenderingStateReady()})}var Qe=class{constructor(){He(this,Xe),He(this,Ye)}render(e,t){return e?e.isGPUDeviceReady()?t&&0!=t.length?(je(this,Ye,qe).call(this,t),void(je(this,Xe,Ke).call(this,t)||e.render(t))):(console.warn("[RendererController] render displays are not available!"),void Object(o.o)("WGPU RendererController_render() displays are not available!")):(console.log("[RendererController] GPU device is not ready!"),void Object(o.o)("WGPU RendererController_render() GPU device is not ready!")):(console.warn("[RendererController] renderer is not attached!"),void Object(o.o)("WGPU RendererController_render() renderer is not attached!"))}},Ze=r(20),Je=r(21),$e=r(7),et=r.n($e),tt=r(4);function rt(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var it=new WeakMap,nt=new WeakMap,st=new WeakMap,at=new WeakMap,ot=new WeakMap,ht=new WeakMap,ut=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,_t=new WeakMap,vt=new WeakMap,bt=new WeakMap,wt=new WeakMap;var yt=class{constructor(e,t){rt(this,it,{writable:!0,value:0}),rt(this,nt,{writable:!0,value:-1}),rt(this,st,{writable:!0,value:0}),rt(this,at,{writable:!0,value:0}),rt(this,ot,{writable:!0,value:-1}),rt(this,ht,{writable:!0,value:null}),rt(this,ut,{writable:!0,value:-1}),rt(this,lt,{writable:!0,value:null}),rt(this,ct,{writable:!0,value:null}),rt(this,dt,{writable:!0,value:null}),rt(this,ft,{writable:!0,value:!1}),rt(this,pt,{writable:!0,value:null}),rt(this,gt,{writable:!0,value:null}),rt(this,mt,{writable:!0,value:null}),rt(this,_t,{writable:!0,value:null}),rt(this,vt,{writable:!0,value:null}),rt(this,bt,{writable:!0,value:!1}),rt(this,wt,{writable:!0,value:""}),a()(this,it,e),a()(this,nt,t)}getIndex(){return n()(this,it)}lock(){a()(this,ft,!0)}unlock(){a()(this,ft,!1)}isLocked(){return n()(this,ft)}getZIndex(){return n()(this,nt)}setWidth(e){a()(this,st,e)}setHeight(e){a()(this,at,e)}getWidth(){return n()(this,st)}getHeight(){return n()(this,at)}getRawData(){return n()(this,ht)}setRawData(e){a()(this,ht,e)}setIsNew(e){a()(this,bt,e)}isNew(){return n()(this,bt)}setColorFormat(e){a()(this,wt,e)}getColorFormat(){return n()(this,wt)}setPendingVideoFrame(e){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),a()(this,pt,e)}clearPendingVideoFrame(){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null))}setTextureLayerType(e){a()(this,ot,e)}getTextureLayerType(){return n()(this,ot)}setTextureType(e){a()(this,ut,e)}getTextureType(){return n()(this,ut)}getPendingVideoFrame(){return n()(this,pt)}getUVCoords(){return n()(this,ct)}setUVCoords(e){a()(this,ct,e)}getUVCoordsBuffer(){return n()(this,_t)}setUVCoordsBuffer(e){a()(this,_t,e)}evalViewport(e,t,r,i,s){n()(this,dt)||a()(this,dt,{}),n()(this,dt).x=Math.floor(e),n()(this,dt).w=Math.floor(r),n()(this,dt).h=Math.floor(i),n()(this,ot)==h.v.BASE_LAYER?n()(this,dt).y=Math.floor(s-(t+i)):n()(this,dt).y=Math.floor(t),n()(this,dt).x<0&&(n()(this,dt).x=0),n()(this,dt).y<0&&(n()(this,dt).y=0),n()(this,dt).minDepth=0,n()(this,dt).maxDepth=1}setViewport(e){a()(this,dt,e)}getViewport(){return n()(this,dt)}getTextureGroup(){return n()(this,lt)}setTextureGroup(e){a()(this,lt,e)}setUniformBuffer(e){a()(this,gt,e)}getUniformBuffer(){return n()(this,gt)}setClearColorUniformBuffer(e){a()(this,mt,e)}getClearColorUniformBuffer(){return n()(this,mt)}setTextureBufferGroup(e){a()(this,vt,e)}getTextureBufferGroup(){return n()(this,vt)}destroyTextureBufferGroup(){n()(this,vt)&&a()(this,vt,null)}recycle(e){this.destroyTextureBufferGroup(),e&&e.destroyTextureGroup(this),n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),n()(this,gt)&&(n()(this,gt).destroy(),a()(this,gt,null)),n()(this,mt)&&(n()(this,mt).destroy(),a()(this,mt,null)),a()(this,it,-1),a()(this,nt,-1),a()(this,ot,h.v.UNKNOWN),a()(this,ht,null),a()(this,ut,h.x.UNKNOWN),a()(this,ct,null),a()(this,dt,null),a()(this,ft,!1),a()(this,bt,!1),a()(this,wt,"")}},xt=r(9);function Tt(e,t){Et(e,t),t.add(e)}function Rt(e,t,r){Et(e,t),t.set(e,r)}function Et(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function St(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var At=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ct=new WeakMap,Pt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ot=new WeakMap,Dt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,er=new WeakMap,tr=new WeakMap,rr=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,ar=new WeakMap,or=new WeakMap,hr=new WeakMap,ur=new WeakMap,lr=new WeakMap,cr=new WeakMap,dr=new WeakMap,fr=new WeakSet,pr=new WeakSet,gr=new WeakSet,mr=new WeakSet,_r=new WeakSet,vr=new WeakSet,br=new WeakSet,wr=new WeakSet,yr=new WeakSet,xr=new WeakSet,Tr=new WeakSet,Rr=new WeakSet,Er=new WeakSet,Sr=new WeakSet,Ar=new WeakSet,kr=new WeakSet,Mr=new WeakSet,Cr=new WeakSet,Pr=new WeakSet,Ur=new WeakSet,Lr=new WeakSet,Ir=new WeakSet,Or=new WeakSet,Dr=new WeakSet,Br=new WeakSet,Gr=new WeakSet,Wr=new WeakSet,Nr=new WeakSet,Fr=new WeakSet,Vr=new WeakSet;function zr(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(St(this,Rr,ei).call(this),!n()(this,Nt)||!n()(this,Ft)||!n()(this,Nt).isGPUDeviceReady())return void(r instanceof VideoFrame&&r.close());const s=h.w.VS_BASE,a=St(this,Sr,ri).call(this,s),u=a.isLocked();if(u){const n=a.getPendingVideoFrame();!n||n.codedWidth==e&&n.codedHeight==t?r instanceof VideoFrame&&r.close():r instanceof VideoFrame?a.setPendingVideoFrame(r):(i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!"))}else{if(r instanceof VideoFrame){a.getPendingVideoFrame()!=r&&a.setPendingVideoFrame(r)}else i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!");a.setTextureLayerType(h.v.BASE_LAYER),a.setTextureType(h.x.EXTERNAL_TEX),a.lock()}this.markRenderingStateReady()}function Hr(e,t,r,i,s,a){St(this,Rr,ei).call(this);const o=h.w.VS_BASE,u=St(this,Sr,ri).call(this,o);if(u.setTextureLayerType(h.v.BASE_LAYER),u.setTextureType(h.x.GPU_TEX_YUV),u.clearPendingVideoFrame(),u.isLocked()){const e=u.getWidth(),i=u.getHeight();e==t&&i==r||(u.setWidth(t),u.setHeight(r),u.setIsNew(!0))}else u.setWidth(t),u.setHeight(r),u.setIsNew(!0),u.lock();const l=St(this,Dr,di).call(this,i,t,r,a),c=n()(this,Nt).writeToYuvTexturesBufferGroup(l,s);u.setTextureBufferGroup(c)}function jr(e,t,r,i){const s=St(this,Gr,pi).call(this,t,r);s.label="RgbaTexBuffer(".concat(e.getIndex(),")-").concat(s.size);let a=e.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,e,a,s),!a||!a.buffer)return console.warn("[updateRgbaBaseTexLayer()] texLayer(".concat(e.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,vr,qr).call(this,n()(this,At),t,r,i,a),this.markRenderingStateReady()}function Yr(e,t,r,i,s){const a=h.w.CURSOR,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Xr(e,t,r,i,s){const a=h.w.WATERMARK,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function qr(e,t,r,i,s){const a=h.w.VS_BASE,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BASE_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Kr(e,t,r){if(!St(this,Fr,_i).call(this,e))return;if(!n()(this,Ft))return void console.log("drawVideoFrameBaseTextureLayer() canvas is invalid? canvas=".concat(n()(this,Ft)));const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}const p=St(this,kr,ni).call(this);p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Qr(e,t,r){const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}let p=null;p=s.getTextureType()==h.x.EXTERNAL_TEX?St(this,kr,ni).call(this):St(this,Mr,si).call(this,n()(this,Ot)),p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Zr(e,t,r,i,n,s,a){const o=this.isUseFillMode({w:r.width,h:r.height,rotation:i}),h={width:s,height:a},u={width:e,height:t};return Object(xt.c)(o,h,u,r,i,n)}function Jr(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=e.width,o=e.height;s&&(a=s.width,o=s.height);let u,l,c,d,f=i==h.s||i==h.r?r:t,p=i==h.s||i==h.r?t:r,g=f/p*o,m=p/f*a;g>a?(u=0,c=1,l=(o-m)/2/o,d=1-l):(l=0,d=1,u=(a-g)/2/a,c=1-u),u=2*u-1,c=2*c-1,l=1-2*l,d=1-2*d;let _=[{x:c,y:l},{x:c,y:d},{x:u,y:d},{x:c,y:l},{x:u,y:l},{x:u,y:d}];n()(this,Nt)&&n()(this,Nt).updateVertexCoords(_)}function $r(e,t,r,i,n){var s,a,o,u;if(this.isUseFillMode({w:r,h:i,rotation:n}))s=0,a=0,o=1,u=1;else{var l=n==h.s||n==h.r?i:r,c=n==h.s||n==h.r?r:i,d=l/c*t;d>e?(s=0,o=1,u=1-(a=(t-c/l*e)/2/t)):(a=0,u=1,o=1-(s=(e-d)/2/e))}return{top:a=1-2*a,left:s=2*s-1,right:o=2*o-1,bottom:u=1-2*u}}function ei(){n()(this,Nt)||Object(o.u)("[WebGPURenderDisplay] renderer is not attached!")}function ti(e){if(e<0)throw new Error("[hasZIndexTexLayer] ".concat(e," is an invalid parameter!"));return n()(this,cr).has(e)}function ri(e){let t=null;return St(this,Er,ti).call(this,e)?t=n()(this,cr).get(e):(t=new yt(n()(this,At),e),n()(this,cr).set(e,t)),t}function ii(e,t,r){n()(this,Ft)&&(a()(this,rr,e),a()(this,ar,e&&r===tt.N?1:0),a()(this,or,t),e||a()(this,ir,r))}function ni(){const e={rotation:n()(this,Ot)};let t=null,r=n()(this,lr).get(h.w.VS_BASE);if(r){let i=r.buffer,s=r.uniform;if(s)if("yuvMode"in s)i&&i.destroy(),r=null;else if("rotation"in s){if(s.rotation!=e.rotation){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,i)}}else i&&i.destroy(),r=null}if(!r){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r)}return t?(r||(r={}),r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.VS_BASE,r),r):null}function si(e){if(-1==n()(this,nr))return null;const t={yuvMode:tt.V,colorRange:n()(this,nr),rotation:e};let r=null,i=n()(this,lr).get(h.w.VS_BASE);if(i){const e=i.uniform;if(r=i.buffer,e.yuvMode!=t.yuvMode||e.colorRange!=t.colorRange||e.rotation!=t.rotation){const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e,r)}}else{i={};const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e)}return r?(i.uniform=t,i.buffer=r,n()(this,lr).set(h.w.VS_BASE,i),i):null}function ai(){if(!n()(this,ur))return null;const e={cursorFlag:n()(this,or),cursorInfo:n()(this,ur)};let t=null,r=n()(this,lr).get(h.w.CURSOR);if(r){const i=r.uniform;if(t=r.buffer,i.cursorFlag!=e.cursorFlag||i.cursorInfo!=e.cursorInfo){const r=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,t)}}else{r={};const i=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),i)}return t?(r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.CURSOR,r),r):null}function oi(e,t){return Math.ceil(e/t)*t}function hi(e){const t=St(this,Pr,oi).call(this,1*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.rotation,r}function ui(e){const t=St(this,Pr,oi).call(this,3*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.yuvMode,r[1]=e.colorRange,r[2]=e.rotation,r}function li(e){const t=St(this,Pr,oi).call(this,5*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.cursorFlag,r[1]=e.cursorInfo.x,r[2]=e.cursorInfo.y,r[3]=e.cursorInfo.w,r[4]=e.cursorInfo.h,r}function ci(e){if(!e||0==e.length)return null;const t=St(this,Pr,oi).call(this,4*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function di(e,t,r,i){let n=t*r,s=e.subarray(0,n),a=0,o=0;i==tt.V?(o=t/2*r/2,a=o):i==tt.Z&&(o=t*r/2,a=0);let h=e.subarray(n,n+o);return{yPlane:{buffer:s,width:t,height:r},crPlane:{buffer:0!=a?e.subarray(n+o,n+o+a):null,width:t/2,height:r/2},cbPlane:{buffer:h,width:t/2,height:r/2}}}function fi(e,t,r){let i="",n=0,s=0,a=0;r==tt.V?(n=e/2*t/2,s=n,i="i420",a=Uint8Array.BYTES_PER_ELEMENT):r==tt.Z&&(n=e*t/2,s=0,i="nv12",a=Uint16Array.BYTES_PER_ELEMENT);const o=St(this,Pr,oi).call(this,Uint8Array.BYTES_PER_ELEMENT*e,256),h=St(this,Pr,oi).call(this,a*e/2,256);let u=o*t+h*t/2;s>0&&(u+=h*t/2);return{colorFormat:i,size:u,yPlane:{width:o,height:t},uvPlane:{width:h,height:t/2}}}function pi(e,t){const r=St(this,Pr,oi).call(this,Uint32Array.BYTES_PER_ELEMENT*e,256);return{colorFormat:"rgba",width:r,height:t,size:r*t}}function gi(e,t,r){if(t)if(t.buffer)if(r.size>t.buffer.size)n()(this,tr).recycleTextureBufferGroup(e),t.buffer=n()(this,tr).requestTextureBuffer(r),t.bufferConfig=r;else{"mapped"==t.buffer.mapState?t.bufferArray&&t.bufferArray.byteLength1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this),St(this,Ar,ii).call(this,1,n()(this,$t),n()(this,Dt));let i=null;i=t?St(this,Tr,$r).call(this,e.width,e.height,e.width,e.height,h.p):St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot)),St(this,br,Kr).call(this,e,i,r)}drawRemoteVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,Ft))return;if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this);const r=this.isRgbaMode(n()(this,Dt))?1:0;St(this,Ar,ii).call(this,r,n()(this,$t),n()(this,Dt));const i=St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot));St(this,wr,Qr).call(this,e,i,t)}drawCursor(e,t,r,i,s){if(!n()(this,Qt)||e&&(i<0||s<0))return;const o=h.w.CURSOR,u=St(this,Sr,ri).call(this,o),l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(u.setUVCoords(l.getUVCoords()),u.evalViewport(t,r,i,s,n()(this,Ft).height),e&&n()(this,$t)){const e={x:t/n()(this,Mt).width,y:r/n()(this,Mt).height,w:i/n()(this,Mt).width,h:s/n()(this,Mt).height};a()(this,ur,e)}else{const e={x:0,y:0,w:0,h:0};a()(this,ur,e)}const c=St(this,Cr,ai).call(this);c&&c.buffer&&u.setUniformBuffer(c.buffer)}setMultiView(e){a()(this,Vt,e)}setFillMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a()(this,Bt,e),a()(this,Gt,t)}getFillMode(){return n()(this,Bt)}setColorRange(e){a()(this,nr,e)}getFillModeForResolution(){return n()(this,Gt)}getTextureIndex(){return n()(this,kt)}isUseFillMode(e){let{w:t,h:r,rotation:i}=e;if(!n()(this,Bt))return!1;if(!n()(this,Gt))return!0;if(!t||!r)return!1;const s=i===h.s||i===h.s?r/t:t/r;return(Array.isArray(n()(this,Gt))?n()(this,Gt):[n()(this,Gt)]).some(e=>Math.abs(s-e)<.01)}setVideoMode(e){a()(this,Dt,e)}getVideoMode(){return n()(this,Dt)}setWatermarkFlag(e){a()(this,zt,e),e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))}setWatermarkRepeated(e){a()(this,Ht,e)}isWatermarkRepeated(){return!!n()(this,Ht)}setWatermarkOpacity(e){a()(this,jt,e||.15)}getWatermarkOpacity(){return n()(this,jt)}setWatermarkPosition(e){a()(this,Yt,e||16)}getWatermarkPosition(){return n()(this,Yt)}isSetWatermark(){return n()(this,zt)}isRgbaMode(e){return-1!==[tt.ab,tt.N].indexOf(e)}getTextureWidth(){return n()(this,Ct)}getTextureHeight(){return n()(this,Pt)}getCroppingParams(){return n()(this,Mt)}recoverTextures(){}updateWatermark(e,t,r){const i=h.w.WATERMARK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(a()(this,Xt,e),a()(this,qt,t),a()(this,zt,1),a()(this,sr,1),!St(this,Er,ti).call(this,h.w.VS_BASE)){console.log("[updateWatermark] base layer is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};return void s.setRawData(i)}const u=St(this,Sr,ri).call(this,h.w.VS_BASE).getViewport();if(u)try{const i=St(this,Gr,pi).call(this,e,t);i.label="WatermarkTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateWatermark()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,_r,Xr).call(this,n()(this,At),e,t,r,a),u&&s.setViewport(u);let o=s.getUVCoords(),h=St(this,Nr,mi).call(this);o||(o=new Float32Array(12)),o.set(h,0),s.setUVCoords(o),s.setRawData(null),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateWatermark() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateWatermark() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}else{console.log("[updateWatermark] base layer's viewport is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};s.setRawData(i)}}updateCursor(e,t,r){const i=h.w.CURSOR,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();a()(this,Zt,e),a()(this,Jt,t),a()(this,$t,1);try{const i=St(this,Gr,pi).call(this,e,t);i.label="CursorTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return void console.warn("[updateCursor()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!"));if("mapped"!=a.buffer.mapState)return void console.error("updateCursor() why buffer state is not mapped!");St(this,mr,Yr).call(this,n()(this,At),e,t,r,a),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateCursor() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateCursor() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}updateSelfVideoTextures(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;St(this,Rr,ei).call(this);const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Ft)||!n()(this,Nt))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length%4!=0)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(1!=e||1!=t){if(a()(this,Ct,e),a()(this,Pt,t),a()(this,Ot,u),Object.assign(n()(this,Mt),i),!s)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateSelfVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfVideoTextures() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close();St(this,Sr,ri).call(this,h.w.VS_BASE).setPendingVideoFrame(null)}}else{l.setPendingVideoFrame(null),St(this,Vr,vi).call(this),r&&r instanceof VideoFrame&&r.close();const e=St(this,Or,ci).call(this,r);if(e)if(n()(this,Nt)){let t=l.getClearColorUniformBuffer();t=n()(this,Nt).writeUniformBuffer("ClearColorUniformBuffer",e,t),l.setClearColorUniformBuffer(t),l.setTextureType(h.x.CLEAR_COLOR)}else console.warn("updateSelfVideoTextures() renderer is not attached!");else Object(o.u)("updateSelfVideoTextures() cannot create the uniform buffer array.");this.markRenderingStateReady()}}updateRemoteVideoTexturesImageBitmap(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Nt)||!n()(this,Ft))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(a()(this,Ct,e),a()(this,Pt,t),Number.isNaN(s)||a()(this,Ot,s),Object.assign(n()(this,Mt),i),!u)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close(),l.setPendingVideoFrame(null)}}updateRemoteVideoTextures(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6?arguments[6]:void 0;const c=h.w.VS_BASE,d=St(this,Sr,ri).call(this,c);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(!St(this,Fr,_i).call(this,l))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();St(this,Rr,ei).call(this);const f=this.isRgbaMode(n()(this,Dt));if(e<=0||t<=0||!i||!i.length||i.length!=e*t*3/2&&!f||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();if(f)try{St(this,fr,zr).call(this,e,t,i,!0);let o=u?0:1;a()(this,nr,o),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height)}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),d.setPendingVideoFrame(null),this.markRenderingStatePending()}finally{n()(this,tr).recycleTextureBufferGroup(d)}else try{const o=St(this,Br,fi).call(this,e,t,n()(this,Dt));o.label="YuvVideoTexBuffer(".concat(d.getIndex(),")-").concat(o.size),d.setColorFormat(o.colorFormat);let h=d.getTextureBufferGroup();if(h=St(this,Wr,gi).call(this,d,h,o),!h||!h.buffer)return console.warn("[updateRemoteVideoTextures()] texLayer(".concat(d.getIndex(),") cannot apply a GPUBuffer!")),void this.markRenderingStatePending();let l=u?0:1;a()(this,nr,l),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),St(this,pr,Hr).call(this,n()(this,At),e,t,i,h,n()(this,Dt)),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message," cs:").concat(e.stack)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(d),this.markRenderingStatePending()}}drawNextOutputPictureFrame(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];const d=h.w.VS_BASE,f=St(this,Sr,ri).call(this,d);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(f),void this.markRenderingStatePending();s=s||h.p;let p=(r=r||{top:0,left:0,width:e,height:t}).width!=n()(this,Mt).width||r.height!=n()(this,Mt).height,g=r.top!=n()(this,Mt).top||r.left!=n()(this,Mt).left,m=n()(this,Ft).width!=n()(this,Ut)||n()(this,Ft).height!=n()(this,Lt),_=e!=n()(this,Ct)||t!=n()(this,Pt),v=s!=n()(this,It);if((p||m||v)&&St(this,xr,Jr).call(this,n()(this,Ft),r.width,r.height,s,l),l){const e=Object(xt.d)(r,s),t=Object(xt.a)(l,e);f.evalViewport(t.x,t.y,t.width,t.height,n()(this,Ft).height)}else f.evalViewport(0,0,n()(this,Ft).width,n()(this,Ft).height,n()(this,Ft).height);if(p||g||_||v||!f.getUVCoords()){let i=Object(xt.b)({width:e,height:t},r,n()(this,Ft),s),a=f.getUVCoords();a||(a=new Float32Array(12)),a.set(i),f.setUVCoords(a)}let b=u?0:1;b!=n()(this,nr)&&a()(this,nr,b),a()(this,rr,0),a()(this,ir,tt.V),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,It,s),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),f.setColorFormat("i420");try{const r=St(this,Br,fi).call(this,e,t,tt.V);if(r.label="YuvShareTexBuffer(".concat(f.getIndex(),")-").concat(r.size),c){let s=f.getTextureBufferGroup();if(s=St(this,Wr,gi).call(this,f,s,r),!s||!s.buffer)return console.warn("[drawNextOutputPictureFrame()] texLayer(".concat(f.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,pr,Hr).call(this,n()(this,At),e,t,i,s,tt.V);const a=St(this,Mr,si).call(this,n()(this,It));a&&a.buffer&&f.setUniformBuffer(a.buffer)}n()(this,$t)?a()(this,or,1):a()(this,or,0),a()(this,Qt,1),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] drawNextOutputPictureFrame() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_drawNextOutputPictureFrame() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(f),this.markRenderingStatePending()}}clearCanvas(e){n()(this,Nt)&&n()(this,Nt).clearAttachedCanvas()}updateSelfMaskImage(e,t,r){const i=h.w.MASK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(!St(this,Er,ti).call(this,h.w.VS_BASE))return console.log("[updateSelfMaskImage] base layer is not ready."),n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();try{const i=St(this,Gr,pi).call(this,e,t);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateSelfMaskImage()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();if(a.buffer.label="SelfMaskImageTexBuffer(".concat(s.getIndex(),")-").concat(i.size),s.setTextureLayerType(h.v.BLEND_LAYER),s.setTextureType(h.x.GPU_TEX_RGBA),s.isLocked()){const r=s.getWidth(),i=s.getHeight();r==e&&i==t||(s.setWidth(e),s.setHeight(t),s.setIsNew(!0))}else s.setWidth(e),s.setHeight(t),s.setIsNew(!0),s.lock();const o=n()(this,Nt).writeToRgbaTextureBuffer(n()(this,At),e,t,r,a);s.setTextureBufferGroup(o);const u=St(this,Sr,ri).call(this,h.w.VS_BASE),l=u.getViewport();l&&s.setViewport(l),s.setUVCoords(u.getUVCoords()),this.isSetWatermark()&&n()(this,Xt)&&n()(this,qt),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateSelfMaskImage() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfMaskImage() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}readPixelsSyncRequest(e,t,r,i){}isAvaiable(){return!0}markRenderingStateReady(){a()(this,Kt,h.k.READY)}markRenderingStateRendering(){a()(this,Kt,h.k.RENDERING)}markRenderingStatePending(){a()(this,Kt,h.k.PENDING)}markRenderingStateIdle(){a()(this,Kt,h.k.IDLE)}isRenderingStateReady(){return n()(this,Kt)===h.k.READY}isInTargetRenderingState(e){return n()(this,Kt)===e}getWatermarkWidth(){return n()(this,Xt)}getWatermarkHeight(){return n()(this,qt)}getIndex(){return n()(this,At)}getRenderingState(){return n()(this,Kt)}recycle(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(const[t,r]of n()(this,cr))r&&(n()(this,tr).recycleTextureBufferGroup(r,e),r.recycle(n()(this,tr)));a()(this,dr,{top:0,left:0,bottom:0,right:0}),this.markRenderingStateIdle(),n()(this,cr).clear(),n()(this,lr).clear(),this.unbindSsrc()}cleanup(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.recycle(e),this.removeRenderer(),this.detachCanvas(),this.removeGPUResMgr()}clear(){console.log("WebGPURenderDisplay.clear"),this.clearCanvas(),a()(this,Qt,0),a()(this,$t,0),this.recycle()}clearDisplay(){console.log("WebGPURenderDisplay.clearDisplay"),this.clearCanvas()}getTextureLayersMap(){return n()(this,cr)}getTextureLayerByZIndex(e){return St(this,Sr,ri).call(this,e)}getUsedBuffersCount(){let e=0;for(const[t,r]of n()(this,cr))r&&r.getTextureBufferGroup()&&r.getTextureBufferGroup().buffer&&e++;return e}consumePendingGPUEvents(){if(n()(this,zt)){const e=St(this,Sr,ri).call(this,h.w.WATERMARK).getRawData();e&&this.updateWatermark(n()(this,Xt),n()(this,qt),e.data)}}resizeCanvasTo(e,t){n()(this,Ft)&&(n()(this,Ft).width=e,n()(this,Ft).height=t)}};function wi(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var yi=new WeakMap,xi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Ei=new WeakMap;var Si=class{constructor(e,t,r){wi(this,yi,{writable:!0,value:0}),wi(this,xi,{writable:!0,value:null}),wi(this,Ti,{writable:!0,value:null}),wi(this,Ri,{writable:!0,value:h.t.AVAILABLE}),wi(this,Ei,{writable:!0,value:null}),a()(this,yi,e),a()(this,Ri,t),a()(this,Ei,r),a()(this,xi,[]),a()(this,Ti,[])}initPool(e){if(e>n()(this,yi))throw new Error("initSize=".concat(e," is larger than maxSize=").concat(n()(this,yi),", invalid!"));if(e<0)throw new Error("initSize=".concat(e," is smaller than 0, invalid!"));for(let t=0;t=n()(this,yi))return;let t=0;if(n()(this,xi).length+e>=n()(this,yi)&&(t=n()(this,yi)-n()(this,xi).length),t>0){const e=n()(this,xi).length;for(let r=0;r0&&void 0!==arguments[0])||arguments[0])&&this.isPoolEmpty()&&this.expandPool(4);const e=n()(this,xi).pop();return e&&(e.markRenderingStatePending(),n()(this,Ti).push(e)),e}recycle(e){if(n()(this,xi).length0&&void 0!==arguments[0])||arguments[0];n()(this,xi).forEach(t=>{t.cleanup(e)}),n()(this,Ti).forEach(t=>{t.cleanup(e)}),a()(this,xi,[]),a()(this,Ti,[])}isPoolEmpty(){return 0==n()(this,xi).length}getInUseRenderDisplays(){return n()(this,Ti)}getAllRenderDisplays(){return n()(this,xi)}isServeForVideoRendering(){return n()(this,Ri)===h.t.VIDEO}isServeForShareRendering(){return n()(this,Ri)===h.t.SHARE}isServingForNow(e){return n()(this,Ri)===e}};function Ai(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ki=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Pi=new WeakMap,Ui=new WeakMap;class Li{getVideoRenderDisplay(e,t,r,i){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getSharingRenderDisplay(e,t,r){throw new Error("getSharingRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,r){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}var Ii=new WeakMap,Oi=new WeakMap;class Di extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Ii,{writable:!0,value:new Map}),Ai(this,Oi,{writable:!0,value:!1}),a()(this,Oi,e)}setCanvasAlphaChannelEnability(e){a()(this,Oi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Ze.a(e,t,r,s,a,o,h,n()(this,Oi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Ii).get(e);if(!a){let i=[];a=[i,[]],n()(this,Ii).set(e,a);let o=new Ze.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Oi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Ze.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,n()(this,Oi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Ii).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Ze.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Oi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Ii).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Ii).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Ii).delete(r),n()(this,Ii).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Ii)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t,null);for(const[e,t]of n()(this,Ii)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Ii,new Map)}cleanupByCanvas(e){if(n()(this,Ii).get(e)){let t=n()(this,Ii).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Ii).delete(e)}}}}var Bi=new WeakMap,Gi=new WeakMap;class Wi extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Bi,{writable:!0,value:new Map}),Ai(this,Gi,{writable:!0,value:!1}),a()(this,Gi,e)}setCanvasAlphaChannelEnability(e){a()(this,Gi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Je.a(e,t,r,s,a,o,h,n()(this,Gi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Bi).get(e);if(!a){let i=[];a=[i,[]],n()(this,Bi).set(e,a);let o=new Je.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Gi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Je.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,void 0,n()(this,Gi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Bi).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Je.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Gi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Bi).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Bi).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Bi).delete(r),n()(this,Bi).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Bi)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t);for(const[e,t]of n()(this,Bi)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Bi,new Map)}cleanupByCanvas(e){if(n()(this,Bi).get(e)){let t=n()(this,Bi).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Bi).delete(e)}}}}var Ni=new WeakMap,Fi=new WeakMap,Vi=new WeakMap;class zi extends Li{constructor(){super(),Ai(this,Ni,{writable:!0,value:new Map}),Ai(this,Fi,{writable:!0,value:new Map}),Ai(this,Vi,{writable:!0,value:null})}setGPUResourceMgr(e){a()(this,Vi,e)}getVideoRenderDisplay(e,t,r,i){let s=n()(this,Ni).get(e);s||(s=new Si(r,h.t.VIDEO,n()(this,Vi)),s.initPool(r),n()(this,Ni).set(e,s));let a=s.pop();return a?(a.setMultiView(!0),a):null}getSharingRenderDisplay(e,t,r){r&&r.clearCache&&n()(this,Fi).clear();let i=n()(this,Fi).get(e);return i||(i=new Si(1,h.t.SHARE,n()(this,Vi)),i.initPool(1),n()(this,Fi).set(e,i)),i.pop()}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=new bi(r,n()(this,Vi));return s.addRenderer(i),s.attachCanvas(e),s}getInUseCanvasRenderDisplayList(e){let t=[],r=null;if(e==h.t.VIDEO?r=n()(this,Ni):e==h.t.SHARE&&(r=n()(this,Fi)),r)for(const[e,i]of r){let r={};r.canvas=e,r.renderDisplays=i.getInUseRenderDisplays(),r.renderDisplays.length>0&&t.push(r)}return t}recycleRenderDisplay(e,t){if(e){const t=e.getAttachedCanvas();if(t){let r=n()(this,Ni).get(t);r&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),r.recycle(e));let i=n()(this,Fi).get(t);i&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),i.recycle(e))}}}cleanup(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null==e||null===(t=e.cleanup)||void 0===t||t.call(e,r);for(const[e,t]of n()(this,Ni))t.cleanup(r);for(const[e,t]of n()(this,Fi))t.cleanup(r)}cleanupByCanvas(e){let t=n()(this,Ni).get(e);t&&(t.cleanup(),n()(this,Ni).delete(e));let r=n()(this,Fi).get(e);r&&(r.cleanup(),n()(this,Fi).delete(e))}collectInUseRenderDisplays(e){return this.getInUseCanvasRenderDisplayList(e)}collectInUseRenderDisplaysByCanvas(e,t){let r=null;if(e)if(t==h.t.VIDEO){r=n()(this,Ni).get(e).getInUseRenderDisplays()}else if(t==h.t.SHARE){r=n()(this,Fi).get(e).getInUseRenderDisplays()}return r}getRenderDisplayMap(e){let t=null;return e==h.t.VIDEO?t=n()(this,Ni):e==h.t.SHARE&&(t=n()(this,Fi)),t}}var Hi=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ai(this,ki,{writable:!0,value:null}),Ai(this,Mi,{writable:!0,value:null}),Ai(this,Ci,{writable:!0,value:null}),Ai(this,Pi,{writable:!0,value:null}),Ai(this,Ui,{writable:!0,value:!1}),a()(this,Ui,e)}setGPUResourceMgr(e){a()(this,Pi,e)}isEnableCanvasAlphaChannel(){return n()(this,Ui)}setCanvasAlphaChannelEnability(e){a()(this,Ui,e),n()(this,ki)&&n()(this,ki).setCanvasAlphaChannelEnability(e),n()(this,Mi)&&n()(this,Mi).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),n()(this,ki)}getWebGL2RenderDisplayMgr(){return n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),n()(this,Mi)}getWebGPURenderDisplayMgr(){return n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),n()(this,Ci)}getVideoRenderDisplay(e,t,r,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),l=n()(this,ki).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),l=n()(this,Mi).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),l=n()(this,Ci).getVideoRenderDisplay(t,r,i,s),l&&(l.addRenderer(o),l.attachCanvas(t),l.setGPUResMgr(n()(this,Pi)))),l}getSharingRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),o=n()(this,ki).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),o=n()(this,Mi).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),o=n()(this,Ci).getSharingRenderDisplay(t,r,s),o&&(o.addRenderer(i),o.attachCanvas(t),o.setGPUResMgr(n()(this,Pi)))),o}createVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=null;return e==h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),u=n()(this,ki).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),u=n()(this,Mi).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),u=n()(this,Ci).createVideoRenderDisplay(t,r,i,s,o),u.addRenderer(s),u.attachCanvas(t),u.setGPUResMgr(n()(this,Pi))),u}recycleRenderDisplay(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e===h.j.WEBGPU?n()(this,Ci)&&n()(this,Ci).recycleRenderDisplay(r,i,s):e===h.j.WEBGL?n()(this,ki)&&n()(this,ki).recycleRenderDisplay(t,r,s):e===h.j.WEBGL_2&&n()(this,Mi)&&n()(this,Mi).recycleRenderDisplay(t,r,s)}collectInUseRenderDisplays(e,t){let r=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(r=n()(this,Ci).collectInUseRenderDisplays(t)),r}collectInUseRenderDisplaysByCanvas(e,t,r){let i=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(i=n()(this,Ci).collectInUseRenderDisplaysByCanvas(t,r)),i}getRenderDisplayMap(e,t){if(e===h.j.WEBGL){if(n()(this,ki))return n()(this,ki).getRenderDisplayMap()}else if(e===h.j.WEBGPU){if(n()(this,Ci))return n()(this,Ci).getRenderDisplayMap(t)}else if(e===h.j.WEBGL_2&&n()(this,Mi))return n()(this,Mi).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,ki)?n()(this,ki).onRestoredFromContextLost(e,t,r,i,s,a):n()(this,Mi)?n()(this,Mi).onRestoredFromContextLost(e,t,r,i,s,a):null}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==n()(this,ki)&&n()(this,ki).cleanup(e,t),n()(this,Mi)&&n()(this,Mi).cleanup(e,t),null!==n()(this,Ci)&&n()(this,Ci).cleanup(t,r)}cleanupByCanvas(e){null!==n()(this,ki)&&n()(this,ki).cleanupByCanvas(e),null!==n()(this,Mi)&&n()(this,Mi).cleanupByCanvas(e),null!==n()(this,Ci)&&n()(this,Ci).cleanupByCanvas(e)}};function ji(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var Yi=new WeakMap,Xi=new WeakMap,qi=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;var $i=class{constructor(e){ji(this,Yi,{writable:!0,value:h.f.VERTEX_BUFFER}),ji(this,Xi,{writable:!0,value:{}}),ji(this,qi,{writable:!0,value:null}),ji(this,Ki,{writable:!0,value:0}),ji(this,Qi,{writable:!0,value:0}),ji(this,Zi,{writable:!0,value:[]}),ji(this,Ji,{writable:!0,value:new Map}),a()(this,qi,e)}acquireBuffer(e,t,r){let i,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?n()(this,Ji).has(e)?i=n()(this,Ji).get(e):n()(this,Zi).length>0?(i=n()(this,Zi).pop(),n()(this,Ji).set(e,i)):(i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),n()(this,Ji).set(e,i)):i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),i}releaseBuffer(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Ji).has(e)){const t=n()(this,Ji).get(e);r?n()(this,Zi).push(t):t.destroy(),n()(this,Ji).delete(e)}else r||-1!=n()(this,Zi).indexOf(t)&&(n()(this,Zi)[index]=n()(this,Zi)[n()(this,Zi).length-1],n()(this,Zi).pop(),t.destroy())}getNumUsedBuffers(){return n()(this,Ki)}getNumFreeBuffers(){return n()(this,Qi)}cleanup(){n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Ji).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,n()(this,Ji).clear(),a()(this,Ki,0),a()(this,Qi,0)}release(e){e==h.n.OVERUSE&&(n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,a()(this,Qi,0))}getResourceType(){return n()(this,Yi)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Ji))e++,t+=s.size,r+="[GPUBufferMgr] entry{key:".concat(i,", buffer:{label:").concat(s.label," size:").concat(s.size,"}}\n");for(const r of n()(this,Zi))e++,t+=r.size;return r+="[GPUBufferMgr] freeBuffers{size:".concat(n()(this,Zi).length,"}\n"),r+="[GPUBufferMgr] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,Xi).type=n()(this,Yi),n()(this,Xi).count=e,n()(this,Xi).usedBytes=t,n()(this,Xi).output=r,n()(this,Xi)}onOccupancyLevelEvaluated(e){console.log("[GPUBufferManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUBufferManager_onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}};function en(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var tn=new WeakMap,rn=new WeakMap,nn=new WeakMap;var sn=class{constructor(){en(this,tn,{writable:!0,value:h.f.TEXTURE}),en(this,rn,{writable:!0,value:[]}),en(this,nn,{writable:!0,value:[]})}acquire(e){let t=null;const r=n()(this,rn).findIndex(t=>t&&t.width==e.w&&t.height==e.h&&t.format==e.format&&t.usage==e.usage);return r>-1&&(t=n()(this,rn).splice(r,1)[0]),t&&n()(this,nn).push(t),t}recycle(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=n()(this,nn).indexOf(e);-1!=r&&n()(this,nn).splice(r,1),t?e.destroy():(n()(this,rn).push(e),e.label="")}pushToAvailablePool(e){e&&n()(this,rn).push(e)}pushToInUsePool(e){e&&n()(this,nn).push(e)}release(e){if(e==h.n.OVERUSE&&n()(this,rn).length>0){for(const e of n()(this,rn))e.destroy();n()(this,rn).length=0}}cleanup(){for(const e of n()(this,rn))e.destroy();for(const e of n()(this,nn))e.destroy();n()(this,rn).length=0,n()(this,nn).length=0}getAvailablePool(){return n()(this,rn)}getInUsedPool(){return n()(this,nn)}getResourceType(){return n()(this,tn)}};function an(e,t){hn(e,t),t.add(e)}function on(e,t,r){hn(e,t),t.set(e,r)}function hn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function un(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakSet,gn=new WeakSet,mn=new WeakSet,_n=new WeakSet,vn=new WeakSet;function bn(e){let t=n()(this,dn).get(e.level),r=null;return t?(r=t.acquire(e),r||(r=un(this,mn,yn).call(this,e),r?t.pushToInUsePool(r):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e))))):(r=un(this,mn,yn).call(this,e),r?(t=new sn,t.pushToInUsePool(r),n()(this,dn).set(e.level,t)):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e)))),r}function wn(e){const t=e.zOrder;let r=n()(this,fn).get(t);return r?(e.w>r.width||e.h>r.height)&&(r.destroy(),r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)):(r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)),r}function yn(e){if(!n()(this,ln))return null;if(0==e.w||0==e.h)return null;const t={size:{width:e.w,height:e.h},format:e.format,usage:e.usage};return e.sampleCount>0&&(t.sampleCount=e.sampleCount),n()(this,ln).createTexture(t)}function xn(e){let t=h.u[h.u.length-1];for(let r=0;r1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=this.assembleTextureConfig(e.width,e.height,e.usage,e.format,e.sampleCount);let i=n()(this,dn).get(r.level);if(i)i.recycle(e,t);else if(console.warn("recycleTexture(".concat(e.label,") texture is not found in the map!, destroy:").concat(t)),t)e.destroy();else{const t=new sn;t.pushToAvailablePool(e),n()(this,dn).set(r.level,t)}}cleanup(){for(const[e,t]of n()(this,dn))t&&t.cleanup();n()(this,dn).clear()}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,dn))if(s){const n=s.getAvailablePool();for(const r of n)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);const a=s.getInUsedPool();for(const r of a)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);(n.length>0||a.length>0)&&(r+="[GPUTexturePool] level:".concat(i," pool:{ava_count:").concat(n.length," in_used_count:").concat(a.length,"}\n"))}return r+="[GPUTexturePool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,cn).type=h.f.TEXTURE,n()(this,cn).count=e,n()(this,cn).usedBytes=t,n()(this,cn).output=r,n()(this,cn)}onOccupancyLevelEvaluated(e){if(console.log("[GPUTextureManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUTextureManager_onOccupancyLevelEvaluated() level:".concat(e)),e==h.n.OVERUSE)for(const[t,r]of n()(this,dn))r&&r.release(e)}};function En(e,t){An(e,t),t.add(e)}function Sn(e,t,r){An(e,t),t.set(e,r)}function An(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function kn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Mn=new WeakMap,Cn=new WeakMap,Pn=new WeakMap,Un=new WeakMap,Ln=new WeakSet,In=new WeakSet;function On(e,t,r){if(n()(this,Pn).set(e,t),r){let e=Array.from(n()(this,Pn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Pn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Pn).set(t,r)})}}function Dn(e,t){if(!e||0==e.length)return null;let r=0,i=0,n=null;for(const s of e)"mapped"==s.mapState?(r+=1,n||s.size>=t&&(n=s)):i+=1;if(r>0&&0==i||r>=2&&0!=i){if(n){const t=e.indexOf(n);-1!=t&&e.splice(t,1)}return n}return null}var Bn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;En(this,In),En(this,Ln),Sn(this,Mn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Sn(this,Cn,{writable:!0,value:0}),Sn(this,Pn,{writable:!0,value:new Map}),Sn(this,Un,{writable:!0,value:0}),a()(this,Cn,e),a()(this,Un,t)}isUpToThreshold(e,t){if(e!=n()(this,Cn)||t<=0)return!1;if(0==n()(this,Un))return!1;const r=n()(this,Pn).get(t);return!!r&&r.length>=n()(this,Un)}push(e,t,r){if(e!=n()(this,Cn)||!r||t<=0)return!1;let i=null,s=!1;if(n()(this,Pn).has(t)){if(i=n()(this,Pn).get(t),i||(i=[],s=!0),!(i.length1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r=e.level,i=e.bytesPerRow,s=e.size;if(r!=n()(this,Cn)||i<=0)return console.error("[GPUBufferPoolEntry] acquire() level(".concat(r,") or bpr=").concat(i," is invalid!")),null;let a=null,o=!1;if(n()(this,Pn).has(i)){let e=n()(this,Pn).get(i);if(e){const t=e.findIndex(e=>"mapped"==e.mapState&&e.size>=s);t>-1?a=e.splice(t,1)[0]:o=!0}else o=!0}else o=!0;if(o&&!a&&!t){let t=2,o=!1;r>=h.m[h.h]&&(o=!0);for(const[r,h]of n()(this,Pn))if((t>0||o)&&r>i){if(a=kn(this,In,Dn).call(this,h,s),a){e.bytesPerRow=r;break}t--}}return a}recycle(e,t,r){if(e!=n()(this,Cn)||t<=0||!r)return!1;let i=!1;if(n()(this,Pn).has(t)){let e=!1,s=n()(this,Pn).get(t);s||(s=[],e=!0),s.push(r),e&&kn(this,Ln,On).call(this,t,s,e),i=!0}else i=this.push(e,t,r);return i}release(e){if(e==h.n.OVERUSE){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}}cleanup(){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}getPool(){return n()(this,Pn)}hasBytesPerRowAsKey(e){return n()(this,Pn).has(e)}getResourceType(){return n()(this,Mn)}getPoolThreshold(){return n()(this,Un)}canLendBufferCrossLevel(e,t){let r=!0;if(n()(this,Pn).has(t)){const i=n()(this,Pn).get(t);if(i){let t=0,n=0;for(const e of i)"mapped"==e.mapState?t+=1:n+=1;if(e>=h.m[h.h])r=t>0;else{const e=t>=2&&0!=n;r=t>0&&0==n||e}}}else r=!1;return r}};function Gn(e,t){Nn(e,t),t.add(e)}function Wn(e,t,r){Nn(e,t),t.set(e,r)}function Nn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Vn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,qn=new WeakSet,Kn=new WeakSet,Qn=new WeakSet,Zn=new WeakSet,Jn=new WeakSet,$n=new WeakSet,es=new WeakSet;function ts(e){if(!e)return;const t=e.colorFormat;if("rgba"==t){const t=Fn(this,Kn,rs).call(this,e.height);t>0&&t0&&t0&&t-1&&t+1<=h.m.length-1?h.m[t+1]:e}function ns(e){if(!e)return 0;let t=0;const r=e.colorFormat;if("rgba"==r?t=e.height:"i420"!=r&&"nv12"!=r||(t=e.yPlane.height),0==t)return 0;let i=0;return i=t<=h.m[2]?90:t>h.m[2]&&t<=h.m[5]?60:15,i}function ss(e){return e.mapAsync(GPUMapMode.WRITE,0,e.size)}function as(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Yn).set(e,t),r){let e=Array.from(n()(this,Yn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Yn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Yn).set(t,r)})}}function os(e){if(!e)return null;let t=e.level,r=e.bytesPerRow;e.size;const i=Fn(this,Qn,is).call(this,t);if(i<=t)return null;if(!n()(this,Yn).has(i))return null;const s=n()(this,Yn).get(i);if(!s)return null;if(!s.hasBytesPerRowAsKey(r))return null;if(!s.canLendBufferCrossLevel(t,r))return null;const a={};Object.assign(a,e),a.level=i;const o=s.acquire(a,!0);return o&&(e.level=i,e.bytesPerRow=a.bytesPerRow),o}var hs=class{constructor(e){Gn(this,es),Gn(this,$n),Gn(this,Jn),Gn(this,Zn),Gn(this,Qn),Gn(this,Kn),Gn(this,qn),Wn(this,Vn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Wn(this,zn,{writable:!0,value:{}}),Wn(this,Hn,{writable:!0,value:null}),Wn(this,jn,{writable:!0,value:[]}),Wn(this,Yn,{writable:!0,value:new Map}),Wn(this,Xn,{writable:!0,value:0}),a()(this,Hn,e)}acquire(e){if(!e)throw new Error("acquire() bufferConfig is invalid!");Fn(this,qn,ts).call(this,e);let t=null,r=null;if(0==n()(this,Yn).size){if(n()(this,Hn)){const i=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});let s=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),s=!0}i&&(a()(this,Xn,n()(this,Xn)+1),t=i,t.label="".concat(e.label,"-").concat(n()(this,Xn))),Fn(this,$n,as).call(this,e.level,r,s)}}else if(n()(this,Yn).has(e.level)){r=n()(this,Yn).get(e.level);let i=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}if(t=r.acquire(e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else if(t=Fn(this,es,os).call(this,e),!t)if(r.isUpToThreshold(e.level,e.bytesPerRow))console.log("[GPUBufferPool]acquire() next level cant help and pool is up to threshold! Only to wait for a while...");else{const r=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});r&&(a()(this,Xn,n()(this,Xn)+1),t=r,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}else{let i=!1;if(t=Fn(this,es,os).call(this,e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else{const s=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}s&&(a()(this,Xn,n()(this,Xn)+1),t=s,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}return t&&n()(this,jn).push(t),t}recycle(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return;const i=n()(this,jn).indexOf(e);if(-1!=i?n()(this,jn).splice(i,1):(console.error("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r)),Object(o.o)("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r))),t)if(r){"unmapped"!=e.mapState&&e.unmap(),"unmapped"==e.mapState&&Fn(this,Jn,ss).call(this,e).then(()=>{}).catch(t=>{console.warn("mapAsyncBuffer() error:".concat(t)),e.destroy(),e=null});let r=n()(this,Yn).get(t.level);r&&r.recycle(t.level,t.bytesPerRow,e),e.label=""}else e.destroy(),e=null;else e.destroy()}recycleInUsedGPUBuffers(e,t){for(const[r,i]of e)for(const e of i)if(e){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),this.recycle(r.buffer,r.bufferConfig)),e.destroyTextureBufferGroup(t)}}recycleTextureBufferGroup(e,t){if(e&&t){const r=t.acquireGPUBufferPool();if(r){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),r.recycle(i.buffer,i.bufferConfig),e.destroyTextureBufferGroup(t))}}}cleanup(){for(const e of n()(this,jn))"unmapped"!=e.mapState&&e.unmap(),e.destroy();n()(this,jn).length=0;for(const[e,t]of n()(this,Yn))t&&t.cleanup();n()(this,Yn).clear()}release(e){if(e==h.n.OVERUSE){for(const[t,r]of n()(this,Yn))r&&r.release(e);n()(this,Yn).clear()}}getResourceType(){return n()(this,Vn)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Yn))if(s){const n=s.getPool();for(const[a,o]of n){e+=o.length;let n=0,h=0;for(const e of o)t+=e.size,"mapped"==e.mapState?n+=1:h+=1;r+="[GPUBufferPool] level:".concat(i," bpr:").concat(a," threshold:").concat(s.getPoolThreshold()," pool:{len:").concat(o.length," ava_count:").concat(n," pending_count:").concat(h,"}\n")}}let i=0;for(const r of n()(this,jn))e+=1,t+=r.size,i+=1;return r+="[GPUBufferPool] in_used_count:".concat(i,"\n"),r+="[GPUBufferPool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,zn).type=n()(this,Vn),n()(this,zn).count=e,n()(this,zn).usedBytes=t,n()(this,zn).output=r,n()(this,zn)}onOccupancyLevelEvaluated(e){Object(o.o)("WGPU GPUBufferPool_onOccupancyLevelEvaluated() level:".concat(e)),console.log("[GPUBufferPool] onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}getInUsedPoolCount(){return n()(this,jn).length}};function us(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ls=new WeakMap,cs=new WeakMap;var ds=class{constructor(e){us(this,ls,{writable:!0,value:null}),us(this,cs,{writable:!0,value:null}),a()(this,ls,e),e&&a()(this,cs,e.features)}getAdapterFeatures(){return n()(this,cs)}getAdapterLimits(){return n()(this,ls)?n()(this,ls).limits:null}queryMaxTextureDimension2D(){const e=this.getAdapterLimits();return e?e.maxTextureDimension2D:0}queryMaxBufferSize(){const e=this.getAdapterLimits();return e?e.maxBufferSize:0}queryAdapterFeature(e){return!(!n()(this,cs)||!e)&&n()(this,cs).has(e)}isTimestampQuerySupported(){return this.queryAdapterFeature("timestamp-query")}getGPUAdapter(){return n()(this,ls)}cleanup(){a()(this,ls,null),a()(this,cs,null)}};function fs(e,t){gs(e,t),t.add(e)}function ps(e,t,r){gs(e,t),t.set(e,r)}function gs(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ms(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var _s=new WeakMap,vs=new WeakMap,bs=new WeakMap,ws=new WeakMap,ys=new WeakSet,xs=new WeakSet,Ts=new WeakSet;function Rs(){let e=h.n.LOW;const t="---WatchDog(".concat(n()(this,ws),") starts analyzing---\n");console.log("".concat(t));for(const t of n()(this,vs)){const r=t.collectResourceInfo();console.log("".concat(r.output));const i=ms(this,xs,Es).call(this,r);t.onOccupancyLevelEvaluated(i),i>e&&(e=i)}const r=ms(this,Ts,Ss).call(this,e);r!=n()(this,_s)&&(clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,r),this.monitor())}function Es(e){let t=h.n.LOW;return e.type==h.f.TEXTURE?t=e.usedBytes<=31457280?h.n.LOW:e.usedBytes<=94371840?h.n.MEDIUM:e.usedBytes<=157286400?h.n.HIGH:h.n.OVERUSE:e.type==h.f.VERTEX_BUFFER?t=e.usedBytes<=5242880?h.n.LOW:e.usedBytes<=10485760?h.n.MEDIUM:e.usedBytes<=15728640?h.n.HIGH:h.n.OVERUSE:e.type==h.f.TEXTURE_BUFFER&&(t=e.usedBytes<=52428800?h.n.LOW:e.usedBytes<=104857600?h.n.MEDIUM:e.usedBytes<=209715200?h.n.HIGH:h.n.OVERUSE),t}function Ss(e){let t=0;switch(e){case h.n.LOW:t=h.o.LOW;break;case h.n.MEDIUM:t=h.o.MEDIUM;break;case h.n.HIGH:t=h.o.HIGH;break;case h.n.OVERUSE:t=h.o.OVERUSE;break;default:t=h.o.MEDIUM}return t}var As=class{constructor(e){fs(this,Ts),fs(this,xs),fs(this,ys),ps(this,_s,{writable:!0,value:h.o.HIGH}),ps(this,vs,{writable:!0,value:[]}),ps(this,bs,{writable:!0,value:null}),ps(this,ws,{writable:!0,value:""}),a()(this,ws,e)}addObservable(e){n()(this,vs).push(e)}removeObservable(e){const t=n()(this,vs).indexOf(e);-1!=t&&n()(this,vs).splice(t,1)}removeAllObservables(){n()(this,vs).length=0}monitor(){n()(this,bs)||a()(this,bs,setInterval(()=>{ms(this,ys,Rs).call(this)},n()(this,_s)))}cleanup(){this.removeAllObservables(),clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,0)}};function ks(e,t,r){Ms(e,t),t.set(e,r)}function Ms(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}var Cs=new WeakMap,Ps=new WeakMap,Us=new WeakMap,Ls=new WeakMap,Is=new WeakMap,Os=new WeakMap,Ds=new WeakMap,Bs=new WeakMap,Gs=new WeakMap,Ws=new WeakMap,Ns=new WeakMap,Fs=new WeakSet;function Vs(e){return void 0!==e&&"yPlaneTex"in e}var zs=class{constructor(){var e,t;Ms(e=this,t=Fs),t.add(e),ks(this,Cs,{writable:!0,value:null}),ks(this,Ps,{writable:!0,value:null}),ks(this,Us,{writable:!0,value:null}),ks(this,Ls,{writable:!0,value:null}),ks(this,Is,{writable:!0,value:null}),ks(this,Os,{writable:!0,value:null}),ks(this,Ds,{writable:!0,value:null}),ks(this,Bs,{writable:!0,value:null}),ks(this,Gs,{writable:!0,value:null}),ks(this,Ws,{writable:!0,value:null}),ks(this,Ns,{writable:!0,value:""})}addRendererProviderModule(e){a()(this,Ws,e)}setLabel(e){a()(this,Ns,e)}async initialize(){if(navigator.gpu){if(!n()(this,Cs)&&(a()(this,Cs,await navigator.gpu.requestAdapter()),!n()(this,Cs)))return console.error("[WebGPUResManager] initialize() Couldn't request WebGPU adapter."),Object(o.u)("WebGPU device was lost: ".concat(info.message," reason=").concat(info.reason)),void Object(o.p)("WebGPUDeviceLost");n()(this,Us)||(a()(this,Us,await n()(this,Cs).requestDevice()),n()(this,Us).lost.then(async e=>{"destroyed"!=e.reason&&(console.error("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.u)("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.p)("WebGPUDeviceLost")),n()(this,Ws)&&n()(this,Ws).rendererUnconfigureGPUContext(),this.cleanup(),"destroyed"!=e.reason&&(a()(this,Us,null),await this.initialize(),n()(this,Ws)&&n()(this,Ws).rendererReinitialize())})),n()(this,Ps)||("function"==typeof n()(this,Cs).requestAdapterInfo?a()(this,Ps,await n()(this,Cs).requestAdapterInfo()):"info"in n()(this,Cs)&&a()(this,Ps,n()(this,Cs).info)),n()(this,Ls)||a()(this,Ls,navigator.gpu.getPreferredCanvasFormat()),n()(this,Is)||a()(this,Is,new $i(n()(this,Us))),n()(this,Os)||a()(this,Os,new Rn(n()(this,Us))),n()(this,Ds)||a()(this,Ds,new hs(n()(this,Us))),n()(this,Bs)||a()(this,Bs,new ds(n()(this,Cs))),n()(this,Gs)||(a()(this,Gs,new As(n()(this,Ns))),n()(this,Gs).addObservable(n()(this,Is)),n()(this,Gs).addObservable(n()(this,Os)),n()(this,Gs).addObservable(n()(this,Ds)),n()(this,Gs).monitor())}else console.error("[WebGPUResManager] initialize() WebGPU is not supported!")}acquireGPUDevice(){return n()(this,Us)}acquireCanvasFormat(){return n()(this,Ls)}acquireGPUAdapterInfo(){return n()(this,Ps)}destroyGPUDevice(){n()(this,Us)&&(n()(this,Us).destroy(),a()(this,Us,null))}acquireGPUBufferMgr(){return n()(this,Is)}acquireGPUTextureMgr(){return n()(this,Os)}acquireGPUBufferPool(){return n()(this,Ds)}acquireGPUFeaturesHelper(){return n()(this,Bs)}cleanup(){n()(this,Is)&&(n()(this,Is).cleanup(),a()(this,Is,null)),n()(this,Os)&&(n()(this,Os).cleanup(),a()(this,Os,null)),n()(this,Ds)&&(n()(this,Ds).cleanup(),a()(this,Ds,null)),n()(this,Bs)&&(n()(this,Bs).cleanup(),a()(this,Bs,null)),n()(this,Gs)&&(n()(this,Gs).cleanup(),a()(this,Gs,null)),a()(this,Ws,null),this.destroyGPUDevice()}recycleTextureBufferGroup(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&n()(this,Ds)){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),n()(this,Ds).recycle(r.buffer,r.bufferConfig,t),e.destroyTextureBufferGroup(this))}}recycleInUsedGPUBuffers(e){for(const[t,r]of e)for(const e of r)if(e){const t=e.getTextureBufferGroup();t&&t.buffer&&(t.bufferArray&&(t.bufferArray=null),n()(this,Ds).recycle(t.buffer,t.bufferConfig)),e.destroyTextureBufferGroup(this)}}requestTextureBuffer(e){if(!n()(this,Ds))return null;if(Object(xt.f)(this,e.size))return Object(o.u)("requestTextureBuffer() a buffer size that exceeds the max size of GPUBuffer is required.(size:".concat(e.size,")")),null;const t=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC;return e.usage=t,n()(this,Ds).acquire(e)}destroyTextureGroup(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=e.getTextureGroup();if(!r)return;if(!n()(this,Os))return void Object(o.u)("destroyTextureGroup() mGPUTextureMgr is undefined!");const i=e.getTextureType();r&&(i==h.x.GPU_TEX_YUV||i!=h.x.GPU_TEX_RGBA&&function(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,Fs,Vs).call(this,r)?(n()(this,Os).recycleTexture(r.yPlaneTex,t),n()(this,Os).recycleTexture(r.uPlaneTex,t),r.vPlaneTex&&n()(this,Os).recycleTexture(r.vPlaneTex,t)):n()(this,Os).recycleTexture(r,t),e.setTextureGroup(null))}};function Hs(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var js=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,qs=new WeakMap,Ks=new WeakMap;t.a=class{constructor(e){Hs(this,js,{writable:!0,value:""}),Hs(this,Ys,{writable:!0,value:new ze}),Hs(this,Xs,{writable:!0,value:new Hi}),Hs(this,qs,{writable:!0,value:new Qe}),Hs(this,Ks,{writable:!0,value:new zs}),a()(this,js,e),n()(this,Ks).addRendererProviderModule(n()(this,Ys)),n()(this,Ks).setLabel(n()(this,js)),n()(this,Xs).setGPUResourceMgr(n()(this,Ks))}isEnableCanvasAlphaChannel(){return n()(this,Xs).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){n()(this,Xs).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await n()(this,Ys).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=n()(this,Ys).getRendererType(),o=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).getVideoRenderDisplay(a,e,t,r,i,o,s)}createWebGLVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):n()(this,Ys).isWebGLRendererType()?n()(this,Xs).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):null}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=n()(this,Ys).getRendererType(),a=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).createVideoRenderDisplay(s,e,t,r,a,i)}getSharingRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType(),s=n()(this,Ys).acquireRenderer(e,n()(this,Ks),!0);return r||(r={}),r.clearCache=!0,n()(this,Xs).getSharingRenderDisplay(i,e,t,s,r)}recycleRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType();n()(this,Xs).recycleRenderDisplay(i,e,t,n()(this,Ks),r)}renderFor(e){if(n()(this,Ys).isWebGPURendererType()){const t=n()(this,Ys).getRendererType(),r=n()(this,Xs).collectInUseRenderDisplays(t,e);r&&r.forEach(e=>{const t=n()(this,Ys).acquireRenderer(e.canvas,n()(this,Ks));n()(this,qs).render(t,e.renderDisplays)})}}renderWith(e){if(n()(this,Ys).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const r=n()(this,Ys).acquireRenderer(t,n()(this,Ks)),i=[];i.push(e),n()(this,qs).render(r,i)}}}getRenderDisplayMap(e){const t=n()(this,Ys).getRendererType();return n()(this,Xs).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,Ys).isWebGLRendererType()||n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).onRestoredFromContextLost(e,t,r,i,s,a):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&n()(this,Ys).isWebGPURendererType()&&e.close()}getRendererProvider(){return n()(this,Ys)}getRenderDisplayManager(){return n()(this,Xs)}getWebGPUResMgr(){return n()(this,Ks)}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];n()(this,Ys)&&n()(this,Ys).cleanup(),n()(this,Xs)&&n()(this,Xs).cleanup(e,t,n()(this,Ks),r),r||n()(this,Ks)&&n()(this,Ks).cleanup()}clearOffscreenCanvas(e){n()(this,Xs)&&n()(this,Xs).cleanupByCanvas(e)}}},function(e,t,r){var i=r(24).default,n=r(35);e.exports=function(e){var t=n(e,"string");return"symbol"===i(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(24).default;e.exports=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(15),n=r(4),s=r(5),a=r(2),o=r(30),h=r(27),u=r(3);function l(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new h.a,this.sharingQueue=new h.a,this.WaterMarkRGBA=new o.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=n.B,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null}l.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},l.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},l.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},l.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},l.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},l.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},l.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let r=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-r,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},l.prototype.JsMediaSDK_SharingRender=function(){var e,t,r;if(this.sharingDisplay)if(!1!==(null===(e=(t=this.sharingDisplay).isAvaiable)||void 0===e?void 0:e.call(t))){null===(r=this.statisticObj)||void 0===r||r.sample();var n=this.Get_Decoded_Sharing_Frame(this.currentshareactive,this.isFromMainSession),o=this.Get_Decoded_Mouse_Frame(this.currentshareactive,this.isFromMainSession);if(n){let e,t;this.lRTimeStamp=n.ntptime,n.yuvdata instanceof u.m?(e=n.yuvdata.yuvdata,t=n.yuvdata):(e=n.yuvdata,t=null),this.sharingWidthAndHeightInfo.logicWidth==n.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==n.logic_h||(this.PubSub?PubSub.publish(i.g,{body:{width:n.logic_w,height:n.logic_h,logicWidth:n.logic_w,logicHeight:n.logic_h}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=n.logic_w,this.sharingWidthAndHeightInfo.logicHeight=n.logic_h);var h=n.logic_h,l=n.logic_w,c=n.r_h,d=n.r_w;this.xratio=d/l,this.yratio=c/h;var f={top:n.r_x,left:n.r_y,height:n.r_h,width:n.r_w};this.currentSharingHeight==n.r_h&&this.currentSharingWidth==n.r_w&&this.currentSharingLogicHeight==n.logic_h&&this.currentSharingLogicWidth==n.logic_w||(this.Notify_APPUI?this.Notify_APPUI(i.f,{body:{height:n.logic_h,width:n.logic_w,logicHeight:n.logic_h,logicWidth:n.logic_w}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.currentSharingHeight=n.r_h,this.currentSharingWidth=n.r_w,this.currentSharingLogicHeight=n.logic_h,this.currentSharingLogicWidth=n.logic_w);const r=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:n.r_w,a=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:n.r_h;this.Should_Update_Watermark(this.sharingDisplay,r,a)&&this.Update_Display_Watermark(this.sharingDisplay,r,a),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:s.X,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOutputPictureFrame(n.width,n.height,f,e,null,n.yuv_limited),t&&t.recycle(),n.dataptr&&Module._free(n.dataptr)}else if(this.brefresh&&(this.brefresh=!1,0!=this.sharingDisplay.getTextureWidth()&&0!=this.sharingDisplay.getTextureHeight()&&0!==this.currentSharingWidth&&0!==this.currentSharingHeight)){const e=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:this.currentSharingWidth,t=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:this.currentSharingHeight;this.Should_Update_Watermark(this.sharingDisplay,e,t)&&this.Update_Display_Watermark(this.sharingDisplay,e,t),this.sharingDisplay.drawNextOutputPictureFrame(this.sharingDisplay.getTextureWidth(),this.sharingDisplay.getTextureHeight(),this.sharingDisplay.getCroppingParams(),null,this.picRotation,!0,null,!1),n=!0}o&&(this.Cursorx=o.r_x*this.xratio,this.Cursory=o.r_y*this.yratio,this.CursorWidth=o.width*this.xratio,this.CursorHeight=o.height*this.yratio,this.sharingDisplay.updateCursor(o.width,o.height,o.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:s.X,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.drawCursor(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight)),n&&this.renderManager.renderFor(a.t.SHARE)}else{var p,g;null===(p=(g=this.sharingDisplay).restoreContext)||void 0===p||p.call(g)}else Object(u.u)("JsMediaSDK_SharingRender error, display is null")},l.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},l.prototype.updateOffscreenCanvasSize=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!r)return console.log("drop logic w/h");try{let r=this.sharingDisplay.getAttachedCanvas();r&&r instanceof OffscreenCanvas&&(r.width=e,r.height=t,this.brefresh=!0)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},l.prototype.Set_Render_Display=function(e){this.sharingDisplay=e},l.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},l.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:r,sharingWaterMarkName:i,watermarkOpacity:n,watermarkRepeated:s,watermarkPosition:a}=e;r||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=r,this.sharingWaterMarkName=i,void 0!==s&&(this.isWaterMarkRepeatedEnable=!!s),void 0!==n&&(this.waterMarkOpacity=n),void 0!==a&&(this.watermarkPosition=a)},l.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},l.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.setWatermarkFlag(e?1:0)},l.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const c=function(e,t){if(e<640&&e){const r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};l.prototype.Update_Display_Watermark=function(e,t,r){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const i=t<512||r<288?16:this.watermarkPosition,n=this.Should_Watermark_Repeated(t,r),s=c(t,r);t=s.width,r=s.height;const a=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i});e.updateWatermark(t,r,a)},l.prototype.Should_Update_Watermark=function(e,t,r){if(!this.isCreateSharingWaterMark)return!1;let i=!1;const n=c(t,r);n.width===e.getWatermarkWidth()&&n.height===e.getWatermarkHeight()||(i=!0);const s=this.Should_Watermark_Repeated(t,r);e.isSetWatermark()||(i=!0),s!==e.isWatermarkRepeated()&&(i=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(i=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const a=t<512||r<288?16:this.watermarkPosition;return a!==e.getWatermarkPosition()&&(i=!0,e.setWatermarkPosition(a)),i},l.prototype.Update_Sharing_Canvas_Size=function(e){let{width:t,height:r}=e;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(r)}},l.prototype.ClearQueue=function(){try{let e=this.sharingQueue.ssrcQueueMap;for(let[t,r]of e)for(;!r.isEmpty();){let e=r.dequeue();e.yuvdata&&e.yuvdata instanceof u.m&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},l.prototype.Get_Decoded_Sharing_Frame=function(e,t){if(!this.sharingQueue)return null;var r=this.GetLogicalSSRCPart(e,t),i=this.sharingQueue.GetQueue(r);return i?i.dequeue():null},l.prototype.Get_Decoded_Mouse_Frame=function(e,t){if(this.mouseQueue){var r=this.GetLogicalSSRCPart(e,t),i=this.mouseQueue.GetQueue(r);return i?i.dequeue():null}},l.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var r=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||r!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(i.e,this.currentshareactive):postMessage({status:s.F,ssrc:this.currentshareactive}));var n=this.sharingQueue.GetQueue(r);n||(n=this.sharingQueue.AddQueue(r)),n.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var a=this.sharingQueue.GetQueueLength(r),o=a-t;for(this.maxQueueLength=t;o>=0;){let t=this.Get_Decoded_Sharing_Frame(e.ssrc,e.isFromMainSession);t.yuvdata instanceof u.m&&t.yuvdata.recycle(),t.dataptr&&Module._free(t.dataptr),o--}}},l.prototype.Get_Current_QueueLength=function(){if(!this.sharingQueue)return;let e=this.currentshareactive;var t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)},l.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),r=this.mouseQueue.GetQueue(t);r||(r=this.mouseQueue.AddQueue(t)),r.enqueue(e);for(var i=this.mouseQueue.GetQueueLength(t)-10;i>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc,e.isFromMainSession),i--}},l.prototype.GetLogicalSSRCPart=function(e,t){let r=e>>10;return t&&(r|=1<<23),r},l.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},l.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(u.u)(e,t)},l.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):Object(u.t)(e)},l.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},l.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval(()=>{this.No_Bindthis_Interval()},20)):(this.Start_Draw(),this.startRAFHealthCheck())},l.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},l.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval(()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(n.C),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))},2e3)},l.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)},t.a=l},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channel_Agent",(function(){return Dt})),r.d(t,"Open_Sharing_WebSocket_Connect",(function(){return Bt})),r.d(t,"sharing_websocket_on_open",(function(){return Gt})),r.d(t,"sharing_websocket_on_message",(function(){return Wt})),r.d(t,"sharing_websocket_on_close",(function(){return Nt})),r.d(t,"sharing_websocket_on_error",(function(){return Ft})),r.d(t,"JsMediaSDK_Log",(function(){return Vt})),r.d(t,"Recieve_Wb_Packet",(function(){return zt})),r.d(t,"Send_Wb_Rtp_Packet",(function(){return Ht})),r.d(t,"wcl_trace_log",(function(){return jt})),r.d(t,"sharing_qos_monitor",(function(){return Qt})),r.d(t,"responseSharingQosData",(function(){return Zt})),r.d(t,"frame_callback_video_mode",(function(){return $t})),r.d(t,"frame_callback_mouse_video_mode",(function(){return er})),r.d(t,"Send_Data",(function(){return tr})),r.d(t,"decode_callback",(function(){return rr})),r.d(t,"SubScribeUpdateSharing",(function(){return ir})),r.d(t,"IsSupportMultiThread",(function(){return ar})),r.d(t,"hardcodecpunumber",(function(){return or})),r.d(t,"LimitWebCodecsEncoderTo360_js",(function(){return hr})),r.d(t,"LimitWebCodecsDecoderTo360_js",(function(){return ur})),r.d(t,"UserAgentIsTesla_js",(function(){return lr})),r.d(t,"IsSupportMultiThreadForWebcodec",(function(){return cr})),r.d(t,"getGraphicName",(function(){return dr})),r.d(t,"getVendorName",(function(){return fr})),r.d(t,"GetCscThreadNum",(function(){return pr})),r.d(t,"GetEncThreadNum",(function(){return gr})),r.d(t,"Sharing_Decode",(function(){return mr})),r.d(t,"GetLogLevel_js",(function(){return _r})),r.d(t,"Send_Data_Codec",(function(){return vr})),r.d(t,"LOG_OUT",(function(){return br})),r.d(t,"Utf8ArrayToStr",(function(){return wr})),r.d(t,"Write_App_Log",(function(){return yr})),r.d(t,"Pace_Sender",(function(){return Rr})),r.d(t,"Compute_WebSocket_Speed",(function(){return Er})),r.d(t,"Compute_Capture_Delay",(function(){return Sr})),r.d(t,"APP_Troubleshoting_Info",(function(){return Ar})),r.d(t,"Sharing_Capture",(function(){return kr})),r.d(t,"Update_WebSokcet_Speed",(function(){return Mr})),r.d(t,"SAVE_IV",(function(){return Cr})),r.d(t,"getWasmMemory",(function(){return Pr})),r.d(t,"freeWasmMemory",(function(){return Ur})),r.d(t,"MCMMonitor_Sharing_LOG",(function(){return Wr})),r.d(t,"Send_Out_Qos",(function(){return Nr})),r.d(t,"BigLog_js",(function(){return jr})),r.d(t,"Set_Share_Mode_js",(function(){return Yr})),r.d(t,"checkWebCodecWhitelist_js",(function(){return Jr})),r.d(t,"UserWebCodecController_js",(function(){return $r}));var i=r(3),n=r(4),s=r(5),a=r(36),o=r(12),h=r(15),u=r(29),l=r(14),c=r(31),d=r(18),f=r(33),p=r(19),g=r(8),m=r(11),_=r(26),v=r(13),b=r(23),w=r(6),y=r(25);const x=r(46);var T,R,E,S,A,k,M,C,P,U,L,I,O,D,B,G,W,N,F,V;self.wasmSuccessEvent=s.Z,self.wasmFailEvent=s.Y,self.downloadAndInstantiateWebAssembly=i.q,self.onunhandledrejection=e=>{Object(i.u)("Unhandled rejection in worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)};var z,H,j,Y,X,q,K,Q,Z,J=new Map,$=!1,ee=!1,te=0,re=0,ie=0,ne=!1;const se=new f.a("sharing");var ae,oe,he,ue=null,le=new _.a(s.W,!0);self.onWasmModuleReady=()=>{T=Module.cwrap("_Sharing_Encode","number",["number","number","number","number","number","number"]),k=Module.cwrap("_Sharing_Encode_Mouse_Data","number",["number","number","number"]),R=Module.cwrap("_Sharing_Encode_Uninit","number",["number"]),E=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","array","number"]),S=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","number","number"]),A=Module.cwrap("_Sharing_Encode_Init","number",["number","string","string","number","number","number","boolean","boolean","boolean"]),M=Module.cwrap("_Sharing_Set_Data_Encryption","number",["number","number"]),F=Module.cwrap("_Request_Sharing_Qos_Data","number",["number","boolean","boolean"]),C=Module.cwrap("_Sharing_Pause_Encode","number",["number"]),Module.cwrap("_Sharing_Stop_Encode","number",["number"]),P=Module.cwrap("_Sharing_Resume_Encode","number",["number"]),U=Module.cwrap("_Sharing_Websocket_Speed","number",["number","number"]),L=Module.cwrap("_Add_Sharing_Cooker_info","number",["number","number","number","number"]),O=Module.cwrap("_Get_Sharing_Meat_Weight","number",["number"]),I=Module.cwrap("_Remove_Sharing_Cooker_Info","number",["number","number"]),D=Module.cwrap("_Set_Sharing_Encryption_Key_Directly","number",["number","number","number","number"]),B=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),G=Module.cwrap("_Add_Rev_Channel","number",["number","number","number","number"]),W=Module.cwrap("_Remove_Rev_Channel","number",["number","number"]),N=Module.cwrap("_update_sharing_uplink_bandwidth_limitation_by_server","number",["number","number"]),V=Module.cwrap("_set_annotation_action","number",["number","number","number","number"]),H=Module.cwrap("_collect_sharing_monitor_info","number",["number","boolean","boolean"]),j=Module.cwrap("_Change_Connect_Type_For_Sharing","number",["number","number"]),Y=Module.cwrap("_request_nack_t_periodically_for_sharing_qos","number",["number"]),ae=Module.cwrap("_Jpeg_Init","number",[]),Module.cwrap("_Jpeg_Uninit","number",["number"]),oe=Module.cwrap("_Jpeg_HeardInfo","number",["number","number","number"]),he=Module.cwrap("_Jpeg_Decode","number",["number","number","number","number","number","number"]),Module._malloc=function(){let e=Module.asm.malloc.apply(null,arguments);if(!e&&!ne){ne=!0,Object(i.o)("MEMERR:SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));let e=new Error("memry malloc error SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));Object(i.u)("memry malloc error",e)}return e},"undefined"!=typeof _malloc&&(_malloc=Module._malloc)};var ce,de,fe,pe,ge,me,_e,ve,be,we,ye,xe,Te,Re,Ee,Se,Ae,ke=0,Me=null,Ce=0,Pe=0,Ue=0,Le=null,Ie=null,Oe=null,De=null,Be=!1,Ge=!1,We=!1,Ne=null,Fe=!1,Ve=0,ze=0,He=0,je=0,Ye=new m.a,Xe=new m.a,qe=!1,Ke=0,Qe=0,Ze=0,Je=null,$e=null,et=!1,tt=!1,rt=null,it=null,nt=null,st=null,at=null,ot=!0,ht=!1,ut=new m.a,lt=n.L,ct=!1,dt=!1,ft=1,pt=!1,gt=0,mt=0,_t=!1,vt=n.d.DESKTOP_SOURCE,bt=0,wt=null,yt=null,xt=0,Tt=null,Rt=0,Et=null,St=0,At=0,kt=!1,Mt=[],Ct=[],Pt=[];function Ut(e,t){postMessage({status:s.H,data:"".concat(e,":").concat(t)})}function Lt(e,t){Object(i.o)("".concat(e,":").concat(t,":F"))}var It=new l.b({tag:"WCL_M,ASRENDER_ERR",interval:1e4,reportcallback:function(e,t,r,i){Ut(e,"".concat(t,",").concat(r,",").concat(i))}}),Ot=new c.a({tag:"WCL,AS",report_call:Ut});function Dt(){function e(e){let t=null,r=n.db,s=null,a=e.onmessage,o=e.onopen,h=e.onclose;e.onmessage=r=>{t=(new Date).getTime(),a.call(e,r)},e.onopen=i=>{t=(new Date).getTime(),function(){if(s)return;s=setInterval(()=>{var i;(new Date).getTime()-t>=1e3*r&&(clearInterval(s),s=null,null===(i=e.socket)||void 0===i||i.close())},1e3)}(),o.call(e,i,e)},e.onclose=t=>{try{clearInterval(s)}catch(e){Object(i.u)("WebSocket closed",e)}h.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,r,i,n,s){this.websocketaddress=t,this.onopen=r,this.onmessage=i,this.onerror=n,this.onclose=s,e(this)},this.connect=function(e,t,r,n,a){var o=this;Object(i.o)("SB"),o.init(e,t,r,n,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex+=1,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(i.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(i.o)("SCLOSE"),o.socket.close()},o.socket.onclose=function(e){Object(i.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:s.ab}),Object(i.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){ht||1!=Le.socket.readyState?(ke+=e.length,Xe.enqueue(e),Rr()):Le.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function Bt(e,t,r,n,s){Object(i.o)("WSURL:false:".concat(e));var a=new Dt;return a.connect(e,t,r,n,s),a}function Gt(){postMessage({status:s.bb})}Ot.threshold=300;function Wt(t){let r=new Uint8Array(t.data);if(!(r.length<4))if(37!==r[0]){if(102!=r[0]){if(r[0]==n.t.SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME){if(!$||!Ie||vt!=n.d.UAC_SOURCE)return;let t,i=0;if(t=x.inflate(e.from(r.subarray(4,r.length)),{windowBits:31}),i=t.length,i>xt&&(yt&&Module._free(yt),xt=3*i/2,yt=Module._malloc(xt)),!yt)return xt=0,void console.error("Couldn't allocate memory");writeArrayToMemory(t,yt);let s=oe(wt,yt,i);if(!s)return;let a=65535&s,o=s>>16&65535,h=a*o*4;if(h>Rt&&(Tt&&Module._free(Tt),Rt=h,Tt=Module._malloc(h)),!Tt)return Rt=0,void console.error("Couldn't allocate memory");if(bt++,s=he(wt,yt,i,o,a,Tt),0!=s)return;return ni(o,a),1!=xe&&(xe=1),void T(Ie,Tt,h,o,a,xe)}if(r[0]!=n.t.SHARE_REMOTE_CONTROL_UAC_MOUSE)if(111!=r[0])if(109!=r[0]){if(0==r[0])Le&&Le.send(r);else if(Ie)if(Ge){if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);Ye.enqueue(e);let r=Ye.dequeue();for(;r;)E(Ie,r,r.length),r=Ye.dequeue()}}else mr(t.data);else if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);0!=e[0]&&Ye.enqueue(e)}}else Oe&&E(Oe,r,r.length);else 1==r[4]?(Object(i.o)("UAC_START"),bt=0,wt||(wt=ae()),vt=n.d.UAC_SOURCE):(Object(i.o)("UAC_STOP"),Object(i.o)("UAC_ASCAPTURE:".concat(bt)),vt=n.d.DESKTOP_SOURCE,We=!0,Tt&&Module._free(Tt),Tt=null,Rt=0,yt&&Module._free(yt),yt=null,xt=0,Et&&Module._free(Et),Et=null,St=0);else if(Ie&&$&&vt==n.d.UAC_SOURCE){if(r.length>St&&(Et&&Module._free(Et),St=3*r.length/2,Et=Module._malloc(St)),!Et)return void(St=0);writeArrayToMemory(r,Et),k(Ie,Et,r.length)}}}else postMessage({status:s.Q,data:r})}function Nt(e){Vt("sharing_websocket_on_close")}function Ft(e){Vt("sharing_websocket_on_error")}function Vt(e){console.log(e)}function zt(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.Cb,data:r},[r.buffer])}function Ht(e,t,r){var n=new Uint8Array(r+8),s=Object(i.d)().subarray(t+0,t+r);n.set(s,8),n[0]=109;var a=new Uint32Array(1);a[0]=e;var o=new Uint8Array(a.buffer);n.set(o,4),Object(i.y)(Le,n),le.setRtpPackets()}function jt(e,t){zr&&zr.writeWasmLog(e,t)}var Yt,Xt,qt={sharingqosIntervalId:0,sharingmonitorPanelFlag:!1,panelpollingInterval:0},Kt=!0;function Qt(){const e=()=>{if(ht&&!Kt&&Ie)F(Ie,!0);else if(!ht&&(!et||tt)){let e=kt?d.e():Ie;e&&F(e,!1)}};qt.sharingqosIntervalId&&clearInterval(qt.sharingqosIntervalId),qt.sharingmonitorPanelFlag&&(qt.sharingqosIntervalId=setInterval(e,qt.panelpollingInterval||n.y))}function Zt(e,t,r,i,n,s,a,o,u){if(qt.sharingmonitorPanelFlag){const l={width:e,height:t,fps:r,rtt:i,jitter:n,avg_loss:s,max_loss:a,bandwidth:o,rate:u};postMessage({status:h.i,data:l})}}var Jt=new Map;function $t(e,t,r,n,a,o,h,u,l,c,d,f,p,g){let m=!(g==Ie);kt=m,Jt.get(n)||(Jt.set(n,!0),postMessage({status:s.U,ssrc:n}));var _=Object(i.d)().subarray(e+0,e+t),v=Object(i.g)().subarray(r,r+8),b=0;for(let e=0;e<8;e++)b+=v[e]*Math.pow(256,e);var w=n,y=a,x=o;if(et){if(!tt)return;if(t>Yt)return void It.timeoutReport(0,performance.now());let e=new i.m(Xt);if(e.storeSync(_)){var T={yuvdata:e,ntptime:b,ssrc:w,width:y,height:x,r_x:h,r_y:u,r_w:l,r_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m};at&&at.Put_Sharing_Data_From_Queue(T,5)}}else{let e=new Uint8Array(_);postMessage({status:s.S,data:e,sharing_timestamp:b,sharing_ssrc:w,sharing_width:y,sharing_height:x,rendering_x:h,rendering_y:u,rendering_w:l,rendering_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m},[e.buffer])}}function er(e,t,r,n,a,o,h,u,l,c,d,f){var p=new Uint8Array(t),g=Object(i.d)().subarray(e+0,e+t);p.set(g,0,t);var m=n,_=a,v=o;let b=!(f==Ie);if(et){var w={type:"mouse_data",buffer:p,ntptime:r,ssrc:m,width:_,height:v,r_x:h,r_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b};at&&at.Put_Mouse_Data_Into_Queue(w)}else postMessage({status:s.I,data:p,mouse_timestamp:r,mouse_ssrc:m,mouse_width:_,mouse_height:v,mouse_x:h,mouse_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b},[p.buffer])}function tr(e,t,r){if(!(t<4)){var n,s=new Uint8Array(t),a=Object(i.d)().subarray(e+0,e+t);if(s.set(a,0,t),133!=s[0]&&77!=s[0]||le.setRtpPackets(),r==Ie)Object(i.y)(Le,s);else Object(i.y)(null===(n=d.h)||void 0===n?void 0:n.socket,s)}}function rr(e,t,r){let i=!(r==Ie);postMessage({status:s.T,ssrc:e,size:t,isFromMainSession:i})}function ir(e){le.setSubForMe(e)}function nr(e,t,r,i){if(ht||++te%24e4==0&&postMessage({status:s.H,data:"WCL_M,RTCPSN"+te}),t&&r){if(dt&&(77==e[0]||79==e[0])&&!ct){lt=n.K;for(var a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(n);break;case 12:case 13:s=e[r++],t+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[r++],a=e[r++],t+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&a)<<0)}return t}function yr(){Le.socket.bufferedAmount,Xe.getLength(),Sr()}var xr=0,Tr=150;function Rr(){if(0!==xr?(Tr=performance.now()-xr)>=150&&(xr=performance.now()):xr=performance.now(),Le.socket.bufferedAmount>2e4)return;if(Tr>=150&&We&&(Xe.getLength(),ke-2e4<0))We=!We,Te&&Ee?(Ne&&(Ne=null),Ee.read().then((function(e){let{done:t,value:r}=e;if(t)return void console.log("Stream is done!!!");let i={data:r};1e3==mt&&(postMessage({status:s.R}),mt=0),mt++,Br(i)}))):Ne?(kr(Ne),Ne=null):postMessage({status:s.ob});else{let e=performance.now();if(re&&ie&&He&&e-re>3e3){if(re=e,vt!=n.d.DESKTOP_SOURCE)return;T(Ie,He,ie,Ve,ze,xe)}}if(Xe.getLength()>20&&!qe){qe=!0,Ke=0;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=28,Qe=(new Date).getTime(),e[1]=0,Le.socket.send(t)}if(qe&&20==Ke){qe=!1;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=29,e[1]=(new Date).getTime()-Qe,Le.socket.send(t)}let e=Xe.dequeue();for(;e;){if(Ke++,Le.socket.send(e),Er(e),ke-=e.length,Le.socket.bufferedAmount>2e4)return void yr();e=Xe.dequeue()}yr()}function Er(e){var t;if(Me){var r=(new Date).getTime()/1e3;if((t=r-Me)>10){var i=Ce-Le.socket.bufferedAmount;0==Le.socket.bufferedAmount?(Ue=Ue?.8*Ue+16e4:8e5,Ie&&U(Ie,Ue)):(Pe=8*i/(1*t),Ue=Ue?.8*Ue+.2*Pe:8e5,Ie&&U(Ie,Ue)),Ce-=i,Me=r}}else Ce=0,Me=(new Date).getTime()/1e3,Ie&&U(Ie,8e5);Ce+=e.length}function Sr(){var e=ke+Ce-1e4;return 0==je||e<=0?0:je>0?e/je:void 0}function Ar(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.b,data:wr(r)})}function kr(e){!Be&&e?postMessage({status:s.ob,data:e.data},[e.data.buffer]):postMessage({status:s.ob})}function Mr(e){je=je?(je+e)/2:e}function Cr(e,t){ve||(ve=setInterval((function(){Ie&&O(Ie)}),6e4));let r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),be=r,postMessage({status:s.a,data:r})}function Pr(e){if(!e)return 0;let t=Module._malloc(e.length);return Object(i.g)().subarray(t,t+e.length).set(e,0,e.length),t}function Ur(e){e&&Module._free(e)}function Lr(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.v)(n)}function Ir(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.w)(n)}function Or(e){try{Je.canvas.width===e.width&&Je.canvas.height===e.height||(Je.canvas.width=e.width,Je.canvas.height=e.height)}catch(e){Object(i.u)("Error when updating OffScreenCanvas size",e)}}function Dr(e){let t={rect:{x:0,y:0,width:0,height:0}};return e.visibleRect.left%2!=0?t.rect.x=e.visibleRect.left-1:t.rect.x=e.visibleRect.left,e.visibleRect.top%2!=0?t.rect.y=e.visibleRect.top-1:t.rect.y=e.visibleRect.top,e.visibleRect.width%2!=0?t.rect.width=e.visibleRect.width-1:t.rect.width=e.visibleRect.width,e.visibleRect.height%2!=0?t.rect.height=e.visibleRect.height-1:t.rect.height=e.visibleRect.height,t}async function Br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.d.DESKTOP_SOURCE;if(t>> Set_Share_Mode_js")}self.addEventListener("message",(function(e){var t,r=e.data;switch(r.command){case g.p:Object(i.o)("STARTMEDIA:".concat(function(e){let t=e.confId,r=e.isPreviewMode?1:0;return r|=Qr()?2:0,"".concat(t,":").concat(r)}(r)));try{if(z||(z=setInterval(()=>{let e=kt?d.e():Ie;$&&e&&H(e,!!ht)},1e3)),r.isPreviewMode)break;Qr()||(Kr=!1,Object(i.o)("RSTHOLD")),function(e){Hr=e._id,Q=e.graphicalname,Z=e.vendorname,ce=e.meetingnumb+"",de=e.meetingid,ft=e.multiThreadNum,At=e.uplimit?e.uplimit:0,ht=!!e.encode,me=e.confId,Ge=ht,Be=!!e.isChromeOrEdge,dt=ft>1,se.setCanvasAlphaChannelEnability(e.isEnableCanvasAlphaChannel),p.a.setIsEnableCanvasCtxOptionsOpt(e.isEnableCanvasCtxOptionsOpt)}(r),Xr||(zr&&zr.init({workerType:ht?o.b.SHARING_ENCODE:o.b.SHARING_DECODE}),Xr=!0),function(e){se.getRendererProvider().setRendererType(e.rendererType),se.getRendererProvider().isWebGPURendererType()&&se.getWebGPUResMgr().initialize()}(r),function(e){if(ei||ht||((ei=Object(b.d)(w.e.SHARR_DECODE)).onmessage=Fr,ei.onopen=()=>{X=!0,Vr()},ei.onclose=()=>{X=!1,Vr()},(ti.sender||ti.reciver)&&Object(v.b)(ei,ti.sender,ti.reciver)),!e.websocket_ip_address)return;let t=e.websocket_ip_address+"&mode=1";ht&&(t=e.websocket_ip_address.slice(0,e.websocket_ip_address.length-42)+"s"+e.websocket_ip_address.slice(e.websocket_ip_address.length-41,e.websocket_ip_address.length)+"&mode=2"),Object(i.j)(Le,t)&&(Le=Bt(t,Gt,Wt,Ft,Nt))}(r),ht||(Xt||(Yt=15728640,Xt=new i.k(5,Yt)),qr()),postMessage({status:Ie||ht?s.db:s.cb})}catch(e){postMessage({status:s.cb}),Object(i.u)("sharing startr media error",e)}break;case g.b:z&&(clearInterval(z),z=null),Ie&&R(Ie),Ie=null,De&&R(De),De=null,function(){try{let e=ei;ei=null,X=!1,ti={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}(),close();break;case"ENCRYPT":Fe=r.encrypt,Ie&&M(Ie,Fe?1:0);break;case g.l:qt.panelpollingInterval=r.data.pollingInterval,qt.sharingmonitorPanelFlag=r.data.enable,Qt();break;case"startSharingEncode":$=!0,r.isSupportVideoTrackReader?(xe=2,!0):(xe=1,!1),Te=!!r.isSupportMediaStreamTrackProcessor,dt&<==n.L?function(e){if(dt&&!ct){lt=n.K;for(var t=0;t{let t=parseInt(e.userid);if(e.bremove)return void(Ie&&I(Ie,t));let r=e.sn;if(16!=r.length&&32!=r.length)return;let i=Pr(r);if(Ie){let e=!1;ht&&me!=t||(e=!0),e&&L(Ie,t,i,r.length)}Ur(i),ht&&me==t&&r});break}case"SET_OFFSCREENCANVAS_WIDTH_HEIGHT":{let{width:e,height:t}=r.data;at&&(at.setOnlyAcceptUISize(!0),at.updateOffscreenCanvasSize(e,t,!0));break}case"BUILD_MS_CHANNEL_IN_BO":d.c(Bt,r.data,nr,E);break;case"SHARING_REMOVE_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASD:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.f(ii,e):Ie&&ii(Ie,e.ssrc)}break;case"SHARING_ADD_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASC:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.e()?d.a(ri,e):Mt.push(e):Ie?ri(Ie,e.ssrc,e.streamIndex,e.videoMode):Ct.push(e)}break;case g.r:{let e=r.data;if(e.isFromMainSession)De=d.d(A,D,e.updateParams,Pr,Ur),Mt.length>0&&(Object(i.u)("retry add recv channel for master share"),Mt.forEach(e=>{d.a(ri,e)}),Mt=[]),j(De,X?0:2);else if(Se=e,Ge)Ie&&Gr(Ie,Se.updateParams.userId,Se.updateParams.sn,Se.updateParams.encryptKey,Se.updateParams.encryptType);else if(Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t)}}break;case g.s:{let e=r.data;if(e.isFromMainSession)d.b(B,e);else if(Ie&&e.body){if(e.body.add){let t=0,r=e.body.add;for(;t{Y(Ie)},50)),ee||(ee=!0,"function"==typeof SharedArrayBuffer&&wasmMemory.buffer instanceof SharedArrayBuffer&&function(){const e=8+1500*(n.bb+1);q||(null!=(q=Module._malloc(e))?(Atomics.store(Object(i.f)().subarray(q/4,q/4+e),0,0),Atomics.store(Object(i.f)().subarray(q/4,q/4+e),1,0),ti.reciver={sab:wasmMemory,offset:q,length:e,interval:10,useCopy:!1,useOneElement:!1},Object(v.b)(ei,null,ti.reciver)):console.log("malloc failed"))}());break;case"WHITEBOARD_JOIN_MESSAGE":if(Oe||Gr(Oe=A(r.nodeId,"1","1",0,0,0,!1,!0,!1),r.nodeId,r.sn,r.encryptKey,2),!J.get(r.dcsId)){J.set(r.dcsId,!0);let e=Pr(r.EncodedSn);B(Oe,r.dcsId,e,r.EncodedSn.length),Ur(e),M(Oe,1)}if(Oe){V(Oe,0,r.dcsId,0);let e=Pr(r.data);V(Oe,1,e,r.data.length),Ur(e)}break;case"audioTimestamp":at&&at.SetcATimeStamp(r.data);break;case"vsport":Ae&&(Ae.close(),Ae=null),(Ae=e.ports[0]).onmessage=function(e){at&&at.SetcATimeStamp(e.data)};break;case g.e:{let e=r.data||{},n=!!e.hold;Object(i.o)("HOLD:".concat(n,":").concat(e.userid,":").concat(e.reinit)),n?function(e){if(Kr)return;if(me&&e.userid&&e.userid>>10!=me>>10)return void Object(i.o)("HOLDINVALID");Kr=!0,ht&&Zr();let t=Ie;Ie=null,t&&R(t),Oe&&(R(Oe),Oe=null),J.clear()}(e):(t=e,Kr&&(Kr=!1,t.reinit&&(me=t.userid,Ie||0==Hr||(qr(),postMessage({status:Ie||ht?s.db:s.cb})))))}break;case"SEND_ANNOTATION_PDU":var m;r.data instanceof Uint8Array&&(r.isPresenter||null===(m=Le)||void 0===m||m.send(r.data));break;case g.g:!function(e){let t=e.content_type,r=e.cmd,n=e.type;"PDU"==t&&(r=Object(i.a)(r),4==n&&Wt({data:r.buffer}))}(r.data)}}));var Xr=!1;function qr(){if(!Qr())return;if(_e==me&&Ie)return;Ie&&(R(Ie),Ie=null),Ie=A(me,ce,de,0,0,At,!1,!1,!0);let e=Se;if(e&&Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t),_e=me}Ct.length>0&&(Object(i.u)("retry add recv channel for share decode"),Ct.forEach(e=>{ri(Ie,e.ssrc,e.streamIndex,e.videoMode)}),Ct=[])}var Kr=!1;function Qr(){return!Kr}function Zr(){Ot.stop(),ve&&(clearInterval(ve),ve=null),Ie&&(Xe=new m.a),Ze&&(clearInterval(Ze),Ze=0),We=!1,ke=0,ot=!0,xr=0,ie=0,re=0,pt=!0,Kt=!1,$=!1,vt=n.d.DESKTOP_SOURCE,lt!=n.L&&setTimeout((function(){pt&&(PThread.terminateAllThreads(),ct=!1,lt=n.L,gt=0,console.log("terminate multiple threads"))}),6e5),le.stopCheck()}function Jr(){return-1}function $r(){return!1}var ei=null,ti={};function ri(e,t,r,n){-1!=Pt.findIndex(r=>r.handle==e&&r.ssrc==t)&&(ii(e,t),Object(i.u)("Duplicate add sharing recv ".concat(t))),G(e,t,r,n),Object(i.o)("ASCHANNEL:".concat(t,":").concat(r)),Pt.push({ssrc:t,index:r,videoMode:n,handle:e})}function ii(e,t){let r=Pt.findIndex(r=>r.handle==e&&r.ssrc==t);-1!=r&&Pt.splice(r,1),W(e,t),Object(i.o)("RMASCHANNEL:".concat(t))}function ni(e,t){return(Ve!=e||ze!=t)&&(postMessage({status:s.w,width:e,height:t}),Ve=e,ze=t,!0)}Object(b.b)(),Object(y.a)(self)}.call(this,r(41).Buffer)},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=r(43),n=r(44),s=r(45);function a(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(h.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(i)return N(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=h.from(t,i)),h.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,a=1,o=e.length,h=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,h/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var l=-1;for(s=r;so&&(r=o-h),s=r;s>=0;s--){for(var c=!0,d=0;dn&&(i=n):i=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function E(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[n+1]))&&(h=(31&u)<<6|63&s)>127&&(l=h);break;case 3:s=e[n+1],a=e[n+2],128==(192&s)&&128==(192&a)&&(h=(15&u)<<12|(63&s)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=e[n+1],a=e[n+2],o=e[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,i,n){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(i,n),l=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,i,n,s){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function L(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function I(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function O(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,i,s){return s||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,s){return s||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}h.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},h.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*t)),i},h.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},h.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+n]=e/s&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},h.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(42))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){for(var t,r=u(e),i=r[0],a=r[1],o=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,a)),h=0,l=a>0?i-4:i,c=0;c>16&255,o[h++]=t>>8&255,o[h++]=255&t;2===a&&(t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4,o[h++]=255&t);1===a&&(t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2,o[h++]=t>>8&255,o[h++]=255&t);return o},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(t=e[r-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,s,a=[],o=t;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,i,n){var s,a,o=8*n-i-1,h=(1<>1,l=-7,c=r?n-1:0,d=r?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-l)-1,f>>=-l,l+=o;l>0;s=256*s+e[t+c],c+=d,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=i;l>0;a=256*a+e[t+c],c+=d,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=u}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))<1&&(a--,h*=2),(t+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(t*h-1)*Math.pow(2,n),a+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Deflate",(function(){return $t})),r.d(t,"Inflate",(function(){return ir})),r.d(t,"constants",(function(){return or})),r.d(t,"default",(function(){return hr})),r.d(t,"deflate",(function(){return er})),r.d(t,"deflateRaw",(function(){return tr})),r.d(t,"gzip",(function(){return rr})),r.d(t,"inflate",(function(){return nr})),r.d(t,"inflateRaw",(function(){return sr})),r.d(t,"ungzip",(function(){return ar}));function i(e){let t=e.length;for(;--t>=0;)e[t]=0}const n=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new Array(576);i(h);const u=new Array(60);i(u);const l=new Array(512);i(l);const c=new Array(256);i(c);const d=new Array(29);i(d);const f=new Array(30);function p(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let g,m,_;function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}i(f);const b=e=>e<256?l[e]:l[256+(e>>>7)],w=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},y=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<{y(e,r[2*t],r[2*t+1])},T=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},R=(e,t,r)=>{const i=new Array(16);let n,s,a=0;for(n=1;n<=15;n++)a=a+r[n-1]<<1,i[n]=a;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=T(i[t]++,t))}},E=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},S=e=>{e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},A=(e,t,r,i)=>{const n=2*t,s=2*r;return e[n]{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n{let i,a,o,h,u=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+u++],i+=(255&e.pending_buf[e.sym_buf+u++])<<8,a=e.pending_buf[e.sym_buf+u++],0===i?x(e,a,t):(o=c[a],x(e,o+256+1,t),h=n[o],0!==h&&(a-=d[o],y(e,a,h)),i--,o=b(i),x(e,o,r),h=s[o],0!==h&&(i-=f[o],y(e,i,h)))}while(u{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)k(e,r,a);h=s;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],k(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,r[2*h]=r[2*a]+r[2*o],e.depth[h]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,r[2*a+1]=r[2*o+1]=h,e.heap[1]=h++,k(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let u,l,c,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=r[2*r[2*l+1]+1]+1,d>h&&(d=h,g++),r[2*l+1]=d,l>i||(e.bl_count[d]++,f=0,l>=o&&(f=a[l-o]),p=r[2*l],e.opt_len+=p*(d+f),s&&(e.static_len+=p*(n[2*l+1]+f)));if(0!==g){do{for(d=h-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[h]--,g-=2}while(g>0);for(d=h;0!==d;d--)for(l=e.bl_count[d];0!==l;)c=e.heap[--u],c>i||(r[2*c+1]!==d&&(e.opt_len+=(d-r[2*c+1])*r[2*c],r[2*c+1]=d),l--)}})(e,t),R(r,u,e.bl_count)},P=(e,t,r)=>{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++o{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++o{y(e,0+(i?1:0),3),S(e),w(e,r),w(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var O={_tr_init:e=>{L||((()=>{let e,t,r,i,o;const v=new Array(16);for(r=0,i=0;i<28;i++)for(d[i]=r,e=0;e<1<>=7;i<30;i++)for(f[i]=o<<7,e=0;e<1<{let n,s,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),C(e,e.l_desc),C(e,e.d_desc),a=(e=>{let t;for(P(e,e.dyn_ltree,e.l_desc.max_code),P(e,e.dyn_dtree,e.d_desc.max_code),C(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==t?I(e,t,r,i):4===e.strategy||s===n?(y(e,2+(i?1:0),3),M(e,h,u)):(y(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(y(e,t-257,5),y(e,r-1,5),y(e,i-4,4),n=0;n(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(c[r]+256+1)]++,e.dyn_dtree[2*b(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{y(e,2,3),x(e,256,h),(e=>{16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var D=(e,t,r,i)=>{let n=65535&e|0,s=e>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,s=s+n|0}while(--a);n%=65521,s%=65521}return n|s<<16|0};const B=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var G=(e,t,r,i)=>{const n=B,s=i+r;e^=-1;for(let r=i;r>>8^n[255&(e^t[r])];return-1^e},W={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},N={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:V,_tr_flush_block:z,_tr_tally:H,_tr_align:j}=O,{Z_NO_FLUSH:Y,Z_PARTIAL_FLUSH:X,Z_FULL_FLUSH:q,Z_FINISH:K,Z_BLOCK:Q,Z_OK:Z,Z_STREAM_END:J,Z_STREAM_ERROR:$,Z_DATA_ERROR:ee,Z_BUF_ERROR:te,Z_DEFAULT_COMPRESSION:re,Z_FILTERED:ie,Z_HUFFMAN_ONLY:ne,Z_RLE:se,Z_FIXED:ae,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:he,Z_DEFLATED:ue}=N,le=(e,t)=>(e.msg=W[t],t),ce=e=>2*e-(e>4?9:0),de=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fe=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let pe=(e,t,r)=>(t<{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},me=(e,t)=>{z(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ge(e.strm)},_e=(e,t)=>{e.pending_buf[e.pending++]=t},ve=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},be=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=D(e.adler,t,n,r):2===e.state.wrap&&(e.adler=G(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},we=(e,t)=>{let r,i,n=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const h=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,l=e.w_mask,c=e.prev,d=e.strstart+258;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(r=t,u[r+a]===p&&u[r+a-1]===f&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sa){if(e.match_start=t,a=i,i>=o)break;f=u[s+a-1],p=u[s+a]}}}while((t=c[t&l])>h&&0!=--n);return a<=e.lookahead?a:e.lookahead},ye=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-262)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fe(e),i+=t),0===e.strm.avail_in)break;if(r=be(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=pe(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=pe(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},xe=(e,t)=>{let r,i,n,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,ge(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(be(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_watern&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(be(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,s=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=s||(i||t===K)&&t!==Y&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===K&&0===e.strm.avail_in&&r===i?1:0,V(e,e.block_start,r,a),e.block_start+=r,ge(e.strm)),a?3:1)},Te=(e,t)=>{let r,i;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=we(e,r)),e.match_length>=3)if(i=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=pe(e,e.ins_h,e.window[e.strstart+1]);else i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2},Re=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(me(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=H(e,0,e.window[e.strstart-1]),i&&me(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const Se=[new Ee(0,0,0,0,xe),new Ee(4,4,8,4,Te),new Ee(4,5,16,8,Te),new Ee(4,6,32,32,Te),new Ee(4,4,16,16,Re),new Ee(8,16,32,32,Re),new Ee(8,16,128,128,Re),new Ee(8,32,128,256,Re),new Ee(32,128,258,1024,Re),new Ee(32,258,258,4096,Re)];function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ue,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),de(this.dyn_ltree),de(this.dyn_dtree),de(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),de(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),de(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ke=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||42!==t.status&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&113!==t.status&&666!==t.status?1:0},Me=e=>{if(ke(e))return le(e,$);e.total_in=e.total_out=0,e.data_type=he;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=-2,F(t),Z},Ce=e=>{const t=Me(e);var r;return t===Z&&((r=e.state).window_size=2*r.w_size,de(r.head),r.max_lazy_match=Se[r.level].max_lazy,r.good_match=Se[r.level].good_length,r.nice_match=Se[r.level].nice_length,r.max_chain_length=Se[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Pe=(e,t,r,i,n,s)=>{if(!e)return $;let a=1;if(t===re&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==ue||i<8||i>15||t<0||t>9||s<0||s>ae||8===i&&1!==a)return le(e,$);8===i&&(i=9);const o=new Ae;return e.state=o,o.strm=e,o.status=42,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Pe(e,t,ue,15,8,oe),deflateInit2:Pe,deflateReset:Ce,deflateResetKeep:Me,deflateSetHeader:(e,t)=>ke(e)||2!==e.state.wrap?$:(e.state.gzhead=t,Z),deflate:(e,t)=>{if(ke(e)||t>Q||t<0)return e?le(e,$):$;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===r.status&&t!==K)return le(e,0===e.avail_out?te:$);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ge(e),0===e.avail_out)return r.last_flush=-1,Z}else if(0===e.avail_in&&ce(t)<=ce(i)&&t!==K)return le(e,te);if(666===r.status&&0!==e.avail_in)return le(e,te);if(42===r.status&&0===r.wrap&&(r.status=113),42===r.status){let t=ue+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=ne||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ve(r,t),0!==r.strstart&&(ve(r,e.adler>>>16),ve(r,65535&e.adler)),e.adler=1,r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(57===r.status)if(e.adler=0,_e(r,31),_e(r,139),_e(r,8),r.gzhead)_e(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),_e(r,255&r.gzhead.time),_e(r,r.gzhead.time>>8&255),_e(r,r.gzhead.time>>16&255),_e(r,r.gzhead.time>>24&255),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(_e(r,255&r.gzhead.extra.length),_e(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=G(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,3),r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ge(e),0!==r.pending)return r.last_flush=-1,Z;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ge(e),0!==r.pending))return r.last_flush=-1,Z;_e(r,255&e.adler),_e(r,e.adler>>8&255),e.adler=0}if(r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(0!==e.avail_in||0!==r.lookahead||t!==Y&&666!==r.status){let i=0===r.level?xe(r,t):r.strategy===ne?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ye(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===se?((e,t)=>{let r,i,n,s;const a=e.window;for(;;){if(e.lookahead<=258){if(ye(e),e.lookahead<=258&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=e.strstart+258;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):Se[r.level].func(r,t);if(3!==i&&4!==i||(r.status=666),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Z;if(2===i&&(t===X?j(r):t!==Q&&(V(r,0,0,!1),t===q&&(de(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ge(e),0===e.avail_out))return r.last_flush=-1,Z}return t!==K?Z:r.wrap<=0?J:(2===r.wrap?(_e(r,255&e.adler),_e(r,e.adler>>8&255),_e(r,e.adler>>16&255),_e(r,e.adler>>24&255),_e(r,255&e.total_in),_e(r,e.total_in>>8&255),_e(r,e.total_in>>16&255),_e(r,e.total_in>>24&255)):(ve(r,e.adler>>>16),ve(r,65535&e.adler)),ge(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Z:J)},deflateEnd:e=>{if(ke(e))return $;const t=e.state.status;return e.state=null,113===t?le(e,ee):Z},deflateSetDictionary:(e,t)=>{let r=t.length;if(ke(e))return $;const i=e.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return $;if(1===n&&(e.adler=D(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(de(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ye(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=pe(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,ye(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,i.wrap=n,Z},deflateInfo:"pako deflate (from Nodeca project)"};const Le=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ie=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Le(r,t)&&(e[t]=r[t])}}return e},Oe=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Be[254]=Be[254]=1;var Ge=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,s,a=e.length,o=0;for(n=0;n>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},We=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const s=new Array(2*r);for(n=0,i=0;i4)s[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i1?s[n++]=65533:t<65536?s[n++]=t:(t-=65536,s[n++]=55296|t>>10&1023,s[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&De)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Be[e[r]]>t?r:t};var Fe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ve=Object.prototype.toString,{Z_NO_FLUSH:ze,Z_SYNC_FLUSH:He,Z_FULL_FLUSH:je,Z_FINISH:Ye,Z_OK:Xe,Z_STREAM_END:qe,Z_DEFAULT_COMPRESSION:Ke,Z_DEFAULT_STRATEGY:Qe,Z_DEFLATED:Ze}=N;function Je(e){this.options=Ie({level:Ke,method:Ze,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Ue.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Xe)throw new Error(W[r]);if(t.header&&Ue.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ge(t.dictionary):"[object ArrayBuffer]"===Ve.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Ue.deflateSetDictionary(this.strm,e),r!==Xe)throw new Error(W[r]);this._dict_set=!0}}function $e(e,t){const r=new Je(t);if(r.push(e,!0),r.err)throw r.msg||W[r.err];return r.result}Je.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?Ye:ze,"string"==typeof e?r.input=Ge(e):"[object ArrayBuffer]"===Ve.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(s===He||s===je)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=Ue.deflate(r,s),n===qe)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Ue.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Xe;if(0!==r.avail_out){if(s>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Je.prototype.onData=function(e){this.chunks.push(e)},Je.prototype.onEnd=function(e){e===Xe&&(this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var et={Deflate:Je,deflate:$e,deflateRaw:function(e,t){return(t=t||{}).raw=!0,$e(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,$e(e,t)},constants:N};var tt=function(e,t){let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R,E;const S=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,s=n-(t-e.avail_out),a=n+(e.avail_out-257),o=S.dmax,h=S.wsize,u=S.whave,l=S.wnext,c=S.window,d=S.hold,f=S.bits,p=S.lencode,g=S.distcode,m=(1<>>24,d>>>=b,f-=b,b=v>>>16&255,0===b)E[n++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=p[(65535&v)+(d&(1<>>=b,f-=b),f<15&&(d+=R[r++]<>>24,d>>>=b,f-=b,b=v>>>16&255,!(16&b)){if(0==(64&b)){v=g[(65535&v)+(d&(1<o){e.msg="invalid distance too far back",S.mode=16209;break e}if(d>>>=b,f-=b,b=n-s,y>b){if(b=y-b,b>u&&S.sane){e.msg="invalid distance too far back",S.mode=16209;break e}if(x=0,T=c,0===l){if(x+=h-b,b2;)E[n++]=T[x++],E[n++]=T[x++],E[n++]=T[x++],w-=3;w&&(E[n++]=T[x++],w>1&&(E[n++]=T[x++]))}else{x=n-y;do{E[n++]=E[x++],E[n++]=E[x++],E[n++]=E[x++],w-=3}while(w>2);w&&(E[n++]=E[x++],w>1&&(E[n++]=E[x++]))}break}}break}}while(r>3,r-=w,f-=w<<3,d&=(1<{const h=o.bits;let u,l,c,d,f,p,g=0,m=0,_=0,v=0,b=0,w=0,y=0,x=0,T=0,R=0,E=null;const S=new Uint16Array(16),A=new Uint16Array(16);let k,M,C,P=null;for(g=0;g<=15;g++)S[g]=0;for(m=0;m=1&&0===S[v];v--);if(b>v&&(b=v),0===v)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(_=1;_0&&(0===e||1!==v))return-1;for(A[1]=0,g=1;g<15;g++)A[g+1]=A[g]+S[g];for(m=0;m852||2===e&&T>592)return 1;for(;;){k=g-y,a[m]+1=p?(M=P[a[m]-p],C=E[a[m]-p]):(M=96,C=0),u=1<>y)+l]=k<<24|M<<16|C|0}while(0!==l);for(u=1<>=1;if(0!==u?(R&=u-1,R+=u):R=0,m++,0==--S[g]){if(g===v)break;g=t[r+a[m]]}if(g>b&&(R&d)!==c){for(0===y&&(y=b),f+=_,w=g-y,x=1<852||2===e&&T>592)return 1;c=R&d,n[c]=b<<24|w<<16|f-s|0}}return 0!==R&&(n[f+R]=g-y<<24|64<<16|0),o.bits=b,0};const{Z_FINISH:ot,Z_BLOCK:ht,Z_TREES:ut,Z_OK:lt,Z_STREAM_END:ct,Z_NEED_DICT:dt,Z_STREAM_ERROR:ft,Z_DATA_ERROR:pt,Z_MEM_ERROR:gt,Z_BUF_ERROR:mt,Z_DEFLATED:_t}=N,vt=16209,bt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function wt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<16180||t.mode>16211?1:0},xt=e=>{if(yt(e))return ft;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,lt},Tt=e=>{if(yt(e))return ft;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xt(e)},Rt=(e,t)=>{let r;if(yt(e))return ft;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ft:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Tt(e))},Et=(e,t)=>{if(!e)return ft;const r=new wt;e.state=r,r.strm=e,r.window=null,r.mode=16180;const i=Rt(e,t);return i!==lt&&(e.state=null),i};let St,At,kt=!0;const Mt=e=>{if(kt){St=new Int32Array(512),At=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(at(1,e.lens,0,288,St,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;at(2,e.lens,0,32,At,0,e.work,{bits:5}),kt=!1}e.lencode=St,e.lenbits=9,e.distcode=At,e.distbits=5},Ct=(e,t,r,i)=>{let n;const s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(t.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(t.subarray(r-i,r-i+n),s.wnext),(i-=n)?(s.window.set(t.subarray(r-i,r),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveEt(e,15),inflateInit2:Et,inflate:(e,t)=>{let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R=0;const E=new Uint8Array(4);let S,A;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yt(e)||!e.output||!e.input&&0!==e.avail_in)return ft;r=e.state,16191===r.mode&&(r.mode=16192),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,d=h,T=lt;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=vt;break}if((15&u)!==_t){e.msg="unknown compression method",r.mode=vt;break}if(u>>>=4,l-=4,x=8+(15&u),0===r.wbits&&(r.wbits=x),x>15||x>r.wbits){e.msg="invalid window size",r.mode=vt;break}r.dmax=1<>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=G(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>o&&(f=o),f&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(s,s+f),x)),512&r.flags&&4&r.wrap&&(r.check=G(r.check,i,f,s)),o-=f,s+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;f=0;do{x=i[s+f++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&f>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>=7&l,l-=7&l,r.mode=16206;break}for(;l<3;){if(0===o)break e;o--,u+=i[s++]<>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Mt(r),r.mode=16199,t===ut){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=vt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=vt;break}if(r.length=65535&u,u=0,l=0,r.mode=16194,t===ut)break e;case 16194:r.mode=16195;case 16195:if(f=r.length,f){if(f>o&&(f=o),f>h&&(f=h),0===f)break e;n.set(i.subarray(s,s+f),a),o-=f,s+=f,h-=f,a+=f,r.length-=f;break}r.mode=16191;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[s++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vt;break}r.have=0,r.mode=16197;case 16197:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},T=at(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid code lengths set",r.mode=vt;break}r.have=0,r.mode=16198;case 16198:for(;r.have>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=m,l-=m,r.lens[r.have++]=v;else{if(16===v){for(A=m+2;l>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=vt;break}x=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===v){for(A=m+3;l>>=m,l-=m,x=0,f=3+(7&u),u>>>=3,l-=3}else{for(A=m+7;l>>=m,l-=m,x=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vt;break}for(;f--;)r.lens[r.have++]=x}}if(r.mode===vt)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=vt;break}if(r.lenbits=9,S={bits:r.lenbits},T=at(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid literal/lengths set",r.mode=vt;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},T=at(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,T){e.msg="invalid distances set",r.mode=vt;break}if(r.mode=16199,t===ut)break e;case 16199:r.mode=16200;case 16200:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,tt(e,d),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;R=r.lencode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,r.length=v,0===_){r.mode=16205;break}if(32&_){r.back=-1,r.mode=16191;break}if(64&_){e.msg="invalid literal/length code",r.mode=vt;break}r.extra=15&_,r.mode=16201;case 16201:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;R=r.distcode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,64&_){e.msg="invalid distance code",r.mode=vt;break}r.offset=v,r.extra=15&_,r.mode=16203;case 16203:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vt;break}r.mode=16204;case 16204:if(0===h)break e;if(f=d-h,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vt;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),g=r.window}else g=n,p=a-r.offset,f=r.length;f>h&&(f=h),h-=f,r.length-=f;do{n[a++]=g[p++]}while(--f);0===r.length&&(r.mode=16200);break;case 16205:if(0===h)break e;n[a++]=r.length,h--,r.mode=16200;break;case 16206:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[s++]<{if(yt(e))return ft;let t=e.state;return t.window&&(t.window=null),e.state=null,lt},inflateGetHeader:(e,t)=>{if(yt(e))return ft;const r=e.state;return 0==(2&r.wrap)?ft:(r.head=t,t.done=!1,lt)},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,s;return yt(e)?ft:(i=e.state,0!==i.wrap&&16190!==i.mode?ft:16190===i.mode&&(n=1,n=D(n,t,r,0),n!==i.check)?pt:(s=Ct(e,t,r,r),s?(i.mode=16210,gt):(i.havedict=1,lt)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ut=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Lt=Object.prototype.toString,{Z_NO_FLUSH:It,Z_FINISH:Ot,Z_OK:Dt,Z_STREAM_END:Bt,Z_NEED_DICT:Gt,Z_STREAM_ERROR:Wt,Z_DATA_ERROR:Nt,Z_MEM_ERROR:Ft}=N;function Vt(e){this.options=Ie({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Pt.inflateInit2(this.strm,t.windowBits);if(r!==Dt)throw new Error(W[r]);if(this.header=new Ut,Pt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ge(t.dictionary):"[object ArrayBuffer]"===Lt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Pt.inflateSetDictionary(this.strm,t.dictionary),r!==Dt)))throw new Error(W[r])}function zt(e,t){const r=new Vt(t);if(r.push(e),r.err)throw r.msg||W[r.err];return r.result}Vt.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Ot:It,"[object ArrayBuffer]"===Lt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),s=Pt.inflate(r,a),s===Gt&&n&&(s=Pt.inflateSetDictionary(r,n),s===Dt?s=Pt.inflate(r,a):s===Nt&&(s=Gt));r.avail_in>0&&s===Bt&&r.state.wrap>0&&0!==e[r.next_in];)Pt.inflateReset(r),s=Pt.inflate(r,a);switch(s){case Wt:case Nt:case Gt:case Ft:return this.onEnd(s),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||s===Bt))if("string"===this.options.to){let e=Ne(r.output,r.next_out),t=r.next_out-e,n=We(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(s!==Dt||0!==o){if(s===Bt)return s=Pt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Vt.prototype.onData=function(e){this.chunks.push(e)},Vt.prototype.onEnd=function(e){e===Dt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Ht={Inflate:Vt,inflate:zt,inflateRaw:function(e,t){return(t=t||{}).raw=!0,zt(e,t)},ungzip:zt,constants:N};const{Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt}=et,{Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt}=Ht;var $t=jt,er=Yt,tr=Xt,rr=qt,ir=Kt,nr=Qt,sr=Zt,ar=Jt,or=N,hr={Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt,Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt,constants:N}},,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var i=r(40);Object.keys(i).forEach(e=>self[e]=i[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/sharing_mtsimd.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1;var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +let data = `class webcodecDecodeWorkerMessageChannel{static handleVDMSCMessage(e){let t=e.data;switch(t.cmd){case"init":{let e=t.id,o=t.context;WebcodecDecoders[e]||(WebcodecDecoders[e]=new WebcodecDecoder(e)),WebcodecDecoders[e].init(o)}break;case"configure":{let e=t.id,o=t.buffer,a=t.extraDataLen,d=t.Width,i=t.Height,r=t.ssrc,c=new Uint8Array(a),n=GROWABLE_HEAP_U8().subarray(o,o+a);return c.set(n),_free(o),WebcodecDecoders[e].configure(c,d,i,r),"configured"==WebcodecDecoders[e].videoDecoder.state?0:-1}case"decode":{let e=t.id,o=t.NewIDR,a=t.buffer,d=t.vclBufferSize,i=(t.vclNalCount,GROWABLE_HEAP_U8().subarray(a,a+d)),r=new Uint8Array(d);r.set(i),WebcodecDecoders[e].decode(r,o)}}}constructor(){this.decodeMSCManager=[]}addMSC(e){this.decodeMSCManager.push(e),e.onmessage=webcodecDecodeWorkerMessageChannel.handleVDMSCMessage}}const FRAME_ENC_SUCCEED=0,FRAME_ENC_OVERTIME=1,FRAME_ENC_FAILED=2,FRAME_DEC_SUCCEED=0,FRAME_DEC_OVERTIME=1,FRAME_DEC_FAILED=2,MONITOR_TIMEOUT_MS=3e4,MAX_TIMEOUT_MS=40,TIMEOUT_UP_STEP=20,SLOW_START_TIMEOUT=100,MAX_CACHE_SIZE=20,WEBCODEC_ERROR=3;function globalTracingError(e,t){postMessage({cmd:"globalTracingError",data:e,error:t})}function globalTraingReport(e,t){postMessage({cmd:"GlobalTracingDT",data:e,error:t})}function printError(e){postMessage({cmd:"printError",data:e})}class WebCodecPerformanceStatus{constructor({encode:e,id:t}){this.inputIndex=0,this.outputIndex=0,this.timeoutIndex=0,this.records=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.timeout_id=-1,this.enabled=!1,this.startTs=0,this.isFailed=!1,this.sumDelay=0,this.maxDelay=0,this.minDelay=1e6,this.encode=e,this.id=t||0}_report(){let e=performance.now();this.enabled=!1;let t=Math.round(e-this.startTs),o=1e3*this.inputIndex/t,a=1e3*this.outputIndex/t,d=this.sumDelay/(this.outputIndex||1),i=this.timeoutIndex/(this.inputIndex||1);postMessage({cmd:"webcodecperformance",id:this.id,encode:this.encode,avgDelay:d,inputIndex:this.inputIndex,inavgFps:o,outputIndex:this.outputIndex,outavgFps:a,failed:this.isFailed,ratio:i,elapsed:t})}start(){-1==this.timeout_id&&(this.enabled=!0,this.startTs=performance.now(),this.timeout_id=setTimeout((()=>{this._report()}),3e4))}stop(e){this.isFailed=e,-1!=this.timeout_id&&clearTimeout(this.timeout_id),this._report()}inputInc(){this.inputIndex++,this.enabled&&(this.records[this.inputIndex%20]=performance.now())}outputInc(){if(this.outputIndex++,!this.enabled)return;let e=performance.now()-this.records[this.outputIndex%20];this.sumDelay+=e}}var Module={},initializedJS=!1,pendingNotifiedProxyingQueues=[],enableVBWasmBackend=0,codecMRG=new CodecMRG;Module.codecMRG=codecMRG;var multiThreadFlag,model,tfjsUrl,prob,mask,firstpayload,afnModel,frame=null,modelArtifacts={},IOhandle={};IOhandle.load=function(){return modelArtifacts},IOhandle.save=function(){};var baseModel,afnModelArtifacts={},afnIOHandle={},baseModelArtifacts={},baseIOHandle={};let tfInitPromise,webcodecDecodeFlag=!1,webcodecEncodeFlag=!1;afnIOHandle.load=function(){return afnModelArtifacts},afnIOHandle.save=function(){},baseIOHandle.load=function(){return baseModelArtifacts},baseIOHandle.save=function(){};var decHAOption,dualModelOKCount=0,tfLoad=!1;let webcodecDecodeWorkerMSC,decodeThreadSSRC,wasmDecodeWorkerMSC=null;function initTf(e){tfLoad||(importScripts(e),tfLoad=!0,tfInitPromise=tf.setBackend("webgl").then((e=>{if(!e)return Promise.reject("init tf fail 1")})).catch((()=>{if(!enableVBWasmBackend)return postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 2");const t=e.substr(0,e.lastIndexOf("/")+1);return importScripts(t+"tf-backend-wasm.min.js"),tf.wasm.setWasmPaths(t),tf.setBackend("wasm").then((e=>{if(!e)return postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 3")}),(()=>(postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 4"))))})))}function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var chunk,err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var o=new WebAssembly.Instance(Module.wasmModule,e);return t(o),Module.wasmModule=null,o.exports},self.addEventListener("unhandledrejection",(function(e){let t="";const o=e?.reason;(o instanceof Error||o instanceof ErrorEvent)&&(t+=" Message: "+o?.message+" Stack: "+(o?.error?.stack??o?.stack)),globalTracingError("Unhandled Rejection: "+JSON.stringify(e?.reason??e)+t)})),self.addEventListener("error",(e=>{globalTracingError("Message: "+e?.message+" Stack:"+e?.error?.stack)})),self.onmessage=e=>{try{if("load"===e.data.cmd){Module.wasmModule=e.data.wasmModule;for(const t of e.data.handlers)Module[t]=function(){postMessage({cmd:"callHandler",handler:t,args:[...arguments]})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,Module.isTeslaMode=e.data.isTeslaMode,Module.is360penablehwenc=!!e.data.is360penablehwenc,Module.is360penablehwdec=!!e.data.is360penablehwdec,Module.isAndroid=e.data.isAndroid,"string"==typeof e.data.urlOrBlob)importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}}else if("run"===e.data.cmd){Module.__performance_now_clock_drift=performance.now()-e.data.time,Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(pendingNotifiedProxyingQueues.forEach((e=>{Module.executeNotifiedProxyingQueue(e)})),pendingNotifiedProxyingQueues=[],initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(e){if("unwind"!=e){if(!(e instanceof Module.ExitStatus))throw e;Module.keepRuntimeAlive()||Module.__emscripten_thread_exit(e.status)}}}else if("cancel"===e.data.cmd)Module._pthread_self()&&Module.__emscripten_thread_exit(-1);else if("setimmediate"===e.data.target);else if("processProxyingQueue"===e.data.cmd)initializedJS?Module.executeNotifiedProxyingQueue(e.data.queue):pendingNotifiedProxyingQueues.push(e.data.queue);else if("videoframe"===e.data.cmd)frame&&(frame.close(),postMessage({cmd:"video_un_ref"})),frame=e.data.data;else if("vdmsc1"===e.data.cmd)wasmDecodeWorkerMSC=e.ports[0];else if("vdmsc2"===e.data.cmd)webcodecDecodeWorkerMSC||(webcodecDecodeWorkerMSC=new webcodecDecodeWorkerMessageChannel),webcodecDecodeWorkerMSC.addMSC(e.ports[0]);else if("VideoEncodeConfigure"===e.data.cmd){var o=e.data.Width,a=e.data.Height,d=e.data.id,i=e.data.Bitrate,r=e.data.Framerate,c=e.data.buffer;Module.codecMRG.configEncodeWebCodec(d,i,r,o,a,c)}else if("VideoEncodeInit"===e.data.cmd){d=e.data.id;var n=e.data.context;Module.codecMRG.initEncodeWebCodec(d,n)}else if("VideoEncode"===e.data.cmd){var s=e.data.videoFrameId,l=e.data.dataLength,u=(d=e.data.id,e.data.NewIDR),f=e.data.rawData,h=e.data.timeout;Module.codecMRG.encodeVideoFrame(d,s,u,f,l,h)}else if("CloseVideoEncode"===e.data.cmd)Module.codecMRG.closeVideoEncode();else if("multiThreadFlag"===e.data.cmd)multiThreadFlag=e.data.multiThreadFlag;else if("vbObj0"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;var m=e.data.modelJSON;if(modelArtifacts.modelTopology=m.modelTopology,modelArtifacts.format=m.format,modelArtifacts.generatedBy=m.generatedBy,modelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(var p=0;p{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(IOhandle).then((function(e){model=e,postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=tf.tensor4d(t,[1,144,256,3],"float32");model.predict(o),postMessage({cmd:"vbPredictDone"})}))}))}else if("vbObj1"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;m=e.data.modelJSON;if(afnModelArtifacts.modelTopology=m.modelTopology,afnModelArtifacts.format=m.format,afnModelArtifacts.generatedBy=m.generatedBy,afnModelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(p=0;p{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(afnIOHandle).then((function(e){afnModel=e,0==dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=new Float32Array(110592),a=new Float32Array(36864),d=tf.tensor4d(t,[1,144,256,3],"float32"),i=tf.tensor4d(o,[1,144,256,3],"float32"),r=tf.tensor4d(a,[1,144,256,1],"float32");afnModel.predict([d,i,r]),2==++dualModelOKCount&&postMessage({cmd:"vbPredictDone"})}))}))}else if("vbObj2"===e.data.cmd){tfjsUrl=e.data.tfjsUrl;m=e.data.modelJSON;if(baseModelArtifacts.modelTopology=m.modelTopology,baseModelArtifacts.format=m.format,baseModelArtifacts.generatedBy=m.generatedBy,baseModelArtifacts.convertedBy=m.convertedBy,m.weightsManifest)for(p=0;p{tf.loadGraphModel(baseIOHandle).then((function(e){baseModel=e,0==dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),o=tf.tensor4d(t,[1,144,256,3],"float32");baseModel.predict(o),2==++dualModelOKCount&&postMessage({cmd:"vbPredictDone"})}))}))}else if("vbFlag"==e.data.cmd)enableVBWasmBackend=e.data.enableVBWasmBackend;else if("vb"==e.data.cmd)multiThreadFlag=!1;else if("webcodec"==e.data.cmd)noExitRuntime=!0,decHAOption=e.data.decHAOption;else if("webcodecfailed"==e.data.cmd){let t=e.data.encode,o=e.data.id;t?codecMRG?.webcodecFailed(o):WebcodecDecoders[o].failed()}else err("worker.js received unknown command "+e.data.cmd),err(e.data)}catch(e){throw postMessage({cmd:"tCrashed",data:e.toString()}),Module.__emscripten_thread_crashed,e}};var WebcodecDecoders=[];function WebcodecDecoder(e){this.id=e,this.videoDecoder=null,this.context=null,this.decodeOutputIndex=0,this.ssrc=0,this.continuoustimeout=0,this.timeoutcount=0,this.timeout=MAX_TIMEOUT_MS,this.webcodecStatus=new WebCodecPerformanceStatus({encode:!1,id:e}),this.paintFrameToCanvas=function(e){if(this.webcodecStatus.outputInc(),this.timeout_id){this.continuoustimeout=0;try{postMessage({cmd:"decoded_webcodec",data:e,id:this.id,frameIndex:this.decodeOutputIndex,ssrc:this.ssrc},[e])}catch(e){globalTracingError("error closing video frame",e)}Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_SUCCEED,this.decodeOutputIndex),this.closeTimeout(),this.decodeOutputIndex++}else e.close()},this.onDecoderError=function(e){globalTracingError("onDecoderError code"+e?.code,e),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0),this.closeTimeout()}}function InitVideoDecoder_js(e,t){return wasmDecodeWorkerMSC?(wasmDecodeWorkerMSC.postMessage({cmd:"init",id:e,context:t}),0):-1}function VideoDecoderConfigure_js(e,t,o,a,d){if(wasmDecodeWorkerMSC){let r=_malloc(o);if(!r)return-1;var i=GROWABLE_HEAP_U8().subarray(t,t+o);return writeArrayToMemory(i,r),wasmDecodeWorkerMSC.postMessage({cmd:"configure",id:e,buffer:r,extraDataLen:o,Width:a,Height:d,ssrc:decodeThreadSSRC}),0}return-1}function VideoDecoder_js(e,t,o,a,d){return wasmDecodeWorkerMSC?(wasmDecodeWorkerMSC.postMessage({cmd:"decode",id:e,buffer:t,vclBufferSize:o,NewIDR:a,vclNalCount:d}),0):-1}function GetEncThreadNum(){return 1}function GetCscThreadNum(){return 1}function js_info_from_wcl(e,t,o){var a=new Uint8Array(o),d=GROWABLE_HEAP_I8().subarray(t+0,t+o);a.set(d,0,o),postMessage({cmd:"js_info_from_wcl",data:a},[a.buffer])}function decode_callback(e,t){postMessage({cmd:"size",ssrc:e,size:t})}function frame_callback(e,t,o,a,d,i,r,c,n,s,l,u){var f=a;f=f>>10<<10,postMessage({cmd:"decoded",status:0,yuvdataptr:e,yuvdata:e,yuvlength:t,ntptime:0,ssrc:f,width:d,height:i,r_x:r,r_y:c,r_w:n,r_h:s,rotation:l,yuv_limited:u})}function frame_callback_webcodec(e,t,o,a,d,i,r,c,n,s,l,u){postMessage({cmd:"decoded_webcodec_render",status:0,id:e,iFrameNum:t,timestamp:o,ssrc:a,format_width:d,format_height:i,rendering_x:r,rendering_y:c,rendering_width:n,rendering_height:s,rotation:l,yuv_limited:u})}WebcodecDecoder.prototype.failed=function(){this.webcodecStatus.stop(!0),this.closeTimeout()},WebcodecDecoder.prototype.init=function(e){this.videoDecoder=new VideoDecoder({output:this.paintFrameToCanvas.bind(this),error:this.onDecoderError.bind(this)}),this.videoDecoder||globalTracingError("error creating VideoDecoder"),this.context=e,this.webcodecStatus.start()},WebcodecDecoder.prototype.configure=function(e,t,o,a){try{this.ssrc=a;let d={codec:"avc1.640028",description:e,codedWidth:t,codedHeight:o,optimizeForLatency:!0,hardwareAcceleration:decHAOption||"prefer-hardware"};this.videoDecoder.configure(d),this.closeTimeout()}catch(e){globalTracingError("Error configuring VideoDecoder",e),this.context&&Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0)}},WebcodecDecoder.prototype.decode=function(e,t){try{1==t?(chunk=new EncodedVideoChunk({type:"key",timestamp:0,duration:0,data:e}),firstpayload=0):chunk=new EncodedVideoChunk({type:"delta",timestamp:0,duration:0,data:e}),webcodecDecodeFlag||(webcodecDecodeFlag=!0,globalTraingReport("webcodec decode start")),this.videoDecoder.decode(chunk),this.webcodecStatus.inputInc(),this.checkTimoutRatio(),this.closeTimeout(),this.startTimeout()}catch(e){globalTracingError("Error decoding in WebcodecDecoder",e),this.context&&Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0)}return 0},WebcodecDecoder.prototype.startTimeout=function(){UserWebCodecController_js()&&(this.getTimeout(),this.timeout_id=setTimeout((()=>{this.timeout_id=0,this.continuoustimeout++,this.webcodecStatus.timeoutIndex++,Module._OnVideoFrameOutputCallback(this.context,1,0),this.checkAvailability()}),this.timeout))},WebcodecDecoder.prototype.getTimeout=function(){this.continuoustimeout>1?this.webcodecStatus.inputIndex<5?this.timeout=100:this.timeout+=20:this.timeout=MAX_TIMEOUT_MS},WebcodecDecoder.prototype.closeTimeout=function(){this.timeout_id&&(clearTimeout(this.timeout_id),this.timeout_id=0)},WebcodecDecoder.prototype.checkTimoutRatio=function(){if(this.webcodecStatus.inputIndex%50)return;let e=this.webcodecStatus.timeoutIndex-this.timeoutcount;this.timeoutcount=this.webcodecStatus.timeoutIndex,e>=15&&(globalTracingError("webcodec decode timed out ratio: "+Math.round(100*e/50)),this.closeTimeout(),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0))},WebcodecDecoder.prototype.checkAvailability=function(){this.webcodecStatus.inputIndex-this.webcodecStatus.outputIndex>=20&&setTimeout((()=>{this.webcodecStatus.inputIndex-this.webcodecStatus.outputIndex>=20&&(globalTracingError("webcodec decode failed exceeded maximum cache frame"),this.closeTimeout(),Module._OnVideoFrameOutputCallback(this.context,FRAME_DEC_FAILED,0))}),1e3)};var encodereclaim=0;function WebcodecEncoder(e){this.id=e,this.handle=null,this.context=null,this.bsBuffer=null,this.timeoutid=-1,this.encodereclaimcount=0,this.webcodecStatus=new WebCodecPerformanceStatus({encode:!0,id:e})}function CodecMRG(){this.decodeCodecHandles=new Map,this.encodeCodecHandles=new Map}function UserAgentIsTesla_js(){return Module.isTeslaMode}function LimitWebCodecsEncoderTo360_js(){return Module.is360penablehwenc}function LimitWebCodecsDecoderTo360_js(){return Module.is360penablehwdec}function js_info_from_wcl_video_data(e,t,o,a,d,i){var r=new Uint8Array(o+4),c=GROWABLE_HEAP_I8().subarray(t+0,t+o);r[0]=a,r[1]=d,r.set(c,4,o),postMessage({cmd:"js_info_from_wcl_video_data",ssrc:e,data:r,is_sent_by_data:i},[r.buffer])}function processed_capture_data_callback(e,t,o,a,d,i,r,c,n,s){postMessage({cmd:"processed_capture_data_callback",ssrc:e,data:t,len_of_data:o,format_width:a,format_height:d,valid_x:i,valid_y:r,valid_width:c,valid_height:n,yuv_limited:s})}function SAVE_IV(e,t){postMessage({cmd:"SAVE_IV",ptr:e,len:t})}function change_capture_resolution(e){postMessage({cmd:"change_capture_resolution",type:e})}function APP_Troubleshoting_Info(e,t){postMessage({cmd:"APP_Troubleshoting_Info",data:e,len:t})}function IsSupportMultiThread(){return multiThreadFlag?1:0}function hardcodecpunumber(){return navigator.hardwareConcurrency||1}function setCurrentThreadSsrc_js(e){decodeThreadSSRC=e}function execute(e,t,o,a){if(model)try{var d=new Float32Array(GROWABLE_HEAP_U8().buffer,e,t),i=tf.tensor4d(d,[1,144,256,3],"float32"),r=model.predict(i),c=Float32Array.from(r.as1D(36864).arraySync());return GROWABLE_HEAP_F32().set(c,o>>2),i.dispose(),r.dispose(),0}catch(e){return globalTracingError("Multi Thread VB error",e),-1}}function execute_base(e,t,o,a){return tf.tidy((()=>{var d=new Float32Array(wasmMemory.buffer,e,t),i=tf.tensor4d(d,[1,144,256,3],"float32"),r=baseModel.predict(i);1==r[1].size?(mask=Float32Array.from(r[0].as1D(36864).arraySync()),prob=Float32Array.from(r[1].as1D(1).arraySync())):(mask=Float32Array.from(r[1].as1D(36864).arraySync()),prob=Float32Array.from(r[0].as1D(1).arraySync()));let c=new Float32Array(wasmMemory.buffer);c.set(mask,o>>2),c.set(prob,a>>2)})),0}function execute_afn(e,t,o,a,d){return tf.tidy((()=>{var i=new Float32Array(GROWABLE_HEAP_U8().buffer,e,a),r=new Float32Array(GROWABLE_HEAP_U8().buffer,t,a),c=new Float32Array(GROWABLE_HEAP_U8().buffer,o,a/3),n=tf.tensor4d(i,[1,144,256,3],"float32"),s=tf.tensor4d(r,[1,144,256,3],"float32"),l=tf.tensor4d(c,[1,144,256,1],"float32"),u=afnModel.predict([n,s,l]);mask=Float32Array.from(u.as1D(36864).arraySync()),GROWABLE_HEAP_F32().set(mask,d>>2)})),0}function MCMMonitor_Video_LOG(e,t){var o=new Uint8Array(t),a=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(a),postMessage({cmd:"MCM_VIDEO_LOG",data:o},[o.buffer])}function wcl_trace_log(e,t){var o=new Uint8Array(t),a=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(a,0,t),postMessage({cmd:"wcl_trace_log",data:o},[o.buffer])}function WebCodecsEncoderFail_js(e,t){postMessage({cmd:"WCEF",data:e,code:t})}function WebCodecsDecoderFail_js(e){postMessage({cmd:"WCDF",data:e})}function UserWebCodecController_js(){return Module.isAndroid}WebcodecEncoder.prototype.init=function(e,t){this.id=e,this.context=t,this.handle=new VideoEncoder({output:this.EncodedVideoChunkOutputCallback.bind(this),error:this.onEncoderError.bind(this)}),this.webcodecStatus.start()},WebcodecEncoder.prototype.EncodedVideoChunkOutputCallback=function(e){if(this.webcodecStatus.outputInc(),this.webcodecStatus.inputIndex==this.webcodecStatus.outputIndex&&-1!=this.timeoutid){this._stopTimeout();var t=e.byteLength,o=GROWABLE_HEAP_U8().subarray(this.bsBuffer,this.bsBuffer+t);e.copyTo(o),Module._OnEncodedVideoChunkOutputCallback(this.context,0,t)}},WebcodecEncoder.prototype.onEncoderError=function(e){let t=e&&-1!==e.toString().indexOf("reclaimed")&&++this.encodereclaimcount<2;t?(postMessage({cmd:"reclaimed",data:0}),encodereclaim=1):postMessage({cmd:"reclaimed",data:-1}),frame&&(frame.close(),frame=null),t?globalTracingError("VideoEncoder reclaimed"):(WebCodecsEncoderFail_js(this.id,3),globalTracingError("VideoEncoder error",e),this.context&&Module._OnEncodedVideoChunkOutputCallback(this.context,2,0),codecMRG.closeVideoEncode())},WebcodecEncoder.prototype.configure=function(e,t,o,a,d){try{if(encodereclaim&&(this.handle=new VideoEncoder({output:this.EncodedVideoChunkOutputCallback.bind(this),error:this.onEncoderError.bind(this)}),encodereclaim=0),this.handle){var i={codec:"avc1.640028",bitrate:e,width:o,height:a,avc:{format:"annexb"},framerate:t,hardwareAcceleration:"no-preference",latencyMode:"realtime",bitrateMode:"constant",scalabilityMode:"L1T2"};this.handle.configure(i),this.bsBuffer=d,this._stopTimeout()}}catch(e){this.onEncoderError(e)}},WebcodecEncoder.prototype.encode=function(e,t,o,a,d){if(this._startTimeout(t,d),this.handle){var i={keyFrame:!1};1==t&&(i.keyFrame=!0),webcodecEncodeFlag||(webcodecEncodeFlag=!0,globalTraingReport("webcodec encode start")),this.webcodecStatus.inputInc(),this.webcodecStatus.inputIndex%200==0&&postMessage({cmd:"THWEC",data:this.webcodecStatus.inputIndex}),this.handle.encode(frame,i),frame.close(),frame=null,postMessage({cmd:"video_un_ref"})}},WebcodecEncoder.prototype._stopTimeout=function(){-1!=this.timeoutid&&(clearTimeout(this.timeoutid),this.timeoutid=-1)},WebcodecEncoder.prototype._startTimeout=function(e,t){this._stopTimeout(),this.timeoutid=setTimeout((()=>{this.timeoutid=-1,this.context&&Module._OnEncodedVideoChunkOutputCallback(this.context,1,0),this.webcodecStatus.timeoutIndex++}),t)},WebcodecEncoder.prototype.close=function(){"closed"!=this.handle.state&&(this.handle.close(),this.handle=null),codecMRG.clear_encodestate()},WebcodecEncoder.prototype.failed=function(){this.webcodecStatus.stop(!0)},CodecMRG.prototype.initEncodeWebCodec=function(e,t){var o=this.encodeCodecHandles.get(e);o||(o=new WebcodecEncoder(e),this.encodeCodecHandles.set(e,o)),o.init(e,t)},CodecMRG.prototype.configEncodeWebCodec=function(e,t,o,a,d,i){var r=this.encodeCodecHandles.get(e);r&&r.configure(t,o,a,d,i)},CodecMRG.prototype.encodeVideoFrame=function(e,t,o,a,d,i){var r=this.encodeCodecHandles.get(e);r&&r.encode(t,o,a,d,i)},CodecMRG.prototype.webcodecFailed=function(e){var t=this.encodeCodecHandles.get(e);t&&t.failed()},CodecMRG.prototype.closeVideoEncode=function(){var e=this.encodeCodecHandles.get(0);e&&e.close()},CodecMRG.prototype.clear_encodestate=function(){this.encodeCodecHandles&&this.encodeCodecHandles.clear()};` + return URL.createObjectURL(new Blob([data],{type:"application/javascript", label:"sharing.thread"})) +} +Module["mainScriptUrlOrBlob"] = String.raw`function GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP16}function GROWABLE_HEAP_U16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU16}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var ENVIRONMENT_IS_PTHREAD=Module["ENVIRONMENT_IS_PTHREAD"]||false;var _scriptDir=typeof document!="undefined"&&document.currentScript?document.currentScript.src:undefined;if(ENVIRONMENT_IS_WORKER){_scriptDir=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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.buffer instanceof SharedArrayBuffer?heapOrArray.slice(idx,endPtr):heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;if(ENVIRONMENT_IS_PTHREAD){buffer=Module["buffer"]}function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||67108864;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module["wasmMemory"];buffer=Module["buffer"]}else{if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2097152e3/65536,"shared":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag");if(ENVIRONMENT_IS_NODE){err("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)")}throw Error("bad memory")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;if(ENVIRONMENT_IS_PTHREAD)return;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="video.mtsimd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;registerTLSInit(Module["asm"]["_emscripten_tls_init"]);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){removeRunDependency("wasm-instantiate")}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency("wasm-instantiate")}function receiveInstantiationResult(result){receiveInstance(result["instance"],result["module"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={365900:$0=>{console.log("Video Version: ",$0)},365937:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},365971:$0=>{change_capture_resolution($0)},366006:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},366083:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},366153:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_webcodec($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},366232:($0,$1)=>{decode_callback($0,$1)},366261:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},366295:($0,$1,$2,$3)=>{Video_Controller_Encode_Data2($0,$1,$2,$3)},366343:($0,$1)=>{SAVE_IV($0,$1)},366361:($0,$1,$2,$3)=>{Video_Controller_Encode_Data($0,$1,$2,$3)},366408:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},366465:$0=>{Exit_Thread($0)},366483:$0=>{return Before_Create_Thread($0)},366520:$0=>{return Before_Create_Thread($0)},366557:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},366591:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},366631:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},366661:$0=>{SubScribeUpdateVideo($0)},366689:()=>{return Date.now()/1e3},366716:()=>{return Date.now()%1e3},366743:($0,$1)=>{send_data($0,$1)},366766:$0=>{SubScribeUpdateVideo($0)},366794:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},366855:($0,$1)=>{SAVE_IV($0,$1)},366873:()=>{return Date.now()},366896:($0,$1)=>{Update_Required_Bandwidth($0,$1)},366932:$0=>{Update_Video_Hd_Info($0)},366962:$0=>{console.log("Sharing Version: ",$0)},367001:($0,$1,$2,$3)=>{Send_Multi_Data($0,$1,$2,$3)},367035:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},367057:($0,$1,$2)=>{Send_Data($0,$1,$2)},367081:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367109:($0,$1,$2)=>{Send_Data($0,$1,$2)},367133:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367161:($0,$1,$2)=>{Send_Data($0,$1,$2)},367185:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},367223:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},367260:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367291:($0,$1,$2)=>{Send_Data($0,$1,$2)},367318:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},367348:($0,$1,$2)=>{Send_Data($0,$1,$2)},367375:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)=>{frame_callback_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)},367466:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_mouse_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},367553:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},367585:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},367630:$0=>{SubScribeUpdateSharing($0)},367660:($0,$1)=>{Send_Data($0,$1)},367683:$0=>{Update_WebSokcet_Speed($0)},367715:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},367778:($0,$1)=>{SAVE_IV($0,$1)},367796:$0=>{console.error("tjDecompressHeader3 error %d ",$0)},367849:$0=>{console.error("tjDecompress2 error %d ",$0)},367896:($0,$1,$2,$3)=>{Sharing_Decode_Channel_Change($0,$1,$2,$3)},367943:($0,$1)=>{Update_Required_Bandwidth($0,$1)},367979:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},368010:($0,$1)=>{Recieve_Wb_Packet($0,$1)},368037:$0=>{release_video_receiving_channle($0)},368077:()=>{videocodec_create_helpthread()},368111:()=>{console.error("_do_sharing_controller_decode: start")},368167:()=>{console.error("_do_sharing_controller_decode: waiting msg ")},368230:$0=>{console.error("_do_sharing_controller_decode: ",$0)},368285:($0,$1,$2)=>{console.error("_do_sharing_controller_decode: Try_Analysis ",$0,$1,$2)},368360:()=>{console.error("_do_sharing_controller_decode: main session _Set_Sharing_Encryption_Key_Directly ")},368461:()=>{console.error("_do_sharing_controller_decode: _Set_Sharing_Encryption_Key_Directly ")},368549:()=>{console.error("SHARING_DECODE_NETWORK_INFO WCLSharing is null")},368615:()=>{console.error("SHARING_DECODE_REQUEST_CHECK_ONE_TYPE WCLSharing is null")},368691:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA WCLSharing is null",$0,$1)},368764:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA type unknwon",$0,$1)},368831:($0,$1)=>{wcl_sharing_inited($0,$1)},368860:($0,$1,$2,$3,$4)=>{video_data_from_qos($0,$1,$2,$3,$4)},368905:($0,$1,$2,$3,$4,$5)=>{video_as_data_from_qos($0,$1,$2,$3,$4,$5)},368957:($0,$1)=>{wcl_trace_log($0,$1)},368981:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},369021:($0,$1)=>{COMMIT_PRINT($0,$1)},369043:()=>{videoencode_create_helpthread()},369078:($0,$1)=>{LOG_OUT($0,$1)},369099:($0,$1)=>{wcl_trace_log($0,$1)}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function killThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];delete PThread.pthreads[pthread_ptr];worker.terminate();__emscripten_thread_free_data(pthread_ptr);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0}function cancelThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];worker.postMessage({"cmd":"cancel"})}function cleanupThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];assert(worker);PThread.returnWorkerToPool(worker)}function spawnThread(threadParams){var worker=PThread.getNewWorker();if(!worker){return 6}PThread.runningWorkers.push(worker);PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={"cmd":"run","start_routine":threadParams.startRoutine,"arg":threadParams.arg,"pthread_ptr":threadParams.pthread_ptr};worker.runPthread=()=>{msg.time=performance.now();worker.postMessage(msg,threadParams.transferList);delete worker.runPthread};if(worker.loaded){worker.runPthread()}return 0}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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,GROWABLE_HEAP_I8(),ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}GROWABLE_HEAP_I32()[buf>>2]=stat.dev;GROWABLE_HEAP_I32()[buf+8>>2]=stat.ino;GROWABLE_HEAP_I32()[buf+12>>2]=stat.mode;GROWABLE_HEAP_U32()[buf+16>>2]=stat.nlink;GROWABLE_HEAP_I32()[buf+20>>2]=stat.uid;GROWABLE_HEAP_I32()[buf+24>>2]=stat.gid;GROWABLE_HEAP_I32()[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+40>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+44>>2]=tempI64[1];GROWABLE_HEAP_I32()[buf+48>>2]=4096;GROWABLE_HEAP_I32()[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+56>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+60>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+72>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+76>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+88>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+92>>2]=tempI64[1];GROWABLE_HEAP_U32()[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[buf+104>>2]=tempI64[0],GROWABLE_HEAP_I32()[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=GROWABLE_HEAP_U8().slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;if(!implicit){if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw"unwind"}else{}}_proc_exit(status)}var _exit=exitJS;function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}var PThread={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){if(ENVIRONMENT_IS_PTHREAD){PThread.initWorker()}else{PThread.initMainThread()}},initMainThread:function(){},initWorker:function(){noExitRuntime=false},setExitStatus:function(status){EXITSTATUS=status},terminateAllThreads:function(){for(var worker of Object.values(PThread.pthreads)){PThread.returnWorkerToPool(worker)}for(var worker of PThread.unusedWorkers){worker.terminate()}PThread.unusedWorkers=[]},returnWorkerToPool:function(worker){var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0;__emscripten_thread_free_data(pthread_ptr)},receiveObjectTransfer:function(data){},threadInitTLS:function(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=e=>{var d=e["data"];var cmd=d["cmd"];if(worker.pthread_ptr)PThread.currentProxiedOperationCallerThread=worker.pthread_ptr;if(d["targetThread"]&&d["targetThread"]!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];if(targetWorker){targetWorker.postMessage(d,d["transferList"])}else{err('Internal error! Worker sent a message "'+cmd+'" to target pthread '+d["targetThread"]+", but that thread no longer exists!")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd==="processProxyingQueue"){executeNotifiedProxyingQueue(d["queue"])}else if(cmd==="spawnThread"){spawnThread(d)}else if(cmd==="cleanupThread"){cleanupThread(d["thread"])}else if(cmd==="killThread"){killThread(d["thread"])}else if(cmd==="cancelThread"){cancelThread(d["thread"])}else if(cmd==="loaded"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread()}}else if(cmd==="print"){out("Thread "+d["threadId"]+": "+d["text"])}else if(cmd==="printErr"){err("Thread "+d["threadId"]+": "+d["text"])}else if(cmd==="alert"){alert("Thread "+d["threadId"]+": "+d["text"])}else if(d.target==="setimmediate"){worker.postMessage(d)}else if(cmd==="callHandler"){Module[d["handler"]](...d["args"])}else if(cmd){err("worker sent an unknown command "+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=e=>{var message="worker sent an error!";err(message+" "+e.filename+":"+e.lineno+": "+e.message);throw e};var handlers=[];var knownHandlers=["onExit","onAbort","print","printErr"];for(var handler of knownHandlers){if(Module.hasOwnProperty(handler)){handlers.push(handler)}}worker.postMessage({"cmd":"load","handlers":handlers,"urlOrBlob":Module["mainScriptUrlOrBlob"]||_scriptDir,"wasmMemory":wasmMemory,"wasmModule":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile("video.mtsimd.worker.js");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}return PThread.unusedWorkers.pop()}};Module["PThread"]=PThread;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(GROWABLE_HEAP_I32()[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function establishStackSpace(){var pthread_ptr=_pthread_self();var stackTop=GROWABLE_HEAP_I32()[pthread_ptr+52>>2];var stackSize=GROWABLE_HEAP_I32()[pthread_ptr+56>>2];var stackMax=stackTop-stackSize;_emscripten_stack_set_limits(stackTop,stackMax);stackRestore(stackTop)}Module["establishStackSpace"]=establishStackSpace;function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,0,returnCode);try{_exit(returnCode)}catch(e){handleException(e)}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function invokeEntryPoint(ptr,arg){var result=getWasmTableEntry(ptr)(arg);if(keepRuntimeAlive()){PThread.setExitStatus(result)}else{__emscripten_thread_exit(result)}}Module["invokeEntryPoint"]=invokeEntryPoint;function registerTLSInit(tlsInitFunc){PThread.tlsInitFunctions.push(tlsInitFunc)}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function _AdapterWhiteListCheck(){return checkWebCodecWhitelist_js()}function _CloseVideoEncoder(id){CloseVideoEncoder_js(id)}function _CreateGltPlatform(){err("missing function: CreateGltPlatform");abort(-1)}function _DestroyGltPlatform(){err("missing function: DestroyGltPlatform");abort(-1)}function _EncodeVideoFrameID(type,numb){return EncodeVideoFrameID_js(type,numb)}function _GetEncoderState(id){return GetEncoderState_js(id)}function _GetLogLevel(){return GetLogLevel_js()}function _InitVideoDecoder(id,context){return InitVideoDecoder_js(id,context)}function _InitVideoEncoder(id,context){return InitVideoEncoder_js(id,context)}function _LimitWebCodecsDecoderTo360(){return LimitWebCodecsDecoderTo360_js()}function _LimitWebCodecsEncoderTo360(){return LimitWebCodecsEncoderTo360_js()}function _Set_Share_Mode(flag){return Set_Share_Mode_js(flag)}function _UserAgentIsTesla(){return UserAgentIsTesla_js()}function _VideoDecoder(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount){return VideoDecoder_js(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount)}function _VideoDecoderConfigure(id,extradata,extraDataLen,Width,Height){return VideoDecoderConfigure_js(id,extradata,extraDataLen,Width,Height)}function _VideoEncoderConfigure(id,Bitrate,Framerate,Width,Height,bsBuffer){return VideoEncoderConfigure_js(id,Bitrate,Framerate,Width,Height,bsBuffer)}function _WebCodecsDecoderFail(m_iID){WebCodecsDecoderFail_js(m_iID)}function _WebCodecsEncoderFail(m_iID,code){WebCodecsEncoderFail_js(m_iID,code)}function _WebCodecsVideoEncoder(id,videoFrameId,NewIDR,rawData,dataLength,timeout){return VideoEncoder_js(id,videoFrameId,NewIDR,rawData,dataLength,timeout)}function __ZN11cpt_generic6thread4joinEv(){err("missing function: _ZN11cpt_generic6thread4joinEv");abort(-1)}function __ZN11cpt_generic6threadD1Ev(){err("missing function: _ZN11cpt_generic6threadD1Ev");abort(-1)}function __ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE(){err("missing function: _ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE");abort(-1)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){GROWABLE_HEAP_U32()[this.ptr+4>>2]=type};this.get_type=function(){return GROWABLE_HEAP_U32()[this.ptr+4>>2]};this.set_destructor=function(destructor){GROWABLE_HEAP_U32()[this.ptr+8>>2]=destructor};this.get_destructor=function(){return GROWABLE_HEAP_U32()[this.ptr+8>>2]};this.set_refcount=function(refcount){GROWABLE_HEAP_I32()[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;GROWABLE_HEAP_I8()[this.ptr+12>>0]=caught};this.get_caught=function(){return GROWABLE_HEAP_I8()[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;GROWABLE_HEAP_I8()[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return GROWABLE_HEAP_I8()[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){Atomics.add(GROWABLE_HEAP_I32(),this.ptr+0>>2,1)};this.release_ref=function(){var prev=Atomics.sub(GROWABLE_HEAP_I32(),this.ptr+0>>2,1);return prev===1};this.set_adjusted_ptr=function(adjustedPtr){GROWABLE_HEAP_U32()[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return GROWABLE_HEAP_U32()[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return GROWABLE_HEAP_U32()[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function ___emscripten_init_main_thread_js(tb){__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,!ENVIRONMENT_IS_WEB);PThread.threadInitTLS()}function ___emscripten_thread_cleanup(thread){if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({"cmd":"cleanupThread","thread":thread})}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){if(typeof SharedArrayBuffer=="undefined"){err("Current environment does not support SharedArrayBuffer, pthreads are not available!");return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine:startRoutine,pthread_ptr:pthread_ptr,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd="spawnThread";postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,nfds,readfds,writefds,exceptfds,timeout);try{var total=0;var srcReadLow=readfds?GROWABLE_HEAP_I32()[readfds>>2]:0,srcReadHigh=readfds?GROWABLE_HEAP_I32()[readfds+4>>2]:0;var srcWriteLow=writefds?GROWABLE_HEAP_I32()[writefds>>2]:0,srcWriteHigh=writefds?GROWABLE_HEAP_I32()[writefds+4>>2]:0;var srcExceptLow=exceptfds?GROWABLE_HEAP_I32()[exceptfds>>2]:0,srcExceptHigh=exceptfds?GROWABLE_HEAP_I32()[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?GROWABLE_HEAP_I32()[readfds>>2]:0)|(writefds?GROWABLE_HEAP_I32()[writefds>>2]:0)|(exceptfds?GROWABLE_HEAP_I32()[exceptfds>>2]:0);var allHigh=(readfds?GROWABLE_HEAP_I32()[readfds+4>>2]:0)|(writefds?GROWABLE_HEAP_I32()[writefds+4>>2]:0)|(exceptfds?GROWABLE_HEAP_I32()[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;GROWABLE_HEAP_I32()[readfds+4>>2]=dstReadHigh}if(writefds){GROWABLE_HEAP_I32()[writefds>>2]=dstWriteLow;GROWABLE_HEAP_I32()[writefds+4>>2]=dstWriteHigh}if(exceptfds){GROWABLE_HEAP_I32()[exceptfds>>2]=dstExceptLow;GROWABLE_HEAP_I32()[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}GROWABLE_HEAP_I32()[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(GROWABLE_HEAP_U16()[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=GROWABLE_HEAP_I32()[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[GROWABLE_HEAP_I32()[sa+8>>2],GROWABLE_HEAP_I32()[sa+12>>2],GROWABLE_HEAP_I32()[sa+16>>2],GROWABLE_HEAP_I32()[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(7,1,fd,buf);try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(8,1,buf,size);try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(10,1,path,buf);try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(11,1,dirfd,path,mode);try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(12,1,dirfd,path,buf,flags);try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(13,1,dirfd,path,flags,varargs);SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(14,1,fdPtr);try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();GROWABLE_HEAP_I32()[fdPtr>>2]=res.readable_fd;GROWABLE_HEAP_I32()[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(15,1,fds,nfds,timeout);try{var nonzero=0;for(var i=0;i>2];var events=GROWABLE_HEAP_I16()[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;GROWABLE_HEAP_I16()[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(16,1,domain,type,protocol);try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_stat64(path,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(17,1,path,buf);try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __emscripten_default_pthread_stack_size(){return 2097152}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function executeNotifiedProxyingQueue(queue){Atomics.store(GROWABLE_HEAP_I32(),queue>>2,1);if(_pthread_self()){__emscripten_proxy_execute_task_queue(queue)}Atomics.compareExchange(GROWABLE_HEAP_I32(),queue>>2,1,0)}Module["executeNotifiedProxyingQueue"]=executeNotifiedProxyingQueue;function __emscripten_notify_task_queue(targetThreadId,currThreadId,mainThreadId,queue){if(targetThreadId==currThreadId){setTimeout(()=>executeNotifiedProxyingQueue(queue))}else if(ENVIRONMENT_IS_PTHREAD){postMessage({"targetThread":targetThreadId,"cmd":"processProxyingQueue","queue":queue})}else{var worker=PThread.pthreads[targetThreadId];if(!worker){return}worker.postMessage({"cmd":"processProxyingQueue","queue":queue})}return 1}function __emscripten_set_offscreencanvas_size(target,width,height){return-1}function __emscripten_throw_longjmp(){throw Infinity}function readI53FromI64(ptr){return GROWABLE_HEAP_U32()[ptr>>2]+GROWABLE_HEAP_I32()[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);GROWABLE_HEAP_I32()[tmPtr>>2]=date.getUTCSeconds();GROWABLE_HEAP_I32()[tmPtr+4>>2]=date.getUTCMinutes();GROWABLE_HEAP_I32()[tmPtr+8>>2]=date.getUTCHours();GROWABLE_HEAP_I32()[tmPtr+12>>2]=date.getUTCDate();GROWABLE_HEAP_I32()[tmPtr+16>>2]=date.getUTCMonth();GROWABLE_HEAP_I32()[tmPtr+20>>2]=date.getUTCFullYear()-1900;GROWABLE_HEAP_I32()[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;GROWABLE_HEAP_I32()[tmPtr+28>>2]=yday}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);GROWABLE_HEAP_I32()[tmPtr>>2]=date.getSeconds();GROWABLE_HEAP_I32()[tmPtr+4>>2]=date.getMinutes();GROWABLE_HEAP_I32()[tmPtr+8>>2]=date.getHours();GROWABLE_HEAP_I32()[tmPtr+12>>2]=date.getDate();GROWABLE_HEAP_I32()[tmPtr+16>>2]=date.getMonth();GROWABLE_HEAP_I32()[tmPtr+20>>2]=date.getFullYear()-1900;GROWABLE_HEAP_I32()[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;GROWABLE_HEAP_I32()[tmPtr+28>>2]=yday;GROWABLE_HEAP_I32()[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;GROWABLE_HEAP_I32()[tmPtr+32>>2]=dst}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,GROWABLE_HEAP_I8(),ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);GROWABLE_HEAP_U32()[timezone>>2]=stdTimezoneOffset*60;GROWABLE_HEAP_I32()[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;GROWABLE_HEAP_U32()[tzname+4>>2]=summerNamePtr}else{GROWABLE_HEAP_U32()[tzname>>2]=summerNamePtr;GROWABLE_HEAP_U32()[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=GROWABLE_HEAP_U8()[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?GROWABLE_HEAP_I32()[buf]:GROWABLE_HEAP_F64()[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function runMainThreadEmAsm(code,sigPtr,argbuf,sync){var args=readEmAsmArgs(sigPtr,argbuf);if(ENVIRONMENT_IS_PTHREAD){return _emscripten_proxy_to_main_thread_js.apply(null,[-1-code,sync].concat(args))}return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int_sync_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,1)}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}function _emscripten_check_blocking_allowed(){if(ENVIRONMENT_IS_WORKER)return;warnOnce("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;if(ENVIRONMENT_IS_PTHREAD){_emscripten_get_now=()=>performance.now()-Module["__performance_now_clock_drift"]}else _emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var outerArgs=arguments;return withStackSave(()=>{var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){postMessage({status:-35,cmd:-35})}}function _emscripten_resize_heap(requestedSize){var oldSize=GROWABLE_HEAP_U8().length;requestedSize=requestedSize>>>0;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+1/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}function _emscripten_unwind_to_js_event_loop(){throw"unwind"}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)GROWABLE_HEAP_I8()[buffer>>0]=0}function _environ_get(__environ,environ_buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(18,1,__environ,environ_buf);var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;GROWABLE_HEAP_U32()[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(19,1,penviron_count,penviron_buf_size);var strings=getEnvStrings();GROWABLE_HEAP_U32()[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});GROWABLE_HEAP_U32()[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(20,1,fd);try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;var curr=FS.read(stream,GROWABLE_HEAP_I8(),ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(22,1,fd,offset_low,offset_high,whence,newOffset);try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],GROWABLE_HEAP_I32()[newOffset>>2]=tempI64[0],GROWABLE_HEAP_I32()[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;var curr=FS.write(stream,GROWABLE_HEAP_I8(),ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(23,1,fd,iov,iovcnt,pnum);try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);GROWABLE_HEAP_U32()[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _setCurrentThreadSsrc(ssrc){setCurrentThreadSsrc_js(ssrc)}function __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];function __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}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=GROWABLE_HEAP_I32()[tm+40>>2];var date={tm_sec:GROWABLE_HEAP_I32()[tm>>2],tm_min:GROWABLE_HEAP_I32()[tm+4>>2],tm_hour:GROWABLE_HEAP_I32()[tm+8>>2],tm_mday:GROWABLE_HEAP_I32()[tm+12>>2],tm_mon:GROWABLE_HEAP_I32()[tm+16>>2],tm_year:GROWABLE_HEAP_I32()[tm+20>>2],tm_wday:GROWABLE_HEAP_I32()[tm+24>>2],tm_yday:GROWABLE_HEAP_I32()[tm+28>>2],tm_isdst:GROWABLE_HEAP_I32()[tm+32>>2],tm_gmtoff:GROWABLE_HEAP_I32()[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function _zlt_tfjs_execute_afn(input_img,input_ref,input_msk,len,output_buffer){return execute_afn(input_img,input_ref,input_msk,len,output_buffer)}function _zlt_tfjs_execute_base_cls(input_buffer,len,output_buffer,output_len){return execute_base(input_buffer,len,output_buffer,output_len)}async function _zlt_tfjs_init(){}function _zoom_wcl_get_cpu_num(){return hardcodecpunumber()}function _zoom_wcl_get_csc_thread_num(){return 1}function _zoom_wcl_support_multi_thread(){return IsSupportMultiThread()}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}PThread.init();var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var proxiedFunctionTable=[null,_proc_exit,exitOnMainThread,pthreadCreateProxied,___syscall__newselect,___syscall_connect,___syscall_fcntl64,___syscall_fstat64,___syscall_getcwd,___syscall_ioctl,___syscall_lstat64,___syscall_mkdirat,___syscall_newfstatat,___syscall_openat,___syscall_pipe,___syscall_poll,___syscall_socket,___syscall_stat64,_environ_get,_environ_sizes_get,_fd_close,_fd_read,_fd_seek,_fd_write];var asmLibraryArg={"AdapterWhiteListCheck":_AdapterWhiteListCheck,"CloseVideoEncoder":_CloseVideoEncoder,"CreateGltPlatform":_CreateGltPlatform,"DestroyGltPlatform":_DestroyGltPlatform,"EncodeVideoFrameID":_EncodeVideoFrameID,"GetEncoderState":_GetEncoderState,"GetLogLevel":_GetLogLevel,"InitVideoDecoder":_InitVideoDecoder,"InitVideoEncoder":_InitVideoEncoder,"LimitWebCodecsDecoderTo360":_LimitWebCodecsDecoderTo360,"LimitWebCodecsEncoderTo360":_LimitWebCodecsEncoderTo360,"Set_Share_Mode":_Set_Share_Mode,"UserAgentIsTesla":_UserAgentIsTesla,"VideoDecoder":_VideoDecoder,"VideoDecoderConfigure":_VideoDecoderConfigure,"VideoEncoderConfigure":_VideoEncoderConfigure,"WebCodecsDecoderFail":_WebCodecsDecoderFail,"WebCodecsEncoderFail":_WebCodecsEncoderFail,"WebCodecsVideoEncoder":_WebCodecsVideoEncoder,"_ZN11cpt_generic6thread4joinEv":__ZN11cpt_generic6thread4joinEv,"_ZN11cpt_generic6threadD1Ev":__ZN11cpt_generic6threadD1Ev,"_ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE":__ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE,"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__emscripten_init_main_thread_js":___emscripten_init_main_thread_js,"__emscripten_thread_cleanup":___emscripten_thread_cleanup,"__pthread_create_js":___pthread_create_js,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_default_pthread_stack_size":__emscripten_default_pthread_stack_size,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_emscripten_notify_task_queue":__emscripten_notify_task_queue,"_emscripten_set_offscreencanvas_size":__emscripten_set_offscreencanvas_size,"_emscripten_throw_longjmp":__emscripten_throw_longjmp,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_asm_const_int_sync_on_main_thread":_emscripten_asm_const_int_sync_on_main_thread,"emscripten_check_blocking_allowed":_emscripten_check_blocking_allowed,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_receive_on_main_thread_js":_emscripten_receive_on_main_thread_js,"emscripten_resize_heap":_emscripten_resize_heap,"emscripten_unwind_to_js_event_loop":_emscripten_unwind_to_js_event_loop,"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_ii":invoke_ii,"invoke_iii":invoke_iii,"invoke_iiii":invoke_iiii,"invoke_vi":invoke_vi,"invoke_viii":invoke_viii,"memory":wasmMemory,"setCurrentThreadSsrc":_setCurrentThreadSsrc,"strftime":_strftime,"strftime_l":_strftime_l,"zlt_tfjs_execute_afn":_zlt_tfjs_execute_afn,"zlt_tfjs_execute_base_cls":_zlt_tfjs_execute_base_cls,"zlt_tfjs_init":_zlt_tfjs_init,"zoom_wcl_get_cpu_num":_zoom_wcl_get_cpu_num,"zoom_wcl_get_csc_thread_num":_zoom_wcl_get_csc_thread_num,"zoom_wcl_support_multi_thread":_zoom_wcl_support_multi_thread};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Video_Init=Module["__Video_Init"]=function(){return(__Video_Init=Module["__Video_Init"]=Module["asm"]["_Video_Init"]).apply(null,arguments)};var __Video_UnInit=Module["__Video_UnInit"]=function(){return(__Video_UnInit=Module["__Video_UnInit"]=Module["asm"]["_Video_UnInit"]).apply(null,arguments)};var __Video_Decode=Module["__Video_Decode"]=function(){return(__Video_Decode=Module["__Video_Decode"]=Module["asm"]["_Video_Decode"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __Video_Try_Analysis=Module["__Video_Try_Analysis"]=function(){return(__Video_Try_Analysis=Module["__Video_Try_Analysis"]=Module["asm"]["_Video_Try_Analysis"]).apply(null,arguments)};var __signal_video_controller_encode_pdu_info=Module["__signal_video_controller_encode_pdu_info"]=function(){return(__signal_video_controller_encode_pdu_info=Module["__signal_video_controller_encode_pdu_info"]=Module["asm"]["_signal_video_controller_encode_pdu_info"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __Video_Encode_YUV=Module["__Video_Encode_YUV"]=function(){return(__Video_Encode_YUV=Module["__Video_Encode_YUV"]=Module["asm"]["_Video_Encode_YUV"]).apply(null,arguments)};var __Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=function(){return(__Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=Module["asm"]["_Video_VirtualBackground_Special_Action"]).apply(null,arguments)};var __Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=function(){return(__Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=Module["asm"]["_Qos_Sender_Send_Data_In_Main_Thread"]).apply(null,arguments)};var __Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=function(){return(__Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=Module["asm"]["_Video_Websocket_Speed"]).apply(null,arguments)};var __Video_Start_Encode=Module["__Video_Start_Encode"]=function(){return(__Video_Start_Encode=Module["__Video_Start_Encode"]=Module["asm"]["_Video_Start_Encode"]).apply(null,arguments)};var __signal_video_controller_enocde_start_or_stop_encode=Module["__signal_video_controller_enocde_start_or_stop_encode"]=function(){return(__signal_video_controller_enocde_start_or_stop_encode=Module["__signal_video_controller_enocde_start_or_stop_encode"]=Module["asm"]["_signal_video_controller_enocde_start_or_stop_encode"]).apply(null,arguments)};var __Video_Stop_Encode=Module["__Video_Stop_Encode"]=function(){return(__Video_Stop_Encode=Module["__Video_Stop_Encode"]=Module["asm"]["_Video_Stop_Encode"]).apply(null,arguments)};var __Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=function(){return(__Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=Module["asm"]["_Request_Video_Qos_Data"]).apply(null,arguments)};var __signal_video_controller_enocde_request_check_one_type=Module["__signal_video_controller_enocde_request_check_one_type"]=function(){return(__signal_video_controller_enocde_request_check_one_type=Module["__signal_video_controller_enocde_request_check_one_type"]=Module["asm"]["_signal_video_controller_enocde_request_check_one_type"]).apply(null,arguments)};var __Video_Update_Format=Module["__Video_Update_Format"]=function(){return(__Video_Update_Format=Module["__Video_Update_Format"]=Module["asm"]["_Video_Update_Format"]).apply(null,arguments)};var __Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=function(){return(__Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=Module["asm"]["_Video_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=function(){return(__Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=Module["asm"]["_Add_Video_Cooker_info"]).apply(null,arguments)};var __signal_video_controller_encode_cooker_info=Module["__signal_video_controller_encode_cooker_info"]=function(){return(__signal_video_controller_encode_cooker_info=Module["__signal_video_controller_encode_cooker_info"]=Module["asm"]["_signal_video_controller_encode_cooker_info"]).apply(null,arguments)};var __Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=function(){return(__Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=Module["asm"]["_Remove_Video_Cooker_Info"]).apply(null,arguments)};var __Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=function(){return(__Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=Module["asm"]["_Get_Video_Meat_Weight"]).apply(null,arguments)};var __Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=function(){return(__Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=Module["asm"]["_Set_Max_Receiving_Channel_Num"]).apply(null,arguments)};var __update_sync_time=Module["__update_sync_time"]=function(){return(__update_sync_time=Module["__update_sync_time"]=Module["asm"]["_update_sync_time"]).apply(null,arguments)};var __release_video_receiving_channel=Module["__release_video_receiving_channel"]=function(){return(__release_video_receiving_channel=Module["__release_video_receiving_channel"]=Module["asm"]["_release_video_receiving_channel"]).apply(null,arguments)};var __change_hw_status=Module["__change_hw_status"]=function(){return(__change_hw_status=Module["__change_hw_status"]=Module["asm"]["_change_hw_status"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).apply(null,arguments)};var __update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=function(){return(__update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_video_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __create_vb_thread=Module["__create_vb_thread"]=function(){return(__create_vb_thread=Module["__create_vb_thread"]=Module["asm"]["_create_vb_thread"]).apply(null,arguments)};var __create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=function(){return(__create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=Module["asm"]["_create_vb_no_sab_thread"]).apply(null,arguments)};var __signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=function(){return(__signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=Module["asm"]["_signal_vb_thread_blur"]).apply(null,arguments)};var __signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=function(){return(__signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=Module["asm"]["_signal_vb_thread_bg"]).apply(null,arguments)};var __signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=function(){return(__signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=Module["asm"]["_signal_vb_thread_video_yuv"]).apply(null,arguments)};var __signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=function(){return(__signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=Module["asm"]["_signal_vb_thread_video_rgba"]).apply(null,arguments)};var __signal_vb_thread_close=Module["__signal_vb_thread_close"]=function(){return(__signal_vb_thread_close=Module["__signal_vb_thread_close"]=Module["asm"]["_signal_vb_thread_close"]).apply(null,arguments)};var __update_video_cropping_mode=Module["__update_video_cropping_mode"]=function(){return(__update_video_cropping_mode=Module["__update_video_cropping_mode"]=Module["asm"]["_update_video_cropping_mode"]).apply(null,arguments)};var __collect_video_monitor_info=Module["__collect_video_monitor_info"]=function(){return(__collect_video_monitor_info=Module["__collect_video_monitor_info"]=Module["asm"]["_collect_video_monitor_info"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __Create_HW_Encode=Module["__Create_HW_Encode"]=function(){return(__Create_HW_Encode=Module["__Create_HW_Encode"]=Module["asm"]["_Create_HW_Encode"]).apply(null,arguments)};var __Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=function(){return(__Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=Module["asm"]["_Sharing_Encode_Init"]).apply(null,arguments)};var __Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=function(){return(__Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=Module["asm"]["_Sharing_Encode_Try_Analysis"]).apply(null,arguments)};var __signal_sharing_controller_encode_pdu_info=Module["__signal_sharing_controller_encode_pdu_info"]=function(){return(__signal_sharing_controller_encode_pdu_info=Module["__signal_sharing_controller_encode_pdu_info"]=Module["asm"]["_signal_sharing_controller_encode_pdu_info"]).apply(null,arguments)};var __Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=function(){return(__Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=Module["asm"]["_Sharing_Encode_Uninit"]).apply(null,arguments)};var __Sharing_Encode=Module["__Sharing_Encode"]=function(){return(__Sharing_Encode=Module["__Sharing_Encode"]=Module["asm"]["_Sharing_Encode"]).apply(null,arguments)};var __signal_sharing_controller_encode_yuv=Module["__signal_sharing_controller_encode_yuv"]=function(){return(__signal_sharing_controller_encode_yuv=Module["__signal_sharing_controller_encode_yuv"]=Module["asm"]["_signal_sharing_controller_encode_yuv"]).apply(null,arguments)};var __Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=function(){return(__Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=Module["asm"]["_Sharing_Encode_Mouse_Data"]).apply(null,arguments)};var __signal_sharing_controller_encode_mouse_data=Module["__signal_sharing_controller_encode_mouse_data"]=function(){return(__signal_sharing_controller_encode_mouse_data=Module["__signal_sharing_controller_encode_mouse_data"]=Module["asm"]["_signal_sharing_controller_encode_mouse_data"]).apply(null,arguments)};var __Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=function(){return(__Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=Module["asm"]["_Request_Sharing_Qos_Data"]).apply(null,arguments)};var __signal_sharing_controller_enocde_request_check_one_type=Module["__signal_sharing_controller_enocde_request_check_one_type"]=function(){return(__signal_sharing_controller_enocde_request_check_one_type=Module["__signal_sharing_controller_enocde_request_check_one_type"]=Module["asm"]["_signal_sharing_controller_enocde_request_check_one_type"]).apply(null,arguments)};var __signal_sharing_controller_decode_request_check_one_type=Module["__signal_sharing_controller_decode_request_check_one_type"]=function(){return(__signal_sharing_controller_decode_request_check_one_type=Module["__signal_sharing_controller_decode_request_check_one_type"]=Module["asm"]["_signal_sharing_controller_decode_request_check_one_type"]).apply(null,arguments)};var __Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=function(){return(__Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=Module["asm"]["_Sharing_Set_Data_Encryption"]).apply(null,arguments)};var __Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=function(){return(__Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=Module["asm"]["_Sharing_Pause_Encode"]).apply(null,arguments)};var __Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=function(){return(__Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=Module["asm"]["_Sharing_Resume_Encode"]).apply(null,arguments)};var __Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=function(){return(__Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=Module["asm"]["_Sharing_Stop_Encode"]).apply(null,arguments)};var __Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=function(){return(__Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=Module["asm"]["_Sharing_Websocket_Speed"]).apply(null,arguments)};var __Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=function(){return(__Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=Module["asm"]["_Add_Sharing_Cooker_info"]).apply(null,arguments)};var __Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=function(){return(__Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=Module["asm"]["_Remove_Sharing_Cooker_Info"]).apply(null,arguments)};var __Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=function(){return(__Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=Module["asm"]["_Get_Sharing_Meat_Weight"]).apply(null,arguments)};var __Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=function(){return(__Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=Module["asm"]["_Set_Sharing_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Add_Rev_Channel=Module["__Add_Rev_Channel"]=function(){return(__Add_Rev_Channel=Module["__Add_Rev_Channel"]=Module["asm"]["_Add_Rev_Channel"]).apply(null,arguments)};var __Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=function(){return(__Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=Module["asm"]["_Remove_Rev_Channel"]).apply(null,arguments)};var __update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=function(){return(__update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_sharing_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var __collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=function(){return(__collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=Module["asm"]["_collect_sharing_monitor_info"]).apply(null,arguments)};var __set_annotation_action=Module["__set_annotation_action"]=function(){return(__set_annotation_action=Module["__set_annotation_action"]=Module["asm"]["_set_annotation_action"]).apply(null,arguments)};var __request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=function(){return(__request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=Module["asm"]["_request_nack_t_periodically_for_sharing_qos"]).apply(null,arguments)};var __Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=function(){return(__Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=Module["asm"]["_Change_Connect_Type_For_Sharing"]).apply(null,arguments)};var __Jpeg_Init=Module["__Jpeg_Init"]=function(){return(__Jpeg_Init=Module["__Jpeg_Init"]=Module["asm"]["_Jpeg_Init"]).apply(null,arguments)};var __Jpeg_Uninit=Module["__Jpeg_Uninit"]=function(){return(__Jpeg_Uninit=Module["__Jpeg_Uninit"]=Module["asm"]["_Jpeg_Uninit"]).apply(null,arguments)};var __Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=function(){return(__Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=Module["asm"]["_Jpeg_HeardInfo"]).apply(null,arguments)};var __Jpeg_Decode=Module["__Jpeg_Decode"]=function(){return(__Jpeg_Decode=Module["__Jpeg_Decode"]=Module["asm"]["_Jpeg_Decode"]).apply(null,arguments)};var __signal_video_controller_encode_init_info=Module["__signal_video_controller_encode_init_info"]=function(){return(__signal_video_controller_encode_init_info=Module["__signal_video_controller_encode_init_info"]=Module["asm"]["_signal_video_controller_encode_init_info"]).apply(null,arguments)};var __signal_video_controller_encode_yuv=Module["__signal_video_controller_encode_yuv"]=function(){return(__signal_video_controller_encode_yuv=Module["__signal_video_controller_encode_yuv"]=Module["asm"]["_signal_video_controller_encode_yuv"]).apply(null,arguments)};var __signal_video_controller_encode_rgba=Module["__signal_video_controller_encode_rgba"]=function(){return(__signal_video_controller_encode_rgba=Module["__signal_video_controller_encode_rgba"]=Module["asm"]["_signal_video_controller_encode_rgba"]).apply(null,arguments)};var __signal_video_controller_encode_hw_info=Module["__signal_video_controller_encode_hw_info"]=function(){return(__signal_video_controller_encode_hw_info=Module["__signal_video_controller_encode_hw_info"]=Module["asm"]["_signal_video_controller_encode_hw_info"]).apply(null,arguments)};var __signal_video_controller_change_connect_type=Module["__signal_video_controller_change_connect_type"]=function(){return(__signal_video_controller_change_connect_type=Module["__signal_video_controller_change_connect_type"]=Module["asm"]["_signal_video_controller_change_connect_type"]).apply(null,arguments)};var __create_video_encode_thread=Module["__create_video_encode_thread"]=function(){return(__create_video_encode_thread=Module["__create_video_encode_thread"]=Module["asm"]["_create_video_encode_thread"]).apply(null,arguments)};var __singal_video_controller_fec_info=Module["__singal_video_controller_fec_info"]=function(){return(__singal_video_controller_fec_info=Module["__singal_video_controller_fec_info"]=Module["asm"]["_singal_video_controller_fec_info"]).apply(null,arguments)};var __singal_video_controller_bandwidth_alloc=Module["__singal_video_controller_bandwidth_alloc"]=function(){return(__singal_video_controller_bandwidth_alloc=Module["__singal_video_controller_bandwidth_alloc"]=Module["asm"]["_singal_video_controller_bandwidth_alloc"]).apply(null,arguments)};var __signal_video_share_flag=Module["__signal_video_share_flag"]=function(){return(__signal_video_share_flag=Module["__signal_video_share_flag"]=Module["asm"]["_signal_video_share_flag"]).apply(null,arguments)};var __signal_video_controller_encode_uninit=Module["__signal_video_controller_encode_uninit"]=function(){return(__signal_video_controller_encode_uninit=Module["__signal_video_controller_encode_uninit"]=Module["asm"]["_signal_video_controller_encode_uninit"]).apply(null,arguments)};var __create_video_decode_thread=Module["__create_video_decode_thread"]=function(){return(__create_video_decode_thread=Module["__create_video_decode_thread"]=Module["asm"]["_create_video_decode_thread"]).apply(null,arguments)};var __signal_video_controller_decode_init_info=Module["__signal_video_controller_decode_init_info"]=function(){return(__signal_video_controller_decode_init_info=Module["__signal_video_controller_decode_init_info"]=Module["asm"]["_signal_video_controller_decode_init_info"]).apply(null,arguments)};var __signal_video_controller_decode_close=Module["__signal_video_controller_decode_close"]=function(){return(__signal_video_controller_decode_close=Module["__signal_video_controller_decode_close"]=Module["asm"]["_signal_video_controller_decode_close"]).apply(null,arguments)};var __signal_video_controller_decode_hw_info=Module["__signal_video_controller_decode_hw_info"]=function(){return(__signal_video_controller_decode_hw_info=Module["__signal_video_controller_decode_hw_info"]=Module["asm"]["_signal_video_controller_decode_hw_info"]).apply(null,arguments)};var __signal_video_controller_decode_uninit=Module["__signal_video_controller_decode_uninit"]=function(){return(__signal_video_controller_decode_uninit=Module["__signal_video_controller_decode_uninit"]=Module["asm"]["_signal_video_controller_decode_uninit"]).apply(null,arguments)};var __proxy_videocodec_create_helpthread=Module["__proxy_videocodec_create_helpthread"]=function(){return(__proxy_videocodec_create_helpthread=Module["__proxy_videocodec_create_helpthread"]=Module["asm"]["_proxy_videocodec_create_helpthread"]).apply(null,arguments)};var __create_sharing_encode_thread=Module["__create_sharing_encode_thread"]=function(){return(__create_sharing_encode_thread=Module["__create_sharing_encode_thread"]=Module["asm"]["_create_sharing_encode_thread"]).apply(null,arguments)};var __signal_sharing_controller_encode_init_info=Module["__signal_sharing_controller_encode_init_info"]=function(){return(__signal_sharing_controller_encode_init_info=Module["__signal_sharing_controller_encode_init_info"]=Module["asm"]["_signal_sharing_controller_encode_init_info"]).apply(null,arguments)};var __signal_sharing_controller_encode_uninit=Module["__signal_sharing_controller_encode_uninit"]=function(){return(__signal_sharing_controller_encode_uninit=Module["__signal_sharing_controller_encode_uninit"]=Module["asm"]["_signal_sharing_controller_encode_uninit"]).apply(null,arguments)};var __create_sharing_decode_thread=Module["__create_sharing_decode_thread"]=function(){return(__create_sharing_decode_thread=Module["__create_sharing_decode_thread"]=Module["asm"]["_create_sharing_decode_thread"]).apply(null,arguments)};var __signal_sharing_controller_decode_init_info=Module["__signal_sharing_controller_decode_init_info"]=function(){return(__signal_sharing_controller_decode_init_info=Module["__signal_sharing_controller_decode_init_info"]=Module["asm"]["_signal_sharing_controller_decode_init_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_meeting_key=Module["__signal_sharing_controller_decode_meeting_key"]=function(){return(__signal_sharing_controller_decode_meeting_key=Module["__signal_sharing_controller_decode_meeting_key"]=Module["asm"]["_signal_sharing_controller_decode_meeting_key"]).apply(null,arguments)};var __signal_sharing_controller_decode_pdu_info=Module["__signal_sharing_controller_decode_pdu_info"]=function(){return(__signal_sharing_controller_decode_pdu_info=Module["__signal_sharing_controller_decode_pdu_info"]=Module["asm"]["_signal_sharing_controller_decode_pdu_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_meeting_cooker=Module["__signal_sharing_controller_decode_meeting_cooker"]=function(){return(__signal_sharing_controller_decode_meeting_cooker=Module["__signal_sharing_controller_decode_meeting_cooker"]=Module["asm"]["_signal_sharing_controller_decode_meeting_cooker"]).apply(null,arguments)};var __signal_sharing_controller_decode_roster_info=Module["__signal_sharing_controller_decode_roster_info"]=function(){return(__signal_sharing_controller_decode_roster_info=Module["__signal_sharing_controller_decode_roster_info"]=Module["asm"]["_signal_sharing_controller_decode_roster_info"]).apply(null,arguments)};var __signal_sharing_controller_decode_rev_channel=Module["__signal_sharing_controller_decode_rev_channel"]=function(){return(__signal_sharing_controller_decode_rev_channel=Module["__signal_sharing_controller_decode_rev_channel"]=Module["asm"]["_signal_sharing_controller_decode_rev_channel"]).apply(null,arguments)};var __singal_sharing_controller_decode_close=Module["__singal_sharing_controller_decode_close"]=function(){return(__singal_sharing_controller_decode_close=Module["__singal_sharing_controller_decode_close"]=Module["asm"]["_singal_sharing_controller_decode_close"]).apply(null,arguments)};var __signal_sharing_controller_decode_uninit=Module["__signal_sharing_controller_decode_uninit"]=function(){return(__signal_sharing_controller_decode_uninit=Module["__signal_sharing_controller_decode_uninit"]=Module["asm"]["_signal_sharing_controller_decode_uninit"]).apply(null,arguments)};var __Qos_Init=Module["__Qos_Init"]=function(){return(__Qos_Init=Module["__Qos_Init"]=Module["asm"]["_Qos_Init"]).apply(null,arguments)};var __Qos_UnInit=Module["__Qos_UnInit"]=function(){return(__Qos_UnInit=Module["__Qos_UnInit"]=Module["asm"]["_Qos_UnInit"]).apply(null,arguments)};var __Qos_Start_Send=Module["__Qos_Start_Send"]=function(){return(__Qos_Start_Send=Module["__Qos_Start_Send"]=Module["asm"]["_Qos_Start_Send"]).apply(null,arguments)};var __Qos_Stop_Send=Module["__Qos_Stop_Send"]=function(){return(__Qos_Stop_Send=Module["__Qos_Stop_Send"]=Module["asm"]["_Qos_Stop_Send"]).apply(null,arguments)};var __Qos_Change_Connect_Type_Or_Video_Share=Module["__Qos_Change_Connect_Type_Or_Video_Share"]=function(){return(__Qos_Change_Connect_Type_Or_Video_Share=Module["__Qos_Change_Connect_Type_Or_Video_Share"]=Module["asm"]["_Qos_Change_Connect_Type_Or_Video_Share"]).apply(null,arguments)};var __Qos_Send_Data_Packet=Module["__Qos_Send_Data_Packet"]=function(){return(__Qos_Send_Data_Packet=Module["__Qos_Send_Data_Packet"]=Module["asm"]["_Qos_Send_Data_Packet"]).apply(null,arguments)};var __Qos_Send_Data_Multi_Packet=Module["__Qos_Send_Data_Multi_Packet"]=function(){return(__Qos_Send_Data_Multi_Packet=Module["__Qos_Send_Data_Multi_Packet"]=Module["asm"]["_Qos_Send_Data_Multi_Packet"]).apply(null,arguments)};var __Qos_Data_From_Rwg=Module["__Qos_Data_From_Rwg"]=function(){return(__Qos_Data_From_Rwg=Module["__Qos_Data_From_Rwg"]=Module["asm"]["_Qos_Data_From_Rwg"]).apply(null,arguments)};var __Qos_AS_Data_From_Rwg=Module["__Qos_AS_Data_From_Rwg"]=function(){return(__Qos_AS_Data_From_Rwg=Module["__Qos_AS_Data_From_Rwg"]=Module["asm"]["_Qos_AS_Data_From_Rwg"]).apply(null,arguments)};var __Qos_Smooth_Send_Periodically_For_Qos=Module["__Qos_Smooth_Send_Periodically_For_Qos"]=function(){return(__Qos_Smooth_Send_Periodically_For_Qos=Module["__Qos_Smooth_Send_Periodically_For_Qos"]=Module["asm"]["_Qos_Smooth_Send_Periodically_For_Qos"]).apply(null,arguments)};var __Qos_Request_Nack_T_Periodically_For_Qos=Module["__Qos_Request_Nack_T_Periodically_For_Qos"]=function(){return(__Qos_Request_Nack_T_Periodically_For_Qos=Module["__Qos_Request_Nack_T_Periodically_For_Qos"]=Module["asm"]["_Qos_Request_Nack_T_Periodically_For_Qos"]).apply(null,arguments)};var __Qos_Update_Required_Bandwidth=Module["__Qos_Update_Required_Bandwidth"]=function(){return(__Qos_Update_Required_Bandwidth=Module["__Qos_Update_Required_Bandwidth"]=Module["asm"]["_Qos_Update_Required_Bandwidth"]).apply(null,arguments)};var __Qos_Update_Video_Hd_Info=Module["__Qos_Update_Video_Hd_Info"]=function(){return(__Qos_Update_Video_Hd_Info=Module["__Qos_Update_Video_Hd_Info"]=Module["asm"]["_Qos_Update_Video_Hd_Info"]).apply(null,arguments)};var __Qos_Reset_As_Qos_Buffer=Module["__Qos_Reset_As_Qos_Buffer"]=function(){return(__Qos_Reset_As_Qos_Buffer=Module["__Qos_Reset_As_Qos_Buffer"]=Module["asm"]["_Qos_Reset_As_Qos_Buffer"]).apply(null,arguments)};var __Qos_Add_Recv_SSRC=Module["__Qos_Add_Recv_SSRC"]=function(){return(__Qos_Add_Recv_SSRC=Module["__Qos_Add_Recv_SSRC"]=Module["asm"]["_Qos_Add_Recv_SSRC"]).apply(null,arguments)};var __Qos_Remove_Recv_SSRC=Module["__Qos_Remove_Recv_SSRC"]=function(){return(__Qos_Remove_Recv_SSRC=Module["__Qos_Remove_Recv_SSRC"]=Module["asm"]["_Qos_Remove_Recv_SSRC"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=function(){return(_OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=Module["asm"]["OnVideoFrameOutputCallback"]).apply(null,arguments)};var _OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=function(){return(_OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=Module["asm"]["OnEncodedVideoChunkOutputCallback"]).apply(null,arguments)};var _pthread_self=Module["_pthread_self"]=function(){return(_pthread_self=Module["_pthread_self"]=Module["asm"]["pthread_self"]).apply(null,arguments)};var _saveSetjmp=Module["_saveSetjmp"]=function(){return(_saveSetjmp=Module["_saveSetjmp"]=Module["asm"]["saveSetjmp"]).apply(null,arguments)};var __emscripten_tls_init=Module["__emscripten_tls_init"]=function(){return(__emscripten_tls_init=Module["__emscripten_tls_init"]=Module["asm"]["_emscripten_tls_init"]).apply(null,arguments)};var __emscripten_thread_init=Module["__emscripten_thread_init"]=function(){return(__emscripten_thread_init=Module["__emscripten_thread_init"]=Module["asm"]["_emscripten_thread_init"]).apply(null,arguments)};var __emscripten_thread_crashed=Module["__emscripten_thread_crashed"]=function(){return(__emscripten_thread_crashed=Module["__emscripten_thread_crashed"]=Module["asm"]["_emscripten_thread_crashed"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=function(){return(_emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=Module["asm"]["emscripten_main_thread_process_queued_calls"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _emscripten_main_browser_thread_id=Module["_emscripten_main_browser_thread_id"]=function(){return(_emscripten_main_browser_thread_id=Module["_emscripten_main_browser_thread_id"]=Module["asm"]["emscripten_main_browser_thread_id"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module["_emscripten_run_in_main_runtime_thread_js"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module["_emscripten_run_in_main_runtime_thread_js"]=Module["asm"]["emscripten_run_in_main_runtime_thread_js"]).apply(null,arguments)};var _emscripten_dispatch_to_thread_=Module["_emscripten_dispatch_to_thread_"]=function(){return(_emscripten_dispatch_to_thread_=Module["_emscripten_dispatch_to_thread_"]=Module["asm"]["emscripten_dispatch_to_thread_"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var __emscripten_proxy_execute_task_queue=Module["__emscripten_proxy_execute_task_queue"]=function(){return(__emscripten_proxy_execute_task_queue=Module["__emscripten_proxy_execute_task_queue"]=Module["asm"]["_emscripten_proxy_execute_task_queue"]).apply(null,arguments)};var __emscripten_thread_free_data=Module["__emscripten_thread_free_data"]=function(){return(__emscripten_thread_free_data=Module["__emscripten_thread_free_data"]=Module["asm"]["_emscripten_thread_free_data"]).apply(null,arguments)};var __emscripten_thread_exit=Module["__emscripten_thread_exit"]=function(){return(__emscripten_thread_exit=Module["__emscripten_thread_exit"]=Module["asm"]["_emscripten_thread_exit"]).apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return(_setThrew=Module["_setThrew"]=Module["asm"]["setThrew"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module["_emscripten_stack_set_limits"]=function(){return(_emscripten_stack_set_limits=Module["_emscripten_stack_set_limits"]=Module["asm"]["emscripten_stack_set_limits"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiii"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiijii=Module["dynCall_iiijii"]=function(){return(dynCall_iiijii=Module["dynCall_iiijii"]=Module["asm"]["dynCall_iiijii"]).apply(null,arguments)};var dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=function(){return(dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiij"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=function(){return(dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=Module["asm"]["dynCall_iiiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiiij"]).apply(null,arguments)};var dynCall_viiiiiij=Module["dynCall_viiiiiij"]=function(){return(dynCall_viiiiiij=Module["dynCall_viiiiiij"]=Module["asm"]["dynCall_viiiiiij"]).apply(null,arguments)};var dynCall_viji=Module["dynCall_viji"]=function(){return(dynCall_viji=Module["dynCall_viji"]=Module["asm"]["dynCall_viji"]).apply(null,arguments)};var dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=function(){return(dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=Module["asm"]["dynCall_iiiiiiji"]).apply(null,arguments)};var dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=function(){return(dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=Module["asm"]["dynCall_iiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiij"]).apply(null,arguments)};var dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=function(){return(dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiij"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_jiiiiii=Module["dynCall_jiiiiii"]=function(){return(dynCall_jiiiiii=Module["dynCall_jiiiiii"]=Module["asm"]["dynCall_jiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}Module["keepRuntimeAlive"]=keepRuntimeAlive;Module["wasmMemory"]=wasmMemory;Module["cwrap"]=cwrap;Module["ExitStatus"]=ExitStatus;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){initRuntime();postMessage({"cmd":"loaded"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); +` +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var objectUrl = URL.createObjectURL((new Blob([Module["mainScriptUrlOrBlob"]],{type:"application/javascript"}))) +Module["mainScriptUrlOrBlob"]=new Blob([Module["mainScriptUrlOrBlob"]],{type:"application/javascript"}); +(function wasmWaitForMemory(){ +let that = self; +return new Promise((resolve, reject) => { +postMessage({ status: 'WFMO' }) +const listenForWasmMemory = (e) => { +let data = e.data; +if (data.command === 'wasmMemory') { +Module['wasmMemory'] = data.data; +that.removeEventListener('message', listenForWasmMemory); +resolve(); +} +} +that.addEventListener('message', listenForWasmMemory); +}) +})().then(()=>{ +importScripts(objectUrl); +URL.revokeObjectURL(objectUrl); +}); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/sharing_s.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_s.min.js new file mode 100644 index 0000000..78996db --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_s.min.js @@ -0,0 +1,28 @@ +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=56)}([function(e,t,r){var i=r(37),n=r(32);e.exports=function(e,t){var r=n(e,t,"get");return i(e,r)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(38),n=r(32);e.exports=function(e,t,r){var s=n(e,t,"set");return i(e,s,r),r},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"C",(function(){return i})),r.d(t,"j",(function(){return n})),r.d(t,"t",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"v",(function(){return o})),r.d(t,"x",(function(){return h})),r.d(t,"p",(function(){return u})),r.d(t,"s",(function(){return l})),r.d(t,"q",(function(){return c})),r.d(t,"r",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"w",(function(){return g})),r.d(t,"g",(function(){return m})),r.d(t,"y",(function(){return _})),r.d(t,"z",(function(){return v})),r.d(t,"A",(function(){return b})),r.d(t,"B",(function(){return w})),r.d(t,"e",(function(){return y})),r.d(t,"d",(function(){return x})),r.d(t,"c",(function(){return T})),r.d(t,"f",(function(){return R})),r.d(t,"n",(function(){return E})),r.d(t,"o",(function(){return S})),r.d(t,"m",(function(){return A})),r.d(t,"l",(function(){return k})),r.d(t,"h",(function(){return M})),r.d(t,"u",(function(){return C})),r.d(t,"i",(function(){return P}));const i={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},n={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},s={AVAILABLE:0,VIDEO:1,SHARE:2},a={IDLE:0,PENDING:1,READY:2,RENDERING:3},o={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},h={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},u=0,l=1,c=2,d=3,f=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],p=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},m=["intel","nvidia","apple","amd","qualcomm","arm"],_="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n struct FsUniforms {\n rotation: f32,\n };\n\n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n\n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n",v="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(6) var vertexUniforms: FsUniforms;\n\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n\n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var vPlaneTex: texture_2d;\n @group(0) @binding(5) var uniforms: FsUniforms;\n // @group(0) @binding(7) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n return color;\n }\n",b="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(5) var vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var uniforms: FsUniforms;\n // @group(0) @binding(5) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n\n return color;\n }\n",w="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n",y="\n\n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n\n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d;\n @group(0) @binding(2) var uniforms: FsUniforms;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n\n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n\n return color;\n }\n",x="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4 {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n",T="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n\n struct ClearColorUniforms {\n clearColor: vec4,\n };\n\n @group(0) @binding(0) var uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4 {\n return uniforms.clearColor;\n }\n",R={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},E={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},S={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},A=[60,120,180,360,540,720,1080,2160],k={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},M=6,C=[180,360,540,720,1080,2160],P=5},function(e,t,r){"use strict";var i=r(5),n=r(16);new Error;const s=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,h=null;function u(e,t){var r,i;if(!function(e){const t=performance.now();return(!s.has(e)||t-s.get(e)>5e3)&&(s.set(e,t),!0)}(e))return;let u;try{u=a("object"==typeof t?JSON.stringify(t):t)}catch(e){u=a(t)}null===(r=h)||void 0===r||r("NEM-".concat(e,"-").concat(u)),n.a.error("NotifyUIError,event=".concat(e,",data=").concat(u)),null===(i=o)||void 0===i||i(e,t)}var l=r(15);function c(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function p(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function g(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const r=await new Promise((e,t)=>{const r=i=>{let n=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===n.command?(y("DE"),self.removeEventListener("message",r),e(n.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===n.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),y("DS"),postMessage({status:i.E,url:wasmUrl})});let n=await WebAssembly.instantiate(r,e);n.instance?(self.wasmModuleToShare=n.module,t(n.instance)):(self.wasmModuleToShare=r,t(n))}catch(e){y("IF"),b("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}r.d(t,"d",(function(){return c})),r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"c",(function(){return g})),r.d(t,"q",(function(){return m})),r.d(t,"i",(function(){return v})),r.d(t,"u",(function(){return b})),r.d(t,"t",(function(){return w})),r.d(t,"o",(function(){return y})),r.d(t,"n",(function(){return x})),r.d(t,"v",(function(){return T})),r.d(t,"w",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"s",(function(){return A})),r.d(t,"k",(function(){return k})),r.d(t,"m",(function(){return M})),r.d(t,"r",(function(){return L})),r.d(t,"l",(function(){return I})),r.d(t,"x",(function(){return W})),r.d(t,"b",(function(){return N})),r.d(t,"h",(function(){return F})),r.d(t,"y",(function(){return V})),r.d(t,"a",(function(){return z})),r.d(t,"j",(function(){return H}));const _="function"!=typeof importScripts;function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_?n.a.error(e,t):b(e,t)}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var r,n,s,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(r=t)||void 0===r?void 0:r.message)+" Stack: "+(null!==(n=null===(s=t)||void 0===s||null===(s=s.error)||void 0===s?void 0:s.stack)&&void 0!==n?n:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:i.G,errorMessage:e,errorEvent:t})}function w(e){postMessage({status:i.G,errorMessage:e,level:"low"})}function y(e){postMessage({status:i.zb,data:e})}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:i.f,data:e});postMessage({status:i.f,data:e})}function T(e){postMessage({status:i.M,canvasId:e,replaceCanvas:!1})}function R(e){postMessage({status:i.N,canvasId:e})}function E(e){_?u(l.k,e):postMessage({status:i.Bb,where:e})}function S(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function A(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(r){t=null==e?void 0:e.getContext("2d")}return t||b("get2DContextFromCanvas return null"),t}class k{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let r=0;r0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new S;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class M{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),i=r>e?r:e;if(i+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(i)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){b("Error in YuvWrap.recycle: ".concat(e))}}}function C(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function P(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const U=["","MOZ_","OP_","WEBKIT_"];function L(e,t){for(var r=0;r0&&(t+="&index="+e);let r={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:C,onclose:P,group:this,index:e},i=new O(r);await i.connect(),this.transportArray[e]=i}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const D=new Map,B=[90,180,360,720,1080],G=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,r)=>{const i=this.ssrcInfoMap.get(r);i&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))})}_notifyFPS(e,t){postMessage({status:i.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function W(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:n,r_h:s,rotation:a,ssrc:o}=e;let h=1==a||3==a,u=h?s:n,l=h?n:s;const c=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!D.get(c)||D.get(c).width!==u||D.get(c).height!==l){const e={width:u,height:l,ssrc:c,quality:f};D.set(c,e),r?r(e):postMessage({status:i.v,data:e})}t&&G.updateSSRCInfo(c,Date.now())}function N(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function F(e,t,r,i,n){if(!n&&!i||1==e)return!1;let s=i&&t>=640,a=n&&t>=1280;return 2!=e||640==t&&480==r?s||a:((s||a)&&v("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}function V(e,t){e?e.send(t):b("websocket is null",new Error("message type ".concat(t[0])))}function z(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function H(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,r){"use strict";r.d(t,"y",(function(){return i})),r.d(t,"Y",(function(){return n})),r.d(t,"L",(function(){return s})),r.d(t,"K",(function(){return a})),r.d(t,"J",(function(){return o})),r.d(t,"v",(function(){return h})),r.d(t,"q",(function(){return u})),r.d(t,"r",(function(){return l})),r.d(t,"w",(function(){return c})),r.d(t,"x",(function(){return d})),r.d(t,"u",(function(){return f})),r.d(t,"X",(function(){return p})),r.d(t,"P",(function(){return g})),r.d(t,"Q",(function(){return m})),r.d(t,"O",(function(){return _})),r.d(t,"M",(function(){return v})),r.d(t,"s",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"n",(function(){return y})),r.d(t,"l",(function(){return x})),r.d(t,"m",(function(){return T})),r.d(t,"db",(function(){return R})),r.d(t,"B",(function(){return E})),r.d(t,"C",(function(){return S})),r.d(t,"W",(function(){return A})),r.d(t,"ab",(function(){return k})),r.d(t,"V",(function(){return M})),r.d(t,"Z",(function(){return C})),r.d(t,"N",(function(){return P})),r.d(t,"h",(function(){return U})),r.d(t,"g",(function(){return L})),r.d(t,"f",(function(){return I})),r.d(t,"A",(function(){return O})),r.d(t,"z",(function(){return D})),r.d(t,"S",(function(){return B})),r.d(t,"R",(function(){return G})),r.d(t,"e",(function(){return W})),r.d(t,"o",(function(){return N})),r.d(t,"T",(function(){return F})),r.d(t,"U",(function(){return V})),r.d(t,"G",(function(){return z})),r.d(t,"E",(function(){return H})),r.d(t,"H",(function(){return j})),r.d(t,"I",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"bb",(function(){return q})),r.d(t,"c",(function(){return K})),r.d(t,"b",(function(){return Q})),r.d(t,"cb",(function(){return Z})),r.d(t,"d",(function(){return J})),r.d(t,"t",(function(){return $})),r.d(t,"D",(function(){return ee})),r.d(t,"p",(function(){return te})),r.d(t,"a",(function(){return re})),r.d(t,"j",(function(){return ie})),r.d(t,"i",(function(){return ne}));const i=1e3,n=5,s=43,a=44,o=45,h=0,u=1,l=146,c=2,d=7,f=9,p=17,g=10,m=11,_=12,v=102,b=107,w=0,y=1,x=2,T=3,R=65,E=0,S=1,A=-1,k=0,M=1,C=2,P=3,U=1,L=2,I=3,O={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},D={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,G=20,W=15,N=10,F=8294400,V=5,z=0,H=1,j=2,Y=15,X=5,q=400,K=7,Q=8,Z={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,re=1,ie=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),ne={PAUSE:0,RESUME:1,STOP:2}},function(e,t,r){"use strict";r.d(t,"j",(function(){return i})),r.d(t,"h",(function(){return n})),r.d(t,"l",(function(){return s})),r.d(t,"sb",(function(){return a})),r.d(t,"qb",(function(){return o})),r.d(t,"ub",(function(){return h})),r.d(t,"Z",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"bb",(function(){return c})),r.d(t,"db",(function(){return d})),r.d(t,"D",(function(){return f})),r.d(t,"ob",(function(){return p})),r.d(t,"H",(function(){return g})),r.d(t,"Eb",(function(){return m})),r.d(t,"n",(function(){return _})),r.d(t,"vb",(function(){return v})),r.d(t,"E",(function(){return b})),r.d(t,"b",(function(){return w})),r.d(t,"zb",(function(){return y})),r.d(t,"S",(function(){return x})),r.d(t,"I",(function(){return T})),r.d(t,"T",(function(){return R})),r.d(t,"xb",(function(){return E})),r.d(t,"f",(function(){return S})),r.d(t,"nb",(function(){return A})),r.d(t,"mb",(function(){return k})),r.d(t,"eb",(function(){return M})),r.d(t,"X",(function(){return C})),r.d(t,"V",(function(){return P})),r.d(t,"a",(function(){return U})),r.d(t,"z",(function(){return L})),r.d(t,"Fb",(function(){return I})),r.d(t,"G",(function(){return O})),r.d(t,"wb",(function(){return D})),r.d(t,"v",(function(){return B})),r.d(t,"u",(function(){return G})),r.d(t,"t",(function(){return W})),r.d(t,"w",(function(){return N})),r.d(t,"U",(function(){return F})),r.d(t,"jb",(function(){return V})),r.d(t,"kb",(function(){return z})),r.d(t,"R",(function(){return H})),r.d(t,"hb",(function(){return j})),r.d(t,"ib",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"r",(function(){return q})),r.d(t,"q",(function(){return K})),r.d(t,"y",(function(){return Q})),r.d(t,"p",(function(){return Z})),r.d(t,"x",(function(){return J})),r.d(t,"Cb",(function(){return $})),r.d(t,"O",(function(){return ee})),r.d(t,"P",(function(){return te})),r.d(t,"Ab",(function(){return re})),r.d(t,"C",(function(){return ie})),r.d(t,"B",(function(){return ne})),r.d(t,"A",(function(){return se})),r.d(t,"K",(function(){return ae})),r.d(t,"J",(function(){return oe})),r.d(t,"L",(function(){return he})),r.d(t,"o",(function(){return ue})),r.d(t,"s",(function(){return le})),r.d(t,"gb",(function(){return ce})),r.d(t,"fb",(function(){return de})),r.d(t,"Db",(function(){return fe})),r.d(t,"Q",(function(){return pe})),r.d(t,"i",(function(){return ge})),r.d(t,"g",(function(){return me})),r.d(t,"k",(function(){return _e})),r.d(t,"m",(function(){return ve})),r.d(t,"rb",(function(){return be})),r.d(t,"pb",(function(){return we})),r.d(t,"tb",(function(){return ye})),r.d(t,"Y",(function(){return xe})),r.d(t,"cb",(function(){return Te})),r.d(t,"ab",(function(){return Re})),r.d(t,"c",(function(){return Ee})),r.d(t,"M",(function(){return Se})),r.d(t,"Bb",(function(){return Ae})),r.d(t,"N",(function(){return ke})),r.d(t,"yb",(function(){return Me})),r.d(t,"W",(function(){return Ce})),r.d(t,"lb",(function(){return Pe})),r.d(t,"e",(function(){return Ue}));const i=1,n=2,s=3,a=7,o=8,h=9,u=12,l=14,c=15,d=16,f=18,p=20,g=21,m=24,_=26,v=27,b=30,w=31,y=35,x=36,T=37,R=38,E=47,S=48,A=50,k=51,M=52,C=53,P=54,U=56,L=57,I=60,O=61,D=62,B=66.5,G=66.6,W=67,N=68,F=69,V=71,z=72,H=73,j=75,Y=76,X=78,q=105,K=106,Q=107,Z=108,J=109,$=120,ee=121,te=122,re=123,ie=124,ne=125,se=126,ae=127,oe=128,he=129,ue=132,le=133,ce=135,de=136,fe=137,pe=151,ge=-1,me=-2,_e=-3,ve=-5,be=-7,we=-8,ye=-9,xe=-12,Te=-14,Re=-15,Ee=-23,Se=-26,Ae=-27,ke=-28,Me=-35,Ce=-129,Pe=-130,Ue=-131},function(e,t,r){"use strict";r.d(t,"e",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"d",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"c",(function(){return g}));var i=r(7),n=r.n(i),s=r(14),a=r(17),o=r(5),h=r(10),u=r(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},c=e=>{0};class d{constructor(){this.onmessage=c,this.status=d.CLOSED,this.onopen=c,this.onclose=c,this.onwer=null}send(e){}delete(){this.onmessage=c,this.onopen=c,this.onclose=c,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}n()(d,"OPEN",1),n()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(c),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=c),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(r,0);break;case o.L:this.status=r,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:r,interval:i}=e||{};r?i?(this.sender=e=>{r.enqueue(e)},this.wasmSender=e=>{r.enqueue(e)},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}}):(this.sender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),this.port.postMessage({cmd:o.K,data:r},[r.buffer])});let{sabqueue:n,consumer:h,useCopy:u,interval:l,offset:c}=t||{};if(h&&(h.cancelConsume(),h=null),n){const e=u?e=>{this.onmessage(e,0)}:c?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=p.dataTransportMgr.monitorlogfn;if(l&&i){var d;let e=new s.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});r=e.timeoutReport.bind(e)}h=new a.a(n,e,r),t.consumer=h,l?h.consume(l,u):this.reciver=()=>{h.consumeAll(u)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=c,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:r,interval:i,offset:n,length:s,useOneElement:o}=e,h=new a.b(n>0?t.buffer:t,void 0,void 0,!!o,n,s,n>0?t:null);this.sab.sender={sabqueue:h,interval:i,useCopy:r,offset:n}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:n,offset:s,length:o,useOneElement:h}=t,u=new a.b(s>0?e.buffer:e,void 0,void 0,!!h,s,o,s>0?e:null),{consumer:l}=(null===(r=this.sab)||void 0===r?void 0:r.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:u,interval:n,useCopy:i,offset:s}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(e){this.onmessage=c,this.onopen=c,this.onclose=c,this.connect_type=e.connect_type||p.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=h.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=p.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=p.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}n()(p,"UDP",0),n()(p,"TCP",1),n()(p,"RLB_UDP",2),n()(p,"dataTransportMgr",null);class g{constructor(e){this.sock=null,this.onmessage=c}isReady(){return!1}send(){c()}setStatus(e){0}}function m(e,t,r,i){var n;null===(n=u.a.monitorlogfn)||void 0===n||n.call(u.a,e,"".concat(t,",").concat(r,",").concat(i))}},function(e,t,r){var i=r(34);e.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"p",(function(){return i})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return h})),r.d(t,"k",(function(){return u})),r.d(t,"q",(function(){return l})),r.d(t,"r",(function(){return c})),r.d(t,"s",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"n",(function(){return p})),r.d(t,"e",(function(){return g})),r.d(t,"m",(function(){return m})),r.d(t,"o",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"h",(function(){return b})),r.d(t,"a",(function(){return w})),r.d(t,"f",(function(){return y}));const i=1,n=2,s=3,a=4,o=5,h=6,u=7,l=8,c=9,d=10,f=11,p=129,g=130,m=131,_=132,v=133,b=134,w=135,y=136},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return a})),r.d(t,"g",(function(){return o})),r.d(t,"f",(function(){return h})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c})),r.d(t,"c",(function(){return d}));var i=r(3),n=r(2);function s(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function a(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}function o(e,t,r){if(!e||t<0||r<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(r));let n=!1,s=0;const a=e.acquireGPUFeaturesHelper();return a&&(s=a.queryMaxTextureDimension2D(),s>0&&(n=t>s||r>s)),n&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s)),Object(i.o)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s))),n}function h(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let r=!1,n=0;const s=e.acquireGPUFeaturesHelper();return s&&(n=s.queryMaxBufferSize(),n>0&&(r=t>n)),r&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n)),Object(i.o)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n))),r}function u(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===n.s||t===n.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function l(e,t){let r=0,i=0,n=0,s=0;const a=t.width/t.height;return e.width/e.height>a?(i=e.height,r=i*a,n=(e.width-r)/2,s=0):(r=e.width,i=r/a,n=0,s=(e.height-i)/2),r<=e.canvas.width&&(n=(e.canvas.width-r)/2),i<=e.canvas.height&&(s=(e.canvas.height-i)/2),{x:n,y:s,width:r,height:i}}function c(e,t,r,i){if(!e||!t||!r)return null;const s=t.width/t.height;let a=t.width,o=t.height;if(t.width>e.width||t.height>e.height){const r=e.width/t.width,i=e.height/t.height,n=Math.min(r,i);a*=n,o*=n}let h=0,u=0;e.width/e.height>s?(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a,h>e.width&&(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o)):(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o,u>e.height&&(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a));let l=0,c=0,d=0,f=0;i==n.p?(l=1-(l+(o-1)/e.height),c=t.left/e.width,f=1-t.top/e.height,d=c+a/e.width):i==n.s?(c=1-(l+(o-1)/e.height),d=1-t.top/e.height,l=t.left/e.width,f=c+a/e.width):i==n.q?(l=t.top/e.height,c=t.left/e.width,f=l+(o-1)/e.height,d=c+a/e.width):i==n.r&&(c=t.top/e.height,d=l+(o-1)/e.height,l=t.left/e.width,f=c+a/e.width);let p=[],g=[{x:d,y:f},{x:d,y:l},{x:c,y:l},{x:d,y:f},{x:c,y:f},{x:c,y:l}];for(let e=0;ee){const t=i.height*e;u=a/r.height,l=(Math.round((i.width-t)/2)+s)/r.width,d=u+(i.height-1)/r.height,c=l+t/r.width}else{const t=i.width/e;u=(Math.round((i.height-t)/2)+a)/r.height,l=s/r.width,d=u+(t-1)/r.height,c=l+i.width/r.width}o==n.p?(u=1-(u+(i.height-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+i.width/r.width):o==n.s?(l=1-(u+(i.height-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+i.width/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(i.height-1)/r.height,c=l+i.width/r.width):o==n.r&&(l=i.top/r.height,c=u+(i.height-1)/r.height,u=i.left/r.width,d=l+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,h=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,n=r.height/i.height,s=Math.min(e,n);t*=s,h*=s}let f=0,p=0;r.width/r.height>e?(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t,f>r.width&&(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h)):(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h,p>r.height&&(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t)),o==n.p?(u=1-(u+(h-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+t/r.width,i.height>i.width&&(l=a(l,2),c=s(c,2))):o==n.s?(l=1-(u+(h-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+t/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(h-1)/r.height,c=l+t/r.width):o==n.r&&(l=i.top/r.height,c=u+(h-1)/r.height,u=i.left/r.width,d=l+t/r.width)}let f=[],p=[{x:c,y:d},{x:c,y:u},{x:l,y:u},{x:c,y:d},{x:l,y:d},{x:l,y:u}];for(let e=0;e{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(r=>{r(e,t,1)}))}removeTransport(e){var t;let r=e.id;r in this.transportMap&&(delete this.transportMap[r],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let r=this.transportMap[t],i=r.target_thread==a.SELF_THREAD;if(r.type==e&&i)return r}return null}}n()(a,"NO_THREAD",0),n()(a,"SELF_THREAD",1)},function(e,t,r){"use strict";function i(){this.a=[],this.b=0,this.residue=null}i.prototype.getLength=function(){return this.a.length-this.b},i.prototype.isEmpty=function(){return 0==this.a.length},i.prototype.enqueue=function(e){this.a.push(e)},i.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},i.prototype.peek=function(){return 0{const e={};for(const t in n)e[n[t]]="WCL_"+t})(),{[n.AUDIO_ENCODE]:"audio.encode",[n.AUDIO_DECODE]:"audio.decode",[n.VIDEO_ENCODE]:"video.encode",[n.VIDEO_DECODE]:"video.decode",[n.SHARING_ENCODE]:"share.encode",[n.SHARING_DECODE]:"share.decode"})},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l}));var i=r(7),n=r.n(i),s=r(5),a=r(10),o=r(6),h=r(22);function u(e,t,r){if(!e)return;let i=o.a.dataTransportMgr;i.type===l.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,n=this.transportlists.find(e=>e.id===r);if(n||t==s.s)switch(t){case s.s:this.addRemoteTransport(e.data,null);break;case s.fb:n.setMsgPort(i||new a.a);break;case s.gb:n.setSabBuffer(e.data.sender,e.data.reciver);break;case s.o:n.remote=null,this.removeTransport(n)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i,transportType:n}=t.data,a=this.transportlists.find(e=>e.id===i);switch(r){case s.s:this.addRemoteTransport(t.data,e);break;case s.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case s.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let r={cmd:s.s,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransport(e,t){t.postMessage({cmd:s.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var r,i,n,a;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:s.gb,transportId:e.id,sender:null===(n=e.sabInfo)||void 0===n?void 0:n.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:n}=e;let s=this.createMsgSocketTransport(n);s.id=r,s.remote=t,s.portInfo=i,i?s.setMsgPort(s.portInfo):this.bindMessageChannel(s),this.addTransport(s)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let r=t.target_thread||a.b.SELF_THREAD;e.target_thread=r,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,r){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),r&&(r.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:r},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,r))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof h.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof h.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let r=0;r{if(!e.transportlists.includes(t.type))return;let r=e.target_thread||a.b.SELF_THREAD;r==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=r&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=r,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let r=e.target_thread;if(r!=a.b.SELF_THREAD)this.createRemoteTransport(e,r),this.setRemoteTransportSABBUffer(e,r);else{var i,n,s,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(n=e.sabInfo)&&void 0!==n&&n.reciver)e.setSabBuffer(null===(s=e.sabInfo)||void 0===s?void 0:s.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{r._report(),r._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let r="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,r)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,r){"use strict";r.d(t,"c",(function(){return i})),r.d(t,"f",(function(){return n})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"k",(function(){return o})),r.d(t,"g",(function(){return h})),r.d(t,"h",(function(){return u})),r.d(t,"b",(function(){return l})),r.d(t,"j",(function(){return c})),r.d(t,"i",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"d",(function(){return p}));const i=3,n=6,s=34,a=38,o=-51,h="SHARING_PARAM_INFO_FROM_SOCKET",u=121,l="AUDIO_QOS_DATA",c="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},p="EXPOSE_VB_FRAME"},function(e,t,r){"use strict";const i=e=>0==(e&e-1);let n=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(r+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(r+=" Message: ".concat(t.message)),t.error&&(r+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(r+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(r+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+=" Stack: ".concat(t.stack)),t.name&&(r+=" Name: ".concat(t.name)),t.constraint&&(r+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(r+=" Code: ".concat(t.code)),t.reason&&(r+=" Reason: ".concat(t.reason)),r+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(r+=" Message: ".concat(t.message)),t.name&&(r+=" Name: ".concat(t.name))):r+=t?t.toString():"",r}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const r=i(this._highFrequencyLogs[e]);this._instance&&r&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var r,i;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(r=(i=this._instance).directReport)||void 0===r||r.call(i,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=n},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o}));var i=r(11),n=r(16);class s{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=n,this._BYTES_PER_ELEMENT=t,this.capacity=(s-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,n,1),this.read_ptr=new Uint32Array(this.buf,n+4,1),this.storageUint8sByteOffset=n+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,s-8),this.byteLength=s,this.label=r,this.usingOneElementBuffer=i,a&&(this.wasmMemory=a),i&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new i.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let s=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==s)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++s}if(s>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),s>=1e3&&(n.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),r&&r("vqslclear")),s>0&&r){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,r&&r("vqsl"+s))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let r=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+r),r+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=r;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let r,i,n,s=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,s[0]):new Uint8Array(s[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r.byteLength);r.set(e,0)}else r=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+s[0]),i=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n=t*this._BYTES_PER_ELEMENT+8+4+s[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:i,end:n}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof s))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=r,this.tick_lasted_time=0,this.timeoutMS=i,this.maxCount=n}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),r={};this.keysList.forEach((t,i)=>{r[t]=e[i]}),r[this.timeStampKey]=Number(t.getBigUint64(0,!0));let i,n=Number(t.getBigUint64(8,!0)),s=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,n);return i=(this.bCopyData,s),r.data=i,r}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,r=new Uint32Array(e.buffer,0,9),i=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{r[t]=this.obj[e]}),i.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),i.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},function(e,t,r){"use strict";var i,n,s,a,o,h;function u(){}function l(e){let t=new Uint8Array(e.data);t.length<4||n&&a(t,n,s)}function c(e){}function d(e){}function f(e,t,r){n&&a(e,n,t,r)}function p(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(o=i,h=s,e){r.meetingNumber=r.meetingNumber+"",r.meetingId=r.meetingId+"",n=a?e(r.userId,r.meetingNumber,r.meetingId,0,0,!1,0,!0):e(r.userId,r.meetingNumber,r.meetingId,0,0,0,!1,!1,!0);let i=o(r.encryptKey);return t(n,i,r.encryptKey.length,r.encryptType),h(i),n}return 0}function g(e,t,r,n){i=e(t,u,l,c,d),a=r,s=n}function m(e,t){if(n&&t.body){if(t.body.add){let r=0,i=t.body.add;for(;r7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;if(null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost())this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGLRestoreTimeout")},1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext()}catch(e){Object(n.i)("webgl restoreContext exception",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webglcanvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl","experimental-webgl","moz-webgl","webkit-3d"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(i));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,i),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a),this.shaderProgram=a},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(4),n=r(3),s=r(9),a=r(19);let o=new Map,h=[];function u(e){e.preventDefault()}function l(e,t,r,n,s,a,o){let h=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGL2RestoreTimeout")},1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){Object(n.i)("webgl restoreContext exception2",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost2 event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webgl2canvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL2=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl2"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && \n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask* mask.a+ c*(1.0-mask.a);\n }\n }\n\n if (waterMarkFlag!=1) {\n c.a = 1.0;\n }\n\n outputColor = c;\n }\n "),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(r));var i=e.createProgram();e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(7),n=r.n(i),s=r(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new s.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,r,i){if(this._customer_callback){let n="".concat(e,",").concat(t,",").concat(r,",").concat(i);this._customer_callback(this._tag+"TimeOut",n)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),r="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),r=r.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",r)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(s.c.IsQosReport(e))return void this._cureen_qos_report++;if(s.c.IsVideoPkg(e)){let t=s.c.GetQOSTime(e),r=performance.now();if(this._lasted_qos_ts){let e=r-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,r)}this._lasted_qos_ts=t,this._lasted_sys_ts=r,this._lasted_data=e}}};var o=r(8),h=r(12),u=r(5);r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return c}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class c{constructor(e,t,r,i){this.id=e,this.type=t,this.datachannel=r,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=c.UNINIT,this.target_thread=i,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===c.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=c.DISCONNECT&&this._clear(),this._status=c.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==c.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var r;(this._status=c.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==h.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==h.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=c.CONNECTED)&&(null===(r=this.connectedFn)||void 0===r||r.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=c.DISCONNECT;let r=this.disconnectedFn;this._clear(),t!=c.DISCONNECT&&(null==r||r())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let r=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==r||r.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case u.A:this._onclose();break;case u.C:this._onopen();break;case u.B:this._onerror(t.ev);break;case u.H:this.report_monitor_func(t.tag,t.data)}}}n()(c,"UNINIT",0),n()(c,"CONNECTED",1),n()(c,"DISCONNECT",2)},function(e,t,r){"use strict";r.d(t,"d",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"a",(function(){return c}));var i=r(12),n=r(6),s=r(13);function a(e){return new n.a({sock:new n.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(n.a.dataTransportMgr)return;let r=new s.a({type:t?s.a.THREAD_SUB:s.a.THREAD_MAIN,remote:t?self:null});n.a.dataTransportMgr=r,r.monitorlogfn=e,t&&self.addEventListener("message",r._onrecvmainthreadlistener.bind(r))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function h(e){return n.a.dataTransportMgr.getTransportByType(e)}function u(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.removeDataChannel(e)}class c{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,r){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new n.c,r=h(n.e.VIDEO_ENCODE)||t,i=h(n.e.VIDEO_DECODE)||t,s=h(n.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?n.b.OPEN:n.b.CLOSED;r.setStatus(a),i.setStatus(a),this.isSupportVideoShare||s.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])r.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void s.send(t);i.send(t)}});const o=t=>{e.send(t)};r.onmessage=o,i.onmessage=o,s.onmessage=o}connectAudioSession(e){let t=new n.c,r=h(n.e.AUDIO_ENCODE)||t,i=h(n.e.AUDIO_DECODE)||t,s=e.isReady()?n.b.OPEN:n.b.CLOSED;r.setStatus(s),i.setStatus(s),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?r.send(t):i.send(t)});const a=t=>{e.send(t)};r.onmessage=a,i.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var i=r(7),n=r.n(i),s=r(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let r={id:e,worker:t},i=this._recvheartbeat.bind(this,r);r.listener=i,r.lastedtimestamp=Date.now(),r.worker.addEventListener("message",r.listener),this.monitorworkers[e]=r}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let r=t.data;r.cmd===s.Db&&(e.lastedtimestamp=r.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:s.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const r=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),i=Date.now(),n=this._lasted_timestamp;in+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",i-n):t.forEach(t=>{var r;let n=e.monitorworkers[t],s=n.lastedtimestamp+(null!==(r=document)&&void 0!==r&&r.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);i>s&&(e.timeoutcallbackfn(n.id,i-n.lastedtimestamp),n.lastedtimestamp=i)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}n()(o,"INTREVAL_TIME_MS",3e3),n()(o,"HEART_TIMEOUT_MS",15e3),n()(o,"MAX_HEART_TIMEOUT_MS",3e4),n()(o,"instance",null)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));class i{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c}));var i=r(11);function n(){this.ssrcQueueMap=new Map,n.prototype.AddQueue=function(e){var t=new i.a;return this.ssrcQueueMap.set(e,t),t},n.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},n.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},n.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},n.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},n.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var s=function(){this.frames=0,this.ntp=new i.a};s.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;s30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;sbtoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){n()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(s(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const r=this.textEncoder.encode(e);this.processList.push(r),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(s(t.buffer)),this.writeLog(this.EOL);const r=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(s(this.mergeBuffer(r).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=r(3);r.d(t,"a",(function(){return l}));class h{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,r){if(t){var i=new Uint8Array(r?t+1:t),n=Object(o.d)().subarray(e+0,e+t);return i.set(n,0,t),r&&(i[t]=10),i}return e.data}writeWasmLog(e,t){const r=this.getTime(),i=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(r,i):(this.writeLog(r),this.writeLog(i),this.writeLog("\n"))}}class u extends h{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=r=>{"local_log_port"===r.data.command?this.port||(this.port=r.data.data):"local_log_ready"===r.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new u:null}},function(e,t,r){"use strict";t.a=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:r,opacity:i,name:n}=e;t.fillStyle="rgba(0, 0, 0, ".concat(i,")"),t.fillText(n,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(i,")"),t.fillText(n,r.x+1,r.y+1)}_getTransformInfo(e){let t,{canvas:r,position:i}=e;if(1===i)t={x:r.width/2,y:0,rateRadio:0,maxWidth:r.width};else if(2===i)t={x:r.width/2,y:r.height,rateRadio:0,maxWidth:r.width};else if(4===i)t={x:0,y:r.height/2,rateRadio:Math.PI/2,maxWidth:r.height};else if(8===i)t={x:r.width,y:r.height/2,rateRadio:-Math.PI/2,maxWidth:r.height};else{const e=-21*Math.PI/180;t={x:r.width/2,y:r.height/2,rateRadio:e,maxWidth:Math.min(r.width/Math.cos(e),-r.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:r,name:i,textWidth:n}=e;const s=this._getPaddingWidth({ctx:r,position:t,name:i});return 1===t?{x:-n.width/2,y:s}:2===t||4===t||8===t?{x:-n.width/2,y:-s}:{x:-n.width/2,y:r.measureText(i[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:r,name:i}=e;return[1,2,4,8].includes(r)?32:t.measureText(i[0]).width}_setBaseLine(e){let{ctx:t,position:r}=e;t.textBaseline=1===r?"top":2===r||4===r||8===r?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;let h=this._getTransformInfo({canvas:t,position:a});var u=t.getContext("2d");let l;if(u.clearRect(0,0,t.width,t.height),u.translate(h.x,h.y),u.rotate(h.rateRadio),this._setBaseLine({ctx:u,position:a}),u.lineWidth=1,u.imageSmoothingEnabled=!0,1==r.length){const e=h.maxWidth/r.length;u.font=e+"px 'Segoe UI'",l=u.measureText(r)}else{let e=16;for(u.font=e+"px 'Segoe UI'",l=u.measureText(r);l.widthh.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r}))if(e>16)e-=1,u.font=e+"px 'Segoe UI'",l=u.measureText(r);else{const e=r;for(;r.length>5&&l.width>h.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r+"..."});)r=r.slice(0,r.length-1),l=u.measureText(r+"...");e!==r&&(r+="...")}}const c=this._calcTextPos({position:a,ctx:u,name:r,textWidth:l});var d;if(this._drawWatermarkWithShadow({ctx:u,name:r,opacity:s,textPos:c}),o)d=t.toDataURL();else{var f=u.getImageData(0,0,u.canvas.width,u.canvas.height);d=new Uint8Array(f.data.buffer)}return u.rotate(-h.rateRadio),u.translate(-h.x,-h.y),d}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;const h=t.getContext("2d");h.clearRect(0,0,t.width,t.height),h.translate(i/2,n/2),h.rotate(-21*Math.PI/180),h.imageSmoothingEnabled=!0;h.font="".concat(32,"px 'Segoe UI'"),h.textBaseline="top";const u=h.measureText(r),l=.37*u.width;let c,d=0,f=-n;do{let e=d%2==0?l-i:-i;do{h.fillStyle="rgba(0, 0, 0, ".concat(s,")"),h.fillText(r,e,f),h.fillStyle="rgba(255, 255, 255, ".concat(s,")"),h.fillText(r,e+1,f+1),e+=u.width+l}while(e=this._last_update_time+this._init_report_interval&&(this._report(),this.capture_fps_history=[],this.close_frames_history=[],this._last_update_time=e,this._init_report_intervalthis._report_interval&&(this._init_report_interval=this._report_interval)))},n.prototype.closeSample=function(){this.close_frames++,this.close_total_frames++},n.prototype.setCloseTotalFrames=function(e){this.close_total_frames=e},n.prototype.captureTicket=function(){this._enabled&&this.capture_ticket_count++},n.prototype.captureSample=function(){if(!this._enabled)return;this.capture_fps++,this.capture_total_fps++;let e=performance.now();if(this.last_capture_time){let t=e-this.last_capture_time;t>this.threshold&&this.capture_timeout_report.timeoutReport(t,e)}this.last_capture_time=e},n.prototype.ref=function(){this.ref_counts++},n.prototype.unref=function(){this.unref_counts++},n.prototype.start=function(){this._enabled||(0!=this._last_update_time&&(clearTimeout(this._last_update_time),this._last_update_time=0,this._report()),this.capture_fps=0,this.capture_fps_history=[],this.capture_total_fps=0,this.close_frames=0,this.close_frames_history=[],this.close_total_frames=0,this.capture_ticket_count=0,this._last_update_time=performance.now(),this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enabled=!0)},n.prototype.stop=function(){this._enabled&&(this._enabled=!1,this._interval_id&&clearInterval(this._interval_id),this._interval_id=0,(this.close_frames>0||this.capture_fps>0||this.capture_fps_history.length>0||this.close_frames_history>0)&&(this._timeout_id=setTimeout(this._timeout_report.bind(this),3e3)))}},function(e,t){e.exports=function(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(0),n=r.n(i),s=r(1),a=r.n(s),o=r(3),h=r(2);function u(e,t){c(e,t),t.add(e)}function l(e,t,r){c(e,t),t.set(e,r)}function c(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function d(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var f=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,_=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,T=new WeakMap,R=new WeakMap,E=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap,C=new WeakMap,P=new WeakMap,U=new WeakMap,L=new WeakMap,I=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,G=new WeakSet,W=new WeakSet,N=new WeakSet,F=new WeakSet,V=new WeakSet,z=new WeakSet,H=new WeakSet,j=new WeakSet,Y=new WeakSet,X=new WeakSet,q=new WeakSet,K=new WeakSet,Q=new WeakSet,Z=new WeakSet,J=new WeakSet,$=new WeakSet,ee=new WeakSet,te=new WeakSet,re=new WeakSet,ie=new WeakSet;function ne(e){e&&e.forEach(e=>{e.markRenderingStatePending()});const t=d(this,J,ve).call(this,e);if(n()(this,w)&&n()(this,b)&&n()(this,T))if(n()(this,f)&&0!=n()(this,f).width&&0!=n()(this,f).height&&n()(this,b)&&n()(this,b).getCurrentTexture()&&0!=n()(this,b).getCurrentTexture().width&&0!=n()(this,b).getCurrentTexture().height)try{if(!n()(this,S)){const e=n()(this,B).byteLength,t=e;a()(this,S,n()(this,T).acquireBuffer(t,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,e,!0,!1)),new Float32Array(n()(this,S).getMappedRange()).set(n()(this,B)),n()(this,S).unmap()}const e=d(this,H,le).call(this);for(const[r,i]of t)d(this,ee,we).call(this,r,i,e);const r=d(this,Z,_e).call(this,n()(this,b).getCurrentTexture().createView()),i=e.beginRenderPass(r);i.setVertexBuffer(0,n()(this,S));for(const[e,r]of t)if(r&&0!=r.length)for(const e of r){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;const t=e.getTextureType();let r=e.getUVCoords();if(t!==h.x.CLEAR_COLOR&&!r)continue;const s=n()(this,f).width,a=n()(this,f).height;let o=e.getViewport();if(!o||Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.w)||Number.isNaN(o.h)||o.x<0||o.y<0)continue;if(o.x+o.w>s){let e=o.x+o.w-s;if(!(e>0&&e<=h.i))continue;o.w-=e,o.w<=0&&(o.w=1)}if(o.y+o.h>a){let e=o.y+o.h-a;if(!(e>0&&e<=h.i))continue;o.h-=e,o.h<=0&&(o.h=1)}const u=d(this,$,be).call(this,e);if(!u)continue;if(u.pipelineType!==h.l.CLEAR_COLOR){let t=e.getUVCoordsBuffer();if(!t){const i=r.byteLength;t=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,r.byteLength,!1,!1),e.setUVCoordsBuffer(t)}n()(this,w).queue.writeBuffer(t,0,r,0,r.length),i.setVertexBuffer(1,t)}i.setViewport(o.x,o.y,o.w,o.h,o.minDepth,o.maxDepth);const l=u.pipeline;i.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});i.setBindGroup(0,c),i.draw(6,1,0,0)}i.end(),d(this,j,ce).call(this)}catch(e){Object(o.u)("[WebGUPRenderer] renderNoMsaa() error:".concat(e.message))}finally{n()(this,v).recycleInUsedGPUBuffers(t)}else n()(this,v).recycleInUsedGPUBuffers(t);else n()(this,v).recycleInUsedGPUBuffers(t)}function se(e){if(!n()(this,w)||!n()(this,b))return;const t=n()(this,w).createBuffer({label:"VertexBuffer",size:n()(this,B).byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,mappedAtCreation:!0});new Float32Array(t.getMappedRange()).set(n()(this,B)),t.unmap();const r=d(this,H,le).call(this),i=d(this,J,ve).call(this,e);for(const[e,t]of i)d(this,ee,we).call(this,e,t,r);const s=d(this,ie,Te).call(this,n()(this,f)),a=d(this,Q,me).call(this,0,s.createView(),n()(this,b).getCurrentTexture().createView()),o=r.beginRenderPass(a);o.setVertexBuffer(0,t);for(const[e,t]of i)if(t&&0!=t.length)for(const e of t){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;let t=e.getUVCoords();if(!t)continue;let r=e.getUVCoordsBuffer();if(!r){const i=t.byteLength;r=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,t.byteLength,!1,!0),e.setUVCoordsBuffer(r)}n()(this,w).queue.writeBuffer(r,0,t,0,t.length),o.setVertexBuffer(1,r);const i=n()(this,f).width,s=n()(this,f).height;let a=e.getViewport();if(!a||Number.isNaN(a.x)||Number.isNaN(a.y)||Number.isNaN(a.w)||Number.isNaN(a.h)||a.x<0||a.y<0||a.x+a.w>i||a.y+a.h>s)continue;const u=d(this,$,be).call(this,e,!0);if(!u)continue;o.setViewport(a.x,a.y,a.w,a.h,a.minDepth,a.maxDepth);const l=u.pipeline;o.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});o.setBindGroup(0,c),o.draw(6,1,0,0)}o.end(),d(this,j,ce).call(this),e.forEach(e=>{e.markRenderingStatePending()})}function ae(e){if(!Array.isArray(e))return;let t=[];for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalYuvTextureGroup] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalYuvTextureGroup] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();let s=null,a=null,o=null;const h=e.getWidth(),u=e.getHeight(),l=null!=r&&(h!=r.yPlaneTex.width||u!=r.yPlaneTex.height);let c=!0;r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(s=r.yPlaneTex,a=r.uPlaneTex,o=r.vPlaneTex,c=!1));let d=!1,f="r8unorm";if(i&&i.bufferConfig&&"nv12"==i.bufferConfig.colorFormat&&(f="rg8unorm",d=!0),c){const t=e.getIndex(),r=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,i=n()(this,E).assembleTextureConfig(h,u,r,"r8unorm",1),l=n()(this,E).assembleTextureConfig(h/2,u/2,r,f,1);s=n()(this,E).acquireTexture(i),s&&(s.label="RD(".concat(t,")-YPlaneTexture")),d?(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UVPlaneTexture"))):(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UPlaneTexture")),o=n()(this,E).acquireTexture(l),o&&(o.label="RD(".concat(t,")-VPlaneTexture")))}t.copyBufferToTexture({buffer:i.buffer,offset:i.yPlaneBuffer.offset,bytesPerRow:i.yPlaneBuffer.bytesPerRow,rowsPerImage:i.yPlaneBuffer.rowsPerImage},{texture:s},[h,u,1]),t.copyBufferToTexture({buffer:i.buffer,offset:i.uPlaneBuffer.offset,bytesPerRow:i.uPlaneBuffer.bytesPerRow,rowsPerImage:i.uPlaneBuffer.rowsPerImage},{texture:a},[h/2,u/2,1]),i.vPlaneBuffer.offset>0&&!d&&t.copyBufferToTexture({buffer:i.buffer,offset:i.vPlaneBuffer.offset,bytesPerRow:i.vPlaneBuffer.bytesPerRow,rowsPerImage:i.vPlaneBuffer.rowsPerImage},{texture:o},[h/2,u/2,1]);let p={};return p.yPlaneTex=s,p.uPlaneTex=a,p.vPlaneTex=o,p}function he(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalRgbaTexture] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalRgbaTexture] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();const s=e.getIndex(),a=e.getWidth(),o=e.getHeight(),h=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let u=null;const l=null!=r&&(a!=r.width||o!=r.height);let c=!0;if(r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(u=r,c=!1)),c){const e=n()(this,E).assembleTextureConfig(a,o,h,"rgba8unorm",1);u=n()(this,E).acquireTexture(e),u&&(u.label="RD(".concat(s,")-rgbaTexture"))}return t.copyBufferToTexture({buffer:i.buffer,offset:0,bytesPerRow:i.bytesPerRow,rowsPerImage:i.rowsPerImage},{texture:u},[a,o,1]),u}function ue(e,t){return Math.ceil(e/t)*t}function le(){return n()(this,w)?(n()(this,x)||a()(this,x,n()(this,w).createCommandEncoder()),n()(this,x)):(Object(o.u)("GPUDevice is not ready! No available command encoder."),null)}function ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;n()(this,x)&&e?n()(this,w).queue.submit([n()(this,x).finish(),e.finish()]):n()(this,x)?n()(this,w).queue.submit([n()(this,x).finish()]):e&&n()(this,w).queue.submit([e.finish()]),a()(this,x,null)}function de(e,t){if(!n()(this,w))return null;if(!n()(this,I)){let r=n()(this,w).createBindGroupLayout({label:"CursorTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"CursorTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"CursorTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,I,n()(this,w).createRenderPipeline(s))}return n()(this,I)}function fe(e,t){if(!n()(this,w))return null;if(!n()(this,L)){let r=n()(this,w).createBindGroupLayout({label:"WatermarkTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"WatermarkTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"WatermarkTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,L,n()(this,w).createRenderPipeline(s))}return n()(this,L)}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,C)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,C,n()(this,w).createRenderPipeline(i))}return n()(this,C)}function ge(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,P)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,P,n()(this,w).createRenderPipeline(i))}return n()(this,P)}function me(e,t,r){return{label:"renderPass - ".concat(e),colorAttachments:[{view:t,resolveTarget:r,loadOp:"clear",storeOp:"discard"}]}}function _e(e){return e&&(e.label="canvas-texture-view"),{label:"RenderPassNoMsaa",colorAttachments:[{view:e,loadOp:"clear",storeOp:"store"}]}}function ve(e){let t=new Map;for(let r=0;r1&&void 0!==arguments[1]&&arguments[1],r=null,i=null,s=null,a=null;const o=e.getZIndex(),u=e.getTextureType(),l=e.getColorFormat();if(o==h.w.VS_BASE){if(u==h.x.EXTERNAL_TEX){a=h.l.VIDEO_FRAME,r=this.acquireVideoFrameRenderPipeline(h.y,t),i=this.acquireVideoFrameSampler();const o=e.getPendingVideoFrame();if(!o||0==o.codedWidth||0==o.codedHeight||!o.format)return e.setPendingVideoFrame(null),null;const u=e.getUniformBuffer();if(!u)return null;s=[{binding:0,resource:i},{binding:1,resource:n()(this,w).importExternalTexture({source:o})},{binding:2,resource:{buffer:u}}]}else if(u==h.x.CLEAR_COLOR){a=h.l.CLEAR_COLOR,r=this.acquireClearColorRenderPipeline(h.c);const t=e.getClearColorUniformBuffer();if(!t)return null;s=[{binding:0,resource:{buffer:t}}]}else if(u==h.x.GPU_TEX_YUV){"i420"==l?(a=h.l.YUV_I420,r=d(this,q,pe).call(this,h.z,t)):"nv12"==l&&(a=h.l.YUV_NV12,r=d(this,K,ge).call(this,h.A,t)),i=this.acquireYuvTexturesSamplers();const n=e.getUniformBuffer();if(!n)return null;const o=e.getTextureGroup();o&&("i420"==l?s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:o.vPlaneTex.createView()},{binding:5,resource:{buffer:n}},{binding:6,resource:{buffer:n}}]:"nv12"==l&&(s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:{buffer:n}},{binding:5,resource:{buffer:n}}]))}}else if(o==h.w.WATERMARK||o==h.w.MASK){a=h.l.RGBA_WATERMARK,r=d(this,X,fe).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getTextureGroup();n&&(s=[{binding:0,resource:i},{binding:1,resource:n.createView()}])}else if(o==h.w.CURSOR){a=h.l.RGBA_CURSOR,r=d(this,Y,de).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getUniformBuffer();if(!n)return null;const u=e.getTextureGroup();u&&(s=[{binding:0,resource:i},{binding:1,resource:u.createView()},{binding:2,resource:{buffer:n}}])}if(a===h.l.CLEAR_COLOR){if(!r||!s)return null}else if(!r||!i||!s||null==a)return null;const c={pipelineType:a,pipeline:r,entries:s};return c}function we(e,t,r){for(const i of t){const t=i.getTextureType();t!=h.x.EXTERNAL_TEX&&t!=h.x.CLEAR_COLOR&&(e==h.w.VS_BASE?d(this,te,ye).call(this,i,r):e!=h.w.CURSOR&&e!=h.w.WATERMARK&&e!=h.w.MASK||d(this,re,xe).call(this,i,r))}}function ye(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,F,oe).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,F,oe).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function xe(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,V,he).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,V,he).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function Te(e){if(!e||!n()(this,w))return n()(this,D)?n()(this,D):null;if(n()(this,D)){if(n()(this,D).width!=e.width||n()(this,D).height!=e.height){const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}}else{const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}return n()(this,D)}var Re=class{constructor(e,t){if(u(this,ie),u(this,re),u(this,te),u(this,ee),u(this,$),u(this,J),u(this,Z),u(this,Q),u(this,K),u(this,q),u(this,X),u(this,Y),u(this,j),u(this,H),u(this,z),u(this,V),u(this,F),u(this,N),u(this,W),u(this,G),l(this,f,{writable:!0,value:null}),l(this,p,{writable:!0,value:0}),l(this,g,{writable:!0,value:0}),l(this,m,{writable:!0,value:!1}),l(this,_,{writable:!0,value:!1}),l(this,v,{writable:!0,value:null}),l(this,b,{writable:!0,value:null}),l(this,w,{writable:!0,value:null}),l(this,y,{writable:!0,value:null}),l(this,x,{writable:!0,value:null}),l(this,T,{writable:!0,value:null}),l(this,R,{writable:!0,value:null}),l(this,E,{writable:!0,value:null}),l(this,S,{writable:!0,value:null}),l(this,A,{writable:!0,value:null}),l(this,k,{writable:!0,value:null}),l(this,M,{writable:!0,value:null}),l(this,C,{writable:!0,value:null}),l(this,P,{writable:!0,value:null}),l(this,U,{writable:!0,value:null}),l(this,L,{writable:!0,value:null}),l(this,I,{writable:!0,value:null}),l(this,O,{writable:!0,value:null}),l(this,D,{writable:!0,value:null}),l(this,B,{writable:!0,value:new Float32Array(12)}),!t)throw new Error("[WebGPURenderer] resMgr is an invalid param! ".concat(t));a()(this,f,e),a()(this,v,t),this.initialize(e)}switchMsaa(e){a()(this,_,e)}isMsaaEnabled(){return n()(this,_)}setCanvas(e){e&&a()(this,f,e)}setDevice(e){e&&a()(this,w,e)}setRenderArgs(e,t){a()(this,p,e||0),a()(this,g,n()(this,p)?3:t?4:6),a()(this,m,t||!1)}setTextureIndex(e){a()(this,p,e||0)}initialize(e){n()(this,w)||(a()(this,w,n()(this,v).acquireGPUDevice()),n()(this,w))?(n()(this,y)||a()(this,y,n()(this,v).acquireCanvasFormat()),n()(this,T)||a()(this,T,n()(this,v).acquireGPUBufferMgr()),n()(this,R)||a()(this,R,n()(this,v).acquireGPUBufferPool()),n()(this,E)||a()(this,E,n()(this,v).acquireGPUTextureMgr()),this.configureGPUContext(e),d(this,N,ae).call(this,h.b)):Object(o.u)("[WebGPURenderer] initialize() device is not ready!")}isGPUDeviceReady(){return null!=n()(this,w)}render(e){n()(this,_)?d(this,W,se).call(this,e):d(this,G,ne).call(this,e)}updateVertexCoords(e){d(this,N,ae).call(this,e)}createRGBATexture(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;if(t<0)return Object(o.u)("[createRGBATexture] ".concat(t," is an invalid index!")),null;if(!n()(this,T))return console.warn("[createRGBATexture] buffer manager is not ready!"),null;if(!n()(this,w))return console.warn("[createRGBATexture] GPUDevice is not ready!"),null;if(null==s||void 0===s)return console.warn("[createRGBATexture] rgbaData is invalid!"),null;if(!e)return console.warn("[createRGBATexture] command encoder is invalid!"),null;const h=d(this,z,ue).call(this,Uint32Array.BYTES_PER_ELEMENT*r,256),u=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,l=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let c=null;const f=null!=a&&(r!=a.width||i!=a.height);let p=!0;if(a&&(f?(n()(this,E).recycleTexture(a),p=!0):(c=a,p=!1)),p){const e=n()(this,E).assembleTextureConfig(r,i,l,"rgba8unorm",1);c=n()(this,E).acquireTexture(e),c&&(c.label="RD(".concat(t,")-rgbaTexture"))}const g=n()(this,T).acquireBuffer("".concat(t,"_Y"),u,h*i,!0,!1),m=new Uint8Array(g.getMappedRange()),_=r*Uint32Array.BYTES_PER_ELEMENT;for(let e=0;e=g.length)return console.error("[WebGPURenderer] write yPlane is out of range! yPlaneOffset=".concat(0,", yPlane.height=").concat(r.height,", yPlaneBytesPerRow=").concat(a,", mappedArray.len=").concat(g.length)),null;for(let e=0;eg.length)return null;for(let e=0;e0){if(l+s.height*h>g.length)return null;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:null;if(!n()(this,w))return Object(o.u)("writeUniformBuffer() GPUDevice is not ready yet."),null;if(!t||0==t.length)return null;let i=r;return i||(i=n()(this,w).createBuffer({label:e,size:t.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),n()(this,w).queue.writeBuffer(i,0,t,0,t.length),i}acquireBlendTextureSampler(){return n()(this,w)?(n()(this,O)||a()(this,O,n()(this,w).createSampler({})),n()(this,O)):null}configureGPUContext(e){n()(this,b)||(a()(this,b,e.getContext("webgpu")),n()(this,b)?n()(this,b).configure({device:n()(this,w),format:n()(this,y),alphaMode:"premultiplied"}):Object(o.u)("configureGPUContext() webgpuContext is invalid! canvas=".concat(e)))}unconfigureGPUContext(){n()(this,b)&&(n()(this,b).unconfigure(),a()(this,b,null))}acquireVideoFrameRenderPipeline(e,t){if(!n()(this,w)||!e)return null;if(!n()(this,A)){const r=n()(this,w).createBindGroupLayout({label:"VideoFrameBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"VideoFrameRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"VideoFramePipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,A,n()(this,w).createRenderPipeline(i))}return n()(this,A)}acquireClearColorRenderPipeline(e){if(!n()(this,w)||!e)return null;if(!n()(this,k)){const t=n()(this,w).createBindGroupLayout({label:"ClearColorBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),r={label:"ClearColorRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"ClearColorPipelineLayout",bindGroupLayouts:[t]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};a()(this,k,n()(this,w).createRenderPipeline(r))}return n()(this,k)}acquireVideoFrameSampler(){return n()(this,w)?(n()(this,M)||a()(this,M,n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"})),n()(this,M)):null}acquireYuvTexturesSamplers(){if(!n()(this,w))return null;if(!n()(this,U)){a()(this,U,[]);const e=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"}),t=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"});n()(this,U).push(e),n()(this,U).push(t)}return n()(this,U)}clearAttachedCanvas(){if(!n()(this,w)||!n()(this,b)||!n()(this,S))return;if(!n()(this,f)||0==n()(this,f).width||0==n()(this,f).height)return;const e=n()(this,w).createCommandEncoder(),t=e.beginRenderPass({colorAttachments:[{view:n()(this,b).getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),r=n()(this,w).createRenderPipeline({layout:"auto",vertex:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}});t.setVertexBuffer(0,n()(this,S)),t.setPipeline(r),t.draw(6),t.end(),n()(this,w).queue.submit([e.finish()])}clear(){console.log("WebGPURender.clear")}cleanup(){this.unconfigureGPUContext(),a()(this,f,null),a()(this,y,null),a()(this,x,null),a()(this,S,null),a()(this,A,null),a()(this,k,null),a()(this,M,null),a()(this,C,null),a()(this,P,null),a()(this,U,null),a()(this,L,null),a()(this,I,null),a()(this,O,null),a()(this,D,null),n()(this,T)&&a()(this,T,null),n()(this,w)&&a()(this,w,null)}};function Ee(e,t){Ae(e,t),t.add(e)}function Se(e,t,r){Ae(e,t),t.set(e,r)}function Ae(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ke(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Me=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,Le=new WeakSet,Ie=new WeakSet,Oe=new WeakSet,De=new WeakSet,Be=new WeakSet;function Ge(){return!0}function We(){if(n()(this,Pe)){let e={};return e.architecture=n()(this,Pe).architecture,e.vendor=n()(this,Pe).vendor,e}return null}async function Ne(){if(!navigator.gpu)return a()(this,Me,h.C.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();if(!e)return a()(this,Me,h.C.CANNOT_REQ_ADAPTER),!1;return await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(a()(this,Pe,await e.requestAdapterInfo()),n()(this,Pe)&&console.log("adapter info: ".concat(n()(this,Pe).architecture,", ").concat(n()(this,Pe).vendor))):"info"in e&&a()(this,Pe,e.info),a()(this,Me,h.C.AVAILABLE),!0):(a()(this,Me,h.C.CANNOT_REQ_DEVICE),!1)}function Fe(e){if(!e)return!1;const t=e.vendor;return-1!==h.g.indexOf(t)}function Ve(e,t,r){return class{static produce(e,t,r){let i=null;return e===h.j.WEBGPU&&(i=new Re(t,r)),i}}.produce(e,t,r)}var ze=class{constructor(){Ee(this,Be),Ee(this,De),Ee(this,Oe),Ee(this,Ie),Ee(this,Le),Se(this,Me,{writable:!0,value:h.C.AVAILABLE}),Se(this,Ce,{writable:!0,value:h.j.WEBGL}),Se(this,Pe,{writable:!0,value:null}),Se(this,Ue,{writable:!0,value:new Map})}async evaluate(e){a()(this,Ce,h.j.WEBGL);if(!ke(this,Le,Ge).call(this))return n()(this,Ce);if(!e.allowedOnTargetPlatforms)return n()(this,Ce);if(!e.allowedOnTargetBrowsers)return n()(this,Ce);if(!await ke(this,Oe,Ne).call(this))return n()(this,Ce);const t=ke(this,Ie,We).call(this);if(!ke(this,De,Fe).call(this,t))return n()(this,Ce);let r=new OffscreenCanvas(1,1);return r.getContext("webgpu")?(r=null,a()(this,Ce,h.j.WEBGPU),n()(this,Ce)):(r=null,n()(this,Ce))}acquireRenderer(e,t){let r=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&n()(this,Ue).clear(),n()(this,Ue).has(e)&&(r=n()(this,Ue).get(e),r&&(e&&(r.setCanvas(e),r.initialize(e)),t&&r.setDevice(t.acquireGPUDevice()))),null==r&&(r=ke(this,Be,Ve).call(this,n()(this,Ce),e,t),r&&n()(this,Ue).set(e,r)),r}rendererReinitialize(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.unconfigureGPUContext()}getRendererType(){return n()(this,Ce)}setRendererType(e){a()(this,Ce,e)}isWebGPURendererType(){return n()(this,Ce)===h.j.WEBGPU}isWebGLRendererType(){return n()(this,Ce)===h.j.WEBGL}isWebGL2RendererType(){return n()(this,Ce)===h.j.WEBGL_2}cleanup(){for(const[e,t]of n()(this,Ue))t&&t.cleanup();n()(this,Ue).clear()}};function He(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function je(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Ye=new WeakSet,Xe=new WeakSet;function qe(e){e.forEach(e=>{e.consumePendingGPUEvents()})}function Ke(e){if(!e||0==e.length)return!0;return-1==e.findIndex(e=>{if(!e)return!1;return!!e.getTextureLayerByZIndex(h.w.VS_BASE)&&e.isRenderingStateReady()})}var Qe=class{constructor(){He(this,Xe),He(this,Ye)}render(e,t){return e?e.isGPUDeviceReady()?t&&0!=t.length?(je(this,Ye,qe).call(this,t),void(je(this,Xe,Ke).call(this,t)||e.render(t))):(console.warn("[RendererController] render displays are not available!"),void Object(o.o)("WGPU RendererController_render() displays are not available!")):(console.log("[RendererController] GPU device is not ready!"),void Object(o.o)("WGPU RendererController_render() GPU device is not ready!")):(console.warn("[RendererController] renderer is not attached!"),void Object(o.o)("WGPU RendererController_render() renderer is not attached!"))}},Ze=r(20),Je=r(21),$e=r(7),et=r.n($e),tt=r(4);function rt(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var it=new WeakMap,nt=new WeakMap,st=new WeakMap,at=new WeakMap,ot=new WeakMap,ht=new WeakMap,ut=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,_t=new WeakMap,vt=new WeakMap,bt=new WeakMap,wt=new WeakMap;var yt=class{constructor(e,t){rt(this,it,{writable:!0,value:0}),rt(this,nt,{writable:!0,value:-1}),rt(this,st,{writable:!0,value:0}),rt(this,at,{writable:!0,value:0}),rt(this,ot,{writable:!0,value:-1}),rt(this,ht,{writable:!0,value:null}),rt(this,ut,{writable:!0,value:-1}),rt(this,lt,{writable:!0,value:null}),rt(this,ct,{writable:!0,value:null}),rt(this,dt,{writable:!0,value:null}),rt(this,ft,{writable:!0,value:!1}),rt(this,pt,{writable:!0,value:null}),rt(this,gt,{writable:!0,value:null}),rt(this,mt,{writable:!0,value:null}),rt(this,_t,{writable:!0,value:null}),rt(this,vt,{writable:!0,value:null}),rt(this,bt,{writable:!0,value:!1}),rt(this,wt,{writable:!0,value:""}),a()(this,it,e),a()(this,nt,t)}getIndex(){return n()(this,it)}lock(){a()(this,ft,!0)}unlock(){a()(this,ft,!1)}isLocked(){return n()(this,ft)}getZIndex(){return n()(this,nt)}setWidth(e){a()(this,st,e)}setHeight(e){a()(this,at,e)}getWidth(){return n()(this,st)}getHeight(){return n()(this,at)}getRawData(){return n()(this,ht)}setRawData(e){a()(this,ht,e)}setIsNew(e){a()(this,bt,e)}isNew(){return n()(this,bt)}setColorFormat(e){a()(this,wt,e)}getColorFormat(){return n()(this,wt)}setPendingVideoFrame(e){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),a()(this,pt,e)}clearPendingVideoFrame(){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null))}setTextureLayerType(e){a()(this,ot,e)}getTextureLayerType(){return n()(this,ot)}setTextureType(e){a()(this,ut,e)}getTextureType(){return n()(this,ut)}getPendingVideoFrame(){return n()(this,pt)}getUVCoords(){return n()(this,ct)}setUVCoords(e){a()(this,ct,e)}getUVCoordsBuffer(){return n()(this,_t)}setUVCoordsBuffer(e){a()(this,_t,e)}evalViewport(e,t,r,i,s){n()(this,dt)||a()(this,dt,{}),n()(this,dt).x=Math.floor(e),n()(this,dt).w=Math.floor(r),n()(this,dt).h=Math.floor(i),n()(this,ot)==h.v.BASE_LAYER?n()(this,dt).y=Math.floor(s-(t+i)):n()(this,dt).y=Math.floor(t),n()(this,dt).x<0&&(n()(this,dt).x=0),n()(this,dt).y<0&&(n()(this,dt).y=0),n()(this,dt).minDepth=0,n()(this,dt).maxDepth=1}setViewport(e){a()(this,dt,e)}getViewport(){return n()(this,dt)}getTextureGroup(){return n()(this,lt)}setTextureGroup(e){a()(this,lt,e)}setUniformBuffer(e){a()(this,gt,e)}getUniformBuffer(){return n()(this,gt)}setClearColorUniformBuffer(e){a()(this,mt,e)}getClearColorUniformBuffer(){return n()(this,mt)}setTextureBufferGroup(e){a()(this,vt,e)}getTextureBufferGroup(){return n()(this,vt)}destroyTextureBufferGroup(){n()(this,vt)&&a()(this,vt,null)}recycle(e){this.destroyTextureBufferGroup(),e&&e.destroyTextureGroup(this),n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),n()(this,gt)&&(n()(this,gt).destroy(),a()(this,gt,null)),n()(this,mt)&&(n()(this,mt).destroy(),a()(this,mt,null)),a()(this,it,-1),a()(this,nt,-1),a()(this,ot,h.v.UNKNOWN),a()(this,ht,null),a()(this,ut,h.x.UNKNOWN),a()(this,ct,null),a()(this,dt,null),a()(this,ft,!1),a()(this,bt,!1),a()(this,wt,"")}},xt=r(9);function Tt(e,t){Et(e,t),t.add(e)}function Rt(e,t,r){Et(e,t),t.set(e,r)}function Et(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function St(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var At=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ct=new WeakMap,Pt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ot=new WeakMap,Dt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,er=new WeakMap,tr=new WeakMap,rr=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,ar=new WeakMap,or=new WeakMap,hr=new WeakMap,ur=new WeakMap,lr=new WeakMap,cr=new WeakMap,dr=new WeakMap,fr=new WeakSet,pr=new WeakSet,gr=new WeakSet,mr=new WeakSet,_r=new WeakSet,vr=new WeakSet,br=new WeakSet,wr=new WeakSet,yr=new WeakSet,xr=new WeakSet,Tr=new WeakSet,Rr=new WeakSet,Er=new WeakSet,Sr=new WeakSet,Ar=new WeakSet,kr=new WeakSet,Mr=new WeakSet,Cr=new WeakSet,Pr=new WeakSet,Ur=new WeakSet,Lr=new WeakSet,Ir=new WeakSet,Or=new WeakSet,Dr=new WeakSet,Br=new WeakSet,Gr=new WeakSet,Wr=new WeakSet,Nr=new WeakSet,Fr=new WeakSet,Vr=new WeakSet;function zr(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(St(this,Rr,ei).call(this),!n()(this,Nt)||!n()(this,Ft)||!n()(this,Nt).isGPUDeviceReady())return void(r instanceof VideoFrame&&r.close());const s=h.w.VS_BASE,a=St(this,Sr,ri).call(this,s),u=a.isLocked();if(u){const n=a.getPendingVideoFrame();!n||n.codedWidth==e&&n.codedHeight==t?r instanceof VideoFrame&&r.close():r instanceof VideoFrame?a.setPendingVideoFrame(r):(i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!"))}else{if(r instanceof VideoFrame){a.getPendingVideoFrame()!=r&&a.setPendingVideoFrame(r)}else i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!");a.setTextureLayerType(h.v.BASE_LAYER),a.setTextureType(h.x.EXTERNAL_TEX),a.lock()}this.markRenderingStateReady()}function Hr(e,t,r,i,s,a){St(this,Rr,ei).call(this);const o=h.w.VS_BASE,u=St(this,Sr,ri).call(this,o);if(u.setTextureLayerType(h.v.BASE_LAYER),u.setTextureType(h.x.GPU_TEX_YUV),u.clearPendingVideoFrame(),u.isLocked()){const e=u.getWidth(),i=u.getHeight();e==t&&i==r||(u.setWidth(t),u.setHeight(r),u.setIsNew(!0))}else u.setWidth(t),u.setHeight(r),u.setIsNew(!0),u.lock();const l=St(this,Dr,di).call(this,i,t,r,a),c=n()(this,Nt).writeToYuvTexturesBufferGroup(l,s);u.setTextureBufferGroup(c)}function jr(e,t,r,i){const s=St(this,Gr,pi).call(this,t,r);s.label="RgbaTexBuffer(".concat(e.getIndex(),")-").concat(s.size);let a=e.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,e,a,s),!a||!a.buffer)return console.warn("[updateRgbaBaseTexLayer()] texLayer(".concat(e.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,vr,qr).call(this,n()(this,At),t,r,i,a),this.markRenderingStateReady()}function Yr(e,t,r,i,s){const a=h.w.CURSOR,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Xr(e,t,r,i,s){const a=h.w.WATERMARK,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function qr(e,t,r,i,s){const a=h.w.VS_BASE,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BASE_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Kr(e,t,r){if(!St(this,Fr,_i).call(this,e))return;if(!n()(this,Ft))return void console.log("drawVideoFrameBaseTextureLayer() canvas is invalid? canvas=".concat(n()(this,Ft)));const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}const p=St(this,kr,ni).call(this);p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Qr(e,t,r){const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}let p=null;p=s.getTextureType()==h.x.EXTERNAL_TEX?St(this,kr,ni).call(this):St(this,Mr,si).call(this,n()(this,Ot)),p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Zr(e,t,r,i,n,s,a){const o=this.isUseFillMode({w:r.width,h:r.height,rotation:i}),h={width:s,height:a},u={width:e,height:t};return Object(xt.c)(o,h,u,r,i,n)}function Jr(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=e.width,o=e.height;s&&(a=s.width,o=s.height);let u,l,c,d,f=i==h.s||i==h.r?r:t,p=i==h.s||i==h.r?t:r,g=f/p*o,m=p/f*a;g>a?(u=0,c=1,l=(o-m)/2/o,d=1-l):(l=0,d=1,u=(a-g)/2/a,c=1-u),u=2*u-1,c=2*c-1,l=1-2*l,d=1-2*d;let _=[{x:c,y:l},{x:c,y:d},{x:u,y:d},{x:c,y:l},{x:u,y:l},{x:u,y:d}];n()(this,Nt)&&n()(this,Nt).updateVertexCoords(_)}function $r(e,t,r,i,n){var s,a,o,u;if(this.isUseFillMode({w:r,h:i,rotation:n}))s=0,a=0,o=1,u=1;else{var l=n==h.s||n==h.r?i:r,c=n==h.s||n==h.r?r:i,d=l/c*t;d>e?(s=0,o=1,u=1-(a=(t-c/l*e)/2/t)):(a=0,u=1,o=1-(s=(e-d)/2/e))}return{top:a=1-2*a,left:s=2*s-1,right:o=2*o-1,bottom:u=1-2*u}}function ei(){n()(this,Nt)||Object(o.u)("[WebGPURenderDisplay] renderer is not attached!")}function ti(e){if(e<0)throw new Error("[hasZIndexTexLayer] ".concat(e," is an invalid parameter!"));return n()(this,cr).has(e)}function ri(e){let t=null;return St(this,Er,ti).call(this,e)?t=n()(this,cr).get(e):(t=new yt(n()(this,At),e),n()(this,cr).set(e,t)),t}function ii(e,t,r){n()(this,Ft)&&(a()(this,rr,e),a()(this,ar,e&&r===tt.N?1:0),a()(this,or,t),e||a()(this,ir,r))}function ni(){const e={rotation:n()(this,Ot)};let t=null,r=n()(this,lr).get(h.w.VS_BASE);if(r){let i=r.buffer,s=r.uniform;if(s)if("yuvMode"in s)i&&i.destroy(),r=null;else if("rotation"in s){if(s.rotation!=e.rotation){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,i)}}else i&&i.destroy(),r=null}if(!r){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r)}return t?(r||(r={}),r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.VS_BASE,r),r):null}function si(e){if(-1==n()(this,nr))return null;const t={yuvMode:tt.V,colorRange:n()(this,nr),rotation:e};let r=null,i=n()(this,lr).get(h.w.VS_BASE);if(i){const e=i.uniform;if(r=i.buffer,e.yuvMode!=t.yuvMode||e.colorRange!=t.colorRange||e.rotation!=t.rotation){const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e,r)}}else{i={};const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e)}return r?(i.uniform=t,i.buffer=r,n()(this,lr).set(h.w.VS_BASE,i),i):null}function ai(){if(!n()(this,ur))return null;const e={cursorFlag:n()(this,or),cursorInfo:n()(this,ur)};let t=null,r=n()(this,lr).get(h.w.CURSOR);if(r){const i=r.uniform;if(t=r.buffer,i.cursorFlag!=e.cursorFlag||i.cursorInfo!=e.cursorInfo){const r=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,t)}}else{r={};const i=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),i)}return t?(r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.CURSOR,r),r):null}function oi(e,t){return Math.ceil(e/t)*t}function hi(e){const t=St(this,Pr,oi).call(this,1*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.rotation,r}function ui(e){const t=St(this,Pr,oi).call(this,3*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.yuvMode,r[1]=e.colorRange,r[2]=e.rotation,r}function li(e){const t=St(this,Pr,oi).call(this,5*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.cursorFlag,r[1]=e.cursorInfo.x,r[2]=e.cursorInfo.y,r[3]=e.cursorInfo.w,r[4]=e.cursorInfo.h,r}function ci(e){if(!e||0==e.length)return null;const t=St(this,Pr,oi).call(this,4*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function di(e,t,r,i){let n=t*r,s=e.subarray(0,n),a=0,o=0;i==tt.V?(o=t/2*r/2,a=o):i==tt.Z&&(o=t*r/2,a=0);let h=e.subarray(n,n+o);return{yPlane:{buffer:s,width:t,height:r},crPlane:{buffer:0!=a?e.subarray(n+o,n+o+a):null,width:t/2,height:r/2},cbPlane:{buffer:h,width:t/2,height:r/2}}}function fi(e,t,r){let i="",n=0,s=0,a=0;r==tt.V?(n=e/2*t/2,s=n,i="i420",a=Uint8Array.BYTES_PER_ELEMENT):r==tt.Z&&(n=e*t/2,s=0,i="nv12",a=Uint16Array.BYTES_PER_ELEMENT);const o=St(this,Pr,oi).call(this,Uint8Array.BYTES_PER_ELEMENT*e,256),h=St(this,Pr,oi).call(this,a*e/2,256);let u=o*t+h*t/2;s>0&&(u+=h*t/2);return{colorFormat:i,size:u,yPlane:{width:o,height:t},uvPlane:{width:h,height:t/2}}}function pi(e,t){const r=St(this,Pr,oi).call(this,Uint32Array.BYTES_PER_ELEMENT*e,256);return{colorFormat:"rgba",width:r,height:t,size:r*t}}function gi(e,t,r){if(t)if(t.buffer)if(r.size>t.buffer.size)n()(this,tr).recycleTextureBufferGroup(e),t.buffer=n()(this,tr).requestTextureBuffer(r),t.bufferConfig=r;else{"mapped"==t.buffer.mapState?t.bufferArray&&t.bufferArray.byteLength1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this),St(this,Ar,ii).call(this,1,n()(this,$t),n()(this,Dt));let i=null;i=t?St(this,Tr,$r).call(this,e.width,e.height,e.width,e.height,h.p):St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot)),St(this,br,Kr).call(this,e,i,r)}drawRemoteVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,Ft))return;if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this);const r=this.isRgbaMode(n()(this,Dt))?1:0;St(this,Ar,ii).call(this,r,n()(this,$t),n()(this,Dt));const i=St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot));St(this,wr,Qr).call(this,e,i,t)}drawCursor(e,t,r,i,s){if(!n()(this,Qt)||e&&(i<0||s<0))return;const o=h.w.CURSOR,u=St(this,Sr,ri).call(this,o),l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(u.setUVCoords(l.getUVCoords()),u.evalViewport(t,r,i,s,n()(this,Ft).height),e&&n()(this,$t)){const e={x:t/n()(this,Mt).width,y:r/n()(this,Mt).height,w:i/n()(this,Mt).width,h:s/n()(this,Mt).height};a()(this,ur,e)}else{const e={x:0,y:0,w:0,h:0};a()(this,ur,e)}const c=St(this,Cr,ai).call(this);c&&c.buffer&&u.setUniformBuffer(c.buffer)}setMultiView(e){a()(this,Vt,e)}setFillMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a()(this,Bt,e),a()(this,Gt,t)}getFillMode(){return n()(this,Bt)}setColorRange(e){a()(this,nr,e)}getFillModeForResolution(){return n()(this,Gt)}getTextureIndex(){return n()(this,kt)}isUseFillMode(e){let{w:t,h:r,rotation:i}=e;if(!n()(this,Bt))return!1;if(!n()(this,Gt))return!0;if(!t||!r)return!1;const s=i===h.s||i===h.s?r/t:t/r;return(Array.isArray(n()(this,Gt))?n()(this,Gt):[n()(this,Gt)]).some(e=>Math.abs(s-e)<.01)}setVideoMode(e){a()(this,Dt,e)}getVideoMode(){return n()(this,Dt)}setWatermarkFlag(e){a()(this,zt,e),e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))}setWatermarkRepeated(e){a()(this,Ht,e)}isWatermarkRepeated(){return!!n()(this,Ht)}setWatermarkOpacity(e){a()(this,jt,e||.15)}getWatermarkOpacity(){return n()(this,jt)}setWatermarkPosition(e){a()(this,Yt,e||16)}getWatermarkPosition(){return n()(this,Yt)}isSetWatermark(){return n()(this,zt)}isRgbaMode(e){return-1!==[tt.ab,tt.N].indexOf(e)}getTextureWidth(){return n()(this,Ct)}getTextureHeight(){return n()(this,Pt)}getCroppingParams(){return n()(this,Mt)}recoverTextures(){}updateWatermark(e,t,r){const i=h.w.WATERMARK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(a()(this,Xt,e),a()(this,qt,t),a()(this,zt,1),a()(this,sr,1),!St(this,Er,ti).call(this,h.w.VS_BASE)){console.log("[updateWatermark] base layer is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};return void s.setRawData(i)}const u=St(this,Sr,ri).call(this,h.w.VS_BASE).getViewport();if(u)try{const i=St(this,Gr,pi).call(this,e,t);i.label="WatermarkTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateWatermark()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,_r,Xr).call(this,n()(this,At),e,t,r,a),u&&s.setViewport(u);let o=s.getUVCoords(),h=St(this,Nr,mi).call(this);o||(o=new Float32Array(12)),o.set(h,0),s.setUVCoords(o),s.setRawData(null),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateWatermark() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateWatermark() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}else{console.log("[updateWatermark] base layer's viewport is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};s.setRawData(i)}}updateCursor(e,t,r){const i=h.w.CURSOR,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();a()(this,Zt,e),a()(this,Jt,t),a()(this,$t,1);try{const i=St(this,Gr,pi).call(this,e,t);i.label="CursorTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return void console.warn("[updateCursor()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!"));if("mapped"!=a.buffer.mapState)return void console.error("updateCursor() why buffer state is not mapped!");St(this,mr,Yr).call(this,n()(this,At),e,t,r,a),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateCursor() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateCursor() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}updateSelfVideoTextures(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;St(this,Rr,ei).call(this);const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Ft)||!n()(this,Nt))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length%4!=0)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(1!=e||1!=t){if(a()(this,Ct,e),a()(this,Pt,t),a()(this,Ot,u),Object.assign(n()(this,Mt),i),!s)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateSelfVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfVideoTextures() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close();St(this,Sr,ri).call(this,h.w.VS_BASE).setPendingVideoFrame(null)}}else{l.setPendingVideoFrame(null),St(this,Vr,vi).call(this),r&&r instanceof VideoFrame&&r.close();const e=St(this,Or,ci).call(this,r);if(e)if(n()(this,Nt)){let t=l.getClearColorUniformBuffer();t=n()(this,Nt).writeUniformBuffer("ClearColorUniformBuffer",e,t),l.setClearColorUniformBuffer(t),l.setTextureType(h.x.CLEAR_COLOR)}else console.warn("updateSelfVideoTextures() renderer is not attached!");else Object(o.u)("updateSelfVideoTextures() cannot create the uniform buffer array.");this.markRenderingStateReady()}}updateRemoteVideoTexturesImageBitmap(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Nt)||!n()(this,Ft))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(a()(this,Ct,e),a()(this,Pt,t),Number.isNaN(s)||a()(this,Ot,s),Object.assign(n()(this,Mt),i),!u)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close(),l.setPendingVideoFrame(null)}}updateRemoteVideoTextures(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6?arguments[6]:void 0;const c=h.w.VS_BASE,d=St(this,Sr,ri).call(this,c);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(!St(this,Fr,_i).call(this,l))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();St(this,Rr,ei).call(this);const f=this.isRgbaMode(n()(this,Dt));if(e<=0||t<=0||!i||!i.length||i.length!=e*t*3/2&&!f||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();if(f)try{St(this,fr,zr).call(this,e,t,i,!0);let o=u?0:1;a()(this,nr,o),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height)}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),d.setPendingVideoFrame(null),this.markRenderingStatePending()}finally{n()(this,tr).recycleTextureBufferGroup(d)}else try{const o=St(this,Br,fi).call(this,e,t,n()(this,Dt));o.label="YuvVideoTexBuffer(".concat(d.getIndex(),")-").concat(o.size),d.setColorFormat(o.colorFormat);let h=d.getTextureBufferGroup();if(h=St(this,Wr,gi).call(this,d,h,o),!h||!h.buffer)return console.warn("[updateRemoteVideoTextures()] texLayer(".concat(d.getIndex(),") cannot apply a GPUBuffer!")),void this.markRenderingStatePending();let l=u?0:1;a()(this,nr,l),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),St(this,pr,Hr).call(this,n()(this,At),e,t,i,h,n()(this,Dt)),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message," cs:").concat(e.stack)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(d),this.markRenderingStatePending()}}drawNextOutputPictureFrame(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];const d=h.w.VS_BASE,f=St(this,Sr,ri).call(this,d);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(f),void this.markRenderingStatePending();s=s||h.p;let p=(r=r||{top:0,left:0,width:e,height:t}).width!=n()(this,Mt).width||r.height!=n()(this,Mt).height,g=r.top!=n()(this,Mt).top||r.left!=n()(this,Mt).left,m=n()(this,Ft).width!=n()(this,Ut)||n()(this,Ft).height!=n()(this,Lt),_=e!=n()(this,Ct)||t!=n()(this,Pt),v=s!=n()(this,It);if((p||m||v)&&St(this,xr,Jr).call(this,n()(this,Ft),r.width,r.height,s,l),l){const e=Object(xt.d)(r,s),t=Object(xt.a)(l,e);f.evalViewport(t.x,t.y,t.width,t.height,n()(this,Ft).height)}else f.evalViewport(0,0,n()(this,Ft).width,n()(this,Ft).height,n()(this,Ft).height);if(p||g||_||v||!f.getUVCoords()){let i=Object(xt.b)({width:e,height:t},r,n()(this,Ft),s),a=f.getUVCoords();a||(a=new Float32Array(12)),a.set(i),f.setUVCoords(a)}let b=u?0:1;b!=n()(this,nr)&&a()(this,nr,b),a()(this,rr,0),a()(this,ir,tt.V),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,It,s),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),f.setColorFormat("i420");try{const r=St(this,Br,fi).call(this,e,t,tt.V);if(r.label="YuvShareTexBuffer(".concat(f.getIndex(),")-").concat(r.size),c){let s=f.getTextureBufferGroup();if(s=St(this,Wr,gi).call(this,f,s,r),!s||!s.buffer)return console.warn("[drawNextOutputPictureFrame()] texLayer(".concat(f.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,pr,Hr).call(this,n()(this,At),e,t,i,s,tt.V);const a=St(this,Mr,si).call(this,n()(this,It));a&&a.buffer&&f.setUniformBuffer(a.buffer)}n()(this,$t)?a()(this,or,1):a()(this,or,0),a()(this,Qt,1),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] drawNextOutputPictureFrame() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_drawNextOutputPictureFrame() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(f),this.markRenderingStatePending()}}clearCanvas(e){n()(this,Nt)&&n()(this,Nt).clearAttachedCanvas()}updateSelfMaskImage(e,t,r){const i=h.w.MASK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(!St(this,Er,ti).call(this,h.w.VS_BASE))return console.log("[updateSelfMaskImage] base layer is not ready."),n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();try{const i=St(this,Gr,pi).call(this,e,t);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateSelfMaskImage()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();if(a.buffer.label="SelfMaskImageTexBuffer(".concat(s.getIndex(),")-").concat(i.size),s.setTextureLayerType(h.v.BLEND_LAYER),s.setTextureType(h.x.GPU_TEX_RGBA),s.isLocked()){const r=s.getWidth(),i=s.getHeight();r==e&&i==t||(s.setWidth(e),s.setHeight(t),s.setIsNew(!0))}else s.setWidth(e),s.setHeight(t),s.setIsNew(!0),s.lock();const o=n()(this,Nt).writeToRgbaTextureBuffer(n()(this,At),e,t,r,a);s.setTextureBufferGroup(o);const u=St(this,Sr,ri).call(this,h.w.VS_BASE),l=u.getViewport();l&&s.setViewport(l),s.setUVCoords(u.getUVCoords()),this.isSetWatermark()&&n()(this,Xt)&&n()(this,qt),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateSelfMaskImage() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfMaskImage() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}readPixelsSyncRequest(e,t,r,i){}isAvaiable(){return!0}markRenderingStateReady(){a()(this,Kt,h.k.READY)}markRenderingStateRendering(){a()(this,Kt,h.k.RENDERING)}markRenderingStatePending(){a()(this,Kt,h.k.PENDING)}markRenderingStateIdle(){a()(this,Kt,h.k.IDLE)}isRenderingStateReady(){return n()(this,Kt)===h.k.READY}isInTargetRenderingState(e){return n()(this,Kt)===e}getWatermarkWidth(){return n()(this,Xt)}getWatermarkHeight(){return n()(this,qt)}getIndex(){return n()(this,At)}getRenderingState(){return n()(this,Kt)}recycle(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(const[t,r]of n()(this,cr))r&&(n()(this,tr).recycleTextureBufferGroup(r,e),r.recycle(n()(this,tr)));a()(this,dr,{top:0,left:0,bottom:0,right:0}),this.markRenderingStateIdle(),n()(this,cr).clear(),n()(this,lr).clear(),this.unbindSsrc()}cleanup(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.recycle(e),this.removeRenderer(),this.detachCanvas(),this.removeGPUResMgr()}clear(){console.log("WebGPURenderDisplay.clear"),this.clearCanvas(),a()(this,Qt,0),a()(this,$t,0),this.recycle()}clearDisplay(){console.log("WebGPURenderDisplay.clearDisplay"),this.clearCanvas()}getTextureLayersMap(){return n()(this,cr)}getTextureLayerByZIndex(e){return St(this,Sr,ri).call(this,e)}getUsedBuffersCount(){let e=0;for(const[t,r]of n()(this,cr))r&&r.getTextureBufferGroup()&&r.getTextureBufferGroup().buffer&&e++;return e}consumePendingGPUEvents(){if(n()(this,zt)){const e=St(this,Sr,ri).call(this,h.w.WATERMARK).getRawData();e&&this.updateWatermark(n()(this,Xt),n()(this,qt),e.data)}}resizeCanvasTo(e,t){n()(this,Ft)&&(n()(this,Ft).width=e,n()(this,Ft).height=t)}};function wi(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var yi=new WeakMap,xi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Ei=new WeakMap;var Si=class{constructor(e,t,r){wi(this,yi,{writable:!0,value:0}),wi(this,xi,{writable:!0,value:null}),wi(this,Ti,{writable:!0,value:null}),wi(this,Ri,{writable:!0,value:h.t.AVAILABLE}),wi(this,Ei,{writable:!0,value:null}),a()(this,yi,e),a()(this,Ri,t),a()(this,Ei,r),a()(this,xi,[]),a()(this,Ti,[])}initPool(e){if(e>n()(this,yi))throw new Error("initSize=".concat(e," is larger than maxSize=").concat(n()(this,yi),", invalid!"));if(e<0)throw new Error("initSize=".concat(e," is smaller than 0, invalid!"));for(let t=0;t=n()(this,yi))return;let t=0;if(n()(this,xi).length+e>=n()(this,yi)&&(t=n()(this,yi)-n()(this,xi).length),t>0){const e=n()(this,xi).length;for(let r=0;r0&&void 0!==arguments[0])||arguments[0])&&this.isPoolEmpty()&&this.expandPool(4);const e=n()(this,xi).pop();return e&&(e.markRenderingStatePending(),n()(this,Ti).push(e)),e}recycle(e){if(n()(this,xi).length0&&void 0!==arguments[0])||arguments[0];n()(this,xi).forEach(t=>{t.cleanup(e)}),n()(this,Ti).forEach(t=>{t.cleanup(e)}),a()(this,xi,[]),a()(this,Ti,[])}isPoolEmpty(){return 0==n()(this,xi).length}getInUseRenderDisplays(){return n()(this,Ti)}getAllRenderDisplays(){return n()(this,xi)}isServeForVideoRendering(){return n()(this,Ri)===h.t.VIDEO}isServeForShareRendering(){return n()(this,Ri)===h.t.SHARE}isServingForNow(e){return n()(this,Ri)===e}};function Ai(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ki=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Pi=new WeakMap,Ui=new WeakMap;class Li{getVideoRenderDisplay(e,t,r,i){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getSharingRenderDisplay(e,t,r){throw new Error("getSharingRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,r){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}var Ii=new WeakMap,Oi=new WeakMap;class Di extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Ii,{writable:!0,value:new Map}),Ai(this,Oi,{writable:!0,value:!1}),a()(this,Oi,e)}setCanvasAlphaChannelEnability(e){a()(this,Oi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Ze.a(e,t,r,s,a,o,h,n()(this,Oi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Ii).get(e);if(!a){let i=[];a=[i,[]],n()(this,Ii).set(e,a);let o=new Ze.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Oi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Ze.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,n()(this,Oi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Ii).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Ze.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Oi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Ii).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Ii).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Ii).delete(r),n()(this,Ii).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Ii)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t,null);for(const[e,t]of n()(this,Ii)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Ii,new Map)}cleanupByCanvas(e){if(n()(this,Ii).get(e)){let t=n()(this,Ii).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Ii).delete(e)}}}}var Bi=new WeakMap,Gi=new WeakMap;class Wi extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Bi,{writable:!0,value:new Map}),Ai(this,Gi,{writable:!0,value:!1}),a()(this,Gi,e)}setCanvasAlphaChannelEnability(e){a()(this,Gi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Je.a(e,t,r,s,a,o,h,n()(this,Gi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Bi).get(e);if(!a){let i=[];a=[i,[]],n()(this,Bi).set(e,a);let o=new Je.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Gi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Je.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,void 0,n()(this,Gi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Bi).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Je.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Gi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Bi).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Bi).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Bi).delete(r),n()(this,Bi).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Bi)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t);for(const[e,t]of n()(this,Bi)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Bi,new Map)}cleanupByCanvas(e){if(n()(this,Bi).get(e)){let t=n()(this,Bi).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Bi).delete(e)}}}}var Ni=new WeakMap,Fi=new WeakMap,Vi=new WeakMap;class zi extends Li{constructor(){super(),Ai(this,Ni,{writable:!0,value:new Map}),Ai(this,Fi,{writable:!0,value:new Map}),Ai(this,Vi,{writable:!0,value:null})}setGPUResourceMgr(e){a()(this,Vi,e)}getVideoRenderDisplay(e,t,r,i){let s=n()(this,Ni).get(e);s||(s=new Si(r,h.t.VIDEO,n()(this,Vi)),s.initPool(r),n()(this,Ni).set(e,s));let a=s.pop();return a?(a.setMultiView(!0),a):null}getSharingRenderDisplay(e,t,r){r&&r.clearCache&&n()(this,Fi).clear();let i=n()(this,Fi).get(e);return i||(i=new Si(1,h.t.SHARE,n()(this,Vi)),i.initPool(1),n()(this,Fi).set(e,i)),i.pop()}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=new bi(r,n()(this,Vi));return s.addRenderer(i),s.attachCanvas(e),s}getInUseCanvasRenderDisplayList(e){let t=[],r=null;if(e==h.t.VIDEO?r=n()(this,Ni):e==h.t.SHARE&&(r=n()(this,Fi)),r)for(const[e,i]of r){let r={};r.canvas=e,r.renderDisplays=i.getInUseRenderDisplays(),r.renderDisplays.length>0&&t.push(r)}return t}recycleRenderDisplay(e,t){if(e){const t=e.getAttachedCanvas();if(t){let r=n()(this,Ni).get(t);r&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),r.recycle(e));let i=n()(this,Fi).get(t);i&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),i.recycle(e))}}}cleanup(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null==e||null===(t=e.cleanup)||void 0===t||t.call(e,r);for(const[e,t]of n()(this,Ni))t.cleanup(r);for(const[e,t]of n()(this,Fi))t.cleanup(r)}cleanupByCanvas(e){let t=n()(this,Ni).get(e);t&&(t.cleanup(),n()(this,Ni).delete(e));let r=n()(this,Fi).get(e);r&&(r.cleanup(),n()(this,Fi).delete(e))}collectInUseRenderDisplays(e){return this.getInUseCanvasRenderDisplayList(e)}collectInUseRenderDisplaysByCanvas(e,t){let r=null;if(e)if(t==h.t.VIDEO){r=n()(this,Ni).get(e).getInUseRenderDisplays()}else if(t==h.t.SHARE){r=n()(this,Fi).get(e).getInUseRenderDisplays()}return r}getRenderDisplayMap(e){let t=null;return e==h.t.VIDEO?t=n()(this,Ni):e==h.t.SHARE&&(t=n()(this,Fi)),t}}var Hi=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ai(this,ki,{writable:!0,value:null}),Ai(this,Mi,{writable:!0,value:null}),Ai(this,Ci,{writable:!0,value:null}),Ai(this,Pi,{writable:!0,value:null}),Ai(this,Ui,{writable:!0,value:!1}),a()(this,Ui,e)}setGPUResourceMgr(e){a()(this,Pi,e)}isEnableCanvasAlphaChannel(){return n()(this,Ui)}setCanvasAlphaChannelEnability(e){a()(this,Ui,e),n()(this,ki)&&n()(this,ki).setCanvasAlphaChannelEnability(e),n()(this,Mi)&&n()(this,Mi).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),n()(this,ki)}getWebGL2RenderDisplayMgr(){return n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),n()(this,Mi)}getWebGPURenderDisplayMgr(){return n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),n()(this,Ci)}getVideoRenderDisplay(e,t,r,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),l=n()(this,ki).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),l=n()(this,Mi).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),l=n()(this,Ci).getVideoRenderDisplay(t,r,i,s),l&&(l.addRenderer(o),l.attachCanvas(t),l.setGPUResMgr(n()(this,Pi)))),l}getSharingRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),o=n()(this,ki).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),o=n()(this,Mi).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),o=n()(this,Ci).getSharingRenderDisplay(t,r,s),o&&(o.addRenderer(i),o.attachCanvas(t),o.setGPUResMgr(n()(this,Pi)))),o}createVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=null;return e==h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),u=n()(this,ki).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),u=n()(this,Mi).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),u=n()(this,Ci).createVideoRenderDisplay(t,r,i,s,o),u.addRenderer(s),u.attachCanvas(t),u.setGPUResMgr(n()(this,Pi))),u}recycleRenderDisplay(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e===h.j.WEBGPU?n()(this,Ci)&&n()(this,Ci).recycleRenderDisplay(r,i,s):e===h.j.WEBGL?n()(this,ki)&&n()(this,ki).recycleRenderDisplay(t,r,s):e===h.j.WEBGL_2&&n()(this,Mi)&&n()(this,Mi).recycleRenderDisplay(t,r,s)}collectInUseRenderDisplays(e,t){let r=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(r=n()(this,Ci).collectInUseRenderDisplays(t)),r}collectInUseRenderDisplaysByCanvas(e,t,r){let i=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(i=n()(this,Ci).collectInUseRenderDisplaysByCanvas(t,r)),i}getRenderDisplayMap(e,t){if(e===h.j.WEBGL){if(n()(this,ki))return n()(this,ki).getRenderDisplayMap()}else if(e===h.j.WEBGPU){if(n()(this,Ci))return n()(this,Ci).getRenderDisplayMap(t)}else if(e===h.j.WEBGL_2&&n()(this,Mi))return n()(this,Mi).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,ki)?n()(this,ki).onRestoredFromContextLost(e,t,r,i,s,a):n()(this,Mi)?n()(this,Mi).onRestoredFromContextLost(e,t,r,i,s,a):null}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==n()(this,ki)&&n()(this,ki).cleanup(e,t),n()(this,Mi)&&n()(this,Mi).cleanup(e,t),null!==n()(this,Ci)&&n()(this,Ci).cleanup(t,r)}cleanupByCanvas(e){null!==n()(this,ki)&&n()(this,ki).cleanupByCanvas(e),null!==n()(this,Mi)&&n()(this,Mi).cleanupByCanvas(e),null!==n()(this,Ci)&&n()(this,Ci).cleanupByCanvas(e)}};function ji(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var Yi=new WeakMap,Xi=new WeakMap,qi=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;var $i=class{constructor(e){ji(this,Yi,{writable:!0,value:h.f.VERTEX_BUFFER}),ji(this,Xi,{writable:!0,value:{}}),ji(this,qi,{writable:!0,value:null}),ji(this,Ki,{writable:!0,value:0}),ji(this,Qi,{writable:!0,value:0}),ji(this,Zi,{writable:!0,value:[]}),ji(this,Ji,{writable:!0,value:new Map}),a()(this,qi,e)}acquireBuffer(e,t,r){let i,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?n()(this,Ji).has(e)?i=n()(this,Ji).get(e):n()(this,Zi).length>0?(i=n()(this,Zi).pop(),n()(this,Ji).set(e,i)):(i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),n()(this,Ji).set(e,i)):i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),i}releaseBuffer(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Ji).has(e)){const t=n()(this,Ji).get(e);r?n()(this,Zi).push(t):t.destroy(),n()(this,Ji).delete(e)}else r||-1!=n()(this,Zi).indexOf(t)&&(n()(this,Zi)[index]=n()(this,Zi)[n()(this,Zi).length-1],n()(this,Zi).pop(),t.destroy())}getNumUsedBuffers(){return n()(this,Ki)}getNumFreeBuffers(){return n()(this,Qi)}cleanup(){n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Ji).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,n()(this,Ji).clear(),a()(this,Ki,0),a()(this,Qi,0)}release(e){e==h.n.OVERUSE&&(n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,a()(this,Qi,0))}getResourceType(){return n()(this,Yi)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Ji))e++,t+=s.size,r+="[GPUBufferMgr] entry{key:".concat(i,", buffer:{label:").concat(s.label," size:").concat(s.size,"}}\n");for(const r of n()(this,Zi))e++,t+=r.size;return r+="[GPUBufferMgr] freeBuffers{size:".concat(n()(this,Zi).length,"}\n"),r+="[GPUBufferMgr] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,Xi).type=n()(this,Yi),n()(this,Xi).count=e,n()(this,Xi).usedBytes=t,n()(this,Xi).output=r,n()(this,Xi)}onOccupancyLevelEvaluated(e){console.log("[GPUBufferManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUBufferManager_onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}};function en(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var tn=new WeakMap,rn=new WeakMap,nn=new WeakMap;var sn=class{constructor(){en(this,tn,{writable:!0,value:h.f.TEXTURE}),en(this,rn,{writable:!0,value:[]}),en(this,nn,{writable:!0,value:[]})}acquire(e){let t=null;const r=n()(this,rn).findIndex(t=>t&&t.width==e.w&&t.height==e.h&&t.format==e.format&&t.usage==e.usage);return r>-1&&(t=n()(this,rn).splice(r,1)[0]),t&&n()(this,nn).push(t),t}recycle(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=n()(this,nn).indexOf(e);-1!=r&&n()(this,nn).splice(r,1),t?e.destroy():(n()(this,rn).push(e),e.label="")}pushToAvailablePool(e){e&&n()(this,rn).push(e)}pushToInUsePool(e){e&&n()(this,nn).push(e)}release(e){if(e==h.n.OVERUSE&&n()(this,rn).length>0){for(const e of n()(this,rn))e.destroy();n()(this,rn).length=0}}cleanup(){for(const e of n()(this,rn))e.destroy();for(const e of n()(this,nn))e.destroy();n()(this,rn).length=0,n()(this,nn).length=0}getAvailablePool(){return n()(this,rn)}getInUsedPool(){return n()(this,nn)}getResourceType(){return n()(this,tn)}};function an(e,t){hn(e,t),t.add(e)}function on(e,t,r){hn(e,t),t.set(e,r)}function hn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function un(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakSet,gn=new WeakSet,mn=new WeakSet,_n=new WeakSet,vn=new WeakSet;function bn(e){let t=n()(this,dn).get(e.level),r=null;return t?(r=t.acquire(e),r||(r=un(this,mn,yn).call(this,e),r?t.pushToInUsePool(r):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e))))):(r=un(this,mn,yn).call(this,e),r?(t=new sn,t.pushToInUsePool(r),n()(this,dn).set(e.level,t)):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e)))),r}function wn(e){const t=e.zOrder;let r=n()(this,fn).get(t);return r?(e.w>r.width||e.h>r.height)&&(r.destroy(),r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)):(r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)),r}function yn(e){if(!n()(this,ln))return null;if(0==e.w||0==e.h)return null;const t={size:{width:e.w,height:e.h},format:e.format,usage:e.usage};return e.sampleCount>0&&(t.sampleCount=e.sampleCount),n()(this,ln).createTexture(t)}function xn(e){let t=h.u[h.u.length-1];for(let r=0;r1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=this.assembleTextureConfig(e.width,e.height,e.usage,e.format,e.sampleCount);let i=n()(this,dn).get(r.level);if(i)i.recycle(e,t);else if(console.warn("recycleTexture(".concat(e.label,") texture is not found in the map!, destroy:").concat(t)),t)e.destroy();else{const t=new sn;t.pushToAvailablePool(e),n()(this,dn).set(r.level,t)}}cleanup(){for(const[e,t]of n()(this,dn))t&&t.cleanup();n()(this,dn).clear()}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,dn))if(s){const n=s.getAvailablePool();for(const r of n)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);const a=s.getInUsedPool();for(const r of a)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);(n.length>0||a.length>0)&&(r+="[GPUTexturePool] level:".concat(i," pool:{ava_count:").concat(n.length," in_used_count:").concat(a.length,"}\n"))}return r+="[GPUTexturePool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,cn).type=h.f.TEXTURE,n()(this,cn).count=e,n()(this,cn).usedBytes=t,n()(this,cn).output=r,n()(this,cn)}onOccupancyLevelEvaluated(e){if(console.log("[GPUTextureManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUTextureManager_onOccupancyLevelEvaluated() level:".concat(e)),e==h.n.OVERUSE)for(const[t,r]of n()(this,dn))r&&r.release(e)}};function En(e,t){An(e,t),t.add(e)}function Sn(e,t,r){An(e,t),t.set(e,r)}function An(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function kn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Mn=new WeakMap,Cn=new WeakMap,Pn=new WeakMap,Un=new WeakMap,Ln=new WeakSet,In=new WeakSet;function On(e,t,r){if(n()(this,Pn).set(e,t),r){let e=Array.from(n()(this,Pn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Pn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Pn).set(t,r)})}}function Dn(e,t){if(!e||0==e.length)return null;let r=0,i=0,n=null;for(const s of e)"mapped"==s.mapState?(r+=1,n||s.size>=t&&(n=s)):i+=1;if(r>0&&0==i||r>=2&&0!=i){if(n){const t=e.indexOf(n);-1!=t&&e.splice(t,1)}return n}return null}var Bn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;En(this,In),En(this,Ln),Sn(this,Mn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Sn(this,Cn,{writable:!0,value:0}),Sn(this,Pn,{writable:!0,value:new Map}),Sn(this,Un,{writable:!0,value:0}),a()(this,Cn,e),a()(this,Un,t)}isUpToThreshold(e,t){if(e!=n()(this,Cn)||t<=0)return!1;if(0==n()(this,Un))return!1;const r=n()(this,Pn).get(t);return!!r&&r.length>=n()(this,Un)}push(e,t,r){if(e!=n()(this,Cn)||!r||t<=0)return!1;let i=null,s=!1;if(n()(this,Pn).has(t)){if(i=n()(this,Pn).get(t),i||(i=[],s=!0),!(i.length1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r=e.level,i=e.bytesPerRow,s=e.size;if(r!=n()(this,Cn)||i<=0)return console.error("[GPUBufferPoolEntry] acquire() level(".concat(r,") or bpr=").concat(i," is invalid!")),null;let a=null,o=!1;if(n()(this,Pn).has(i)){let e=n()(this,Pn).get(i);if(e){const t=e.findIndex(e=>"mapped"==e.mapState&&e.size>=s);t>-1?a=e.splice(t,1)[0]:o=!0}else o=!0}else o=!0;if(o&&!a&&!t){let t=2,o=!1;r>=h.m[h.h]&&(o=!0);for(const[r,h]of n()(this,Pn))if((t>0||o)&&r>i){if(a=kn(this,In,Dn).call(this,h,s),a){e.bytesPerRow=r;break}t--}}return a}recycle(e,t,r){if(e!=n()(this,Cn)||t<=0||!r)return!1;let i=!1;if(n()(this,Pn).has(t)){let e=!1,s=n()(this,Pn).get(t);s||(s=[],e=!0),s.push(r),e&&kn(this,Ln,On).call(this,t,s,e),i=!0}else i=this.push(e,t,r);return i}release(e){if(e==h.n.OVERUSE){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}}cleanup(){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}getPool(){return n()(this,Pn)}hasBytesPerRowAsKey(e){return n()(this,Pn).has(e)}getResourceType(){return n()(this,Mn)}getPoolThreshold(){return n()(this,Un)}canLendBufferCrossLevel(e,t){let r=!0;if(n()(this,Pn).has(t)){const i=n()(this,Pn).get(t);if(i){let t=0,n=0;for(const e of i)"mapped"==e.mapState?t+=1:n+=1;if(e>=h.m[h.h])r=t>0;else{const e=t>=2&&0!=n;r=t>0&&0==n||e}}}else r=!1;return r}};function Gn(e,t){Nn(e,t),t.add(e)}function Wn(e,t,r){Nn(e,t),t.set(e,r)}function Nn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Vn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,qn=new WeakSet,Kn=new WeakSet,Qn=new WeakSet,Zn=new WeakSet,Jn=new WeakSet,$n=new WeakSet,es=new WeakSet;function ts(e){if(!e)return;const t=e.colorFormat;if("rgba"==t){const t=Fn(this,Kn,rs).call(this,e.height);t>0&&t0&&t0&&t-1&&t+1<=h.m.length-1?h.m[t+1]:e}function ns(e){if(!e)return 0;let t=0;const r=e.colorFormat;if("rgba"==r?t=e.height:"i420"!=r&&"nv12"!=r||(t=e.yPlane.height),0==t)return 0;let i=0;return i=t<=h.m[2]?90:t>h.m[2]&&t<=h.m[5]?60:15,i}function ss(e){return e.mapAsync(GPUMapMode.WRITE,0,e.size)}function as(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Yn).set(e,t),r){let e=Array.from(n()(this,Yn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Yn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Yn).set(t,r)})}}function os(e){if(!e)return null;let t=e.level,r=e.bytesPerRow;e.size;const i=Fn(this,Qn,is).call(this,t);if(i<=t)return null;if(!n()(this,Yn).has(i))return null;const s=n()(this,Yn).get(i);if(!s)return null;if(!s.hasBytesPerRowAsKey(r))return null;if(!s.canLendBufferCrossLevel(t,r))return null;const a={};Object.assign(a,e),a.level=i;const o=s.acquire(a,!0);return o&&(e.level=i,e.bytesPerRow=a.bytesPerRow),o}var hs=class{constructor(e){Gn(this,es),Gn(this,$n),Gn(this,Jn),Gn(this,Zn),Gn(this,Qn),Gn(this,Kn),Gn(this,qn),Wn(this,Vn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Wn(this,zn,{writable:!0,value:{}}),Wn(this,Hn,{writable:!0,value:null}),Wn(this,jn,{writable:!0,value:[]}),Wn(this,Yn,{writable:!0,value:new Map}),Wn(this,Xn,{writable:!0,value:0}),a()(this,Hn,e)}acquire(e){if(!e)throw new Error("acquire() bufferConfig is invalid!");Fn(this,qn,ts).call(this,e);let t=null,r=null;if(0==n()(this,Yn).size){if(n()(this,Hn)){const i=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});let s=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),s=!0}i&&(a()(this,Xn,n()(this,Xn)+1),t=i,t.label="".concat(e.label,"-").concat(n()(this,Xn))),Fn(this,$n,as).call(this,e.level,r,s)}}else if(n()(this,Yn).has(e.level)){r=n()(this,Yn).get(e.level);let i=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}if(t=r.acquire(e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else if(t=Fn(this,es,os).call(this,e),!t)if(r.isUpToThreshold(e.level,e.bytesPerRow))console.log("[GPUBufferPool]acquire() next level cant help and pool is up to threshold! Only to wait for a while...");else{const r=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});r&&(a()(this,Xn,n()(this,Xn)+1),t=r,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}else{let i=!1;if(t=Fn(this,es,os).call(this,e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else{const s=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}s&&(a()(this,Xn,n()(this,Xn)+1),t=s,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}return t&&n()(this,jn).push(t),t}recycle(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return;const i=n()(this,jn).indexOf(e);if(-1!=i?n()(this,jn).splice(i,1):(console.error("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r)),Object(o.o)("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r))),t)if(r){"unmapped"!=e.mapState&&e.unmap(),"unmapped"==e.mapState&&Fn(this,Jn,ss).call(this,e).then(()=>{}).catch(t=>{console.warn("mapAsyncBuffer() error:".concat(t)),e.destroy(),e=null});let r=n()(this,Yn).get(t.level);r&&r.recycle(t.level,t.bytesPerRow,e),e.label=""}else e.destroy(),e=null;else e.destroy()}recycleInUsedGPUBuffers(e,t){for(const[r,i]of e)for(const e of i)if(e){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),this.recycle(r.buffer,r.bufferConfig)),e.destroyTextureBufferGroup(t)}}recycleTextureBufferGroup(e,t){if(e&&t){const r=t.acquireGPUBufferPool();if(r){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),r.recycle(i.buffer,i.bufferConfig),e.destroyTextureBufferGroup(t))}}}cleanup(){for(const e of n()(this,jn))"unmapped"!=e.mapState&&e.unmap(),e.destroy();n()(this,jn).length=0;for(const[e,t]of n()(this,Yn))t&&t.cleanup();n()(this,Yn).clear()}release(e){if(e==h.n.OVERUSE){for(const[t,r]of n()(this,Yn))r&&r.release(e);n()(this,Yn).clear()}}getResourceType(){return n()(this,Vn)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Yn))if(s){const n=s.getPool();for(const[a,o]of n){e+=o.length;let n=0,h=0;for(const e of o)t+=e.size,"mapped"==e.mapState?n+=1:h+=1;r+="[GPUBufferPool] level:".concat(i," bpr:").concat(a," threshold:").concat(s.getPoolThreshold()," pool:{len:").concat(o.length," ava_count:").concat(n," pending_count:").concat(h,"}\n")}}let i=0;for(const r of n()(this,jn))e+=1,t+=r.size,i+=1;return r+="[GPUBufferPool] in_used_count:".concat(i,"\n"),r+="[GPUBufferPool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,zn).type=n()(this,Vn),n()(this,zn).count=e,n()(this,zn).usedBytes=t,n()(this,zn).output=r,n()(this,zn)}onOccupancyLevelEvaluated(e){Object(o.o)("WGPU GPUBufferPool_onOccupancyLevelEvaluated() level:".concat(e)),console.log("[GPUBufferPool] onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}getInUsedPoolCount(){return n()(this,jn).length}};function us(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ls=new WeakMap,cs=new WeakMap;var ds=class{constructor(e){us(this,ls,{writable:!0,value:null}),us(this,cs,{writable:!0,value:null}),a()(this,ls,e),e&&a()(this,cs,e.features)}getAdapterFeatures(){return n()(this,cs)}getAdapterLimits(){return n()(this,ls)?n()(this,ls).limits:null}queryMaxTextureDimension2D(){const e=this.getAdapterLimits();return e?e.maxTextureDimension2D:0}queryMaxBufferSize(){const e=this.getAdapterLimits();return e?e.maxBufferSize:0}queryAdapterFeature(e){return!(!n()(this,cs)||!e)&&n()(this,cs).has(e)}isTimestampQuerySupported(){return this.queryAdapterFeature("timestamp-query")}getGPUAdapter(){return n()(this,ls)}cleanup(){a()(this,ls,null),a()(this,cs,null)}};function fs(e,t){gs(e,t),t.add(e)}function ps(e,t,r){gs(e,t),t.set(e,r)}function gs(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ms(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var _s=new WeakMap,vs=new WeakMap,bs=new WeakMap,ws=new WeakMap,ys=new WeakSet,xs=new WeakSet,Ts=new WeakSet;function Rs(){let e=h.n.LOW;const t="---WatchDog(".concat(n()(this,ws),") starts analyzing---\n");console.log("".concat(t));for(const t of n()(this,vs)){const r=t.collectResourceInfo();console.log("".concat(r.output));const i=ms(this,xs,Es).call(this,r);t.onOccupancyLevelEvaluated(i),i>e&&(e=i)}const r=ms(this,Ts,Ss).call(this,e);r!=n()(this,_s)&&(clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,r),this.monitor())}function Es(e){let t=h.n.LOW;return e.type==h.f.TEXTURE?t=e.usedBytes<=31457280?h.n.LOW:e.usedBytes<=94371840?h.n.MEDIUM:e.usedBytes<=157286400?h.n.HIGH:h.n.OVERUSE:e.type==h.f.VERTEX_BUFFER?t=e.usedBytes<=5242880?h.n.LOW:e.usedBytes<=10485760?h.n.MEDIUM:e.usedBytes<=15728640?h.n.HIGH:h.n.OVERUSE:e.type==h.f.TEXTURE_BUFFER&&(t=e.usedBytes<=52428800?h.n.LOW:e.usedBytes<=104857600?h.n.MEDIUM:e.usedBytes<=209715200?h.n.HIGH:h.n.OVERUSE),t}function Ss(e){let t=0;switch(e){case h.n.LOW:t=h.o.LOW;break;case h.n.MEDIUM:t=h.o.MEDIUM;break;case h.n.HIGH:t=h.o.HIGH;break;case h.n.OVERUSE:t=h.o.OVERUSE;break;default:t=h.o.MEDIUM}return t}var As=class{constructor(e){fs(this,Ts),fs(this,xs),fs(this,ys),ps(this,_s,{writable:!0,value:h.o.HIGH}),ps(this,vs,{writable:!0,value:[]}),ps(this,bs,{writable:!0,value:null}),ps(this,ws,{writable:!0,value:""}),a()(this,ws,e)}addObservable(e){n()(this,vs).push(e)}removeObservable(e){const t=n()(this,vs).indexOf(e);-1!=t&&n()(this,vs).splice(t,1)}removeAllObservables(){n()(this,vs).length=0}monitor(){n()(this,bs)||a()(this,bs,setInterval(()=>{ms(this,ys,Rs).call(this)},n()(this,_s)))}cleanup(){this.removeAllObservables(),clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,0)}};function ks(e,t,r){Ms(e,t),t.set(e,r)}function Ms(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}var Cs=new WeakMap,Ps=new WeakMap,Us=new WeakMap,Ls=new WeakMap,Is=new WeakMap,Os=new WeakMap,Ds=new WeakMap,Bs=new WeakMap,Gs=new WeakMap,Ws=new WeakMap,Ns=new WeakMap,Fs=new WeakSet;function Vs(e){return void 0!==e&&"yPlaneTex"in e}var zs=class{constructor(){var e,t;Ms(e=this,t=Fs),t.add(e),ks(this,Cs,{writable:!0,value:null}),ks(this,Ps,{writable:!0,value:null}),ks(this,Us,{writable:!0,value:null}),ks(this,Ls,{writable:!0,value:null}),ks(this,Is,{writable:!0,value:null}),ks(this,Os,{writable:!0,value:null}),ks(this,Ds,{writable:!0,value:null}),ks(this,Bs,{writable:!0,value:null}),ks(this,Gs,{writable:!0,value:null}),ks(this,Ws,{writable:!0,value:null}),ks(this,Ns,{writable:!0,value:""})}addRendererProviderModule(e){a()(this,Ws,e)}setLabel(e){a()(this,Ns,e)}async initialize(){if(navigator.gpu){if(!n()(this,Cs)&&(a()(this,Cs,await navigator.gpu.requestAdapter()),!n()(this,Cs)))return console.error("[WebGPUResManager] initialize() Couldn't request WebGPU adapter."),Object(o.u)("WebGPU device was lost: ".concat(info.message," reason=").concat(info.reason)),void Object(o.p)("WebGPUDeviceLost");n()(this,Us)||(a()(this,Us,await n()(this,Cs).requestDevice()),n()(this,Us).lost.then(async e=>{"destroyed"!=e.reason&&(console.error("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.u)("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.p)("WebGPUDeviceLost")),n()(this,Ws)&&n()(this,Ws).rendererUnconfigureGPUContext(),this.cleanup(),"destroyed"!=e.reason&&(a()(this,Us,null),await this.initialize(),n()(this,Ws)&&n()(this,Ws).rendererReinitialize())})),n()(this,Ps)||("function"==typeof n()(this,Cs).requestAdapterInfo?a()(this,Ps,await n()(this,Cs).requestAdapterInfo()):"info"in n()(this,Cs)&&a()(this,Ps,n()(this,Cs).info)),n()(this,Ls)||a()(this,Ls,navigator.gpu.getPreferredCanvasFormat()),n()(this,Is)||a()(this,Is,new $i(n()(this,Us))),n()(this,Os)||a()(this,Os,new Rn(n()(this,Us))),n()(this,Ds)||a()(this,Ds,new hs(n()(this,Us))),n()(this,Bs)||a()(this,Bs,new ds(n()(this,Cs))),n()(this,Gs)||(a()(this,Gs,new As(n()(this,Ns))),n()(this,Gs).addObservable(n()(this,Is)),n()(this,Gs).addObservable(n()(this,Os)),n()(this,Gs).addObservable(n()(this,Ds)),n()(this,Gs).monitor())}else console.error("[WebGPUResManager] initialize() WebGPU is not supported!")}acquireGPUDevice(){return n()(this,Us)}acquireCanvasFormat(){return n()(this,Ls)}acquireGPUAdapterInfo(){return n()(this,Ps)}destroyGPUDevice(){n()(this,Us)&&(n()(this,Us).destroy(),a()(this,Us,null))}acquireGPUBufferMgr(){return n()(this,Is)}acquireGPUTextureMgr(){return n()(this,Os)}acquireGPUBufferPool(){return n()(this,Ds)}acquireGPUFeaturesHelper(){return n()(this,Bs)}cleanup(){n()(this,Is)&&(n()(this,Is).cleanup(),a()(this,Is,null)),n()(this,Os)&&(n()(this,Os).cleanup(),a()(this,Os,null)),n()(this,Ds)&&(n()(this,Ds).cleanup(),a()(this,Ds,null)),n()(this,Bs)&&(n()(this,Bs).cleanup(),a()(this,Bs,null)),n()(this,Gs)&&(n()(this,Gs).cleanup(),a()(this,Gs,null)),a()(this,Ws,null),this.destroyGPUDevice()}recycleTextureBufferGroup(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&n()(this,Ds)){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),n()(this,Ds).recycle(r.buffer,r.bufferConfig,t),e.destroyTextureBufferGroup(this))}}recycleInUsedGPUBuffers(e){for(const[t,r]of e)for(const e of r)if(e){const t=e.getTextureBufferGroup();t&&t.buffer&&(t.bufferArray&&(t.bufferArray=null),n()(this,Ds).recycle(t.buffer,t.bufferConfig)),e.destroyTextureBufferGroup(this)}}requestTextureBuffer(e){if(!n()(this,Ds))return null;if(Object(xt.f)(this,e.size))return Object(o.u)("requestTextureBuffer() a buffer size that exceeds the max size of GPUBuffer is required.(size:".concat(e.size,")")),null;const t=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC;return e.usage=t,n()(this,Ds).acquire(e)}destroyTextureGroup(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=e.getTextureGroup();if(!r)return;if(!n()(this,Os))return void Object(o.u)("destroyTextureGroup() mGPUTextureMgr is undefined!");const i=e.getTextureType();r&&(i==h.x.GPU_TEX_YUV||i!=h.x.GPU_TEX_RGBA&&function(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,Fs,Vs).call(this,r)?(n()(this,Os).recycleTexture(r.yPlaneTex,t),n()(this,Os).recycleTexture(r.uPlaneTex,t),r.vPlaneTex&&n()(this,Os).recycleTexture(r.vPlaneTex,t)):n()(this,Os).recycleTexture(r,t),e.setTextureGroup(null))}};function Hs(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var js=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,qs=new WeakMap,Ks=new WeakMap;t.a=class{constructor(e){Hs(this,js,{writable:!0,value:""}),Hs(this,Ys,{writable:!0,value:new ze}),Hs(this,Xs,{writable:!0,value:new Hi}),Hs(this,qs,{writable:!0,value:new Qe}),Hs(this,Ks,{writable:!0,value:new zs}),a()(this,js,e),n()(this,Ks).addRendererProviderModule(n()(this,Ys)),n()(this,Ks).setLabel(n()(this,js)),n()(this,Xs).setGPUResourceMgr(n()(this,Ks))}isEnableCanvasAlphaChannel(){return n()(this,Xs).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){n()(this,Xs).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await n()(this,Ys).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=n()(this,Ys).getRendererType(),o=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).getVideoRenderDisplay(a,e,t,r,i,o,s)}createWebGLVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):n()(this,Ys).isWebGLRendererType()?n()(this,Xs).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):null}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=n()(this,Ys).getRendererType(),a=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).createVideoRenderDisplay(s,e,t,r,a,i)}getSharingRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType(),s=n()(this,Ys).acquireRenderer(e,n()(this,Ks),!0);return r||(r={}),r.clearCache=!0,n()(this,Xs).getSharingRenderDisplay(i,e,t,s,r)}recycleRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType();n()(this,Xs).recycleRenderDisplay(i,e,t,n()(this,Ks),r)}renderFor(e){if(n()(this,Ys).isWebGPURendererType()){const t=n()(this,Ys).getRendererType(),r=n()(this,Xs).collectInUseRenderDisplays(t,e);r&&r.forEach(e=>{const t=n()(this,Ys).acquireRenderer(e.canvas,n()(this,Ks));n()(this,qs).render(t,e.renderDisplays)})}}renderWith(e){if(n()(this,Ys).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const r=n()(this,Ys).acquireRenderer(t,n()(this,Ks)),i=[];i.push(e),n()(this,qs).render(r,i)}}}getRenderDisplayMap(e){const t=n()(this,Ys).getRendererType();return n()(this,Xs).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,Ys).isWebGLRendererType()||n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).onRestoredFromContextLost(e,t,r,i,s,a):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&n()(this,Ys).isWebGPURendererType()&&e.close()}getRendererProvider(){return n()(this,Ys)}getRenderDisplayManager(){return n()(this,Xs)}getWebGPUResMgr(){return n()(this,Ks)}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];n()(this,Ys)&&n()(this,Ys).cleanup(),n()(this,Xs)&&n()(this,Xs).cleanup(e,t,n()(this,Ks),r),r||n()(this,Ks)&&n()(this,Ks).cleanup()}clearOffscreenCanvas(e){n()(this,Xs)&&n()(this,Xs).cleanupByCanvas(e)}}},function(e,t,r){var i=r(24).default,n=r(35);e.exports=function(e){var t=n(e,"string");return"symbol"===i(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(24).default;e.exports=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(15),n=r(4),s=r(5),a=r(2),o=r(30),h=r(27),u=r(3);function l(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new h.a,this.sharingQueue=new h.a,this.WaterMarkRGBA=new o.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=n.B,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null}l.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},l.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},l.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},l.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},l.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},l.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},l.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let r=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-r,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},l.prototype.JsMediaSDK_SharingRender=function(){var e,t,r;if(this.sharingDisplay)if(!1!==(null===(e=(t=this.sharingDisplay).isAvaiable)||void 0===e?void 0:e.call(t))){null===(r=this.statisticObj)||void 0===r||r.sample();var n=this.Get_Decoded_Sharing_Frame(this.currentshareactive,this.isFromMainSession),o=this.Get_Decoded_Mouse_Frame(this.currentshareactive,this.isFromMainSession);if(n){let e,t;this.lRTimeStamp=n.ntptime,n.yuvdata instanceof u.m?(e=n.yuvdata.yuvdata,t=n.yuvdata):(e=n.yuvdata,t=null),this.sharingWidthAndHeightInfo.logicWidth==n.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==n.logic_h||(this.PubSub?PubSub.publish(i.g,{body:{width:n.logic_w,height:n.logic_h,logicWidth:n.logic_w,logicHeight:n.logic_h}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=n.logic_w,this.sharingWidthAndHeightInfo.logicHeight=n.logic_h);var h=n.logic_h,l=n.logic_w,c=n.r_h,d=n.r_w;this.xratio=d/l,this.yratio=c/h;var f={top:n.r_x,left:n.r_y,height:n.r_h,width:n.r_w};this.currentSharingHeight==n.r_h&&this.currentSharingWidth==n.r_w&&this.currentSharingLogicHeight==n.logic_h&&this.currentSharingLogicWidth==n.logic_w||(this.Notify_APPUI?this.Notify_APPUI(i.f,{body:{height:n.logic_h,width:n.logic_w,logicHeight:n.logic_h,logicWidth:n.logic_w}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.currentSharingHeight=n.r_h,this.currentSharingWidth=n.r_w,this.currentSharingLogicHeight=n.logic_h,this.currentSharingLogicWidth=n.logic_w);const r=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:n.r_w,a=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:n.r_h;this.Should_Update_Watermark(this.sharingDisplay,r,a)&&this.Update_Display_Watermark(this.sharingDisplay,r,a),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:s.X,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOutputPictureFrame(n.width,n.height,f,e,null,n.yuv_limited),t&&t.recycle(),n.dataptr&&Module._free(n.dataptr)}else if(this.brefresh&&(this.brefresh=!1,0!=this.sharingDisplay.getTextureWidth()&&0!=this.sharingDisplay.getTextureHeight()&&0!==this.currentSharingWidth&&0!==this.currentSharingHeight)){const e=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:this.currentSharingWidth,t=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:this.currentSharingHeight;this.Should_Update_Watermark(this.sharingDisplay,e,t)&&this.Update_Display_Watermark(this.sharingDisplay,e,t),this.sharingDisplay.drawNextOutputPictureFrame(this.sharingDisplay.getTextureWidth(),this.sharingDisplay.getTextureHeight(),this.sharingDisplay.getCroppingParams(),null,this.picRotation,!0,null,!1),n=!0}o&&(this.Cursorx=o.r_x*this.xratio,this.Cursory=o.r_y*this.yratio,this.CursorWidth=o.width*this.xratio,this.CursorHeight=o.height*this.yratio,this.sharingDisplay.updateCursor(o.width,o.height,o.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:s.X,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.drawCursor(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight)),n&&this.renderManager.renderFor(a.t.SHARE)}else{var p,g;null===(p=(g=this.sharingDisplay).restoreContext)||void 0===p||p.call(g)}else Object(u.u)("JsMediaSDK_SharingRender error, display is null")},l.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},l.prototype.updateOffscreenCanvasSize=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!r)return console.log("drop logic w/h");try{let r=this.sharingDisplay.getAttachedCanvas();r&&r instanceof OffscreenCanvas&&(r.width=e,r.height=t,this.brefresh=!0)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},l.prototype.Set_Render_Display=function(e){this.sharingDisplay=e},l.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},l.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:r,sharingWaterMarkName:i,watermarkOpacity:n,watermarkRepeated:s,watermarkPosition:a}=e;r||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=r,this.sharingWaterMarkName=i,void 0!==s&&(this.isWaterMarkRepeatedEnable=!!s),void 0!==n&&(this.waterMarkOpacity=n),void 0!==a&&(this.watermarkPosition=a)},l.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},l.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.setWatermarkFlag(e?1:0)},l.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const c=function(e,t){if(e<640&&e){const r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};l.prototype.Update_Display_Watermark=function(e,t,r){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const i=t<512||r<288?16:this.watermarkPosition,n=this.Should_Watermark_Repeated(t,r),s=c(t,r);t=s.width,r=s.height;const a=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i});e.updateWatermark(t,r,a)},l.prototype.Should_Update_Watermark=function(e,t,r){if(!this.isCreateSharingWaterMark)return!1;let i=!1;const n=c(t,r);n.width===e.getWatermarkWidth()&&n.height===e.getWatermarkHeight()||(i=!0);const s=this.Should_Watermark_Repeated(t,r);e.isSetWatermark()||(i=!0),s!==e.isWatermarkRepeated()&&(i=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(i=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const a=t<512||r<288?16:this.watermarkPosition;return a!==e.getWatermarkPosition()&&(i=!0,e.setWatermarkPosition(a)),i},l.prototype.Update_Sharing_Canvas_Size=function(e){let{width:t,height:r}=e;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(r)}},l.prototype.ClearQueue=function(){try{let e=this.sharingQueue.ssrcQueueMap;for(let[t,r]of e)for(;!r.isEmpty();){let e=r.dequeue();e.yuvdata&&e.yuvdata instanceof u.m&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},l.prototype.Get_Decoded_Sharing_Frame=function(e,t){if(!this.sharingQueue)return null;var r=this.GetLogicalSSRCPart(e,t),i=this.sharingQueue.GetQueue(r);return i?i.dequeue():null},l.prototype.Get_Decoded_Mouse_Frame=function(e,t){if(this.mouseQueue){var r=this.GetLogicalSSRCPart(e,t),i=this.mouseQueue.GetQueue(r);return i?i.dequeue():null}},l.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var r=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||r!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(i.e,this.currentshareactive):postMessage({status:s.F,ssrc:this.currentshareactive}));var n=this.sharingQueue.GetQueue(r);n||(n=this.sharingQueue.AddQueue(r)),n.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var a=this.sharingQueue.GetQueueLength(r),o=a-t;for(this.maxQueueLength=t;o>=0;){let t=this.Get_Decoded_Sharing_Frame(e.ssrc,e.isFromMainSession);t.yuvdata instanceof u.m&&t.yuvdata.recycle(),t.dataptr&&Module._free(t.dataptr),o--}}},l.prototype.Get_Current_QueueLength=function(){if(!this.sharingQueue)return;let e=this.currentshareactive;var t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)},l.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),r=this.mouseQueue.GetQueue(t);r||(r=this.mouseQueue.AddQueue(t)),r.enqueue(e);for(var i=this.mouseQueue.GetQueueLength(t)-10;i>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc,e.isFromMainSession),i--}},l.prototype.GetLogicalSSRCPart=function(e,t){let r=e>>10;return t&&(r|=1<<23),r},l.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},l.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(u.u)(e,t)},l.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):Object(u.t)(e)},l.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},l.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval(()=>{this.No_Bindthis_Interval()},20)):(this.Start_Draw(),this.startRAFHealthCheck())},l.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},l.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval(()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(n.C),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))},2e3)},l.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)},t.a=l},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channel_Agent",(function(){return Dt})),r.d(t,"Open_Sharing_WebSocket_Connect",(function(){return Bt})),r.d(t,"sharing_websocket_on_open",(function(){return Gt})),r.d(t,"sharing_websocket_on_message",(function(){return Wt})),r.d(t,"sharing_websocket_on_close",(function(){return Nt})),r.d(t,"sharing_websocket_on_error",(function(){return Ft})),r.d(t,"JsMediaSDK_Log",(function(){return Vt})),r.d(t,"Recieve_Wb_Packet",(function(){return zt})),r.d(t,"Send_Wb_Rtp_Packet",(function(){return Ht})),r.d(t,"wcl_trace_log",(function(){return jt})),r.d(t,"sharing_qos_monitor",(function(){return Qt})),r.d(t,"responseSharingQosData",(function(){return Zt})),r.d(t,"frame_callback_video_mode",(function(){return $t})),r.d(t,"frame_callback_mouse_video_mode",(function(){return er})),r.d(t,"Send_Data",(function(){return tr})),r.d(t,"decode_callback",(function(){return rr})),r.d(t,"SubScribeUpdateSharing",(function(){return ir})),r.d(t,"IsSupportMultiThread",(function(){return ar})),r.d(t,"hardcodecpunumber",(function(){return or})),r.d(t,"LimitWebCodecsEncoderTo360_js",(function(){return hr})),r.d(t,"LimitWebCodecsDecoderTo360_js",(function(){return ur})),r.d(t,"UserAgentIsTesla_js",(function(){return lr})),r.d(t,"IsSupportMultiThreadForWebcodec",(function(){return cr})),r.d(t,"getGraphicName",(function(){return dr})),r.d(t,"getVendorName",(function(){return fr})),r.d(t,"GetCscThreadNum",(function(){return pr})),r.d(t,"GetEncThreadNum",(function(){return gr})),r.d(t,"Sharing_Decode",(function(){return mr})),r.d(t,"GetLogLevel_js",(function(){return _r})),r.d(t,"Send_Data_Codec",(function(){return vr})),r.d(t,"LOG_OUT",(function(){return br})),r.d(t,"Utf8ArrayToStr",(function(){return wr})),r.d(t,"Write_App_Log",(function(){return yr})),r.d(t,"Pace_Sender",(function(){return Rr})),r.d(t,"Compute_WebSocket_Speed",(function(){return Er})),r.d(t,"Compute_Capture_Delay",(function(){return Sr})),r.d(t,"APP_Troubleshoting_Info",(function(){return Ar})),r.d(t,"Sharing_Capture",(function(){return kr})),r.d(t,"Update_WebSokcet_Speed",(function(){return Mr})),r.d(t,"SAVE_IV",(function(){return Cr})),r.d(t,"getWasmMemory",(function(){return Pr})),r.d(t,"freeWasmMemory",(function(){return Ur})),r.d(t,"MCMMonitor_Sharing_LOG",(function(){return Wr})),r.d(t,"Send_Out_Qos",(function(){return Nr})),r.d(t,"BigLog_js",(function(){return jr})),r.d(t,"Set_Share_Mode_js",(function(){return Yr})),r.d(t,"checkWebCodecWhitelist_js",(function(){return Jr})),r.d(t,"UserWebCodecController_js",(function(){return $r}));var i=r(3),n=r(4),s=r(5),a=r(36),o=r(12),h=r(15),u=r(29),l=r(14),c=r(31),d=r(18),f=r(33),p=r(19),g=r(8),m=r(11),_=r(26),v=r(13),b=r(23),w=r(6),y=r(25);const x=r(46);var T,R,E,S,A,k,M,C,P,U,L,I,O,D,B,G,W,N,F,V;self.wasmSuccessEvent=s.Z,self.wasmFailEvent=s.Y,self.downloadAndInstantiateWebAssembly=i.q,self.onunhandledrejection=e=>{Object(i.u)("Unhandled rejection in worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)};var z,H,j,Y,X,q,K,Q,Z,J=new Map,$=!1,ee=!1,te=0,re=0,ie=0,ne=!1;const se=new f.a("sharing");var ae,oe,he,ue=null,le=new _.a(s.W,!0);self.onWasmModuleReady=()=>{T=Module.cwrap("_Sharing_Encode","number",["number","number","number","number","number","number"]),k=Module.cwrap("_Sharing_Encode_Mouse_Data","number",["number","number","number"]),R=Module.cwrap("_Sharing_Encode_Uninit","number",["number"]),E=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","array","number"]),S=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","number","number"]),A=Module.cwrap("_Sharing_Encode_Init","number",["number","string","string","number","number","number","boolean","boolean","boolean"]),M=Module.cwrap("_Sharing_Set_Data_Encryption","number",["number","number"]),F=Module.cwrap("_Request_Sharing_Qos_Data","number",["number","boolean","boolean"]),C=Module.cwrap("_Sharing_Pause_Encode","number",["number"]),Module.cwrap("_Sharing_Stop_Encode","number",["number"]),P=Module.cwrap("_Sharing_Resume_Encode","number",["number"]),U=Module.cwrap("_Sharing_Websocket_Speed","number",["number","number"]),L=Module.cwrap("_Add_Sharing_Cooker_info","number",["number","number","number","number"]),O=Module.cwrap("_Get_Sharing_Meat_Weight","number",["number"]),I=Module.cwrap("_Remove_Sharing_Cooker_Info","number",["number","number"]),D=Module.cwrap("_Set_Sharing_Encryption_Key_Directly","number",["number","number","number","number"]),B=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),G=Module.cwrap("_Add_Rev_Channel","number",["number","number","number","number"]),W=Module.cwrap("_Remove_Rev_Channel","number",["number","number"]),N=Module.cwrap("_update_sharing_uplink_bandwidth_limitation_by_server","number",["number","number"]),V=Module.cwrap("_set_annotation_action","number",["number","number","number","number"]),H=Module.cwrap("_collect_sharing_monitor_info","number",["number","boolean","boolean"]),j=Module.cwrap("_Change_Connect_Type_For_Sharing","number",["number","number"]),Y=Module.cwrap("_request_nack_t_periodically_for_sharing_qos","number",["number"]),ae=Module.cwrap("_Jpeg_Init","number",[]),Module.cwrap("_Jpeg_Uninit","number",["number"]),oe=Module.cwrap("_Jpeg_HeardInfo","number",["number","number","number"]),he=Module.cwrap("_Jpeg_Decode","number",["number","number","number","number","number","number"]),Module._malloc=function(){let e=Module.asm.malloc.apply(null,arguments);if(!e&&!ne){ne=!0,Object(i.o)("MEMERR:SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));let e=new Error("memry malloc error SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));Object(i.u)("memry malloc error",e)}return e},"undefined"!=typeof _malloc&&(_malloc=Module._malloc)};var ce,de,fe,pe,ge,me,_e,ve,be,we,ye,xe,Te,Re,Ee,Se,Ae,ke=0,Me=null,Ce=0,Pe=0,Ue=0,Le=null,Ie=null,Oe=null,De=null,Be=!1,Ge=!1,We=!1,Ne=null,Fe=!1,Ve=0,ze=0,He=0,je=0,Ye=new m.a,Xe=new m.a,qe=!1,Ke=0,Qe=0,Ze=0,Je=null,$e=null,et=!1,tt=!1,rt=null,it=null,nt=null,st=null,at=null,ot=!0,ht=!1,ut=new m.a,lt=n.L,ct=!1,dt=!1,ft=1,pt=!1,gt=0,mt=0,_t=!1,vt=n.d.DESKTOP_SOURCE,bt=0,wt=null,yt=null,xt=0,Tt=null,Rt=0,Et=null,St=0,At=0,kt=!1,Mt=[],Ct=[],Pt=[];function Ut(e,t){postMessage({status:s.H,data:"".concat(e,":").concat(t)})}function Lt(e,t){Object(i.o)("".concat(e,":").concat(t,":F"))}var It=new l.b({tag:"WCL_M,ASRENDER_ERR",interval:1e4,reportcallback:function(e,t,r,i){Ut(e,"".concat(t,",").concat(r,",").concat(i))}}),Ot=new c.a({tag:"WCL,AS",report_call:Ut});function Dt(){function e(e){let t=null,r=n.db,s=null,a=e.onmessage,o=e.onopen,h=e.onclose;e.onmessage=r=>{t=(new Date).getTime(),a.call(e,r)},e.onopen=i=>{t=(new Date).getTime(),function(){if(s)return;s=setInterval(()=>{var i;(new Date).getTime()-t>=1e3*r&&(clearInterval(s),s=null,null===(i=e.socket)||void 0===i||i.close())},1e3)}(),o.call(e,i,e)},e.onclose=t=>{try{clearInterval(s)}catch(e){Object(i.u)("WebSocket closed",e)}h.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,r,i,n,s){this.websocketaddress=t,this.onopen=r,this.onmessage=i,this.onerror=n,this.onclose=s,e(this)},this.connect=function(e,t,r,n,a){var o=this;Object(i.o)("SB"),o.init(e,t,r,n,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex+=1,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(i.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(i.o)("SCLOSE"),o.socket.close()},o.socket.onclose=function(e){Object(i.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:s.ab}),Object(i.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){ht||1!=Le.socket.readyState?(ke+=e.length,Xe.enqueue(e),Rr()):Le.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function Bt(e,t,r,n,s){Object(i.o)("WSURL:false:".concat(e));var a=new Dt;return a.connect(e,t,r,n,s),a}function Gt(){postMessage({status:s.bb})}Ot.threshold=300;function Wt(t){let r=new Uint8Array(t.data);if(!(r.length<4))if(37!==r[0]){if(102!=r[0]){if(r[0]==n.t.SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME){if(!$||!Ie||vt!=n.d.UAC_SOURCE)return;let t,i=0;if(t=x.inflate(e.from(r.subarray(4,r.length)),{windowBits:31}),i=t.length,i>xt&&(yt&&Module._free(yt),xt=3*i/2,yt=Module._malloc(xt)),!yt)return xt=0,void console.error("Couldn't allocate memory");writeArrayToMemory(t,yt);let s=oe(wt,yt,i);if(!s)return;let a=65535&s,o=s>>16&65535,h=a*o*4;if(h>Rt&&(Tt&&Module._free(Tt),Rt=h,Tt=Module._malloc(h)),!Tt)return Rt=0,void console.error("Couldn't allocate memory");if(bt++,s=he(wt,yt,i,o,a,Tt),0!=s)return;return ni(o,a),1!=xe&&(xe=1),void T(Ie,Tt,h,o,a,xe)}if(r[0]!=n.t.SHARE_REMOTE_CONTROL_UAC_MOUSE)if(111!=r[0])if(109!=r[0]){if(0==r[0])Le&&Le.send(r);else if(Ie)if(Ge){if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);Ye.enqueue(e);let r=Ye.dequeue();for(;r;)E(Ie,r,r.length),r=Ye.dequeue()}}else mr(t.data);else if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);0!=e[0]&&Ye.enqueue(e)}}else Oe&&E(Oe,r,r.length);else 1==r[4]?(Object(i.o)("UAC_START"),bt=0,wt||(wt=ae()),vt=n.d.UAC_SOURCE):(Object(i.o)("UAC_STOP"),Object(i.o)("UAC_ASCAPTURE:".concat(bt)),vt=n.d.DESKTOP_SOURCE,We=!0,Tt&&Module._free(Tt),Tt=null,Rt=0,yt&&Module._free(yt),yt=null,xt=0,Et&&Module._free(Et),Et=null,St=0);else if(Ie&&$&&vt==n.d.UAC_SOURCE){if(r.length>St&&(Et&&Module._free(Et),St=3*r.length/2,Et=Module._malloc(St)),!Et)return void(St=0);writeArrayToMemory(r,Et),k(Ie,Et,r.length)}}}else postMessage({status:s.Q,data:r})}function Nt(e){Vt("sharing_websocket_on_close")}function Ft(e){Vt("sharing_websocket_on_error")}function Vt(e){console.log(e)}function zt(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.Cb,data:r},[r.buffer])}function Ht(e,t,r){var n=new Uint8Array(r+8),s=Object(i.d)().subarray(t+0,t+r);n.set(s,8),n[0]=109;var a=new Uint32Array(1);a[0]=e;var o=new Uint8Array(a.buffer);n.set(o,4),Object(i.y)(Le,n),le.setRtpPackets()}function jt(e,t){zr&&zr.writeWasmLog(e,t)}var Yt,Xt,qt={sharingqosIntervalId:0,sharingmonitorPanelFlag:!1,panelpollingInterval:0},Kt=!0;function Qt(){const e=()=>{if(ht&&!Kt&&Ie)F(Ie,!0);else if(!ht&&(!et||tt)){let e=kt?d.e():Ie;e&&F(e,!1)}};qt.sharingqosIntervalId&&clearInterval(qt.sharingqosIntervalId),qt.sharingmonitorPanelFlag&&(qt.sharingqosIntervalId=setInterval(e,qt.panelpollingInterval||n.y))}function Zt(e,t,r,i,n,s,a,o,u){if(qt.sharingmonitorPanelFlag){const l={width:e,height:t,fps:r,rtt:i,jitter:n,avg_loss:s,max_loss:a,bandwidth:o,rate:u};postMessage({status:h.i,data:l})}}var Jt=new Map;function $t(e,t,r,n,a,o,h,u,l,c,d,f,p,g){let m=!(g==Ie);kt=m,Jt.get(n)||(Jt.set(n,!0),postMessage({status:s.U,ssrc:n}));var _=Object(i.d)().subarray(e+0,e+t),v=Object(i.g)().subarray(r,r+8),b=0;for(let e=0;e<8;e++)b+=v[e]*Math.pow(256,e);var w=n,y=a,x=o;if(et){if(!tt)return;if(t>Yt)return void It.timeoutReport(0,performance.now());let e=new i.m(Xt);if(e.storeSync(_)){var T={yuvdata:e,ntptime:b,ssrc:w,width:y,height:x,r_x:h,r_y:u,r_w:l,r_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m};at&&at.Put_Sharing_Data_From_Queue(T,5)}}else{let e=new Uint8Array(_);postMessage({status:s.S,data:e,sharing_timestamp:b,sharing_ssrc:w,sharing_width:y,sharing_height:x,rendering_x:h,rendering_y:u,rendering_w:l,rendering_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m},[e.buffer])}}function er(e,t,r,n,a,o,h,u,l,c,d,f){var p=new Uint8Array(t),g=Object(i.d)().subarray(e+0,e+t);p.set(g,0,t);var m=n,_=a,v=o;let b=!(f==Ie);if(et){var w={type:"mouse_data",buffer:p,ntptime:r,ssrc:m,width:_,height:v,r_x:h,r_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b};at&&at.Put_Mouse_Data_Into_Queue(w)}else postMessage({status:s.I,data:p,mouse_timestamp:r,mouse_ssrc:m,mouse_width:_,mouse_height:v,mouse_x:h,mouse_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b},[p.buffer])}function tr(e,t,r){if(!(t<4)){var n,s=new Uint8Array(t),a=Object(i.d)().subarray(e+0,e+t);if(s.set(a,0,t),133!=s[0]&&77!=s[0]||le.setRtpPackets(),r==Ie)Object(i.y)(Le,s);else Object(i.y)(null===(n=d.h)||void 0===n?void 0:n.socket,s)}}function rr(e,t,r){let i=!(r==Ie);postMessage({status:s.T,ssrc:e,size:t,isFromMainSession:i})}function ir(e){le.setSubForMe(e)}function nr(e,t,r,i){if(ht||++te%24e4==0&&postMessage({status:s.H,data:"WCL_M,RTCPSN"+te}),t&&r){if(dt&&(77==e[0]||79==e[0])&&!ct){lt=n.K;for(var a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(n);break;case 12:case 13:s=e[r++],t+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[r++],a=e[r++],t+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&a)<<0)}return t}function yr(){Le.socket.bufferedAmount,Xe.getLength(),Sr()}var xr=0,Tr=150;function Rr(){if(0!==xr?(Tr=performance.now()-xr)>=150&&(xr=performance.now()):xr=performance.now(),Le.socket.bufferedAmount>2e4)return;if(Tr>=150&&We&&(Xe.getLength(),ke-2e4<0))We=!We,Te&&Ee?(Ne&&(Ne=null),Ee.read().then((function(e){let{done:t,value:r}=e;if(t)return void console.log("Stream is done!!!");let i={data:r};1e3==mt&&(postMessage({status:s.R}),mt=0),mt++,Br(i)}))):Ne?(kr(Ne),Ne=null):postMessage({status:s.ob});else{let e=performance.now();if(re&&ie&&He&&e-re>3e3){if(re=e,vt!=n.d.DESKTOP_SOURCE)return;T(Ie,He,ie,Ve,ze,xe)}}if(Xe.getLength()>20&&!qe){qe=!0,Ke=0;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=28,Qe=(new Date).getTime(),e[1]=0,Le.socket.send(t)}if(qe&&20==Ke){qe=!1;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=29,e[1]=(new Date).getTime()-Qe,Le.socket.send(t)}let e=Xe.dequeue();for(;e;){if(Ke++,Le.socket.send(e),Er(e),ke-=e.length,Le.socket.bufferedAmount>2e4)return void yr();e=Xe.dequeue()}yr()}function Er(e){var t;if(Me){var r=(new Date).getTime()/1e3;if((t=r-Me)>10){var i=Ce-Le.socket.bufferedAmount;0==Le.socket.bufferedAmount?(Ue=Ue?.8*Ue+16e4:8e5,Ie&&U(Ie,Ue)):(Pe=8*i/(1*t),Ue=Ue?.8*Ue+.2*Pe:8e5,Ie&&U(Ie,Ue)),Ce-=i,Me=r}}else Ce=0,Me=(new Date).getTime()/1e3,Ie&&U(Ie,8e5);Ce+=e.length}function Sr(){var e=ke+Ce-1e4;return 0==je||e<=0?0:je>0?e/je:void 0}function Ar(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.b,data:wr(r)})}function kr(e){!Be&&e?postMessage({status:s.ob,data:e.data},[e.data.buffer]):postMessage({status:s.ob})}function Mr(e){je=je?(je+e)/2:e}function Cr(e,t){ve||(ve=setInterval((function(){Ie&&O(Ie)}),6e4));let r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),be=r,postMessage({status:s.a,data:r})}function Pr(e){if(!e)return 0;let t=Module._malloc(e.length);return Object(i.g)().subarray(t,t+e.length).set(e,0,e.length),t}function Ur(e){e&&Module._free(e)}function Lr(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.v)(n)}function Ir(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.w)(n)}function Or(e){try{Je.canvas.width===e.width&&Je.canvas.height===e.height||(Je.canvas.width=e.width,Je.canvas.height=e.height)}catch(e){Object(i.u)("Error when updating OffScreenCanvas size",e)}}function Dr(e){let t={rect:{x:0,y:0,width:0,height:0}};return e.visibleRect.left%2!=0?t.rect.x=e.visibleRect.left-1:t.rect.x=e.visibleRect.left,e.visibleRect.top%2!=0?t.rect.y=e.visibleRect.top-1:t.rect.y=e.visibleRect.top,e.visibleRect.width%2!=0?t.rect.width=e.visibleRect.width-1:t.rect.width=e.visibleRect.width,e.visibleRect.height%2!=0?t.rect.height=e.visibleRect.height-1:t.rect.height=e.visibleRect.height,t}async function Br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.d.DESKTOP_SOURCE;if(t>> Set_Share_Mode_js")}self.addEventListener("message",(function(e){var t,r=e.data;switch(r.command){case g.p:Object(i.o)("STARTMEDIA:".concat(function(e){let t=e.confId,r=e.isPreviewMode?1:0;return r|=Qr()?2:0,"".concat(t,":").concat(r)}(r)));try{if(z||(z=setInterval(()=>{let e=kt?d.e():Ie;$&&e&&H(e,!!ht)},1e3)),r.isPreviewMode)break;Qr()||(Kr=!1,Object(i.o)("RSTHOLD")),function(e){Hr=e._id,Q=e.graphicalname,Z=e.vendorname,ce=e.meetingnumb+"",de=e.meetingid,ft=e.multiThreadNum,At=e.uplimit?e.uplimit:0,ht=!!e.encode,me=e.confId,Ge=ht,Be=!!e.isChromeOrEdge,dt=ft>1,se.setCanvasAlphaChannelEnability(e.isEnableCanvasAlphaChannel),p.a.setIsEnableCanvasCtxOptionsOpt(e.isEnableCanvasCtxOptionsOpt)}(r),Xr||(zr&&zr.init({workerType:ht?o.b.SHARING_ENCODE:o.b.SHARING_DECODE}),Xr=!0),function(e){se.getRendererProvider().setRendererType(e.rendererType),se.getRendererProvider().isWebGPURendererType()&&se.getWebGPUResMgr().initialize()}(r),function(e){if(ei||ht||((ei=Object(b.d)(w.e.SHARR_DECODE)).onmessage=Fr,ei.onopen=()=>{X=!0,Vr()},ei.onclose=()=>{X=!1,Vr()},(ti.sender||ti.reciver)&&Object(v.b)(ei,ti.sender,ti.reciver)),!e.websocket_ip_address)return;let t=e.websocket_ip_address+"&mode=1";ht&&(t=e.websocket_ip_address.slice(0,e.websocket_ip_address.length-42)+"s"+e.websocket_ip_address.slice(e.websocket_ip_address.length-41,e.websocket_ip_address.length)+"&mode=2"),Object(i.j)(Le,t)&&(Le=Bt(t,Gt,Wt,Ft,Nt))}(r),ht||(Xt||(Yt=15728640,Xt=new i.k(5,Yt)),qr()),postMessage({status:Ie||ht?s.db:s.cb})}catch(e){postMessage({status:s.cb}),Object(i.u)("sharing startr media error",e)}break;case g.b:z&&(clearInterval(z),z=null),Ie&&R(Ie),Ie=null,De&&R(De),De=null,function(){try{let e=ei;ei=null,X=!1,ti={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}(),close();break;case"ENCRYPT":Fe=r.encrypt,Ie&&M(Ie,Fe?1:0);break;case g.l:qt.panelpollingInterval=r.data.pollingInterval,qt.sharingmonitorPanelFlag=r.data.enable,Qt();break;case"startSharingEncode":$=!0,r.isSupportVideoTrackReader?(xe=2,!0):(xe=1,!1),Te=!!r.isSupportMediaStreamTrackProcessor,dt&<==n.L?function(e){if(dt&&!ct){lt=n.K;for(var t=0;t{let t=parseInt(e.userid);if(e.bremove)return void(Ie&&I(Ie,t));let r=e.sn;if(16!=r.length&&32!=r.length)return;let i=Pr(r);if(Ie){let e=!1;ht&&me!=t||(e=!0),e&&L(Ie,t,i,r.length)}Ur(i),ht&&me==t&&r});break}case"SET_OFFSCREENCANVAS_WIDTH_HEIGHT":{let{width:e,height:t}=r.data;at&&(at.setOnlyAcceptUISize(!0),at.updateOffscreenCanvasSize(e,t,!0));break}case"BUILD_MS_CHANNEL_IN_BO":d.c(Bt,r.data,nr,E);break;case"SHARING_REMOVE_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASD:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.f(ii,e):Ie&&ii(Ie,e.ssrc)}break;case"SHARING_ADD_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASC:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.e()?d.a(ri,e):Mt.push(e):Ie?ri(Ie,e.ssrc,e.streamIndex,e.videoMode):Ct.push(e)}break;case g.r:{let e=r.data;if(e.isFromMainSession)De=d.d(A,D,e.updateParams,Pr,Ur),Mt.length>0&&(Object(i.u)("retry add recv channel for master share"),Mt.forEach(e=>{d.a(ri,e)}),Mt=[]),j(De,X?0:2);else if(Se=e,Ge)Ie&&Gr(Ie,Se.updateParams.userId,Se.updateParams.sn,Se.updateParams.encryptKey,Se.updateParams.encryptType);else if(Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t)}}break;case g.s:{let e=r.data;if(e.isFromMainSession)d.b(B,e);else if(Ie&&e.body){if(e.body.add){let t=0,r=e.body.add;for(;t{Y(Ie)},50)),ee||(ee=!0,"function"==typeof SharedArrayBuffer&&wasmMemory.buffer instanceof SharedArrayBuffer&&function(){const e=8+1500*(n.bb+1);q||(null!=(q=Module._malloc(e))?(Atomics.store(Object(i.f)().subarray(q/4,q/4+e),0,0),Atomics.store(Object(i.f)().subarray(q/4,q/4+e),1,0),ti.reciver={sab:wasmMemory,offset:q,length:e,interval:10,useCopy:!1,useOneElement:!1},Object(v.b)(ei,null,ti.reciver)):console.log("malloc failed"))}());break;case"WHITEBOARD_JOIN_MESSAGE":if(Oe||Gr(Oe=A(r.nodeId,"1","1",0,0,0,!1,!0,!1),r.nodeId,r.sn,r.encryptKey,2),!J.get(r.dcsId)){J.set(r.dcsId,!0);let e=Pr(r.EncodedSn);B(Oe,r.dcsId,e,r.EncodedSn.length),Ur(e),M(Oe,1)}if(Oe){V(Oe,0,r.dcsId,0);let e=Pr(r.data);V(Oe,1,e,r.data.length),Ur(e)}break;case"audioTimestamp":at&&at.SetcATimeStamp(r.data);break;case"vsport":Ae&&(Ae.close(),Ae=null),(Ae=e.ports[0]).onmessage=function(e){at&&at.SetcATimeStamp(e.data)};break;case g.e:{let e=r.data||{},n=!!e.hold;Object(i.o)("HOLD:".concat(n,":").concat(e.userid,":").concat(e.reinit)),n?function(e){if(Kr)return;if(me&&e.userid&&e.userid>>10!=me>>10)return void Object(i.o)("HOLDINVALID");Kr=!0,ht&&Zr();let t=Ie;Ie=null,t&&R(t),Oe&&(R(Oe),Oe=null),J.clear()}(e):(t=e,Kr&&(Kr=!1,t.reinit&&(me=t.userid,Ie||0==Hr||(qr(),postMessage({status:Ie||ht?s.db:s.cb})))))}break;case"SEND_ANNOTATION_PDU":var m;r.data instanceof Uint8Array&&(r.isPresenter||null===(m=Le)||void 0===m||m.send(r.data));break;case g.g:!function(e){let t=e.content_type,r=e.cmd,n=e.type;"PDU"==t&&(r=Object(i.a)(r),4==n&&Wt({data:r.buffer}))}(r.data)}}));var Xr=!1;function qr(){if(!Qr())return;if(_e==me&&Ie)return;Ie&&(R(Ie),Ie=null),Ie=A(me,ce,de,0,0,At,!1,!1,!0);let e=Se;if(e&&Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t),_e=me}Ct.length>0&&(Object(i.u)("retry add recv channel for share decode"),Ct.forEach(e=>{ri(Ie,e.ssrc,e.streamIndex,e.videoMode)}),Ct=[])}var Kr=!1;function Qr(){return!Kr}function Zr(){Ot.stop(),ve&&(clearInterval(ve),ve=null),Ie&&(Xe=new m.a),Ze&&(clearInterval(Ze),Ze=0),We=!1,ke=0,ot=!0,xr=0,ie=0,re=0,pt=!0,Kt=!1,$=!1,vt=n.d.DESKTOP_SOURCE,lt!=n.L&&setTimeout((function(){pt&&(PThread.terminateAllThreads(),ct=!1,lt=n.L,gt=0,console.log("terminate multiple threads"))}),6e5),le.stopCheck()}function Jr(){return-1}function $r(){return!1}var ei=null,ti={};function ri(e,t,r,n){-1!=Pt.findIndex(r=>r.handle==e&&r.ssrc==t)&&(ii(e,t),Object(i.u)("Duplicate add sharing recv ".concat(t))),G(e,t,r,n),Object(i.o)("ASCHANNEL:".concat(t,":").concat(r)),Pt.push({ssrc:t,index:r,videoMode:n,handle:e})}function ii(e,t){let r=Pt.findIndex(r=>r.handle==e&&r.ssrc==t);-1!=r&&Pt.splice(r,1),W(e,t),Object(i.o)("RMASCHANNEL:".concat(t))}function ni(e,t){return(Ve!=e||ze!=t)&&(postMessage({status:s.w,width:e,height:t}),Ve=e,ze=t,!0)}Object(b.b)(),Object(y.a)(self)}.call(this,r(41).Buffer)},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=r(43),n=r(44),s=r(45);function a(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(h.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(i)return N(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=h.from(t,i)),h.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,a=1,o=e.length,h=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,h/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var l=-1;for(s=r;so&&(r=o-h),s=r;s>=0;s--){for(var c=!0,d=0;dn&&(i=n):i=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function E(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[n+1]))&&(h=(31&u)<<6|63&s)>127&&(l=h);break;case 3:s=e[n+1],a=e[n+2],128==(192&s)&&128==(192&a)&&(h=(15&u)<<12|(63&s)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=e[n+1],a=e[n+2],o=e[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,i,n){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(i,n),l=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,i,n,s){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function L(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function I(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function O(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,i,s){return s||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,s){return s||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}h.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},h.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*t)),i},h.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},h.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+n]=e/s&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},h.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(42))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){for(var t,r=u(e),i=r[0],a=r[1],o=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,a)),h=0,l=a>0?i-4:i,c=0;c>16&255,o[h++]=t>>8&255,o[h++]=255&t;2===a&&(t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4,o[h++]=255&t);1===a&&(t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2,o[h++]=t>>8&255,o[h++]=255&t);return o},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(t=e[r-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,s,a=[],o=t;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,i,n){var s,a,o=8*n-i-1,h=(1<>1,l=-7,c=r?n-1:0,d=r?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-l)-1,f>>=-l,l+=o;l>0;s=256*s+e[t+c],c+=d,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=i;l>0;a=256*a+e[t+c],c+=d,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=u}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))<1&&(a--,h*=2),(t+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(t*h-1)*Math.pow(2,n),a+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Deflate",(function(){return $t})),r.d(t,"Inflate",(function(){return ir})),r.d(t,"constants",(function(){return or})),r.d(t,"default",(function(){return hr})),r.d(t,"deflate",(function(){return er})),r.d(t,"deflateRaw",(function(){return tr})),r.d(t,"gzip",(function(){return rr})),r.d(t,"inflate",(function(){return nr})),r.d(t,"inflateRaw",(function(){return sr})),r.d(t,"ungzip",(function(){return ar}));function i(e){let t=e.length;for(;--t>=0;)e[t]=0}const n=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new Array(576);i(h);const u=new Array(60);i(u);const l=new Array(512);i(l);const c=new Array(256);i(c);const d=new Array(29);i(d);const f=new Array(30);function p(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let g,m,_;function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}i(f);const b=e=>e<256?l[e]:l[256+(e>>>7)],w=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},y=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<{y(e,r[2*t],r[2*t+1])},T=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},R=(e,t,r)=>{const i=new Array(16);let n,s,a=0;for(n=1;n<=15;n++)a=a+r[n-1]<<1,i[n]=a;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=T(i[t]++,t))}},E=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},S=e=>{e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},A=(e,t,r,i)=>{const n=2*t,s=2*r;return e[n]{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n{let i,a,o,h,u=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+u++],i+=(255&e.pending_buf[e.sym_buf+u++])<<8,a=e.pending_buf[e.sym_buf+u++],0===i?x(e,a,t):(o=c[a],x(e,o+256+1,t),h=n[o],0!==h&&(a-=d[o],y(e,a,h)),i--,o=b(i),x(e,o,r),h=s[o],0!==h&&(i-=f[o],y(e,i,h)))}while(u{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)k(e,r,a);h=s;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],k(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,r[2*h]=r[2*a]+r[2*o],e.depth[h]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,r[2*a+1]=r[2*o+1]=h,e.heap[1]=h++,k(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let u,l,c,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=r[2*r[2*l+1]+1]+1,d>h&&(d=h,g++),r[2*l+1]=d,l>i||(e.bl_count[d]++,f=0,l>=o&&(f=a[l-o]),p=r[2*l],e.opt_len+=p*(d+f),s&&(e.static_len+=p*(n[2*l+1]+f)));if(0!==g){do{for(d=h-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[h]--,g-=2}while(g>0);for(d=h;0!==d;d--)for(l=e.bl_count[d];0!==l;)c=e.heap[--u],c>i||(r[2*c+1]!==d&&(e.opt_len+=(d-r[2*c+1])*r[2*c],r[2*c+1]=d),l--)}})(e,t),R(r,u,e.bl_count)},P=(e,t,r)=>{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++o{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++o{y(e,0+(i?1:0),3),S(e),w(e,r),w(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var O={_tr_init:e=>{L||((()=>{let e,t,r,i,o;const v=new Array(16);for(r=0,i=0;i<28;i++)for(d[i]=r,e=0;e<1<>=7;i<30;i++)for(f[i]=o<<7,e=0;e<1<{let n,s,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),C(e,e.l_desc),C(e,e.d_desc),a=(e=>{let t;for(P(e,e.dyn_ltree,e.l_desc.max_code),P(e,e.dyn_dtree,e.d_desc.max_code),C(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==t?I(e,t,r,i):4===e.strategy||s===n?(y(e,2+(i?1:0),3),M(e,h,u)):(y(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(y(e,t-257,5),y(e,r-1,5),y(e,i-4,4),n=0;n(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(c[r]+256+1)]++,e.dyn_dtree[2*b(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{y(e,2,3),x(e,256,h),(e=>{16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var D=(e,t,r,i)=>{let n=65535&e|0,s=e>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,s=s+n|0}while(--a);n%=65521,s%=65521}return n|s<<16|0};const B=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var G=(e,t,r,i)=>{const n=B,s=i+r;e^=-1;for(let r=i;r>>8^n[255&(e^t[r])];return-1^e},W={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},N={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:V,_tr_flush_block:z,_tr_tally:H,_tr_align:j}=O,{Z_NO_FLUSH:Y,Z_PARTIAL_FLUSH:X,Z_FULL_FLUSH:q,Z_FINISH:K,Z_BLOCK:Q,Z_OK:Z,Z_STREAM_END:J,Z_STREAM_ERROR:$,Z_DATA_ERROR:ee,Z_BUF_ERROR:te,Z_DEFAULT_COMPRESSION:re,Z_FILTERED:ie,Z_HUFFMAN_ONLY:ne,Z_RLE:se,Z_FIXED:ae,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:he,Z_DEFLATED:ue}=N,le=(e,t)=>(e.msg=W[t],t),ce=e=>2*e-(e>4?9:0),de=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fe=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let pe=(e,t,r)=>(t<{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},me=(e,t)=>{z(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ge(e.strm)},_e=(e,t)=>{e.pending_buf[e.pending++]=t},ve=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},be=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=D(e.adler,t,n,r):2===e.state.wrap&&(e.adler=G(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},we=(e,t)=>{let r,i,n=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const h=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,l=e.w_mask,c=e.prev,d=e.strstart+258;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(r=t,u[r+a]===p&&u[r+a-1]===f&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sa){if(e.match_start=t,a=i,i>=o)break;f=u[s+a-1],p=u[s+a]}}}while((t=c[t&l])>h&&0!=--n);return a<=e.lookahead?a:e.lookahead},ye=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-262)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fe(e),i+=t),0===e.strm.avail_in)break;if(r=be(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=pe(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=pe(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},xe=(e,t)=>{let r,i,n,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,ge(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(be(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_watern&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(be(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,s=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=s||(i||t===K)&&t!==Y&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===K&&0===e.strm.avail_in&&r===i?1:0,V(e,e.block_start,r,a),e.block_start+=r,ge(e.strm)),a?3:1)},Te=(e,t)=>{let r,i;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=we(e,r)),e.match_length>=3)if(i=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=pe(e,e.ins_h,e.window[e.strstart+1]);else i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2},Re=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(me(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=H(e,0,e.window[e.strstart-1]),i&&me(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const Se=[new Ee(0,0,0,0,xe),new Ee(4,4,8,4,Te),new Ee(4,5,16,8,Te),new Ee(4,6,32,32,Te),new Ee(4,4,16,16,Re),new Ee(8,16,32,32,Re),new Ee(8,16,128,128,Re),new Ee(8,32,128,256,Re),new Ee(32,128,258,1024,Re),new Ee(32,258,258,4096,Re)];function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ue,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),de(this.dyn_ltree),de(this.dyn_dtree),de(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),de(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),de(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ke=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||42!==t.status&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&113!==t.status&&666!==t.status?1:0},Me=e=>{if(ke(e))return le(e,$);e.total_in=e.total_out=0,e.data_type=he;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=-2,F(t),Z},Ce=e=>{const t=Me(e);var r;return t===Z&&((r=e.state).window_size=2*r.w_size,de(r.head),r.max_lazy_match=Se[r.level].max_lazy,r.good_match=Se[r.level].good_length,r.nice_match=Se[r.level].nice_length,r.max_chain_length=Se[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Pe=(e,t,r,i,n,s)=>{if(!e)return $;let a=1;if(t===re&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==ue||i<8||i>15||t<0||t>9||s<0||s>ae||8===i&&1!==a)return le(e,$);8===i&&(i=9);const o=new Ae;return e.state=o,o.strm=e,o.status=42,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Pe(e,t,ue,15,8,oe),deflateInit2:Pe,deflateReset:Ce,deflateResetKeep:Me,deflateSetHeader:(e,t)=>ke(e)||2!==e.state.wrap?$:(e.state.gzhead=t,Z),deflate:(e,t)=>{if(ke(e)||t>Q||t<0)return e?le(e,$):$;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===r.status&&t!==K)return le(e,0===e.avail_out?te:$);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ge(e),0===e.avail_out)return r.last_flush=-1,Z}else if(0===e.avail_in&&ce(t)<=ce(i)&&t!==K)return le(e,te);if(666===r.status&&0!==e.avail_in)return le(e,te);if(42===r.status&&0===r.wrap&&(r.status=113),42===r.status){let t=ue+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=ne||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ve(r,t),0!==r.strstart&&(ve(r,e.adler>>>16),ve(r,65535&e.adler)),e.adler=1,r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(57===r.status)if(e.adler=0,_e(r,31),_e(r,139),_e(r,8),r.gzhead)_e(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),_e(r,255&r.gzhead.time),_e(r,r.gzhead.time>>8&255),_e(r,r.gzhead.time>>16&255),_e(r,r.gzhead.time>>24&255),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(_e(r,255&r.gzhead.extra.length),_e(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=G(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,3),r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ge(e),0!==r.pending)return r.last_flush=-1,Z;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ge(e),0!==r.pending))return r.last_flush=-1,Z;_e(r,255&e.adler),_e(r,e.adler>>8&255),e.adler=0}if(r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(0!==e.avail_in||0!==r.lookahead||t!==Y&&666!==r.status){let i=0===r.level?xe(r,t):r.strategy===ne?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ye(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===se?((e,t)=>{let r,i,n,s;const a=e.window;for(;;){if(e.lookahead<=258){if(ye(e),e.lookahead<=258&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=e.strstart+258;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):Se[r.level].func(r,t);if(3!==i&&4!==i||(r.status=666),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Z;if(2===i&&(t===X?j(r):t!==Q&&(V(r,0,0,!1),t===q&&(de(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ge(e),0===e.avail_out))return r.last_flush=-1,Z}return t!==K?Z:r.wrap<=0?J:(2===r.wrap?(_e(r,255&e.adler),_e(r,e.adler>>8&255),_e(r,e.adler>>16&255),_e(r,e.adler>>24&255),_e(r,255&e.total_in),_e(r,e.total_in>>8&255),_e(r,e.total_in>>16&255),_e(r,e.total_in>>24&255)):(ve(r,e.adler>>>16),ve(r,65535&e.adler)),ge(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Z:J)},deflateEnd:e=>{if(ke(e))return $;const t=e.state.status;return e.state=null,113===t?le(e,ee):Z},deflateSetDictionary:(e,t)=>{let r=t.length;if(ke(e))return $;const i=e.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return $;if(1===n&&(e.adler=D(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(de(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ye(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=pe(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,ye(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,i.wrap=n,Z},deflateInfo:"pako deflate (from Nodeca project)"};const Le=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ie=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Le(r,t)&&(e[t]=r[t])}}return e},Oe=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Be[254]=Be[254]=1;var Ge=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,s,a=e.length,o=0;for(n=0;n>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},We=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const s=new Array(2*r);for(n=0,i=0;i4)s[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i1?s[n++]=65533:t<65536?s[n++]=t:(t-=65536,s[n++]=55296|t>>10&1023,s[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&De)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Be[e[r]]>t?r:t};var Fe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ve=Object.prototype.toString,{Z_NO_FLUSH:ze,Z_SYNC_FLUSH:He,Z_FULL_FLUSH:je,Z_FINISH:Ye,Z_OK:Xe,Z_STREAM_END:qe,Z_DEFAULT_COMPRESSION:Ke,Z_DEFAULT_STRATEGY:Qe,Z_DEFLATED:Ze}=N;function Je(e){this.options=Ie({level:Ke,method:Ze,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Ue.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Xe)throw new Error(W[r]);if(t.header&&Ue.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ge(t.dictionary):"[object ArrayBuffer]"===Ve.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Ue.deflateSetDictionary(this.strm,e),r!==Xe)throw new Error(W[r]);this._dict_set=!0}}function $e(e,t){const r=new Je(t);if(r.push(e,!0),r.err)throw r.msg||W[r.err];return r.result}Je.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?Ye:ze,"string"==typeof e?r.input=Ge(e):"[object ArrayBuffer]"===Ve.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(s===He||s===je)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=Ue.deflate(r,s),n===qe)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Ue.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Xe;if(0!==r.avail_out){if(s>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Je.prototype.onData=function(e){this.chunks.push(e)},Je.prototype.onEnd=function(e){e===Xe&&(this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var et={Deflate:Je,deflate:$e,deflateRaw:function(e,t){return(t=t||{}).raw=!0,$e(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,$e(e,t)},constants:N};var tt=function(e,t){let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R,E;const S=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,s=n-(t-e.avail_out),a=n+(e.avail_out-257),o=S.dmax,h=S.wsize,u=S.whave,l=S.wnext,c=S.window,d=S.hold,f=S.bits,p=S.lencode,g=S.distcode,m=(1<>>24,d>>>=b,f-=b,b=v>>>16&255,0===b)E[n++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=p[(65535&v)+(d&(1<>>=b,f-=b),f<15&&(d+=R[r++]<>>24,d>>>=b,f-=b,b=v>>>16&255,!(16&b)){if(0==(64&b)){v=g[(65535&v)+(d&(1<o){e.msg="invalid distance too far back",S.mode=16209;break e}if(d>>>=b,f-=b,b=n-s,y>b){if(b=y-b,b>u&&S.sane){e.msg="invalid distance too far back",S.mode=16209;break e}if(x=0,T=c,0===l){if(x+=h-b,b2;)E[n++]=T[x++],E[n++]=T[x++],E[n++]=T[x++],w-=3;w&&(E[n++]=T[x++],w>1&&(E[n++]=T[x++]))}else{x=n-y;do{E[n++]=E[x++],E[n++]=E[x++],E[n++]=E[x++],w-=3}while(w>2);w&&(E[n++]=E[x++],w>1&&(E[n++]=E[x++]))}break}}break}}while(r>3,r-=w,f-=w<<3,d&=(1<{const h=o.bits;let u,l,c,d,f,p,g=0,m=0,_=0,v=0,b=0,w=0,y=0,x=0,T=0,R=0,E=null;const S=new Uint16Array(16),A=new Uint16Array(16);let k,M,C,P=null;for(g=0;g<=15;g++)S[g]=0;for(m=0;m=1&&0===S[v];v--);if(b>v&&(b=v),0===v)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(_=1;_0&&(0===e||1!==v))return-1;for(A[1]=0,g=1;g<15;g++)A[g+1]=A[g]+S[g];for(m=0;m852||2===e&&T>592)return 1;for(;;){k=g-y,a[m]+1=p?(M=P[a[m]-p],C=E[a[m]-p]):(M=96,C=0),u=1<>y)+l]=k<<24|M<<16|C|0}while(0!==l);for(u=1<>=1;if(0!==u?(R&=u-1,R+=u):R=0,m++,0==--S[g]){if(g===v)break;g=t[r+a[m]]}if(g>b&&(R&d)!==c){for(0===y&&(y=b),f+=_,w=g-y,x=1<852||2===e&&T>592)return 1;c=R&d,n[c]=b<<24|w<<16|f-s|0}}return 0!==R&&(n[f+R]=g-y<<24|64<<16|0),o.bits=b,0};const{Z_FINISH:ot,Z_BLOCK:ht,Z_TREES:ut,Z_OK:lt,Z_STREAM_END:ct,Z_NEED_DICT:dt,Z_STREAM_ERROR:ft,Z_DATA_ERROR:pt,Z_MEM_ERROR:gt,Z_BUF_ERROR:mt,Z_DEFLATED:_t}=N,vt=16209,bt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function wt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<16180||t.mode>16211?1:0},xt=e=>{if(yt(e))return ft;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,lt},Tt=e=>{if(yt(e))return ft;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xt(e)},Rt=(e,t)=>{let r;if(yt(e))return ft;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ft:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Tt(e))},Et=(e,t)=>{if(!e)return ft;const r=new wt;e.state=r,r.strm=e,r.window=null,r.mode=16180;const i=Rt(e,t);return i!==lt&&(e.state=null),i};let St,At,kt=!0;const Mt=e=>{if(kt){St=new Int32Array(512),At=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(at(1,e.lens,0,288,St,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;at(2,e.lens,0,32,At,0,e.work,{bits:5}),kt=!1}e.lencode=St,e.lenbits=9,e.distcode=At,e.distbits=5},Ct=(e,t,r,i)=>{let n;const s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(t.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(t.subarray(r-i,r-i+n),s.wnext),(i-=n)?(s.window.set(t.subarray(r-i,r),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveEt(e,15),inflateInit2:Et,inflate:(e,t)=>{let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R=0;const E=new Uint8Array(4);let S,A;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yt(e)||!e.output||!e.input&&0!==e.avail_in)return ft;r=e.state,16191===r.mode&&(r.mode=16192),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,d=h,T=lt;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=vt;break}if((15&u)!==_t){e.msg="unknown compression method",r.mode=vt;break}if(u>>>=4,l-=4,x=8+(15&u),0===r.wbits&&(r.wbits=x),x>15||x>r.wbits){e.msg="invalid window size",r.mode=vt;break}r.dmax=1<>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=G(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>o&&(f=o),f&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(s,s+f),x)),512&r.flags&&4&r.wrap&&(r.check=G(r.check,i,f,s)),o-=f,s+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;f=0;do{x=i[s+f++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&f>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>=7&l,l-=7&l,r.mode=16206;break}for(;l<3;){if(0===o)break e;o--,u+=i[s++]<>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Mt(r),r.mode=16199,t===ut){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=vt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=vt;break}if(r.length=65535&u,u=0,l=0,r.mode=16194,t===ut)break e;case 16194:r.mode=16195;case 16195:if(f=r.length,f){if(f>o&&(f=o),f>h&&(f=h),0===f)break e;n.set(i.subarray(s,s+f),a),o-=f,s+=f,h-=f,a+=f,r.length-=f;break}r.mode=16191;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[s++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vt;break}r.have=0,r.mode=16197;case 16197:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},T=at(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid code lengths set",r.mode=vt;break}r.have=0,r.mode=16198;case 16198:for(;r.have>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=m,l-=m,r.lens[r.have++]=v;else{if(16===v){for(A=m+2;l>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=vt;break}x=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===v){for(A=m+3;l>>=m,l-=m,x=0,f=3+(7&u),u>>>=3,l-=3}else{for(A=m+7;l>>=m,l-=m,x=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vt;break}for(;f--;)r.lens[r.have++]=x}}if(r.mode===vt)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=vt;break}if(r.lenbits=9,S={bits:r.lenbits},T=at(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid literal/lengths set",r.mode=vt;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},T=at(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,T){e.msg="invalid distances set",r.mode=vt;break}if(r.mode=16199,t===ut)break e;case 16199:r.mode=16200;case 16200:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,tt(e,d),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;R=r.lencode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,r.length=v,0===_){r.mode=16205;break}if(32&_){r.back=-1,r.mode=16191;break}if(64&_){e.msg="invalid literal/length code",r.mode=vt;break}r.extra=15&_,r.mode=16201;case 16201:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;R=r.distcode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,64&_){e.msg="invalid distance code",r.mode=vt;break}r.offset=v,r.extra=15&_,r.mode=16203;case 16203:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vt;break}r.mode=16204;case 16204:if(0===h)break e;if(f=d-h,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vt;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),g=r.window}else g=n,p=a-r.offset,f=r.length;f>h&&(f=h),h-=f,r.length-=f;do{n[a++]=g[p++]}while(--f);0===r.length&&(r.mode=16200);break;case 16205:if(0===h)break e;n[a++]=r.length,h--,r.mode=16200;break;case 16206:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[s++]<{if(yt(e))return ft;let t=e.state;return t.window&&(t.window=null),e.state=null,lt},inflateGetHeader:(e,t)=>{if(yt(e))return ft;const r=e.state;return 0==(2&r.wrap)?ft:(r.head=t,t.done=!1,lt)},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,s;return yt(e)?ft:(i=e.state,0!==i.wrap&&16190!==i.mode?ft:16190===i.mode&&(n=1,n=D(n,t,r,0),n!==i.check)?pt:(s=Ct(e,t,r,r),s?(i.mode=16210,gt):(i.havedict=1,lt)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ut=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Lt=Object.prototype.toString,{Z_NO_FLUSH:It,Z_FINISH:Ot,Z_OK:Dt,Z_STREAM_END:Bt,Z_NEED_DICT:Gt,Z_STREAM_ERROR:Wt,Z_DATA_ERROR:Nt,Z_MEM_ERROR:Ft}=N;function Vt(e){this.options=Ie({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Pt.inflateInit2(this.strm,t.windowBits);if(r!==Dt)throw new Error(W[r]);if(this.header=new Ut,Pt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ge(t.dictionary):"[object ArrayBuffer]"===Lt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Pt.inflateSetDictionary(this.strm,t.dictionary),r!==Dt)))throw new Error(W[r])}function zt(e,t){const r=new Vt(t);if(r.push(e),r.err)throw r.msg||W[r.err];return r.result}Vt.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Ot:It,"[object ArrayBuffer]"===Lt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),s=Pt.inflate(r,a),s===Gt&&n&&(s=Pt.inflateSetDictionary(r,n),s===Dt?s=Pt.inflate(r,a):s===Nt&&(s=Gt));r.avail_in>0&&s===Bt&&r.state.wrap>0&&0!==e[r.next_in];)Pt.inflateReset(r),s=Pt.inflate(r,a);switch(s){case Wt:case Nt:case Gt:case Ft:return this.onEnd(s),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||s===Bt))if("string"===this.options.to){let e=Ne(r.output,r.next_out),t=r.next_out-e,n=We(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(s!==Dt||0!==o){if(s===Bt)return s=Pt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Vt.prototype.onData=function(e){this.chunks.push(e)},Vt.prototype.onEnd=function(e){e===Dt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Ht={Inflate:Vt,inflate:zt,inflateRaw:function(e,t){return(t=t||{}).raw=!0,zt(e,t)},ungzip:zt,constants:N};const{Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt}=et,{Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt}=Ht;var $t=jt,er=Yt,tr=Xt,rr=qt,ir=Kt,nr=Qt,sr=Zt,ar=Jt,or=N,hr={Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt,Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt,constants:N}},,,,,,,,,,function(e,t,r){"use strict";r.r(t);var i=r(40);Object.keys(i).forEach(e=>self[e]=i[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/sharing_s.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1; +var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +} +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="video.decode.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["memory"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={362860:$0=>{console.log("Video Version: ",$0)},362897:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},362931:$0=>{change_capture_resolution($0)},362966:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},363043:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},363113:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_webcodec($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},363192:($0,$1)=>{decode_callback($0,$1)},363221:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},363255:($0,$1,$2,$3)=>{Video_Controller_Encode_Data2($0,$1,$2,$3)},363303:($0,$1)=>{SAVE_IV($0,$1)},363321:($0,$1,$2,$3)=>{Video_Controller_Encode_Data($0,$1,$2,$3)},363368:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},363425:$0=>{Exit_Thread($0)},363443:$0=>{return Before_Create_Thread($0)},363480:$0=>{return Before_Create_Thread($0)},363517:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},363551:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},363591:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},363621:$0=>{SubScribeUpdateVideo($0)},363649:()=>{return Date.now()/1e3},363676:()=>{return Date.now()%1e3},363703:($0,$1)=>{send_data($0,$1)},363726:$0=>{SubScribeUpdateVideo($0)},363754:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},363815:($0,$1)=>{SAVE_IV($0,$1)},363833:()=>{return Date.now()},363856:($0,$1)=>{Update_Required_Bandwidth($0,$1)},363892:$0=>{Update_Video_Hd_Info($0)},363922:$0=>{console.log("Sharing Version: ",$0)},363961:($0,$1,$2,$3)=>{Send_Multi_Data($0,$1,$2,$3)},363995:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},364017:($0,$1,$2)=>{Send_Data($0,$1,$2)},364041:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364069:($0,$1,$2)=>{Send_Data($0,$1,$2)},364093:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364121:($0,$1,$2)=>{Send_Data($0,$1,$2)},364145:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},364183:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},364220:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364251:($0,$1,$2)=>{Send_Data($0,$1,$2)},364278:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364308:($0,$1,$2)=>{Send_Data($0,$1,$2)},364335:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)=>{frame_callback_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)},364426:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_mouse_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},364513:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},364545:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},364590:$0=>{SubScribeUpdateSharing($0)},364620:($0,$1)=>{Send_Data($0,$1)},364643:$0=>{Update_WebSokcet_Speed($0)},364675:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},364738:($0,$1)=>{SAVE_IV($0,$1)},364756:$0=>{console.error("tjDecompressHeader3 error %d ",$0)},364809:$0=>{console.error("tjDecompress2 error %d ",$0)},364856:($0,$1,$2,$3)=>{Sharing_Decode_Channel_Change($0,$1,$2,$3)},364903:($0,$1)=>{Update_Required_Bandwidth($0,$1)},364939:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},364970:($0,$1)=>{Recieve_Wb_Packet($0,$1)},364997:($0,$1)=>{COMMIT_PRINT($0,$1)},365019:()=>{videoencode_create_helpthread()},365054:($0,$1)=>{LOG_OUT($0,$1)},365075:($0,$1)=>{wcl_trace_log($0,$1)}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function _AdapterWhiteListCheck(){return checkWebCodecWhitelist_js()}function _CloseVideoEncoder(id){CloseVideoEncoder_js(id)}function _CreateGltPlatform(){err("missing function: CreateGltPlatform");abort(-1)}function _DestroyGltPlatform(){err("missing function: DestroyGltPlatform");abort(-1)}function _GetEncoderState(id){return GetEncoderState_js(id)}function _GetLogLevel(){return GetLogLevel_js()}function _InitVideoDecoder(id,context){return InitVideoDecoder_js(id,context)}function _InitVideoEncoder(id,context){return InitVideoEncoder_js(id,context)}function _LimitWebCodecsDecoderTo360(){return LimitWebCodecsDecoderTo360_js()}function _LimitWebCodecsEncoderTo360(){return LimitWebCodecsEncoderTo360_js()}function _Set_Share_Mode(flag){return Set_Share_Mode_js(flag)}function _UserAgentIsTesla(){return UserAgentIsTesla_js()}function _VideoDecoder(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount){return VideoDecoder_js(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount)}function _VideoDecoderConfigure(id,extradata,extraDataLen,Width,Height){return VideoDecoderConfigure_js(id,extradata,extraDataLen,Width,Height)}function _VideoEncoderConfigure(id,Bitrate,Framerate,Width,Height,bsBuffer){return VideoEncoderConfigure_js(id,Bitrate,Framerate,Width,Height,bsBuffer)}function _WebCodecsDecoderFail(m_iID){WebCodecsDecoderFail_js(m_iID)}function _WebCodecsEncoderFail(m_iID,code){WebCodecsEncoderFail_js(m_iID,code)}function _WebCodecsVideoEncoder(id,videoFrameId,NewIDR,rawData,dataLength,timeout){return VideoEncoder_js(id,videoFrameId,NewIDR,rawData,dataLength,timeout)}function __ZN11cpt_generic6thread4joinEv(){err("missing function: _ZN11cpt_generic6thread4joinEv");abort(-1)}function __ZN11cpt_generic6threadD1Ev(){err("missing function: _ZN11cpt_generic6threadD1Ev");abort(-1)}function __ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE(){err("missing function: _ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE");abort(-1)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function __emscripten_throw_longjmp(){throw Infinity}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function runMainThreadEmAsm(code,sigPtr,argbuf,sync){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int_sync_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,1)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){postMessage({status:-35,cmd:-35})}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;_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 instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _setCurrentThreadSsrc(ssrc){setCurrentThreadSsrc_js(ssrc)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function _zlt_tfjs_execute_afn(input_img,input_ref,input_msk,len,output_buffer){return execute_afn(input_img,input_ref,input_msk,len,output_buffer)}function _zlt_tfjs_execute_base_cls(input_buffer,len,output_buffer,output_len){return execute_base(input_buffer,len,output_buffer,output_len)}async function _zlt_tfjs_init(){}function _zoom_wcl_get_cpu_num(){return hardcodecpunumber()}function _zoom_wcl_get_csc_thread_num(){return 1}function _zoom_wcl_support_multi_thread(){return IsSupportMultiThread()}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"AdapterWhiteListCheck":_AdapterWhiteListCheck,"CloseVideoEncoder":_CloseVideoEncoder,"CreateGltPlatform":_CreateGltPlatform,"DestroyGltPlatform":_DestroyGltPlatform,"GetEncoderState":_GetEncoderState,"GetLogLevel":_GetLogLevel,"InitVideoDecoder":_InitVideoDecoder,"InitVideoEncoder":_InitVideoEncoder,"LimitWebCodecsDecoderTo360":_LimitWebCodecsDecoderTo360,"LimitWebCodecsEncoderTo360":_LimitWebCodecsEncoderTo360,"Set_Share_Mode":_Set_Share_Mode,"UserAgentIsTesla":_UserAgentIsTesla,"VideoDecoder":_VideoDecoder,"VideoDecoderConfigure":_VideoDecoderConfigure,"VideoEncoderConfigure":_VideoEncoderConfigure,"WebCodecsDecoderFail":_WebCodecsDecoderFail,"WebCodecsEncoderFail":_WebCodecsEncoderFail,"WebCodecsVideoEncoder":_WebCodecsVideoEncoder,"_ZN11cpt_generic6thread4joinEv":__ZN11cpt_generic6thread4joinEv,"_ZN11cpt_generic6threadD1Ev":__ZN11cpt_generic6threadD1Ev,"_ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE":__ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE,"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_emscripten_throw_longjmp":__emscripten_throw_longjmp,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_asm_const_int_sync_on_main_thread":_emscripten_asm_const_int_sync_on_main_thread,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"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_ii":invoke_ii,"invoke_iii":invoke_iii,"invoke_iiii":invoke_iiii,"invoke_vi":invoke_vi,"invoke_viii":invoke_viii,"setCurrentThreadSsrc":_setCurrentThreadSsrc,"strftime":_strftime,"strftime_l":_strftime_l,"zlt_tfjs_execute_afn":_zlt_tfjs_execute_afn,"zlt_tfjs_execute_base_cls":_zlt_tfjs_execute_base_cls,"zlt_tfjs_init":_zlt_tfjs_init,"zoom_wcl_get_cpu_num":_zoom_wcl_get_cpu_num,"zoom_wcl_get_csc_thread_num":_zoom_wcl_get_csc_thread_num,"zoom_wcl_support_multi_thread":_zoom_wcl_support_multi_thread};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Video_Init=Module["__Video_Init"]=function(){return(__Video_Init=Module["__Video_Init"]=Module["asm"]["_Video_Init"]).apply(null,arguments)};var __Video_UnInit=Module["__Video_UnInit"]=function(){return(__Video_UnInit=Module["__Video_UnInit"]=Module["asm"]["_Video_UnInit"]).apply(null,arguments)};var __Video_Decode=Module["__Video_Decode"]=function(){return(__Video_Decode=Module["__Video_Decode"]=Module["asm"]["_Video_Decode"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __Video_Try_Analysis=Module["__Video_Try_Analysis"]=function(){return(__Video_Try_Analysis=Module["__Video_Try_Analysis"]=Module["asm"]["_Video_Try_Analysis"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __Video_Encode_YUV=Module["__Video_Encode_YUV"]=function(){return(__Video_Encode_YUV=Module["__Video_Encode_YUV"]=Module["asm"]["_Video_Encode_YUV"]).apply(null,arguments)};var __Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=function(){return(__Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=Module["asm"]["_Video_VirtualBackground_Special_Action"]).apply(null,arguments)};var __Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=function(){return(__Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=Module["asm"]["_Qos_Sender_Send_Data_In_Main_Thread"]).apply(null,arguments)};var __Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=function(){return(__Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=Module["asm"]["_Video_Websocket_Speed"]).apply(null,arguments)};var __Video_Start_Encode=Module["__Video_Start_Encode"]=function(){return(__Video_Start_Encode=Module["__Video_Start_Encode"]=Module["asm"]["_Video_Start_Encode"]).apply(null,arguments)};var __Video_Stop_Encode=Module["__Video_Stop_Encode"]=function(){return(__Video_Stop_Encode=Module["__Video_Stop_Encode"]=Module["asm"]["_Video_Stop_Encode"]).apply(null,arguments)};var __Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=function(){return(__Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=Module["asm"]["_Request_Video_Qos_Data"]).apply(null,arguments)};var __Video_Update_Format=Module["__Video_Update_Format"]=function(){return(__Video_Update_Format=Module["__Video_Update_Format"]=Module["asm"]["_Video_Update_Format"]).apply(null,arguments)};var __Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=function(){return(__Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=Module["asm"]["_Video_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=function(){return(__Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=Module["asm"]["_Add_Video_Cooker_info"]).apply(null,arguments)};var __Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=function(){return(__Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=Module["asm"]["_Remove_Video_Cooker_Info"]).apply(null,arguments)};var __Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=function(){return(__Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=Module["asm"]["_Get_Video_Meat_Weight"]).apply(null,arguments)};var __Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=function(){return(__Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=Module["asm"]["_Set_Max_Receiving_Channel_Num"]).apply(null,arguments)};var __update_sync_time=Module["__update_sync_time"]=function(){return(__update_sync_time=Module["__update_sync_time"]=Module["asm"]["_update_sync_time"]).apply(null,arguments)};var __release_video_receiving_channel=Module["__release_video_receiving_channel"]=function(){return(__release_video_receiving_channel=Module["__release_video_receiving_channel"]=Module["asm"]["_release_video_receiving_channel"]).apply(null,arguments)};var __change_hw_status=Module["__change_hw_status"]=function(){return(__change_hw_status=Module["__change_hw_status"]=Module["asm"]["_change_hw_status"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).apply(null,arguments)};var __update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=function(){return(__update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_video_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __create_vb_thread=Module["__create_vb_thread"]=function(){return(__create_vb_thread=Module["__create_vb_thread"]=Module["asm"]["_create_vb_thread"]).apply(null,arguments)};var __create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=function(){return(__create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=Module["asm"]["_create_vb_no_sab_thread"]).apply(null,arguments)};var __signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=function(){return(__signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=Module["asm"]["_signal_vb_thread_blur"]).apply(null,arguments)};var __signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=function(){return(__signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=Module["asm"]["_signal_vb_thread_bg"]).apply(null,arguments)};var __signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=function(){return(__signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=Module["asm"]["_signal_vb_thread_video_yuv"]).apply(null,arguments)};var __signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=function(){return(__signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=Module["asm"]["_signal_vb_thread_video_rgba"]).apply(null,arguments)};var __signal_vb_thread_close=Module["__signal_vb_thread_close"]=function(){return(__signal_vb_thread_close=Module["__signal_vb_thread_close"]=Module["asm"]["_signal_vb_thread_close"]).apply(null,arguments)};var __update_video_cropping_mode=Module["__update_video_cropping_mode"]=function(){return(__update_video_cropping_mode=Module["__update_video_cropping_mode"]=Module["asm"]["_update_video_cropping_mode"]).apply(null,arguments)};var __collect_video_monitor_info=Module["__collect_video_monitor_info"]=function(){return(__collect_video_monitor_info=Module["__collect_video_monitor_info"]=Module["asm"]["_collect_video_monitor_info"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=function(){return(__Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=Module["asm"]["_Sharing_Encode_Init"]).apply(null,arguments)};var __Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=function(){return(__Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=Module["asm"]["_Sharing_Encode_Try_Analysis"]).apply(null,arguments)};var __Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=function(){return(__Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=Module["asm"]["_Sharing_Encode_Uninit"]).apply(null,arguments)};var __Sharing_Encode=Module["__Sharing_Encode"]=function(){return(__Sharing_Encode=Module["__Sharing_Encode"]=Module["asm"]["_Sharing_Encode"]).apply(null,arguments)};var __Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=function(){return(__Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=Module["asm"]["_Sharing_Encode_Mouse_Data"]).apply(null,arguments)};var __Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=function(){return(__Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=Module["asm"]["_Request_Sharing_Qos_Data"]).apply(null,arguments)};var __Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=function(){return(__Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=Module["asm"]["_Sharing_Set_Data_Encryption"]).apply(null,arguments)};var __Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=function(){return(__Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=Module["asm"]["_Sharing_Pause_Encode"]).apply(null,arguments)};var __Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=function(){return(__Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=Module["asm"]["_Sharing_Resume_Encode"]).apply(null,arguments)};var __Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=function(){return(__Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=Module["asm"]["_Sharing_Stop_Encode"]).apply(null,arguments)};var __Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=function(){return(__Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=Module["asm"]["_Sharing_Websocket_Speed"]).apply(null,arguments)};var __Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=function(){return(__Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=Module["asm"]["_Add_Sharing_Cooker_info"]).apply(null,arguments)};var __Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=function(){return(__Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=Module["asm"]["_Remove_Sharing_Cooker_Info"]).apply(null,arguments)};var __Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=function(){return(__Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=Module["asm"]["_Get_Sharing_Meat_Weight"]).apply(null,arguments)};var __Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=function(){return(__Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=Module["asm"]["_Set_Sharing_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Add_Rev_Channel=Module["__Add_Rev_Channel"]=function(){return(__Add_Rev_Channel=Module["__Add_Rev_Channel"]=Module["asm"]["_Add_Rev_Channel"]).apply(null,arguments)};var __Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=function(){return(__Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=Module["asm"]["_Remove_Rev_Channel"]).apply(null,arguments)};var __update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=function(){return(__update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_sharing_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var __collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=function(){return(__collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=Module["asm"]["_collect_sharing_monitor_info"]).apply(null,arguments)};var __set_annotation_action=Module["__set_annotation_action"]=function(){return(__set_annotation_action=Module["__set_annotation_action"]=Module["asm"]["_set_annotation_action"]).apply(null,arguments)};var __request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=function(){return(__request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=Module["asm"]["_request_nack_t_periodically_for_sharing_qos"]).apply(null,arguments)};var __Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=function(){return(__Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=Module["asm"]["_Change_Connect_Type_For_Sharing"]).apply(null,arguments)};var __Jpeg_Init=Module["__Jpeg_Init"]=function(){return(__Jpeg_Init=Module["__Jpeg_Init"]=Module["asm"]["_Jpeg_Init"]).apply(null,arguments)};var __Jpeg_Uninit=Module["__Jpeg_Uninit"]=function(){return(__Jpeg_Uninit=Module["__Jpeg_Uninit"]=Module["asm"]["_Jpeg_Uninit"]).apply(null,arguments)};var __Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=function(){return(__Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=Module["asm"]["_Jpeg_HeardInfo"]).apply(null,arguments)};var __Jpeg_Decode=Module["__Jpeg_Decode"]=function(){return(__Jpeg_Decode=Module["__Jpeg_Decode"]=Module["asm"]["_Jpeg_Decode"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=function(){return(_OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=Module["asm"]["OnVideoFrameOutputCallback"]).apply(null,arguments)};var _OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=function(){return(_OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=Module["asm"]["OnEncodedVideoChunkOutputCallback"]).apply(null,arguments)};var _saveSetjmp=Module["_saveSetjmp"]=function(){return(_saveSetjmp=Module["_saveSetjmp"]=Module["asm"]["saveSetjmp"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return(_setThrew=Module["_setThrew"]=Module["asm"]["setThrew"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiii"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiijii=Module["dynCall_iiijii"]=function(){return(dynCall_iiijii=Module["dynCall_iiijii"]=Module["asm"]["dynCall_iiijii"]).apply(null,arguments)};var dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=function(){return(dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiij"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=function(){return(dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=Module["asm"]["dynCall_iiiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiiij"]).apply(null,arguments)};var dynCall_viiiiiij=Module["dynCall_viiiiiij"]=function(){return(dynCall_viiiiiij=Module["dynCall_viiiiiij"]=Module["asm"]["dynCall_viiiiiij"]).apply(null,arguments)};var dynCall_viji=Module["dynCall_viji"]=function(){return(dynCall_viji=Module["dynCall_viji"]=Module["asm"]["dynCall_viji"]).apply(null,arguments)};var dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=function(){return(dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=Module["asm"]["dynCall_iiiiiiji"]).apply(null,arguments)};var dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=function(){return(dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=Module["asm"]["dynCall_iiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiij"]).apply(null,arguments)};var dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=function(){return(dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiij"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_jiiiiii=Module["dynCall_jiiiiii"]=function(){return(dynCall_jiiiiii=Module["dynCall_jiiiiii"]=Module["asm"]["dynCall_jiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/sharing_simd.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_simd.min.js new file mode 100644 index 0000000..598a287 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/sharing_simd.min.js @@ -0,0 +1,28 @@ +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=58)}([function(e,t,r){var i=r(37),n=r(32);e.exports=function(e,t){var r=n(e,t,"get");return i(e,r)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(38),n=r(32);e.exports=function(e,t,r){var s=n(e,t,"set");return i(e,s,r),r},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"C",(function(){return i})),r.d(t,"j",(function(){return n})),r.d(t,"t",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"v",(function(){return o})),r.d(t,"x",(function(){return h})),r.d(t,"p",(function(){return u})),r.d(t,"s",(function(){return l})),r.d(t,"q",(function(){return c})),r.d(t,"r",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"w",(function(){return g})),r.d(t,"g",(function(){return m})),r.d(t,"y",(function(){return _})),r.d(t,"z",(function(){return v})),r.d(t,"A",(function(){return b})),r.d(t,"B",(function(){return w})),r.d(t,"e",(function(){return y})),r.d(t,"d",(function(){return x})),r.d(t,"c",(function(){return T})),r.d(t,"f",(function(){return R})),r.d(t,"n",(function(){return E})),r.d(t,"o",(function(){return S})),r.d(t,"m",(function(){return A})),r.d(t,"l",(function(){return k})),r.d(t,"h",(function(){return M})),r.d(t,"u",(function(){return C})),r.d(t,"i",(function(){return P}));const i={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},n={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},s={AVAILABLE:0,VIDEO:1,SHARE:2},a={IDLE:0,PENDING:1,READY:2,RENDERING:3},o={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},h={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},u=0,l=1,c=2,d=3,f=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],p=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},m=["intel","nvidia","apple","amd","qualcomm","arm"],_="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n struct FsUniforms {\n rotation: f32,\n };\n\n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n\n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n",v="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(6) var vertexUniforms: FsUniforms;\n\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n\n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var vPlaneTex: texture_2d;\n @group(0) @binding(5) var uniforms: FsUniforms;\n // @group(0) @binding(7) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n return color;\n }\n",b="\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @group(0) @binding(5) var vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n\n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d;\n @group(0) @binding(3) var uPlaneTex: texture_2d;\n @group(0) @binding(4) var uniforms: FsUniforms;\n // @group(0) @binding(5) var outputBuffer: array;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2) -> @location(0) vec4 {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n\n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n\n const yuv2RGB_F = mat4x4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n var color = vec4(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n\n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n\n return color;\n }\n",w="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n",y="\n\n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n\n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d;\n @group(0) @binding(2) var uniforms: FsUniforms;\n\n struct VertexOutput {\n @builtin(position) Position: vec4,\n @location(0) uv: vec2,\n };\n\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2,\n @location(1) uvPos: vec2\n ) -> VertexOutput {\n\n var output: VertexOutput;\n output.Position = vec4(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n\n @fragment\n fn f_main(@location(0) uv: vec2) -> @location(0) vec4 {\n var color: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n\n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4 = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n\n return color;\n }\n",x="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4 {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n",T="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2,\n ) -> @builtin(position) vec4 {\n return vec4(vtxPos, 0.0, 1.0);\n }\n\n struct ClearColorUniforms {\n clearColor: vec4,\n };\n\n @group(0) @binding(0) var uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4 {\n return uniforms.clearColor;\n }\n",R={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},E={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},S={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},A=[60,120,180,360,540,720,1080,2160],k={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},M=6,C=[180,360,540,720,1080,2160],P=5},function(e,t,r){"use strict";var i=r(5),n=r(16);new Error;const s=new Map;function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,h=null;function u(e,t){var r,i;if(!function(e){const t=performance.now();return(!s.has(e)||t-s.get(e)>5e3)&&(s.set(e,t),!0)}(e))return;let u;try{u=a("object"==typeof t?JSON.stringify(t):t)}catch(e){u=a(t)}null===(r=h)||void 0===r||r("NEM-".concat(e,"-").concat(u)),n.a.error("NotifyUIError,event=".concat(e,",data=").concat(u)),null===(i=o)||void 0===i||i(e,t)}var l=r(15);function c(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function p(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function g(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const r=await new Promise((e,t)=>{const r=i=>{let n=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===n.command?(y("DE"),self.removeEventListener("message",r),e(n.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===n.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),y("DS"),postMessage({status:i.E,url:wasmUrl})});let n=await WebAssembly.instantiate(r,e);n.instance?(self.wasmModuleToShare=n.module,t(n.instance)):(self.wasmModuleToShare=r,t(n))}catch(e){y("IF"),b("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}r.d(t,"d",(function(){return c})),r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"c",(function(){return g})),r.d(t,"q",(function(){return m})),r.d(t,"i",(function(){return v})),r.d(t,"u",(function(){return b})),r.d(t,"t",(function(){return w})),r.d(t,"o",(function(){return y})),r.d(t,"n",(function(){return x})),r.d(t,"v",(function(){return T})),r.d(t,"w",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"s",(function(){return A})),r.d(t,"k",(function(){return k})),r.d(t,"m",(function(){return M})),r.d(t,"r",(function(){return L})),r.d(t,"l",(function(){return I})),r.d(t,"x",(function(){return W})),r.d(t,"b",(function(){return N})),r.d(t,"h",(function(){return F})),r.d(t,"y",(function(){return V})),r.d(t,"a",(function(){return z})),r.d(t,"j",(function(){return H}));const _="function"!=typeof importScripts;function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_?n.a.error(e,t):b(e,t)}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var r,n,s,a;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(r=t)||void 0===r?void 0:r.message)+" Stack: "+(null!==(n=null===(s=t)||void 0===s||null===(s=s.error)||void 0===s?void 0:s.stack)&&void 0!==n?n:null===(a=t)||void 0===a?void 0:a.stack),t=null);postMessage({status:i.G,errorMessage:e,errorEvent:t})}function w(e){postMessage({status:i.G,errorMessage:e,level:"low"})}function y(e){postMessage({status:i.zb,data:e})}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:i.f,data:e});postMessage({status:i.f,data:e})}function T(e){postMessage({status:i.M,canvasId:e,replaceCanvas:!1})}function R(e){postMessage({status:i.N,canvasId:e})}function E(e){_?u(l.k,e):postMessage({status:i.Bb,where:e})}function S(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function A(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(r){t=null==e?void 0:e.getContext("2d")}return t||b("get2DContextFromCanvas return null"),t}class k{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let r=0;r0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new S;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class M{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),i=r>e?r:e;if(i+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(i)}return this.store(e)}store(e){return this.sharedBufferList.get().then(t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{this.autoRecycle()}})}storeSync(e){let t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}autoRecycle(){this.autoRecycleInterval=setTimeout(()=>{console.log("autoRecycle",this.obj.index),this.recycle()},5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){b("Error in YuvWrap.recycle: ".concat(e))}}}function C(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function P(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const U=["","MOZ_","OP_","WEBKIT_"];function L(e,t){for(var r=0;r0&&(t+="&index="+e);let r={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:C,onclose:P,group:this,index:e},i=new O(r);await i.connect(),this.transportArray[e]=i}}send(e){if(!(this.openedCount<=0))for(let t=0;t{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const D=new Map,B=[90,180,360,720,1080],G=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,r)=>{const i=this.ssrcInfoMap.get(r);i&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))})}_notifyFPS(e,t){postMessage({status:i.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function W(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:n,r_h:s,rotation:a,ssrc:o}=e;let h=1==a||3==a,u=h?s:n,l=h?n:s;const c=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-l)>Math.abs(t-l)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!D.get(c)||D.get(c).width!==u||D.get(c).height!==l){const e={width:u,height:l,ssrc:c,quality:f};D.set(c,e),r?r(e):postMessage({status:i.v,data:e})}t&&G.updateSSRCInfo(c,Date.now())}function N(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function F(e,t,r,i,n){if(!n&&!i||1==e)return!1;let s=i&&t>=640,a=n&&t>=1280;return 2!=e||640==t&&480==r?s||a:((s||a)&&v("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}function V(e,t){e?e.send(t):b("websocket is null",new Error("message type ".concat(t[0])))}function z(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function H(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,r){"use strict";r.d(t,"y",(function(){return i})),r.d(t,"Y",(function(){return n})),r.d(t,"L",(function(){return s})),r.d(t,"K",(function(){return a})),r.d(t,"J",(function(){return o})),r.d(t,"v",(function(){return h})),r.d(t,"q",(function(){return u})),r.d(t,"r",(function(){return l})),r.d(t,"w",(function(){return c})),r.d(t,"x",(function(){return d})),r.d(t,"u",(function(){return f})),r.d(t,"X",(function(){return p})),r.d(t,"P",(function(){return g})),r.d(t,"Q",(function(){return m})),r.d(t,"O",(function(){return _})),r.d(t,"M",(function(){return v})),r.d(t,"s",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"n",(function(){return y})),r.d(t,"l",(function(){return x})),r.d(t,"m",(function(){return T})),r.d(t,"db",(function(){return R})),r.d(t,"B",(function(){return E})),r.d(t,"C",(function(){return S})),r.d(t,"W",(function(){return A})),r.d(t,"ab",(function(){return k})),r.d(t,"V",(function(){return M})),r.d(t,"Z",(function(){return C})),r.d(t,"N",(function(){return P})),r.d(t,"h",(function(){return U})),r.d(t,"g",(function(){return L})),r.d(t,"f",(function(){return I})),r.d(t,"A",(function(){return O})),r.d(t,"z",(function(){return D})),r.d(t,"S",(function(){return B})),r.d(t,"R",(function(){return G})),r.d(t,"e",(function(){return W})),r.d(t,"o",(function(){return N})),r.d(t,"T",(function(){return F})),r.d(t,"U",(function(){return V})),r.d(t,"G",(function(){return z})),r.d(t,"E",(function(){return H})),r.d(t,"H",(function(){return j})),r.d(t,"I",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"bb",(function(){return q})),r.d(t,"c",(function(){return K})),r.d(t,"b",(function(){return Q})),r.d(t,"cb",(function(){return Z})),r.d(t,"d",(function(){return J})),r.d(t,"t",(function(){return $})),r.d(t,"D",(function(){return ee})),r.d(t,"p",(function(){return te})),r.d(t,"a",(function(){return re})),r.d(t,"j",(function(){return ie})),r.d(t,"i",(function(){return ne}));const i=1e3,n=5,s=43,a=44,o=45,h=0,u=1,l=146,c=2,d=7,f=9,p=17,g=10,m=11,_=12,v=102,b=107,w=0,y=1,x=2,T=3,R=65,E=0,S=1,A=-1,k=0,M=1,C=2,P=3,U=1,L=2,I=3,O={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},D={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,G=20,W=15,N=10,F=8294400,V=5,z=0,H=1,j=2,Y=15,X=5,q=400,K=7,Q=8,Z={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},J={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,re=1,ie=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),ne={PAUSE:0,RESUME:1,STOP:2}},function(e,t,r){"use strict";r.d(t,"j",(function(){return i})),r.d(t,"h",(function(){return n})),r.d(t,"l",(function(){return s})),r.d(t,"sb",(function(){return a})),r.d(t,"qb",(function(){return o})),r.d(t,"ub",(function(){return h})),r.d(t,"Z",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"bb",(function(){return c})),r.d(t,"db",(function(){return d})),r.d(t,"D",(function(){return f})),r.d(t,"ob",(function(){return p})),r.d(t,"H",(function(){return g})),r.d(t,"Eb",(function(){return m})),r.d(t,"n",(function(){return _})),r.d(t,"vb",(function(){return v})),r.d(t,"E",(function(){return b})),r.d(t,"b",(function(){return w})),r.d(t,"zb",(function(){return y})),r.d(t,"S",(function(){return x})),r.d(t,"I",(function(){return T})),r.d(t,"T",(function(){return R})),r.d(t,"xb",(function(){return E})),r.d(t,"f",(function(){return S})),r.d(t,"nb",(function(){return A})),r.d(t,"mb",(function(){return k})),r.d(t,"eb",(function(){return M})),r.d(t,"X",(function(){return C})),r.d(t,"V",(function(){return P})),r.d(t,"a",(function(){return U})),r.d(t,"z",(function(){return L})),r.d(t,"Fb",(function(){return I})),r.d(t,"G",(function(){return O})),r.d(t,"wb",(function(){return D})),r.d(t,"v",(function(){return B})),r.d(t,"u",(function(){return G})),r.d(t,"t",(function(){return W})),r.d(t,"w",(function(){return N})),r.d(t,"U",(function(){return F})),r.d(t,"jb",(function(){return V})),r.d(t,"kb",(function(){return z})),r.d(t,"R",(function(){return H})),r.d(t,"hb",(function(){return j})),r.d(t,"ib",(function(){return Y})),r.d(t,"F",(function(){return X})),r.d(t,"r",(function(){return q})),r.d(t,"q",(function(){return K})),r.d(t,"y",(function(){return Q})),r.d(t,"p",(function(){return Z})),r.d(t,"x",(function(){return J})),r.d(t,"Cb",(function(){return $})),r.d(t,"O",(function(){return ee})),r.d(t,"P",(function(){return te})),r.d(t,"Ab",(function(){return re})),r.d(t,"C",(function(){return ie})),r.d(t,"B",(function(){return ne})),r.d(t,"A",(function(){return se})),r.d(t,"K",(function(){return ae})),r.d(t,"J",(function(){return oe})),r.d(t,"L",(function(){return he})),r.d(t,"o",(function(){return ue})),r.d(t,"s",(function(){return le})),r.d(t,"gb",(function(){return ce})),r.d(t,"fb",(function(){return de})),r.d(t,"Db",(function(){return fe})),r.d(t,"Q",(function(){return pe})),r.d(t,"i",(function(){return ge})),r.d(t,"g",(function(){return me})),r.d(t,"k",(function(){return _e})),r.d(t,"m",(function(){return ve})),r.d(t,"rb",(function(){return be})),r.d(t,"pb",(function(){return we})),r.d(t,"tb",(function(){return ye})),r.d(t,"Y",(function(){return xe})),r.d(t,"cb",(function(){return Te})),r.d(t,"ab",(function(){return Re})),r.d(t,"c",(function(){return Ee})),r.d(t,"M",(function(){return Se})),r.d(t,"Bb",(function(){return Ae})),r.d(t,"N",(function(){return ke})),r.d(t,"yb",(function(){return Me})),r.d(t,"W",(function(){return Ce})),r.d(t,"lb",(function(){return Pe})),r.d(t,"e",(function(){return Ue}));const i=1,n=2,s=3,a=7,o=8,h=9,u=12,l=14,c=15,d=16,f=18,p=20,g=21,m=24,_=26,v=27,b=30,w=31,y=35,x=36,T=37,R=38,E=47,S=48,A=50,k=51,M=52,C=53,P=54,U=56,L=57,I=60,O=61,D=62,B=66.5,G=66.6,W=67,N=68,F=69,V=71,z=72,H=73,j=75,Y=76,X=78,q=105,K=106,Q=107,Z=108,J=109,$=120,ee=121,te=122,re=123,ie=124,ne=125,se=126,ae=127,oe=128,he=129,ue=132,le=133,ce=135,de=136,fe=137,pe=151,ge=-1,me=-2,_e=-3,ve=-5,be=-7,we=-8,ye=-9,xe=-12,Te=-14,Re=-15,Ee=-23,Se=-26,Ae=-27,ke=-28,Me=-35,Ce=-129,Pe=-130,Ue=-131},function(e,t,r){"use strict";r.d(t,"e",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"d",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"c",(function(){return g}));var i=r(7),n=r.n(i),s=r(14),a=r(17),o=r(5),h=r(10),u=r(13);const l={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},c=e=>{0};class d{constructor(){this.onmessage=c,this.status=d.CLOSED,this.onopen=c,this.onclose=c,this.onwer=null}send(e){}delete(){this.onmessage=c,this.onopen=c,this.onclose=c,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}n()(d,"OPEN",1),n()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=c,this.sender=c,this.videoSender=c,this.reciver=c,this.wasmSender=c;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(c),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=c),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(r,0);break;case o.L:this.status=r,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:r,interval:i}=e||{};r?i?(this.sender=e=>{r.enqueue(e)},this.wasmSender=e=>{r.enqueue(e)},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}}):(this.sender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),this.port.postMessage({cmd:o.K,data:r},[r.buffer])});let{sabqueue:n,consumer:h,useCopy:u,interval:l,offset:c}=t||{};if(h&&(h.cancelConsume(),h=null),n){const e=u?e=>{this.onmessage(e,0)}:c?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=p.dataTransportMgr.monitorlogfn;if(l&&i){var d;let e=new s.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});r=e.timeoutReport.bind(e)}h=new a.a(n,e,r),t.consumer=h,l?h.consume(l,u):this.reciver=()=>{h.consumeAll(u)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=c,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:r,interval:i,offset:n,length:s,useOneElement:o}=e,h=new a.b(n>0?t.buffer:t,void 0,void 0,!!o,n,s,n>0?t:null);this.sab.sender={sabqueue:h,interval:i,useCopy:r,offset:n}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:n,offset:s,length:o,useOneElement:h}=t,u=new a.b(s>0?e.buffer:e,void 0,void 0,!!h,s,o,s>0?e:null),{consumer:l}=(null===(r=this.sab)||void 0===r?void 0:r.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:u,interval:n,useCopy:i,offset:s}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(e){this.onmessage=c,this.onopen=c,this.onclose=c,this.connect_type=e.connect_type||p.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=h.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=p.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=p.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==u.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}n()(p,"UDP",0),n()(p,"TCP",1),n()(p,"RLB_UDP",2),n()(p,"dataTransportMgr",null);class g{constructor(e){this.sock=null,this.onmessage=c}isReady(){return!1}send(){c()}setStatus(e){0}}function m(e,t,r,i){var n;null===(n=u.a.monitorlogfn)||void 0===n||n.call(u.a,e,"".concat(t,",").concat(r,",").concat(i))}},function(e,t,r){var i=r(34);e.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"p",(function(){return i})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return h})),r.d(t,"k",(function(){return u})),r.d(t,"q",(function(){return l})),r.d(t,"r",(function(){return c})),r.d(t,"s",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"n",(function(){return p})),r.d(t,"e",(function(){return g})),r.d(t,"m",(function(){return m})),r.d(t,"o",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"h",(function(){return b})),r.d(t,"a",(function(){return w})),r.d(t,"f",(function(){return y}));const i=1,n=2,s=3,a=4,o=5,h=6,u=7,l=8,c=9,d=10,f=11,p=129,g=130,m=131,_=132,v=133,b=134,w=135,y=136},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return a})),r.d(t,"g",(function(){return o})),r.d(t,"f",(function(){return h})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c})),r.d(t,"c",(function(){return d}));var i=r(3),n=r(2);function s(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function a(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}function o(e,t,r){if(!e||t<0||r<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(r));let n=!1,s=0;const a=e.acquireGPUFeaturesHelper();return a&&(s=a.queryMaxTextureDimension2D(),s>0&&(n=t>s||r>s)),n&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s)),Object(i.o)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s))),n}function h(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let r=!1,n=0;const s=e.acquireGPUFeaturesHelper();return s&&(n=s.queryMaxBufferSize(),n>0&&(r=t>n)),r&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n)),Object(i.o)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(n))),r}function u(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===n.s||t===n.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function l(e,t){let r=0,i=0,n=0,s=0;const a=t.width/t.height;return e.width/e.height>a?(i=e.height,r=i*a,n=(e.width-r)/2,s=0):(r=e.width,i=r/a,n=0,s=(e.height-i)/2),r<=e.canvas.width&&(n=(e.canvas.width-r)/2),i<=e.canvas.height&&(s=(e.canvas.height-i)/2),{x:n,y:s,width:r,height:i}}function c(e,t,r,i){if(!e||!t||!r)return null;const s=t.width/t.height;let a=t.width,o=t.height;if(t.width>e.width||t.height>e.height){const r=e.width/t.width,i=e.height/t.height,n=Math.min(r,i);a*=n,o*=n}let h=0,u=0;e.width/e.height>s?(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a,h>e.width&&(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o)):(h=Math.floor(e.width/a)*a,u=Math.floor(h/s/o)*o,u>e.height&&(u=Math.floor(e.height/o)*o,h=Math.floor(u*s/a)*a));let l=0,c=0,d=0,f=0;i==n.p?(l=1-(l+(o-1)/e.height),c=t.left/e.width,f=1-t.top/e.height,d=c+a/e.width):i==n.s?(c=1-(l+(o-1)/e.height),d=1-t.top/e.height,l=t.left/e.width,f=c+a/e.width):i==n.q?(l=t.top/e.height,c=t.left/e.width,f=l+(o-1)/e.height,d=c+a/e.width):i==n.r&&(c=t.top/e.height,d=l+(o-1)/e.height,l=t.left/e.width,f=c+a/e.width);let p=[],g=[{x:d,y:f},{x:d,y:l},{x:c,y:l},{x:d,y:f},{x:c,y:f},{x:c,y:l}];for(let e=0;ee){const t=i.height*e;u=a/r.height,l=(Math.round((i.width-t)/2)+s)/r.width,d=u+(i.height-1)/r.height,c=l+t/r.width}else{const t=i.width/e;u=(Math.round((i.height-t)/2)+a)/r.height,l=s/r.width,d=u+(t-1)/r.height,c=l+i.width/r.width}o==n.p?(u=1-(u+(i.height-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+i.width/r.width):o==n.s?(l=1-(u+(i.height-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+i.width/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(i.height-1)/r.height,c=l+i.width/r.width):o==n.r&&(l=i.top/r.height,c=u+(i.height-1)/r.height,u=i.left/r.width,d=l+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,h=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,n=r.height/i.height,s=Math.min(e,n);t*=s,h*=s}let f=0,p=0;r.width/r.height>e?(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t,f>r.width&&(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h)):(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/h)*h,p>r.height&&(p=Math.floor(r.height/h)*h,f=Math.floor(p*e/t)*t)),o==n.p?(u=1-(u+(h-1)/r.height),l=i.left/r.width,d=1-i.top/r.height,c=l+t/r.width,i.height>i.width&&(l=a(l,2),c=s(c,2))):o==n.s?(l=1-(u+(h-1)/r.height),c=1-i.top/r.height,u=i.left/r.width,d=l+t/r.width):o==n.q?(u=i.top/r.height,l=i.left/r.width,d=u+(h-1)/r.height,c=l+t/r.width):o==n.r&&(l=i.top/r.height,c=u+(h-1)/r.height,u=i.left/r.width,d=l+t/r.width)}let f=[],p=[{x:c,y:d},{x:c,y:u},{x:l,y:u},{x:c,y:d},{x:l,y:d},{x:l,y:u}];for(let e=0;e{}}addEventListener(){}close(){}}class a{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(r=>{r(e,t,1)}))}removeTransport(e){var t;let r=e.id;r in this.transportMap&&(delete this.transportMap[r],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let r=this.transportMap[t],i=r.target_thread==a.SELF_THREAD;if(r.type==e&&i)return r}return null}}n()(a,"NO_THREAD",0),n()(a,"SELF_THREAD",1)},function(e,t,r){"use strict";function i(){this.a=[],this.b=0,this.residue=null}i.prototype.getLength=function(){return this.a.length-this.b},i.prototype.isEmpty=function(){return 0==this.a.length},i.prototype.enqueue=function(e){this.a.push(e)},i.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},i.prototype.peek=function(){return 0{const e={};for(const t in n)e[n[t]]="WCL_"+t})(),{[n.AUDIO_ENCODE]:"audio.encode",[n.AUDIO_DECODE]:"audio.decode",[n.VIDEO_ENCODE]:"video.encode",[n.VIDEO_DECODE]:"video.decode",[n.SHARING_ENCODE]:"share.encode",[n.SHARING_DECODE]:"share.decode"})},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l}));var i=r(7),n=r.n(i),s=r(5),a=r(10),o=r(6),h=r(22);function u(e,t,r){if(!e)return;let i=o.a.dataTransportMgr;i.type===l.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t}))}class l{constructor(e){let t=e||{};this.type=t.type||l.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new a.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,n=this.transportlists.find(e=>e.id===r);if(n||t==s.s)switch(t){case s.s:this.addRemoteTransport(e.data,null);break;case s.fb:n.setMsgPort(i||new a.a);break;case s.gb:n.setSabBuffer(e.data.sender,e.data.reciver);break;case s.o:n.remote=null,this.removeTransport(n)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i,transportType:n}=t.data,a=this.transportlists.find(e=>e.id===i);switch(r){case s.s:this.addRemoteTransport(t.data,e);break;case s.gb:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case s.o:a.remote=null,this.removeTransport(a)}}createRemoteTransport(e,t){let r={cmd:s.s,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransport(e,t){t.postMessage({cmd:s.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var r,i,n,a;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:s.gb,transportId:e.id,sender:null===(n=e.sabInfo)||void 0===n?void 0:n.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:n}=e;let s=this.createMsgSocketTransport(n);s.id=r,s.remote=t,s.portInfo=i,i?s.setMsgPort(s.portInfo):this.bindMessageChannel(s),this.addTransport(s)}addTransport(e){let t=this.getChannelByTransportType(e.type);if(!t)return;let r=t.target_thread||a.b.SELF_THREAD;e.target_thread=r,this.bindTransPortForChannel(e,t)}removeTransport(e){let t=this.transportlists.indexOf(e);-1!=t&&(this.transportlists.splice(t,1),e.remote&&this.closeRemoteTransport(e,e.remote),e.target_thread!=a.b.NO_THREAD&&this.unbindTransPortForChannel(e))}createMsgSocketTransport(e){let t=null;return t=new o.a({mgr:this,sock:new o.d,type:e,local:!0}),t}bindMessageChannel(e){if(this.type!=l.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.fb,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,r){this.type==l.THREAD_MAIN?(e.sabInfo||(e.sabInfo={}),r&&(r.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:r},e.target_thread!=a.b.NO_THREAD&&(e.target_thread!=a.b.SELF_THREAD?this.setRemoteTransportSABBUffer(e,e.target_thread):e.setSabBuffer(t,r))):console.error("<<<<< setSabBufferInfo in sub thread")}addDataChannel(e){if(e instanceof h.a){try{this.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channellists.push(e)}else console.error("channel must be a DataChannelWrapper")}removeDataChannel(e){if(!(e instanceof h.a))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1)}removeTransportByRemote(e){let t=[];for(let r=0;r{if(!e.transportlists.includes(t.type))return;let r=e.target_thread||a.b.SELF_THREAD;r==t.target_thread||(this.type==l.THREAD_MAIN&&t.target_thread!=a.b.NO_THREAD&&t.target_thread!=r&&(this.unbindTransPortForChannel(t),this.bindMessageChannel(t)),t.target_thread=r,this.bindTransPortForChannel(t,e))})}bindTransPortForChannel(e,t){e.channel=t;let r=e.target_thread;if(r!=a.b.SELF_THREAD)this.createRemoteTransport(e,r),this.setRemoteTransportSABBUffer(e,r);else{var i,n,s,o;if(e.portInfo&&e.setMsgPort(e.portInfo),null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(n=e.sabInfo)&&void 0!==n&&n.reciver)e.setSabBuffer(null===(s=e.sabInfo)||void 0===s?void 0:s.sender,null===(o=e.sabInfo)||void 0===o?void 0:o.reciver);this.mediadatachannel.addTransport(e,t)}}unbindTransPortForChannel(e){e.target_thread!=a.b.SELF_THREAD?this.type==l.THREAD_MAIN&&this.closeRemoteTransport(e,e.target_thread):this.mediadatachannel.removeTransport(e)}getChannelByTransportType(e){for(let t=0;tthis.max_timeout&&(this.max_timeout=e),e{r._report(),r._timeoutid=0},this.interval_report_time)}}class a extends class{constructor(e){this._tag=e.tag||"MONITOR",this._base_time=0,this._interval_id=-1,this._timeout=Math.max(1e3,e.timeout||0),this._callback=e.callback}_report(){let e=Date.now(),t=this.getSamples(e);t||(t=[]);let r="".concat(this._base_time,":").concat(e-this._base_time,":").concat(t.join("|"));this._callback&&this._callback(this._tag,r)}getSamples(e){}onStart(){}onStop(){}start(){-1==this._interval_id&&(this._base_time=Date.now(),this._interval_id=setInterval(this._report.bind(this),this._timeout),this.onStart())}stop(){-1!=this._interval_id&&(clearInterval(this._interval_id),this._interval_id=-1,this._report(),this.onStop())}}{constructor(e){super(e),this._count=0}onStart(){this._count=0}sample(){this._count++}getSamples(e){return[this._count]}}},function(e,t,r){"use strict";r.d(t,"c",(function(){return i})),r.d(t,"f",(function(){return n})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"k",(function(){return o})),r.d(t,"g",(function(){return h})),r.d(t,"h",(function(){return u})),r.d(t,"b",(function(){return l})),r.d(t,"j",(function(){return c})),r.d(t,"i",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"d",(function(){return p}));const i=3,n=6,s=34,a=38,o=-51,h="SHARING_PARAM_INFO_FROM_SOCKET",u=121,l="AUDIO_QOS_DATA",c="VIDEO_QOS_DATA",d="VIDEOSHARE_QOS_DATA",f={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},p="EXPOSE_VB_FRAME"},function(e,t,r){"use strict";const i=e=>0==(e&e-1);let n=new class{constructor(){this._highFrequencyLogs={},this.fixVersion=""}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(r+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(r+=" Message: ".concat(t.message)),t.error&&(r+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.fileName&&(r+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(r+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+=" Stack: ".concat(t.stack)),t.name&&(r+=" Name: ".concat(t.name)),t.constraint&&(r+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(r+=" Code: ".concat(t.code)),t.reason&&(r+=" Reason: ".concat(t.reason)),r+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(r+=" Message: ".concat(t.message)),t.name&&(r+=" Name: ".concat(t.name))):r+=t?t.toString():"",r}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;const r=i(this._highFrequencyLogs[e]);this._instance&&r&&this._instance.error(e,[this.fixVersion])}severityerror(e,t){this._instance&&this._instance.error(JSON.stringify(e),t)}directReport(e,t){var r,i;this._instance&&(t||(t=["MEDIASDK_INFO"]),null===(r=(i=this._instance).directReport)||void 0===r||r.call(i,{msg:e},t))}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}log(e){this._instance&&this._instance.log(e)}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};t.a=n},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o}));var i=r(11),n=r(16);class s{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=n,this._BYTES_PER_ELEMENT=t,this.capacity=(s-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,n,1),this.read_ptr=new Uint32Array(this.buf,n+4,1),this.storageUint8sByteOffset=n+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,s-8),this.byteLength=s,this.label=r,this.usingOneElementBuffer=i,a&&(this.wasmMemory=a),i&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new i.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let s=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==s)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++s}if(s>0&&!this.repushhander&&(this.repushhander=setTimeout(()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)},30)),s>=1e3&&(n.a.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),r&&r("vqslclear")),s>0&&r){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,r&&r("vqsl"+s))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let r=0;e.forEach(e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+r),r+=e.byteLength}),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=r;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}_push(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;let r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let r,i,n,s=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,s[0]):new Uint8Array(s[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r.byteLength);r.set(e,0)}else r=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+s[0]),i=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,n=t*this._BYTES_PER_ELEMENT+8+4+s[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:i,end:n}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof s))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=r,this.tick_lasted_time=0,this.timeoutMS=i,this.maxCount=n}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval(()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()},e),console.log("consume interval ".concat(this.interval)))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}class o{constructor(){this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}setOBJ(e){this.obj=e,this.yuvUint8s=e.data}setBuffer(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}buffer2Obj(){let e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),r={};this.keysList.forEach((t,i)=>{r[t]=e[i]}),r[this.timeStampKey]=Number(t.getBigUint64(0,!0));let i,n=Number(t.getBigUint64(8,!0)),s=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,n);return i=(this.bCopyData,s),r.data=i,r}obj2buffer(){let e=new Uint8Array(56),t=this.keysList,r=new Uint32Array(e.buffer,0,9),i=new DataView(e.buffer,40,16);return t.forEach((e,t)=>{r[t]=this.obj[e]}),i.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),i.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[e,this.yuvUint8s]}}},function(e,t,r){"use strict";var i,n,s,a,o,h;function u(){}function l(e){let t=new Uint8Array(e.data);t.length<4||n&&a(t,n,s)}function c(e){}function d(e){}function f(e,t,r){n&&a(e,n,t,r)}function p(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(o=i,h=s,e){r.meetingNumber=r.meetingNumber+"",r.meetingId=r.meetingId+"",n=a?e(r.userId,r.meetingNumber,r.meetingId,0,0,!1,0,!0):e(r.userId,r.meetingNumber,r.meetingId,0,0,0,!1,!1,!0);let i=o(r.encryptKey);return t(n,i,r.encryptKey.length,r.encryptType),h(i),n}return 0}function g(e,t,r,n){i=e(t,u,l,c,d),a=r,s=n}function m(e,t){if(n&&t.body){if(t.body.add){let r=0,i=t.body.add;for(;r7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;if(null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost())this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGLRestoreTimeout")},1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext()}catch(e){Object(n.i)("webgl restoreContext exception",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webglcanvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl","experimental-webgl","moz-webgl","webkit-3d"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(i));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,i),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a),this.shaderProgram=a},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(4),n=r(3),s=r(9),a=r(19);let o=new Map,h=[];function u(e){e.preventDefault()}function l(e,t,r,n,s,a,o){let h=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=r||0,this.texturestride=this.textureindex?3:o?4:6,this.initmask=o||!1,this.reuse=!1,this.isEnableCanvasAlphaChannel=h,l.prototype.ROTATION_CLOCK0=0,l.prototype.ROTATION_CLOCK90=1,l.prototype.ROTATION_CLOCK180=2,l.prototype.ROTATION_CLOCK270=3,this.webGLResources=a,a||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.reinit(a);var u=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(u),this.dummpyWaterMark=new Uint8Array(u),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.W,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}function c(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;var s=e.contextGL;let a=s.canvas.width,o=s.canvas.height;n&&(a=n.width,o=n.height);var h,u,l,c,d=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,f=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,p=d/f*o,g=f/d*a;p>a?(h=0,l=1,c=1-(u=(o-g)/2/o)):(u=0,c=1,l=1-(h=(a-p)/2/a)),h=2*h-1,l=2*l-1,u=1-2*u,c=1-2*c;var m=new Float32Array([l,u,h,u,l,c,h,c,l,u,h,u,l,c,h,c]);s.bindBuffer(s.ARRAY_BUFFER,e.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,m,s.DYNAMIC_DRAW)}function d(e,t,r,i,n){var s=e.contextGL,a=i.top/r,o=i.left/t,h=a+(i.height-1)/r,u=o+i.width/t,l=[o,a,u,a,u,h,o,h];n==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),n==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],d=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=d;var f=new Float32Array([...l,1,0,0,0,1,1,0,1]);s.bindBuffer(s.ARRAY_BUFFER,e.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,f,s.DYNAMIC_DRAW)}l.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.waterMarkTextureRef=this.webGLResources.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=this.webGLResources.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer;let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},l.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(Object(n.r)(this.contextGL,"WEBGL_lose_context"))},l.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout(()=>{Object(n.p)("WebGL2RestoreTimeout")},1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){Object(n.i)("webgl restoreContext exception2",e)}},l.prototype.webgGLContextLostCallback=function(e){Object(n.t)("webglcontextlost2 event: canvas listener size=".concat(h.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(h.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},l.prototype.removeEventListener=function(e,t){if(e&&t){0,e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=h.indexOf(this.canvasID);h.splice(r,1),o.delete(e)}},l.prototype.webGLContextRestoredCallback=function(e){Object(n.t)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.reinit(),this.contextOptions&&this.contextOptions.webglcontextrestoredCallback&&this.contextOptions.webglcontextrestoredCallback(e,this.contextOptions.params)},l.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=Object(n.r)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=o.get(e);t&&this.removeEventListener(e,t),o.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===h.indexOf(this.canvasID)&&(h.push(this.canvasID),h.length>4&&Object(n.t)("webgl2canvas listener size=".concat(h.length,", ids:").concat(h.join())))},l.prototype.isWebGL2=function(){return this.contextGL},l.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},l.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,s=null,o=["webgl2"],h=0;!s&&h 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && \n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask* mask.a+ c*(1.0-mask.a);\n }\n }\n\n if (waterMarkFlag!=1) {\n c.a = 1.0;\n }\n\n outputColor = c;\n }\n "),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(r));var i=e.createProgram();e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||e.isContextLost()||Object(n.t)("webgl2 Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},l.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=n},l.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n,this.oyTextureRef=n;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var a=this.initTexture();if(this.vTextureRef=a,this.ovTextureRef=a,e){this.BindTextures(i.V);var o=this.initTexture(),h=t.getUniformLocation(r,"cursorSampler");t.uniform1i(h,this.textureindex*this.texturestride+3),this.cursorTextureRef=o;var u=this.initTexture(),l=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(l,4),this.waterMarkTextureRef=u;var c=this.initTexture();this.repeatedWaterMarkTextureRef=c;var d=this.initTexture(),f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var p=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=p}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var g=this.initTexture(),m=t.getUniformLocation(r,"maskSampler");t.uniform1i(m,this.textureindex*this.texturestride+6),this.maskTextureRef=g}var _=t.getUniformLocation(r,"colorRange");this.colorRangeRef=_,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},l.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.V){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"ySampler");t.uniform1i(i,0);let n=t.getUniformLocation(r,"uSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"vSampler");t.uniform1i(s,0)}else if(e==i.Z){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}let n=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(n,0);let s=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,6)):t.uniform1i(s,0);let a=t.getUniformLocation(r,"cursorSampler");t.uniform1i(a,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,0)},l.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},l.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},l.prototype.cleanup=function(){let e=this.canvasElement,t=o.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=u,e.addEventListener("webglcontextlost",u,{capture:!1})),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),this.textureindex||this.initmask||(r.activeTexture(r.TEXTURE3+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(this.getRepeatedWatermarkTextureValue(r)),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5+this.textureindex*this.texturestride),r.bindTexture(r.TEXTURE_2D,null)),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteTexture(this.repeatedWaterMarkTextureRef),r.deleteTexture(this.previewVideoTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},l.prototype.drawNextOutputPicture=function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var s=this.contextGL;s?this.drawNextOutputPictureFrame(e,t,r,i,n):this.drawNextOuptutPictureRGBA(e,t,r,i)},l.prototype.updateVertexInfoForMultiView=function(e,t,r,i,n){var s,a,o,h,u=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:n}))s=0,a=0,o=1,h=1;else{var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?i:r,c=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r:i,d=l/c*t;d>e?(s=0,o=1,h=1-(a=(t-c/l*e)/2/t)):(a=0,h=1,o=1-(s=(e-d)/2/e))}s=2*s-1,o=2*o-1,a=1-2*a,h=1-2*h;var f=new Float32Array([o,a,s,a,o,h,s,h,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,f,u.DYNAMIC_DRAW)},l.prototype.updateTextureInfoForMultiView=function(e,t,r,i,n,a,o){var h,u,l,c,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const n=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/a:a/o,s=r.left||0,d=r.top||0;if(r.width/r.height>n){const i=r.height*n;h=d/t,u=(Math.round((r.width-i)/2)+s)/e,l=h+(r.height-1)/t,c=u+i/e}else{const i=r.width/n;l=(h=(Math.round((r.height-i)/2)+d)/t)+(i-1)/t,c=(u=s/e)+r.width/e}}else h=Object(s.e)(r.top/t,2),u=Object(s.e)(r.left/e,2),l=Object(s.h)((r.top+r.height-1)/t,2),c=Object(s.h)((r.width-1+r.left)/e,2);var f=[u,h,c,h,c,l,u,l];i==this.ROTATION_CLOCK90&&(f.unshift(f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK180&&(f.unshift(f[4],f[5],f[6],f[7]),f=f.slice(0,8)),i==this.ROTATION_CLOCK270&&(f.push(f[0],f[1]),f=f.slice(2,10));var p=f[0],g=f[1];if(f[0]=f[2],f[1]=f[3],f[2]=p,f[3]=g,n)if(i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270){let e=f[1];f[1]=f[3],f[3]=e,e=f[5],f[5]=f[7],f[7]=e}else f[0]=1-f[0],f[2]=1-f[2],f[4]=1-f[4],f[6]=1-f[6];var m=new Float32Array([...f,1,0,0,0,1,1,0,1]);d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,m,d.DYNAMIC_DRAW)},l.prototype.drawNextOutputPictureFrame=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var u=this.contextGL,l=(this.texturePosBuffer,this.yTextureRef),f=this.uTextureRef,p=this.vTextureRef;u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var g=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,m=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,_=u.canvas.width!=this.canvasWidth||u.canvas.height!=this.canvasHeight,v=e!=this.textureWidth||t!=this.textureHeight,b=s!=this.picRotation;(g||_||b)&&c(this,r.width,r.height,s,o),(g||m||v||b)&&d(this,e,t,r,s);let w=a?0:1;w!=this.colorRange&&(u.uniform1i(this.colorRangeRef,w),this.colorRange=w),o?u.viewport(o.x,o.y,o.width,o.height):u.viewport(0,0,u.canvas.width,u.canvas.height),u.uniform1i(this.onlyRGBARef,0),u.uniform1i(this.yuvmodeRef,i.V),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.canvasWidth=u.canvas.width,this.canvasHeight=u.canvas.height,u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),u.clear(u.COLOR_BUFFER_BIT);var y=n,x=e*t;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),h){var T=y.subarray(0,x);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e,t,0,u.LUMINANCE,u.UNSIGNED_BYTE,T)}var R=e/2*t/2;if(u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,f),h){var E=y.subarray(x,x+R);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,E)}var S=R;if(u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,p),h){var A=y.subarray(x+R,x+R+S);u.texImage2D(u.TEXTURE_2D,0,u.LUMINANCE,e/2,t/2,0,u.LUMINANCE,u.UNSIGNED_BYTE,A)}u.activeTexture(u.TEXTURE3),u.bindTexture(u.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?u.uniform1i(this.cursorFlagRef,1):h&&u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyCursor),u.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),u.activeTexture(u.TEXTURE5),u.bindTexture(u.TEXTURE_2D,this.previewVideoTextureRef),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,this.dummpyWaterMark);var k=u.getUniformLocation(this.shaderProgram,"maskSampler");u.uniform1i(k,5),this.render(),this.hasWholeFrame=1},l.prototype.updateTextureBlock=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL,a=n;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||i<0||r+e>this.textureWidth||i+t>this.textureHeight)&&n&&n.length==e*t*3/2){var o=this.yTextureRef,h=this.uTextureRef,u=this.vTextureRef,l=e*t,c=a.subarray(0,l);s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,r,i,e,t,s.LUMINANCE,s.UNSIGNED_BYTE,c);var d=e/2*t/2,f=a.subarray(l,l+d);s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,h),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,f);var p=d,g=a.subarray(l+d,l+d+p);s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,u),s.texSubImage2D(s.TEXTURE_2D,0,r/2,i/2,e/2,t/2,s.LUMINANCE,s.UNSIGNED_BYTE,g)}}},l.prototype.updateCursor=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,this.cursorTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},l.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1)}},l.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;if(this.isSetWatermark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.isWatermarkRepeated()?(e.activeTexture(this.getRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);let t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.isWatermarkRepeated()?this.getRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}}},l.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},l.prototype.drawCursor=function(e,t,r,i,n){if(this.isAvaiable()){var s=this.contextGL;if(!(!this.hasWholeFrame||e&&(i<0||n<0))){s.viewport(0,0,s.canvas.width,s.canvas.height);var a=this.yTextureRef,o=this.uTextureRef,h=this.vTextureRef,u=this.cursorTextureRef;if(s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,o),s.activeTexture(s.TEXTURE2),s.bindTexture(s.TEXTURE_2D,h),s.activeTexture(s.TEXTURE3),s.bindTexture(s.TEXTURE_2D,u),e&&this.hasCursor){let e=t/this.croppingParams.width,a=r/this.croppingParams.height,o=i/this.croppingParams.width,h=n/this.croppingParams.height;this.cx=e,this.cy=a,this.cw=o,this.ch=h,s.uniform4f(this.cursorInfoRef,e,a,o,h)}else s.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}}},l.prototype.clear=function(){this.hasWholeFrame=0,this.hasCursor=0},l.prototype.clearCanvas=function(e){if(this.isAvaiable()){var t=this.contextGL;e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT)}},l.prototype.drawNextOuptutPictureRGBA=function(e,t,r,i){if(this.isAvaiable()){var n=i,s=this.canvasElement.getContext("2d"),a=s.getImageData(0,0,e,t);a.data.set(n),s.putImageData(a,0,0)}},l.prototype.isRGBAMode=function(e){return-1!==[i.ab,i.N].indexOf(e)},l.prototype.updateRemoteVideoTextures=function(e,t,r,n,s){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var h=this.contextGL,u=this.yTextureRef,l=this.uTextureRef,c=this.vTextureRef;h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);const d=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!d||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let f=a?0:1;if(this.colorRange=f,this.rotation=s,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=h.canvas.width,this.canvasHeight=h.canvas.height,!o)return;if(h.bindTexture(h.TEXTURE_2D,u),d)return void h.texImage2D(h.TEXTURE_2D,0,h.RGBA,e,t,0,h.RGBA,h.UNSIGNED_BYTE,n);var p=n,g=e*t,m=p.subarray(0,g);h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e,t,0,h.LUMINANCE,h.UNSIGNED_BYTE,m);let _=0,v=0;this.videoMode==i.V?(_=e/2*t/2,v=_):this.videoMode==i.Z&&(_=e*t/2,v=0);var b=p.subarray(g,g+_);if(h.bindTexture(h.TEXTURE_2D,l),v){h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,b);var w=p.subarray(g+_,g+_+v);h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE,e/2,t/2,0,h.LUMINANCE,h.UNSIGNED_BYTE,w)}else h.texImage2D(h.TEXTURE_2D,0,h.LUMINANCE_ALPHA,e/2,t/2,0,h.LUMINANCE_ALPHA,h.UNSIGNED_BYTE,b);return!0},l.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,n){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(n)||(this.rotation=n),Object.assign(this.croppingParams,i),!s)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const o=0,h=a.RGBA,u=a.RGBA,l=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,o,h,u,l,r)},l.prototype.updateSelfMaskImage=function(e,t,r){if(!(e<=0||t<=0)&&r&&r.length==e*t*4&&this.isAvaiable()){var i=this.contextGL;i.bindTexture(i.TEXTURE_2D,this.maskTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,r)}},l.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},l.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var r=this.contextGL;let i=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(i,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()},l.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var n,s=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),n=this.destination,s.flush(),s.readPixels(e,t,r,i,s.RGBA,s.UNSIGNED_BYTE,n),n}},l.prototype.updateSelfVideoTextures=function(e,t,r,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&r&&r.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=s,Object.assign(this.croppingParams,i),n&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r))}},l.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var n=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.ab),this.render()}},l.prototype.isSetWatermark=function(){return this.hasWaterMark},l.prototype.recoverTextures=function(){},l.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},l.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var n=this.contextGL;n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.N?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r)}},l.prototype.setVideoMode=function(e){this.videoMode=e},l.prototype.getVideoMode=function(e){return this.videoMode},l.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},l.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},l.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},l.prototype.getWatermarkPosition=function(){return this.watermarkPosition},l.prototype.setMultiView=function(e){return this.isMultiView=e},l.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},l.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},l.prototype.setFillMode=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},l.prototype.getFillMode=function(){return this.fillMode},l.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},l.prototype.getTextureIndex=function(){return this.textureindex},l.prototype.getIndex=function(){return this.textureindex},l.prototype.getWatermarkWidth=function(){return this.watermarkWidth},l.prototype.getWatermarkHeight=function(){return this.watermarkHeight},l.prototype.getTextureWidth=function(){return this.textureWidth},l.prototype.getTextureHeight=function(){return this.textureHeight},l.prototype.getCroppingParams=function(){return this.croppingParams},l.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},l.prototype.getAttachedCanvas=function(){return this.canvasElement},l.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},l.prototype.isUseFillMode=function(e){let{width:t,height:r,rotation:i}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;const n=i===this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some(e=>Math.abs(n-e)<.01)},t.a=l},function(e,t,r){"use strict";var i=r(7),n=r.n(i),s=r(14);function a(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new s.b({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}a.prototype._qos_report_timeout=function(e,t,r,i){if(this._customer_callback){let n="".concat(e,",").concat(t,",").concat(r,",").concat(i);this._customer_callback(this._tag+"TimeOut",n)}},a.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),r="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=t.replaceAll(",","|"),r=r.replaceAll(",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",r)):console.error("tag:".concat(this._tag,",").concat(t))},a.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},a.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},a.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},a.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(s.c.IsQosReport(e))return void this._cureen_qos_report++;if(s.c.IsVideoPkg(e)){let t=s.c.GetQOSTime(e),r=performance.now();if(this._lasted_qos_ts){let e=r-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,r)}this._lasted_qos_ts=t,this._lasted_sys_ts=r,this._lasted_data=e}}};var o=r(8),h=r(12),u=r(5);r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return c}));class l{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class c{constructor(e,t,r,i){this.id=e,this.type=t,this.datachannel=r,this._recv_statistic=null,this.onmessageFn=null,this.disconnectedFn=null,this.connectedFn=null,this._status=c.UNINIT,this.target_thread=i,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{}}isReady(){return this._status===c.CONNECTED}send(e){this.datachannel.send(e),this._send_statistic.sample(!1)}open(){if(this.target_thread)try{return this.target_thread.postMessage({command:o.h,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists},[this.datachannel]),this.transfered=!0,this.datachannel=null,this._listener=this._mesagelistener.bind(this),void this.target_thread.addEventListener("message",this._listener)}catch(e){this.target_thread=null}this._addEventListener()}close(){let e=this.disconnectedFn;this.transfered&&this.target_thread&&this._listener&&(this.target_thread.removeEventListener("message",this._listener),this._listener=null,this.target_thread.postMessage({command:o.a,id:this.id,type:this.type})),this._status!=c.DISCONNECT&&this._clear(),this._status=c.DISCONNECT,null==e||e()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}_addEventListener(){this.datachannel.onmessage=this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==c.UNINIT&&this._onopen()}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;var r;(this._status=c.CONNECTED,this.transfered||(this._send_statistic||(this._send_statistic=new a({tag:this.type==h.a.VIDEO?"VDCS":"ADCS",report_call:this.report_monitor_func})),this._recv_statistic||(this._recv_statistic=new a({tag:this.type==h.a.VIDEO?"VDCR":"ADCR",report_call:this.report_monitor_func})),this._send_statistic.start(),this._recv_statistic.start()),t!=c.CONNECTED)&&(null===(r=this.connectedFn)||void 0===r||r.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=c.DISCONNECT;let r=this.disconnectedFn;this._clear(),t!=c.DISCONNECT&&(null==r||r())}_clear(){var e,t;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let r=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null==r||r.close()}_mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case u.A:this._onclose();break;case u.C:this._onopen();break;case u.B:this._onerror(t.ev);break;case u.H:this.report_monitor_func(t.tag,t.data)}}}n()(c,"UNINIT",0),n()(c,"CONNECTED",1),n()(c,"DISCONNECT",2)},function(e,t,r){"use strict";r.d(t,"d",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"a",(function(){return c}));var i=r(12),n=r(6),s=r(13);function a(e){return new n.a({sock:new n.d,type:e,local:!1})}function o(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(n.a.dataTransportMgr)return;let r=new s.a({type:t?s.a.THREAD_SUB:s.a.THREAD_MAIN,remote:t?self:null});n.a.dataTransportMgr=r,r.monitorlogfn=e,t&&self.addEventListener("message",r._onrecvmainthreadlistener.bind(r))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function h(e){return n.a.dataTransportMgr.getTransportByType(e)}function u(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.addDataChannel(e)}function l(e){if(!n.a.dataTransportMgr)throw new Error("not InitDataTransportModule");n.a.dataTransportMgr.removeDataChannel(e)}class c{constructor(){this._listener=this._listenerfn.bind(this),this.isSupportVideoShare=!1}addTransportListiner(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}remoteTransportListener(){var e;e=this._listener,n.a.dataTransportMgr.addTransportListChangeListener(e)}_listenerfn(e,t,r){this.connectSession(t)}setVideoShareModel(e){this.isSupportVideoShare=e}connectSession(e){const{type:t}=e;!e.transfered&&e.isReady()&&(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}disconnectSession(e){const{type:t}=e;e.transfered||(t==i.a.VIDEO&&this.connectVideoSession(e),t==i.a.AUDIO&&this.connectAudioSession(e))}connectVideoSession(e){let t=new n.c,r=h(n.e.VIDEO_ENCODE)||t,i=h(n.e.VIDEO_DECODE)||t,s=h(n.e.SHARR_DECODE)||t,a=(null==e?void 0:e.isReady())?n.b.OPEN:n.b.CLOSED;r.setStatus(a),i.setStatus(a),this.isSupportVideoShare||s.setStatus(a),e.onmessage(e=>{var t=new Uint8Array(e.data);if((104==t[0]||132==t[0])&&0==t[1]||20==t[0]||130==t[0])r.send(t);else{if(!this.isSupportVideoShare&&(133==t[0]||132==t[0]))return void s.send(t);i.send(t)}});const o=t=>{e.send(t)};r.onmessage=o,i.onmessage=o,s.onmessage=o}connectAudioSession(e){let t=new n.c,r=h(n.e.AUDIO_ENCODE)||t,i=h(n.e.AUDIO_DECODE)||t,s=e.isReady()?n.b.OPEN:n.b.CLOSED;r.setStatus(s),i.setStatus(s),e.onmessage(e=>{var t=new Uint8Array(e.data);108==t[0]&&0==t[1]?r.send(t):i.send(t)});const a=t=>{e.send(t)};r.onmessage=a,i.onmessage=a}notifyTransportStatus(e,t){}}},function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var i=r(7),n=r.n(i),s=r(5);function a(e){o.instance||(o.instance=new o),o.instance.start(e)}class o{constructor(){this._interval=-1,this.monitorworkers={},this._lasted_timestamp=-1,this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let r={id:e,worker:t},i=this._recvheartbeat.bind(this,r);r.listener=i,r.lastedtimestamp=Date.now(),r.worker.addEventListener("message",r.listener),this.monitorworkers[e]=r}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let r=t.data;r.cmd===s.Db&&(e.lastedtimestamp=r.timestamp)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval(()=>{e.postMessage({cmd:s.Db,timestamp:Date.now()})},o.INTREVAL_TIME_MS));const r=Math.max(o.INTREVAL_TIME_MS-1e3,500);this._lasted_timestamp=Date.now(),this._interval=setInterval(()=>{let e=o.instance,t=Object.keys(e.monitorworkers),i=Date.now(),n=this._lasted_timestamp;in+o.HEART_TIMEOUT_MS?e.timeoutcallbackfn("MAIN",i-n):t.forEach(t=>{var r;let n=e.monitorworkers[t],s=n.lastedtimestamp+(null!==(r=document)&&void 0!==r&&r.hidden?o.MAX_HEART_TIMEOUT_MS:o.HEART_TIMEOUT_MS);i>s&&(e.timeoutcallbackfn(n.id,i-n.lastedtimestamp),n.lastedtimestamp=i)}))},o.INTREVAL_TIME_MS)}close(){try{Object.keys(this.monitorworkers).forEach(e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}),this._interval&&clearInterval(this._interval),this._interval=-1}catch(e){}}}n()(o,"INTREVAL_TIME_MS",3e3),n()(o,"HEART_TIMEOUT_MS",15e3),n()(o,"MAX_HEART_TIMEOUT_MS",3e4),n()(o,"instance",null)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));class i{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.checkInterval=0,this.hasRTPPackets=!1,this.callBackEvent=e,this.subforme=!1,this.lastsubformetime=0,this.videoType=t,this.paused=!1}startCheck(){this.checkInterval&&(clearInterval(this.checkInterval),this.hasRTPPackets=!1,this.subforme=!1,this.paused=!1),this.checkInterval=setInterval(()=>{if((this.videoType&&this.subforme||!this.videoType)&&!this.hasRTPPackets&&!this.paused){performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets})}this.hasRTPPackets=!1},3e4)}stopCheck(){this.checkInterval&&clearInterval(this.checkInterval),this.checkSharingInterval=0,this.subforme=!1,this.paused=!1}setRtpPackets(){this.hasRTPPackets=!0}setSubForMe(e){let t=e>=0;this.subforme!==t&&(this.subforme=t,this.lastsubformetime=performance.now())}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c}));var i=r(11);function n(){this.ssrcQueueMap=new Map,n.prototype.AddQueue=function(e){var t=new i.a;return this.ssrcQueueMap.set(e,t),t},n.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},n.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},n.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},n.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},n.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var s=function(){this.frames=0,this.ntp=new i.a};s.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;s30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,i=0,n=0,s=0;sbtoa(String.fromCharCode(...new Uint8Array(e)));class a{constructor(e){n()(this,"process",async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(s(t)),this.writeLog(this.EOL)}requestAnimationFrame(this.process)}),this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder,this.EOL=this.textEncoder.encode("\n"),this.processList=[],this.writeLog=e,this.key=null,this.initEncryptPromise=this.initEncrypt()}addLogData(e,t){if(!e||!t)return;const r=this.textEncoder.encode(e);this.processList.push(r),this.processList.push(t),this.processList.push(this.EOL)}async initEncrypt(){this.key=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),this.iv=crypto.getRandomValues(new Uint8Array(12));const e=new Uint8Array(await crypto.subtle.exportKey("raw",this.key)),t=new Uint8Array([0]);this.writeLog("v"),this.writeLog(this.EOL),this.writeLog(s(t.buffer)),this.writeLog(this.EOL);const r=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(s(this.mergeBuffer(r).buffer)),this.writeLog(this.EOL),this.startProcess()}mergeBuffer(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}async encryptData(e){await this.initEncryptPromise;return await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}var o=r(3);r.d(t,"a",(function(){return l}));class h{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new a(this.writeLog.bind(this)))}readyForLog(){}sendLog(e){}writeLog(e){this.readyForLog()?(this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}clearCache(){this.stopCache=!0,this.cache=[]}getTime(){const e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}getLogData(e,t,r){if(t){var i=new Uint8Array(r?t+1:t),n=Object(o.d)().subarray(e+0,e+t);return i.set(n,0,t),r&&(i[t]=10),i}return e.data}writeWasmLog(e,t){const r=this.getTime(),i=this.getLogData(e,t);this.logProcesser?this.logProcesser.addLogData(r,i):(this.writeLog(r),this.writeLog(i),this.writeLog("\n"))}}class u extends h{constructor(){super(!0),this.port=null,this.ready=!1}init(){let e=0;const t=r=>{"local_log_port"===r.data.command?this.port||(this.port=r.data.data):"local_log_ready"===r.data.command&&(this.ready=!0,self.removeEventListener("message",t),clearTimeout(e),this.stopCache||(this.cache.forEach(e=>this.sendLog(e)),this.clearCache()))};self.addEventListener("message",t),e=setTimeout(()=>{self.removeEventListener("message",t),this.clearCache()},6e4)}readyForLog(){return!!this.port&&this.ready}sendLog(e){this.port.postMessage(e)}}function l(){let e=!1;try{e=!1}catch(e){}return e?new u:null}},function(e,t,r){"use strict";t.a=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:r,opacity:i,name:n}=e;t.fillStyle="rgba(0, 0, 0, ".concat(i,")"),t.fillText(n,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(i,")"),t.fillText(n,r.x+1,r.y+1)}_getTransformInfo(e){let t,{canvas:r,position:i}=e;if(1===i)t={x:r.width/2,y:0,rateRadio:0,maxWidth:r.width};else if(2===i)t={x:r.width/2,y:r.height,rateRadio:0,maxWidth:r.width};else if(4===i)t={x:0,y:r.height/2,rateRadio:Math.PI/2,maxWidth:r.height};else if(8===i)t={x:r.width,y:r.height/2,rateRadio:-Math.PI/2,maxWidth:r.height};else{const e=-21*Math.PI/180;t={x:r.width/2,y:r.height/2,rateRadio:e,maxWidth:Math.min(r.width/Math.cos(e),-r.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:r,name:i,textWidth:n}=e;const s=this._getPaddingWidth({ctx:r,position:t,name:i});return 1===t?{x:-n.width/2,y:s}:2===t||4===t||8===t?{x:-n.width/2,y:-s}:{x:-n.width/2,y:r.measureText(i[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:r,name:i}=e;return[1,2,4,8].includes(r)?32:t.measureText(i[0]).width}_setBaseLine(e){let{ctx:t,position:r}=e;t.textBaseline=1===r?"top":2===r||4===r||8===r?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;let h=this._getTransformInfo({canvas:t,position:a});var u=t.getContext("2d");let l;if(u.clearRect(0,0,t.width,t.height),u.translate(h.x,h.y),u.rotate(h.rateRadio),this._setBaseLine({ctx:u,position:a}),u.lineWidth=1,u.imageSmoothingEnabled=!0,1==r.length){const e=h.maxWidth/r.length;u.font=e+"px 'Segoe UI'",l=u.measureText(r)}else{let e=16;for(u.font=e+"px 'Segoe UI'",l=u.measureText(r);l.widthh.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r}))if(e>16)e-=1,u.font=e+"px 'Segoe UI'",l=u.measureText(r);else{const e=r;for(;r.length>5&&l.width>h.maxWidth-2*this._getPaddingWidth({ctx:u,position:a,name:r+"..."});)r=r.slice(0,r.length-1),l=u.measureText(r+"...");e!==r&&(r+="...")}}const c=this._calcTextPos({position:a,ctx:u,name:r,textWidth:l});var d;if(this._drawWatermarkWithShadow({ctx:u,name:r,opacity:s,textPos:c}),o)d=t.toDataURL();else{var f=u.getImageData(0,0,u.canvas.width,u.canvas.height);d=new Uint8Array(f.data.buffer)}return u.rotate(-h.rateRadio),u.translate(-h.x,-h.y),d}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:n,opacity:s=.15,position:a,convertToDataUrl:o}=e;if(!r||!i||!n)return;s=s||.15;i*=1,n*=1,t.width=i,t.height=n;const h=t.getContext("2d");h.clearRect(0,0,t.width,t.height),h.translate(i/2,n/2),h.rotate(-21*Math.PI/180),h.imageSmoothingEnabled=!0;h.font="".concat(32,"px 'Segoe UI'"),h.textBaseline="top";const u=h.measureText(r),l=.37*u.width;let c,d=0,f=-n;do{let e=d%2==0?l-i:-i;do{h.fillStyle="rgba(0, 0, 0, ".concat(s,")"),h.fillText(r,e,f),h.fillStyle="rgba(255, 255, 255, ".concat(s,")"),h.fillText(r,e+1,f+1),e+=u.width+l}while(e=this._last_update_time+this._init_report_interval&&(this._report(),this.capture_fps_history=[],this.close_frames_history=[],this._last_update_time=e,this._init_report_intervalthis._report_interval&&(this._init_report_interval=this._report_interval)))},n.prototype.closeSample=function(){this.close_frames++,this.close_total_frames++},n.prototype.setCloseTotalFrames=function(e){this.close_total_frames=e},n.prototype.captureTicket=function(){this._enabled&&this.capture_ticket_count++},n.prototype.captureSample=function(){if(!this._enabled)return;this.capture_fps++,this.capture_total_fps++;let e=performance.now();if(this.last_capture_time){let t=e-this.last_capture_time;t>this.threshold&&this.capture_timeout_report.timeoutReport(t,e)}this.last_capture_time=e},n.prototype.ref=function(){this.ref_counts++},n.prototype.unref=function(){this.unref_counts++},n.prototype.start=function(){this._enabled||(0!=this._last_update_time&&(clearTimeout(this._last_update_time),this._last_update_time=0,this._report()),this.capture_fps=0,this.capture_fps_history=[],this.capture_total_fps=0,this.close_frames=0,this.close_frames_history=[],this.close_total_frames=0,this.capture_ticket_count=0,this._last_update_time=performance.now(),this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enabled=!0)},n.prototype.stop=function(){this._enabled&&(this._enabled=!1,this._interval_id&&clearInterval(this._interval_id),this._interval_id=0,(this.close_frames>0||this.capture_fps>0||this.capture_fps_history.length>0||this.close_frames_history>0)&&(this._timeout_id=setTimeout(this._timeout_report.bind(this),3e3)))}},function(e,t){e.exports=function(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(0),n=r.n(i),s=r(1),a=r.n(s),o=r(3),h=r(2);function u(e,t){c(e,t),t.add(e)}function l(e,t,r){c(e,t),t.set(e,r)}function c(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function d(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var f=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,_=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,T=new WeakMap,R=new WeakMap,E=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap,C=new WeakMap,P=new WeakMap,U=new WeakMap,L=new WeakMap,I=new WeakMap,O=new WeakMap,D=new WeakMap,B=new WeakMap,G=new WeakSet,W=new WeakSet,N=new WeakSet,F=new WeakSet,V=new WeakSet,z=new WeakSet,H=new WeakSet,j=new WeakSet,Y=new WeakSet,X=new WeakSet,q=new WeakSet,K=new WeakSet,Q=new WeakSet,Z=new WeakSet,J=new WeakSet,$=new WeakSet,ee=new WeakSet,te=new WeakSet,re=new WeakSet,ie=new WeakSet;function ne(e){e&&e.forEach(e=>{e.markRenderingStatePending()});const t=d(this,J,ve).call(this,e);if(n()(this,w)&&n()(this,b)&&n()(this,T))if(n()(this,f)&&0!=n()(this,f).width&&0!=n()(this,f).height&&n()(this,b)&&n()(this,b).getCurrentTexture()&&0!=n()(this,b).getCurrentTexture().width&&0!=n()(this,b).getCurrentTexture().height)try{if(!n()(this,S)){const e=n()(this,B).byteLength,t=e;a()(this,S,n()(this,T).acquireBuffer(t,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,e,!0,!1)),new Float32Array(n()(this,S).getMappedRange()).set(n()(this,B)),n()(this,S).unmap()}const e=d(this,H,le).call(this);for(const[r,i]of t)d(this,ee,we).call(this,r,i,e);const r=d(this,Z,_e).call(this,n()(this,b).getCurrentTexture().createView()),i=e.beginRenderPass(r);i.setVertexBuffer(0,n()(this,S));for(const[e,r]of t)if(r&&0!=r.length)for(const e of r){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;const t=e.getTextureType();let r=e.getUVCoords();if(t!==h.x.CLEAR_COLOR&&!r)continue;const s=n()(this,f).width,a=n()(this,f).height;let o=e.getViewport();if(!o||Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.w)||Number.isNaN(o.h)||o.x<0||o.y<0)continue;if(o.x+o.w>s){let e=o.x+o.w-s;if(!(e>0&&e<=h.i))continue;o.w-=e,o.w<=0&&(o.w=1)}if(o.y+o.h>a){let e=o.y+o.h-a;if(!(e>0&&e<=h.i))continue;o.h-=e,o.h<=0&&(o.h=1)}const u=d(this,$,be).call(this,e);if(!u)continue;if(u.pipelineType!==h.l.CLEAR_COLOR){let t=e.getUVCoordsBuffer();if(!t){const i=r.byteLength;t=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,r.byteLength,!1,!1),e.setUVCoordsBuffer(t)}n()(this,w).queue.writeBuffer(t,0,r,0,r.length),i.setVertexBuffer(1,t)}i.setViewport(o.x,o.y,o.w,o.h,o.minDepth,o.maxDepth);const l=u.pipeline;i.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});i.setBindGroup(0,c),i.draw(6,1,0,0)}i.end(),d(this,j,ce).call(this)}catch(e){Object(o.u)("[WebGUPRenderer] renderNoMsaa() error:".concat(e.message))}finally{n()(this,v).recycleInUsedGPUBuffers(t)}else n()(this,v).recycleInUsedGPUBuffers(t);else n()(this,v).recycleInUsedGPUBuffers(t)}function se(e){if(!n()(this,w)||!n()(this,b))return;const t=n()(this,w).createBuffer({label:"VertexBuffer",size:n()(this,B).byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,mappedAtCreation:!0});new Float32Array(t.getMappedRange()).set(n()(this,B)),t.unmap();const r=d(this,H,le).call(this),i=d(this,J,ve).call(this,e);for(const[e,t]of i)d(this,ee,we).call(this,e,t,r);const s=d(this,ie,Te).call(this,n()(this,f)),a=d(this,Q,me).call(this,0,s.createView(),n()(this,b).getCurrentTexture().createView()),o=r.beginRenderPass(a);o.setVertexBuffer(0,t);for(const[e,t]of i)if(t&&0!=t.length)for(const e of t){e.unlock();if(e.getTextureLayerType()==h.v.UNKNOWN)continue;let t=e.getUVCoords();if(!t)continue;let r=e.getUVCoordsBuffer();if(!r){const i=t.byteLength;r=n()(this,T).acquireBuffer(i,GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,t.byteLength,!1,!0),e.setUVCoordsBuffer(r)}n()(this,w).queue.writeBuffer(r,0,t,0,t.length),o.setVertexBuffer(1,r);const i=n()(this,f).width,s=n()(this,f).height;let a=e.getViewport();if(!a||Number.isNaN(a.x)||Number.isNaN(a.y)||Number.isNaN(a.w)||Number.isNaN(a.h)||a.x<0||a.y<0||a.x+a.w>i||a.y+a.h>s)continue;const u=d(this,$,be).call(this,e,!0);if(!u)continue;o.setViewport(a.x,a.y,a.w,a.h,a.minDepth,a.maxDepth);const l=u.pipeline;o.setPipeline(l);const c=n()(this,w).createBindGroup({layout:l.getBindGroupLayout(0),entries:u.entries});o.setBindGroup(0,c),o.draw(6,1,0,0)}o.end(),d(this,j,ce).call(this),e.forEach(e=>{e.markRenderingStatePending()})}function ae(e){if(!Array.isArray(e))return;let t=[];for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalYuvTextureGroup] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalYuvTextureGroup] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();let s=null,a=null,o=null;const h=e.getWidth(),u=e.getHeight(),l=null!=r&&(h!=r.yPlaneTex.width||u!=r.yPlaneTex.height);let c=!0;r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(s=r.yPlaneTex,a=r.uPlaneTex,o=r.vPlaneTex,c=!1));let d=!1,f="r8unorm";if(i&&i.bufferConfig&&"nv12"==i.bufferConfig.colorFormat&&(f="rg8unorm",d=!0),c){const t=e.getIndex(),r=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,i=n()(this,E).assembleTextureConfig(h,u,r,"r8unorm",1),l=n()(this,E).assembleTextureConfig(h/2,u/2,r,f,1);s=n()(this,E).acquireTexture(i),s&&(s.label="RD(".concat(t,")-YPlaneTexture")),d?(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UVPlaneTexture"))):(a=n()(this,E).acquireTexture(l),a&&(a.label="RD(".concat(t,")-UPlaneTexture")),o=n()(this,E).acquireTexture(l),o&&(o.label="RD(".concat(t,")-VPlaneTexture")))}t.copyBufferToTexture({buffer:i.buffer,offset:i.yPlaneBuffer.offset,bytesPerRow:i.yPlaneBuffer.bytesPerRow,rowsPerImage:i.yPlaneBuffer.rowsPerImage},{texture:s},[h,u,1]),t.copyBufferToTexture({buffer:i.buffer,offset:i.uPlaneBuffer.offset,bytesPerRow:i.uPlaneBuffer.bytesPerRow,rowsPerImage:i.uPlaneBuffer.rowsPerImage},{texture:a},[h/2,u/2,1]),i.vPlaneBuffer.offset>0&&!d&&t.copyBufferToTexture({buffer:i.buffer,offset:i.vPlaneBuffer.offset,bytesPerRow:i.vPlaneBuffer.bytesPerRow,rowsPerImage:i.vPlaneBuffer.rowsPerImage},{texture:o},[h/2,u/2,1]);let p={};return p.yPlaneTex=s,p.uPlaneTex=a,p.vPlaneTex=o,p}function he(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i=e.getTextureBufferGroup();if(!n()(this,w))return console.warn("[evalRgbaTexture] GPUDevice is not ready!"),i&&i.buffer&&i.buffer.unmap(),null;if(!t)return console.warn("[evalRgbaTexture] command encoder is invalid!"),i&&i.buffer&&i.buffer.unmap(),null;if(!i)return r||null;"unmapped"!=i.buffer.mapState&&i.buffer.unmap();const s=e.getIndex(),a=e.getWidth(),o=e.getHeight(),h=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let u=null;const l=null!=r&&(a!=r.width||o!=r.height);let c=!0;if(r&&(l?(n()(this,v).destroyTextureGroup(e),c=!0):(u=r,c=!1)),c){const e=n()(this,E).assembleTextureConfig(a,o,h,"rgba8unorm",1);u=n()(this,E).acquireTexture(e),u&&(u.label="RD(".concat(s,")-rgbaTexture"))}return t.copyBufferToTexture({buffer:i.buffer,offset:0,bytesPerRow:i.bytesPerRow,rowsPerImage:i.rowsPerImage},{texture:u},[a,o,1]),u}function ue(e,t){return Math.ceil(e/t)*t}function le(){return n()(this,w)?(n()(this,x)||a()(this,x,n()(this,w).createCommandEncoder()),n()(this,x)):(Object(o.u)("GPUDevice is not ready! No available command encoder."),null)}function ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;n()(this,x)&&e?n()(this,w).queue.submit([n()(this,x).finish(),e.finish()]):n()(this,x)?n()(this,w).queue.submit([n()(this,x).finish()]):e&&n()(this,w).queue.submit([e.finish()]),a()(this,x,null)}function de(e,t){if(!n()(this,w))return null;if(!n()(this,I)){let r=n()(this,w).createBindGroupLayout({label:"CursorTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"CursorTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"CursorTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.e}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,I,n()(this,w).createRenderPipeline(s))}return n()(this,I)}function fe(e,t){if(!n()(this,w))return null;if(!n()(this,L)){let r=n()(this,w).createBindGroupLayout({label:"WatermarkTexBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}}]});if(!r)return null;const i=n()(this,w).createPipelineLayout({label:"WatermarkTexPipelineLayout(".concat(e,")"),bindGroupLayouts:[r]}),s={label:"WatermarkTexRenderPipeline(".concat(e,")"),layout:i,vertex:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.B}),entryPoint:"f_main",targets:[{format:n()(this,y),blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}};t&&(s.multisample={count:4}),a()(this,L,n()(this,w).createRenderPipeline(s))}return n()(this,L)}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,C)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,C,n()(this,w).createRenderPipeline(i))}return n()(this,C)}function ge(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,w)||!e)return null;if(!n()(this,P)){const r=n()(this,w).createBindGroupLayout({label:"YuvBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"YuvRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"YuvPipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,P,n()(this,w).createRenderPipeline(i))}return n()(this,P)}function me(e,t,r){return{label:"renderPass - ".concat(e),colorAttachments:[{view:t,resolveTarget:r,loadOp:"clear",storeOp:"discard"}]}}function _e(e){return e&&(e.label="canvas-texture-view"),{label:"RenderPassNoMsaa",colorAttachments:[{view:e,loadOp:"clear",storeOp:"store"}]}}function ve(e){let t=new Map;for(let r=0;r1&&void 0!==arguments[1]&&arguments[1],r=null,i=null,s=null,a=null;const o=e.getZIndex(),u=e.getTextureType(),l=e.getColorFormat();if(o==h.w.VS_BASE){if(u==h.x.EXTERNAL_TEX){a=h.l.VIDEO_FRAME,r=this.acquireVideoFrameRenderPipeline(h.y,t),i=this.acquireVideoFrameSampler();const o=e.getPendingVideoFrame();if(!o||0==o.codedWidth||0==o.codedHeight||!o.format)return e.setPendingVideoFrame(null),null;const u=e.getUniformBuffer();if(!u)return null;s=[{binding:0,resource:i},{binding:1,resource:n()(this,w).importExternalTexture({source:o})},{binding:2,resource:{buffer:u}}]}else if(u==h.x.CLEAR_COLOR){a=h.l.CLEAR_COLOR,r=this.acquireClearColorRenderPipeline(h.c);const t=e.getClearColorUniformBuffer();if(!t)return null;s=[{binding:0,resource:{buffer:t}}]}else if(u==h.x.GPU_TEX_YUV){"i420"==l?(a=h.l.YUV_I420,r=d(this,q,pe).call(this,h.z,t)):"nv12"==l&&(a=h.l.YUV_NV12,r=d(this,K,ge).call(this,h.A,t)),i=this.acquireYuvTexturesSamplers();const n=e.getUniformBuffer();if(!n)return null;const o=e.getTextureGroup();o&&("i420"==l?s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:o.vPlaneTex.createView()},{binding:5,resource:{buffer:n}},{binding:6,resource:{buffer:n}}]:"nv12"==l&&(s=[{binding:0,resource:i[0]},{binding:1,resource:i[1]},{binding:2,resource:o.yPlaneTex.createView()},{binding:3,resource:o.uPlaneTex.createView()},{binding:4,resource:{buffer:n}},{binding:5,resource:{buffer:n}}]))}}else if(o==h.w.WATERMARK||o==h.w.MASK){a=h.l.RGBA_WATERMARK,r=d(this,X,fe).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getTextureGroup();n&&(s=[{binding:0,resource:i},{binding:1,resource:n.createView()}])}else if(o==h.w.CURSOR){a=h.l.RGBA_CURSOR,r=d(this,Y,de).call(this,o,t),i=this.acquireBlendTextureSampler();const n=e.getUniformBuffer();if(!n)return null;const u=e.getTextureGroup();u&&(s=[{binding:0,resource:i},{binding:1,resource:u.createView()},{binding:2,resource:{buffer:n}}])}if(a===h.l.CLEAR_COLOR){if(!r||!s)return null}else if(!r||!i||!s||null==a)return null;const c={pipelineType:a,pipeline:r,entries:s};return c}function we(e,t,r){for(const i of t){const t=i.getTextureType();t!=h.x.EXTERNAL_TEX&&t!=h.x.CLEAR_COLOR&&(e==h.w.VS_BASE?d(this,te,ye).call(this,i,r):e!=h.w.CURSOR&&e!=h.w.WATERMARK&&e!=h.w.MASK||d(this,re,xe).call(this,i,r))}}function ye(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,F,oe).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,F,oe).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function xe(e,t){let r=e.getTextureGroup();r?e.isNew()&&(r=d(this,V,he).call(this,e,t,r),e.setIsNew(!1)):(r=d(this,V,he).call(this,e,t,null),e.setIsNew(!1)),r&&e.setTextureGroup(r)}function Te(e){if(!e||!n()(this,w))return n()(this,D)?n()(this,D):null;if(n()(this,D)){if(n()(this,D).width!=e.width||n()(this,D).height!=e.height){const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}}else{const t=n()(this,E).assembleTextureConfig(e.width,e.height,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,n()(this,y),4);a()(this,D,n()(this,E).acquireTexture(t))}return n()(this,D)}var Re=class{constructor(e,t){if(u(this,ie),u(this,re),u(this,te),u(this,ee),u(this,$),u(this,J),u(this,Z),u(this,Q),u(this,K),u(this,q),u(this,X),u(this,Y),u(this,j),u(this,H),u(this,z),u(this,V),u(this,F),u(this,N),u(this,W),u(this,G),l(this,f,{writable:!0,value:null}),l(this,p,{writable:!0,value:0}),l(this,g,{writable:!0,value:0}),l(this,m,{writable:!0,value:!1}),l(this,_,{writable:!0,value:!1}),l(this,v,{writable:!0,value:null}),l(this,b,{writable:!0,value:null}),l(this,w,{writable:!0,value:null}),l(this,y,{writable:!0,value:null}),l(this,x,{writable:!0,value:null}),l(this,T,{writable:!0,value:null}),l(this,R,{writable:!0,value:null}),l(this,E,{writable:!0,value:null}),l(this,S,{writable:!0,value:null}),l(this,A,{writable:!0,value:null}),l(this,k,{writable:!0,value:null}),l(this,M,{writable:!0,value:null}),l(this,C,{writable:!0,value:null}),l(this,P,{writable:!0,value:null}),l(this,U,{writable:!0,value:null}),l(this,L,{writable:!0,value:null}),l(this,I,{writable:!0,value:null}),l(this,O,{writable:!0,value:null}),l(this,D,{writable:!0,value:null}),l(this,B,{writable:!0,value:new Float32Array(12)}),!t)throw new Error("[WebGPURenderer] resMgr is an invalid param! ".concat(t));a()(this,f,e),a()(this,v,t),this.initialize(e)}switchMsaa(e){a()(this,_,e)}isMsaaEnabled(){return n()(this,_)}setCanvas(e){e&&a()(this,f,e)}setDevice(e){e&&a()(this,w,e)}setRenderArgs(e,t){a()(this,p,e||0),a()(this,g,n()(this,p)?3:t?4:6),a()(this,m,t||!1)}setTextureIndex(e){a()(this,p,e||0)}initialize(e){n()(this,w)||(a()(this,w,n()(this,v).acquireGPUDevice()),n()(this,w))?(n()(this,y)||a()(this,y,n()(this,v).acquireCanvasFormat()),n()(this,T)||a()(this,T,n()(this,v).acquireGPUBufferMgr()),n()(this,R)||a()(this,R,n()(this,v).acquireGPUBufferPool()),n()(this,E)||a()(this,E,n()(this,v).acquireGPUTextureMgr()),this.configureGPUContext(e),d(this,N,ae).call(this,h.b)):Object(o.u)("[WebGPURenderer] initialize() device is not ready!")}isGPUDeviceReady(){return null!=n()(this,w)}render(e){n()(this,_)?d(this,W,se).call(this,e):d(this,G,ne).call(this,e)}updateVertexCoords(e){d(this,N,ae).call(this,e)}createRGBATexture(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;if(t<0)return Object(o.u)("[createRGBATexture] ".concat(t," is an invalid index!")),null;if(!n()(this,T))return console.warn("[createRGBATexture] buffer manager is not ready!"),null;if(!n()(this,w))return console.warn("[createRGBATexture] GPUDevice is not ready!"),null;if(null==s||void 0===s)return console.warn("[createRGBATexture] rgbaData is invalid!"),null;if(!e)return console.warn("[createRGBATexture] command encoder is invalid!"),null;const h=d(this,z,ue).call(this,Uint32Array.BYTES_PER_ELEMENT*r,256),u=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,l=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;let c=null;const f=null!=a&&(r!=a.width||i!=a.height);let p=!0;if(a&&(f?(n()(this,E).recycleTexture(a),p=!0):(c=a,p=!1)),p){const e=n()(this,E).assembleTextureConfig(r,i,l,"rgba8unorm",1);c=n()(this,E).acquireTexture(e),c&&(c.label="RD(".concat(t,")-rgbaTexture"))}const g=n()(this,T).acquireBuffer("".concat(t,"_Y"),u,h*i,!0,!1),m=new Uint8Array(g.getMappedRange()),_=r*Uint32Array.BYTES_PER_ELEMENT;for(let e=0;e=g.length)return console.error("[WebGPURenderer] write yPlane is out of range! yPlaneOffset=".concat(0,", yPlane.height=").concat(r.height,", yPlaneBytesPerRow=").concat(a,", mappedArray.len=").concat(g.length)),null;for(let e=0;eg.length)return null;for(let e=0;e0){if(l+s.height*h>g.length)return null;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:null;if(!n()(this,w))return Object(o.u)("writeUniformBuffer() GPUDevice is not ready yet."),null;if(!t||0==t.length)return null;let i=r;return i||(i=n()(this,w).createBuffer({label:e,size:t.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),n()(this,w).queue.writeBuffer(i,0,t,0,t.length),i}acquireBlendTextureSampler(){return n()(this,w)?(n()(this,O)||a()(this,O,n()(this,w).createSampler({})),n()(this,O)):null}configureGPUContext(e){n()(this,b)||(a()(this,b,e.getContext("webgpu")),n()(this,b)?n()(this,b).configure({device:n()(this,w),format:n()(this,y),alphaMode:"premultiplied"}):Object(o.u)("configureGPUContext() webgpuContext is invalid! canvas=".concat(e)))}unconfigureGPUContext(){n()(this,b)&&(n()(this,b).unconfigure(),a()(this,b,null))}acquireVideoFrameRenderPipeline(e,t){if(!n()(this,w)||!e)return null;if(!n()(this,A)){const r=n()(this,w).createBindGroupLayout({label:"VideoFrameBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]}),i={label:"VideoFrameRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"VideoFramePipelineLayout",bindGroupLayouts:[r]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"vertex_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]},{arrayStride:8,attributes:[{shaderLocation:1,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"fragment_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};t&&(i.multisample={count:4}),a()(this,A,n()(this,w).createRenderPipeline(i))}return n()(this,A)}acquireClearColorRenderPipeline(e){if(!n()(this,w)||!e)return null;if(!n()(this,k)){const t=n()(this,w).createBindGroupLayout({label:"ClearColorBindGroupLayout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),r={label:"ClearColorRenderPipeline",layout:n()(this,w).createPipelineLayout({label:"ClearColorPipelineLayout",bindGroupLayouts:[t]}),vertex:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:e}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}};a()(this,k,n()(this,w).createRenderPipeline(r))}return n()(this,k)}acquireVideoFrameSampler(){return n()(this,w)?(n()(this,M)||a()(this,M,n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"})),n()(this,M)):null}acquireYuvTexturesSamplers(){if(!n()(this,w))return null;if(!n()(this,U)){a()(this,U,[]);const e=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"}),t=n()(this,w).createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear"});n()(this,U).push(e),n()(this,U).push(t)}return n()(this,U)}clearAttachedCanvas(){if(!n()(this,w)||!n()(this,b)||!n()(this,S))return;if(!n()(this,f)||0==n()(this,f).width||0==n()(this,f).height)return;const e=n()(this,w).createCommandEncoder(),t=e.beginRenderPass({colorAttachments:[{view:n()(this,b).getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),r=n()(this,w).createRenderPipeline({layout:"auto",vertex:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"v_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,format:"float32x2",offset:0}]}]},fragment:{module:n()(this,w).createShaderModule({code:h.d}),entryPoint:"f_main",targets:[{format:n()(this,y)}]},primitive:{topology:"triangle-list"}});t.setVertexBuffer(0,n()(this,S)),t.setPipeline(r),t.draw(6),t.end(),n()(this,w).queue.submit([e.finish()])}clear(){console.log("WebGPURender.clear")}cleanup(){this.unconfigureGPUContext(),a()(this,f,null),a()(this,y,null),a()(this,x,null),a()(this,S,null),a()(this,A,null),a()(this,k,null),a()(this,M,null),a()(this,C,null),a()(this,P,null),a()(this,U,null),a()(this,L,null),a()(this,I,null),a()(this,O,null),a()(this,D,null),n()(this,T)&&a()(this,T,null),n()(this,w)&&a()(this,w,null)}};function Ee(e,t){Ae(e,t),t.add(e)}function Se(e,t,r){Ae(e,t),t.set(e,r)}function Ae(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ke(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Me=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,Le=new WeakSet,Ie=new WeakSet,Oe=new WeakSet,De=new WeakSet,Be=new WeakSet;function Ge(){return!0}function We(){if(n()(this,Pe)){let e={};return e.architecture=n()(this,Pe).architecture,e.vendor=n()(this,Pe).vendor,e}return null}async function Ne(){if(!navigator.gpu)return a()(this,Me,h.C.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();if(!e)return a()(this,Me,h.C.CANNOT_REQ_ADAPTER),!1;return await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(a()(this,Pe,await e.requestAdapterInfo()),n()(this,Pe)&&console.log("adapter info: ".concat(n()(this,Pe).architecture,", ").concat(n()(this,Pe).vendor))):"info"in e&&a()(this,Pe,e.info),a()(this,Me,h.C.AVAILABLE),!0):(a()(this,Me,h.C.CANNOT_REQ_DEVICE),!1)}function Fe(e){if(!e)return!1;const t=e.vendor;return-1!==h.g.indexOf(t)}function Ve(e,t,r){return class{static produce(e,t,r){let i=null;return e===h.j.WEBGPU&&(i=new Re(t,r)),i}}.produce(e,t,r)}var ze=class{constructor(){Ee(this,Be),Ee(this,De),Ee(this,Oe),Ee(this,Ie),Ee(this,Le),Se(this,Me,{writable:!0,value:h.C.AVAILABLE}),Se(this,Ce,{writable:!0,value:h.j.WEBGL}),Se(this,Pe,{writable:!0,value:null}),Se(this,Ue,{writable:!0,value:new Map})}async evaluate(e){a()(this,Ce,h.j.WEBGL);if(!ke(this,Le,Ge).call(this))return n()(this,Ce);if(!e.allowedOnTargetPlatforms)return n()(this,Ce);if(!e.allowedOnTargetBrowsers)return n()(this,Ce);if(!await ke(this,Oe,Ne).call(this))return n()(this,Ce);const t=ke(this,Ie,We).call(this);if(!ke(this,De,Fe).call(this,t))return n()(this,Ce);let r=new OffscreenCanvas(1,1);return r.getContext("webgpu")?(r=null,a()(this,Ce,h.j.WEBGPU),n()(this,Ce)):(r=null,n()(this,Ce))}acquireRenderer(e,t){let r=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&n()(this,Ue).clear(),n()(this,Ue).has(e)&&(r=n()(this,Ue).get(e),r&&(e&&(r.setCanvas(e),r.initialize(e)),t&&r.setDevice(t.acquireGPUDevice()))),null==r&&(r=ke(this,Be,Ve).call(this,n()(this,Ce),e,t),r&&n()(this,Ue).set(e,r)),r}rendererReinitialize(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(n()(this,Ue))for(const[e,t]of n()(this,Ue))t&&t.unconfigureGPUContext()}getRendererType(){return n()(this,Ce)}setRendererType(e){a()(this,Ce,e)}isWebGPURendererType(){return n()(this,Ce)===h.j.WEBGPU}isWebGLRendererType(){return n()(this,Ce)===h.j.WEBGL}isWebGL2RendererType(){return n()(this,Ce)===h.j.WEBGL_2}cleanup(){for(const[e,t]of n()(this,Ue))t&&t.cleanup();n()(this,Ue).clear()}};function He(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function je(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Ye=new WeakSet,Xe=new WeakSet;function qe(e){e.forEach(e=>{e.consumePendingGPUEvents()})}function Ke(e){if(!e||0==e.length)return!0;return-1==e.findIndex(e=>{if(!e)return!1;return!!e.getTextureLayerByZIndex(h.w.VS_BASE)&&e.isRenderingStateReady()})}var Qe=class{constructor(){He(this,Xe),He(this,Ye)}render(e,t){return e?e.isGPUDeviceReady()?t&&0!=t.length?(je(this,Ye,qe).call(this,t),void(je(this,Xe,Ke).call(this,t)||e.render(t))):(console.warn("[RendererController] render displays are not available!"),void Object(o.o)("WGPU RendererController_render() displays are not available!")):(console.log("[RendererController] GPU device is not ready!"),void Object(o.o)("WGPU RendererController_render() GPU device is not ready!")):(console.warn("[RendererController] renderer is not attached!"),void Object(o.o)("WGPU RendererController_render() renderer is not attached!"))}},Ze=r(20),Je=r(21),$e=r(7),et=r.n($e),tt=r(4);function rt(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var it=new WeakMap,nt=new WeakMap,st=new WeakMap,at=new WeakMap,ot=new WeakMap,ht=new WeakMap,ut=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,_t=new WeakMap,vt=new WeakMap,bt=new WeakMap,wt=new WeakMap;var yt=class{constructor(e,t){rt(this,it,{writable:!0,value:0}),rt(this,nt,{writable:!0,value:-1}),rt(this,st,{writable:!0,value:0}),rt(this,at,{writable:!0,value:0}),rt(this,ot,{writable:!0,value:-1}),rt(this,ht,{writable:!0,value:null}),rt(this,ut,{writable:!0,value:-1}),rt(this,lt,{writable:!0,value:null}),rt(this,ct,{writable:!0,value:null}),rt(this,dt,{writable:!0,value:null}),rt(this,ft,{writable:!0,value:!1}),rt(this,pt,{writable:!0,value:null}),rt(this,gt,{writable:!0,value:null}),rt(this,mt,{writable:!0,value:null}),rt(this,_t,{writable:!0,value:null}),rt(this,vt,{writable:!0,value:null}),rt(this,bt,{writable:!0,value:!1}),rt(this,wt,{writable:!0,value:""}),a()(this,it,e),a()(this,nt,t)}getIndex(){return n()(this,it)}lock(){a()(this,ft,!0)}unlock(){a()(this,ft,!1)}isLocked(){return n()(this,ft)}getZIndex(){return n()(this,nt)}setWidth(e){a()(this,st,e)}setHeight(e){a()(this,at,e)}getWidth(){return n()(this,st)}getHeight(){return n()(this,at)}getRawData(){return n()(this,ht)}setRawData(e){a()(this,ht,e)}setIsNew(e){a()(this,bt,e)}isNew(){return n()(this,bt)}setColorFormat(e){a()(this,wt,e)}getColorFormat(){return n()(this,wt)}setPendingVideoFrame(e){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),a()(this,pt,e)}clearPendingVideoFrame(){n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null))}setTextureLayerType(e){a()(this,ot,e)}getTextureLayerType(){return n()(this,ot)}setTextureType(e){a()(this,ut,e)}getTextureType(){return n()(this,ut)}getPendingVideoFrame(){return n()(this,pt)}getUVCoords(){return n()(this,ct)}setUVCoords(e){a()(this,ct,e)}getUVCoordsBuffer(){return n()(this,_t)}setUVCoordsBuffer(e){a()(this,_t,e)}evalViewport(e,t,r,i,s){n()(this,dt)||a()(this,dt,{}),n()(this,dt).x=Math.floor(e),n()(this,dt).w=Math.floor(r),n()(this,dt).h=Math.floor(i),n()(this,ot)==h.v.BASE_LAYER?n()(this,dt).y=Math.floor(s-(t+i)):n()(this,dt).y=Math.floor(t),n()(this,dt).x<0&&(n()(this,dt).x=0),n()(this,dt).y<0&&(n()(this,dt).y=0),n()(this,dt).minDepth=0,n()(this,dt).maxDepth=1}setViewport(e){a()(this,dt,e)}getViewport(){return n()(this,dt)}getTextureGroup(){return n()(this,lt)}setTextureGroup(e){a()(this,lt,e)}setUniformBuffer(e){a()(this,gt,e)}getUniformBuffer(){return n()(this,gt)}setClearColorUniformBuffer(e){a()(this,mt,e)}getClearColorUniformBuffer(){return n()(this,mt)}setTextureBufferGroup(e){a()(this,vt,e)}getTextureBufferGroup(){return n()(this,vt)}destroyTextureBufferGroup(){n()(this,vt)&&a()(this,vt,null)}recycle(e){this.destroyTextureBufferGroup(),e&&e.destroyTextureGroup(this),n()(this,pt)&&(n()(this,pt).close(),a()(this,pt,null)),n()(this,gt)&&(n()(this,gt).destroy(),a()(this,gt,null)),n()(this,mt)&&(n()(this,mt).destroy(),a()(this,mt,null)),a()(this,it,-1),a()(this,nt,-1),a()(this,ot,h.v.UNKNOWN),a()(this,ht,null),a()(this,ut,h.x.UNKNOWN),a()(this,ct,null),a()(this,dt,null),a()(this,ft,!1),a()(this,bt,!1),a()(this,wt,"")}},xt=r(9);function Tt(e,t){Et(e,t),t.add(e)}function Rt(e,t,r){Et(e,t),t.set(e,r)}function Et(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function St(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var At=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ct=new WeakMap,Pt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ot=new WeakMap,Dt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,er=new WeakMap,tr=new WeakMap,rr=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,ar=new WeakMap,or=new WeakMap,hr=new WeakMap,ur=new WeakMap,lr=new WeakMap,cr=new WeakMap,dr=new WeakMap,fr=new WeakSet,pr=new WeakSet,gr=new WeakSet,mr=new WeakSet,_r=new WeakSet,vr=new WeakSet,br=new WeakSet,wr=new WeakSet,yr=new WeakSet,xr=new WeakSet,Tr=new WeakSet,Rr=new WeakSet,Er=new WeakSet,Sr=new WeakSet,Ar=new WeakSet,kr=new WeakSet,Mr=new WeakSet,Cr=new WeakSet,Pr=new WeakSet,Ur=new WeakSet,Lr=new WeakSet,Ir=new WeakSet,Or=new WeakSet,Dr=new WeakSet,Br=new WeakSet,Gr=new WeakSet,Wr=new WeakSet,Nr=new WeakSet,Fr=new WeakSet,Vr=new WeakSet;function zr(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(St(this,Rr,ei).call(this),!n()(this,Nt)||!n()(this,Ft)||!n()(this,Nt).isGPUDeviceReady())return void(r instanceof VideoFrame&&r.close());const s=h.w.VS_BASE,a=St(this,Sr,ri).call(this,s),u=a.isLocked();if(u){const n=a.getPendingVideoFrame();!n||n.codedWidth==e&&n.codedHeight==t?r instanceof VideoFrame&&r.close():r instanceof VideoFrame?a.setPendingVideoFrame(r):(i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!"))}else{if(r instanceof VideoFrame){a.getPendingVideoFrame()!=r&&a.setPendingVideoFrame(r)}else i&&St(this,gr,jr).call(this,a,e,t,r),Object(o.u)("updateVideoFrameBaseTextureLayer() an unexpected case!"),console.error("updateVideoFrameBaseTextureLayer() an unexpected case!");a.setTextureLayerType(h.v.BASE_LAYER),a.setTextureType(h.x.EXTERNAL_TEX),a.lock()}this.markRenderingStateReady()}function Hr(e,t,r,i,s,a){St(this,Rr,ei).call(this);const o=h.w.VS_BASE,u=St(this,Sr,ri).call(this,o);if(u.setTextureLayerType(h.v.BASE_LAYER),u.setTextureType(h.x.GPU_TEX_YUV),u.clearPendingVideoFrame(),u.isLocked()){const e=u.getWidth(),i=u.getHeight();e==t&&i==r||(u.setWidth(t),u.setHeight(r),u.setIsNew(!0))}else u.setWidth(t),u.setHeight(r),u.setIsNew(!0),u.lock();const l=St(this,Dr,di).call(this,i,t,r,a),c=n()(this,Nt).writeToYuvTexturesBufferGroup(l,s);u.setTextureBufferGroup(c)}function jr(e,t,r,i){const s=St(this,Gr,pi).call(this,t,r);s.label="RgbaTexBuffer(".concat(e.getIndex(),")-").concat(s.size);let a=e.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,e,a,s),!a||!a.buffer)return console.warn("[updateRgbaBaseTexLayer()] texLayer(".concat(e.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,vr,qr).call(this,n()(this,At),t,r,i,a),this.markRenderingStateReady()}function Yr(e,t,r,i,s){const a=h.w.CURSOR,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Xr(e,t,r,i,s){const a=h.w.WATERMARK,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BLEND_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function qr(e,t,r,i,s){const a=h.w.VS_BASE,o=St(this,Sr,ri).call(this,a);if(o.setTextureLayerType(h.v.BASE_LAYER),o.setTextureType(h.x.GPU_TEX_RGBA),o.isLocked()){const e=o.getWidth(),i=o.getHeight();e==t&&i==r||(o.setWidth(t),o.setHeight(r),o.setIsNew(!0))}else o.setWidth(t),o.setHeight(r),o.setIsNew(!0),o.lock();const u=n()(this,Nt).writeToRgbaTextureBuffer(e,t,r,i,s);o.setTextureBufferGroup(u)}function Kr(e,t,r){if(!St(this,Fr,_i).call(this,e))return;if(!n()(this,Ft))return void console.log("drawVideoFrameBaseTextureLayer() canvas is invalid? canvas=".concat(n()(this,Ft)));const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}const p=St(this,kr,ni).call(this);p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Qr(e,t,r){const i=h.w.VS_BASE,s=St(this,Sr,ri).call(this,i);let a=s.getUVCoords(),o=St(this,yr,Zr).call(this,n()(this,Ct),n()(this,Pt),n()(this,Mt),n()(this,Ot),r,e.width,e.height);a||(a=new Float32Array(12)),a.set(o,0),s.setUVCoords(a);const u=n()(this,Mt).width>n()(this,Mt).height,l=n()(this,Ft).width>e.width,c=n()(this,Ft).height>e.height;let d=l?e.width:n()(this,Ft).width,f=c?e.height:n()(this,Ft).height;if(u){const r=Math.abs(t.left)*d,i=Math.abs(t.top)*f,a=e.x+(e.width-r)/2;let o=0;o=e.y>=0?e.y+(e.height-i)/2:0,s.evalViewport(a,o,r,i,n()(this,Ft).height)}else{let t=e.height*n()(this,Mt).width/n()(this,Mt).height;t>e.width&&(t=e.width);let r=n()(this,Mt).height/n()(this,Mt).width*t;const i=e.x+e.width/2-t/2;let a=0;if(e.y>0)a=e.y+(e.height-r)/2;else if(0===e.y){a=e.height>r?(e.height-r)/2:0}else a=0;s.evalViewport(i,a,t,r,n()(this,Ft).height)}let p=null;p=s.getTextureType()==h.x.EXTERNAL_TEX?St(this,kr,ni).call(this):St(this,Mr,si).call(this,n()(this,Ot)),p&&p.buffer&&s.setUniformBuffer(p.buffer)}function Zr(e,t,r,i,n,s,a){const o=this.isUseFillMode({w:r.width,h:r.height,rotation:i}),h={width:s,height:a},u={width:e,height:t};return Object(xt.c)(o,h,u,r,i,n)}function Jr(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=e.width,o=e.height;s&&(a=s.width,o=s.height);let u,l,c,d,f=i==h.s||i==h.r?r:t,p=i==h.s||i==h.r?t:r,g=f/p*o,m=p/f*a;g>a?(u=0,c=1,l=(o-m)/2/o,d=1-l):(l=0,d=1,u=(a-g)/2/a,c=1-u),u=2*u-1,c=2*c-1,l=1-2*l,d=1-2*d;let _=[{x:c,y:l},{x:c,y:d},{x:u,y:d},{x:c,y:l},{x:u,y:l},{x:u,y:d}];n()(this,Nt)&&n()(this,Nt).updateVertexCoords(_)}function $r(e,t,r,i,n){var s,a,o,u;if(this.isUseFillMode({w:r,h:i,rotation:n}))s=0,a=0,o=1,u=1;else{var l=n==h.s||n==h.r?i:r,c=n==h.s||n==h.r?r:i,d=l/c*t;d>e?(s=0,o=1,u=1-(a=(t-c/l*e)/2/t)):(a=0,u=1,o=1-(s=(e-d)/2/e))}return{top:a=1-2*a,left:s=2*s-1,right:o=2*o-1,bottom:u=1-2*u}}function ei(){n()(this,Nt)||Object(o.u)("[WebGPURenderDisplay] renderer is not attached!")}function ti(e){if(e<0)throw new Error("[hasZIndexTexLayer] ".concat(e," is an invalid parameter!"));return n()(this,cr).has(e)}function ri(e){let t=null;return St(this,Er,ti).call(this,e)?t=n()(this,cr).get(e):(t=new yt(n()(this,At),e),n()(this,cr).set(e,t)),t}function ii(e,t,r){n()(this,Ft)&&(a()(this,rr,e),a()(this,ar,e&&r===tt.N?1:0),a()(this,or,t),e||a()(this,ir,r))}function ni(){const e={rotation:n()(this,Ot)};let t=null,r=n()(this,lr).get(h.w.VS_BASE);if(r){let i=r.buffer,s=r.uniform;if(s)if("yuvMode"in s)i&&i.destroy(),r=null;else if("rotation"in s){if(s.rotation!=e.rotation){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,i)}}else i&&i.destroy(),r=null}if(!r){const r=St(this,Ur,hi).call(this,e);t=n()(this,Nt).writeUniformBuffer("VideoFrameTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r)}return t?(r||(r={}),r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.VS_BASE,r),r):null}function si(e){if(-1==n()(this,nr))return null;const t={yuvMode:tt.V,colorRange:n()(this,nr),rotation:e};let r=null,i=n()(this,lr).get(h.w.VS_BASE);if(i){const e=i.uniform;if(r=i.buffer,e.yuvMode!=t.yuvMode||e.colorRange!=t.colorRange||e.rotation!=t.rotation){const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e,r)}}else{i={};const e=St(this,Lr,ui).call(this,t);r=n()(this,Nt).writeUniformBuffer("YuvTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),e)}return r?(i.uniform=t,i.buffer=r,n()(this,lr).set(h.w.VS_BASE,i),i):null}function ai(){if(!n()(this,ur))return null;const e={cursorFlag:n()(this,or),cursorInfo:n()(this,ur)};let t=null,r=n()(this,lr).get(h.w.CURSOR);if(r){const i=r.uniform;if(t=r.buffer,i.cursorFlag!=e.cursorFlag||i.cursorInfo!=e.cursorInfo){const r=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),r,t)}}else{r={};const i=St(this,Ir,li).call(this,e);t=n()(this,Nt).writeUniformBuffer("CursorTexLayerUniformBuffer(idx=".concat(n()(this,At),")"),i)}return t?(r.uniform=e,r.buffer=t,n()(this,lr).set(h.w.CURSOR,r),r):null}function oi(e,t){return Math.ceil(e/t)*t}function hi(e){const t=St(this,Pr,oi).call(this,1*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.rotation,r}function ui(e){const t=St(this,Pr,oi).call(this,3*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.yuvMode,r[1]=e.colorRange,r[2]=e.rotation,r}function li(e){const t=St(this,Pr,oi).call(this,5*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e.cursorFlag,r[1]=e.cursorInfo.x,r[2]=e.cursorInfo.y,r[3]=e.cursorInfo.w,r[4]=e.cursorInfo.h,r}function ci(e){if(!e||0==e.length)return null;const t=St(this,Pr,oi).call(this,4*Float32Array.BYTES_PER_ELEMENT,16),r=new Float32Array(t/Float32Array.BYTES_PER_ELEMENT);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function di(e,t,r,i){let n=t*r,s=e.subarray(0,n),a=0,o=0;i==tt.V?(o=t/2*r/2,a=o):i==tt.Z&&(o=t*r/2,a=0);let h=e.subarray(n,n+o);return{yPlane:{buffer:s,width:t,height:r},crPlane:{buffer:0!=a?e.subarray(n+o,n+o+a):null,width:t/2,height:r/2},cbPlane:{buffer:h,width:t/2,height:r/2}}}function fi(e,t,r){let i="",n=0,s=0,a=0;r==tt.V?(n=e/2*t/2,s=n,i="i420",a=Uint8Array.BYTES_PER_ELEMENT):r==tt.Z&&(n=e*t/2,s=0,i="nv12",a=Uint16Array.BYTES_PER_ELEMENT);const o=St(this,Pr,oi).call(this,Uint8Array.BYTES_PER_ELEMENT*e,256),h=St(this,Pr,oi).call(this,a*e/2,256);let u=o*t+h*t/2;s>0&&(u+=h*t/2);return{colorFormat:i,size:u,yPlane:{width:o,height:t},uvPlane:{width:h,height:t/2}}}function pi(e,t){const r=St(this,Pr,oi).call(this,Uint32Array.BYTES_PER_ELEMENT*e,256);return{colorFormat:"rgba",width:r,height:t,size:r*t}}function gi(e,t,r){if(t)if(t.buffer)if(r.size>t.buffer.size)n()(this,tr).recycleTextureBufferGroup(e),t.buffer=n()(this,tr).requestTextureBuffer(r),t.bufferConfig=r;else{"mapped"==t.buffer.mapState?t.bufferArray&&t.bufferArray.byteLength1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this),St(this,Ar,ii).call(this,1,n()(this,$t),n()(this,Dt));let i=null;i=t?St(this,Tr,$r).call(this,e.width,e.height,e.width,e.height,h.p):St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot)),St(this,br,Kr).call(this,e,i,r)}drawRemoteVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n()(this,Ft))return;if(!St(this,Fr,_i).call(this,e))return;St(this,Rr,ei).call(this);const r=this.isRgbaMode(n()(this,Dt))?1:0;St(this,Ar,ii).call(this,r,n()(this,$t),n()(this,Dt));const i=St(this,Tr,$r).call(this,e.width,e.height,n()(this,Mt).width,n()(this,Mt).height,n()(this,Ot));St(this,wr,Qr).call(this,e,i,t)}drawCursor(e,t,r,i,s){if(!n()(this,Qt)||e&&(i<0||s<0))return;const o=h.w.CURSOR,u=St(this,Sr,ri).call(this,o),l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(u.setUVCoords(l.getUVCoords()),u.evalViewport(t,r,i,s,n()(this,Ft).height),e&&n()(this,$t)){const e={x:t/n()(this,Mt).width,y:r/n()(this,Mt).height,w:i/n()(this,Mt).width,h:s/n()(this,Mt).height};a()(this,ur,e)}else{const e={x:0,y:0,w:0,h:0};a()(this,ur,e)}const c=St(this,Cr,ai).call(this);c&&c.buffer&&u.setUniformBuffer(c.buffer)}setMultiView(e){a()(this,Vt,e)}setFillMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a()(this,Bt,e),a()(this,Gt,t)}getFillMode(){return n()(this,Bt)}setColorRange(e){a()(this,nr,e)}getFillModeForResolution(){return n()(this,Gt)}getTextureIndex(){return n()(this,kt)}isUseFillMode(e){let{w:t,h:r,rotation:i}=e;if(!n()(this,Bt))return!1;if(!n()(this,Gt))return!0;if(!t||!r)return!1;const s=i===h.s||i===h.s?r/t:t/r;return(Array.isArray(n()(this,Gt))?n()(this,Gt):[n()(this,Gt)]).some(e=>Math.abs(s-e)<.01)}setVideoMode(e){a()(this,Dt,e)}getVideoMode(){return n()(this,Dt)}setWatermarkFlag(e){a()(this,zt,e),e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))}setWatermarkRepeated(e){a()(this,Ht,e)}isWatermarkRepeated(){return!!n()(this,Ht)}setWatermarkOpacity(e){a()(this,jt,e||.15)}getWatermarkOpacity(){return n()(this,jt)}setWatermarkPosition(e){a()(this,Yt,e||16)}getWatermarkPosition(){return n()(this,Yt)}isSetWatermark(){return n()(this,zt)}isRgbaMode(e){return-1!==[tt.ab,tt.N].indexOf(e)}getTextureWidth(){return n()(this,Ct)}getTextureHeight(){return n()(this,Pt)}getCroppingParams(){return n()(this,Mt)}recoverTextures(){}updateWatermark(e,t,r){const i=h.w.WATERMARK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(a()(this,Xt,e),a()(this,qt,t),a()(this,zt,1),a()(this,sr,1),!St(this,Er,ti).call(this,h.w.VS_BASE)){console.log("[updateWatermark] base layer is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};return void s.setRawData(i)}const u=St(this,Sr,ri).call(this,h.w.VS_BASE).getViewport();if(u)try{const i=St(this,Gr,pi).call(this,e,t);i.label="WatermarkTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateWatermark()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,_r,Xr).call(this,n()(this,At),e,t,r,a),u&&s.setViewport(u);let o=s.getUVCoords(),h=St(this,Nr,mi).call(this);o||(o=new Float32Array(12)),o.set(h,0),s.setUVCoords(o),s.setRawData(null),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateWatermark() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateWatermark() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}else{console.log("[updateWatermark] base layer's viewport is not ready, set data to the texture layer for creating texture later."),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending();const i={index:n()(this,At),width:e,height:t,data:r};s.setRawData(i)}}updateCursor(e,t,r){const i=h.w.CURSOR,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();a()(this,Zt,e),a()(this,Jt,t),a()(this,$t,1);try{const i=St(this,Gr,pi).call(this,e,t);i.label="CursorTexBuffer(".concat(s.getIndex(),")-").concat(i.size);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return void console.warn("[updateCursor()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!"));if("mapped"!=a.buffer.mapState)return void console.error("updateCursor() why buffer state is not mapped!");St(this,mr,Yr).call(this,n()(this,At),e,t,r,a),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateCursor() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateCursor() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}updateSelfVideoTextures(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;St(this,Rr,ei).call(this);const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Ft)||!n()(this,Nt))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length%4!=0)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(1!=e||1!=t){if(a()(this,Ct,e),a()(this,Pt,t),a()(this,Ot,u),Object.assign(n()(this,Mt),i),!s)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateSelfVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfVideoTextures() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close();St(this,Sr,ri).call(this,h.w.VS_BASE).setPendingVideoFrame(null)}}else{l.setPendingVideoFrame(null),St(this,Vr,vi).call(this),r&&r instanceof VideoFrame&&r.close();const e=St(this,Or,ci).call(this,r);if(e)if(n()(this,Nt)){let t=l.getClearColorUniformBuffer();t=n()(this,Nt).writeUniformBuffer("ClearColorUniformBuffer",e,t),l.setClearColorUniformBuffer(t),l.setTextureType(h.x.CLEAR_COLOR)}else console.warn("updateSelfVideoTextures() renderer is not attached!");else Object(o.u)("updateSelfVideoTextures() cannot create the uniform buffer array.");this.markRenderingStateReady()}}updateRemoteVideoTexturesImageBitmap(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const l=St(this,Sr,ri).call(this,h.w.VS_BASE);if(!n()(this,Nt)||!n()(this,Ft))return r&&r instanceof VideoFrame&&r.close(),St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(e<=0||t<=0||!r)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();if(a()(this,Ct,e),a()(this,Pt,t),Number.isNaN(s)||a()(this,Ot,s),Object.assign(n()(this,Mt),i),!u)return r&&r instanceof VideoFrame&&r.close(),void this.markRenderingStatePending();try{St(this,fr,zr).call(this,e,t,r),this.markRenderingStateReady()}catch(e){console.log("[WebGPURenderDisplay] updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTexturesImageBitmap() error:".concat(e.message)),this.markRenderingStatePending(),r instanceof VideoFrame&&r.close(),l.setPendingVideoFrame(null)}}updateRemoteVideoTextures(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6?arguments[6]:void 0;const c=h.w.VS_BASE,d=St(this,Sr,ri).call(this,c);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(!St(this,Fr,_i).call(this,l))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();St(this,Rr,ei).call(this);const f=this.isRgbaMode(n()(this,Dt));if(e<=0||t<=0||!i||!i.length||i.length!=e*t*3/2&&!f||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return n()(this,tr).recycleTextureBufferGroup(d),void this.markRenderingStatePending();if(f)try{St(this,fr,zr).call(this,e,t,i,!0);let o=u?0:1;a()(this,nr,o),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height)}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),d.setPendingVideoFrame(null),this.markRenderingStatePending()}finally{n()(this,tr).recycleTextureBufferGroup(d)}else try{const o=St(this,Br,fi).call(this,e,t,n()(this,Dt));o.label="YuvVideoTexBuffer(".concat(d.getIndex(),")-").concat(o.size),d.setColorFormat(o.colorFormat);let h=d.getTextureBufferGroup();if(h=St(this,Wr,gi).call(this,d,h,o),!h||!h.buffer)return console.warn("[updateRemoteVideoTextures()] texLayer(".concat(d.getIndex(),") cannot apply a GPUBuffer!")),void this.markRenderingStatePending();let l=u?0:1;a()(this,nr,l),a()(this,Ot,s),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),St(this,pr,Hr).call(this,n()(this,At),e,t,i,h,n()(this,Dt)),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateRemoteVideoTextures() error:".concat(e.message," cs:").concat(e.stack)),Object(o.o)("WGPU WebGPURenderDisplay_updateRemoteVideoTextures() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(d),this.markRenderingStatePending()}}drawNextOutputPictureFrame(e,t,r,i,s){let u=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];const d=h.w.VS_BASE,f=St(this,Sr,ri).call(this,d);if(!n()(this,Ft)||!n()(this,Nt))return St(this,Vr,vi).call(this),void this.markRenderingStatePending();if(Object(xt.g)(n()(this,tr),e,t))return n()(this,tr).recycleTextureBufferGroup(f),void this.markRenderingStatePending();s=s||h.p;let p=(r=r||{top:0,left:0,width:e,height:t}).width!=n()(this,Mt).width||r.height!=n()(this,Mt).height,g=r.top!=n()(this,Mt).top||r.left!=n()(this,Mt).left,m=n()(this,Ft).width!=n()(this,Ut)||n()(this,Ft).height!=n()(this,Lt),_=e!=n()(this,Ct)||t!=n()(this,Pt),v=s!=n()(this,It);if((p||m||v)&&St(this,xr,Jr).call(this,n()(this,Ft),r.width,r.height,s,l),l){const e=Object(xt.d)(r,s),t=Object(xt.a)(l,e);f.evalViewport(t.x,t.y,t.width,t.height,n()(this,Ft).height)}else f.evalViewport(0,0,n()(this,Ft).width,n()(this,Ft).height,n()(this,Ft).height);if(p||g||_||v||!f.getUVCoords()){let i=Object(xt.b)({width:e,height:t},r,n()(this,Ft),s),a=f.getUVCoords();a||(a=new Float32Array(12)),a.set(i),f.setUVCoords(a)}let b=u?0:1;b!=n()(this,nr)&&a()(this,nr,b),a()(this,rr,0),a()(this,ir,tt.V),Object.assign(n()(this,Mt),r),a()(this,Ct,e),a()(this,Pt,t),a()(this,It,s),a()(this,Ut,n()(this,Ft).width),a()(this,Lt,n()(this,Ft).height),f.setColorFormat("i420");try{const r=St(this,Br,fi).call(this,e,t,tt.V);if(r.label="YuvShareTexBuffer(".concat(f.getIndex(),")-").concat(r.size),c){let s=f.getTextureBufferGroup();if(s=St(this,Wr,gi).call(this,f,s,r),!s||!s.buffer)return console.warn("[drawNextOutputPictureFrame()] texLayer(".concat(f.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();St(this,pr,Hr).call(this,n()(this,At),e,t,i,s,tt.V);const a=St(this,Mr,si).call(this,n()(this,It));a&&a.buffer&&f.setUniformBuffer(a.buffer)}n()(this,$t)?a()(this,or,1):a()(this,or,0),a()(this,Qt,1),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] drawNextOutputPictureFrame() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_drawNextOutputPictureFrame() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(f),this.markRenderingStatePending()}}clearCanvas(e){n()(this,Nt)&&n()(this,Nt).clearAttachedCanvas()}updateSelfMaskImage(e,t,r){const i=h.w.MASK,s=St(this,Sr,ri).call(this,i);if(!n()(this,Ft))return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(e<=0||t<=0||!r||r.length!=e*t*4)return n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();if(!St(this,Er,ti).call(this,h.w.VS_BASE))return console.log("[updateSelfMaskImage] base layer is not ready."),n()(this,tr).recycleTextureBufferGroup(s),void this.markRenderingStatePending();try{const i=St(this,Gr,pi).call(this,e,t);let a=s.getTextureBufferGroup();if(a=St(this,Wr,gi).call(this,s,a,i),!a||!a.buffer)return console.warn("[updateSelfMaskImage()] texLayer(".concat(s.getIndex(),") cannot apply a GPU buffer!")),void this.markRenderingStatePending();if(a.buffer.label="SelfMaskImageTexBuffer(".concat(s.getIndex(),")-").concat(i.size),s.setTextureLayerType(h.v.BLEND_LAYER),s.setTextureType(h.x.GPU_TEX_RGBA),s.isLocked()){const r=s.getWidth(),i=s.getHeight();r==e&&i==t||(s.setWidth(e),s.setHeight(t),s.setIsNew(!0))}else s.setWidth(e),s.setHeight(t),s.setIsNew(!0),s.lock();const o=n()(this,Nt).writeToRgbaTextureBuffer(n()(this,At),e,t,r,a);s.setTextureBufferGroup(o);const u=St(this,Sr,ri).call(this,h.w.VS_BASE),l=u.getViewport();l&&s.setViewport(l),s.setUVCoords(u.getUVCoords()),this.isSetWatermark()&&n()(this,Xt)&&n()(this,qt),this.markRenderingStateReady()}catch(e){console.error("[WebGPURenderDisplay] updateSelfMaskImage() error:".concat(e.message)),Object(o.o)("WGPU WebGPURenderDisplay_updateSelfMaskImage() error:".concat(e.message)),n()(this,tr).recycleTextureBufferGroup(s),this.markRenderingStatePending()}}readPixelsSyncRequest(e,t,r,i){}isAvaiable(){return!0}markRenderingStateReady(){a()(this,Kt,h.k.READY)}markRenderingStateRendering(){a()(this,Kt,h.k.RENDERING)}markRenderingStatePending(){a()(this,Kt,h.k.PENDING)}markRenderingStateIdle(){a()(this,Kt,h.k.IDLE)}isRenderingStateReady(){return n()(this,Kt)===h.k.READY}isInTargetRenderingState(e){return n()(this,Kt)===e}getWatermarkWidth(){return n()(this,Xt)}getWatermarkHeight(){return n()(this,qt)}getIndex(){return n()(this,At)}getRenderingState(){return n()(this,Kt)}recycle(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(const[t,r]of n()(this,cr))r&&(n()(this,tr).recycleTextureBufferGroup(r,e),r.recycle(n()(this,tr)));a()(this,dr,{top:0,left:0,bottom:0,right:0}),this.markRenderingStateIdle(),n()(this,cr).clear(),n()(this,lr).clear(),this.unbindSsrc()}cleanup(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.recycle(e),this.removeRenderer(),this.detachCanvas(),this.removeGPUResMgr()}clear(){console.log("WebGPURenderDisplay.clear"),this.clearCanvas(),a()(this,Qt,0),a()(this,$t,0),this.recycle()}clearDisplay(){console.log("WebGPURenderDisplay.clearDisplay"),this.clearCanvas()}getTextureLayersMap(){return n()(this,cr)}getTextureLayerByZIndex(e){return St(this,Sr,ri).call(this,e)}getUsedBuffersCount(){let e=0;for(const[t,r]of n()(this,cr))r&&r.getTextureBufferGroup()&&r.getTextureBufferGroup().buffer&&e++;return e}consumePendingGPUEvents(){if(n()(this,zt)){const e=St(this,Sr,ri).call(this,h.w.WATERMARK).getRawData();e&&this.updateWatermark(n()(this,Xt),n()(this,qt),e.data)}}resizeCanvasTo(e,t){n()(this,Ft)&&(n()(this,Ft).width=e,n()(this,Ft).height=t)}};function wi(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var yi=new WeakMap,xi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Ei=new WeakMap;var Si=class{constructor(e,t,r){wi(this,yi,{writable:!0,value:0}),wi(this,xi,{writable:!0,value:null}),wi(this,Ti,{writable:!0,value:null}),wi(this,Ri,{writable:!0,value:h.t.AVAILABLE}),wi(this,Ei,{writable:!0,value:null}),a()(this,yi,e),a()(this,Ri,t),a()(this,Ei,r),a()(this,xi,[]),a()(this,Ti,[])}initPool(e){if(e>n()(this,yi))throw new Error("initSize=".concat(e," is larger than maxSize=").concat(n()(this,yi),", invalid!"));if(e<0)throw new Error("initSize=".concat(e," is smaller than 0, invalid!"));for(let t=0;t=n()(this,yi))return;let t=0;if(n()(this,xi).length+e>=n()(this,yi)&&(t=n()(this,yi)-n()(this,xi).length),t>0){const e=n()(this,xi).length;for(let r=0;r0&&void 0!==arguments[0])||arguments[0])&&this.isPoolEmpty()&&this.expandPool(4);const e=n()(this,xi).pop();return e&&(e.markRenderingStatePending(),n()(this,Ti).push(e)),e}recycle(e){if(n()(this,xi).length0&&void 0!==arguments[0])||arguments[0];n()(this,xi).forEach(t=>{t.cleanup(e)}),n()(this,Ti).forEach(t=>{t.cleanup(e)}),a()(this,xi,[]),a()(this,Ti,[])}isPoolEmpty(){return 0==n()(this,xi).length}getInUseRenderDisplays(){return n()(this,Ti)}getAllRenderDisplays(){return n()(this,xi)}isServeForVideoRendering(){return n()(this,Ri)===h.t.VIDEO}isServeForShareRendering(){return n()(this,Ri)===h.t.SHARE}isServingForNow(e){return n()(this,Ri)===e}};function Ai(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ki=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Pi=new WeakMap,Ui=new WeakMap;class Li{getVideoRenderDisplay(e,t,r,i){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getSharingRenderDisplay(e,t,r){throw new Error("getSharingRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,r){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}var Ii=new WeakMap,Oi=new WeakMap;class Di extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Ii,{writable:!0,value:new Map}),Ai(this,Oi,{writable:!0,value:!1}),a()(this,Oi,e)}setCanvasAlphaChannelEnability(e){a()(this,Oi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Ze.a(e,t,r,s,a,o,h,n()(this,Oi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Ii).get(e);if(!a){let i=[];a=[i,[]],n()(this,Ii).set(e,a);let o=new Ze.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Oi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Ze.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,n()(this,Oi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Ii).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Ze.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Oi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Ii).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Ii).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Ii).delete(r),n()(this,Ii).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Ii)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t,null);for(const[e,t]of n()(this,Ii)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Ii,new Map)}cleanupByCanvas(e){if(n()(this,Ii).get(e)){let t=n()(this,Ii).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Ii).delete(e)}}}}var Bi=new WeakMap,Gi=new WeakMap;class Wi extends Li{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ai(this,Bi,{writable:!0,value:new Map}),Ai(this,Gi,{writable:!0,value:!1}),a()(this,Gi,e)}setCanvasAlphaChannelEnability(e){a()(this,Gi,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,a=null,o=null,h=!1;return i&&(s=i.forceNoGL,a=i.contextOptions,o=i.webGLResources,h=i.initMask),new Je.a(e,t,r,s,a,o,h,n()(this,Gi))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=n()(this,Bi).get(e);if(!a){let i=[];a=[i,[]],n()(this,Bi).set(e,a);let o=new Je.a(e,t,0,void 0,void 0,void 0,void 0,n()(this,Gi));o.setMultiView(!0),s&&s.set(e,o);let h=1;for(;h<=r;h++){const r=new Je.a(e,t,h,void 0,void 0,{program:o.shaderProgram,contextgl:o.contextGL,vBuffer:o.vertexPosBuffer,tBuffer:o.texturePosBuffer,waterMarkTextureRef:o.waterMarkTextureRef,repeatedWaterMarkTextureRef:o.repeatedWaterMarkTextureRef},void 0,void 0,n()(this,Gi));r.setMultiView(!0),i.push(r)}}let o,h=n()(this,Bi).get(e),u=h[0],l=h[1];if(h&&u[0]&&(o=u.pop(),l.push(o)),!o){const e=h?"".concat(h.length):"undefined",t=u?"".concat(u.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}getSharingRenderDisplay(e,t,r){return new Je.a(e,t,0,void 0,r.contextOptions,void 0,void 0,n()(this,Gi))}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(tt.W),t.clear(r);let i=n()(this,Bi).get(e);if(i){let e=i[0],r=i[1];r&&r.some((function(e,i){if(e===t)return r.splice(i,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=n()(this,Bi).get(r);(!o||o.length<2)&&s("canvasRenderArray:".concat(o,", length:").concat(null==o?void 0:o.length));let h=a.get(t);if(h){h.reinit();for(let e=0;e<(null==o?void 0:o.length);e++)o[e].forEach(e=>{null==e||e.reinit({program:h.shaderProgram,contextgl:h.contextGL,vBuffer:h.vertexPosBuffer,tBuffer:h.texturePosBuffer,waterMarkTextureRef:h.waterMarkTextureRef,repeatedWaterMarkTextureRef:h.repeatedWaterMarkTextureRef})});return r!==t&&(n()(this,Bi).delete(r),n()(this,Bi).set(t,o),a&&(a.delete(r),a.set(t,h))),null}}getRenderDisplayMap(){return n()(this,Bi)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t);for(const[e,t]of n()(this,Bi)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}a()(this,Bi,new Map)}cleanupByCanvas(e){if(n()(this,Bi).get(e)){let t=n()(this,Bi).get(e);if(t){let r=t[0],i=t[1];i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),r=[],i=[],n()(this,Bi).delete(e)}}}}var Ni=new WeakMap,Fi=new WeakMap,Vi=new WeakMap;class zi extends Li{constructor(){super(),Ai(this,Ni,{writable:!0,value:new Map}),Ai(this,Fi,{writable:!0,value:new Map}),Ai(this,Vi,{writable:!0,value:null})}setGPUResourceMgr(e){a()(this,Vi,e)}getVideoRenderDisplay(e,t,r,i){let s=n()(this,Ni).get(e);s||(s=new Si(r,h.t.VIDEO,n()(this,Vi)),s.initPool(r),n()(this,Ni).set(e,s));let a=s.pop();return a?(a.setMultiView(!0),a):null}getSharingRenderDisplay(e,t,r){r&&r.clearCache&&n()(this,Fi).clear();let i=n()(this,Fi).get(e);return i||(i=new Si(1,h.t.SHARE,n()(this,Vi)),i.initPool(1),n()(this,Fi).set(e,i)),i.pop()}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=new bi(r,n()(this,Vi));return s.addRenderer(i),s.attachCanvas(e),s}getInUseCanvasRenderDisplayList(e){let t=[],r=null;if(e==h.t.VIDEO?r=n()(this,Ni):e==h.t.SHARE&&(r=n()(this,Fi)),r)for(const[e,i]of r){let r={};r.canvas=e,r.renderDisplays=i.getInUseRenderDisplays(),r.renderDisplays.length>0&&t.push(r)}return t}recycleRenderDisplay(e,t){if(e){const t=e.getAttachedCanvas();if(t){let r=n()(this,Ni).get(t);r&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),r.recycle(e));let i=n()(this,Fi).get(t);i&&(e.setWatermarkFlag(0),e.setVideoMode(tt.W),i.recycle(e))}}}cleanup(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null==e||null===(t=e.cleanup)||void 0===t||t.call(e,r);for(const[e,t]of n()(this,Ni))t.cleanup(r);for(const[e,t]of n()(this,Fi))t.cleanup(r)}cleanupByCanvas(e){let t=n()(this,Ni).get(e);t&&(t.cleanup(),n()(this,Ni).delete(e));let r=n()(this,Fi).get(e);r&&(r.cleanup(),n()(this,Fi).delete(e))}collectInUseRenderDisplays(e){return this.getInUseCanvasRenderDisplayList(e)}collectInUseRenderDisplaysByCanvas(e,t){let r=null;if(e)if(t==h.t.VIDEO){r=n()(this,Ni).get(e).getInUseRenderDisplays()}else if(t==h.t.SHARE){r=n()(this,Fi).get(e).getInUseRenderDisplays()}return r}getRenderDisplayMap(e){let t=null;return e==h.t.VIDEO?t=n()(this,Ni):e==h.t.SHARE&&(t=n()(this,Fi)),t}}var Hi=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ai(this,ki,{writable:!0,value:null}),Ai(this,Mi,{writable:!0,value:null}),Ai(this,Ci,{writable:!0,value:null}),Ai(this,Pi,{writable:!0,value:null}),Ai(this,Ui,{writable:!0,value:!1}),a()(this,Ui,e)}setGPUResourceMgr(e){a()(this,Pi,e)}isEnableCanvasAlphaChannel(){return n()(this,Ui)}setCanvasAlphaChannelEnability(e){a()(this,Ui,e),n()(this,ki)&&n()(this,ki).setCanvasAlphaChannelEnability(e),n()(this,Mi)&&n()(this,Mi).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),n()(this,ki)}getWebGL2RenderDisplayMgr(){return n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),n()(this,Mi)}getWebGPURenderDisplayMgr(){return n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),n()(this,Ci)}getVideoRenderDisplay(e,t,r,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),l=n()(this,ki).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),l=n()(this,Mi).getVideoRenderDisplay(t,r,i,s,u)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),l=n()(this,Ci).getVideoRenderDisplay(t,r,i,s),l&&(l.addRenderer(o),l.attachCanvas(t),l.setGPUResMgr(n()(this,Pi)))),l}getSharingRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=null;return e===h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),o=n()(this,ki).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),o=n()(this,Mi).getSharingRenderDisplay(t,r,s)):e===h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),o=n()(this,Ci).getSharingRenderDisplay(t,r,s),o&&(o.addRenderer(i),o.attachCanvas(t),o.setGPUResMgr(n()(this,Pi)))),o}createVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=null;return e==h.j.WEBGL?(n()(this,ki)||a()(this,ki,new Di(n()(this,Ui))),u=n()(this,ki).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGL_2?(n()(this,Mi)||a()(this,Mi,new Wi(n()(this,Ui))),u=n()(this,Mi).createVideoRenderDisplay(t,r,i,s,o)):e==h.j.WEBGPU&&(n()(this,Ci)||(a()(this,Ci,new zi),n()(this,Ci).setGPUResourceMgr(n()(this,Pi))),u=n()(this,Ci).createVideoRenderDisplay(t,r,i,s,o),u.addRenderer(s),u.attachCanvas(t),u.setGPUResMgr(n()(this,Pi))),u}recycleRenderDisplay(e,t,r,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e===h.j.WEBGPU?n()(this,Ci)&&n()(this,Ci).recycleRenderDisplay(r,i,s):e===h.j.WEBGL?n()(this,ki)&&n()(this,ki).recycleRenderDisplay(t,r,s):e===h.j.WEBGL_2&&n()(this,Mi)&&n()(this,Mi).recycleRenderDisplay(t,r,s)}collectInUseRenderDisplays(e,t){let r=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(r=n()(this,Ci).collectInUseRenderDisplays(t)),r}collectInUseRenderDisplaysByCanvas(e,t,r){let i=null;return e===h.j.WEBGPU&&n()(this,Ci)&&(i=n()(this,Ci).collectInUseRenderDisplaysByCanvas(t,r)),i}getRenderDisplayMap(e,t){if(e===h.j.WEBGL){if(n()(this,ki))return n()(this,ki).getRenderDisplayMap()}else if(e===h.j.WEBGPU){if(n()(this,Ci))return n()(this,Ci).getRenderDisplayMap(t)}else if(e===h.j.WEBGL_2&&n()(this,Mi))return n()(this,Mi).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,ki)?n()(this,ki).onRestoredFromContextLost(e,t,r,i,s,a):n()(this,Mi)?n()(this,Mi).onRestoredFromContextLost(e,t,r,i,s,a):null}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==n()(this,ki)&&n()(this,ki).cleanup(e,t),n()(this,Mi)&&n()(this,Mi).cleanup(e,t),null!==n()(this,Ci)&&n()(this,Ci).cleanup(t,r)}cleanupByCanvas(e){null!==n()(this,ki)&&n()(this,ki).cleanupByCanvas(e),null!==n()(this,Mi)&&n()(this,Mi).cleanupByCanvas(e),null!==n()(this,Ci)&&n()(this,Ci).cleanupByCanvas(e)}};function ji(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var Yi=new WeakMap,Xi=new WeakMap,qi=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;var $i=class{constructor(e){ji(this,Yi,{writable:!0,value:h.f.VERTEX_BUFFER}),ji(this,Xi,{writable:!0,value:{}}),ji(this,qi,{writable:!0,value:null}),ji(this,Ki,{writable:!0,value:0}),ji(this,Qi,{writable:!0,value:0}),ji(this,Zi,{writable:!0,value:[]}),ji(this,Ji,{writable:!0,value:new Map}),a()(this,qi,e)}acquireBuffer(e,t,r){let i,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?n()(this,Ji).has(e)?i=n()(this,Ji).get(e):n()(this,Zi).length>0?(i=n()(this,Zi).pop(),n()(this,Ji).set(e,i)):(i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),n()(this,Ji).set(e,i)):i=n()(this,qi).createBuffer({size:r,usage:t,mappedAtCreation:s}),i}releaseBuffer(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Ji).has(e)){const t=n()(this,Ji).get(e);r?n()(this,Zi).push(t):t.destroy(),n()(this,Ji).delete(e)}else r||-1!=n()(this,Zi).indexOf(t)&&(n()(this,Zi)[index]=n()(this,Zi)[n()(this,Zi).length-1],n()(this,Zi).pop(),t.destroy())}getNumUsedBuffers(){return n()(this,Ki)}getNumFreeBuffers(){return n()(this,Qi)}cleanup(){n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Ji).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,n()(this,Ji).clear(),a()(this,Ki,0),a()(this,Qi,0)}release(e){e==h.n.OVERUSE&&(n()(this,Zi).forEach((e,t)=>{e.forEach(e=>{e.destroy()})}),n()(this,Zi).length=0,a()(this,Qi,0))}getResourceType(){return n()(this,Yi)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Ji))e++,t+=s.size,r+="[GPUBufferMgr] entry{key:".concat(i,", buffer:{label:").concat(s.label," size:").concat(s.size,"}}\n");for(const r of n()(this,Zi))e++,t+=r.size;return r+="[GPUBufferMgr] freeBuffers{size:".concat(n()(this,Zi).length,"}\n"),r+="[GPUBufferMgr] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,Xi).type=n()(this,Yi),n()(this,Xi).count=e,n()(this,Xi).usedBytes=t,n()(this,Xi).output=r,n()(this,Xi)}onOccupancyLevelEvaluated(e){console.log("[GPUBufferManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUBufferManager_onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}};function en(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var tn=new WeakMap,rn=new WeakMap,nn=new WeakMap;var sn=class{constructor(){en(this,tn,{writable:!0,value:h.f.TEXTURE}),en(this,rn,{writable:!0,value:[]}),en(this,nn,{writable:!0,value:[]})}acquire(e){let t=null;const r=n()(this,rn).findIndex(t=>t&&t.width==e.w&&t.height==e.h&&t.format==e.format&&t.usage==e.usage);return r>-1&&(t=n()(this,rn).splice(r,1)[0]),t&&n()(this,nn).push(t),t}recycle(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=n()(this,nn).indexOf(e);-1!=r&&n()(this,nn).splice(r,1),t?e.destroy():(n()(this,rn).push(e),e.label="")}pushToAvailablePool(e){e&&n()(this,rn).push(e)}pushToInUsePool(e){e&&n()(this,nn).push(e)}release(e){if(e==h.n.OVERUSE&&n()(this,rn).length>0){for(const e of n()(this,rn))e.destroy();n()(this,rn).length=0}}cleanup(){for(const e of n()(this,rn))e.destroy();for(const e of n()(this,nn))e.destroy();n()(this,rn).length=0,n()(this,nn).length=0}getAvailablePool(){return n()(this,rn)}getInUsedPool(){return n()(this,nn)}getResourceType(){return n()(this,tn)}};function an(e,t){hn(e,t),t.add(e)}function on(e,t,r){hn(e,t),t.set(e,r)}function hn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function un(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakSet,gn=new WeakSet,mn=new WeakSet,_n=new WeakSet,vn=new WeakSet;function bn(e){let t=n()(this,dn).get(e.level),r=null;return t?(r=t.acquire(e),r||(r=un(this,mn,yn).call(this,e),r?t.pushToInUsePool(r):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e))))):(r=un(this,mn,yn).call(this,e),r?(t=new sn,t.pushToInUsePool(r),n()(this,dn).set(e.level,t)):console.error("acquireTexture() cannot create an available tex. texConfig=".concat(JSON.stringify(e)))),r}function wn(e){const t=e.zOrder;let r=n()(this,fn).get(t);return r?(e.w>r.width||e.h>r.height)&&(r.destroy(),r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)):(r=un(this,mn,yn).call(this,e),n()(this,fn).set(t,r)),r}function yn(e){if(!n()(this,ln))return null;if(0==e.w||0==e.h)return null;const t={size:{width:e.w,height:e.h},format:e.format,usage:e.usage};return e.sampleCount>0&&(t.sampleCount=e.sampleCount),n()(this,ln).createTexture(t)}function xn(e){let t=h.u[h.u.length-1];for(let r=0;r1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=this.assembleTextureConfig(e.width,e.height,e.usage,e.format,e.sampleCount);let i=n()(this,dn).get(r.level);if(i)i.recycle(e,t);else if(console.warn("recycleTexture(".concat(e.label,") texture is not found in the map!, destroy:").concat(t)),t)e.destroy();else{const t=new sn;t.pushToAvailablePool(e),n()(this,dn).set(r.level,t)}}cleanup(){for(const[e,t]of n()(this,dn))t&&t.cleanup();n()(this,dn).clear()}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,dn))if(s){const n=s.getAvailablePool();for(const r of n)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);const a=s.getInUsedPool();for(const r of a)e++,"r8unorm"==r.format?t+=r.width*r.height:"rgba8unorm"==r.format&&(t+=r.width*r.height*Uint32Array.BYTES_PER_ELEMENT);(n.length>0||a.length>0)&&(r+="[GPUTexturePool] level:".concat(i," pool:{ava_count:").concat(n.length," in_used_count:").concat(a.length,"}\n"))}return r+="[GPUTexturePool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,cn).type=h.f.TEXTURE,n()(this,cn).count=e,n()(this,cn).usedBytes=t,n()(this,cn).output=r,n()(this,cn)}onOccupancyLevelEvaluated(e){if(console.log("[GPUTextureManager] onOccupancyLevelEvaluated() level:".concat(e)),Object(o.o)("WGPU GPUTextureManager_onOccupancyLevelEvaluated() level:".concat(e)),e==h.n.OVERUSE)for(const[t,r]of n()(this,dn))r&&r.release(e)}};function En(e,t){An(e,t),t.add(e)}function Sn(e,t,r){An(e,t),t.set(e,r)}function An(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function kn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Mn=new WeakMap,Cn=new WeakMap,Pn=new WeakMap,Un=new WeakMap,Ln=new WeakSet,In=new WeakSet;function On(e,t,r){if(n()(this,Pn).set(e,t),r){let e=Array.from(n()(this,Pn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Pn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Pn).set(t,r)})}}function Dn(e,t){if(!e||0==e.length)return null;let r=0,i=0,n=null;for(const s of e)"mapped"==s.mapState?(r+=1,n||s.size>=t&&(n=s)):i+=1;if(r>0&&0==i||r>=2&&0!=i){if(n){const t=e.indexOf(n);-1!=t&&e.splice(t,1)}return n}return null}var Bn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;En(this,In),En(this,Ln),Sn(this,Mn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Sn(this,Cn,{writable:!0,value:0}),Sn(this,Pn,{writable:!0,value:new Map}),Sn(this,Un,{writable:!0,value:0}),a()(this,Cn,e),a()(this,Un,t)}isUpToThreshold(e,t){if(e!=n()(this,Cn)||t<=0)return!1;if(0==n()(this,Un))return!1;const r=n()(this,Pn).get(t);return!!r&&r.length>=n()(this,Un)}push(e,t,r){if(e!=n()(this,Cn)||!r||t<=0)return!1;let i=null,s=!1;if(n()(this,Pn).has(t)){if(i=n()(this,Pn).get(t),i||(i=[],s=!0),!(i.length1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r=e.level,i=e.bytesPerRow,s=e.size;if(r!=n()(this,Cn)||i<=0)return console.error("[GPUBufferPoolEntry] acquire() level(".concat(r,") or bpr=").concat(i," is invalid!")),null;let a=null,o=!1;if(n()(this,Pn).has(i)){let e=n()(this,Pn).get(i);if(e){const t=e.findIndex(e=>"mapped"==e.mapState&&e.size>=s);t>-1?a=e.splice(t,1)[0]:o=!0}else o=!0}else o=!0;if(o&&!a&&!t){let t=2,o=!1;r>=h.m[h.h]&&(o=!0);for(const[r,h]of n()(this,Pn))if((t>0||o)&&r>i){if(a=kn(this,In,Dn).call(this,h,s),a){e.bytesPerRow=r;break}t--}}return a}recycle(e,t,r){if(e!=n()(this,Cn)||t<=0||!r)return!1;let i=!1;if(n()(this,Pn).has(t)){let e=!1,s=n()(this,Pn).get(t);s||(s=[],e=!0),s.push(r),e&&kn(this,Ln,On).call(this,t,s,e),i=!0}else i=this.push(e,t,r);return i}release(e){if(e==h.n.OVERUSE){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}}cleanup(){for(const[e,t]of n()(this,Pn))if(t){for(const e of t)"mapped"!=e.mapState&&"unmapped"!=e.mapState||e.destroy();t.length=0}n()(this,Pn).clear()}getPool(){return n()(this,Pn)}hasBytesPerRowAsKey(e){return n()(this,Pn).has(e)}getResourceType(){return n()(this,Mn)}getPoolThreshold(){return n()(this,Un)}canLendBufferCrossLevel(e,t){let r=!0;if(n()(this,Pn).has(t)){const i=n()(this,Pn).get(t);if(i){let t=0,n=0;for(const e of i)"mapped"==e.mapState?t+=1:n+=1;if(e>=h.m[h.h])r=t>0;else{const e=t>=2&&0!=n;r=t>0&&0==n||e}}}else r=!1;return r}};function Gn(e,t){Nn(e,t),t.add(e)}function Wn(e,t,r){Nn(e,t),t.set(e,r)}function Nn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fn(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var Vn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,qn=new WeakSet,Kn=new WeakSet,Qn=new WeakSet,Zn=new WeakSet,Jn=new WeakSet,$n=new WeakSet,es=new WeakSet;function ts(e){if(!e)return;const t=e.colorFormat;if("rgba"==t){const t=Fn(this,Kn,rs).call(this,e.height);t>0&&t0&&t0&&t-1&&t+1<=h.m.length-1?h.m[t+1]:e}function ns(e){if(!e)return 0;let t=0;const r=e.colorFormat;if("rgba"==r?t=e.height:"i420"!=r&&"nv12"!=r||(t=e.yPlane.height),0==t)return 0;let i=0;return i=t<=h.m[2]?90:t>h.m[2]&&t<=h.m[5]?60:15,i}function ss(e){return e.mapAsync(GPUMapMode.WRITE,0,e.size)}function as(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n()(this,Yn).set(e,t),r){let e=Array.from(n()(this,Yn).entries());e.sort((e,t)=>e[0]-t[0]),n()(this,Yn).clear(),e.forEach(e=>{let[t,r]=e;n()(this,Yn).set(t,r)})}}function os(e){if(!e)return null;let t=e.level,r=e.bytesPerRow;e.size;const i=Fn(this,Qn,is).call(this,t);if(i<=t)return null;if(!n()(this,Yn).has(i))return null;const s=n()(this,Yn).get(i);if(!s)return null;if(!s.hasBytesPerRowAsKey(r))return null;if(!s.canLendBufferCrossLevel(t,r))return null;const a={};Object.assign(a,e),a.level=i;const o=s.acquire(a,!0);return o&&(e.level=i,e.bytesPerRow=a.bytesPerRow),o}var hs=class{constructor(e){Gn(this,es),Gn(this,$n),Gn(this,Jn),Gn(this,Zn),Gn(this,Qn),Gn(this,Kn),Gn(this,qn),Wn(this,Vn,{writable:!0,value:h.f.TEXTURE_BUFFER}),Wn(this,zn,{writable:!0,value:{}}),Wn(this,Hn,{writable:!0,value:null}),Wn(this,jn,{writable:!0,value:[]}),Wn(this,Yn,{writable:!0,value:new Map}),Wn(this,Xn,{writable:!0,value:0}),a()(this,Hn,e)}acquire(e){if(!e)throw new Error("acquire() bufferConfig is invalid!");Fn(this,qn,ts).call(this,e);let t=null,r=null;if(0==n()(this,Yn).size){if(n()(this,Hn)){const i=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});let s=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),s=!0}i&&(a()(this,Xn,n()(this,Xn)+1),t=i,t.label="".concat(e.label,"-").concat(n()(this,Xn))),Fn(this,$n,as).call(this,e.level,r,s)}}else if(n()(this,Yn).has(e.level)){r=n()(this,Yn).get(e.level);let i=!1;if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}if(t=r.acquire(e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else if(t=Fn(this,es,os).call(this,e),!t)if(r.isUpToThreshold(e.level,e.bytesPerRow))console.log("[GPUBufferPool]acquire() next level cant help and pool is up to threshold! Only to wait for a while...");else{const r=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});r&&(a()(this,Xn,n()(this,Xn)+1),t=r,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}else{let i=!1;if(t=Fn(this,es,os).call(this,e),t)t.label="".concat(e.label,"-").concat(n()(this,Xn));else{const s=n()(this,Hn).createBuffer({label:e.label,size:e.size,usage:e.usage,mappedAtCreation:!0});if(!r){const t=Fn(this,Zn,ns).call(this,e);r=new Bn(e.level,t),i=!0}s&&(a()(this,Xn,n()(this,Xn)+1),t=s,t.label="".concat(e.label,"-").concat(n()(this,Xn)))}i&&Fn(this,$n,as).call(this,e.level,r,i)}return t&&n()(this,jn).push(t),t}recycle(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return;const i=n()(this,jn).indexOf(e);if(-1!=i?n()(this,jn).splice(i,1):(console.error("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r)),Object(o.o)("[BufferPool] buffer can't be recycled. bufferConfig:".concat(JSON.stringify(t),", needToRecycle=").concat(r))),t)if(r){"unmapped"!=e.mapState&&e.unmap(),"unmapped"==e.mapState&&Fn(this,Jn,ss).call(this,e).then(()=>{}).catch(t=>{console.warn("mapAsyncBuffer() error:".concat(t)),e.destroy(),e=null});let r=n()(this,Yn).get(t.level);r&&r.recycle(t.level,t.bytesPerRow,e),e.label=""}else e.destroy(),e=null;else e.destroy()}recycleInUsedGPUBuffers(e,t){for(const[r,i]of e)for(const e of i)if(e){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),this.recycle(r.buffer,r.bufferConfig)),e.destroyTextureBufferGroup(t)}}recycleTextureBufferGroup(e,t){if(e&&t){const r=t.acquireGPUBufferPool();if(r){const i=e.getTextureBufferGroup();i&&i.buffer&&(i.bufferArray&&(i.bufferArray=null),r.recycle(i.buffer,i.bufferConfig),e.destroyTextureBufferGroup(t))}}}cleanup(){for(const e of n()(this,jn))"unmapped"!=e.mapState&&e.unmap(),e.destroy();n()(this,jn).length=0;for(const[e,t]of n()(this,Yn))t&&t.cleanup();n()(this,Yn).clear()}release(e){if(e==h.n.OVERUSE){for(const[t,r]of n()(this,Yn))r&&r.release(e);n()(this,Yn).clear()}}getResourceType(){return n()(this,Vn)}collectResourceInfo(){let e=0,t=0,r="";for(const[i,s]of n()(this,Yn))if(s){const n=s.getPool();for(const[a,o]of n){e+=o.length;let n=0,h=0;for(const e of o)t+=e.size,"mapped"==e.mapState?n+=1:h+=1;r+="[GPUBufferPool] level:".concat(i," bpr:").concat(a," threshold:").concat(s.getPoolThreshold()," pool:{len:").concat(o.length," ava_count:").concat(n," pending_count:").concat(h,"}\n")}}let i=0;for(const r of n()(this,jn))e+=1,t+=r.size,i+=1;return r+="[GPUBufferPool] in_used_count:".concat(i,"\n"),r+="[GPUBufferPool] total: count:".concat(e," usedBytes:").concat(t,"\n"),n()(this,zn).type=n()(this,Vn),n()(this,zn).count=e,n()(this,zn).usedBytes=t,n()(this,zn).output=r,n()(this,zn)}onOccupancyLevelEvaluated(e){Object(o.o)("WGPU GPUBufferPool_onOccupancyLevelEvaluated() level:".concat(e)),console.log("[GPUBufferPool] onOccupancyLevelEvaluated() level:".concat(e)),this.release(e)}getInUsedPoolCount(){return n()(this,jn).length}};function us(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var ls=new WeakMap,cs=new WeakMap;var ds=class{constructor(e){us(this,ls,{writable:!0,value:null}),us(this,cs,{writable:!0,value:null}),a()(this,ls,e),e&&a()(this,cs,e.features)}getAdapterFeatures(){return n()(this,cs)}getAdapterLimits(){return n()(this,ls)?n()(this,ls).limits:null}queryMaxTextureDimension2D(){const e=this.getAdapterLimits();return e?e.maxTextureDimension2D:0}queryMaxBufferSize(){const e=this.getAdapterLimits();return e?e.maxBufferSize:0}queryAdapterFeature(e){return!(!n()(this,cs)||!e)&&n()(this,cs).has(e)}isTimestampQuerySupported(){return this.queryAdapterFeature("timestamp-query")}getGPUAdapter(){return n()(this,ls)}cleanup(){a()(this,ls,null),a()(this,cs,null)}};function fs(e,t){gs(e,t),t.add(e)}function ps(e,t,r){gs(e,t),t.set(e,r)}function gs(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ms(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}var _s=new WeakMap,vs=new WeakMap,bs=new WeakMap,ws=new WeakMap,ys=new WeakSet,xs=new WeakSet,Ts=new WeakSet;function Rs(){let e=h.n.LOW;const t="---WatchDog(".concat(n()(this,ws),") starts analyzing---\n");console.log("".concat(t));for(const t of n()(this,vs)){const r=t.collectResourceInfo();console.log("".concat(r.output));const i=ms(this,xs,Es).call(this,r);t.onOccupancyLevelEvaluated(i),i>e&&(e=i)}const r=ms(this,Ts,Ss).call(this,e);r!=n()(this,_s)&&(clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,r),this.monitor())}function Es(e){let t=h.n.LOW;return e.type==h.f.TEXTURE?t=e.usedBytes<=31457280?h.n.LOW:e.usedBytes<=94371840?h.n.MEDIUM:e.usedBytes<=157286400?h.n.HIGH:h.n.OVERUSE:e.type==h.f.VERTEX_BUFFER?t=e.usedBytes<=5242880?h.n.LOW:e.usedBytes<=10485760?h.n.MEDIUM:e.usedBytes<=15728640?h.n.HIGH:h.n.OVERUSE:e.type==h.f.TEXTURE_BUFFER&&(t=e.usedBytes<=52428800?h.n.LOW:e.usedBytes<=104857600?h.n.MEDIUM:e.usedBytes<=209715200?h.n.HIGH:h.n.OVERUSE),t}function Ss(e){let t=0;switch(e){case h.n.LOW:t=h.o.LOW;break;case h.n.MEDIUM:t=h.o.MEDIUM;break;case h.n.HIGH:t=h.o.HIGH;break;case h.n.OVERUSE:t=h.o.OVERUSE;break;default:t=h.o.MEDIUM}return t}var As=class{constructor(e){fs(this,Ts),fs(this,xs),fs(this,ys),ps(this,_s,{writable:!0,value:h.o.HIGH}),ps(this,vs,{writable:!0,value:[]}),ps(this,bs,{writable:!0,value:null}),ps(this,ws,{writable:!0,value:""}),a()(this,ws,e)}addObservable(e){n()(this,vs).push(e)}removeObservable(e){const t=n()(this,vs).indexOf(e);-1!=t&&n()(this,vs).splice(t,1)}removeAllObservables(){n()(this,vs).length=0}monitor(){n()(this,bs)||a()(this,bs,setInterval(()=>{ms(this,ys,Rs).call(this)},n()(this,_s)))}cleanup(){this.removeAllObservables(),clearInterval(n()(this,bs)),a()(this,bs,null),a()(this,_s,0)}};function ks(e,t,r){Ms(e,t),t.set(e,r)}function Ms(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}var Cs=new WeakMap,Ps=new WeakMap,Us=new WeakMap,Ls=new WeakMap,Is=new WeakMap,Os=new WeakMap,Ds=new WeakMap,Bs=new WeakMap,Gs=new WeakMap,Ws=new WeakMap,Ns=new WeakMap,Fs=new WeakSet;function Vs(e){return void 0!==e&&"yPlaneTex"in e}var zs=class{constructor(){var e,t;Ms(e=this,t=Fs),t.add(e),ks(this,Cs,{writable:!0,value:null}),ks(this,Ps,{writable:!0,value:null}),ks(this,Us,{writable:!0,value:null}),ks(this,Ls,{writable:!0,value:null}),ks(this,Is,{writable:!0,value:null}),ks(this,Os,{writable:!0,value:null}),ks(this,Ds,{writable:!0,value:null}),ks(this,Bs,{writable:!0,value:null}),ks(this,Gs,{writable:!0,value:null}),ks(this,Ws,{writable:!0,value:null}),ks(this,Ns,{writable:!0,value:""})}addRendererProviderModule(e){a()(this,Ws,e)}setLabel(e){a()(this,Ns,e)}async initialize(){if(navigator.gpu){if(!n()(this,Cs)&&(a()(this,Cs,await navigator.gpu.requestAdapter()),!n()(this,Cs)))return console.error("[WebGPUResManager] initialize() Couldn't request WebGPU adapter."),Object(o.u)("WebGPU device was lost: ".concat(info.message," reason=").concat(info.reason)),void Object(o.p)("WebGPUDeviceLost");n()(this,Us)||(a()(this,Us,await n()(this,Cs).requestDevice()),n()(this,Us).lost.then(async e=>{"destroyed"!=e.reason&&(console.error("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.u)("WebGPU device was lost: ".concat(e.message," reason=").concat(e.reason)),Object(o.p)("WebGPUDeviceLost")),n()(this,Ws)&&n()(this,Ws).rendererUnconfigureGPUContext(),this.cleanup(),"destroyed"!=e.reason&&(a()(this,Us,null),await this.initialize(),n()(this,Ws)&&n()(this,Ws).rendererReinitialize())})),n()(this,Ps)||("function"==typeof n()(this,Cs).requestAdapterInfo?a()(this,Ps,await n()(this,Cs).requestAdapterInfo()):"info"in n()(this,Cs)&&a()(this,Ps,n()(this,Cs).info)),n()(this,Ls)||a()(this,Ls,navigator.gpu.getPreferredCanvasFormat()),n()(this,Is)||a()(this,Is,new $i(n()(this,Us))),n()(this,Os)||a()(this,Os,new Rn(n()(this,Us))),n()(this,Ds)||a()(this,Ds,new hs(n()(this,Us))),n()(this,Bs)||a()(this,Bs,new ds(n()(this,Cs))),n()(this,Gs)||(a()(this,Gs,new As(n()(this,Ns))),n()(this,Gs).addObservable(n()(this,Is)),n()(this,Gs).addObservable(n()(this,Os)),n()(this,Gs).addObservable(n()(this,Ds)),n()(this,Gs).monitor())}else console.error("[WebGPUResManager] initialize() WebGPU is not supported!")}acquireGPUDevice(){return n()(this,Us)}acquireCanvasFormat(){return n()(this,Ls)}acquireGPUAdapterInfo(){return n()(this,Ps)}destroyGPUDevice(){n()(this,Us)&&(n()(this,Us).destroy(),a()(this,Us,null))}acquireGPUBufferMgr(){return n()(this,Is)}acquireGPUTextureMgr(){return n()(this,Os)}acquireGPUBufferPool(){return n()(this,Ds)}acquireGPUFeaturesHelper(){return n()(this,Bs)}cleanup(){n()(this,Is)&&(n()(this,Is).cleanup(),a()(this,Is,null)),n()(this,Os)&&(n()(this,Os).cleanup(),a()(this,Os,null)),n()(this,Ds)&&(n()(this,Ds).cleanup(),a()(this,Ds,null)),n()(this,Bs)&&(n()(this,Bs).cleanup(),a()(this,Bs,null)),n()(this,Gs)&&(n()(this,Gs).cleanup(),a()(this,Gs,null)),a()(this,Ws,null),this.destroyGPUDevice()}recycleTextureBufferGroup(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&n()(this,Ds)){const r=e.getTextureBufferGroup();r&&r.buffer&&(r.bufferArray&&(r.bufferArray=null),n()(this,Ds).recycle(r.buffer,r.bufferConfig,t),e.destroyTextureBufferGroup(this))}}recycleInUsedGPUBuffers(e){for(const[t,r]of e)for(const e of r)if(e){const t=e.getTextureBufferGroup();t&&t.buffer&&(t.bufferArray&&(t.bufferArray=null),n()(this,Ds).recycle(t.buffer,t.bufferConfig)),e.destroyTextureBufferGroup(this)}}requestTextureBuffer(e){if(!n()(this,Ds))return null;if(Object(xt.f)(this,e.size))return Object(o.u)("requestTextureBuffer() a buffer size that exceeds the max size of GPUBuffer is required.(size:".concat(e.size,")")),null;const t=GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC;return e.usage=t,n()(this,Ds).acquire(e)}destroyTextureGroup(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const r=e.getTextureGroup();if(!r)return;if(!n()(this,Os))return void Object(o.u)("destroyTextureGroup() mGPUTextureMgr is undefined!");const i=e.getTextureType();r&&(i==h.x.GPU_TEX_YUV||i!=h.x.GPU_TEX_RGBA&&function(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,Fs,Vs).call(this,r)?(n()(this,Os).recycleTexture(r.yPlaneTex,t),n()(this,Os).recycleTexture(r.uPlaneTex,t),r.vPlaneTex&&n()(this,Os).recycleTexture(r.vPlaneTex,t)):n()(this,Os).recycleTexture(r,t),e.setTextureGroup(null))}};function Hs(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var js=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,qs=new WeakMap,Ks=new WeakMap;t.a=class{constructor(e){Hs(this,js,{writable:!0,value:""}),Hs(this,Ys,{writable:!0,value:new ze}),Hs(this,Xs,{writable:!0,value:new Hi}),Hs(this,qs,{writable:!0,value:new Qe}),Hs(this,Ks,{writable:!0,value:new zs}),a()(this,js,e),n()(this,Ks).addRendererProviderModule(n()(this,Ys)),n()(this,Ks).setLabel(n()(this,js)),n()(this,Xs).setGPUResourceMgr(n()(this,Ks))}isEnableCanvasAlphaChannel(){return n()(this,Xs).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){n()(this,Xs).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await n()(this,Ys).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,r,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=n()(this,Ys).getRendererType(),o=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).getVideoRenderDisplay(a,e,t,r,i,o,s)}createWebGLVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):n()(this,Ys).isWebGLRendererType()?n()(this,Xs).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):null}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=n()(this,Ys).getRendererType(),a=n()(this,Ys).acquireRenderer(e,n()(this,Ks));return n()(this,Xs).createVideoRenderDisplay(s,e,t,r,a,i)}getSharingRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType(),s=n()(this,Ys).acquireRenderer(e,n()(this,Ks),!0);return r||(r={}),r.clearCache=!0,n()(this,Xs).getSharingRenderDisplay(i,e,t,s,r)}recycleRenderDisplay(e,t,r){const i=n()(this,Ys).getRendererType();n()(this,Xs).recycleRenderDisplay(i,e,t,n()(this,Ks),r)}renderFor(e){if(n()(this,Ys).isWebGPURendererType()){const t=n()(this,Ys).getRendererType(),r=n()(this,Xs).collectInUseRenderDisplays(t,e);r&&r.forEach(e=>{const t=n()(this,Ys).acquireRenderer(e.canvas,n()(this,Ks));n()(this,qs).render(t,e.renderDisplays)})}}renderWith(e){if(n()(this,Ys).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const r=n()(this,Ys).acquireRenderer(t,n()(this,Ks)),i=[];i.push(e),n()(this,qs).render(r,i)}}}getRenderDisplayMap(e){const t=n()(this,Ys).getRendererType();return n()(this,Xs).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,r,i,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return n()(this,Ys).isWebGLRendererType()||n()(this,Ys).isWebGL2RendererType()?n()(this,Xs).onRestoredFromContextLost(e,t,r,i,s,a):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&n()(this,Ys).isWebGPURendererType()&&e.close()}getRendererProvider(){return n()(this,Ys)}getRenderDisplayManager(){return n()(this,Xs)}getWebGPUResMgr(){return n()(this,Ks)}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];n()(this,Ys)&&n()(this,Ys).cleanup(),n()(this,Xs)&&n()(this,Xs).cleanup(e,t,n()(this,Ks),r),r||n()(this,Ks)&&n()(this,Ks).cleanup()}clearOffscreenCanvas(e){n()(this,Xs)&&n()(this,Xs).cleanupByCanvas(e)}}},function(e,t,r){var i=r(24).default,n=r(35);e.exports=function(e){var t=n(e,"string");return"symbol"===i(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(24).default;e.exports=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var i=r(15),n=r(4),s=r(5),a=r(2),o=r(30),h=r(27),u=r(3);function l(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new h.a,this.sharingQueue=new h.a,this.WaterMarkRGBA=new o.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=n.B,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null}l.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},l.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},l.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},l.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},l.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},l.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},l.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let r=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-r,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},l.prototype.JsMediaSDK_SharingRender=function(){var e,t,r;if(this.sharingDisplay)if(!1!==(null===(e=(t=this.sharingDisplay).isAvaiable)||void 0===e?void 0:e.call(t))){null===(r=this.statisticObj)||void 0===r||r.sample();var n=this.Get_Decoded_Sharing_Frame(this.currentshareactive,this.isFromMainSession),o=this.Get_Decoded_Mouse_Frame(this.currentshareactive,this.isFromMainSession);if(n){let e,t;this.lRTimeStamp=n.ntptime,n.yuvdata instanceof u.m?(e=n.yuvdata.yuvdata,t=n.yuvdata):(e=n.yuvdata,t=null),this.sharingWidthAndHeightInfo.logicWidth==n.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==n.logic_h||(this.PubSub?PubSub.publish(i.g,{body:{width:n.logic_w,height:n.logic_h,logicWidth:n.logic_w,logicHeight:n.logic_h}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=n.logic_w,this.sharingWidthAndHeightInfo.logicHeight=n.logic_h);var h=n.logic_h,l=n.logic_w,c=n.r_h,d=n.r_w;this.xratio=d/l,this.yratio=c/h;var f={top:n.r_x,left:n.r_y,height:n.r_h,width:n.r_w};this.currentSharingHeight==n.r_h&&this.currentSharingWidth==n.r_w&&this.currentSharingLogicHeight==n.logic_h&&this.currentSharingLogicWidth==n.logic_w||(this.Notify_APPUI?this.Notify_APPUI(i.f,{body:{height:n.logic_h,width:n.logic_w,logicHeight:n.logic_h,logicWidth:n.logic_w}}):(postMessage({status:s.eb,logicWidth:n.logic_w,logicHeight:n.logic_h}),this.updateOffscreenCanvasSize(n.logic_w,n.logic_h)),this.currentSharingHeight=n.r_h,this.currentSharingWidth=n.r_w,this.currentSharingLogicHeight=n.logic_h,this.currentSharingLogicWidth=n.logic_w);const r=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:n.r_w,a=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:n.r_h;this.Should_Update_Watermark(this.sharingDisplay,r,a)&&this.Update_Display_Watermark(this.sharingDisplay,r,a),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:s.X,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOutputPictureFrame(n.width,n.height,f,e,null,n.yuv_limited),t&&t.recycle(),n.dataptr&&Module._free(n.dataptr)}else if(this.brefresh&&(this.brefresh=!1,0!=this.sharingDisplay.getTextureWidth()&&0!=this.sharingDisplay.getTextureHeight()&&0!==this.currentSharingWidth&&0!==this.currentSharingHeight)){const e=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:this.currentSharingWidth,t=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:this.currentSharingHeight;this.Should_Update_Watermark(this.sharingDisplay,e,t)&&this.Update_Display_Watermark(this.sharingDisplay,e,t),this.sharingDisplay.drawNextOutputPictureFrame(this.sharingDisplay.getTextureWidth(),this.sharingDisplay.getTextureHeight(),this.sharingDisplay.getCroppingParams(),null,this.picRotation,!0,null,!1),n=!0}o&&(this.Cursorx=o.r_x*this.xratio,this.Cursory=o.r_y*this.yratio,this.CursorWidth=o.width*this.xratio,this.CursorHeight=o.height*this.yratio,this.sharingDisplay.updateCursor(o.width,o.height,o.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:s.X,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.drawCursor(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight)),n&&this.renderManager.renderFor(a.t.SHARE)}else{var p,g;null===(p=(g=this.sharingDisplay).restoreContext)||void 0===p||p.call(g)}else Object(u.u)("JsMediaSDK_SharingRender error, display is null")},l.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},l.prototype.updateOffscreenCanvasSize=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!r)return console.log("drop logic w/h");try{let r=this.sharingDisplay.getAttachedCanvas();r&&r instanceof OffscreenCanvas&&(r.width=e,r.height=t,this.brefresh=!0)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},l.prototype.Set_Render_Display=function(e){this.sharingDisplay=e},l.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},l.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:r,sharingWaterMarkName:i,watermarkOpacity:n,watermarkRepeated:s,watermarkPosition:a}=e;r||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=r,this.sharingWaterMarkName=i,void 0!==s&&(this.isWaterMarkRepeatedEnable=!!s),void 0!==n&&(this.waterMarkOpacity=n),void 0!==a&&(this.watermarkPosition=a)},l.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},l.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.setWatermarkFlag(e?1:0)},l.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const c=function(e,t){if(e<640&&e){const r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};l.prototype.Update_Display_Watermark=function(e,t,r){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const i=t<512||r<288?16:this.watermarkPosition,n=this.Should_Watermark_Repeated(t,r),s=c(t,r);t=s.width,r=s.height;const a=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:i});e.updateWatermark(t,r,a)},l.prototype.Should_Update_Watermark=function(e,t,r){if(!this.isCreateSharingWaterMark)return!1;let i=!1;const n=c(t,r);n.width===e.getWatermarkWidth()&&n.height===e.getWatermarkHeight()||(i=!0);const s=this.Should_Watermark_Repeated(t,r);e.isSetWatermark()||(i=!0),s!==e.isWatermarkRepeated()&&(i=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(i=!0,e.setWatermarkOpacity(this.waterMarkOpacity));const a=t<512||r<288?16:this.watermarkPosition;return a!==e.getWatermarkPosition()&&(i=!0,e.setWatermarkPosition(a)),i},l.prototype.Update_Sharing_Canvas_Size=function(e){let{width:t,height:r}=e;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(r)}},l.prototype.ClearQueue=function(){try{let e=this.sharingQueue.ssrcQueueMap;for(let[t,r]of e)for(;!r.isEmpty();){let e=r.dequeue();e.yuvdata&&e.yuvdata instanceof u.m&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},l.prototype.Get_Decoded_Sharing_Frame=function(e,t){if(!this.sharingQueue)return null;var r=this.GetLogicalSSRCPart(e,t),i=this.sharingQueue.GetQueue(r);return i?i.dequeue():null},l.prototype.Get_Decoded_Mouse_Frame=function(e,t){if(this.mouseQueue){var r=this.GetLogicalSSRCPart(e,t),i=this.mouseQueue.GetQueue(r);return i?i.dequeue():null}},l.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var r=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||r!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(i.e,this.currentshareactive):postMessage({status:s.F,ssrc:this.currentshareactive}));var n=this.sharingQueue.GetQueue(r);n||(n=this.sharingQueue.AddQueue(r)),n.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var a=this.sharingQueue.GetQueueLength(r),o=a-t;for(this.maxQueueLength=t;o>=0;){let t=this.Get_Decoded_Sharing_Frame(e.ssrc,e.isFromMainSession);t.yuvdata instanceof u.m&&t.yuvdata.recycle(),t.dataptr&&Module._free(t.dataptr),o--}}},l.prototype.Get_Current_QueueLength=function(){if(!this.sharingQueue)return;let e=this.currentshareactive;var t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)},l.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),r=this.mouseQueue.GetQueue(t);r||(r=this.mouseQueue.AddQueue(t)),r.enqueue(e);for(var i=this.mouseQueue.GetQueueLength(t)-10;i>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc,e.isFromMainSession),i--}},l.prototype.GetLogicalSSRCPart=function(e,t){let r=e>>10;return t&&(r|=1<<23),r},l.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},l.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(u.u)(e,t)},l.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):Object(u.t)(e)},l.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},l.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval(()=>{this.No_Bindthis_Interval()},20)):(this.Start_Draw(),this.startRAFHealthCheck())},l.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},l.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval(()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(n.C),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))},2e3)},l.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)},t.a=l},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channel_Agent",(function(){return Dt})),r.d(t,"Open_Sharing_WebSocket_Connect",(function(){return Bt})),r.d(t,"sharing_websocket_on_open",(function(){return Gt})),r.d(t,"sharing_websocket_on_message",(function(){return Wt})),r.d(t,"sharing_websocket_on_close",(function(){return Nt})),r.d(t,"sharing_websocket_on_error",(function(){return Ft})),r.d(t,"JsMediaSDK_Log",(function(){return Vt})),r.d(t,"Recieve_Wb_Packet",(function(){return zt})),r.d(t,"Send_Wb_Rtp_Packet",(function(){return Ht})),r.d(t,"wcl_trace_log",(function(){return jt})),r.d(t,"sharing_qos_monitor",(function(){return Qt})),r.d(t,"responseSharingQosData",(function(){return Zt})),r.d(t,"frame_callback_video_mode",(function(){return $t})),r.d(t,"frame_callback_mouse_video_mode",(function(){return er})),r.d(t,"Send_Data",(function(){return tr})),r.d(t,"decode_callback",(function(){return rr})),r.d(t,"SubScribeUpdateSharing",(function(){return ir})),r.d(t,"IsSupportMultiThread",(function(){return ar})),r.d(t,"hardcodecpunumber",(function(){return or})),r.d(t,"LimitWebCodecsEncoderTo360_js",(function(){return hr})),r.d(t,"LimitWebCodecsDecoderTo360_js",(function(){return ur})),r.d(t,"UserAgentIsTesla_js",(function(){return lr})),r.d(t,"IsSupportMultiThreadForWebcodec",(function(){return cr})),r.d(t,"getGraphicName",(function(){return dr})),r.d(t,"getVendorName",(function(){return fr})),r.d(t,"GetCscThreadNum",(function(){return pr})),r.d(t,"GetEncThreadNum",(function(){return gr})),r.d(t,"Sharing_Decode",(function(){return mr})),r.d(t,"GetLogLevel_js",(function(){return _r})),r.d(t,"Send_Data_Codec",(function(){return vr})),r.d(t,"LOG_OUT",(function(){return br})),r.d(t,"Utf8ArrayToStr",(function(){return wr})),r.d(t,"Write_App_Log",(function(){return yr})),r.d(t,"Pace_Sender",(function(){return Rr})),r.d(t,"Compute_WebSocket_Speed",(function(){return Er})),r.d(t,"Compute_Capture_Delay",(function(){return Sr})),r.d(t,"APP_Troubleshoting_Info",(function(){return Ar})),r.d(t,"Sharing_Capture",(function(){return kr})),r.d(t,"Update_WebSokcet_Speed",(function(){return Mr})),r.d(t,"SAVE_IV",(function(){return Cr})),r.d(t,"getWasmMemory",(function(){return Pr})),r.d(t,"freeWasmMemory",(function(){return Ur})),r.d(t,"MCMMonitor_Sharing_LOG",(function(){return Wr})),r.d(t,"Send_Out_Qos",(function(){return Nr})),r.d(t,"BigLog_js",(function(){return jr})),r.d(t,"Set_Share_Mode_js",(function(){return Yr})),r.d(t,"checkWebCodecWhitelist_js",(function(){return Jr})),r.d(t,"UserWebCodecController_js",(function(){return $r}));var i=r(3),n=r(4),s=r(5),a=r(36),o=r(12),h=r(15),u=r(29),l=r(14),c=r(31),d=r(18),f=r(33),p=r(19),g=r(8),m=r(11),_=r(26),v=r(13),b=r(23),w=r(6),y=r(25);const x=r(46);var T,R,E,S,A,k,M,C,P,U,L,I,O,D,B,G,W,N,F,V;self.wasmSuccessEvent=s.Z,self.wasmFailEvent=s.Y,self.downloadAndInstantiateWebAssembly=i.q,self.onunhandledrejection=e=>{Object(i.u)("Unhandled rejection in worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null)};var z,H,j,Y,X,q,K,Q,Z,J=new Map,$=!1,ee=!1,te=0,re=0,ie=0,ne=!1;const se=new f.a("sharing");var ae,oe,he,ue=null,le=new _.a(s.W,!0);self.onWasmModuleReady=()=>{T=Module.cwrap("_Sharing_Encode","number",["number","number","number","number","number","number"]),k=Module.cwrap("_Sharing_Encode_Mouse_Data","number",["number","number","number"]),R=Module.cwrap("_Sharing_Encode_Uninit","number",["number"]),E=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","array","number"]),S=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","number","number"]),A=Module.cwrap("_Sharing_Encode_Init","number",["number","string","string","number","number","number","boolean","boolean","boolean"]),M=Module.cwrap("_Sharing_Set_Data_Encryption","number",["number","number"]),F=Module.cwrap("_Request_Sharing_Qos_Data","number",["number","boolean","boolean"]),C=Module.cwrap("_Sharing_Pause_Encode","number",["number"]),Module.cwrap("_Sharing_Stop_Encode","number",["number"]),P=Module.cwrap("_Sharing_Resume_Encode","number",["number"]),U=Module.cwrap("_Sharing_Websocket_Speed","number",["number","number"]),L=Module.cwrap("_Add_Sharing_Cooker_info","number",["number","number","number","number"]),O=Module.cwrap("_Get_Sharing_Meat_Weight","number",["number"]),I=Module.cwrap("_Remove_Sharing_Cooker_Info","number",["number","number"]),D=Module.cwrap("_Set_Sharing_Encryption_Key_Directly","number",["number","number","number","number"]),B=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),G=Module.cwrap("_Add_Rev_Channel","number",["number","number","number","number"]),W=Module.cwrap("_Remove_Rev_Channel","number",["number","number"]),N=Module.cwrap("_update_sharing_uplink_bandwidth_limitation_by_server","number",["number","number"]),V=Module.cwrap("_set_annotation_action","number",["number","number","number","number"]),H=Module.cwrap("_collect_sharing_monitor_info","number",["number","boolean","boolean"]),j=Module.cwrap("_Change_Connect_Type_For_Sharing","number",["number","number"]),Y=Module.cwrap("_request_nack_t_periodically_for_sharing_qos","number",["number"]),ae=Module.cwrap("_Jpeg_Init","number",[]),Module.cwrap("_Jpeg_Uninit","number",["number"]),oe=Module.cwrap("_Jpeg_HeardInfo","number",["number","number","number"]),he=Module.cwrap("_Jpeg_Decode","number",["number","number","number","number","number","number"]),Module._malloc=function(){let e=Module.asm.malloc.apply(null,arguments);if(!e&&!ne){ne=!0,Object(i.o)("MEMERR:SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));let e=new Error("memry malloc error SHARE-".concat(ht,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0]));Object(i.u)("memry malloc error",e)}return e},"undefined"!=typeof _malloc&&(_malloc=Module._malloc)};var ce,de,fe,pe,ge,me,_e,ve,be,we,ye,xe,Te,Re,Ee,Se,Ae,ke=0,Me=null,Ce=0,Pe=0,Ue=0,Le=null,Ie=null,Oe=null,De=null,Be=!1,Ge=!1,We=!1,Ne=null,Fe=!1,Ve=0,ze=0,He=0,je=0,Ye=new m.a,Xe=new m.a,qe=!1,Ke=0,Qe=0,Ze=0,Je=null,$e=null,et=!1,tt=!1,rt=null,it=null,nt=null,st=null,at=null,ot=!0,ht=!1,ut=new m.a,lt=n.L,ct=!1,dt=!1,ft=1,pt=!1,gt=0,mt=0,_t=!1,vt=n.d.DESKTOP_SOURCE,bt=0,wt=null,yt=null,xt=0,Tt=null,Rt=0,Et=null,St=0,At=0,kt=!1,Mt=[],Ct=[],Pt=[];function Ut(e,t){postMessage({status:s.H,data:"".concat(e,":").concat(t)})}function Lt(e,t){Object(i.o)("".concat(e,":").concat(t,":F"))}var It=new l.b({tag:"WCL_M,ASRENDER_ERR",interval:1e4,reportcallback:function(e,t,r,i){Ut(e,"".concat(t,",").concat(r,",").concat(i))}}),Ot=new c.a({tag:"WCL,AS",report_call:Ut});function Dt(){function e(e){let t=null,r=n.db,s=null,a=e.onmessage,o=e.onopen,h=e.onclose;e.onmessage=r=>{t=(new Date).getTime(),a.call(e,r)},e.onopen=i=>{t=(new Date).getTime(),function(){if(s)return;s=setInterval(()=>{var i;(new Date).getTime()-t>=1e3*r&&(clearInterval(s),s=null,null===(i=e.socket)||void 0===i||i.close())},1e3)}(),o.call(e,i,e)},e.onclose=t=>{try{clearInterval(s)}catch(e){Object(i.u)("WebSocket closed",e)}h.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,r,i,n,s){this.websocketaddress=t,this.onopen=r,this.onmessage=i,this.onerror=n,this.onclose=s,e(this)},this.connect=function(e,t,r,n,a){var o=this;Object(i.o)("SB"),o.init(e,t,r,n,a),o.reconnect=function(){if(o.isReconnectNow||o.isTimerExist)return;o.isReconnectNow=!0,o.isTimerExist=!0;let e=0;o.startwebsocketreconnecttime&&((new Date).getTime()/1e3-o.startwebsocketreconnecttime<3?e=5:o.connectIndex=0);let t=Math.max(Math.min(Math.pow(2,o.connectIndex)-1,31),e);o.connectIndex+=1,setTimeout(()=>{o.activeclosewebsocket||(o.isTimerExist=!1,o.startwebsocketreconnecttime=null,o.socket=new WebSocket(this.websocketaddress),o.socket.binaryType="arraybuffer",o.socket.onopen=function(e){o.isReconnectNow=!1,Object(i.o)("SE"),o.startwebsocketreconnecttime=(new Date).getTime()/1e3,o.onopen(e)},o.socket.onmessage=function(e){o.onmessage(e)},o.socket.onerror=function(e){Object(i.o)("SCLOSE"),o.socket.close()},o.socket.onclose=function(e){Object(i.o)("SCLOSE"),o.isReconnectNow=!1,o.onclose(e),o.activeclosewebsocket||(o.connectIndex<10?o.reconnect():(postMessage({status:s.ab}),Object(i.u)("NetWork is Bad, Don't to reconnect the serer!")))})},1e3*t)},o.reconnect()},this.send=function(e){ht||1!=Le.socket.readyState?(ke+=e.length,Xe.enqueue(e),Rr()):Le.socket.send(e)},this.close=function(){try{var e;this.activeclosewebsocket=!0,null===(e=this.socket)||void 0===e||e.close()}catch(e){console.warn("force close",e)}}}function Bt(e,t,r,n,s){Object(i.o)("WSURL:false:".concat(e));var a=new Dt;return a.connect(e,t,r,n,s),a}function Gt(){postMessage({status:s.bb})}Ot.threshold=300;function Wt(t){let r=new Uint8Array(t.data);if(!(r.length<4))if(37!==r[0]){if(102!=r[0]){if(r[0]==n.t.SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME){if(!$||!Ie||vt!=n.d.UAC_SOURCE)return;let t,i=0;if(t=x.inflate(e.from(r.subarray(4,r.length)),{windowBits:31}),i=t.length,i>xt&&(yt&&Module._free(yt),xt=3*i/2,yt=Module._malloc(xt)),!yt)return xt=0,void console.error("Couldn't allocate memory");writeArrayToMemory(t,yt);let s=oe(wt,yt,i);if(!s)return;let a=65535&s,o=s>>16&65535,h=a*o*4;if(h>Rt&&(Tt&&Module._free(Tt),Rt=h,Tt=Module._malloc(h)),!Tt)return Rt=0,void console.error("Couldn't allocate memory");if(bt++,s=he(wt,yt,i,o,a,Tt),0!=s)return;return ni(o,a),1!=xe&&(xe=1),void T(Ie,Tt,h,o,a,xe)}if(r[0]!=n.t.SHARE_REMOTE_CONTROL_UAC_MOUSE)if(111!=r[0])if(109!=r[0]){if(0==r[0])Le&&Le.send(r);else if(Ie)if(Ge){if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);Ye.enqueue(e);let r=Ye.dequeue();for(;r;)E(Ie,r,r.length),r=Ye.dequeue()}}else mr(t.data);else if(t.data instanceof ArrayBuffer){let e=new Uint8Array(t.data);0!=e[0]&&Ye.enqueue(e)}}else Oe&&E(Oe,r,r.length);else 1==r[4]?(Object(i.o)("UAC_START"),bt=0,wt||(wt=ae()),vt=n.d.UAC_SOURCE):(Object(i.o)("UAC_STOP"),Object(i.o)("UAC_ASCAPTURE:".concat(bt)),vt=n.d.DESKTOP_SOURCE,We=!0,Tt&&Module._free(Tt),Tt=null,Rt=0,yt&&Module._free(yt),yt=null,xt=0,Et&&Module._free(Et),Et=null,St=0);else if(Ie&&$&&vt==n.d.UAC_SOURCE){if(r.length>St&&(Et&&Module._free(Et),St=3*r.length/2,Et=Module._malloc(St)),!Et)return void(St=0);writeArrayToMemory(r,Et),k(Ie,Et,r.length)}}}else postMessage({status:s.Q,data:r})}function Nt(e){Vt("sharing_websocket_on_close")}function Ft(e){Vt("sharing_websocket_on_error")}function Vt(e){console.log(e)}function zt(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.Cb,data:r},[r.buffer])}function Ht(e,t,r){var n=new Uint8Array(r+8),s=Object(i.d)().subarray(t+0,t+r);n.set(s,8),n[0]=109;var a=new Uint32Array(1);a[0]=e;var o=new Uint8Array(a.buffer);n.set(o,4),Object(i.y)(Le,n),le.setRtpPackets()}function jt(e,t){zr&&zr.writeWasmLog(e,t)}var Yt,Xt,qt={sharingqosIntervalId:0,sharingmonitorPanelFlag:!1,panelpollingInterval:0},Kt=!0;function Qt(){const e=()=>{if(ht&&!Kt&&Ie)F(Ie,!0);else if(!ht&&(!et||tt)){let e=kt?d.e():Ie;e&&F(e,!1)}};qt.sharingqosIntervalId&&clearInterval(qt.sharingqosIntervalId),qt.sharingmonitorPanelFlag&&(qt.sharingqosIntervalId=setInterval(e,qt.panelpollingInterval||n.y))}function Zt(e,t,r,i,n,s,a,o,u){if(qt.sharingmonitorPanelFlag){const l={width:e,height:t,fps:r,rtt:i,jitter:n,avg_loss:s,max_loss:a,bandwidth:o,rate:u};postMessage({status:h.i,data:l})}}var Jt=new Map;function $t(e,t,r,n,a,o,h,u,l,c,d,f,p,g){let m=!(g==Ie);kt=m,Jt.get(n)||(Jt.set(n,!0),postMessage({status:s.U,ssrc:n}));var _=Object(i.d)().subarray(e+0,e+t),v=Object(i.g)().subarray(r,r+8),b=0;for(let e=0;e<8;e++)b+=v[e]*Math.pow(256,e);var w=n,y=a,x=o;if(et){if(!tt)return;if(t>Yt)return void It.timeoutReport(0,performance.now());let e=new i.m(Xt);if(e.storeSync(_)){var T={yuvdata:e,ntptime:b,ssrc:w,width:y,height:x,r_x:h,r_y:u,r_w:l,r_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m};at&&at.Put_Sharing_Data_From_Queue(T,5)}}else{let e=new Uint8Array(_);postMessage({status:s.S,data:e,sharing_timestamp:b,sharing_ssrc:w,sharing_width:y,sharing_height:x,rendering_x:h,rendering_y:u,rendering_w:l,rendering_h:c,logic_w:d,logic_h:f,yuv_limited:p,isFromMainSession:m},[e.buffer])}}function er(e,t,r,n,a,o,h,u,l,c,d,f){var p=new Uint8Array(t),g=Object(i.d)().subarray(e+0,e+t);p.set(g,0,t);var m=n,_=a,v=o;let b=!(f==Ie);if(et){var w={type:"mouse_data",buffer:p,ntptime:r,ssrc:m,width:_,height:v,r_x:h,r_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b};at&&at.Put_Mouse_Data_Into_Queue(w)}else postMessage({status:s.I,data:p,mouse_timestamp:r,mouse_ssrc:m,mouse_width:_,mouse_height:v,mouse_x:h,mouse_y:u,mLogic_w:l,mLogic_h:c,sync_id:d,isFromMainSession:b},[p.buffer])}function tr(e,t,r){if(!(t<4)){var n,s=new Uint8Array(t),a=Object(i.d)().subarray(e+0,e+t);if(s.set(a,0,t),133!=s[0]&&77!=s[0]||le.setRtpPackets(),r==Ie)Object(i.y)(Le,s);else Object(i.y)(null===(n=d.h)||void 0===n?void 0:n.socket,s)}}function rr(e,t,r){let i=!(r==Ie);postMessage({status:s.T,ssrc:e,size:t,isFromMainSession:i})}function ir(e){le.setSubForMe(e)}function nr(e,t,r,i){if(ht||++te%24e4==0&&postMessage({status:s.H,data:"WCL_M,RTCPSN"+te}),t&&r){if(dt&&(77==e[0]||79==e[0])&&!ct){lt=n.K;for(var a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(n);break;case 12:case 13:s=e[r++],t+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[r++],a=e[r++],t+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&a)<<0)}return t}function yr(){Le.socket.bufferedAmount,Xe.getLength(),Sr()}var xr=0,Tr=150;function Rr(){if(0!==xr?(Tr=performance.now()-xr)>=150&&(xr=performance.now()):xr=performance.now(),Le.socket.bufferedAmount>2e4)return;if(Tr>=150&&We&&(Xe.getLength(),ke-2e4<0))We=!We,Te&&Ee?(Ne&&(Ne=null),Ee.read().then((function(e){let{done:t,value:r}=e;if(t)return void console.log("Stream is done!!!");let i={data:r};1e3==mt&&(postMessage({status:s.R}),mt=0),mt++,Br(i)}))):Ne?(kr(Ne),Ne=null):postMessage({status:s.ob});else{let e=performance.now();if(re&&ie&&He&&e-re>3e3){if(re=e,vt!=n.d.DESKTOP_SOURCE)return;T(Ie,He,ie,Ve,ze,xe)}}if(Xe.getLength()>20&&!qe){qe=!0,Ke=0;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=28,Qe=(new Date).getTime(),e[1]=0,Le.socket.send(t)}if(qe&&20==Ke){qe=!1;let e=new Int32Array(2),t=new Int8Array(e.buffer);t[0]=29,e[1]=(new Date).getTime()-Qe,Le.socket.send(t)}let e=Xe.dequeue();for(;e;){if(Ke++,Le.socket.send(e),Er(e),ke-=e.length,Le.socket.bufferedAmount>2e4)return void yr();e=Xe.dequeue()}yr()}function Er(e){var t;if(Me){var r=(new Date).getTime()/1e3;if((t=r-Me)>10){var i=Ce-Le.socket.bufferedAmount;0==Le.socket.bufferedAmount?(Ue=Ue?.8*Ue+16e4:8e5,Ie&&U(Ie,Ue)):(Pe=8*i/(1*t),Ue=Ue?.8*Ue+.2*Pe:8e5,Ie&&U(Ie,Ue)),Ce-=i,Me=r}}else Ce=0,Me=(new Date).getTime()/1e3,Ie&&U(Ie,8e5);Ce+=e.length}function Sr(){var e=ke+Ce-1e4;return 0==je||e<=0?0:je>0?e/je:void 0}function Ar(e,t){var r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),postMessage({status:s.b,data:wr(r)})}function kr(e){!Be&&e?postMessage({status:s.ob,data:e.data},[e.data.buffer]):postMessage({status:s.ob})}function Mr(e){je=je?(je+e)/2:e}function Cr(e,t){ve||(ve=setInterval((function(){Ie&&O(Ie)}),6e4));let r=new Uint8Array(t),n=Object(i.d)().subarray(e+0,e+t);r.set(n,0,t),be=r,postMessage({status:s.a,data:r})}function Pr(e){if(!e)return 0;let t=Module._malloc(e.length);return Object(i.g)().subarray(t,t+e.length).set(e,0,e.length),t}function Ur(e){e&&Module._free(e)}function Lr(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.v)(n)}function Ir(e,t){let{canvas:r,rendercanvasID:n}=t;Object(i.w)(n)}function Or(e){try{Je.canvas.width===e.width&&Je.canvas.height===e.height||(Je.canvas.width=e.width,Je.canvas.height=e.height)}catch(e){Object(i.u)("Error when updating OffScreenCanvas size",e)}}function Dr(e){let t={rect:{x:0,y:0,width:0,height:0}};return e.visibleRect.left%2!=0?t.rect.x=e.visibleRect.left-1:t.rect.x=e.visibleRect.left,e.visibleRect.top%2!=0?t.rect.y=e.visibleRect.top-1:t.rect.y=e.visibleRect.top,e.visibleRect.width%2!=0?t.rect.width=e.visibleRect.width-1:t.rect.width=e.visibleRect.width,e.visibleRect.height%2!=0?t.rect.height=e.visibleRect.height-1:t.rect.height=e.visibleRect.height,t}async function Br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.d.DESKTOP_SOURCE;if(t>> Set_Share_Mode_js")}self.addEventListener("message",(function(e){var t,r=e.data;switch(r.command){case g.p:Object(i.o)("STARTMEDIA:".concat(function(e){let t=e.confId,r=e.isPreviewMode?1:0;return r|=Qr()?2:0,"".concat(t,":").concat(r)}(r)));try{if(z||(z=setInterval(()=>{let e=kt?d.e():Ie;$&&e&&H(e,!!ht)},1e3)),r.isPreviewMode)break;Qr()||(Kr=!1,Object(i.o)("RSTHOLD")),function(e){Hr=e._id,Q=e.graphicalname,Z=e.vendorname,ce=e.meetingnumb+"",de=e.meetingid,ft=e.multiThreadNum,At=e.uplimit?e.uplimit:0,ht=!!e.encode,me=e.confId,Ge=ht,Be=!!e.isChromeOrEdge,dt=ft>1,se.setCanvasAlphaChannelEnability(e.isEnableCanvasAlphaChannel),p.a.setIsEnableCanvasCtxOptionsOpt(e.isEnableCanvasCtxOptionsOpt)}(r),Xr||(zr&&zr.init({workerType:ht?o.b.SHARING_ENCODE:o.b.SHARING_DECODE}),Xr=!0),function(e){se.getRendererProvider().setRendererType(e.rendererType),se.getRendererProvider().isWebGPURendererType()&&se.getWebGPUResMgr().initialize()}(r),function(e){if(ei||ht||((ei=Object(b.d)(w.e.SHARR_DECODE)).onmessage=Fr,ei.onopen=()=>{X=!0,Vr()},ei.onclose=()=>{X=!1,Vr()},(ti.sender||ti.reciver)&&Object(v.b)(ei,ti.sender,ti.reciver)),!e.websocket_ip_address)return;let t=e.websocket_ip_address+"&mode=1";ht&&(t=e.websocket_ip_address.slice(0,e.websocket_ip_address.length-42)+"s"+e.websocket_ip_address.slice(e.websocket_ip_address.length-41,e.websocket_ip_address.length)+"&mode=2"),Object(i.j)(Le,t)&&(Le=Bt(t,Gt,Wt,Ft,Nt))}(r),ht||(Xt||(Yt=15728640,Xt=new i.k(5,Yt)),qr()),postMessage({status:Ie||ht?s.db:s.cb})}catch(e){postMessage({status:s.cb}),Object(i.u)("sharing startr media error",e)}break;case g.b:z&&(clearInterval(z),z=null),Ie&&R(Ie),Ie=null,De&&R(De),De=null,function(){try{let e=ei;ei=null,X=!1,ti={},null==e||e.close()}catch(e){console.error("<<<< CloseDataTransport ",e)}}(),close();break;case"ENCRYPT":Fe=r.encrypt,Ie&&M(Ie,Fe?1:0);break;case g.l:qt.panelpollingInterval=r.data.pollingInterval,qt.sharingmonitorPanelFlag=r.data.enable,Qt();break;case"startSharingEncode":$=!0,r.isSupportVideoTrackReader?(xe=2,!0):(xe=1,!1),Te=!!r.isSupportMediaStreamTrackProcessor,dt&<==n.L?function(e){if(dt&&!ct){lt=n.K;for(var t=0;t{let t=parseInt(e.userid);if(e.bremove)return void(Ie&&I(Ie,t));let r=e.sn;if(16!=r.length&&32!=r.length)return;let i=Pr(r);if(Ie){let e=!1;ht&&me!=t||(e=!0),e&&L(Ie,t,i,r.length)}Ur(i),ht&&me==t&&r});break}case"SET_OFFSCREENCANVAS_WIDTH_HEIGHT":{let{width:e,height:t}=r.data;at&&(at.setOnlyAcceptUISize(!0),at.updateOffscreenCanvasSize(e,t,!0));break}case"BUILD_MS_CHANNEL_IN_BO":d.c(Bt,r.data,nr,E);break;case"SHARING_REMOVE_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASD:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.f(ii,e):Ie&&ii(Ie,e.ssrc)}break;case"SHARING_ADD_REV_CHANNEL_TYPE":{let e=r.data;Object(i.o)("ASC:".concat(e.ssrc,":").concat(!!e.isFromMainSession)),e.isFromMainSession?d.e()?d.a(ri,e):Mt.push(e):Ie?ri(Ie,e.ssrc,e.streamIndex,e.videoMode):Ct.push(e)}break;case g.r:{let e=r.data;if(e.isFromMainSession)De=d.d(A,D,e.updateParams,Pr,Ur),Mt.length>0&&(Object(i.u)("retry add recv channel for master share"),Mt.forEach(e=>{d.a(ri,e)}),Mt=[]),j(De,X?0:2);else if(Se=e,Ge)Ie&&Gr(Ie,Se.updateParams.userId,Se.updateParams.sn,Se.updateParams.encryptKey,Se.updateParams.encryptType);else if(Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t)}}break;case g.s:{let e=r.data;if(e.isFromMainSession)d.b(B,e);else if(Ie&&e.body){if(e.body.add){let t=0,r=e.body.add;for(;t{Y(Ie)},50)),ee||(ee=!0,"function"==typeof SharedArrayBuffer&&wasmMemory.buffer instanceof SharedArrayBuffer&&function(){const e=8+1500*(n.bb+1);q||(null!=(q=Module._malloc(e))?(Atomics.store(Object(i.f)().subarray(q/4,q/4+e),0,0),Atomics.store(Object(i.f)().subarray(q/4,q/4+e),1,0),ti.reciver={sab:wasmMemory,offset:q,length:e,interval:10,useCopy:!1,useOneElement:!1},Object(v.b)(ei,null,ti.reciver)):console.log("malloc failed"))}());break;case"WHITEBOARD_JOIN_MESSAGE":if(Oe||Gr(Oe=A(r.nodeId,"1","1",0,0,0,!1,!0,!1),r.nodeId,r.sn,r.encryptKey,2),!J.get(r.dcsId)){J.set(r.dcsId,!0);let e=Pr(r.EncodedSn);B(Oe,r.dcsId,e,r.EncodedSn.length),Ur(e),M(Oe,1)}if(Oe){V(Oe,0,r.dcsId,0);let e=Pr(r.data);V(Oe,1,e,r.data.length),Ur(e)}break;case"audioTimestamp":at&&at.SetcATimeStamp(r.data);break;case"vsport":Ae&&(Ae.close(),Ae=null),(Ae=e.ports[0]).onmessage=function(e){at&&at.SetcATimeStamp(e.data)};break;case g.e:{let e=r.data||{},n=!!e.hold;Object(i.o)("HOLD:".concat(n,":").concat(e.userid,":").concat(e.reinit)),n?function(e){if(Kr)return;if(me&&e.userid&&e.userid>>10!=me>>10)return void Object(i.o)("HOLDINVALID");Kr=!0,ht&&Zr();let t=Ie;Ie=null,t&&R(t),Oe&&(R(Oe),Oe=null),J.clear()}(e):(t=e,Kr&&(Kr=!1,t.reinit&&(me=t.userid,Ie||0==Hr||(qr(),postMessage({status:Ie||ht?s.db:s.cb})))))}break;case"SEND_ANNOTATION_PDU":var m;r.data instanceof Uint8Array&&(r.isPresenter||null===(m=Le)||void 0===m||m.send(r.data));break;case g.g:!function(e){let t=e.content_type,r=e.cmd,n=e.type;"PDU"==t&&(r=Object(i.a)(r),4==n&&Wt({data:r.buffer}))}(r.data)}}));var Xr=!1;function qr(){if(!Qr())return;if(_e==me&&Ie)return;Ie&&(R(Ie),Ie=null),Ie=A(me,ce,de,0,0,At,!1,!1,!0);let e=Se;if(e&&Ie){let t=Pr(e.updateParams.encryptKey);D(Ie,t,e.updateParams.encryptKey.length,e.updateParams.encryptType),Ur(t),_e=me}Ct.length>0&&(Object(i.u)("retry add recv channel for share decode"),Ct.forEach(e=>{ri(Ie,e.ssrc,e.streamIndex,e.videoMode)}),Ct=[])}var Kr=!1;function Qr(){return!Kr}function Zr(){Ot.stop(),ve&&(clearInterval(ve),ve=null),Ie&&(Xe=new m.a),Ze&&(clearInterval(Ze),Ze=0),We=!1,ke=0,ot=!0,xr=0,ie=0,re=0,pt=!0,Kt=!1,$=!1,vt=n.d.DESKTOP_SOURCE,lt!=n.L&&setTimeout((function(){pt&&(PThread.terminateAllThreads(),ct=!1,lt=n.L,gt=0,console.log("terminate multiple threads"))}),6e5),le.stopCheck()}function Jr(){return-1}function $r(){return!1}var ei=null,ti={};function ri(e,t,r,n){-1!=Pt.findIndex(r=>r.handle==e&&r.ssrc==t)&&(ii(e,t),Object(i.u)("Duplicate add sharing recv ".concat(t))),G(e,t,r,n),Object(i.o)("ASCHANNEL:".concat(t,":").concat(r)),Pt.push({ssrc:t,index:r,videoMode:n,handle:e})}function ii(e,t){let r=Pt.findIndex(r=>r.handle==e&&r.ssrc==t);-1!=r&&Pt.splice(r,1),W(e,t),Object(i.o)("RMASCHANNEL:".concat(t))}function ni(e,t){return(Ve!=e||ze!=t)&&(postMessage({status:s.w,width:e,height:t}),Ve=e,ze=t,!0)}Object(b.b)(),Object(y.a)(self)}.call(this,r(41).Buffer)},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=r(43),n=r(44),s=r(45);function a(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(h.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(i)return N(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=h.from(t,i)),h.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,a=1,o=e.length,h=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,h/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var l=-1;for(s=r;so&&(r=o-h),s=r;s>=0;s--){for(var c=!0,d=0;dn&&(i=n):i=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function E(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[n+1]))&&(h=(31&u)<<6|63&s)>127&&(l=h);break;case 3:s=e[n+1],a=e[n+2],128==(192&s)&&128==(192&a)&&(h=(15&u)<<12|(63&s)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=e[n+1],a=e[n+2],o=e[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,i,n){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(i,n),l=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,i,n,s){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function L(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function I(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function O(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,i,s){return s||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,s){return s||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}h.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},h.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*t)),i},h.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},h.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+n]=e/s&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},h.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);U(this,e,t,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(42))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){for(var t,r=u(e),i=r[0],a=r[1],o=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,a)),h=0,l=a>0?i-4:i,c=0;c>16&255,o[h++]=t>>8&255,o[h++]=255&t;2===a&&(t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4,o[h++]=255&t);1===a&&(t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2,o[h++]=t>>8&255,o[h++]=255&t);return o},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(t=e[r-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,s,a=[],o=t;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,i,n){var s,a,o=8*n-i-1,h=(1<>1,l=-7,c=r?n-1:0,d=r?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-l)-1,f>>=-l,l+=o;l>0;s=256*s+e[t+c],c+=d,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=i;l>0;a=256*a+e[t+c],c+=d,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=u}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))<1&&(a--,h*=2),(t+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(t*h-1)*Math.pow(2,n),a+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Deflate",(function(){return $t})),r.d(t,"Inflate",(function(){return ir})),r.d(t,"constants",(function(){return or})),r.d(t,"default",(function(){return hr})),r.d(t,"deflate",(function(){return er})),r.d(t,"deflateRaw",(function(){return tr})),r.d(t,"gzip",(function(){return rr})),r.d(t,"inflate",(function(){return nr})),r.d(t,"inflateRaw",(function(){return sr})),r.d(t,"ungzip",(function(){return ar}));function i(e){let t=e.length;for(;--t>=0;)e[t]=0}const n=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new Array(576);i(h);const u=new Array(60);i(u);const l=new Array(512);i(l);const c=new Array(256);i(c);const d=new Array(29);i(d);const f=new Array(30);function p(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let g,m,_;function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}i(f);const b=e=>e<256?l[e]:l[256+(e>>>7)],w=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},y=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<{y(e,r[2*t],r[2*t+1])},T=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},R=(e,t,r)=>{const i=new Array(16);let n,s,a=0;for(n=1;n<=15;n++)a=a+r[n-1]<<1,i[n]=a;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=T(i[t]++,t))}},E=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},S=e=>{e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},A=(e,t,r,i)=>{const n=2*t,s=2*r;return e[n]{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n{let i,a,o,h,u=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+u++],i+=(255&e.pending_buf[e.sym_buf+u++])<<8,a=e.pending_buf[e.sym_buf+u++],0===i?x(e,a,t):(o=c[a],x(e,o+256+1,t),h=n[o],0!==h&&(a-=d[o],y(e,a,h)),i--,o=b(i),x(e,o,r),h=s[o],0!==h&&(i-=f[o],y(e,i,h)))}while(u{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)k(e,r,a);h=s;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],k(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,r[2*h]=r[2*a]+r[2*o],e.depth[h]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,r[2*a+1]=r[2*o+1]=h,e.heap[1]=h++,k(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let u,l,c,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=r[2*r[2*l+1]+1]+1,d>h&&(d=h,g++),r[2*l+1]=d,l>i||(e.bl_count[d]++,f=0,l>=o&&(f=a[l-o]),p=r[2*l],e.opt_len+=p*(d+f),s&&(e.static_len+=p*(n[2*l+1]+f)));if(0!==g){do{for(d=h-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[h]--,g-=2}while(g>0);for(d=h;0!==d;d--)for(l=e.bl_count[d];0!==l;)c=e.heap[--u],c>i||(r[2*c+1]!==d&&(e.opt_len+=(d-r[2*c+1])*r[2*c],r[2*c+1]=d),l--)}})(e,t),R(r,u,e.bl_count)},P=(e,t,r)=>{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++o{let i,n,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++o{y(e,0+(i?1:0),3),S(e),w(e,r),w(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var O={_tr_init:e=>{L||((()=>{let e,t,r,i,o;const v=new Array(16);for(r=0,i=0;i<28;i++)for(d[i]=r,e=0;e<1<>=7;i<30;i++)for(f[i]=o<<7,e=0;e<1<{let n,s,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),C(e,e.l_desc),C(e,e.d_desc),a=(e=>{let t;for(P(e,e.dyn_ltree,e.l_desc.max_code),P(e,e.dyn_dtree,e.d_desc.max_code),C(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==t?I(e,t,r,i):4===e.strategy||s===n?(y(e,2+(i?1:0),3),M(e,h,u)):(y(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(y(e,t-257,5),y(e,r-1,5),y(e,i-4,4),n=0;n(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(c[r]+256+1)]++,e.dyn_dtree[2*b(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{y(e,2,3),x(e,256,h),(e=>{16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var D=(e,t,r,i)=>{let n=65535&e|0,s=e>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,s=s+n|0}while(--a);n%=65521,s%=65521}return n|s<<16|0};const B=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var G=(e,t,r,i)=>{const n=B,s=i+r;e^=-1;for(let r=i;r>>8^n[255&(e^t[r])];return-1^e},W={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},N={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:V,_tr_flush_block:z,_tr_tally:H,_tr_align:j}=O,{Z_NO_FLUSH:Y,Z_PARTIAL_FLUSH:X,Z_FULL_FLUSH:q,Z_FINISH:K,Z_BLOCK:Q,Z_OK:Z,Z_STREAM_END:J,Z_STREAM_ERROR:$,Z_DATA_ERROR:ee,Z_BUF_ERROR:te,Z_DEFAULT_COMPRESSION:re,Z_FILTERED:ie,Z_HUFFMAN_ONLY:ne,Z_RLE:se,Z_FIXED:ae,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:he,Z_DEFLATED:ue}=N,le=(e,t)=>(e.msg=W[t],t),ce=e=>2*e-(e>4?9:0),de=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fe=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let pe=(e,t,r)=>(t<{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},me=(e,t)=>{z(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ge(e.strm)},_e=(e,t)=>{e.pending_buf[e.pending++]=t},ve=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},be=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=D(e.adler,t,n,r):2===e.state.wrap&&(e.adler=G(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},we=(e,t)=>{let r,i,n=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const h=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,l=e.w_mask,c=e.prev,d=e.strstart+258;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(r=t,u[r+a]===p&&u[r+a-1]===f&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sa){if(e.match_start=t,a=i,i>=o)break;f=u[s+a-1],p=u[s+a]}}}while((t=c[t&l])>h&&0!=--n);return a<=e.lookahead?a:e.lookahead},ye=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-262)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fe(e),i+=t),0===e.strm.avail_in)break;if(r=be(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=pe(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=pe(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},xe=(e,t)=>{let r,i,n,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,ge(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(be(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_watern&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(be(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,s=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=s||(i||t===K)&&t!==Y&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===K&&0===e.strm.avail_in&&r===i?1:0,V(e,e.block_start,r,a),e.block_start+=r,ge(e.strm)),a?3:1)},Te=(e,t)=>{let r,i;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=we(e,r)),e.match_length>=3)if(i=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=pe(e,e.ins_h,e.window[e.strstart+1]);else i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2},Re=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<262){if(ye(e),e.lookahead<262&&t===Y)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=pe(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(me(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=H(e,0,e.window[e.strstart-1]),i&&me(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const Se=[new Ee(0,0,0,0,xe),new Ee(4,4,8,4,Te),new Ee(4,5,16,8,Te),new Ee(4,6,32,32,Te),new Ee(4,4,16,16,Re),new Ee(8,16,32,32,Re),new Ee(8,16,128,128,Re),new Ee(8,32,128,256,Re),new Ee(32,128,258,1024,Re),new Ee(32,258,258,4096,Re)];function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ue,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),de(this.dyn_ltree),de(this.dyn_dtree),de(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),de(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),de(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ke=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||42!==t.status&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&113!==t.status&&666!==t.status?1:0},Me=e=>{if(ke(e))return le(e,$);e.total_in=e.total_out=0,e.data_type=he;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=-2,F(t),Z},Ce=e=>{const t=Me(e);var r;return t===Z&&((r=e.state).window_size=2*r.w_size,de(r.head),r.max_lazy_match=Se[r.level].max_lazy,r.good_match=Se[r.level].good_length,r.nice_match=Se[r.level].nice_length,r.max_chain_length=Se[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Pe=(e,t,r,i,n,s)=>{if(!e)return $;let a=1;if(t===re&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==ue||i<8||i>15||t<0||t>9||s<0||s>ae||8===i&&1!==a)return le(e,$);8===i&&(i=9);const o=new Ae;return e.state=o,o.strm=e,o.status=42,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Pe(e,t,ue,15,8,oe),deflateInit2:Pe,deflateReset:Ce,deflateResetKeep:Me,deflateSetHeader:(e,t)=>ke(e)||2!==e.state.wrap?$:(e.state.gzhead=t,Z),deflate:(e,t)=>{if(ke(e)||t>Q||t<0)return e?le(e,$):$;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===r.status&&t!==K)return le(e,0===e.avail_out?te:$);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ge(e),0===e.avail_out)return r.last_flush=-1,Z}else if(0===e.avail_in&&ce(t)<=ce(i)&&t!==K)return le(e,te);if(666===r.status&&0!==e.avail_in)return le(e,te);if(42===r.status&&0===r.wrap&&(r.status=113),42===r.status){let t=ue+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=ne||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ve(r,t),0!==r.strstart&&(ve(r,e.adler>>>16),ve(r,65535&e.adler)),e.adler=1,r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(57===r.status)if(e.adler=0,_e(r,31),_e(r,139),_e(r,8),r.gzhead)_e(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),_e(r,255&r.gzhead.time),_e(r,r.gzhead.time>>8&255),_e(r,r.gzhead.time>>16&255),_e(r,r.gzhead.time>>24&255),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(_e(r,255&r.gzhead.extra.length),_e(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=G(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,0),_e(r,9===r.level?2:r.strategy>=ne||r.level<2?4:0),_e(r,3),r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ge(e),0!==r.pending)return r.last_flush=-1,Z;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=G(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i)),ge(e),0!==r.pending)return r.last_flush=-1,Z;i=0}t=r.gzindexi&&(e.adler=G(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ge(e),0!==r.pending))return r.last_flush=-1,Z;_e(r,255&e.adler),_e(r,e.adler>>8&255),e.adler=0}if(r.status=113,ge(e),0!==r.pending)return r.last_flush=-1,Z}if(0!==e.avail_in||0!==r.lookahead||t!==Y&&666!==r.status){let i=0===r.level?xe(r,t):r.strategy===ne?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ye(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===se?((e,t)=>{let r,i,n,s;const a=e.window;for(;;){if(e.lookahead<=258){if(ye(e),e.lookahead<=258&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=e.strstart+258;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(me(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(me(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(me(e,!1),0===e.strm.avail_out)?1:2})(r,t):Se[r.level].func(r,t);if(3!==i&&4!==i||(r.status=666),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Z;if(2===i&&(t===X?j(r):t!==Q&&(V(r,0,0,!1),t===q&&(de(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ge(e),0===e.avail_out))return r.last_flush=-1,Z}return t!==K?Z:r.wrap<=0?J:(2===r.wrap?(_e(r,255&e.adler),_e(r,e.adler>>8&255),_e(r,e.adler>>16&255),_e(r,e.adler>>24&255),_e(r,255&e.total_in),_e(r,e.total_in>>8&255),_e(r,e.total_in>>16&255),_e(r,e.total_in>>24&255)):(ve(r,e.adler>>>16),ve(r,65535&e.adler)),ge(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Z:J)},deflateEnd:e=>{if(ke(e))return $;const t=e.state.status;return e.state=null,113===t?le(e,ee):Z},deflateSetDictionary:(e,t)=>{let r=t.length;if(ke(e))return $;const i=e.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return $;if(1===n&&(e.adler=D(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(de(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ye(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=pe(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,ye(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,i.wrap=n,Z},deflateInfo:"pako deflate (from Nodeca project)"};const Le=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ie=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Le(r,t)&&(e[t]=r[t])}}return e},Oe=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Be[254]=Be[254]=1;var Ge=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,s,a=e.length,o=0;for(n=0;n>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},We=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const s=new Array(2*r);for(n=0,i=0;i4)s[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i1?s[n++]=65533:t<65536?s[n++]=t:(t-=65536,s[n++]=55296|t>>10&1023,s[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&De)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Be[e[r]]>t?r:t};var Fe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ve=Object.prototype.toString,{Z_NO_FLUSH:ze,Z_SYNC_FLUSH:He,Z_FULL_FLUSH:je,Z_FINISH:Ye,Z_OK:Xe,Z_STREAM_END:qe,Z_DEFAULT_COMPRESSION:Ke,Z_DEFAULT_STRATEGY:Qe,Z_DEFLATED:Ze}=N;function Je(e){this.options=Ie({level:Ke,method:Ze,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Ue.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Xe)throw new Error(W[r]);if(t.header&&Ue.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ge(t.dictionary):"[object ArrayBuffer]"===Ve.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Ue.deflateSetDictionary(this.strm,e),r!==Xe)throw new Error(W[r]);this._dict_set=!0}}function $e(e,t){const r=new Je(t);if(r.push(e,!0),r.err)throw r.msg||W[r.err];return r.result}Je.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?Ye:ze,"string"==typeof e?r.input=Ge(e):"[object ArrayBuffer]"===Ve.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(s===He||s===je)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=Ue.deflate(r,s),n===qe)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Ue.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Xe;if(0!==r.avail_out){if(s>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Je.prototype.onData=function(e){this.chunks.push(e)},Je.prototype.onEnd=function(e){e===Xe&&(this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var et={Deflate:Je,deflate:$e,deflateRaw:function(e,t){return(t=t||{}).raw=!0,$e(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,$e(e,t)},constants:N};var tt=function(e,t){let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R,E;const S=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,s=n-(t-e.avail_out),a=n+(e.avail_out-257),o=S.dmax,h=S.wsize,u=S.whave,l=S.wnext,c=S.window,d=S.hold,f=S.bits,p=S.lencode,g=S.distcode,m=(1<>>24,d>>>=b,f-=b,b=v>>>16&255,0===b)E[n++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=p[(65535&v)+(d&(1<>>=b,f-=b),f<15&&(d+=R[r++]<>>24,d>>>=b,f-=b,b=v>>>16&255,!(16&b)){if(0==(64&b)){v=g[(65535&v)+(d&(1<o){e.msg="invalid distance too far back",S.mode=16209;break e}if(d>>>=b,f-=b,b=n-s,y>b){if(b=y-b,b>u&&S.sane){e.msg="invalid distance too far back",S.mode=16209;break e}if(x=0,T=c,0===l){if(x+=h-b,b2;)E[n++]=T[x++],E[n++]=T[x++],E[n++]=T[x++],w-=3;w&&(E[n++]=T[x++],w>1&&(E[n++]=T[x++]))}else{x=n-y;do{E[n++]=E[x++],E[n++]=E[x++],E[n++]=E[x++],w-=3}while(w>2);w&&(E[n++]=E[x++],w>1&&(E[n++]=E[x++]))}break}}break}}while(r>3,r-=w,f-=w<<3,d&=(1<{const h=o.bits;let u,l,c,d,f,p,g=0,m=0,_=0,v=0,b=0,w=0,y=0,x=0,T=0,R=0,E=null;const S=new Uint16Array(16),A=new Uint16Array(16);let k,M,C,P=null;for(g=0;g<=15;g++)S[g]=0;for(m=0;m=1&&0===S[v];v--);if(b>v&&(b=v),0===v)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(_=1;_0&&(0===e||1!==v))return-1;for(A[1]=0,g=1;g<15;g++)A[g+1]=A[g]+S[g];for(m=0;m852||2===e&&T>592)return 1;for(;;){k=g-y,a[m]+1=p?(M=P[a[m]-p],C=E[a[m]-p]):(M=96,C=0),u=1<>y)+l]=k<<24|M<<16|C|0}while(0!==l);for(u=1<>=1;if(0!==u?(R&=u-1,R+=u):R=0,m++,0==--S[g]){if(g===v)break;g=t[r+a[m]]}if(g>b&&(R&d)!==c){for(0===y&&(y=b),f+=_,w=g-y,x=1<852||2===e&&T>592)return 1;c=R&d,n[c]=b<<24|w<<16|f-s|0}}return 0!==R&&(n[f+R]=g-y<<24|64<<16|0),o.bits=b,0};const{Z_FINISH:ot,Z_BLOCK:ht,Z_TREES:ut,Z_OK:lt,Z_STREAM_END:ct,Z_NEED_DICT:dt,Z_STREAM_ERROR:ft,Z_DATA_ERROR:pt,Z_MEM_ERROR:gt,Z_BUF_ERROR:mt,Z_DEFLATED:_t}=N,vt=16209,bt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function wt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<16180||t.mode>16211?1:0},xt=e=>{if(yt(e))return ft;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,lt},Tt=e=>{if(yt(e))return ft;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xt(e)},Rt=(e,t)=>{let r;if(yt(e))return ft;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ft:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Tt(e))},Et=(e,t)=>{if(!e)return ft;const r=new wt;e.state=r,r.strm=e,r.window=null,r.mode=16180;const i=Rt(e,t);return i!==lt&&(e.state=null),i};let St,At,kt=!0;const Mt=e=>{if(kt){St=new Int32Array(512),At=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(at(1,e.lens,0,288,St,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;at(2,e.lens,0,32,At,0,e.work,{bits:5}),kt=!1}e.lencode=St,e.lenbits=9,e.distcode=At,e.distbits=5},Ct=(e,t,r,i)=>{let n;const s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(t.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(t.subarray(r-i,r-i+n),s.wnext),(i-=n)?(s.window.set(t.subarray(r-i,r),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveEt(e,15),inflateInit2:Et,inflate:(e,t)=>{let r,i,n,s,a,o,h,u,l,c,d,f,p,g,m,_,v,b,w,y,x,T,R=0;const E=new Uint8Array(4);let S,A;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yt(e)||!e.output||!e.input&&0!==e.avail_in)return ft;r=e.state,16191===r.mode&&(r.mode=16192),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,d=h,T=lt;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=vt;break}if((15&u)!==_t){e.msg="unknown compression method",r.mode=vt;break}if(u>>>=4,l-=4,x=8+(15&u),0===r.wbits&&(r.wbits=x),x>15||x>r.wbits){e.msg="invalid window size",r.mode=vt;break}r.dmax=1<>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=G(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[s++]<>>8&255,r.check=G(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>o&&(f=o),f&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(s,s+f),x)),512&r.flags&&4&r.wrap&&(r.check=G(r.check,i,f,s)),o-=f,s+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;f=0;do{x=i[s+f++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&f>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[s++]<>>=7&l,l-=7&l,r.mode=16206;break}for(;l<3;){if(0===o)break e;o--,u+=i[s++]<>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Mt(r),r.mode=16199,t===ut){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=vt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=vt;break}if(r.length=65535&u,u=0,l=0,r.mode=16194,t===ut)break e;case 16194:r.mode=16195;case 16195:if(f=r.length,f){if(f>o&&(f=o),f>h&&(f=h),0===f)break e;n.set(i.subarray(s,s+f),a),o-=f,s+=f,h-=f,a+=f,r.length-=f;break}r.mode=16191;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[s++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vt;break}r.have=0,r.mode=16197;case 16197:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},T=at(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid code lengths set",r.mode=vt;break}r.have=0,r.mode=16198;case 16198:for(;r.have>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=m,l-=m,r.lens[r.have++]=v;else{if(16===v){for(A=m+2;l>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=vt;break}x=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===v){for(A=m+3;l>>=m,l-=m,x=0,f=3+(7&u),u>>>=3,l-=3}else{for(A=m+7;l>>=m,l-=m,x=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vt;break}for(;f--;)r.lens[r.have++]=x}}if(r.mode===vt)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=vt;break}if(r.lenbits=9,S={bits:r.lenbits},T=at(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid literal/lengths set",r.mode=vt;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},T=at(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,T){e.msg="invalid distances set",r.mode=vt;break}if(r.mode=16199,t===ut)break e;case 16199:r.mode=16200;case 16200:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,tt(e,d),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;R=r.lencode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,r.length=v,0===_){r.mode=16205;break}if(32&_){r.back=-1,r.mode=16191;break}if(64&_){e.msg="invalid literal/length code",r.mode=vt;break}r.extra=15&_,r.mode=16201;case 16201:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;R=r.distcode[u&(1<>>24,_=R>>>16&255,v=65535&R,!(m<=l);){if(0===o)break e;o--,u+=i[s++]<>b)],m=R>>>24,_=R>>>16&255,v=65535&R,!(b+m<=l);){if(0===o)break e;o--,u+=i[s++]<>>=b,l-=b,r.back+=b}if(u>>>=m,l-=m,r.back+=m,64&_){e.msg="invalid distance code",r.mode=vt;break}r.offset=v,r.extra=15&_,r.mode=16203;case 16203:if(r.extra){for(A=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vt;break}r.mode=16204;case 16204:if(0===h)break e;if(f=d-h,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vt;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),g=r.window}else g=n,p=a-r.offset,f=r.length;f>h&&(f=h),h-=f,r.length-=f;do{n[a++]=g[p++]}while(--f);0===r.length&&(r.mode=16200);break;case 16205:if(0===h)break e;n[a++]=r.length,h--,r.mode=16200;break;case 16206:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[s++]<{if(yt(e))return ft;let t=e.state;return t.window&&(t.window=null),e.state=null,lt},inflateGetHeader:(e,t)=>{if(yt(e))return ft;const r=e.state;return 0==(2&r.wrap)?ft:(r.head=t,t.done=!1,lt)},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,s;return yt(e)?ft:(i=e.state,0!==i.wrap&&16190!==i.mode?ft:16190===i.mode&&(n=1,n=D(n,t,r,0),n!==i.check)?pt:(s=Ct(e,t,r,r),s?(i.mode=16210,gt):(i.havedict=1,lt)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ut=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Lt=Object.prototype.toString,{Z_NO_FLUSH:It,Z_FINISH:Ot,Z_OK:Dt,Z_STREAM_END:Bt,Z_NEED_DICT:Gt,Z_STREAM_ERROR:Wt,Z_DATA_ERROR:Nt,Z_MEM_ERROR:Ft}=N;function Vt(e){this.options=Ie({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fe,this.strm.avail_out=0;let r=Pt.inflateInit2(this.strm,t.windowBits);if(r!==Dt)throw new Error(W[r]);if(this.header=new Ut,Pt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ge(t.dictionary):"[object ArrayBuffer]"===Lt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Pt.inflateSetDictionary(this.strm,t.dictionary),r!==Dt)))throw new Error(W[r])}function zt(e,t){const r=new Vt(t);if(r.push(e),r.err)throw r.msg||W[r.err];return r.result}Vt.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Ot:It,"[object ArrayBuffer]"===Lt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),s=Pt.inflate(r,a),s===Gt&&n&&(s=Pt.inflateSetDictionary(r,n),s===Dt?s=Pt.inflate(r,a):s===Nt&&(s=Gt));r.avail_in>0&&s===Bt&&r.state.wrap>0&&0!==e[r.next_in];)Pt.inflateReset(r),s=Pt.inflate(r,a);switch(s){case Wt:case Nt:case Gt:case Ft:return this.onEnd(s),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||s===Bt))if("string"===this.options.to){let e=Ne(r.output,r.next_out),t=r.next_out-e,n=We(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(s!==Dt||0!==o){if(s===Bt)return s=Pt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Vt.prototype.onData=function(e){this.chunks.push(e)},Vt.prototype.onEnd=function(e){e===Dt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Oe(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Ht={Inflate:Vt,inflate:zt,inflateRaw:function(e,t){return(t=t||{}).raw=!0,zt(e,t)},ungzip:zt,constants:N};const{Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt}=et,{Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt}=Ht;var $t=jt,er=Yt,tr=Xt,rr=qt,ir=Kt,nr=Qt,sr=Zt,ar=Jt,or=N,hr={Deflate:jt,deflate:Yt,deflateRaw:Xt,gzip:qt,Inflate:Kt,inflate:Qt,inflateRaw:Zt,ungzip:Jt,constants:N}},,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var i=r(40);Object.keys(i).forEach(e=>self[e]=i[e])}]); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/sharing_simd.min.js-8dda81762f5af41a3003.map + self.__wasmCodeDataEndFlag = 1; +var Module=typeof Module!=="undefined"?Module:{}; +Module["locateFile"] = function(filename){ +if (filename.endsWith("wasm")) { + return wasmUrl; +} +} +Module['instantiateWasm'] = function (imports, successCallback) { +self.downloadAndInstantiateWebAssembly(imports, successCallback); +return {}; +}; +Module["onRuntimeInitialized"] = function(){ +postMessage({ status: wasmSuccessEvent }); +self.onWasmModuleReady(); +} +Module['onAbort'] = function (reason) { +postMessage({ status: wasmFailEvent, data: reason }); +}; +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};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";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;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.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function 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>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=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}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}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 getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="video.simd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["memory"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={362972:$0=>{console.log("Video Version: ",$0)},363009:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},363043:$0=>{change_capture_resolution($0)},363078:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},363155:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},363225:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_webcodec($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},363304:($0,$1)=>{decode_callback($0,$1)},363333:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},363367:($0,$1,$2,$3)=>{Video_Controller_Encode_Data2($0,$1,$2,$3)},363415:($0,$1)=>{SAVE_IV($0,$1)},363433:($0,$1,$2,$3)=>{Video_Controller_Encode_Data($0,$1,$2,$3)},363480:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},363537:$0=>{Exit_Thread($0)},363555:$0=>{return Before_Create_Thread($0)},363592:$0=>{return Before_Create_Thread($0)},363629:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},363663:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},363703:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},363733:$0=>{SubScribeUpdateVideo($0)},363761:()=>{return Date.now()/1e3},363788:()=>{return Date.now()%1e3},363815:($0,$1)=>{send_data($0,$1)},363838:$0=>{SubScribeUpdateVideo($0)},363866:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},363927:($0,$1)=>{SAVE_IV($0,$1)},363945:()=>{return Date.now()},363968:($0,$1)=>{Update_Required_Bandwidth($0,$1)},364004:$0=>{Update_Video_Hd_Info($0)},364034:$0=>{console.log("Sharing Version: ",$0)},364073:($0,$1,$2,$3)=>{Send_Multi_Data($0,$1,$2,$3)},364107:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},364129:($0,$1,$2)=>{Send_Data($0,$1,$2)},364153:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364181:($0,$1,$2)=>{Send_Data($0,$1,$2)},364205:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364233:($0,$1,$2)=>{Send_Data($0,$1,$2)},364257:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},364295:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},364332:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364363:($0,$1,$2)=>{Send_Data($0,$1,$2)},364390:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},364420:($0,$1,$2)=>{Send_Data($0,$1,$2)},364447:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)=>{frame_callback_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)},364538:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_mouse_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},364625:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},364657:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},364702:$0=>{SubScribeUpdateSharing($0)},364732:($0,$1)=>{Send_Data($0,$1)},364755:$0=>{Update_WebSokcet_Speed($0)},364787:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},364850:($0,$1)=>{SAVE_IV($0,$1)},364868:$0=>{console.error("tjDecompressHeader3 error %d ",$0)},364921:$0=>{console.error("tjDecompress2 error %d ",$0)},364968:($0,$1,$2,$3)=>{Sharing_Decode_Channel_Change($0,$1,$2,$3)},365015:($0,$1)=>{Update_Required_Bandwidth($0,$1)},365051:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},365082:($0,$1)=>{Recieve_Wb_Packet($0,$1)},365109:($0,$1)=>{COMMIT_PRINT($0,$1)},365131:()=>{videoencode_create_helpthread()},365166:($0,$1)=>{LOG_OUT($0,$1)},365187:($0,$1)=>{wcl_trace_log($0,$1)}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function _AdapterWhiteListCheck(){return checkWebCodecWhitelist_js()}function _CloseVideoEncoder(id){CloseVideoEncoder_js(id)}function _CreateGltPlatform(){err("missing function: CreateGltPlatform");abort(-1)}function _DestroyGltPlatform(){err("missing function: DestroyGltPlatform");abort(-1)}function _GetEncoderState(id){return GetEncoderState_js(id)}function _GetLogLevel(){return GetLogLevel_js()}function _InitVideoDecoder(id,context){return InitVideoDecoder_js(id,context)}function _InitVideoEncoder(id,context){return InitVideoEncoder_js(id,context)}function _LimitWebCodecsDecoderTo360(){return LimitWebCodecsDecoderTo360_js()}function _LimitWebCodecsEncoderTo360(){return LimitWebCodecsEncoderTo360_js()}function _Set_Share_Mode(flag){return Set_Share_Mode_js(flag)}function _UserAgentIsTesla(){return UserAgentIsTesla_js()}function _VideoDecoder(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount){return VideoDecoder_js(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount)}function _VideoDecoderConfigure(id,extradata,extraDataLen,Width,Height){return VideoDecoderConfigure_js(id,extradata,extraDataLen,Width,Height)}function _VideoEncoderConfigure(id,Bitrate,Framerate,Width,Height,bsBuffer){return VideoEncoderConfigure_js(id,Bitrate,Framerate,Width,Height,bsBuffer)}function _WebCodecsDecoderFail(m_iID){WebCodecsDecoderFail_js(m_iID)}function _WebCodecsEncoderFail(m_iID,code){WebCodecsEncoderFail_js(m_iID,code)}function _WebCodecsVideoEncoder(id,videoFrameId,NewIDR,rawData,dataLength,timeout){return VideoEncoder_js(id,videoFrameId,NewIDR,rawData,dataLength,timeout)}function __ZN11cpt_generic6thread4joinEv(){err("missing function: _ZN11cpt_generic6thread4joinEv");abort(-1)}function __ZN11cpt_generic6threadD1Ev(){err("missing function: _ZN11cpt_generic6threadD1Ev");abort(-1)}function __ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE(){err("missing function: _ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE");abort(-1)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}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:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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=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;i0?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 TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(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;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){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.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(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:function(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>>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:function(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:function(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.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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,parent)}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)=>{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},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},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=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){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.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;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:type,opts:opts,mountpoint: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);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?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{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)}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 PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}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.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}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:node,path:FS.getPath(node),flags: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(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){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)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});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 random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);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",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},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{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_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]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_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};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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url: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]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{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:ptr,allocated:true}};node.stream_ops=stream_ops;return node},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){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(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 PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(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)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.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 instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function __emscripten_throw_longjmp(){throw Infinity}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(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}function __isLeapYear(year){return 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];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(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=__yday_from_date(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}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){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);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function runMainThreadEmAsm(code,sigPtr,argbuf,sync){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int_sync_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,1)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){postMessage({status:-35,cmd:-35})}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function 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}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;_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 instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);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?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>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 instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>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}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 instanceof FS.ErrnoError))throw e;return e.errno}}function _setCurrentThreadSsrc(ssrc){setCurrentThreadSsrc_js(ssrc)}function __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];function __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}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function _zlt_tfjs_execute_afn(input_img,input_ref,input_msk,len,output_buffer){return execute_afn(input_img,input_ref,input_msk,len,output_buffer)}function _zlt_tfjs_execute_base_cls(input_buffer,len,output_buffer,output_len){return execute_base(input_buffer,len,output_buffer,output_len)}async function _zlt_tfjs_init(){}function _zoom_wcl_get_cpu_num(){return hardcodecpunumber()}function _zoom_wcl_get_csc_thread_num(){return 1}function _zoom_wcl_support_multi_thread(){return IsSupportMultiThread()}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}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;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"AdapterWhiteListCheck":_AdapterWhiteListCheck,"CloseVideoEncoder":_CloseVideoEncoder,"CreateGltPlatform":_CreateGltPlatform,"DestroyGltPlatform":_DestroyGltPlatform,"GetEncoderState":_GetEncoderState,"GetLogLevel":_GetLogLevel,"InitVideoDecoder":_InitVideoDecoder,"InitVideoEncoder":_InitVideoEncoder,"LimitWebCodecsDecoderTo360":_LimitWebCodecsDecoderTo360,"LimitWebCodecsEncoderTo360":_LimitWebCodecsEncoderTo360,"Set_Share_Mode":_Set_Share_Mode,"UserAgentIsTesla":_UserAgentIsTesla,"VideoDecoder":_VideoDecoder,"VideoDecoderConfigure":_VideoDecoderConfigure,"VideoEncoderConfigure":_VideoEncoderConfigure,"WebCodecsDecoderFail":_WebCodecsDecoderFail,"WebCodecsEncoderFail":_WebCodecsEncoderFail,"WebCodecsVideoEncoder":_WebCodecsVideoEncoder,"_ZN11cpt_generic6thread4joinEv":__ZN11cpt_generic6thread4joinEv,"_ZN11cpt_generic6threadD1Ev":__ZN11cpt_generic6threadD1Ev,"_ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE":__ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE,"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_emscripten_throw_longjmp":__emscripten_throw_longjmp,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_asm_const_int_sync_on_main_thread":_emscripten_asm_const_int_sync_on_main_thread,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"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_ii":invoke_ii,"invoke_iii":invoke_iii,"invoke_iiii":invoke_iiii,"invoke_vi":invoke_vi,"invoke_viii":invoke_viii,"setCurrentThreadSsrc":_setCurrentThreadSsrc,"strftime":_strftime,"strftime_l":_strftime_l,"zlt_tfjs_execute_afn":_zlt_tfjs_execute_afn,"zlt_tfjs_execute_base_cls":_zlt_tfjs_execute_base_cls,"zlt_tfjs_init":_zlt_tfjs_init,"zoom_wcl_get_cpu_num":_zoom_wcl_get_cpu_num,"zoom_wcl_get_csc_thread_num":_zoom_wcl_get_csc_thread_num,"zoom_wcl_support_multi_thread":_zoom_wcl_support_multi_thread};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Video_Init=Module["__Video_Init"]=function(){return(__Video_Init=Module["__Video_Init"]=Module["asm"]["_Video_Init"]).apply(null,arguments)};var __Video_UnInit=Module["__Video_UnInit"]=function(){return(__Video_UnInit=Module["__Video_UnInit"]=Module["asm"]["_Video_UnInit"]).apply(null,arguments)};var __Video_Decode=Module["__Video_Decode"]=function(){return(__Video_Decode=Module["__Video_Decode"]=Module["asm"]["_Video_Decode"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __Video_Try_Analysis=Module["__Video_Try_Analysis"]=function(){return(__Video_Try_Analysis=Module["__Video_Try_Analysis"]=Module["asm"]["_Video_Try_Analysis"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __Video_Encode_YUV=Module["__Video_Encode_YUV"]=function(){return(__Video_Encode_YUV=Module["__Video_Encode_YUV"]=Module["asm"]["_Video_Encode_YUV"]).apply(null,arguments)};var __Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=function(){return(__Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=Module["asm"]["_Video_VirtualBackground_Special_Action"]).apply(null,arguments)};var __Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=function(){return(__Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=Module["asm"]["_Qos_Sender_Send_Data_In_Main_Thread"]).apply(null,arguments)};var __Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=function(){return(__Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=Module["asm"]["_Video_Websocket_Speed"]).apply(null,arguments)};var __Video_Start_Encode=Module["__Video_Start_Encode"]=function(){return(__Video_Start_Encode=Module["__Video_Start_Encode"]=Module["asm"]["_Video_Start_Encode"]).apply(null,arguments)};var __Video_Stop_Encode=Module["__Video_Stop_Encode"]=function(){return(__Video_Stop_Encode=Module["__Video_Stop_Encode"]=Module["asm"]["_Video_Stop_Encode"]).apply(null,arguments)};var __Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=function(){return(__Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=Module["asm"]["_Request_Video_Qos_Data"]).apply(null,arguments)};var __Video_Update_Format=Module["__Video_Update_Format"]=function(){return(__Video_Update_Format=Module["__Video_Update_Format"]=Module["asm"]["_Video_Update_Format"]).apply(null,arguments)};var __Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=function(){return(__Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=Module["asm"]["_Video_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=function(){return(__Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=Module["asm"]["_Add_Video_Cooker_info"]).apply(null,arguments)};var __Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=function(){return(__Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=Module["asm"]["_Remove_Video_Cooker_Info"]).apply(null,arguments)};var __Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=function(){return(__Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=Module["asm"]["_Get_Video_Meat_Weight"]).apply(null,arguments)};var __Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=function(){return(__Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=Module["asm"]["_Set_Max_Receiving_Channel_Num"]).apply(null,arguments)};var __update_sync_time=Module["__update_sync_time"]=function(){return(__update_sync_time=Module["__update_sync_time"]=Module["asm"]["_update_sync_time"]).apply(null,arguments)};var __release_video_receiving_channel=Module["__release_video_receiving_channel"]=function(){return(__release_video_receiving_channel=Module["__release_video_receiving_channel"]=Module["asm"]["_release_video_receiving_channel"]).apply(null,arguments)};var __change_hw_status=Module["__change_hw_status"]=function(){return(__change_hw_status=Module["__change_hw_status"]=Module["asm"]["_change_hw_status"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).apply(null,arguments)};var __update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=function(){return(__update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_video_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __create_vb_thread=Module["__create_vb_thread"]=function(){return(__create_vb_thread=Module["__create_vb_thread"]=Module["asm"]["_create_vb_thread"]).apply(null,arguments)};var __create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=function(){return(__create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=Module["asm"]["_create_vb_no_sab_thread"]).apply(null,arguments)};var __signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=function(){return(__signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=Module["asm"]["_signal_vb_thread_blur"]).apply(null,arguments)};var __signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=function(){return(__signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=Module["asm"]["_signal_vb_thread_bg"]).apply(null,arguments)};var __signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=function(){return(__signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=Module["asm"]["_signal_vb_thread_video_yuv"]).apply(null,arguments)};var __signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=function(){return(__signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=Module["asm"]["_signal_vb_thread_video_rgba"]).apply(null,arguments)};var __signal_vb_thread_close=Module["__signal_vb_thread_close"]=function(){return(__signal_vb_thread_close=Module["__signal_vb_thread_close"]=Module["asm"]["_signal_vb_thread_close"]).apply(null,arguments)};var __update_video_cropping_mode=Module["__update_video_cropping_mode"]=function(){return(__update_video_cropping_mode=Module["__update_video_cropping_mode"]=Module["asm"]["_update_video_cropping_mode"]).apply(null,arguments)};var __collect_video_monitor_info=Module["__collect_video_monitor_info"]=function(){return(__collect_video_monitor_info=Module["__collect_video_monitor_info"]=Module["asm"]["_collect_video_monitor_info"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=function(){return(__Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=Module["asm"]["_Sharing_Encode_Init"]).apply(null,arguments)};var __Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=function(){return(__Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=Module["asm"]["_Sharing_Encode_Try_Analysis"]).apply(null,arguments)};var __Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=function(){return(__Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=Module["asm"]["_Sharing_Encode_Uninit"]).apply(null,arguments)};var __Sharing_Encode=Module["__Sharing_Encode"]=function(){return(__Sharing_Encode=Module["__Sharing_Encode"]=Module["asm"]["_Sharing_Encode"]).apply(null,arguments)};var __Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=function(){return(__Sharing_Encode_Mouse_Data=Module["__Sharing_Encode_Mouse_Data"]=Module["asm"]["_Sharing_Encode_Mouse_Data"]).apply(null,arguments)};var __Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=function(){return(__Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=Module["asm"]["_Request_Sharing_Qos_Data"]).apply(null,arguments)};var __Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=function(){return(__Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=Module["asm"]["_Sharing_Set_Data_Encryption"]).apply(null,arguments)};var __Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=function(){return(__Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=Module["asm"]["_Sharing_Pause_Encode"]).apply(null,arguments)};var __Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=function(){return(__Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=Module["asm"]["_Sharing_Resume_Encode"]).apply(null,arguments)};var __Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=function(){return(__Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=Module["asm"]["_Sharing_Stop_Encode"]).apply(null,arguments)};var __Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=function(){return(__Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=Module["asm"]["_Sharing_Websocket_Speed"]).apply(null,arguments)};var __Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=function(){return(__Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=Module["asm"]["_Add_Sharing_Cooker_info"]).apply(null,arguments)};var __Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=function(){return(__Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=Module["asm"]["_Remove_Sharing_Cooker_Info"]).apply(null,arguments)};var __Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=function(){return(__Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=Module["asm"]["_Get_Sharing_Meat_Weight"]).apply(null,arguments)};var __Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=function(){return(__Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=Module["asm"]["_Set_Sharing_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Add_Rev_Channel=Module["__Add_Rev_Channel"]=function(){return(__Add_Rev_Channel=Module["__Add_Rev_Channel"]=Module["asm"]["_Add_Rev_Channel"]).apply(null,arguments)};var __Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=function(){return(__Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=Module["asm"]["_Remove_Rev_Channel"]).apply(null,arguments)};var __update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=function(){return(__update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_sharing_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var __collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=function(){return(__collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=Module["asm"]["_collect_sharing_monitor_info"]).apply(null,arguments)};var __set_annotation_action=Module["__set_annotation_action"]=function(){return(__set_annotation_action=Module["__set_annotation_action"]=Module["asm"]["_set_annotation_action"]).apply(null,arguments)};var __request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=function(){return(__request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=Module["asm"]["_request_nack_t_periodically_for_sharing_qos"]).apply(null,arguments)};var __Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=function(){return(__Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=Module["asm"]["_Change_Connect_Type_For_Sharing"]).apply(null,arguments)};var __Jpeg_Init=Module["__Jpeg_Init"]=function(){return(__Jpeg_Init=Module["__Jpeg_Init"]=Module["asm"]["_Jpeg_Init"]).apply(null,arguments)};var __Jpeg_Uninit=Module["__Jpeg_Uninit"]=function(){return(__Jpeg_Uninit=Module["__Jpeg_Uninit"]=Module["asm"]["_Jpeg_Uninit"]).apply(null,arguments)};var __Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=function(){return(__Jpeg_HeardInfo=Module["__Jpeg_HeardInfo"]=Module["asm"]["_Jpeg_HeardInfo"]).apply(null,arguments)};var __Jpeg_Decode=Module["__Jpeg_Decode"]=function(){return(__Jpeg_Decode=Module["__Jpeg_Decode"]=Module["asm"]["_Jpeg_Decode"]).apply(null,arguments)};var _GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=function(){return(_GIT_COMMIT_VERSION=Module["_GIT_COMMIT_VERSION"]=Module["asm"]["GIT_COMMIT_VERSION"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=function(){return(_OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=Module["asm"]["OnVideoFrameOutputCallback"]).apply(null,arguments)};var _OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=function(){return(_OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=Module["asm"]["OnEncodedVideoChunkOutputCallback"]).apply(null,arguments)};var _saveSetjmp=Module["_saveSetjmp"]=function(){return(_saveSetjmp=Module["_saveSetjmp"]=Module["asm"]["saveSetjmp"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return(_setThrew=Module["_setThrew"]=Module["asm"]["setThrew"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiii"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiijii=Module["dynCall_iiijii"]=function(){return(dynCall_iiijii=Module["dynCall_iiijii"]=Module["asm"]["dynCall_iiijii"]).apply(null,arguments)};var dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=function(){return(dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiij"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=function(){return(dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=Module["asm"]["dynCall_iiiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiiij"]).apply(null,arguments)};var dynCall_viiiiiij=Module["dynCall_viiiiiij"]=function(){return(dynCall_viiiiiij=Module["dynCall_viiiiiij"]=Module["asm"]["dynCall_viiiiiij"]).apply(null,arguments)};var dynCall_viji=Module["dynCall_viji"]=function(){return(dynCall_viji=Module["dynCall_viji"]=Module["asm"]["dynCall_viji"]).apply(null,arguments)};var dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=function(){return(dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=Module["asm"]["dynCall_iiiiiiji"]).apply(null,arguments)};var dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=function(){return(dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=Module["asm"]["dynCall_iiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiij"]).apply(null,arguments)};var dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=function(){return(dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiij"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_jiiiiii=Module["dynCall_jiiiiii"]=function(){return(dynCall_jiiiiii=Module["dynCall_jiiiiii"]=Module["asm"]["dynCall_jiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=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();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/tp.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/tp.min.js new file mode 100644 index 0000000..bbd4f4a --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/tp.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ZoomTPModule",[],t):"object"==typeof exports?exports.ZoomTPModule=t():e.ZoomTPModule=t()}(self,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r,o,s,i,a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isEnableTP=t.ZoomTPWebSocket=t.initWorker=t.initTPModule=t.setCmd=t.tpLogger=void 0;const u=c(n(3)),l=n(4),d=n(6),f=n(7);let h,p,g={},_=!1,m=0;t.setCmd=function(e){p=e};const y=null===(i=null===(s=null===(o=null===(r=null===self||void 0===self?void 0:self.document)||void 0===r?void 0:r.currentScript)||void 0===o?void 0:o.src)||void 0===s?void 0:s.replace)||void 0===i?void 0:i.call(s,"tp.min.js","tp.wasm");function w(){return a(this,void 0,void 0,(function*(){return h||(h=new Promise((e,n)=>a(this,void 0,void 0,(function*(){const n=new u.default;n.addEventListener("error",e=>{null===t.tpLogger||void 0===t.tpLogger||(0,t.tpLogger)("directReport","tp worker error "+(null==e?void 0:e.message)),_=!0,p&&p.socketError("tp worker error "+(null==e?void 0:e.message))}),n.addEventListener("message",r=>{"inited"===r.data.type?e(n):"fallback"===r.data.type?(_=!0,e(null)):"log"===r.data.type?null===t.tpLogger||void 0===t.tpLogger||(0,t.tpLogger)(r.data.level,r.data.message):"heartbeat"===r.data.type&&(m&&clearTimeout(m),!_&&b(null==g?void 0:g.options)&&(m=self.setTimeout(()=>{var e;const n="tp worker no-heartbeat visibility:"+(null===(e=self.document)||void 0===e?void 0:e.visibilityState);null===t.tpLogger||void 0===t.tpLogger||(0,t.tpLogger)("directReport",n),_=!0,p&&p.socketError(n)},2e4)))}),n.postMessage({type:"init",wasmUrl:g.wasmUrl||y})})))),h}))}t.initTPModule=function(e){return a(this,void 0,void 0,(function*(){return g=e||{},"function"!=typeof importScripts?(t.tpLogger=(0,f.logger)(g.logInstance),w().then(e=>{e&&(l.TPSocket.target=e)})):new Promise((e,n)=>{t.tpLogger=(e,t)=>{postMessage({type:"log",level:e,message:t})},self.addEventListener("message",t=>{"boolean"==typeof t.data.fallback&&(_=t.data.fallback,_&&n()),"init_tp_port"===t.data.type?(l.TPSocket.target=t.data.port,g={options:t.data.options},self.portInited=!0,e()):"init_worker"!==t.data.type||self.portInited||(self.postMessage("init_tp"),g={options:t.data.options})}),self.postMessage("init_tp")})}))},t.initWorker=function(e,n){return a(this,void 0,void 0,(function*(){const r=yield w();if(!r)return;r.addEventListener("error",t=>{t.message&&t.message.includes("RuntimeError:")&&e.postMessage({type:"error",fallback:!0})});let o=!1;e.addEventListener("message",s=>{if("init_tp"!==s.data||o)"log"===s.data.type&&(null===t.tpLogger||void 0===t.tpLogger||(0,t.tpLogger)(s.data.level,s.data.message));else{const{port1:t,port2:s}=new MessageChannel;e.postMessage({type:"init_tp_port",port:t,fallback:_,options:(n||g).options},[t]),r.postMessage({type:"add_port",port:s},[s]),o=!0}}),e.postMessage({type:"init_worker",fallback:_,options:(n||g).options})}))};class v{constructor(e,t){if(!e)throw new Error("Failed to construct ZoomTPWebSocket, the url is required.");const n="string"==typeof e?new URL(e):e;return!_&&(0,d.isRlb)(n,g.options)?new l.TPSocket(n):new WebSocket(n,t)}}function b(e){return(0,d.getOption)(e,47,1)}t.ZoomTPWebSocket=v,Object.setPrototypeOf(v.prototype,WebSocket.prototype),t.isEnableTP=b},function(e,t,n){"use strict";function r(e){const t=new URLSearchParams(e.search);return e.hostname.includes("rwg")&&(t.has("dn2")||t.has("islch"))}function o(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"m"===e.searchParams.get("type")}function s(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"x"===e.searchParams.get("type")}function i(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"v"===e.searchParams.get("type")&&"16"===e.searchParams.get("mode")}function a(e){return e.pathname.includes("/ab/signal")&&e.hostname.includes("rwg")&&e.searchParams.get("rwg")===e.hostname}var c;Object.defineProperty(t,"__esModule",{value:!0}),t.URL_TYPE=t.getUrlType=t.isAudioBridge=t.isVideoBridge=t.isXmpp=t.isBoMaster=t.isRwg=void 0,t.isRwg=r,t.isBoMaster=o,t.isXmpp=s,t.isVideoBridge=i,t.isAudioBridge=a,t.getUrlType=function(e){const t="string"==typeof e?new URL(e):e;return r(t)?c.RWG:o(t)?c.BO_MASTER:s(t)?c.XMPP:i(t)?c.VIDEO_BRIDGE:a(t)?c.AUDIO_BRIDGE:c.UNKNOWN},function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.RWG=1]="RWG",e[e.BO_MASTER=2]="BO_MASTER",e[e.XMPP=3]="XMPP",e[e.VIDEO_BRIDGE=4]="VIDEO_BRIDGE",e[e.AUDIO_BRIDGE=5]="AUDIO_BRIDGE"}(c||(t.URL_TYPE=c={}))},function(e,t,n){"use strict";e.exports=function(e,t,n,r){var o=self||window;try{try{var s;try{s=new o.Blob([e])}catch(t){(s=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(e),s=s.getBlob()}var i=o.URL||o.webkitURL,a=i.createObjectURL(s),c=new o[t](a,n);return i.revokeObjectURL(a),c}catch(r){return new o[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new o[t](r,n)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return s}));var r=n(2),o=n.n(r);function s(){return o()('!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monitor=void 0;class r{static setConnection(e){this.connection=e}static setLogger(e){this.logger=e}static setConnectionError(e){this.connectionError=!0}static addMonitor(e,t){var n;this.timeBase||(this.timeBase=Date.now(),this.cache.push(`STARTTPMONITOR${this.timeBase}(0)`)),this.cache.push(`${e}(${Math.ceil(Date.now()-this.timeBase)})`),t&&(null===(n=this.logger)||void 0===n||n.call(this,e))}static transform(e){return"WCL_M,TP;"+e.replace(/,/g,"-")}static sendMonitor(e){if(this.connection){const t={evt:4167,seq:1,body:{data:this.transform(e)}};this.connection.send(JSON.stringify(t))}this.logger&&this.connectionError&&this.logger(e)}static startMonitor(){setInterval(()=>{this.cache.length>0&&(this.connection||this.logger&&this.connectionError)&&(this.sendMonitor(this.cache.join("")),this.cache=[])},1e4)}}t.Monitor=r,r.cache=[],r.connectionError=!1,r.timeBase=0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionManager=void 0;class r{static setHelperConnectionMap(e,t){this.helperConnectionMap.set(e,t)}static setIdConnectionMap(e,t){this.idConnectionMap.set(e,t)}static setHandlerIdMap(e,t){this.handlerIdMap.set(e,t)}static getById(e){return this.idConnectionMap.get(e)}static getByHandler(e){return this.getById(this.handlerIdMap.get(e))}static getByHelper(e){return this.helperConnectionMap.get(e)}static removeHelperConnectionMap(e){this.helperConnectionMap.delete(e)}static removeIdConnectionMap(e){this.idConnectionMap.delete(e)}static removeHandlerIdMap(e){this.handlerIdMap.delete(e)}}t.ConnectionManager=r,r.idConnectionMap=new Map,r.handlerIdMap=new Map,r.helperConnectionMap=new Map},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),i=o(n(3)),a=n(4),c=n(1);n(7);var u,l;function h(e,t){}function d(e,t){postMessage({type:"log",level:e,message:t})}function f(e){return r(this,void 0,void 0,(function*(){s.Monitor.setLogger(e=>d("directReport",e)),s.Monitor.startMonitor(),u=yield(0,i.default)({instantiateWasm:(t,n)=>r(this,void 0,void 0,(function*(){const o=e;let s;try{s=yield function(e,t=3,n=1e3){return r(this,void 0,void 0,(function*(){for(let r=0;rsetTimeout(e,n))}}))}(o)}catch(e){return d("directReport","fetch tp wasm error"),void postMessage({type:"fallback"})}const{instance:i,module:a}=yield WebAssembly.instantiate(s,t);return n(i),i.exports}))}).catch(()=>{d("directReport","init tp wasm error"),postMessage({type:"fallback"})}),(l={create_wcl_tp_handler:u.cwrap("create_wcl_tp_handler","number",[]),init_tp_worker:u.cwrap("init_tp_worker","",[]),destroy_wcl_tp_handler:u.cwrap("destroy_wcl_tp_handler","",["number"]),wcl_tp_handler_connect:u.cwrap("wcl_tp_handler_connect","",["number","number"]),wcl_tp_handler_close:u.cwrap("wcl_tp_handler_close","",["number"]),wcl_tp_handler_send:u.cwrap("wcl_tp_handler_send","",["number","array","number"]),wcl_tp_helper_on_connect:u.cwrap("wcl_tp_helper_on_connect","",["number"]),wcl_tp_helper_on_close:u.cwrap("wcl_tp_helper_on_close","",["number"]),wcl_tp_helper_on_message:u.cwrap("wcl_tp_helper_on_message","",["number","array","number"]),thread_run:u.cwrap("thread_run","",[])}).init_tp_worker();let t=0;setInterval(()=>{l.thread_run(),t++,t>300&&(postMessage({type:"heartbeat"}),t=0)},10),postMessage({type:"inited"})}))}self.addEventListener("unhandledrejection",e=>{d("error",e.error||e.reason)}),self.addEventListener("error",e=>{d("error",e.error||e.reason),s.Monitor.setConnectionError(!0),s.Monitor.addMonitor("TPERR,2",!0),postMessage({type:"fallback"})}),self.addEventListener("message",e=>{let t=e.data;switch(t.type){case"init":f(t.wasmUrl).catch(()=>{s.Monitor.setConnectionError(!0),s.Monitor.addMonitor("TPERR,1",!0),postMessage({type:"fallback"})});break;case"connect":new a.Connection(t.id,t.url,u,l,self,d,"");break;case"add_port":t.port.addEventListener("message",e=>{"connect"===e.data.type&&new a.Connection(e.data.id,e.data.url,u,l,t.port,d,"")}),t.port.start()}}),self.js_wss_connect=function(e,t){var n;null===(n=c.ConnectionManager.getById(t))||void 0===n||n.js_wss_connect(e)},self.js_wss_send=function(e,t,n){var r;null===(r=c.ConnectionManager.getByHelper(e))||void 0===r||r.js_wss_send(t,n)},self.js_wss_close=function(e){var t;null===(t=c.ConnectionManager.getByHelper(e))||void 0===t||t.js_wss_close()},self.js_app_on_message=function(e,t,n){var r;null===(r=c.ConnectionManager.getByHandler(e))||void 0===r||r.js_app_on_message(t,n)},self.js_helper_destoryed=function(e){var t;null===(t=c.ConnectionManager.getByHelper(e))||void 0===t||t.js_helper_destoryed()},self.js_app_on_connect=function(e,t){var n;null===(n=c.ConnectionManager.getByHandler(e))||void 0===n||n.js_app_on_connect(t)},self.js_app_on_close=function(e,t){var n;null===(n=c.ConnectionManager.getByHandler(e))||void 0===n||n.js_app_on_close(t)},self.on_socket_monitor=function(e,t,n){const r=new TextDecoder("utf-8"),o=new Uint8Array(u.HEAP8.buffer,t,n);const i="PORT,"+e+","+r.decode(o);s.Monitor.addMonitor(i)},self.wasm_memory_alert=function(e,t){const n="TPMEMALERT,"+e+","+t;s.Monitor.addMonitor(n,!0)},self.wcl_trace_log=h,self.LOG_OUT=h},function(e,t,n){"use strict";n.r(t);var r,o=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var t,n;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(e,r){t=e,n=r}));var o,s=Object.assign({},e),i=[],a="./this.program",c="";c=self.location.href,r&&(c=r),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)};var u,l,h=e.print||console.log.bind(console),d=e.printErr||console.warn.bind(console);Object.assign(e,s),s=null,e.arguments&&(i=e.arguments),e.thisProgram&&(a=e.thisProgram),e.quit&&e.quit,e.wasmBinary&&(u=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&L("no native wasm support detected");var f=!1;function p(e,t){e||L(t)}var _,g,m,y,v,w,M,b,C="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function P(e,t,n){for(var r=t+n,o=t;e[o]&&!(o>=r);)++o;if(o-t>16&&e.buffer&&C)return C.decode(e.subarray(t,o));for(var s="";t>10,56320|1023&u)}}else s+=String.fromCharCode((31&i)<<6|a)}else s+=String.fromCharCode(i)}return s}function k(e,t){return e?P(m,e,t):""}function E(e,t,n,r){if(!(r>0))return 0;for(var o=n,s=n+r-1,i=0;i=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),a<=127){if(n>=s)break;t[n++]=a}else if(a<=2047){if(n+1>=s)break;t[n++]=192|a>>6,t[n++]=128|63&a}else if(a<=65535){if(n+2>=s)break;t[n++]=224|a>>12,t[n++]=128|a>>6&63,t[n++]=128|63&a}else{if(n+3>=s)break;t[n++]=240|a>>18,t[n++]=128|a>>12&63,t[n++]=128|a>>6&63,t[n++]=128|63&a}}return t[n]=0,n-o}function I(e){for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t}function S(t){_=t,e.HEAP8=g=new Int8Array(t),e.HEAP16=y=new Int16Array(t),e.HEAP32=w=new Int32Array(t),e.HEAPU8=m=new Uint8Array(t),e.HEAPU16=v=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=b=new Float64Array(t)}var T=e.INITIAL_MEMORY||20971520;(l=e.wasmMemory?e.wasmMemory:new WebAssembly.Memory({initial:T/65536,maximum:2048}))&&(_=l.buffer),T=_.byteLength,S(_);var A,O,R=[],x=[],D=[],U=0,j=null,W=null;function L(t){e.onAbort&&e.onAbort(t),d(t="Aborted("+t+")"),f=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw n(r),r}function B(e){return e.startsWith("data:application/octet-stream;base64,")}function F(e){try{if(e==A&&u)return new Uint8Array(u);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}catch(e){L(e)}}B(A="tp.wasm")||(O=A,A=e.locateFile?e.locateFile(O,c):c+O);var H={101252:e=>{js_helper_destoryed(e)},101281:(e,t)=>{js_wss_connect(e,t)},101309:(e,t,n)=>{js_wss_send(e,t,n)},101338:e=>{js_wss_close(e)},101360:(e,t,n)=>{js_app_on_message(e,t,n)},101395:(e,t)=>{js_app_on_connect(e,t)},101426:(e,t)=>{js_app_on_close(e,t)},101455:(e,t,n)=>{on_socket_monitor(e,t,n)},101490:(e,t)=>{LOG_OUT(e,t)},101511:(e,t)=>{wcl_trace_log(e,t)}};function Y(t){for(;t.length>0;)t.shift()(e)}function N(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){M[this.ptr+4>>2]=e},this.get_type=function(){return M[this.ptr+4>>2]},this.set_destructor=function(e){M[this.ptr+8>>2]=e},this.get_destructor=function(){return M[this.ptr+8>>2]},this.set_refcount=function(e){w[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,g[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=g[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,g[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=g[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=w[this.ptr>>2];w[this.ptr>>2]=e+1},this.release_ref=function(){var e=w[this.ptr>>2];return w[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){M[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return M[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ae(this.get_type()))return M[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function G(){d("missing function: $SOCKFS"),L(-1)}function z(){d("missing function: $FS"),L(-1)}function $(e){var t=G.getSocket(e);if(!t)throw new z.ErrnoError(8);return t}function V(e){for(var t=e.split("."),n=0;n<4;n++){var r=Number(t[n]);if(isNaN(r))return null;t[n]=r}return(t[0]|t[1]<<8|t[2]<<16|t[3]<<24)>>>0}function X(e){return parseInt(e)}function K(e){var t,n,r,o,s=[];if(!/^((?=.*::)(?!.*::.+::)(::)?([\\dA-F]{1,4}:(:|\\b)|){5}|([\\dA-F]{1,4}:){6})((([\\dA-F]{1,4}((?!\\3)::|:\\b|$))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})$/i.test(e))return null;if("::"===e)return[0,0,0,0,0,0,0,0];for((e=e.startsWith("::")?e.replace("::","Z:"):e.replace("::",":Z:")).indexOf(".")>0?((t=(e=e.replace(new RegExp("[.]","g"),":")).split(":"))[t.length-4]=X(t[t.length-4])+256*X(t[t.length-3]),t[t.length-3]=X(t[t.length-2])+256*X(t[t.length-1]),t=t.slice(0,t.length-2)):t=e.split(":"),r=0,o=0,n=0;n>2]=16),y[e>>1]=t,w[e+4>>2]=n,y[e+2>>1]=ke(r);break;case 10:n=K(n),Z(e,28),o&&(w[o>>2]=28),w[e>>2]=t,w[e+8>>2]=n[0],w[e+12>>2]=n[1],w[e+16>>2]=n[2],w[e+20>>2]=n[3],y[e+2>>1]=ke(r);break;default:return 5}return 0}var J={address_map:{id:1,addrs:{},names:{}},lookup_name:function(e){var t,n=V(e);if(null!==n)return e;if(null!==(n=K(e)))return e;if(J.address_map.addrs[e])t=J.address_map.addrs[e];else{var r=J.address_map.id++;p(r<65535,"exceeded max address mappings of 65535"),t="172.29."+(255&r)+"."+(65280&r),J.address_map.names[t]=e,J.address_map.addrs[e]=t}return t},lookup_addr:function(e){return J.address_map.names[e]?J.address_map.names[e]:null}},Q={varargs:void 0,get:function(){return Q.varargs+=4,w[Q.varargs-4>>2]},getStr:function(e){return k(e)}};function ee(e){return(255&e)+"."+(e>>8&255)+"."+(e>>16&255)+"."+(e>>24&255)}function te(e){var t="",n=0,r=0,o=0,s=0,i=0,a=0,c=[65535&e[0],e[0]>>16,65535&e[1],e[1]>>16,65535&e[2],e[2]>>16,65535&e[3],e[3]>>16],u=!0,l="";for(a=0;a<5;a++)if(0!==c[a]){u=!1;break}if(u){if(l=ee(c[6]|c[7]<<16),-1===c[5])return t="::ffff:",t+=l;if(0===c[5])return t="::","0.0.0.0"===l&&(l=""),"0.0.0.1"===l&&(l="1"),t+=l}for(n=0;n<8;n++)0===c[n]&&(n-o>1&&(i=0),o=n,i++),i>r&&(s=n-(r=i)+1);for(n=0;n<8;n++)r>1&&0===c[n]&&n>=s&&n>1],o=Ce(v[e+2>>1]);switch(r){case 2:if(16!==t)return{errno:28};n=ee(n=w[e+4>>2]);break;case 10:if(28!==t)return{errno:28};n=te(n=[w[e+8>>2],w[e+12>>2],w[e+16>>2],w[e+20>>2]]);break;default:return{errno:5}}return{family:r,addr:n,port:o}}function re(e){return M[e>>2]+4294967296*w[e+4>>2]}function oe(e){return e%4==0&&(e%100!=0||e%400==0)}var se=[0,31,60,91,121,152,182,213,244,274,305,335],ie=[0,31,59,90,120,151,181,212,243,273,304,334];function ae(e){var t=I(e)+1,n=Ee(t);return n&&E(e,g,n,t),n}var ce=[];function ue(e,t,n){var r=function(e,t){var n;for(ce.length=0,t>>=2;n=m[e++];)t+=105!=n&t,ce.push(105==n?w[t]:b[t++>>1]),++t;return ce}(t,n);return H[e].apply(null,r)}function le(e){try{return l.grow(e-_.byteLength+65535>>>16),S(l.buffer),1}catch(e){}}var he={};function de(){if(!de.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:a||"./this.program"};for(var t in he)void 0===he[t]?delete e[t]:e[t]=he[t];var n=[];for(var t in e)n.push(t+"="+e[t]);de.strings=n}return de.strings}var fe=[null,[],[]];function pe(e,t){var n=fe[e];0===t||10===t?((1===e?h:d)(P(n,0)),n.length=0):n.push(t)}var _e=[31,29,31,30,31,30,31,31,30,31,30,31],ge=[31,28,31,30,31,30,31,31,30,31,30,31];function me(e,t){g.set(e,t)}function ye(e,t,n,r){var o=w[r+40>>2],s={tm_sec:w[r>>2],tm_min:w[r+4>>2],tm_hour:w[r+8>>2],tm_mday:w[r+12>>2],tm_mon:w[r+16>>2],tm_year:w[r+20>>2],tm_wday:w[r+24>>2],tm_yday:w[r+28>>2],tm_isdst:w[r+32>>2],tm_gmtoff:w[r+36>>2],tm_zone:o?k(o):""},i=k(n),a={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in a)i=i.replace(new RegExp(c,"g"),a[c]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function h(e,t,n){for(var r="number"==typeof e?e.toString():e||"";r.length0?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function _(e){var t=function(e,t){for(var n=new Date(e.getTime());t>0;){var r=oe(n.getFullYear()),o=n.getMonth(),s=(r?_e:ge)[o];if(!(t>s-n.getDate()))return n.setDate(n.getDate()+t),n;t-=s-n.getDate()+1,n.setDate(1),o<11?n.setMonth(o+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),r=new Date(t.getFullYear()+1,0,4),o=p(n),s=p(r);return f(o,t)<=0?f(s,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var g={"%a":function(e){return u[e.tm_wday].substring(0,3)},"%A":function(e){return u[e.tm_wday]},"%b":function(e){return l[e.tm_mon].substring(0,3)},"%B":function(e){return l[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return h(e.tm_mday,2," ")},"%g":function(e){return _(e).toString().substring(2)},"%G":function(e){return _(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+function(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}(oe(e.tm_year+1900)?_e:ge,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=e.tm_yday+7-e.tm_wday;return d(Math.floor(t/7),2)},"%V":function(e){var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var n=(e.tm_wday+371-e.tm_yday)%7;4==n||3==n&&oe(e.tm_year)||(t=1)}}else{t=52;var r=(e.tm_wday+7-e.tm_yday-1)%7;(4==r||5==r&&oe(e.tm_year%400-1))&&t++}return d(t,2)},"%w":function(e){return e.tm_wday},"%W":function(e){var t=e.tm_yday+7-(e.tm_wday+6)%7;return d(Math.floor(t/7),2)},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,n=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var c in i=i.replace(/%%/g,"\\0\\0"),g)i.includes(c)&&(i=i.replace(new RegExp(c,"g"),g[c](s)));i=i.replace(/\\0\\0/g,"%");var m,y,v,M,b,C,P=(m=i,y=!1,M=v>0?v:I(m)+1,b=new Array(M),C=E(m,b,0,b.length),y&&(b.length=C),b);return P.length>t?0:(me(P,e),P.length-1)}function ve(t){return e["_"+t]}function we(e,t,n,r,o){var s={string:e=>{var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2);!function(e,t,n){E(e,m,t,n)}(e,t=Te(n),n)}return t},array:e=>{var t=Te(e.length);return me(e,t),t}},i=ve(e),a=[],c=0;if(r)for(var u=0;u>2]=s.error,w[o>>2]=4,s.error=null,0):-50},n:function(e,t,n){return Q.varargs=n,0},F:function(e,t){var n=$(e);return n.sock_ops.listen(n,t),0},E:function(e,t,n){},m:function(e,t,n,r){Q.varargs=r},D:function(e){},C:function(e,t,n){},B:function(e,t,n,r,o,s){var i=$(e),a=i.sock_ops.recvmsg(i,n);return a?(o&&q(o,i.family,J.lookup_name(a.addr),a.port,s),m.set(a.buffer,t),a.buffer.byteLength):0},A:function(e,t,n){var r,o,s=$(e),i=M[t+8>>2],a=w[t+12>>2],c=M[t>>2],u=w[t+4>>2];if(c){var l=ne(c,u);if(l.errno)return-l.errno;o=l.port,r=J.lookup_addr(l.addr)||l.addr}for(var h=0,d=0;d>2];var f=new Uint8Array(h),p=0;for(d=0;d>2],m=w[i+(8*d+4)>>2],y=0;y>0];return s.sock_ops.sendmsg(s,f,0,h,r,o)},l:function(e,t,n){},x:function(){return!0},w:function(e,t){var n=new Date(1e3*re(e));w[t>>2]=n.getUTCSeconds(),w[t+4>>2]=n.getUTCMinutes(),w[t+8>>2]=n.getUTCHours(),w[t+12>>2]=n.getUTCDate(),w[t+16>>2]=n.getUTCMonth(),w[t+20>>2]=n.getUTCFullYear()-1900,w[t+24>>2]=n.getUTCDay();var r=Date.UTC(n.getUTCFullYear(),0,1,0,0,0,0),o=(n.getTime()-r)/864e5|0;w[t+28>>2]=o},v:function(e,t){var n=new Date(1e3*re(e));w[t>>2]=n.getSeconds(),w[t+4>>2]=n.getMinutes(),w[t+8>>2]=n.getHours(),w[t+12>>2]=n.getDate(),w[t+16>>2]=n.getMonth(),w[t+20>>2]=n.getFullYear()-1900,w[t+24>>2]=n.getDay();var r=0|function(e){return(oe(e.getFullYear())?se:ie)[e.getMonth()]+e.getDate()-1}(n);w[t+28>>2]=r,w[t+36>>2]=-60*n.getTimezoneOffset();var o=new Date(n.getFullYear(),0,1),s=new Date(n.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),a=0|(s!=i&&n.getTimezoneOffset()==Math.min(i,s));w[t+32>>2]=a},u:function(e,t,n){var r=(new Date).getFullYear(),o=new Date(r,0,1),s=new Date(r,6,1),i=o.getTimezoneOffset(),a=s.getTimezoneOffset(),c=Math.max(i,a);function u(e){var t=e.toTimeString().match(/\\(([A-Za-z ]+)\\)$/);return t?t[1]:"GMT"}M[e>>2]=60*c,w[t>>2]=Number(i!=a);var l=u(o),h=u(s),d=ae(l),f=ae(h);a>2]=d,M[n+4>>2]=f):(M[n>>2]=f,M[n+4>>2]=d)},j:function(){L("")},c:function(e,t,n){return ue(e,t,n)},f:function(){return Date.now()},t:function(e,t,n){m.copyWithin(e,t,t+n)},s:function(e){var t,n,r=m.length;if((e>>>=0)>134217728)return self.wasm_memory_alert(e,134217728),!1;for(var o=1;o<=4;o*=2){var s=r*(1+.2/o);if(s=Math.min(s,e+100663296),le(Math.min(134217728,(t=Math.max(e,s))+((n=65536)-t%n)%n)))return!0}return!1},z:function(e,t){var n=0;return de().forEach((function(r,o){var s=t+n;M[e+4*o>>2]=s,function(e,t,n){for(var r=0;r>0]=e.charCodeAt(r);n||(g[t>>0]=0)}(r,s),n+=r.length+1})),0},y:function(e,t){var n=de();M[e>>2]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),M[t>>2]=r,0},e:function(e){return 52},k:function(e,t,n,r){return 52},q:function(e,t,n,r,o){return 70},g:function(e,t,n,r){for(var o=0,s=0;s>2],a=M[t+4>>2];t+=8;for(var c=0;c>2]=o,0},r:function(e,t,n,r){var o,s=0,i=0,a=0,c=0,u=0,l=0;function h(e,t,n,r,o,s){var i,a,c;return a=10===e?28:16,o=10===e?te(o):ee(o),p(!q(i=Ee(a),e,o,s)),c=Ee(32),w[c+4>>2]=e,w[c+8>>2]=t,w[c+12>>2]=n,w[c+24>>2]=r,M[c+20>>2]=i,w[c+16>>2]=10===e?28:16,w[c+28>>2]=0,c}if(n&&(a=w[n>>2],c=w[n+4>>2],u=w[n+8>>2],l=w[n+12>>2]),u&&!l&&(l=2===u?17:6),!u&&l&&(u=17===l?2:1),0===l&&(l=6),0===u&&(u=1),!e&&!t)return-2;if(-1088&a)return-1;if(0!==n&&2&w[n>>2]&&!e)return-1;if(32&a)return-2;if(0!==u&&1!==u&&2!==u)return-7;if(0!==c&&2!==c&&10!==c)return-6;if(t&&(t=k(t),i=parseInt(t,10),isNaN(i)))return 1024&a?-2:-8;if(!e)return 0===c&&(c=2),0==(1&a)&&(s=2===c?Pe(2130706433):[0,0,0,1]),o=h(c,u,l,null,s,i),M[r>>2]=o,0;if(null!==(s=V(e=k(e))))if(0===c||2===c)c=2;else{if(!(10===c&&8&a))return-2;s=[0,0,Pe(65535),s],c=10}else if(null!==(s=K(e))){if(0!==c&&10!==c)return-2;c=10}return null!=s?(o=h(c,u,l,e,s,i),M[r>>2]=o,0):4&a?-2:(s=V(e=J.lookup_name(e)),0===c?c=2:10===c&&(s=[0,0,Pe(65535),s]),o=h(c,u,l,null,s,i),M[r>>2]=o,0)},a:l,p:ye,o:function(e,t,n,r,o){return ye(e,t,n,r)},d:function(e){var t=null;if(!t){t=new Array(16);for(var n=(new Date).getTime(),r=0;r<16;r++){var o=(n+256*Math.random())%256|0;n=n/256|0,t[r]=o}}t[6]=15&t[6]|64,t[8]=63&t[8]|128,me(t,e)}},Ce=(function(){var t={a:be};function r(t,n){var r,o=t.exports;e.asm=o,e.asm.M,r=e.asm.L,x.unshift(r),function(t){if(U--,e.monitorRunDependencies&&e.monitorRunDependencies(U),0==U&&(null!==j&&(clearInterval(j),j=null),W)){var n=W;W=null,n()}}()}function o(e){r(e.instance)}function s(e){return(u||"function"!=typeof fetch?Promise.resolve().then((function(){return F(A)})):fetch(A,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at \'"+A+"\'";return e.arrayBuffer()})).catch((function(){return F(A)}))).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(e,(function(e){d("failed to asynchronously prepare wasm: "+e),L(e)}))}if(U++,e.monitorRunDependencies&&e.monitorRunDependencies(U),e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),n(e)}(u||"function"!=typeof WebAssembly.instantiateStreaming||B(A)||"function"!=typeof fetch?s(o):fetch(A,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(o,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),s(o)}))}))).catch(n)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.L).apply(null,arguments)},e._init_tp_worker=function(){return(e._init_tp_worker=e.asm.N).apply(null,arguments)},e._thread_run=function(){return(e._thread_run=e.asm.O).apply(null,arguments)},e._create_wcl_tp_handler=function(){return(e._create_wcl_tp_handler=e.asm.P).apply(null,arguments)},e._destroy_wcl_tp_handler=function(){return(e._destroy_wcl_tp_handler=e.asm.Q).apply(null,arguments)},e._wcl_tp_handler_connect=function(){return(e._wcl_tp_handler_connect=e.asm.R).apply(null,arguments)},e._wcl_tp_handler_send=function(){return(e._wcl_tp_handler_send=e.asm.S).apply(null,arguments)},e._wcl_tp_handler_close=function(){return(e._wcl_tp_handler_close=e.asm.T).apply(null,arguments)},e._wcl_tp_helper_on_connect=function(){return(e._wcl_tp_helper_on_connect=e.asm.U).apply(null,arguments)},e._wcl_tp_helper_on_close=function(){return(e._wcl_tp_helper_on_close=e.asm.V).apply(null,arguments)},e._wcl_tp_helper_on_message=function(){return(e._wcl_tp_helper_on_message=e.asm.W).apply(null,arguments)},e._ntohs=function(){return(Ce=e._ntohs=e.asm.X).apply(null,arguments)}),Pe=e._htonl=function(){return(Pe=e._htonl=e.asm.Y).apply(null,arguments)},ke=e._htons=function(){return(ke=e._htons=e.asm.Z).apply(null,arguments)},Ee=e._malloc=function(){return(Ee=e._malloc=e.asm._).apply(null,arguments)},Ie=e.stackSave=function(){return(Ie=e.stackSave=e.asm.$).apply(null,arguments)},Se=e.stackRestore=function(){return(Se=e.stackRestore=e.asm.aa).apply(null,arguments)},Te=e.stackAlloc=function(){return(Te=e.stackAlloc=e.asm.ba).apply(null,arguments)},Ae=e.___cxa_is_pointer_type=function(){return(Ae=e.___cxa_is_pointer_type=e.asm.ca).apply(null,arguments)};function Oe(n){function r(){Me||(Me=!0,e.calledRun=!0,f||(Y(x),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),D.unshift(t);var t;Y(D)}()))}n=n||i,U>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),R.unshift(t);var t;Y(R)}(),U>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(e.cwrap=function(e,t,n,r){var o=(n=n||[]).every(e=>"number"===e||"boolean"===e);return"string"!==t&&o&&!r?ve(e):function(){return we(e,t,n,arguments)}},W=function e(){Me||Oe(),Me||(W=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return Oe(),e.ready});t.default=o},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Connection=void 0;const o=n(1),s=n(5),i=n(0),a=n(6);t.Connection=class{constructor(e,t,n,r,c,u,l){this.messageId=e,this.wssUrl=t,this.Module=n,this.API=r,this.target=c,this.tpLogger=u,this.logBase=l,this.isOpened=!1,this.isClosing=!1,this.isClosed=!1,this.fallback=!1,this.isTPConnectFinished=!1,this.encoder=new TextEncoder,this.decoder=new TextDecoder("utf-8"),this.messageCache=[],this.type=a.URL_TYPE.UNKNOWN,this.debugWS=null,this.cache=[],this.id=(0,s.getId)(),this.send=e=>{var t,n;if(this.fallback)(null===(t=this.socket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&(null===(n=this.socket)||void 0===n||n.send(e));else{let t=e;"string"==typeof t&&(this.debugWS&&this.debugWS.readyState===WebSocket.OPEN&&this.debugWS.send("send "+e),t=this.encoder.encode(t+"\\n")),this.tp_send(t)}},this.onclose=e=>{this.interval&&self.clearInterval(this.interval),this.target.postMessage({type:"close",id:this.messageId,reason:e.reason,code:e.code}),o.ConnectionManager.removeIdConnectionMap(this.id),this.type===a.URL_TYPE.RWG&&i.Monitor.setConnectionError(!0),this.isClosed=!0},this.type=(0,a.getUrlType)(t),this.sendLog=e=>i.Monitor.addMonitor(e,this.type===a.URL_TYPE.RWG),this.sendLog("TPWSURL,"+this.type+","+this.id),this.target.addEventListener("message",e=>{let t=e.data;if(t.id===this.messageId)switch(t.type){case"send":this.send(t.data);break;case"close":this.fallback?this.socket.close():this.tp_close();break;case"close_wss":0}}),o.ConnectionManager.setIdConnectionMap(this.id,this),this.tp_connect(),this.interval=self.setInterval(()=>{this.cache.length&&(this.cache.forEach(e=>{var t;if(this.socket)if("send"===e.type)try{this.socket.readyState===WebSocket.OPEN&&this.socket.send(e.data)}catch(e){0,null===(t=this.tpLogger)||void 0===t||t.call(this,"directReport",null==e?void 0:e.message)}else"close"===e.type&&this.socket.close()}),this.cache=[])},10)}tp_connect(){this.handler=this.API.create_wcl_tp_handler(),o.ConnectionManager.setHandlerIdMap(this.handler,this.id),this.API.wcl_tp_handler_connect(this.handler,this.id)}tp_send(e){let t=new Uint8Array(e);this.API.wcl_tp_handler_send(this.handler,t,e.byteLength)}tp_close(){if(this.isClosing||this.isClosed)return;if(this.sendLog("TPCLO,"+this.type),this.isClosing=!0,null===this.handler)return;let e=this.handler;this.socket&&this.socket.readyState===WebSocket.OPEN||(this.sendLog("TPCLOBE,"+this.type+","+this.socket.readyState),this.cleanSocket(this.socket),this.onclose({code:1006,reason:""})),this.handler=null,this.API.wcl_tp_handler_close(e),this.API.destroy_wcl_tp_handler(e),o.ConnectionManager.removeHandlerIdMap(e)}cleanSocket(e){e&&(e.onopen=null,e.onclose=null,e.onmessage=null,e.onerror=null)}connectWebSocket(e){return r(this,void 0,void 0,(function*(){return new Promise((t,n)=>{this.socket&&this.cleanSocket(this.socket);const r=new URL(e);this.isTPConnectFinished&&this.sendLog("TPREC,"+this.type);const o=this.socket=new WebSocket(r);o.binaryType="arraybuffer",o.onopen=()=>{this.sendLog("TPWSO,"+this.type),t(o),this.isOpened=!0},o.onerror=e=>{this.sendLog("TPWSE,"+this.type),this.fallback?this.target.postMessage({type:"error",id:this.messageId}):(this.helper&&this.API.wcl_tp_helper_on_close(this.helper),this.isOpened||n(e))},o.onmessage=e=>{if(this.isTPConnectFinished||this.messageCache.push(e.data),this.fallback)this.target.postMessage({type:"message",data:e.data,id:this.messageId});else if(this.helper){let t=new Uint8Array(e.data);this.API.wcl_tp_helper_on_message(this.helper,t,e.data.byteLength)}},o.onclose=e=>{var t;if(this.sendLog("TPWSC,"+this.type),this.fallback)this.target.postMessage({type:"close",id:this.messageId,reason:e.reason,code:e.code});else{const r=e.code,o=e.reason;this.helper&&this.API.wcl_tp_helper_on_close(this.helper),null===(t=this.tpLogger)||void 0===t||t.call(this,"directReport","WebSocket closeCode "+r+" closeReason "+o),this.isOpened||n(e),this.isClosing&&this.onclose(e)}}})}))}js_wss_connect(e){o.ConnectionManager.setHelperConnectionMap(e,this),this.helper=e,this.connectWebSocket(this.wssUrl).then(()=>{this.helper&&this.API.wcl_tp_helper_on_connect(this.helper)}).catch(()=>{this.target.postMessage({type:"error",id:this.messageId}),this.type===a.URL_TYPE.RWG&&i.Monitor.setConnectionError(!0)})}js_wss_send(e,t){if(!this.fallback){var n=new Uint8Array(t),r=this.Module.HEAP8.subarray(e,e+t);n.set(r,0),this.cache.push({type:"send",data:n})}}js_wss_close(){this.sendLog("TPCBC,"+this.type),!this.fallback&&this.isTPConnectFinished&&this.cache.push({type:"close"})}js_app_on_message(e,t){const n=new Uint8Array(this.Module.HEAP8.buffer,e,t),r=this.decoder.decode(n);this.debugWS&&this.debugWS.readyState===WebSocket.OPEN&&this.debugWS.send("receive "+r),this.target.postMessage({type:"message",data:r,id:this.messageId})}js_helper_destoryed(){o.ConnectionManager.removeHelperConnectionMap(this.helper),this.helper=null}js_app_on_connect(e){this.sendLog("TPCBCON,"+this.type+","+e),0===e?(this.target.postMessage({type:"open",id:this.messageId}),this.type===a.URL_TYPE.RWG&&i.Monitor.setConnection(this)):(this.sendLog("TPFBK,"+this.type),this.fallback=!0,this.target.postMessage({type:"open",fallback:!0,id:this.messageId}),this.messageCache.forEach(e=>{this.target.postMessage({type:"message",data:e,id:this.messageId})})),this.isTPConnectFinished=!0}js_app_on_close(e){this.sendLog("TPCBCLO,"+this.type+","+e),o.ConnectionManager.removeHandlerIdMap(this.handler),this.handler=null,this.onclose({reason:"",code:e})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getId=void 0;const r=function*(){let e=1;for(;;)yield e,e=e<65535?e+1:1}();t.getId=function(){return r.next().value}},function(e,t,n){"use strict";function r(e){const t=new URLSearchParams(e.search);return e.hostname.includes("rwg")&&(t.has("dn2")||t.has("islch"))}function o(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"m"===e.searchParams.get("type")}function s(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"x"===e.searchParams.get("type")}function i(e){return e.pathname.includes("/wc/media")&&e.hostname.includes("rwg")&&"v"===e.searchParams.get("type")&&"16"===e.searchParams.get("mode")}function a(e){return e.pathname.includes("/ab/signal")&&e.hostname.includes("rwg")&&e.searchParams.get("rwg")===e.hostname}var c;Object.defineProperty(t,"__esModule",{value:!0}),t.URL_TYPE=t.getUrlType=t.isAudioBridge=t.isVideoBridge=t.isXmpp=t.isBoMaster=t.isRwg=void 0,t.isRwg=r,t.isBoMaster=o,t.isXmpp=s,t.isVideoBridge=i,t.isAudioBridge=a,t.getUrlType=function(e){const t="string"==typeof e?new URL(e):e;return r(t)?c.RWG:o(t)?c.BO_MASTER:s(t)?c.XMPP:i(t)?c.VIDEO_BRIDGE:a(t)?c.AUDIO_BRIDGE:c.UNKNOWN},function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.RWG=1]="RWG",e[e.BO_MASTER=2]="BO_MASTER",e[e.XMPP=3]="XMPP",e[e.VIDEO_BRIDGE=4]="VIDEO_BRIDGE",e[e.AUDIO_BRIDGE=5]="AUDIO_BRIDGE"}(c||(t.URL_TYPE=c={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuid=void 0,t.uuid=function(){var e;return(null===(e=null===crypto||void 0===crypto?void 0:crypto.randomUUID)||void 0===e?void 0:e.call(crypto))||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}]);\n',"Worker",{name:"zoom-tp"},void 0)}},function(e,t,n){"use strict";var r,o,s,i,a,c,u,l,d,f,h,p,g,_,m,y=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},w=this&&this.__classPrivateFieldSet||function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};Object.defineProperty(t,"__esModule",{value:!0}),t.TPSocket=void 0;const v=n(5),b=n(1),M=n(0);class P extends Event{constructor(e,t){super(e),Object.assign(this,t)}}class k extends EventTarget{get url(){return y(this,a,"f")}set url(e){}get readyState(){return y(this,c,"f")}set readyState(e){}get protocol(){return y(this,u,"f")}set protocol(e){}get bufferedAmount(){return y(this,l,"f")}set bufferedAmount(e){}get extensions(){return y(this,d,"f")}set extensions(e){}get OPEN(){return y(this,f,"f")}set OPEN(e){}get CONNECTING(){return y(this,h,"f")}set CONNECTING(e){}get CLOSING(){return y(this,p,"f")}set CLOSING(e){}get CLOSED(){return y(this,g,"f")}set CLOSED(e){}constructor(e,t){var n,P,k,E,O;super(),r.add(this),this.isRlb=!0,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.binaryType="arraybuffer",s.set(this,(0,v.uuid)()),i.set(this,!1),a.set(this,void 0),c.set(this,WebSocket.CONNECTING),u.set(this,""),l.set(this,0),d.set(this,""),f.set(this,WebSocket.OPEN),h.set(this,WebSocket.CONNECTING),p.set(this,WebSocket.CLOSING),g.set(this,WebSocket.CLOSED),_.set(this,e=>{var t;let n=e.data;if(n.id===y(this,s,"f"))switch(n.type){case"open":y(this,c,"f")===WebSocket.CONNECTING&&(w(this,c,WebSocket.OPEN,"f"),this.isRlb=!n.fallback,y(this,r,"m",m).call(this,"open"));break;case"close":y(this,r,"m",m).call(this,"close",{reason:n.reason,code:n.code}),y(this,i,"f")&&(null===M.tpLogger||void 0===M.tpLogger||(0,M.tpLogger)("directReport","callback close event")),null===(t=o.target)||void 0===t||t.removeEventListener("message",y(this,_,"f")),w(this,c,WebSocket.CLOSED,"f");break;case"error":y(this,r,"m",m).call(this,"error");break;case"message":y(this,r,"m",m).call(this,"message",{data:n.data})}});const S="string"==typeof e?new URL(e):e;S.searchParams.set("rlb","1"),w(this,a,S.toString(),"f"),(0,b.isRwg)(S)&&(w(this,i,!0,"f"),(0,M.setCmd)(this)),o.target&&o.target instanceof MessagePort?self.addEventListener("message",e=>{var t;"error"===(null===(t=e.data)||void 0===t?void 0:t.type)&&y(this,r,"m",m).call(this,"error")}):null===(n=o.target)||void 0===n||n.addEventListener("error",e=>{e.message&&e.message.includes("RuntimeError:")&&y(this,r,"m",m).call(this,"error")}),null===(P=o.target)||void 0===P||P.addEventListener("message",y(this,_,"f")),null===(k=o.target)||void 0===k||k.postMessage({type:"connect",url:y(this,a,"f"),id:y(this,s,"f")}),o.target instanceof MessagePort&&(null===(O=null===(E=o.target)||void 0===E?void 0:E.start)||void 0===O||O.call(E))}send(e){var t;y(this,c,"f")===WebSocket.OPEN&&(null===(t=o.target)||void 0===t||t.postMessage({type:"send",data:e,id:y(this,s,"f")}))}close(){var e;y(this,i,"f")&&(null===M.tpLogger||void 0===M.tpLogger||(0,M.tpLogger)("directReport","call close tp")),w(this,c,WebSocket.CLOSING,"f"),null===(e=o.target)||void 0===e||e.postMessage({type:"close",id:y(this,s,"f")})}socketError(e){y(this,r,"m",m).call(this,"error",{code:4001,reason:e})}}t.TPSocket=k,o=k,s=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakMap,g=new WeakMap,_=new WeakMap,r=new WeakSet,m=function(e,t={}){var n;const r=new P(e,t);null===(n=this["on"+e])||void 0===n||n.call(this,r),this.dispatchEvent(r)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuid=void 0,t.uuid=function(){var e;return(null===(e=null===crypto||void 0===crypto?void 0:crypto.randomUUID)||void 0===e?void 0:e.call(crypto))||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isRlb=t.getOption=void 0;const r=n(1);function o(e,t,n){try{let r=e.length;if(t>r)return 0;let o=e.slice(r-t-n+1,r-t+1);if(o){return parseInt(o,16)}}catch(e){}return 0}t.getOption=o,t.isRlb=function(e,t){return!!o(t,47,1)&&!!((0,r.isRwg)(e)||(0,r.isBoMaster)(e)||(0,r.isXmpp)(e)||(0,r.isVideoBridge)(e)||(0,r.isAudioBridge)(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logger=void 0,t.logger=function(e=console){return(t,n,r,o)=>{var s,i,a,c;"directReport"===t?null===(s=e.directReport||e.log)||void 0===s||s(n,o||["TP_INFO"]):"error"===t?null===(i=e.error)||void 0===i||i.call(e,n,r):"warn"===t?null===(a=e.warn)||void 0===a||a.call(e,n):null===(c=e.log)||void 0===c||c.call(e,n)}}}])})); +//# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/tp.min.js-9433bdfc18666d7118dd.map \ No newline at end of file diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/tp.wasm b/@zoom/videosdk-ui-toolkit/dist/lib/tp.wasm new file mode 100644 index 0000000..528c2a9 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/lib/tp.wasm differ diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/dualModel.bin b/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/dualModel.bin new file mode 100644 index 0000000..e3310c8 Binary files /dev/null and b/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/dualModel.bin differ diff --git a/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/tf.min.js b/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/tf.min.js new file mode 100644 index 0000000..0001c89 --- /dev/null +++ b/@zoom/videosdk-ui-toolkit/dist/lib/vb-resource/tf.min.js @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2021 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).tf=e.tf||{})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,t){return e(t={exports:{}},t.exports),t.exports}var r=function(e){return e&&e.Math==Math&&e},a=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(e){return!0}},o=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s={}.propertyIsEnumerable,u=Object.getOwnPropertyDescriptor,l={f:u&&!s.call({1:2},1)?function(e){var t=u(this,e);return!!t&&t.enumerable}:s},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},p={}.toString,h=function(e){return p.call(e).slice(8,-1)},f="".split,d=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==h(e)?f.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},v=function(e){return d(m(e))},g=function(e){return"object"==typeof e?null!==e:"function"==typeof e},y=function(e,t){if(!g(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!g(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!g(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!g(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},b={}.hasOwnProperty,x=function(e,t){return b.call(e,t)},w=a.document,k=g(w)&&g(w.createElement),N=function(e){return k?w.createElement(e):{}},I=!o&&!i((function(){return 7!=Object.defineProperty(N("div"),"a",{get:function(){return 7}}).a})),S=Object.getOwnPropertyDescriptor,T={f:o?S:function(e,t){if(e=v(e),t=y(t,!0),I)try{return S(e,t)}catch(e){}if(x(e,t))return c(!l.f.call(e,t),e[t])}},C=function(e){if(!g(e))throw TypeError(String(e)+" is not an object");return e},E=Object.defineProperty,R={f:o?E:function(e,t,n){if(C(e),t=y(t,!0),C(n),I)try{return E(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},A=o?function(e,t,n){return R.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},F=function(e,t){try{A(a,e,t)}catch(n){a[e]=t}return t},_="__core-js_shared__",D=a[_]||F(_,{}),O=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return O.call(e)});var M,L,z,P=D.inspectSource,B=a.WeakMap,W="function"==typeof B&&/native code/.test(P(B)),V=n((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.9.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),U=0,G=Math.random(),j=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++U+G).toString(36)},H=V("keys"),q=function(e){return H[e]||(H[e]=j(e))},K={},X=a.WeakMap;if(W){var Y=D.state||(D.state=new X),J=Y.get,Z=Y.has,Q=Y.set;M=function(e,t){return t.facade=e,Q.call(Y,e,t),t},L=function(e){return J.call(Y,e)||{}},z=function(e){return Z.call(Y,e)}}else{var $=q("state");K[$]=!0,M=function(e,t){return t.facade=e,A(e,$,t),t},L=function(e){return x(e,$)?e[$]:{}},z=function(e){return x(e,$)}}var ee,te,ne={set:M,get:L,has:z,enforce:function(e){return z(e)?L(e):M(e,{})},getterFor:function(e){return function(t){var n;if(!g(t)||(n=L(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},re=n((function(e){var t=ne.get,n=ne.enforce,r=String(String).split("String");(e.exports=function(e,t,i,o){var s,u=!!o&&!!o.unsafe,l=!!o&&!!o.enumerable,c=!!o&&!!o.noTargetGet;"function"==typeof i&&("string"!=typeof t||x(i,"name")||A(i,"name",t),(s=n(i)).source||(s.source=r.join("string"==typeof t?t:""))),e!==a?(u?!c&&e[t]&&(l=!0):delete e[t],l?e[t]=i:A(e,t,i)):l?e[t]=i:F(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||P(this)}))})),ae=a,ie=function(e){return"function"==typeof e?e:void 0},oe=function(e,t){return arguments.length<2?ie(ae[e])||ie(a[e]):ae[e]&&ae[e][t]||a[e]&&a[e][t]},se=Math.ceil,ue=Math.floor,le=function(e){return isNaN(e=+e)?0:(e>0?ue:se)(e)},ce=Math.min,pe=function(e){return e>0?ce(le(e),9007199254740991):0},he=Math.max,fe=Math.min,de=function(e,t){var n=le(e);return n<0?he(n+t,0):fe(n,t)},me=function(e){return function(t,n,r){var a,i=v(t),o=pe(i.length),s=de(r,o);if(e&&n!=n){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},ve={includes:me(!0),indexOf:me(!1)},ge=ve.indexOf,ye=function(e,t){var n,r=v(e),a=0,i=[];for(n in r)!x(K,n)&&x(r,n)&&i.push(n);for(;t.length>a;)x(r,n=t[a++])&&(~ge(i,n)||i.push(n));return i},be=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xe=be.concat("length","prototype"),we={f:Object.getOwnPropertyNames||function(e){return ye(e,xe)}},ke={f:Object.getOwnPropertySymbols},Ne=oe("Reflect","ownKeys")||function(e){var t=we.f(C(e)),n=ke.f;return n?t.concat(n(e)):t},Ie=function(e,t){for(var n=Ne(t),r=R.f,a=T.f,i=0;i=74)&&(ee=Me.match(/Chrome\/(\d+)/))&&(te=ee[1]);var Be,We=te&&+te,Ve=!!Object.getOwnPropertySymbols&&!i((function(){return!Symbol.sham&&(Oe?38===We:We>37&&We<41)})),Ue=Ve&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ge=Array.isArray||function(e){return"Array"==h(e)},je=function(e){return Object(m(e))},He=Object.keys||function(e){return ye(e,be)},qe=o?Object.defineProperties:function(e,t){C(e);for(var n,r=He(t),a=r.length,i=0;a>i;)R.f(e,n=r[i++],t[n]);return e},Ke=oe("document","documentElement"),Xe=q("IE_PROTO"),Ye=function(){},Je=function(e){return" + + \ No newline at end of file diff --git a/scripts.js b/scripts.js index 787f335..768a43e 100644 --- a/scripts.js +++ b/scripts.js @@ -1,5 +1,3 @@ -import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js' - var sessionContainer = document.getElementById('sessionContainer') var authEndpoint = '' var config = { @@ -7,13 +5,16 @@ var config = { sessionName: 'test', userName: 'JavaScript', sessionPasscode: '123', - features: ['preview', 'video', 'audio', 'settings', 'users', 'chat', 'share'], - options: { init: {}, audio: {}, video: {}, share: {}}, - virtualBackground: { - allowVirtualBackground: true, - allowVirtualBackgroundUpload: true, - virtualBackgrounds: ['https://images.unsplash.com/photo-1715490187538-30a365fa05bd?q=80&w=1945&auto=format&fit=crop'] - } + featuresOptions: { + virtualBackground: { + enable: true, + virtualBackgrounds: [ + { + url: 'https://images.unsplash.com/photo-1715490187538-30a365fa05bd?q=80&w=1945&auto=format&fit=crop' + }, + ], + }, + }, }; var role = 1 diff --git a/styles.css b/styles.css index df87558..2f10e67 100644 --- a/styles.css +++ b/styles.css @@ -11,28 +11,32 @@ html, body { min-width: 0 !important; } -main { +main #join-flow { width: 70%; margin: auto; text-align: center; } main #join-flow button { - margin-top: 20px; - background-color: #2D8CFF; - color: #ffffff; - text-decoration: none; - padding-top: 10px; - padding-bottom: 10px; - padding-left: 40px; - padding-right: 40px; - display: inline-block; - border-radius: 10px; - cursor: pointer; - border: none; - outline: none; + margin-top: 20px; + background-color: #2D8CFF; + color: #ffffff; + text-decoration: none; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 40px; + padding-right: 40px; + display: inline-block; + border-radius: 10px; + cursor: pointer; + border: none; + outline: none; } main #join-flow button:hover { background-color: #2681F2; -} \ No newline at end of file +} + +#uikit-container-app { + height: 100vh; + } \ No newline at end of file