@vinay.kumar.ha/videosdk-ui-toolkit 2.3.5-1.5 → 2.3.5-1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/lib/annoter.min.js +3 -0
  2. package/dist/lib/audio.encode.wasm +0 -0
  3. package/dist/lib/audio.light.simd.wasm +0 -0
  4. package/dist/lib/audio.simd.wasm +0 -0
  5. package/dist/lib/audio_light_simd.min.js +2 -0
  6. package/dist/lib/audio_simd.min.js +2 -0
  7. package/dist/lib/graphics.min.js +2 -0
  8. package/dist/lib/js_audio_level_worklet_process.min.js +2 -0
  9. package/dist/lib/js_audio_level_worklet_process_light.min.js +2 -0
  10. package/dist/lib/js_audio_process.min.js +2 -0
  11. package/dist/lib/js_audio_processor_worklet.min.js +2 -0
  12. package/dist/lib/js_audio_worklet.min.js +2 -0
  13. package/dist/lib/js_audio_worklet_light_simd.min.js +2 -0
  14. package/dist/lib/js_audio_worklet_process.min.js +2 -0
  15. package/dist/lib/js_audio_worklet_simd.min.js +2 -0
  16. package/dist/lib/js_media.min.js +3 -0
  17. package/dist/lib/js_sharing_audio_worklet.min.js +2 -0
  18. package/dist/lib/manifest.json +338 -0
  19. package/dist/lib/mesh_thread.min.js +2 -0
  20. package/dist/lib/net.wasm +0 -0
  21. package/dist/lib/net_thread.min.js +2 -0
  22. package/dist/lib/pako.min.js +2 -0
  23. package/dist/lib/qrscanner.min.js +2 -0
  24. package/dist/lib/share_processor.min.js +2 -0
  25. package/dist/lib/sharing_m.min.js +3 -0
  26. package/dist/lib/sharing_mtsimd.min.js +3 -0
  27. package/dist/lib/sharing_s.min.js +2 -0
  28. package/dist/lib/sharing_simd.min.js +2 -0
  29. package/dist/lib/tp.min.js +2 -0
  30. package/dist/lib/tp.wasm +0 -0
  31. package/dist/lib/vb-resource/dualModel.bin +0 -0
  32. package/dist/lib/vb-resource/tf.min.js +18 -0
  33. package/dist/lib/vb.min.js +2 -0
  34. package/dist/lib/vb_worker.min.js +2 -0
  35. package/dist/lib/video.decode.js +1 -0
  36. package/dist/lib/video.decode.wasm +0 -0
  37. package/dist/lib/video.mt.js +1 -0
  38. package/dist/lib/video.mt.wasm +0 -0
  39. package/dist/lib/video.mtsimd.js +1 -0
  40. package/dist/lib/video.mtsimd.wasm +0 -0
  41. package/dist/lib/video.simd.js +1 -0
  42. package/dist/lib/video.simd.wasm +0 -0
  43. package/dist/lib/video_m.min.js +3 -0
  44. package/dist/lib/video_mtsimd.min.js +3 -0
  45. package/dist/lib/video_processor.min.js +2 -0
  46. package/dist/lib/video_s.min.js +2 -0
  47. package/dist/lib/video_share_mtsimd.min.js +3 -0
  48. package/dist/lib/video_simd.min.js +2 -0
  49. package/dist/lib/wasm_ssrc_stream_service_dynmod.min.js +2 -0
  50. package/dist/lib/webgpu_renderer_dynmod.min.js +2 -0
  51. package/dist/lib/wmsc.min.js +2 -0
  52. package/dist/videosdk-ui-toolkit.min.esm.js +1832 -1832
  53. package/dist/videosdk-ui-toolkit.min.umd.js +82 -82
  54. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ (()=>{var e={1265:(e,t,r)=>{e.exports=r(4598)},6984:(e,t,r)=>{e.exports=r(9792)},7201:(e,t,r)=>{e.exports=r(3042)},1829:(e,t,r)=>{"use strict";var i=r(2222);e.exports=i},6040:(e,t,r)=>{"use strict";var i=r(8251);e.exports=i},7264:(e,t,r)=>{"use strict";var i=r(4139);r(768),r(8549),r(7152),r(1372),e.exports=i},9692:(e,t,r)=>{"use strict";var i=r(7045);e.exports=i},5663:(e,t,r)=>{"use strict";var i=r(70);e.exports=i},6823:(e,t,r)=>{"use strict";var i=r(8280),a=r(2017),n=String.prototype;e.exports=function(e){var t=e.replaceAll;return"string"==typeof e||e===n||i(n,e)&&t===n.replaceAll?a:t}},1042:(e,t,r)=>{"use strict";var i=r(8280),a=r(7511),n=String.prototype;e.exports=function(e){var t=e.trim;return"string"==typeof e||e===n||i(n,e)&&t===n.trim?a:t}},1926:(e,t,r)=>{"use strict";r(6750);var i=r(2046).Object,a=e.exports=function(e,t,r){return i.defineProperty(e,t,r)};i.defineProperty.sham&&(a.sham=!0)},2017:(e,t,r)=>{"use strict";r(1398),r(1995),r(929);var i=r(1747);e.exports=i("String","replaceAll")},7511:(e,t,r)=>{"use strict";r(727);var i=r(1747);e.exports=i("String","trim")},3842:(e,t,r)=>{"use strict";r(8545),r(3643),r(4452),r(3997),r(5084),r(2596),r(5721),r(4954),r(4123),r(3377),r(2230),r(5344),r(1660),r(4610),r(3669),r(4810),r(3325),r(7024),r(8172),r(5205);var i=r(2046);e.exports=i.Symbol},1730:(e,t,r)=>{"use strict";r(9363),r(3643),r(7057),r(4954);var i=r(560);e.exports=i.f("iterator")},1661:(e,t,r)=>{"use strict";r(8537),r(3669);var i=r(560);e.exports=i.f("toPrimitive")},3042:(e,t,r)=>{"use strict";e.exports=r(9604)},9604:(e,t,r)=>{"use strict";r(6038);var i=r(1829);e.exports=i},4997:(e,t,r)=>{"use strict";var i=r(6040);e.exports=i},2321:(e,t,r)=>{"use strict";var i=r(7264);r(3939),r(1785),r(1697),r(4664),r(3422),r(36),r(8703),r(6878),r(9671),r(359),e.exports=i},2231:(e,t,r)=>{"use strict";var i=r(9692);e.exports=i},9280:(e,t,r)=>{"use strict";var i=r(5663);e.exports=i},2159:(e,t,r)=>{"use strict";var i=r(2250),a=r(4640),n=TypeError;e.exports=function(e){if(i(e))return e;throw new n(a(e)+" is not a function")}},43:(e,t,r)=>{"use strict";var i=r(4018),a=String,n=TypeError;e.exports=function(e){if(i(e))return e;throw new n("Can't set "+a(e)+" as a prototype")}},2156:e=>{"use strict";e.exports=function(){}},9596:(e,t,r)=>{"use strict";var i=r(8280),a=TypeError;e.exports=function(e,t){if(i(t,e))return e;throw new a("Incorrect invocation")}},6624:(e,t,r)=>{"use strict";var i=r(6285),a=String,n=TypeError;e.exports=function(e){if(i(e))return e;throw new n(a(e)+" is not an object")}},1229:(e,t,r)=>{"use strict";var i=r(8311),a=r(3930),n=r(9298),o=r(6818),s=r(7812),d=r(5468),l=r(575),c=r(5543),u=r(300),h=r(3448),_=Array;e.exports=function(e){var t=n(e),r=d(this),f=arguments.length,p=f>1?arguments[1]:void 0,m=void 0!==p;m&&(p=i(p,f>2?arguments[2]:void 0));var g,v,y,b,w,S,E=h(t),M=0;if(!E||this===_&&s(E))for(g=l(t),v=r?new this(g):_(g);g>M;M++)S=m?p(t[M],M):t[M],c(v,M,S);else for(v=r?new this:[],w=(b=u(t,E)).next;!(y=a(w,b)).done;M++)S=m?o(b,p,[y.value,M],!0):y.value,c(v,M,S);return v.length=M,v}},4436:(e,t,r)=>{"use strict";var i=r(7374),a=r(4849),n=r(575),o=function(e){return function(t,r,o){var s=i(t),d=n(s);if(0===d)return!e&&-1;var l,c=a(o,d);if(e&&r!=r){for(;d>c;)if((l=s[c++])!=l)return!0}else for(;d>c;c++)if((e||c in s)&&s[c]===r)return e||c||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},726:(e,t,r)=>{"use strict";var i=r(8311),a=r(1907),n=r(6946),o=r(9298),s=r(575),d=r(6968),l=a([].push),c=function(e){var t=1===e,r=2===e,a=3===e,c=4===e,u=6===e,h=7===e,_=5===e||u;return function(f,p,m,g){for(var v,y,b=o(f),w=n(b),S=s(w),E=i(p,m),M=0,R=g||d,T=t?R(f,S):r||h?R(f,0):void 0;S>M;M++)if((_||M in w)&&(y=E(v=w[M],M,b),e))if(t)T[M]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return M;case 2:l(T,v)}else switch(e){case 4:return!1;case 7:l(T,v)}return u?-1:a||c?c:T}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},7171:(e,t,r)=>{"use strict";var i=r(8828),a=r(6264),n=r(798),o=a("species");e.exports=function(e){return n>=51||!i((function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},3427:(e,t,r)=>{"use strict";var i=r(1907);e.exports=i([].slice)},4321:(e,t,r)=>{"use strict";var i=r(3427),a=Math.floor,n=function(e,t){var r=e.length;if(r<8)for(var o,s,d=1;d<r;){for(s=d,o=e[d];s&&t(e[s-1],o)>0;)e[s]=e[--s];s!==d++&&(e[s]=o)}else for(var l=a(r/2),c=n(i(e,0,l),t),u=n(i(e,l),t),h=c.length,_=u.length,f=0,p=0;f<h||p<_;)e[f+p]=f<h&&p<_?t(c[f],u[p])<=0?c[f++]:u[p++]:f<h?c[f++]:u[p++];return e};e.exports=n},4010:(e,t,r)=>{"use strict";var i=r(1793),a=r(5468),n=r(6285),o=r(6264)("species"),s=Array;e.exports=function(e){var t;return i(e)&&(t=e.constructor,(a(t)&&(t===s||i(t.prototype))||n(t)&&null===(t=t[o]))&&(t=void 0)),void 0===t?s:t}},6968:(e,t,r)=>{"use strict";var i=r(4010);e.exports=function(e,t){return new(i(e))(0===t?0:t)}},6818:(e,t,r)=>{"use strict";var i=r(6624),a=r(154);e.exports=function(e,t,r,n){try{return n?t(i(r)[0],r[1]):t(r)}catch(t){a(e,"throw",t)}}},5807:(e,t,r)=>{"use strict";var i=r(1907),a=i({}.toString),n=i("".slice);e.exports=function(e){return n(a(e),8,-1)}},3948:(e,t,r)=>{"use strict";var i=r(2623),a=r(2250),n=r(5807),o=r(6264)("toStringTag"),s=Object,d="Arguments"===n(function(){return arguments}());e.exports=i?n:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),o))?r:d?n(t):"Object"===(i=n(t))&&a(t.callee)?"Arguments":i}},7382:(e,t,r)=>{"use strict";var i=r(8828);e.exports=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},9550:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},1626:(e,t,r)=>{"use strict";var i=r(9447),a=r(4284),n=r(5817);e.exports=i?function(e,t,r){return a.f(e,t,n(1,r))}:function(e,t,r){return e[t]=r,e}},5817:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},5543:(e,t,r)=>{"use strict";var i=r(9447),a=r(4284),n=r(5817);e.exports=function(e,t,r){i?a.f(e,t,n(0,r)):e[t]=r}},9251:(e,t,r)=>{"use strict";var i=r(4284);e.exports=function(e,t,r){return i.f(e,t,r)}},8055:(e,t,r)=>{"use strict";var i=r(1626);e.exports=function(e,t,r,a){return a&&a.enumerable?e[t]=r:i(e,t,r),e}},2802:(e,t,r)=>{"use strict";var i=r(8055);e.exports=function(e,t,r){for(var a in t)r&&r.unsafe&&e[a]?e[a]=t[a]:i(e,a,t[a],r);return e}},2532:(e,t,r)=>{"use strict";var i=r(5951),a=Object.defineProperty;e.exports=function(e,t){try{a(i,e,{value:t,configurable:!0,writable:!0})}catch(r){i[e]=t}return t}},9447:(e,t,r)=>{"use strict";var i=r(8828);e.exports=!i((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9552:(e,t,r)=>{"use strict";var i=r(5951),a=r(6285),n=i.document,o=a(n)&&a(n.createElement);e.exports=function(e){return o?n.createElement(e):{}}},8024:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},9287:e=>{"use strict";e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},376:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6794:(e,t,r)=>{"use strict";var i=r(5951).navigator,a=i&&i.userAgent;e.exports=a?String(a):""},798:(e,t,r)=>{"use strict";var i,a,n=r(5951),o=r(6794),s=n.process,d=n.Deno,l=s&&s.versions||d&&d.version,c=l&&l.v8;c&&(a=(i=c.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!a&&o&&(!(i=o.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=o.match(/Chrome\/(\d+)/))&&(a=+i[1]),e.exports=a},1091:(e,t,r)=>{"use strict";var i=r(5951),a=r(6024),n=r(2361),o=r(2250),s=r(3846).f,d=r(7463),l=r(2046),c=r(8311),u=r(1626),h=r(9724);r(6128);var _=function(e){var t=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,n)}return a(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var r,a,f,p,m,g,v,y,b,w=e.target,S=e.global,E=e.stat,M=e.proto,R=S?i:E?i[w]:i[w]&&i[w].prototype,T=S?l:l[w]||u(l,w,{})[w],x=T.prototype;for(p in t)a=!(r=d(S?p:w+(E?".":"#")+p,e.forced))&&R&&h(R,p),g=T[p],a&&(v=e.dontCallGetSet?(b=s(R,p))&&b.value:R[p]),m=a&&v?v:t[p],(r||M||typeof g!=typeof m)&&(y=e.bind&&a?c(m,i):e.wrap&&a?_(m):M&&o(m)?n(m):m,(e.sham||m&&m.sham||g&&g.sham)&&u(y,"sham",!0),u(T,p,y),M&&(h(l,f=w+"Prototype")||u(l,f,{}),u(l[f],p,m),e.real&&x&&(r||!x[p])&&u(x,p,m)))}},8828:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},6024:(e,t,r)=>{"use strict";var i=r(1505),a=Function.prototype,n=a.apply,o=a.call;e.exports="object"==typeof Reflect&&Reflect.apply||(i?o.bind(n):function(){return o.apply(n,arguments)})},8311:(e,t,r)=>{"use strict";var i=r(2361),a=r(2159),n=r(1505),o=i(i.bind);e.exports=function(e,t){return a(e),void 0===t?e:n?o(e,t):function(){return e.apply(t,arguments)}}},1505:(e,t,r)=>{"use strict";var i=r(8828);e.exports=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},3930:(e,t,r)=>{"use strict";var i=r(1505),a=Function.prototype.call;e.exports=i?a.bind(a):function(){return a.apply(a,arguments)}},6833:(e,t,r)=>{"use strict";var i=r(9447),a=r(9724),n=Function.prototype,o=i&&Object.getOwnPropertyDescriptor,s=a(n,"name"),d=s&&"something"===function(){}.name,l=s&&(!i||i&&o(n,"name").configurable);e.exports={EXISTS:s,PROPER:d,CONFIGURABLE:l}},1871:(e,t,r)=>{"use strict";var i=r(1907),a=r(2159);e.exports=function(e,t,r){try{return i(a(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},2361:(e,t,r)=>{"use strict";var i=r(5807),a=r(1907);e.exports=function(e){if("Function"===i(e))return a(e)}},1907:(e,t,r)=>{"use strict";var i=r(1505),a=Function.prototype,n=a.call,o=i&&a.bind.bind(n,n);e.exports=i?o:function(e){return function(){return n.apply(e,arguments)}}},1747:(e,t,r)=>{"use strict";var i=r(5951),a=r(2046);e.exports=function(e,t){var r=a[e+"Prototype"],n=r&&r[t];if(n)return n;var o=i[e],s=o&&o.prototype;return s&&s[t]}},5582:(e,t,r)=>{"use strict";var i=r(2046),a=r(5951),n=r(2250),o=function(e){return n(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(i[e])||o(a[e]):i[e]&&i[e][t]||a[e]&&a[e][t]}},3448:(e,t,r)=>{"use strict";var i=r(3948),a=r(9367),n=r(7136),o=r(3742),s=r(6264)("iterator");e.exports=function(e){if(!n(e))return a(e,s)||a(e,"@@iterator")||o[i(e)]}},300:(e,t,r)=>{"use strict";var i=r(3930),a=r(2159),n=r(6624),o=r(4640),s=r(3448),d=TypeError;e.exports=function(e,t){var r=arguments.length<2?s(e):t;if(a(r))return n(i(r,e));throw new d(o(e)+" is not iterable")}},6656:(e,t,r)=>{"use strict";var i=r(1907),a=r(1793),n=r(2250),o=r(5807),s=r(160),d=i([].push);e.exports=function(e){if(n(e))return e;if(a(e)){for(var t=e.length,r=[],i=0;i<t;i++){var l=e[i];"string"==typeof l?d(r,l):"number"!=typeof l&&"Number"!==o(l)&&"String"!==o(l)||d(r,s(l))}var c=r.length,u=!0;return function(e,t){if(u)return u=!1,t;if(a(this))return t;for(var i=0;i<c;i++)if(r[i]===e)return t}}}},9367:(e,t,r)=>{"use strict";var i=r(2159),a=r(7136);e.exports=function(e,t){var r=e[t];return a(r)?void 0:i(r)}},7703:(e,t,r)=>{"use strict";var i=r(1907),a=r(9298),n=Math.floor,o=i("".charAt),s=i("".replace),d=i("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,i,u,h){var _=r+e.length,f=i.length,p=c;return void 0!==u&&(u=a(u),p=l),s(h,p,(function(a,s){var l;switch(o(s,0)){case"$":return"$";case"&":return e;case"`":return d(t,0,r);case"'":return d(t,_);case"<":l=u[d(s,1,-1)];break;default:var c=+s;if(0===c)return a;if(c>f){var h=n(c/10);return 0===h?a:h<=f?void 0===i[h-1]?o(s,1):i[h-1]+o(s,1):a}l=i[c-1]}return void 0===l?"":l}))}},5951:function(e,t,r){"use strict";var i=function(e){return e&&e.Math===Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r.g&&r.g)||i("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9724:(e,t,r)=>{"use strict";var i=r(1907),a=r(9298),n=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return n(a(e),t)}},8530:e=>{"use strict";e.exports={}},2416:(e,t,r)=>{"use strict";var i=r(5582);e.exports=i("document","documentElement")},3648:(e,t,r)=>{"use strict";var i=r(9447),a=r(8828),n=r(9552);e.exports=!i&&!a((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))},6946:(e,t,r)=>{"use strict";var i=r(1907),a=r(8828),n=r(5807),o=Object,s=i("".split);e.exports=a((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"===n(e)?s(e,""):o(e)}:o},2647:(e,t,r)=>{"use strict";var i=r(1907),a=r(2250),n=r(6128),o=i(Function.toString);a(n.inspectSource)||(n.inspectSource=function(e){return o(e)}),e.exports=n.inspectSource},4932:(e,t,r)=>{"use strict";var i,a,n,o=r(551),s=r(5951),d=r(6285),l=r(1626),c=r(9724),u=r(6128),h=r(2522),_=r(8530),f="Object already initialized",p=s.TypeError,m=s.WeakMap;if(o||u.state){var g=u.state||(u.state=new m);g.get=g.get,g.has=g.has,g.set=g.set,i=function(e,t){if(g.has(e))throw new p(f);return t.facade=e,g.set(e,t),t},a=function(e){return g.get(e)||{}},n=function(e){return g.has(e)}}else{var v=h("state");_[v]=!0,i=function(e,t){if(c(e,v))throw new p(f);return t.facade=e,l(e,v,t),t},a=function(e){return c(e,v)?e[v]:{}},n=function(e){return c(e,v)}}e.exports={set:i,get:a,has:n,enforce:function(e){return n(e)?a(e):i(e,{})},getterFor:function(e){return function(t){var r;if(!d(t)||(r=a(t)).type!==e)throw new p("Incompatible receiver, "+e+" required");return r}}}},7812:(e,t,r)=>{"use strict";var i=r(6264),a=r(3742),n=i("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(a.Array===e||o[n]===e)}},1793:(e,t,r)=>{"use strict";var i=r(5807);e.exports=Array.isArray||function(e){return"Array"===i(e)}},2250:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},5468:(e,t,r)=>{"use strict";var i=r(1907),a=r(8828),n=r(2250),o=r(3948),s=r(5582),d=r(2647),l=function(){},c=s("Reflect","construct"),u=/^\s*(?:class|function)\b/,h=i(u.exec),_=!u.test(l),f=function(e){if(!n(e))return!1;try{return c(l,[],e),!0}catch(e){return!1}},p=function(e){if(!n(e))return!1;switch(o(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _||!!h(u,d(e))}catch(e){return!0}};p.sham=!0,e.exports=!c||a((function(){var e;return f(f.call)||!f(Object)||!f((function(){e=!0}))||e}))?p:f},7463:(e,t,r)=>{"use strict";var i=r(8828),a=r(2250),n=/#|\.prototype\./,o=function(e,t){var r=d[s(e)];return r===c||r!==l&&(a(t)?i(t):!!t)},s=o.normalize=function(e){return String(e).replace(n,".").toLowerCase()},d=o.data={},l=o.NATIVE="N",c=o.POLYFILL="P";e.exports=o},7136:e=>{"use strict";e.exports=function(e){return null==e}},6285:(e,t,r)=>{"use strict";var i=r(2250);e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},4018:(e,t,r)=>{"use strict";var i=r(6285);e.exports=function(e){return i(e)||null===e}},7376:e=>{"use strict";e.exports=!0},2087:(e,t,r)=>{"use strict";var i=r(6285),a=r(5807),n=r(6264)("match");e.exports=function(e){var t;return i(e)&&(void 0!==(t=e[n])?!!t:"RegExp"===a(e))}},5594:(e,t,r)=>{"use strict";var i=r(5582),a=r(2250),n=r(8280),o=r(1175),s=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=i("Symbol");return a(t)&&n(t.prototype,s(e))}},154:(e,t,r)=>{"use strict";var i=r(3930),a=r(6624),n=r(9367);e.exports=function(e,t,r){var o,s;a(e);try{if(!(o=n(e,"return"))){if("throw"===t)throw r;return r}o=i(o,e)}catch(e){s=!0,o=e}if("throw"===t)throw r;if(s)throw o;return a(o),r}},7181:(e,t,r)=>{"use strict";var i=r(5116).IteratorPrototype,a=r(8075),n=r(5817),o=r(4840),s=r(3742),d=function(){return this};e.exports=function(e,t,r,l){var c=t+" Iterator";return e.prototype=a(i,{next:n(+!l,r)}),o(e,c,!1,!0),s[c]=d,e}},183:(e,t,r)=>{"use strict";var i=r(1091),a=r(3930),n=r(7376),o=r(6833),s=r(2250),d=r(7181),l=r(5972),c=r(9192),u=r(4840),h=r(1626),_=r(8055),f=r(6264),p=r(3742),m=r(5116),g=o.PROPER,v=o.CONFIGURABLE,y=m.IteratorPrototype,b=m.BUGGY_SAFARI_ITERATORS,w=f("iterator"),S="keys",E="values",M="entries",R=function(){return this};e.exports=function(e,t,r,o,f,m,T){d(r,t,o);var x,A,C,k=function(e){if(e===f&&D)return D;if(!b&&e&&e in I)return I[e];switch(e){case S:case E:case M:return function(){return new r(this,e)}}return function(){return new r(this)}},F=t+" Iterator",P=!1,I=e.prototype,L=I[w]||I["@@iterator"]||f&&I[f],D=!b&&L||k(f),O="Array"===t&&I.entries||L;if(O&&(x=l(O.call(new e)))!==Object.prototype&&x.next&&(n||l(x)===y||(c?c(x,y):s(x[w])||_(x,w,R)),u(x,F,!0,!0),n&&(p[F]=R)),g&&f===E&&L&&L.name!==E&&(!n&&v?h(I,"name",E):(P=!0,D=function(){return a(L,this)})),f)if(A={values:k(E),keys:m?D:k(S),entries:k(M)},T)for(C in A)(b||P||!(C in I))&&_(I,C,A[C]);else i({target:t,proto:!0,forced:b||P},A);return n&&!T||I[w]===D||_(I,w,D,{name:f}),p[t]=D,A}},5116:(e,t,r)=>{"use strict";var i,a,n,o=r(8828),s=r(2250),d=r(6285),l=r(8075),c=r(5972),u=r(8055),h=r(6264),_=r(7376),f=h("iterator"),p=!1;[].keys&&("next"in(n=[].keys())?(a=c(c(n)))!==Object.prototype&&(i=a):p=!0),!d(i)||o((function(){var e={};return i[f].call(e)!==e}))?i={}:_&&(i=l(i)),s(i[f])||u(i,f,(function(){return this})),e.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:p}},3742:e=>{"use strict";e.exports={}},575:(e,t,r)=>{"use strict";var i=r(3121);e.exports=function(e){return i(e.length)}},1176:e=>{"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var i=+e;return(i>0?r:t)(i)}},9538:(e,t,r)=>{"use strict";var i=r(9447),a=r(1907),n=r(3930),o=r(8828),s=r(2875),d=r(7170),l=r(2574),c=r(9298),u=r(6946),h=Object.assign,_=Object.defineProperty,f=a([].concat);e.exports=!h||o((function(){if(i&&1!==h({b:1},h(_({},"a",{enumerable:!0,get:function(){_(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),a="abcdefghijklmnopqrst";return e[r]=7,a.split("").forEach((function(e){t[e]=e})),7!==h({},e)[r]||s(h({},t)).join("")!==a}))?function(e,t){for(var r=c(e),a=arguments.length,o=1,h=d.f,_=l.f;a>o;)for(var p,m=u(arguments[o++]),g=h?f(s(m),h(m)):s(m),v=g.length,y=0;v>y;)p=g[y++],i&&!n(_,m,p)||(r[p]=m[p]);return r}:h},8075:(e,t,r)=>{"use strict";var i,a=r(6624),n=r(2220),o=r(376),s=r(8530),d=r(2416),l=r(9552),c=r(2522),u="prototype",h="script",_=c("IE_PROTO"),f=function(){},p=function(e){return"<"+h+">"+e+"</"+h+">"},m=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{i=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;g="undefined"!=typeof document?document.domain&&i?m(i):(t=l("iframe"),r="java"+h+":",t.style.display="none",d.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F):m(i);for(var a=o.length;a--;)delete g[u][o[a]];return g()};s[_]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(f[u]=a(e),r=new f,f[u]=null,r[_]=e):r=g(),void 0===t?r:n.f(r,t)}},2220:(e,t,r)=>{"use strict";var i=r(9447),a=r(8661),n=r(4284),o=r(6624),s=r(7374),d=r(2875);t.f=i&&!a?Object.defineProperties:function(e,t){o(e);for(var r,i=s(t),a=d(t),l=a.length,c=0;l>c;)n.f(e,r=a[c++],i[r]);return e}},4284:(e,t,r)=>{"use strict";var i=r(9447),a=r(3648),n=r(8661),o=r(6624),s=r(470),d=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",h="configurable",_="writable";t.f=i?n?function(e,t,r){if(o(e),t=s(t),o(r),"function"==typeof e&&"prototype"===t&&"value"in r&&_ in r&&!r[_]){var i=c(e,t);i&&i[_]&&(e[t]=r.value,r={configurable:h in r?r[h]:i[h],enumerable:u in r?r[u]:i[u],writable:!1})}return l(e,t,r)}:l:function(e,t,r){if(o(e),t=s(t),o(r),a)try{return l(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new d("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},3846:(e,t,r)=>{"use strict";var i=r(9447),a=r(3930),n=r(2574),o=r(5817),s=r(7374),d=r(470),l=r(9724),c=r(3648),u=Object.getOwnPropertyDescriptor;t.f=i?u:function(e,t){if(e=s(e),t=d(t),c)try{return u(e,t)}catch(e){}if(l(e,t))return o(!a(n.f,e,t),e[t])}},5407:(e,t,r)=>{"use strict";var i=r(5807),a=r(7374),n=r(4443).f,o=r(3427),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"Window"===i(e)?function(e){try{return n(e)}catch(e){return o(s)}}(e):n(a(e))}},4443:(e,t,r)=>{"use strict";var i=r(3045),a=r(376).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,a)}},7170:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},5972:(e,t,r)=>{"use strict";var i=r(9724),a=r(2250),n=r(9298),o=r(2522),s=r(7382),d=o("IE_PROTO"),l=Object,c=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=n(e);if(i(t,d))return t[d];var r=t.constructor;return a(r)&&t instanceof r?r.prototype:t instanceof l?c:null}},8280:(e,t,r)=>{"use strict";var i=r(1907);e.exports=i({}.isPrototypeOf)},3045:(e,t,r)=>{"use strict";var i=r(1907),a=r(9724),n=r(7374),o=r(4436).indexOf,s=r(8530),d=i([].push);e.exports=function(e,t){var r,i=n(e),l=0,c=[];for(r in i)!a(s,r)&&a(i,r)&&d(c,r);for(;t.length>l;)a(i,r=t[l++])&&(~o(c,r)||d(c,r));return c}},2875:(e,t,r)=>{"use strict";var i=r(3045),a=r(376);e.exports=Object.keys||function(e){return i(e,a)}},2574:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);t.f=a?function(e){var t=i(this,e);return!!t&&t.enumerable}:r},9192:(e,t,r)=>{"use strict";var i=r(1871),a=r(6285),n=r(4239),o=r(43);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=i(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return n(r),o(i),a(r)?(t?e(r,i):r.__proto__=i,r):r}}():void 0)},4878:(e,t,r)=>{"use strict";var i=r(2623),a=r(3948);e.exports=i?{}.toString:function(){return"[object "+a(this)+"]"}},581:(e,t,r)=>{"use strict";var i=r(3930),a=r(2250),n=r(6285),o=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&a(r=e.toString)&&!n(s=i(r,e)))return s;if(a(r=e.valueOf)&&!n(s=i(r,e)))return s;if("string"!==t&&a(r=e.toString)&&!n(s=i(r,e)))return s;throw new o("Can't convert object to primitive value")}},2046:e=>{"use strict";e.exports={}},5606:(e,t,r)=>{"use strict";var i=r(6624);e.exports=function(){var e=i(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},663:(e,t,r)=>{"use strict";var i=r(3930),a=r(9724),n=r(8280),o=r(5606),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||a(e,"flags")||!n(s,e)?t:i(o,e)}},4239:(e,t,r)=>{"use strict";var i=r(7136),a=TypeError;e.exports=function(e){if(i(e))throw new a("Can't call method on "+e);return e}},2098:(e,t,r)=>{"use strict";var i=r(5951),a=r(9447),n=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!a)return i[e];var t=n(i,e);return t&&t.value}},4840:(e,t,r)=>{"use strict";var i=r(2623),a=r(4284).f,n=r(1626),o=r(9724),s=r(4878),d=r(6264)("toStringTag");e.exports=function(e,t,r,l){var c=r?e:e&&e.prototype;c&&(o(c,d)||a(c,d,{configurable:!0,value:t}),l&&!i&&n(c,"toString",s))}},2522:(e,t,r)=>{"use strict";var i=r(5816),a=r(6499),n=i("keys");e.exports=function(e){return n[e]||(n[e]=a(e))}},6128:(e,t,r)=>{"use strict";var i=r(7376),a=r(5951),n=r(2532),o="__core-js_shared__",s=e.exports=a[o]||n(o,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:i?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5816:(e,t,r)=>{"use strict";var i=r(6128);e.exports=function(e,t){return i[e]||(i[e]=t||{})}},1470:(e,t,r)=>{"use strict";var i=r(1907),a=r(5482),n=r(160),o=r(4239),s=i("".charAt),d=i("".charCodeAt),l=i("".slice),c=function(e){return function(t,r){var i,c,u=n(o(t)),h=a(r),_=u.length;return h<0||h>=_?e?"":void 0:(i=d(u,h))<55296||i>56319||h+1===_||(c=d(u,h+1))<56320||c>57343?e?s(u,h):i:e?l(u,h,h+2):c-56320+(i-55296<<10)+65536}};e.exports={codeAt:c(!1),charAt:c(!0)}},9156:(e,t,r)=>{"use strict";var i=r(1907),a=2147483647,n=/[^\0-\u007E]/,o=/[.\u3002\uFF0E\uFF61]/g,s="Overflow: input needs wider integers to process",d=RangeError,l=i(o.exec),c=Math.floor,u=String.fromCharCode,h=i("".charCodeAt),_=i([].join),f=i([].push),p=i("".replace),m=i("".split),g=i("".toLowerCase),v=function(e){return e+22+75*(e<26)},y=function(e,t,r){var i=0;for(e=r?c(e/700):e>>1,e+=c(e/t);e>455;)e=c(e/35),i+=36;return c(i+36*e/(e+38))},b=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var a=h(e,r++);if(a>=55296&&a<=56319&&r<i){var n=h(e,r++);56320==(64512&n)?f(t,((1023&a)<<10)+(1023&n)+65536):(f(t,a),r--)}else f(t,a)}return t}(e);var r,i,n=e.length,o=128,l=0,p=72;for(r=0;r<e.length;r++)(i=e[r])<128&&f(t,u(i));var m=t.length,g=m;for(m&&f(t,"-");g<n;){var b=a;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<b&&(b=i);var w=g+1;if(b-o>c((a-l)/w))throw new d(s);for(l+=(b-o)*w,o=b,r=0;r<e.length;r++){if((i=e[r])<o&&++l>a)throw new d(s);if(i===o){for(var S=l,E=36;;){var M=E<=p?1:E>=p+26?26:E-p;if(S<M)break;var R=S-M,T=36-M;f(t,u(v(M+R%T))),S=c(R/T),E+=36}f(t,u(v(S))),p=y(l,w,g===m),l=0,g++}}l++,o++}return _(t,"")};e.exports=function(e){var t,r,i=[],a=m(p(g(e),o,"."),".");for(t=0;t<a.length;t++)r=a[t],f(i,l(n,r)?"xn--"+b(r):r);return _(i,".")}},5819:(e,t,r)=>{"use strict";var i=r(6833).PROPER,a=r(8828),n=r(6395);e.exports=function(e){return a((function(){return!!n[e]()||"​…᠎"!=="​…᠎"[e]()||i&&n[e].name!==e}))}},5993:(e,t,r)=>{"use strict";var i=r(1907),a=r(4239),n=r(160),o=r(6395),s=i("".replace),d=RegExp("^["+o+"]+"),l=RegExp("(^|[^"+o+"])["+o+"]+$"),c=function(e){return function(t){var r=n(a(t));return 1&e&&(r=s(r,d,"")),2&e&&(r=s(r,l,"$1")),r}};e.exports={start:c(1),end:c(2),trim:c(3)}},9846:(e,t,r)=>{"use strict";var i=r(798),a=r(8828),n=r(5951).String;e.exports=!!Object.getOwnPropertySymbols&&!a((function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},3467:(e,t,r)=>{"use strict";var i=r(3930),a=r(5582),n=r(6264),o=r(8055);e.exports=function(){var e=a("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,s=n("toPrimitive");t&&!t[s]&&o(t,s,(function(e){return i(r,this)}),{arity:1})}},2595:(e,t,r)=>{"use strict";var i=r(5582),a=r(1907),n=i("Symbol"),o=n.keyFor,s=a(n.prototype.valueOf);e.exports=n.isRegisteredSymbol||function(e){try{return void 0!==o(s(e))}catch(e){return!1}}},9197:(e,t,r)=>{"use strict";for(var i=r(5816),a=r(5582),n=r(1907),o=r(5594),s=r(6264),d=a("Symbol"),l=d.isWellKnownSymbol,c=a("Object","getOwnPropertyNames"),u=n(d.prototype.valueOf),h=i("wks"),_=0,f=c(d),p=f.length;_<p;_++)try{var m=f[_];o(d[m])&&s(m)}catch(e){}e.exports=function(e){if(l&&l(e))return!0;try{for(var t=u(e),r=0,i=c(h),a=i.length;r<a;r++)if(h[i[r]]==t)return!0}catch(e){}return!1}},4411:(e,t,r)=>{"use strict";var i=r(9846);e.exports=i&&!!Symbol.for&&!!Symbol.keyFor},4849:(e,t,r)=>{"use strict";var i=r(5482),a=Math.max,n=Math.min;e.exports=function(e,t){var r=i(e);return r<0?a(r+t,0):n(r,t)}},7374:(e,t,r)=>{"use strict";var i=r(6946),a=r(4239);e.exports=function(e){return i(a(e))}},5482:(e,t,r)=>{"use strict";var i=r(1176);e.exports=function(e){var t=+e;return t!=t||0===t?0:i(t)}},3121:(e,t,r)=>{"use strict";var i=r(5482),a=Math.min;e.exports=function(e){var t=i(e);return t>0?a(t,9007199254740991):0}},9298:(e,t,r)=>{"use strict";var i=r(4239),a=Object;e.exports=function(e){return a(i(e))}},6028:(e,t,r)=>{"use strict";var i=r(3930),a=r(6285),n=r(5594),o=r(9367),s=r(581),d=r(6264),l=TypeError,c=d("toPrimitive");e.exports=function(e,t){if(!a(e)||n(e))return e;var r,d=o(e,c);if(d){if(void 0===t&&(t="default"),r=i(d,e,t),!a(r)||n(r))return r;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},470:(e,t,r)=>{"use strict";var i=r(6028),a=r(5594);e.exports=function(e){var t=i(e,"string");return a(t)?t:t+""}},2623:(e,t,r)=>{"use strict";var i={};i[r(6264)("toStringTag")]="z",e.exports="[object z]"===String(i)},160:(e,t,r)=>{"use strict";var i=r(3948),a=String;e.exports=function(e){if("Symbol"===i(e))throw new TypeError("Cannot convert a Symbol value to a string");return a(e)}},4640:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6499:(e,t,r)=>{"use strict";var i=r(1907),a=0,n=Math.random(),o=i(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++a+n,36)}},4791:(e,t,r)=>{"use strict";var i=r(8828),a=r(6264),n=r(9447),o=r(7376),s=a("iterator");e.exports=!i((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),r.delete("b",void 0),o&&(!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b"))||!t.size&&(o||!n)||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[s]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==i||"x"!==new URL("https://x",void 0).host}))},1175:(e,t,r)=>{"use strict";var i=r(9846);e.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8661:(e,t,r)=>{"use strict";var i=r(9447),a=r(8828);e.exports=i&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4787:e=>{"use strict";var t=TypeError;e.exports=function(e,r){if(e<r)throw new t("Not enough arguments");return e}},551:(e,t,r)=>{"use strict";var i=r(5951),a=r(2250),n=i.WeakMap;e.exports=a(n)&&/native code/.test(String(n))},366:(e,t,r)=>{"use strict";var i=r(2046),a=r(9724),n=r(560),o=r(4284).f;e.exports=function(e){var t=i.Symbol||(i.Symbol={});a(t,e)||o(t,e,{value:n.f(e)})}},560:(e,t,r)=>{"use strict";var i=r(6264);t.f=i},6264:(e,t,r)=>{"use strict";var i=r(5951),a=r(5816),n=r(9724),o=r(6499),s=r(9846),d=r(1175),l=i.Symbol,c=a("wks"),u=d?l.for||l:l&&l.withoutSetter||o;e.exports=function(e){return n(c,e)||(c[e]=s&&n(l,e)?l[e]:u("Symbol."+e)),c[e]}},6395:e=>{"use strict";e.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},8545:(e,t,r)=>{"use strict";var i=r(1091),a=r(8828),n=r(1793),o=r(6285),s=r(9298),d=r(575),l=r(8024),c=r(5543),u=r(6968),h=r(7171),_=r(6264),f=r(798),p=_("isConcatSpreadable"),m=f>=51||!a((function(){var e=[];return e[p]=!1,e.concat()[0]!==e})),g=function(e){if(!o(e))return!1;var t=e[p];return void 0!==t?!!t:n(e)};i({target:"Array",proto:!0,arity:1,forced:!m||!h("concat")},{concat:function(e){var t,r,i,a,n,o=s(this),h=u(o,0),_=0;for(t=-1,i=arguments.length;t<i;t++)if(g(n=-1===t?o:arguments[t]))for(a=d(n),l(_+a),r=0;r<a;r++,_++)r in n&&c(h,_,n[r]);else l(_+1),c(h,_++,n);return h.length=_,h}})},9363:(e,t,r)=>{"use strict";var i=r(7374),a=r(2156),n=r(3742),o=r(4932),s=r(4284).f,d=r(183),l=r(9550),c=r(7376),u=r(9447),h="Array Iterator",_=o.set,f=o.getterFor(h);e.exports=d(Array,"Array",(function(e,t){_(this,{type:h,target:i(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,l(void 0,!0);switch(e.kind){case"keys":return l(r,!1);case"values":return l(t[r],!1)}return l([r,t[r]],!1)}),"values");var p=n.Arguments=n.Array;if(a("keys"),a("values"),a("entries"),!c&&u&&"values"!==p.name)try{s(p,"name",{value:"values"})}catch(e){}},8537:()=>{},9721:(e,t,r)=>{"use strict";var i=r(1091),a=r(5582),n=r(6024),o=r(3930),s=r(1907),d=r(8828),l=r(2250),c=r(5594),u=r(3427),h=r(6656),_=r(9846),f=String,p=a("JSON","stringify"),m=s(/./.exec),g=s("".charAt),v=s("".charCodeAt),y=s("".replace),b=s(1..toString),w=/[\uD800-\uDFFF]/g,S=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,M=!_||d((function(){var e=a("Symbol")("stringify detection");return"[null]"!==p([e])||"{}"!==p({a:e})||"{}"!==p(Object(e))})),R=d((function(){return'"\\udf06\\ud834"'!==p("\udf06\ud834")||'"\\udead"'!==p("\udead")})),T=function(e,t){var r=u(arguments),i=h(t);if(l(i)||void 0!==e&&!c(e))return r[1]=function(e,t){if(l(i)&&(t=o(i,this,f(e),t)),!c(t))return t},n(p,null,r)},x=function(e,t,r){var i=g(r,t-1),a=g(r,t+1);return m(S,e)&&!m(E,a)||m(E,e)&&!m(S,i)?"\\u"+b(v(e,0),16):e};p&&i({target:"JSON",stat:!0,arity:3,forced:M||R},{stringify:function(e,t,r){var i=u(arguments),a=n(M?T:p,null,i);return R&&"string"==typeof a?y(a,w,x):a}})},7024:(e,t,r)=>{"use strict";var i=r(5951);r(4840)(i.JSON,"JSON",!0)},8172:()=>{},6750:(e,t,r)=>{"use strict";var i=r(1091),a=r(9447),n=r(4284).f;i({target:"Object",stat:!0,forced:Object.defineProperty!==n,sham:!a},{defineProperty:n})},5264:(e,t,r)=>{"use strict";var i=r(1091),a=r(9846),n=r(8828),o=r(7170),s=r(9298);i({target:"Object",stat:!0,forced:!a||n((function(){o.f(1)}))},{getOwnPropertySymbols:function(e){var t=o.f;return t?t(s(e)):[]}})},3643:()=>{},5205:()=>{},1398:()=>{},1074:(e,t,r)=>{"use strict";var i=r(1091),a=r(1907),n=r(4849),o=RangeError,s=String.fromCharCode,d=String.fromCodePoint,l=a([].join);i({target:"String",stat:!0,arity:1,forced:!!d&&1!==d.length},{fromCodePoint:function(e){for(var t,r=[],i=arguments.length,a=0;i>a;){if(t=+arguments[a++],n(t,1114111)!==t)throw new o(t+" is not a valid code point");r[a]=t<65536?s(t):s(55296+((t-=65536)>>10),t%1024+56320)}return l(r,"")}})},7057:(e,t,r)=>{"use strict";var i=r(1470).charAt,a=r(160),n=r(4932),o=r(183),s=r(9550),d="String Iterator",l=n.set,c=n.getterFor(d);o(String,"String",(function(e){l(this,{type:d,string:a(e),index:0})}),(function(){var e,t=c(this),r=t.string,a=t.index;return a>=r.length?s(void 0,!0):(e=i(r,a),t.index+=e.length,s(e,!1))}))},929:(e,t,r)=>{"use strict";var i=r(1091),a=r(3930),n=r(1907),o=r(4239),s=r(2250),d=r(7136),l=r(2087),c=r(160),u=r(9367),h=r(663),_=r(7703),f=r(6264),p=r(7376),m=f("replace"),g=TypeError,v=n("".indexOf),y=n("".replace),b=n("".slice),w=Math.max;i({target:"String",proto:!0},{replaceAll:function(e,t){var r,i,n,f,S,E,M,R,T,x,A=o(this),C=0,k="";if(!d(e)){if((r=l(e))&&(i=c(o(h(e))),!~v(i,"g")))throw new g("`.replaceAll` does not allow non-global regexes");if(n=u(e,m))return a(n,e,A,t);if(p&&r)return y(c(A),e,t)}for(f=c(A),S=c(e),(E=s(t))||(t=c(t)),M=S.length,R=w(1,M),T=v(f,S);-1!==T;)x=E?c(t(S,T,f)):_(S,f,T,[],void 0,t),k+=b(f,C,T)+x,C=T+M,T=T+R>f.length?-1:v(f,S,T+R);return C<f.length&&(k+=b(f,C)),k}})},1995:()=>{},727:(e,t,r)=>{"use strict";var i=r(1091),a=r(5993).trim;i({target:"String",proto:!0,forced:r(5819)("trim")},{trim:function(){return a(this)}})},3997:(e,t,r)=>{"use strict";r(366)("asyncIterator")},3674:(e,t,r)=>{"use strict";var i=r(1091),a=r(5951),n=r(3930),o=r(1907),s=r(7376),d=r(9447),l=r(9846),c=r(8828),u=r(9724),h=r(8280),_=r(6624),f=r(7374),p=r(470),m=r(160),g=r(5817),v=r(8075),y=r(2875),b=r(4443),w=r(5407),S=r(7170),E=r(3846),M=r(4284),R=r(2220),T=r(2574),x=r(8055),A=r(9251),C=r(5816),k=r(2522),F=r(8530),P=r(6499),I=r(6264),L=r(560),D=r(366),O=r(3467),W=r(4840),B=r(4932),U=r(726).forEach,N=k("hidden"),V="Symbol",G="prototype",j=B.set,H=B.getterFor(V),$=Object[G],z=a.Symbol,q=z&&z[G],Y=a.RangeError,X=a.TypeError,K=a.QObject,Q=E.f,J=M.f,Z=w.f,ee=T.f,te=o([].push),re=C("symbols"),ie=C("op-symbols"),ae=C("wks"),ne=!K||!K[G]||!K[G].findChild,oe=function(e,t,r){var i=Q($,t);i&&delete $[t],J(e,t,r),i&&e!==$&&J($,t,i)},se=d&&c((function(){return 7!==v(J({},"a",{get:function(){return J(this,"a",{value:7}).a}})).a}))?oe:J,de=function(e,t){var r=re[e]=v(q);return j(r,{type:V,tag:e,description:t}),d||(r.description=t),r},le=function(e,t,r){e===$&&le(ie,t,r),_(e);var i=p(t);return _(r),u(re,i)?(r.enumerable?(u(e,N)&&e[N][i]&&(e[N][i]=!1),r=v(r,{enumerable:g(0,!1)})):(u(e,N)||J(e,N,g(1,v(null))),e[N][i]=!0),se(e,i,r)):J(e,i,r)},ce=function(e,t){_(e);var r=f(t),i=y(r).concat(fe(r));return U(i,(function(t){d&&!n(ue,r,t)||le(e,t,r[t])})),e},ue=function(e){var t=p(e),r=n(ee,this,t);return!(this===$&&u(re,t)&&!u(ie,t))&&(!(r||!u(this,t)||!u(re,t)||u(this,N)&&this[N][t])||r)},he=function(e,t){var r=f(e),i=p(t);if(r!==$||!u(re,i)||u(ie,i)){var a=Q(r,i);return!a||!u(re,i)||u(r,N)&&r[N][i]||(a.enumerable=!0),a}},_e=function(e){var t=Z(f(e)),r=[];return U(t,(function(e){u(re,e)||u(F,e)||te(r,e)})),r},fe=function(e){var t=e===$,r=Z(t?ie:f(e)),i=[];return U(r,(function(e){!u(re,e)||t&&!u($,e)||te(i,re[e])})),i};l||(x(q=(z=function(){if(h(q,this))throw new X("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?m(arguments[0]):void 0,t=P(e),r=function(e){var i=void 0===this?a:this;i===$&&n(r,ie,e),u(i,N)&&u(i[N],t)&&(i[N][t]=!1);var o=g(1,e);try{se(i,t,o)}catch(e){if(!(e instanceof Y))throw e;oe(i,t,o)}};return d&&ne&&se($,t,{configurable:!0,set:r}),de(t,e)})[G],"toString",(function(){return H(this).tag})),x(z,"withoutSetter",(function(e){return de(P(e),e)})),T.f=ue,M.f=le,R.f=ce,E.f=he,b.f=w.f=_e,S.f=fe,L.f=function(e){return de(I(e),e)},d&&(A(q,"description",{configurable:!0,get:function(){return H(this).description}}),s||x($,"propertyIsEnumerable",ue,{unsafe:!0}))),i({global:!0,constructor:!0,wrap:!0,forced:!l,sham:!l},{Symbol:z}),U(y(ae),(function(e){D(e)})),i({target:V,stat:!0,forced:!l},{useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),i({target:"Object",stat:!0,forced:!l,sham:!d},{create:function(e,t){return void 0===t?v(e):ce(v(e),t)},defineProperty:le,defineProperties:ce,getOwnPropertyDescriptor:he}),i({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:_e}),O(),W(z,V),F[N]=!0},5084:()=>{},3313:(e,t,r)=>{"use strict";var i=r(1091),a=r(5582),n=r(9724),o=r(160),s=r(5816),d=r(4411),l=s("string-to-symbol-registry"),c=s("symbol-to-string-registry");i({target:"Symbol",stat:!0,forced:!d},{for:function(e){var t=o(e);if(n(l,t))return l[t];var r=a("Symbol")(t);return l[t]=r,c[r]=t,r}})},2596:(e,t,r)=>{"use strict";r(366)("hasInstance")},5721:(e,t,r)=>{"use strict";r(366)("isConcatSpreadable")},4954:(e,t,r)=>{"use strict";r(366)("iterator")},4452:(e,t,r)=>{"use strict";r(3674),r(3313),r(751),r(9721),r(5264)},751:(e,t,r)=>{"use strict";var i=r(1091),a=r(9724),n=r(5594),o=r(4640),s=r(5816),d=r(4411),l=s("symbol-to-string-registry");i({target:"Symbol",stat:!0,forced:!d},{keyFor:function(e){if(!n(e))throw new TypeError(o(e)+" is not a symbol");if(a(l,e))return l[e]}})},3377:(e,t,r)=>{"use strict";r(366)("matchAll")},4123:(e,t,r)=>{"use strict";r(366)("match")},2230:(e,t,r)=>{"use strict";r(366)("replace")},5344:(e,t,r)=>{"use strict";r(366)("search")},1660:(e,t,r)=>{"use strict";r(366)("species")},4610:(e,t,r)=>{"use strict";r(366)("split")},3669:(e,t,r)=>{"use strict";var i=r(366),a=r(3467);i("toPrimitive"),a()},4810:(e,t,r)=>{"use strict";var i=r(5582),a=r(366),n=r(4840);a("toStringTag"),n(i("Symbol"),"Symbol")},3325:(e,t,r)=>{"use strict";r(366)("unscopables")},768:(e,t,r)=>{"use strict";var i=r(6264),a=r(4284).f,n=i("metadata"),o=Function.prototype;void 0===o[n]&&a(o,n,{value:null})},6038:(e,t,r)=>{"use strict";r(929)},8549:(e,t,r)=>{"use strict";r(366)("asyncDispose")},1697:(e,t,r)=>{"use strict";r(366)("customMatcher")},7152:(e,t,r)=>{"use strict";r(366)("dispose")},3939:(e,t,r)=>{"use strict";r(1091)({target:"Symbol",stat:!0},{isRegisteredSymbol:r(2595)})},3422:(e,t,r)=>{"use strict";r(1091)({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:r(2595)})},1785:(e,t,r)=>{"use strict";r(1091)({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:r(9197)})},36:(e,t,r)=>{"use strict";r(1091)({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:r(9197)})},8703:(e,t,r)=>{"use strict";r(366)("matcher")},6878:(e,t,r)=>{"use strict";r(366)("metadataKey")},1372:(e,t,r)=>{"use strict";r(366)("metadata")},4664:(e,t,r)=>{"use strict";r(366)("observable")},9671:(e,t,r)=>{"use strict";r(366)("patternMatch")},359:(e,t,r)=>{"use strict";r(366)("replaceAll")},2560:(e,t,r)=>{"use strict";r(9363);var i=r(9287),a=r(5951),n=r(4840),o=r(3742);for(var s in i)n(a[s],s),o[s]=o.Array},7105:(e,t,r)=>{"use strict";r(9363),r(1074);var i=r(1091),a=r(5951),n=r(2098),o=r(5582),s=r(3930),d=r(1907),l=r(9447),c=r(4791),u=r(8055),h=r(9251),_=r(2802),f=r(4840),p=r(7181),m=r(4932),g=r(9596),v=r(2250),y=r(9724),b=r(8311),w=r(3948),S=r(6624),E=r(6285),M=r(160),R=r(8075),T=r(5817),x=r(300),A=r(3448),C=r(9550),k=r(4787),F=r(6264),P=r(4321),I=F("iterator"),L="URLSearchParams",D=L+"Iterator",O=m.set,W=m.getterFor(L),B=m.getterFor(D),U=n("fetch"),N=n("Request"),V=n("Headers"),G=N&&N.prototype,j=V&&V.prototype,H=a.TypeError,$=a.encodeURIComponent,z=String.fromCharCode,q=o("String","fromCodePoint"),Y=parseInt,X=d("".charAt),K=d([].join),Q=d([].push),J=d("".replace),Z=d([].shift),ee=d([].splice),te=d("".split),re=d("".slice),ie=d(/./.exec),ae=/\+/g,ne=/^[0-9a-f]+$/i,oe=function(e,t){var r=re(e,t,t+2);return ie(ne,r)?Y(r,16):NaN},se=function(e){for(var t=0,r=128;r>0&&e&r;r>>=1)t++;return t},de=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},le=function(e){for(var t=(e=J(e,ae," ")).length,r="",i=0;i<t;){var a=X(e,i);if("%"===a){if("%"===X(e,i+1)||i+3>t){r+="%",i++;continue}var n=oe(e,i+1);if(n!=n){r+=a,i++;continue}i+=2;var o=se(n);if(0===o)a=z(n);else{if(1===o||o>4){r+="�",i++;continue}for(var s=[n],d=1;d<o&&!(3+ ++i>t||"%"!==X(e,i));){var l=oe(e,i+1);if(l!=l){i+=3;break}if(l>191||l<128)break;Q(s,l),i+=2,d++}if(s.length!==o){r+="�";continue}var c=de(s);null===c?r+="�":a=q(c)}}r+=a,i++}return r},ce=/[!'()~]|%20/g,ue={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},he=function(e){return ue[e]},_e=function(e){return J($(e),ce,he)},fe=p((function(e,t){O(this,{type:D,target:W(e).entries,index:0,kind:t})}),L,(function(){var e=B(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,C(void 0,!0);var i=t[r];switch(e.kind){case"keys":return C(i.key,!1);case"values":return C(i.value,!1)}return C([i.key,i.value],!1)}),!0),pe=function(e){this.entries=[],this.url=null,void 0!==e&&(E(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===X(e,0)?re(e,1):e:M(e)))};pe.prototype={type:L,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,a,n,o,d,l=this.entries,c=A(e);if(c)for(r=(t=x(e,c)).next;!(i=s(r,t)).done;){if(n=(a=x(S(i.value))).next,(o=s(n,a)).done||(d=s(n,a)).done||!s(n,a).done)throw new H("Expected sequence with length 2");Q(l,{key:M(o.value),value:M(d.value)})}else for(var u in e)y(e,u)&&Q(l,{key:u,value:M(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=this.entries,a=te(e,"&"),n=0;n<a.length;)(t=a[n++]).length&&(r=te(t,"="),Q(i,{key:le(Z(r)),value:le(K(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],Q(r,_e(e.key)+"="+_e(e.value));return K(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var me=function(){g(this,ge);var e=O(this,new pe(arguments.length>0?arguments[0]:void 0));l||(this.size=e.entries.length)},ge=me.prototype;if(_(ge,{append:function(e,t){var r=W(this);k(arguments.length,2),Q(r.entries,{key:M(e),value:M(t)}),l||this.length++,r.updateURL()},delete:function(e){for(var t=W(this),r=k(arguments.length,1),i=t.entries,a=M(e),n=r<2?void 0:arguments[1],o=void 0===n?n:M(n),s=0;s<i.length;){var d=i[s];if(d.key!==a||void 0!==o&&d.value!==o)s++;else if(ee(i,s,1),void 0!==o)break}l||(this.size=i.length),t.updateURL()},get:function(e){var t=W(this).entries;k(arguments.length,1);for(var r=M(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=W(this).entries;k(arguments.length,1);for(var r=M(e),i=[],a=0;a<t.length;a++)t[a].key===r&&Q(i,t[a].value);return i},has:function(e){for(var t=W(this).entries,r=k(arguments.length,1),i=M(e),a=r<2?void 0:arguments[1],n=void 0===a?a:M(a),o=0;o<t.length;){var s=t[o++];if(s.key===i&&(void 0===n||s.value===n))return!0}return!1},set:function(e,t){var r=W(this);k(arguments.length,1);for(var i,a=r.entries,n=!1,o=M(e),s=M(t),d=0;d<a.length;d++)(i=a[d]).key===o&&(n?ee(a,d--,1):(n=!0,i.value=s));n||Q(a,{key:o,value:s}),l||(this.size=a.length),r.updateURL()},sort:function(){var e=W(this);P(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=W(this).entries,i=b(e,arguments.length>1?arguments[1]:void 0),a=0;a<r.length;)i((t=r[a++]).value,t.key,this)},keys:function(){return new fe(this,"keys")},values:function(){return new fe(this,"values")},entries:function(){return new fe(this,"entries")}},{enumerable:!0}),u(ge,I,ge.entries,{name:"entries"}),u(ge,"toString",(function(){return W(this).serialize()}),{enumerable:!0}),l&&h(ge,"size",{get:function(){return W(this).entries.length},configurable:!0,enumerable:!0}),f(me,L),i({global:!0,constructor:!0,forced:!c},{URLSearchParams:me}),!c&&v(V)){var ve=d(j.has),ye=d(j.set),be=function(e){if(E(e)){var t,r=e.body;if(w(r)===L)return t=e.headers?new V(e.headers):new V,ve(t,"content-type")||ye(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),R(e,{body:T(0,M(r)),headers:T(0,t)})}return e};if(v(U)&&i({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return U(e,arguments.length>1?be(arguments[1]):{})}}),v(N)){var we=function(e){return g(this,G),new N(e,arguments.length>1?be(arguments[1]):{})};G.constructor=we,we.prototype=G,i({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:we})}}e.exports={URLSearchParams:me,getState:W}},5042:()=>{},7649:()=>{},6299:(e,t,r)=>{"use strict";r(7105)},3604:()=>{},8669:(e,t,r)=>{"use strict";var i=r(1091),a=r(5582),n=r(8828),o=r(4787),s=r(160),d=r(4791),l=a("URL"),c=d&&n((function(){l.canParse()})),u=n((function(){return 1!==l.canParse.length}));i({target:"URL",stat:!0,forced:!c||u},{canParse:function(e){var t=o(arguments.length,1),r=s(e),i=t<2||void 0===arguments[1]?void 0:s(arguments[1]);try{return!!new l(r,i)}catch(e){return!1}}})},6909:(e,t,r)=>{"use strict";r(7057);var i,a=r(1091),n=r(9447),o=r(4791),s=r(5951),d=r(8311),l=r(1907),c=r(8055),u=r(9251),h=r(9596),_=r(9724),f=r(9538),p=r(1229),m=r(3427),g=r(1470).codeAt,v=r(9156),y=r(160),b=r(4840),w=r(4787),S=r(7105),E=r(4932),M=E.set,R=E.getterFor("URL"),T=S.URLSearchParams,x=S.getState,A=s.URL,C=s.TypeError,k=s.parseInt,F=Math.floor,P=Math.pow,I=l("".charAt),L=l(/./.exec),D=l([].join),O=l(1..toString),W=l([].pop),B=l([].push),U=l("".replace),N=l([].shift),V=l("".split),G=l("".slice),j=l("".toLowerCase),H=l([].unshift),$="Invalid scheme",z="Invalid host",q="Invalid port",Y=/[a-z]/i,X=/[\d+-.a-z]/i,K=/\d/,Q=/^0x/i,J=/^[0-7]+$/,Z=/^\d+$/,ee=/^[\da-f]+$/i,te=/[\0\t\n\r #%/:<>?@[\\\]^|]/,re=/[\0\t\n\r #/:<>?@[\\\]^|]/,ie=/^[\u0000-\u0020]+/,ae=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ne=/[\t\n\r]/g,oe=function(e){var t,r,i,a;if("number"==typeof e){for(t=[],r=0;r<4;r++)H(t,e%256),e=F(e/256);return D(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,a=0,n=0;n<8;n++)0!==e[n]?(a>r&&(t=i,r=a),i=null,a=0):(null===i&&(i=n),++a);return a>r?i:t}(e),r=0;r<8;r++)a&&0===e[r]||(a&&(a=!1),i===r?(t+=r?":":"::",a=!0):(t+=O(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},se={},de=f({},se,{" ":1,'"':1,"<":1,">":1,"`":1}),le=f({},de,{"#":1,"?":1,"{":1,"}":1}),ce=f({},le,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ue=function(e,t){var r=g(e,0);return r>32&&r<127&&!_(t,e)?e:encodeURIComponent(e)},he={ftp:21,file:null,http:80,https:443,ws:80,wss:443},_e=function(e,t){var r;return 2===e.length&&L(Y,I(e,0))&&(":"===(r=I(e,1))||!t&&"|"===r)},fe=function(e){var t;return e.length>1&&_e(G(e,0,2))&&(2===e.length||"/"===(t=I(e,2))||"\\"===t||"?"===t||"#"===t)},pe=function(e){return"."===e||"%2e"===j(e)},me={},ge={},ve={},ye={},be={},we={},Se={},Ee={},Me={},Re={},Te={},xe={},Ae={},Ce={},ke={},Fe={},Pe={},Ie={},Le={},De={},Oe={},We=function(e,t,r){var i,a,n,o=y(e);if(t){if(a=this.parse(o))throw new C(a);this.searchParams=null}else{if(void 0!==r&&(i=new We(r,!0)),a=this.parse(o,null,i))throw new C(a);(n=x(new T)).bindURL(this),this.searchParams=n}};We.prototype={type:"URL",parse:function(e,t,r){var a,n,o,s,d,l=this,c=t||me,u=0,h="",f=!1,g=!1,v=!1;for(e=y(e),t||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,e=U(e,ie,""),e=U(e,ae,"$1")),e=U(e,ne,""),a=p(e);u<=a.length;){switch(n=a[u],c){case me:if(!n||!L(Y,n)){if(t)return $;c=ve;continue}h+=j(n),c=ge;break;case ge:if(n&&(L(X,n)||"+"===n||"-"===n||"."===n))h+=j(n);else{if(":"!==n){if(t)return $;h="",c=ve,u=0;continue}if(t&&(l.isSpecial()!==_(he,h)||"file"===h&&(l.includesCredentials()||null!==l.port)||"file"===l.scheme&&!l.host))return;if(l.scheme=h,t)return void(l.isSpecial()&&he[l.scheme]===l.port&&(l.port=null));h="","file"===l.scheme?c=Ce:l.isSpecial()&&r&&r.scheme===l.scheme?c=ye:l.isSpecial()?c=Ee:"/"===a[u+1]?(c=be,u++):(l.cannotBeABaseURL=!0,B(l.path,""),c=Le)}break;case ve:if(!r||r.cannotBeABaseURL&&"#"!==n)return $;if(r.cannotBeABaseURL&&"#"===n){l.scheme=r.scheme,l.path=m(r.path),l.query=r.query,l.fragment="",l.cannotBeABaseURL=!0,c=Oe;break}c="file"===r.scheme?Ce:we;continue;case ye:if("/"!==n||"/"!==a[u+1]){c=we;continue}c=Me,u++;break;case be:if("/"===n){c=Re;break}c=Ie;continue;case we:if(l.scheme=r.scheme,n===i)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=m(r.path),l.query=r.query;else if("/"===n||"\\"===n&&l.isSpecial())c=Se;else if("?"===n)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=m(r.path),l.query="",c=De;else{if("#"!==n){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=m(r.path),l.path.length--,c=Ie;continue}l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=m(r.path),l.query=r.query,l.fragment="",c=Oe}break;case Se:if(!l.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,c=Ie;continue}c=Re}else c=Me;break;case Ee:if(c=Me,"/"!==n||"/"!==I(h,u+1))continue;u++;break;case Me:if("/"!==n&&"\\"!==n){c=Re;continue}break;case Re:if("@"===n){f&&(h="%40"+h),f=!0,o=p(h);for(var b=0;b<o.length;b++){var w=o[b];if(":"!==w||v){var S=ue(w,ce);v?l.password+=S:l.username+=S}else v=!0}h=""}else if(n===i||"/"===n||"?"===n||"#"===n||"\\"===n&&l.isSpecial()){if(f&&""===h)return"Invalid authority";u-=p(h).length+1,h="",c=Te}else h+=n;break;case Te:case xe:if(t&&"file"===l.scheme){c=Fe;continue}if(":"!==n||g){if(n===i||"/"===n||"?"===n||"#"===n||"\\"===n&&l.isSpecial()){if(l.isSpecial()&&""===h)return z;if(t&&""===h&&(l.includesCredentials()||null!==l.port))return;if(s=l.parseHost(h))return s;if(h="",c=Pe,t)return;continue}"["===n?g=!0:"]"===n&&(g=!1),h+=n}else{if(""===h)return z;if(s=l.parseHost(h))return s;if(h="",c=Ae,t===xe)return}break;case Ae:if(!L(K,n)){if(n===i||"/"===n||"?"===n||"#"===n||"\\"===n&&l.isSpecial()||t){if(""!==h){var E=k(h,10);if(E>65535)return q;l.port=l.isSpecial()&&E===he[l.scheme]?null:E,h=""}if(t)return;c=Pe;continue}return q}h+=n;break;case Ce:if(l.scheme="file","/"===n||"\\"===n)c=ke;else{if(!r||"file"!==r.scheme){c=Ie;continue}switch(n){case i:l.host=r.host,l.path=m(r.path),l.query=r.query;break;case"?":l.host=r.host,l.path=m(r.path),l.query="",c=De;break;case"#":l.host=r.host,l.path=m(r.path),l.query=r.query,l.fragment="",c=Oe;break;default:fe(D(m(a,u),""))||(l.host=r.host,l.path=m(r.path),l.shortenPath()),c=Ie;continue}}break;case ke:if("/"===n||"\\"===n){c=Fe;break}r&&"file"===r.scheme&&!fe(D(m(a,u),""))&&(_e(r.path[0],!0)?B(l.path,r.path[0]):l.host=r.host),c=Ie;continue;case Fe:if(n===i||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&_e(h))c=Ie;else if(""===h){if(l.host="",t)return;c=Pe}else{if(s=l.parseHost(h))return s;if("localhost"===l.host&&(l.host=""),t)return;h="",c=Pe}continue}h+=n;break;case Pe:if(l.isSpecial()){if(c=Ie,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==i&&(c=Ie,"/"!==n))continue}else l.fragment="",c=Oe;else l.query="",c=De;break;case Ie:if(n===i||"/"===n||"\\"===n&&l.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(d=j(d=h))||"%2e."===d||".%2e"===d||"%2e%2e"===d?(l.shortenPath(),"/"===n||"\\"===n&&l.isSpecial()||B(l.path,"")):pe(h)?"/"===n||"\\"===n&&l.isSpecial()||B(l.path,""):("file"===l.scheme&&!l.path.length&&_e(h)&&(l.host&&(l.host=""),h=I(h,0)+":"),B(l.path,h)),h="","file"===l.scheme&&(n===i||"?"===n||"#"===n))for(;l.path.length>1&&""===l.path[0];)N(l.path);"?"===n?(l.query="",c=De):"#"===n&&(l.fragment="",c=Oe)}else h+=ue(n,le);break;case Le:"?"===n?(l.query="",c=De):"#"===n?(l.fragment="",c=Oe):n!==i&&(l.path[0]+=ue(n,se));break;case De:t||"#"!==n?n!==i&&("'"===n&&l.isSpecial()?l.query+="%27":l.query+="#"===n?"%23":ue(n,se)):(l.fragment="",c=Oe);break;case Oe:n!==i&&(l.fragment+=ue(n,de))}u++}},parseHost:function(e){var t,r,i;if("["===I(e,0)){if("]"!==I(e,e.length-1))return z;if(t=function(e){var t,r,i,a,n,o,s,d=[0,0,0,0,0,0,0,0],l=0,c=null,u=0,h=function(){return I(e,u)};if(":"===h()){if(":"!==I(e,1))return;u+=2,c=++l}for(;h();){if(8===l)return;if(":"!==h()){for(t=r=0;r<4&&L(ee,h());)t=16*t+k(h(),16),u++,r++;if("."===h()){if(0===r)return;if(u-=r,l>6)return;for(i=0;h();){if(a=null,i>0){if(!("."===h()&&i<4))return;u++}if(!L(K,h()))return;for(;L(K,h());){if(n=k(h(),10),null===a)a=n;else{if(0===a)return;a=10*a+n}if(a>255)return;u++}d[l]=256*d[l]+a,2!=++i&&4!==i||l++}if(4!==i)return;break}if(":"===h()){if(u++,!h())return}else if(h())return;d[l++]=t}else{if(null!==c)return;u++,c=++l}}if(null!==c)for(o=l-c,l=7;0!==l&&o>0;)s=d[l],d[l--]=d[c+o-1],d[c+--o]=s;else if(8!==l)return;return d}(G(e,1,-1)),!t)return z;this.host=t}else if(this.isSpecial()){if(e=v(e),L(te,e))return z;if(t=function(e){var t,r,i,a,n,o,s,d=V(e,".");if(d.length&&""===d[d.length-1]&&d.length--,(t=d.length)>4)return e;for(r=[],i=0;i<t;i++){if(""===(a=d[i]))return e;if(n=10,a.length>1&&"0"===I(a,0)&&(n=L(Q,a)?16:8,a=G(a,8===n?1:2)),""===a)o=0;else{if(!L(10===n?Z:8===n?J:ee,a))return e;o=k(a,n)}B(r,o)}for(i=0;i<t;i++)if(o=r[i],i===t-1){if(o>=P(256,5-t))return null}else if(o>255)return null;for(s=W(r),i=0;i<r.length;i++)s+=r[i]*P(256,3-i);return s}(e),null===t)return z;this.host=t}else{if(L(re,e))return z;for(t="",r=p(e),i=0;i<r.length;i++)t+=ue(r[i],se);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return _(he,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&_e(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,a=e.host,n=e.port,o=e.path,s=e.query,d=e.fragment,l=t+":";return null!==a?(l+="//",e.includesCredentials()&&(l+=r+(i?":"+i:"")+"@"),l+=oe(a),null!==n&&(l+=":"+n)):"file"===t&&(l+="//"),l+=e.cannotBeABaseURL?o[0]:o.length?"/"+D(o,"/"):"",null!==s&&(l+="?"+s),null!==d&&(l+="#"+d),l},setHref:function(e){var t=this.parse(e);if(t)throw new C(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new Be(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+oe(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(y(e)+":",me)},getUsername:function(){return this.username},setUsername:function(e){var t=p(y(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=ue(t[r],ce)}},getPassword:function(){return this.password},setPassword:function(e){var t=p(y(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=ue(t[r],ce)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?oe(e):oe(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Te)},getHostname:function(){var e=this.host;return null===e?"":oe(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,xe)},getPort:function(){var e=this.port;return null===e?"":y(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=y(e))?this.port=null:this.parse(e,Ae))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+D(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Pe))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=y(e))?this.query=null:("?"===I(e,0)&&(e=G(e,1)),this.query="",this.parse(e,De)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=y(e))?("#"===I(e,0)&&(e=G(e,1)),this.fragment="",this.parse(e,Oe)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Be=function(e){var t=h(this,Ue),r=w(arguments.length,1)>1?arguments[1]:void 0,i=M(t,new We(e,!1,r));n||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},Ue=Be.prototype,Ne=function(e,t){return{get:function(){return R(this)[e]()},set:t&&function(e){return R(this)[t](e)},configurable:!0,enumerable:!0}};if(n&&(u(Ue,"href",Ne("serialize","setHref")),u(Ue,"origin",Ne("getOrigin")),u(Ue,"protocol",Ne("getProtocol","setProtocol")),u(Ue,"username",Ne("getUsername","setUsername")),u(Ue,"password",Ne("getPassword","setPassword")),u(Ue,"host",Ne("getHost","setHost")),u(Ue,"hostname",Ne("getHostname","setHostname")),u(Ue,"port",Ne("getPort","setPort")),u(Ue,"pathname",Ne("getPathname","setPathname")),u(Ue,"search",Ne("getSearch","setSearch")),u(Ue,"searchParams",Ne("getSearchParams")),u(Ue,"hash",Ne("getHash","setHash"))),c(Ue,"toJSON",(function(){return R(this).serialize()}),{enumerable:!0}),c(Ue,"toString",(function(){return R(this).serialize()}),{enumerable:!0}),A){var Ve=A.createObjectURL,Ge=A.revokeObjectURL;Ve&&c(Be,"createObjectURL",d(Ve,A)),Ge&&c(Be,"revokeObjectURL",d(Ge,A))}b(Be,"URL"),a({global:!0,constructor:!0,forced:!o,sham:!n},{URL:Be})},3487:(e,t,r)=>{"use strict";r(6909)},8670:(e,t,r)=>{"use strict";var i=r(1091),a=r(5582),n=r(4787),o=r(160),s=r(4791),d=a("URL");i({target:"URL",stat:!0,forced:!s},{parse:function(e){var t=n(arguments.length,1),r=o(e),i=t<2||void 0===arguments[1]?void 0:o(arguments[1]);try{return new d(r,i)}catch(e){return null}}})},4783:()=>{},2222:(e,t,r)=>{"use strict";var i=r(6823);e.exports=i},4598:(e,t,r)=>{"use strict";var i=r(1042);e.exports=i},8251:(e,t,r)=>{"use strict";var i=r(1926);e.exports=i},4139:(e,t,r)=>{"use strict";var i=r(3842);r(2560),e.exports=i},7045:(e,t,r)=>{"use strict";var i=r(1730);r(2560),e.exports=i},70:(e,t,r)=>{"use strict";var i=r(1661);e.exports=i},9792:(e,t,r)=>{"use strict";var i=r(6908);e.exports=i},9076:(e,t,r)=>{"use strict";r(6299),r(5042),r(7649),r(3604);var i=r(2046);e.exports=i.URLSearchParams},6908:(e,t,r)=>{"use strict";r(9076),r(3487),r(8669),r(8670),r(4783);var i=r(2046);e.exports=i.URL}},t={};function r(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};r.r(e),r.d(e,{APP_Troubleshoting_Info:()=>Fd,Before_Create_Thread:()=>bs,BigLog_js:()=>Dc,CloseVideoEncoder_js:()=>kl,Crop_Mask_Bg_16V9:()=>Bl,Exit_Thread:()=>vs,GetCscThreadNum:()=>ld,GetEncThreadNum:()=>cd,GetEncoderState_js:()=>Tl,GetLogLevel_js:()=>zl,GetWebCodecsEncoderFallbackFlag_js:()=>nd,GetWebCodecsEncoderL1T2Flag_js:()=>ad,Get_Mix_Context_Data_And_Draw:()=>Nl,Get_Mix_Display_Data_And_Draw:()=>ql,Get_Mixed_VB_Data_and_Draw:()=>fc,InitVideoEncoder_js:()=>xl,IsSupportMultiThread:()=>Zs,IsSupportMultiThreadForWebcodec:()=>td,JsMediaSDK_Log:()=>va,LOG_OUT:()=>Pd,LimitWebCodecsDecoderTo360_js:()=>sd,LimitWebCodecsEncoderTo360_js:()=>od,MCMMonitor_Video_LOG:()=>wc,Open_Video_WebSocket_Connect:()=>is,Put_Decoded_Video_Buffer:()=>Nd,SAVE_IV:()=>Dd,Set_Mask_Bg_Image:()=>Ml,SubScribeUpdateVideo:()=>ns,Update_Mask_Texture:()=>Wl,Update_Video_Hd_Info:()=>Oc,UserAgentIsTesla_js:()=>dd,UserWebCodecController_js:()=>Jc,Utf8ArrayToStr:()=>Ld,VideoEncodeInit:()=>al,VideoEncoderConfigure_js:()=>Al,VideoEncoder_js:()=>Cl,WebCodecsEncoderFail_js:()=>Ec,calculateframeCaptureInterval:()=>Rc,change_capture_resolution:()=>gd,checkWebCodecWhitelist_js:()=>Qc,decode_callback:()=>Cd,frame_callback:()=>xd,freeWasmMemory:()=>Wd,getGraphicName:()=>rd,getNTPBaseTime:()=>Tc,getVendorName:()=>id,getWasmMemory:()=>Od,hardcodecpunumber:()=>ed,js_info_from_wcl:()=>vd,js_info_from_wcl_thread:()=>Rd,js_info_from_wcl_video_data:()=>Sd,media_data_transport_type_monitor:()=>bd,network_quality_callback:()=>bc,on_psl_mix_share_info_changed:()=>wd,prepareJSFile:()=>ec,prepareModelFile:()=>Jl,processed_capture_data_callback:()=>Ed,qos_monitor:()=>vc,recalculateFps:()=>Mc,receiver_stats_log:()=>hd,reportSenderNTPTime:()=>xc,responseVideoQosData:()=>gc,send_data:()=>kd,sender_stats_log:()=>ud,setCurrentThreadSsrc_js:()=>Fl,vbLoadingTimer:()=>ws,video_process_capture:()=>rl,video_statistics_monitor:()=>yc,video_websocket_on_close:()=>pd,video_websocket_on_command:()=>md,video_websocket_on_open:()=>os,videocodec_create_helpthread:()=>ys,videoencode_create_helpthread:()=>gs,wcl_trace_log:()=>Id});var t=r(6984),i=r.n(t);const a=9,n=18,o=20,s=21,d=24,l=31,c=35,u=47,h=56,_=61,f=66.5,p=67,m=71,g=76,v=105,y=106,b=107,w=108,S=121,E=127,M=128,R=133,T=135,x=137,A=140,C=141,k=178,F=179,P=183,I=184,L=185,D=186,O=187,W=189,B=193,U=196,N=197,V=-8,G=-9,j=-26,H=-28,$=-137,z=49,q=79,Y="VIDEO_QOS_DATA",X="EXPOSE_VB_FRAME",K="MEDIASDK_CACHE_INFO",Q=new class{constructor(){this._highFrequencyLogs={},this.fixVersion="",this.cacheLogStack=[],this.isFlushing=!1}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=` File: ${t.filename}`),(t.lineno||t.colno)&&(r+=` Line: ${t.lineno}:${t.colno}`),t.message&&(r+=` Message: ${t.message}`),t.error&&(r+=`\nStack: ${t.error.stack}`)):t instanceof Error?(t.message&&(r+=` Message: ${t.message}`),t.stack&&(r+=` Stack: ${t.stack}`),t.name&&(r+=` Name: ${t.name}`),t.constraint&&(r+=` Constraint: ${t.constraint}`)):t instanceof CloseEvent?(t.code&&(r+=` Code: ${t.code}`),t.reason&&(r+=` Reason: ${t.reason}`),r+=` wasClean: ${t.wasClean}`):t instanceof DOMException?(t.message&&(r+=` Message: ${t.message}`),t.name&&(r+=` Name: ${t.name}`)):r+=t?t.toString():"",r}_addCacheLog(e,t){this.cacheLogStack.length<100&&this.cacheLogStack.push({type:e,message:t})}flushCacheLog(){if(this._instance&&this.cacheLogStack.length>0&&!this.isFlushing){this.isFlushing=!0;let e="";this.cacheLogStack.forEach((t=>{let{type:r,message:{message:i="",tags:a=[]}}=t;const n=i?`${a.join("|")}:${i}|----|`:"";switch(r){case"log":this._log(i,[...a,K]);break;case"warn":case"error":case"severityerror":case"directReport":e+=n}})),e&&this._directReport(e,[K]),this.cacheLogStack=[],this.isFlushing=!1}}log(e,t=[]){this._instance?(this.flushCacheLog(),this._log(e,t)):this._addCacheLog("log",{message:e,tags:t})}warn(e,t=null,r=[]){e=this.getMessageFromErrorOrEvent(e,t),this._instance?(this.flushCacheLog(),this._warn(e,r)):this._addCacheLog("warn",{message:e,tags:r})}error(e,t=null,r=[]){var i;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1,!((i=this._highFrequencyLogs[e])&i-1)&&(this._instance?(this.flushCacheLog(),this._error(e,r)):this._addCacheLog("error",{message:e,tags:r}))}severityerror(e,t=[]){this._instance?(this.flushCacheLog(),this._severityerror(JSON.stringify(e),t)):this._addCacheLog("severityerror",{message:JSON.stringify(e),tags:t})}directReport(e,t=["MEDIASDK_INFO"]){var r;this._instance?(this.flushCacheLog(),null===(r=this._directReport)||void 0===r||r.call(this,e,t)):this._addCacheLog("directReport",{message:e,tags:t})}_log(e,t=[]){this._instance&&this._instance.log(e,t)}_warn(e,t=[]){this._instance&&this._instance.warn(e,t)}_error(e,t=[]){this._instance&&this._instance.error(e,[this.fixVersion,...t])}_severityerror(e,t=[]){this._instance&&this._instance.error(e,t)}_directReport(e,t=[]){var r,i;this._instance&&(null===(i=(r=this._instance).directReport)||void 0===i||i.call(r,{msg:e},t))}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};new Error;const J=new Map;function Z(e,t="|"){return e?e.toString().replaceAll(/[,,]/g,t):""}const ee="function"!=typeof importScripts;function te(e){postMessage({status:c,data:e})}function re(e,t=null){ee?Q.error(e,t):ie(e,t)}function ie(e,t=null){var r,i;if(t instanceof Error||t instanceof ErrorEvent){const a=t;e+=" Code: "+(null==a?void 0:a.code)+" Message: "+(null==t?void 0:t.message)+" Stack: "+(null!==(i=null===(r=null==a?void 0:a.error)||void 0===r?void 0:r.stack)&&void 0!==i?i:null==a?void 0:a.stack),t=null}postMessage({status:_,errorMessage:e,errorEvent:t})}function ae(e){postMessage({status:_,errorMessage:e,level:"low"})}function ne(e){ee?function(e,t){if(!function(e){const t=performance.now();return(!J.has(e)||t-J.get(e)>5e3)&&(J.set(e,t),!0)}(e))return;let r;try{r=Z("object"==typeof t?JSON.stringify(t):t)}catch(e){r=Z(t)}Q.error(`NotifyUIError,event=${e},data=${r}`)}(-51,e):postMessage({status:-27,where:e})}function oe(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function se(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function de(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function le(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}function ce(e){postMessage({status:j,canvasId:e,replaceCanvas:!1})}function ue(e){postMessage({status:H,canvasId:e})}function he(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function _e(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||ie("get2DContextFromCanvas return null"),t}class fe{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;r<e;r++)this.uint8Map[r]=new Uint8Array(t),this.availableIndex.push(r),this.avaiableIndexMap[r]=!0}increaseBufferSize(e){let t=this.bytesPerElement+e;this.bytesPerElement=t;for(let e=0;e<this.capacity;e++){let r=this.uint8Map[e],i=new Uint8Array(t);i.set(r,0),this.uint8Map[e]=i}}getCapacity(){return this.capacity}get(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise(((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})}))}{let e=new he;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){!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)&&this.deferedList.shift().resolve(this.get())}}class pe{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}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){ie("Error in YuvWrap.recycle: ".concat(e))}}}const me=["","MOZ_","OP_","WEBKIT_"];function ge(e,t){for(var r=0;r<me.length;++r){var i=me[r]+t,a=e.getExtension(i);if(a)return a}}const ve=new Map,ye=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&&i.lastTime&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))}))}_notifyFPS(e,t){postMessage({status:66.6,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}},be=new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{timeList:[],lastTime:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS(),this._checkIfNewFrameComing()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(r.timeList.push(t),r.lastTime=t,r.timeList.length>2){const t=r.timeList[0],i=r.timeList[r.timeList.length-1];if(i-t>=1e3){const a=Math.floor(1e3/((i-t)/(r.timeList.length-1)));r.fps!==a&&(this._notifyFPS(e,a),r.fps=a),r.timeList=[]}}r.timeList.length>30&&(r.timeList=r.timeList.slice(r.timeList.length-30))}_removeZeroFPS(){this.ssrcInfoMap.forEach(((e,t)=>{const r=this.ssrcInfoMap.get(t);r&&Date.now()-r.lastTime>2e3&&(this.ssrcInfoMap.delete(t),this._notifyFPS(t,0))}))}_notifyFPS(e,t){postMessage({status:66.6,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}};function we(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{r_w:a,r_h:n,rotation:o,ssrc:s}=e;let d=1==o||3==o,l=d?n:a,c=d?a:n;const u=s>>10<<10,h=function(e,t){const r=e*t;return r<36864?0:r<129600?1:r<36e4?2:r<144e4?3:4}(l,c);if(!ve.get(u)||ve.get(u).width!==l||ve.get(u).height!==c){const e={width:l,height:c,ssrc:u,quality:h};ve.set(u,e),r?r(e):postMessage({status:f,data:e})}t&&(i?be:ye).updateSSRCInfo(u,Date.now())}function Se(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),(e=>e.charCodeAt(0))):null}const Ee=function(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;const n=i.width,o=i.height,s=n*o,d=s/4,l=t*r,c=l/4,u=t*i.y+i.x,h=t*i.y/4+i.x/2;let _;_=a?new Uint8Array(a,0,s+2*d):new Uint8Array(s+2*d);const f=e.buffer,p=e.byteOffset;if(t==i.width){const e=new Uint8Array(f,p+u,s);_.set(e,0);const t=new Uint8Array(f,p+l+h,d);_.set(t,s);const r=new Uint8Array(f,p+l+c+h,d);_.set(r,s+d)}else{let e=0,r=p+u;for(let i=0;i<o;i++){const i=new Uint8Array(f,r,n);_.set(i,e),e+=n,r+=t}let i=n/2,a=t/2,m=o/2;e=s,r=p+l+u;for(let t=0;t<m;t++){const t=new Uint8Array(f,r,i);_.set(t,e),e+=i,r+=a}e=s+d,r=p+l+c+h;for(let t=0;t<m;t++){const t=new Uint8Array(f,r,i);_.set(t,e),e+=i,r+=a}}return _};function Me(e,t){postMessage({status:s,data:"".concat(e,":").concat(t)})}function Re(){return(navigator.hardwareConcurrency||0)<4}let Te=null,xe=null;function Ae(e,t,r,i){const a=((e,t,r)=>{let i=1==r||3==r;return(i?t:e)>=1920&&(i?e:t)>=1080})(t,r,i);return xe===e&&Te===a||(xe=e,Te=a,postMessage({status:C,data:a})),a}function Ce(){const e=self.wasmMemory;(!e||!e.buffer||0===e.buffer.byteLength)&&postMessage({status:-36})}const ke=1e3,Fe=5,Pe=43,Ie=44,Le=45,De=10,Oe=11,We=-1,Be=0,Ue=1,Ne=3,Ve={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},Ge=30,je=24,He=20,$e=15,ze=8294400,qe={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},Ye=(new Map([["useinbandfec",1],["maxaveragebitrate",48e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3]]),new Map([["useinbandfec",1],["maxaveragebitrate",64e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),new Map([["stereo",1]]),0),Xe={WASM_INIT_ERROR:1,BITSTREAM_ERROR:2,WEBCODEC_ERROR:3,WEBCODEC_TIMEOUT_ERROR:4,WEBCODEC_RETRY:5};var Ke=r(4997),Qe=r(2321),Je=r(2231);function Ze(e){return Ze="function"==typeof Qe&&"symbol"==typeof Je?function(e){return typeof e}:function(e){return e&&"function"==typeof Qe&&e.constructor===Qe&&e!==Qe.prototype?"symbol":typeof e},Ze(e)}var et=r(9280);function tt(e,t,r){return(t=function(e){var t=function(e){if("object"!=Ze(e)||!e)return e;var t=e[et];if(void 0!==t){var r=t.call(e,"string");if("object"!=Ze(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ze(t)?t:t+""}(t))in e?Ke(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const rt=["intel","nvidia","apple","amd","qualcomm","arm"],it=.005,at=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:r,opacity:i,name:a}=e;t.fillStyle="rgba(0, 0, 0, ".concat(i,")"),t.fillText(a,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(i,")"),t.fillText(a,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:a}=e;const n=this._getPaddingWidth({ctx:r,position:t,name:i});return 1===t?{x:-a.width/2,y:n}:2===t||4===t||8===t?{x:-a.width/2,y:-n}:{x:-a.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:a,opacity:n=.15,position:o,convertToDataUrl:s=!1,transferToImage:d=!1}=e;if(!r||!i||!a)return;n=n||.15,i*=1,a*=1,t.width=i,t.height=a;let l=this._getTransformInfo({canvas:t,position:o});var c=t.getContext("2d");let u;if(c.clearRect(0,0,t.width,t.height),c.translate(l.x,l.y),c.rotate(l.rateRadio),this._setBaseLine({ctx:c,position:o}),c.lineWidth=1,c.imageSmoothingEnabled=!0,1==r.length){const e=l.maxWidth/r.length;c.font=e+"px 'Segoe UI'",u=c.measureText(r)}else{let e=16;for(c.font=e+"px 'Segoe UI'",u=c.measureText(r);u.width<l.maxWidth-2*this._getPaddingWidth({ctx:c,position:o,name:r});)e+=1,c.font=e+"px 'Segoe UI'",u=c.measureText(r);if(u.width>l.maxWidth-2*this._getPaddingWidth({ctx:c,position:o,name:r}))if(e>16)e-=1,c.font=e+"px 'Segoe UI'",u=c.measureText(r);else{const e=r;for(;r.length>5&&u.width>l.maxWidth-2*this._getPaddingWidth({ctx:c,position:o,name:r+"..."});)r=r.slice(0,r.length-1),u=c.measureText(r+"...");e!==r&&(r+="...")}}const h=this._calcTextPos({position:o,ctx:c,name:r,textWidth:u});var _;if(this._drawWatermarkWithShadow({ctx:c,name:r,opacity:n,textPos:h}),s)_=t.toDataURL();else if(d)_=t.transferToImageBitmap();else{var f=c.getImageData(0,0,c.canvas.width,c.canvas.height);_=new Uint8Array(f.data.buffer)}return c.rotate(-l.rateRadio),c.translate(-l.x,-l.y),_}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:r,width:i,height:a,opacity:n=.15,position:o,convertToDataUrl:s=!1,transferToImage:d=!1}=e;if(!r||!i||!a)return;n=n||.15,i*=1,a*=1,t.width=i,t.height=a;const l=t.getContext("2d");l.clearRect(0,0,t.width,t.height),l.translate(i/2,a/2),l.rotate(-21*Math.PI/180),l.imageSmoothingEnabled=!0,l.font="".concat(32,"px 'Segoe UI'"),l.textBaseline="top";const c=l.measureText(r),u=.37*c.width;let h,_=0,f=-a;do{let e=_%2==0?u-i:-i;do{l.fillStyle="rgba(0, 0, 0, ".concat(n,")"),l.fillText(r,e,f),l.fillStyle="rgba(255, 255, 255, ".concat(n,")"),l.fillText(r,e+1,f+1),e+=c.width+u}while(e<i);f+=32+u,_++}while(f<a);if(s)h=t.toDataURL();else if(d)h=t.transferToImageBitmap();else{const e=l.getImageData(0,0,l.canvas.width,l.canvas.height);h=new Uint8Array(e.data.buffer)}return l.rotate(21*Math.PI/180),l.translate(-i/2,-a/2),h}};function nt(){this.a=[],this.b=0,this.residue=null}nt.prototype.getLength=function(){return this.a.length-this.b},nt.prototype.isEmpty=function(){return 0==this.a.length},nt.prototype.enqueue=function(e){this.a.push(e)},nt.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},nt.prototype.peek=function(){return 0<this.a.length?this.a[this.b]:void 0},nt.prototype.clear=function(){this.a=[],this.b=0};const ot=nt;function st(){this.ssrcQueueMap=new Map,st.prototype.AddQueue=function(e){var t=new ot;return this.ssrcQueueMap.set(e,t),t},st.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},st.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},st.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},st.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},st.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var dt=function(){this.frames=0,this.ntp=new ot};dt.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,a=0,n=0;n<e;n++){var o=this.ntp.dequeue();0==o&&0==i?r++:0!=o?(a=0,0==i&&(i=o),t=o):0!=i&&t!=i&&0==o&&a++}return 0==t||t==i?0:e-r-a-1!=0?(t-i)/(e-r-a-1):0}}};var lt=function(){this.ssrcInfoMap=new Map};function ct(){this.ssrcQueueMap=new Map,this.ssrcInfo=new lt,ct.prototype.AddQueue=function(e){var t=new ot;return this.ssrcQueueMap.set(e,t),t},ct.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},ct.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},ct.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},ct.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},ct.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},ct.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},ct.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},ct.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}function ut(e){let{sessionid:t}=e;this.sessionid=t||0,this.map=new Map,this.VideoQueueMGR=new ct}lt.prototype={UpdateSSRCInfo:function(e,t){var r=this.ssrcInfoMap.get(e);r||(r=new dt,this.ssrcInfoMap.set(e,r)),r.UpdateVideoInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetVideoFpsInfo():0}},function(){function e(e){let{sessionid:t}=e;this.map=new Map,this.AudioQueueMGR=new st,this.timemap=new Map,this.sessionid=t||0}e.prototype.Add=function(e,t){this.map.set(e,t),this.AudioQueueMGR.AddQueue(e)},e.prototype.Clear=function(){this.map.clear()},e.prototype.Keys=function(){return this.map.keys()},e.prototype.UpdateSSRCTimeMap=function(e){this.timemap=e},e.prototype.GetSSRCTimeMap=function(e){return this.timemap?this.timemap.get(e):null}}(),ut.prototype.Add=function(e,t){this.map.set(e,t)},ut.prototype.Clear=function(){this.map.clear()},ut.prototype.Keys=function(){return this.map.keys()};var ht=function(){this.frames=0,this.ntp=new ot};ht.prototype={UpdateSharingInfo:function(e){this.frames++,this.ntp.getLength()>30&&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,a=0,n=0;n<e;n++){var o=this.ntp.dequeue();0==o&&0==i?r++:0!=o?(a=0,0==i&&(i=o),t=o):0!=i&&t!=i&&0==o&&a++}return 0==t||t==i?0:e-r-a-1!=0?(t-i)/(e-r-a-1):0}}};var _t=function(){this.ssrcInfoMap=new Map};function ft(){this.ssrcQueueMap=new Map,this.ssrcInfo=new _t,ft.prototype.AddQueue=function(e){var t=new ot;return this.ssrcQueueMap.set(e,t),t},ft.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},ft.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},ft.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},ft.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},ft.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},ft.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},ft.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},ft.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}function pt(e){let{sessionid:t}=e;this.map=new Map,this.sQueue=new ot,this.SharingQueueMGR=new ft,this.sessionid=t||0}function mt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function gt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(r),!0).forEach((function(t){tt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}_t.prototype={UpdateSSRCInfo:function(e,t){var r=this.ssrcInfoMap.get(e);r||(r=new ht,this.ssrcInfoMap.set(e,r)),r.UpdateSharingInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetSharingFpsInfo():0}},pt.prototype.Clear=function(){this.map.clear()},pt.prototype.Keys=function(){return this.map.keys()},pt.prototype.Add=function(e,t){this.map.set(e,t)},pt.prototype.Get=function(e){return this.map.get(e)},pt.prototype.PutData=function(e){e&&this.sQueue&&this.sQueue.enqueue(e)},pt.prototype.GetData=function(){if(this.sQueue)return this.sQueue.dequeue()},pt.prototype.ClearBuffer=function(){this.sQueue&&(this.sQueue=new ot)};const vt=function(e,t){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16/9;if(!e||!t)return null;const i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)||0,a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)||0;if(e/t>r){const n=t*r;return{width:n,height:t,left:Math.round((e-n)/2)+i,top:0+a}}{const n=e/r;return{width:e,height:n,left:0+i,top:Math.round((t-n)/2)+a}}};function yt(e,t,r){function i(e,t){return Math.min("px"===e.unit?e.value/t:e.value/100,.5)}return{radius_lb_x:i(e.topLeft.x,t),radius_lb_y:i(e.topLeft.y,r),radius_lt_x:i(e.bottomLeft.x,t),radius_lt_y:i(e.bottomLeft.y,r),radius_rb_x:i(e.topRight.x,t),radius_rb_y:i(e.topRight.y,r),radius_rt_x:i(e.bottomRight.x,t),radius_rt_y:i(e.bottomRight.y,r)}}const bt={radius_lb_x:0,radius_lb_y:0,radius_lt_x:0,radius_lt_y:0,radius_rb_x:0,radius_rb_y:0,radius_rt_x:0,radius_rt_y:0};function wt(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.isLSSPlayer=e.isLSSPlayer,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 at,this.vMonitorCount=0,this.videoQueue=new ct,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.zoneLastRenderedMap=new Map,this.ssrcCurrentRenderingMap=new Map,this.pauseSet=new Set,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.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.bWebglContextLostProtectingMap=new Map,this.ismirror=!1,this.firstFrameMap=new Map,this.lfTimeStamp=0,this.activeFps=0,this.lastActiveSSRC=0,this.disableOriginalRatio=!1,this.onStopDrawCallback=e.onStopDrawCallback,this.onReStoreCallback=e.onReStoreCallback,this.videoRenderWGLFSTOP=!1}wt.prototype.clearUseridRender=function(e,t,r,i){let a=e[0],n=a.display;if(n)if(!i&&n.setWatermarkFlag(0),this.renderMode)n.clearCanvas(t);else{let e=a.ssrc;if(!n||!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 i=this.renderManager.getRendererProvider().isWebGLRendererType(),o=this.renderManager.getRendererProvider().isWebGL2RendererType(),s=this.renderManager.getRendererProvider().isWebGPURendererType();if(i||o){let e=this.canvasToLocalDisplay.get(a.canvas);if(!e)return;e.setVideoMode(Be),e.colorRange=0,e.setFillMode(1,1),e.setRoundedCornerRadius(bt),e.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===r&&((r={}).x=a.x,r.y=a.y,r.width=a.width,r.height=a.height),e.drawSelfVideo(r,!0)}else if(s){if(!n)return;n.setVideoMode(Be),n.setColorRange(0),n.setFillMode(1,1),n.setRoundedCornerRadius(bt),n.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===r&&((r={}).x=a.x,r.y=a.y,r.width=a.width,r.height=a.height),n.drawSelfVideo(r,!0)}let d=this;this.ssrcDisplayMap.forEach((function(t,r){let a,n;d.selfvideossrc&&r==d.Get_Logical_SSrc(d.selfvideossrc)&&(a=!0),r==d.Get_Logical_SSrc(e)&&(n=!0),t.forEach((e=>{if(!e.haddata||n)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&&(!n||i&&o?t.getVideoMode()!=We&&(-1==[Be,Ne].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.isLSSPlayer&&d.firstFrameMap.get(e.ssrc)&&d.firstFrameMap.delete(e.ssrc)))}))})),this.renderManager.renderFor(1)}},wt.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<this.videoRenderArray.length;e++){let t=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc));t?t.push(this.videoRenderArray[e]):(t=[],t.push(this.videoRenderArray[e]),this.ssrcDisplayMap.set(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc),t),this.ssrcHaddataMap.set(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc),!1))}},wt.prototype.Set_Render_Array=function(e,t){this.renderMode?this.Set_Render_Array_IntervalMode(e,t):this.Set_Render_Array_rAF(e)},wt.prototype.ClearQueue=function(){this.videoQueue&&this.videoQueue.ClearQueue(),this.currentVideoHeight=0,this.currentVideoWidth=0},wt.prototype.Put_Video_Into_Buffer=function(e){if(this.videoQueue){var t=this.videoQueue.GetQueue(e.ssrc);if(t||(t=this.videoQueue.AddQueue(e.ssrc)),t.enqueue(e),this.videoQueue&&this.videoQueue.ssrcInfo){var r=e.ssrc>>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(r,e.ntptime)}for(var i=this.videoQueue.GetQueueLength(e.ssrc)-10;i>=0;)i--}},wt.prototype.Update_RemoteVideo_Texture=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=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&&r){let t=this.Get_Logical_SSrc(r),o=this.FindVideoRenderListFromMap(r);if(!o.length)return void this.renderManager.destroyUnusedVideoFrame(e);let s=this,d=n&&(1==i||3==i);this.ssrcHaddataMap.set(t,!0),a?(this.croppingParams.top=a.y,this.croppingParams.left=a.x,this.croppingParams.height=a.height,this.croppingParams.width=a.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),d){let e=c;c=l,l=e,e=this.croppingParams.height,this.croppingParams.height=this.croppingParams.width,this.croppingParams.width=e}n&&(i=0),this.canvasIdSet.clear(),o&&o.forEach((t=>{t.haddata=!0;let r=t.display;s.coordinate.x=t.x,s.coordinate.y=t.y,s.coordinate.width=t.width,s.coordinate.height=t.height;let a=!(r&&r.reuse&&t.rendercanvasID&&this.canvasIdSet.has(t.rendercanvasID));r&&(r.setVideoMode(Be),s.Should_Update_Watermark(r,t.width,t.height,t.width,t.height)&&s.Update_Display_Watermark(r,t.width,t.height,t.width,t.height),e&&r.updateRemoteVideoTexturesImageBitmap(l,c,e,s.croppingParams,i,a),this.canvasIdSet.add(t.rendercanvasID))}))}else this.renderManager.destroyUnusedVideoFrame(e);else{if(e&&e.ssrc){let t=this.Get_Logical_SSrc(e.ssrc);if(this.isLSSPlayer&&this.pauseSet.has(t+" "+e.zone))return;let r,i=this.FindVideoRenderListFromMap(e.ssrc);if(!i.length)return e.yuvdataptr&&Module._free(e.yuvdataptr),void this.renderManager.destroyUnusedVideoFrame(e);let a=!1,n=this;this.ssrcHaddataMap.set(t,!0);let o=e;this.croppingParams.top=o.r_y,this.croppingParams.left=o.r_x,this.croppingParams.height=o.r_h,this.croppingParams.width=o.r_w,r=o,r.enableMultiDecodeVideoWithoutSAB?r.yuvdata=r.data:r.yuvdata=se().subarray(r.yuvdataptr,r.yuvdataptr+r.yuvlength),!r.yuvdata.length||r.yuvdata.length!=r.width*r.height*3/2||this.croppingParams.top<0||this.croppingParams.left<0||this.croppingParams.left+this.croppingParams.width>r.width||this.croppingParams.top+this.croppingParams.height>r.height||i&&(this.canvasIdSet.clear(),i.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 o=!(i&&i.reuse&&e.rendercanvasID&&this.canvasIdSet.has(e.rendercanvasID));i&&(i.setVideoMode(Ue),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),r&&(this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(t,r),i.updateRemoteVideoTextures(r.width,r.height,n.croppingParams,r.yuvdata,r.rotation,r.yuv_limited,n.coordinate,a,o)),this.canvasIdSet.add(e.rendercanvasID))})))}else this.renderManager.destroyUnusedVideoFrame(e);e.yuvdataptr&&Module._free(e.yuvdataptr)}},wt.prototype.Set_Cropping_Mode=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.disableOriginalRatio=!!e},wt.prototype.Update_Cropping_Params=function(){if(this.disableOriginalRatio){const e=vt(this.croppingParams.width,this.croppingParams.height,this.croppingParams.left,this.croppingParams.top);e&&(this.croppingParams=gt(gt({},this.croppingParams),e))}},wt.prototype.Update_SelfVideo_Texture=function(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Be,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=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 s=this.FindVideoRenderList(i);for(;n<s.length;n++){this.coordinate.x=s[n].x,this.coordinate.y=s[n].y,this.coordinate.width=s[n].width,this.coordinate.height=s[n].height,this.Update_Cropping_Params(),s[n].display.setVideoMode(a);const{display:i,width:d,height:l}=s[n];this.Should_Update_Watermark(i,d,l,d,l)&&this.Update_Display_Watermark(i,d,l,d,l);let c=!(i&&i.reuse&&s[n].rendercanvasID&&this.canvasIdSet.has(s[n].rendercanvasID));-1!==[Be,Ne].indexOf(a)?(s[n].display.updateSelfVideoTextures(e,t,r,this.croppingParams,c,o),s[n].enableMultiDecodeVideoWithoutSAB?s[n].firstFrame=!0:s[n].display.drawSelfVideo(this.coordinate,!1,this.ismirror)):(s[n].display.updateRemoteVideoTextures(e,t,this.croppingParams,r,o,0,this.coordinate,!1,c),s[n].enableMultiDecodeVideoWithoutSAB?s[n].firstFrame=!0:s[n].display.drawRemoteVideo(this.coordinate,this.ismirror)),this.canvasIdSet.add(s[n].rendercanvasID)}this.renderManager.renderFor(1)}else if(r&&i){let n=this.FindVideoRenderListFromMap(i);this.ssrcHaddataMap.set(i,!0);let s=this;n.length&&(this.canvasIdSet.clear(),n.forEach((i=>{i.haddata=!0,s.coordinate.x=i.x,s.coordinate.y=i.y,s.coordinate.width=i.width,s.coordinate.height=i.height,s.Update_Cropping_Params();let n=i.display,d=!(n&&n.reuse&&i.rendercanvasID&&this.canvasIdSet.has(i.rendercanvasID));n&&(n.setVideoMode(a),s.Should_Update_Watermark(n,i.width,i.height,i.width,i.height)&&s.Update_Display_Watermark(n,i.width,i.height,i.width,i.height),-1!==[Be,Ne].indexOf(a)?n.updateSelfVideoTextures(e,t,r,s.croppingParams,d,o):n.updateRemoteVideoTextures(e,t,s.croppingParams,r,o,!0,s.coordinate,!1,d),this.canvasIdSet.add(i.rendercanvasID))})),this.renderManager.renderFor(1))}},wt.prototype.Draw_Send_Video_Img=function(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Be,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.Update_SelfVideo_Texture(t,r,e,i,a,n)},wt.prototype.setMirrorMyVideoOption=function(e){this.ismirror=e},wt.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:(function(e){if(e)Rt=e}(this),this.Start_Request_Animation_Frame())},wt.prototype.Stop_Draw=function(){this.rendingFlag=!1,this.renderMode?clearInterval(this.intervalHandle):this.Stop_Request_Animation_Frame()},wt.prototype.contextLostCallback=function(e){let t=e.currentTarget.canvasId;Et&&ce(t),e.preventDefault()},wt.prototype.contextRestoredCallback=function(e){let t=e.currentTarget,r=t.canvasId,i=t.callback;this.Restored_From_Context_Lost(t,t,r,this.Log_Error.bind(this),i),this.onReStoreCallback&&this.onReStoreCallback(this),Et&&ue(r)},wt.prototype.webGLContextLostProtect=function(e,t,r){let i=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=r,e.callback=i,this.renderMode||((t=this.bWebglContextLostProtectingMap.get(r))&&(t.removeEventListener("webglcontextlost",t.contextLostHandler),t.removeEventListener("webglcontextrestored",t.contextRestoredHandler)),this.bWebglContextLostProtectingMap.set(r,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})))},wt.prototype._Replace_Video_Render_Array_From_Context_LOST=function(e){let{canvas:t,oldCanvas:r,newDisplayMap:i}=e;for(let e=0;e<this.videoRenderArray.length;e++)if(this.videoRenderArray[e].canvas===r||this.videoRenderArray[e].canvas===t){r!==t&&(this.videoRenderArray[e].canvas=t);const n=this.videoRenderArray[e].display.getFillMode();var a;this.videoRenderArray[e].display=i?i.get(this.videoRenderArray[e].display.getTextureIndex()):this._Create_WebGL_Canvas({videoRenderArrayIndex:e,canvas:t,canvasId:this.videoRenderArray[e].rendercanvasID}),n&&this.videoRenderArray[e].display&&this.videoRenderArray[e].display.setFillMode(n,this.videoRenderArray[e].display.getFillModeForResolution()),this.videoRenderArray[e].borderRadius&&(null===(a=this.videoRenderArray[e].display)||void 0===a||a.setRoundedCornerRadius(this.videoRenderArray[e].borderRadius))}},wt.prototype.Restored_From_Context_Lost=function(e,t,r,i){let a=arguments.length>4&&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(r,e,t,this.threadNumbs,i,this.canvasToLocalDisplay);n&&(this.ssrcDisplayMap.forEach(((r,i)=>{r.forEach((r=>{if(r.haddata=!1,r.canvas===t){t!==e&&(r.canvas=e);let i=r.display;r.display=n.get(i.getTextureIndex())}}))})),this._Replace_Video_Render_Array_From_Context_LOST({canvas:e,oldCanvas:t,newDisplayMap:n}),null==a||a({canvas:e,oldCanvas:t,newDisplayMap:n}),this.rendingFlag&&this.Start_Request_Animation_Frame())}},wt.prototype.Replace_Canvas=function(e,t){let r=null;this.bWebglContextLostProtectingMap.forEach(((e,i)=>{i===t&&(r=e)})),r!=e&&(this.bWebglContextLostProtectingMap.delete(t),this.webGLContextLostProtect(e,r,t),this.Restored_From_Context_Lost(e,r,t,this.Log_Error.bind(this))),this.isSupportOffscreenCanvas&&(this.waterMarkCanvas||this.videorendercanvas)&&(this.waterMarkCanvas=this.videorendercanvas=new OffscreenCanvas(640,360))},wt.prototype.Get_Display=function(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const a=this.renderManager.getRendererProvider().isWebGLRendererType(),n=this.renderManager.getRendererProvider().isWebGL2RendererType();return(a||n)&&this.webGLContextLostProtect(e,null,t,i),this.renderManager.getVideoRenderDisplay(e,t,this.threadNumbs,this.Log_Error.bind(this),this.canvasToLocalDisplay)},wt.prototype.GiveBack_Display=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e[0];r&&r.display&&this.renderManager.recycleRenderDisplay(r.canvas,r.display,t)},wt.prototype.Get_Logical_SSrc=function(e){return e?e>>10<<10:-1},wt.prototype.Set_LocalVideo_Ptr=function(e){e&&(this.localVideoPtr=e)},wt.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))},wt.prototype.Set_LocalVideo_SSRC=function(e){e&&(this.localvideossrc=e,this.selfvideossrc=e)},wt.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),r=!0;if(e==t&&(r=!1),e-t==1&&(e=(e+1)%5),r){let t=0,r=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e)/2],i=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+2)/2],a=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+4)/2],n=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+6)/2],o=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+8)/2],s=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+10)/2],d=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(ze+4+8+2)*e+12)/2],l=255&d,c=d>>8&255;t=l&&l!==Ne?r*i*3/2:r*i*4,this.croppingParams.top=a,this.croppingParams.left=n,this.croppingParams.height=s,this.croppingParams.width=o;let u=this.encodedVideoSharedArrayBufferUint8Array.subarray(this.localVideoPtr+4+(ze+4+8+2)*e+4+8+2,this.localVideoPtr+4+(ze+4+8+2)*e+4+8+2+t);this.Update_SelfVideo_Texture(r,i,u,this.Get_Logical_SSrc(this.localvideossrc),l,this.croppingParams,c),Atomics.store(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr,(e+1)%5)}}},wt.prototype.Update_LocalVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.localvideossrc;if(this.renderMode){let a=0,n=0,o=!1,s=this.FindVideoRenderList(i),d=r&&(1==t||3==t);for(;n<s.length;n++){o=!0;let i=e;this.croppingParams.top=i.visibleRect?0:i.cropTop,this.croppingParams.left=i.visibleRect?0:i.cropLeft,this.croppingParams.height=i.visibleRect?d?i.visibleRect.width:i.visibleRect.height:i.cropHeight,this.croppingParams.width=i.visibleRect?d?i.visibleRect.height:i.visibleRect.width:i.cropWidth,this.coordinate.x=s[n].x,this.coordinate.y=s[n].y,this.coordinate.width=s[n].width,this.coordinate.height=s[n].height,this.Update_Cropping_Params(),s[n].display.setVideoMode(a);const{display:l,width:c,height:u}=s[n];0!=c&&0!=u&&(this.Should_Update_Watermark(l,c,u,c,u)&&this.Update_Display_Watermark(l,c,u,c,u),-1!==[Be,Ne].indexOf(a)&&(s[n].display.updateRemoteVideoTexturesImageBitmap(this.croppingParams.width,this.croppingParams.height,i,this.croppingParams,r?0:t),s[n].enableMultiDecodeVideoWithoutSAB?s[n].firstFrame=!0:s[n].display.drawSelfVideo(this.coordinate,!1,this.ismirror)))}o||this.renderManager.destroyUnusedVideoFrame(e)}else this.Update_RemoteVideo_Texture(e,!0,i,t,null,r)},wt.prototype.Set_Capture_Video_Flag=function(e){this.startCaptureVideo=e},wt.prototype.Get_Capture_Video_Flag=function(){return this.startCaptureVideo},wt.prototype.FindVideoRender=function(e){if(!e)return null;for(let t=0;t<this.videoRenderArray.length;t++)if(this.videoRenderArray[t].ssrc&&this.videoRenderArray[t].ssrc>>10==e>>10)return this.videoRenderArray[t];return null},wt.prototype.FindVideoRenderList=function(e){let t=this.isActiveSeakerSsrc(e),r=this.FindVideoRender(1),i=[e>>10];t&&r&&i.push(0);let a=[];for(let e=0;e<this.videoRenderArray.length;e++)this.videoRenderArray[e].ssrc&&i.includes(this.videoRenderArray[e].ssrc>>10)&&a.push(this.videoRenderArray[e]);return a},wt.prototype.FindVideoRenderListFromMap=function(e){let t=this.isActiveSeakerSsrc(e),r=[...this.ssrcDisplayMap.get(this.Get_Logical_SSrc(e))||[]];if(t){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(1))||[];r.push(...e)}return r},wt.prototype.JsMediaSDK_VideoRender_interval=function(){this.startCaptureVideo&&this.Draw_LocalVideo();let e=this.FindVideoRender(1),t=this.FindVideoRender(this.activeSpeakssrc);if(0!=this.videoRenderArray.length){for(let i=0;i<this.videoRenderArray.length;i++){const a=this.videoRenderArray[i];if(this.isLSSPlayer&&this.pauseSet.has(a.ssrc+" "+a.zone))return;const{display:n,canvas:o,enableMultiDecodeVideoWithoutSAB:s,ssrc:d,isMyself:l}=a;var r=null;if(a==e&&t)continue;let c=d;a!=e||t||(c=this.activeSpeakssrc);let u=[a];if(a==t&&e&&u.push(e),this.isActiveSsrcVideo(c)){let e=Date.now();if(this.jsMediaEngine){let e=this.jsMediaEngine.Get_Video_SSRC_Latest_Time();this.timestamp=e.currentSSRCTime,this.audioPlayTime=e.audioPlayTime}this.calPacingTime(e),e-this.timestart<this.pacingTime&&e-this.timestart>0||(r=this.Get_Decoded_Video_Frame(this.Get_Logical_SSrc(c)),this.timestart=e)}else r=this.Get_Decoded_Video_Frame(this.Get_Logical_SSrc(c));if(r){let e;this.isActiveSsrcVideo(c)&&(this.videoTimestamp=r.ntptime),e=r.yuvdata instanceof pe?r.yuvdata.yuvdata:r.yuvdata,this.croppingParams.top=r.r_y,this.croppingParams.left=r.r_x,this.croppingParams.height=r.r_h,this.croppingParams.width=r.r_w;const t=r.width>r.height&&(1===r.rotation||3===r.rotation)||r.width<r.height&&1!==r.rotation&&3!==r.rotation,i=t?r.height:r.width,a=t?r.width:r.height,{width:n,height:l}=o;if(this.currentVideoHeight==this.croppingParams.height&&this.currentVideoWidth==this.croppingParams.width||(this.Notify_APPUI?this.Notify_APPUI(3,{width:this.croppingParams.width,height:this.croppingParams.height}):postMessage({status:50,width:this.croppingParams.width,height:this.croppingParams.height}),this.currentVideoHeight=this.croppingParams.height,this.currentVideoWidth=this.croppingParams.width),e.length==r.width*r.height*3/2&&r.r_x>=0&&r.r_y>=0&&r.r_x+r.r_w<=r.width&&r.r_y+r.r_h<=r.height){8400==this.vMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("VDGLM"):postMessage({status:51,data:"VDGLW"}),this.vMonitorCount=0),this.vMonitorCount++;let t=this;u.forEach((o=>{o.display&&(t.Should_Update_Watermark(o.display,i,a,n,l)&&t.Update_Display_Watermark(o.display,i,a,n,l),s?o.display&&(o.display.setVideoMode(Ue),this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(d,r),o.display.updateRemoteVideoTextures(r.width,r.height,t.croppingParams,e,r.rotation,r.yuv_limited,o),o.firstFrame=!0):(o.display.setVideoMode(Ue),this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(d,r),o.display.drawNextOutputPictureFrame(r.width,r.height,t.croppingParams,e,r.rotation,r.yuv_limited,o)))}))}else this.Log_Error("Invalid YUV data: ".concat(r.r_x," ").concat(r.r_y," ").concat(r.r_w," ").concat(r.r_h," ").concat(r.width," ").concat(r.height));r.yuvdata instanceof pe&&r.yuvdata.recycle()}s&&u.forEach((e=>{if(s&&e.firstFrame){const{x:t,y:r,width:i,height:a}=e,n={x:t,y:r,width:i,height:a};if(l)e.display.drawSelfVideo(n);else{if(this.isLSSPlayer){this.firstFrameMap.get(e.ssrc)||(this.firstFrameMap.set(e.ssrc,!0),this.Notify_APPUI?this.Notify_APPUI(1190,{ssrc:e.ssrc,params:e.display.croppingParams}):postMessage({status:"FIRST_FRAME",ssrc:e.ssrc,params:e.display.croppingParams}));const t=this.ssrcCurrentRenderingMap.get(e.ssrc);e.display.drawRemoteVideo(n),t&&this.zoneLastRenderedMap.set(e.ssrc+" "+e.zone,t)}e.display.drawRemoteVideo(n)}}}))}this.renderManager.renderFor(1)}},wt.prototype.Get_Decoded_Video_Frame=function(e){if(this.videoQueue){var t=this.videoQueue.GetQueue(e);return t?t.dequeue():null}},wt.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())},wt.prototype.Get_Decoded_Video_Buffer_Length=function(e){return this.videoQueue?this.videoQueue.GetQueueLength(e):0},wt.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},wt.prototype.Change_Current_SSRC=function(e){this.currentactive=e,this.ClearQueue()},wt.prototype.Set_Render_Array_IntervalMode=function(e,t){if(this.videoRenderArray=e,this.isLSSPlayer&&this.ssrcDisplayMap.clear(),this.renderMode&&this.videoRenderArray.length>0)for(let e=0;e<this.videoRenderArray.length;e++){const a=this.videoRenderArray[e];var r;if(t){if(!a.display){if(a.enableMultiDecodeVideoWithoutSAB=t,a.display=this.Get_Display(a.canvas,a.canvas.id),a.display&&a.display.setFillMode(a.fillMode,a.fillModeForResolution),this.isLSSPlayer){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(a.ssrc));e||(e=[]),e.push(a),this.ssrcDisplayMap.set(this.Get_Logical_SSrc(a.ssrc),e)}var i;a.borderRadius&&(null===(i=a.display)||void 0===i||i.setRoundedCornerRadius(a.borderRadius))}}else this.renderManager.getRendererProvider().isWebGPURendererType()?a.display=this.Get_Display(a.canvas,a.rendercanvasID):a.display=this._Create_WebGL_Canvas({videoRenderArrayIndex:e,canvas:a.canvas,canvasId:a.rendercanvasID}),a.borderRadius&&(null===(r=a.display)||void 0===r||r.setRoundedCornerRadius(a.borderRadius)),this.webGLContextLostProtect(a.canvas,void 0,a.rendercanvasID)}},wt.prototype._Create_WebGL_Canvas=function(e){let{videoRenderArrayIndex:t,canvas:r,canvasId:i}=e;const a={forceNoGL:void 0,contextOptions:{webglcontextlostCallback:this.webglcontextlostCallback.bind(this),webglcontextrestoredCallback:this.webglcontextrestoredCallback.bind(this),params:{videoRenderArrayIndex:t,canvas:r,canvasId:i}},webGLResources:void 0,initMask:!1};return this.renderManager.createWebGLVideoRenderDisplay(r,i,0,a)},wt.prototype.webglcontextlostCallback=function(e,t){let{canvas:r,canvasId:i}=t;e.preventDefault()},wt.prototype.webglcontextrestoredCallback=function(e,t){var r,i;let{videoRenderArrayIndex:a,canvas:n,canvasId:o}=t;var s;(!this.videoRenderArray||a>=(null===(r=this.videoRenderArray)||void 0===r?void 0:r.length))&&this.Log_Error("videoRenderArray:".concat(this.videoRenderArray,", length:").concat(null===(s=this.videoRenderArray)||void 0===s?void 0:s.length)),this.renderMode&&a<(null===(i=this.videoRenderArray)||void 0===i?void 0:i.length)&&(this.videoRenderArray[a].display=this._Create_WebGL_Canvas({videoRenderArrayIndex:a,canvas:n,canvasId:o}),this.Set_Render_Array(this.videoRenderArray))},wt.prototype.ClearQueue=function(){try{let e=this.videoQueue.ssrcQueueMap;for(let[t,r]of e)for(;!r.isEmpty();){let e=r.dequeue();e.yuvdata&&e.yuvdata instanceof pe&&e.yuvdata.recycle()}}catch(e){this.Log_Error("Exception during VideoRender.ClearQueue",e)}this.videoQueue&&this.videoQueue.ClearQueue(),this.currentVideoHeight=0,this.currentVideoWidth=0},wt.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateVideoWaterMark:r,videoWaterMarkName:i,watermarkOpacity:a,watermarkRepeated:n,watermarkPosition:o}=e;this.waterMarkCanvas=t||this.videorendercanvas,this.isCreateVideoWaterMark=r,this.videoWaterMarkName=i,void 0!==n&&(this.isWaterMarkRepeatedEnable=!!n),void 0!==a&&(this.waterMarkOpacity=a),void 0!==o&&(this.watermarkPosition=o)},wt.prototype.Set_WaterMark_Flag=function(e){if(this.videoRenderArray.length>0)for(let t=0;t<this.videoRenderArray.length;t++){const{display:r}=this.videoRenderArray[t];r.setWatermarkFlag(e?1:0)}},wt.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};const St=function(e,t){if(e<640&&e){const r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};wt.prototype.Update_Display_Watermark=function(e,t,r,i,a){const n=this.Should_Watermark_Repeated(i,a);this.waterMarkCanvas||this.videorendercanvas||(this.videorendercanvas=this.isSupportOffscreenCanvas?new OffscreenCanvas(640,360):null);const o=i<512||a<288?16:this.watermarkPosition,s=this.waterMarkCanvas||this.videorendercanvas;if("function"==typeof OffscreenCanvas&&s instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const d=St(t,r);t=d.width,r=d.height;const l=n?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:s,name:this.videoWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:o}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:s,name:this.videoWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:o});e.updateWatermark(t,r,l)},wt.prototype.Should_Update_Watermark=function(e,t,r,i,a){if(!this.isCreateVideoWaterMark)return!1;let n=!1;const o=St(t,r);o.width===e.getWatermarkWidth()&&o.height===e.getWatermarkHeight()||(n=!0);const s=this.Should_Watermark_Repeated(i,a);e.isSetWatermark()||(n=!0),s!==e.isWatermarkRepeated()&&(n=!0,e.setWatermarkRepeated(s)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(n=!0,e.setWatermarkOpacity(this.waterMarkOpacity),this.waterMarkOpacity=e.getWatermarkOpacity());const d=t<512||r<288?16:this.watermarkPosition;return d!==e.getWatermarkPosition()&&(n=!0,e.setWatermarkPosition(d),this.watermarkPosition=e.getWatermarkPosition()),n},wt.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))},wt.prototype.Put_Video_Data_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;if(this.videoQueue){var r=this.videoQueue.GetQueue(e.ssrc);if(r||(r=this.videoQueue.AddQueue(e.ssrc)),r.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 i=e.ssrc>>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(i,e.ntptime)}for(var a=this.videoQueue.GetQueueLength(e.ssrc)-t;a>=0;){let t=this.Get_Decoded_Video_Frame(e.ssrc);t.yuvdata instanceof pe&&t.yuvdata.recycle(),a--}}else e.yuvdata&&e.yuvdata instanceof pe&&e.yuvdata.recycle()},wt.prototype.Clear_OffScreenCanvas=function(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},wt.prototype.Zoom_Render=function(e){},wt.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 Et="undefined"==typeof window;function Mt(e){let t=Date.now(),r=Rt;if(t-Tt<30&&t-Tt>0)r.Start_Request_Animation_Frame(e);else if(Tt=t,r.rendingFlag){try{r.startCaptureVideo&&r.localVideoPtr&&r.Draw_LocalVideo(),r.ssrcDisplayMap.forEach((function(e,i){if(i!=r.Get_Logical_SSrc(1)||!r.ssrcDisplayMap.has(r.Get_Logical_SSrc(r.activeSpeakssrc)))if(i==r.Get_Logical_SSrc(1)&&(i=r.activeSpeakssrc),r.isActiveSsrcVideo(i))if(r.calPacingTime(t),t-r.timestart<r.pacingTime);else{r.timestart=t;let e=r.Get_Decoded_Video_Frame(r.Get_Logical_SSrc(i));e&&(r.Update_RemoteVideo_Texture(e),r.videoTimestamp=e.ntptime)}else{let e=r.Get_Decoded_Video_Frame(r.Get_Logical_SSrc(i));e&&r.Update_RemoteVideo_Texture(e)}})),r._render()}catch(e){r.Log_Error("Exception while rendering video",e)}r.Start_Request_Animation_Frame(e)}else r.rAFID&&r.Stop_Request_Animation_Frame()}var Rt;wt.prototype.Check_Request_Animation=function(){Et&&this.rendingFlag&&this.prevRequestAnimationTimestap&&performance.now()-this.prevRequestAnimationTimestap>2e3&&!this.rAFIDBack&&(postMessage({status:s,data:"WCL_M,RCIF"}),this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0),this.rAFIDBack=setInterval(Mt.bind(null,!0),30))},wt.prototype.Start_Request_Animation_Frame=function(e,t){if(!e&&this.rAFIDBack&&this.Stop_Request_Animation_Frame_Backup(),!this.rAFIDBack)return t||(this.retryRequestAnimationStep=2),this.prevRequestAnimationTimestap=performance.now(),this.rAFID=requestAnimationFrame(Mt),this.rAFID},wt.prototype.Stop_Request_Animation_Frame_Backup=function(){this.rAFIDBack&&(clearInterval(this.rAFIDBack),this.rAFIDBack=null)},wt.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()},wt.prototype.Add_Pause=function(e){this.pauseSet.add(e.ssrc+" "+e.zone)},wt.prototype.Remove_Pause=function(e){const t=e.ssrc+" "+e.zone;this.pauseSet.has(t)&&this.pauseSet.delete(t)},wt.prototype.Zoom_Render_Paused=function(e){if(this.pauseSet.has(e.ssrc+" "+e.zone)&&this.zoneLastRenderedMap.get(e.ssrc+" "+e.zone)){let t=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(e.ssrc));t[0].x=e.x,t[0].y=e.y,t[0].width=e.width,t[0].height=e.height}this.Draw_Last_Frame()},wt.prototype.Draw_Last_Frame=function(){for(const e of this.pauseSet.values()){const[t]=e.split(" "),r=this.zoneLastRenderedMap.get(e);if(r){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(t));const i=e&&e[0]&&e[0].display||null;if(i){const t=e[0];i.setVideoMode(Ue),this.Should_Update_Watermark(i,t.width,t.height,t.width,t.height)&&this.Update_Display_Watermark(i,t.width,t.height,t.width,t.height),i.updateRemoteVideoTextures(r.width,r.height,{top:r.r_y,left:r.r_x,height:r.r_h,width:r.r_w},r.yuvdata,r.rotation,r.yuv_limited,t),i.drawRemoteVideo({x:e[0].x,y:e[0].y,width:e[0].width,height:e[0].height})}}}},wt.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):ie(e,t)},wt.prototype._render=function(){let e=this;e.ssrcDisplayMap.forEach((function(t,r){const i=e.isSelfVideo(r);t.forEach((t=>{var r;let a=t.display;if(a&&(null!==(r=a.isAvaiable)&&void 0!==r&&r.call(a)||setTimeout((()=>{var e;null===(e=a.restoreContext)||void 0===e||e.call(a)}),5),t.haddata&&a.getVideoMode()!=We))if(e.coordinate.x=t.x,e.coordinate.y=t.y,e.coordinate.width=t.width,e.coordinate.height=t.height,i&&-1!==[Be,Ne].indexOf(a.getVideoMode()))a.drawSelfVideo(e.coordinate,!1,e.ismirror);else if(i)a.drawRemoteVideo(e.coordinate,e.ismirror);else{if(e.isLSSPlayer){e.firstFrameMap.get(t.ssrc)||(e.firstFrameMap.set(t.ssrc,!0),e.Notify_APPUI?e.Notify_APPUI(1190,{ssrc:t.ssrc,params:t.display.croppingParams}):postMessage({status:"FIRST_FRAME",ssrc:t.ssrc,params:t.display.croppingParams}));const r=e.ssrcCurrentRenderingMap.get(t.ssrc);r&&e.zoneLastRenderedMap.set(t.ssrc+" "+t.zone,r)}a.drawRemoteVideo(e.coordinate)}}))})),e.renderManager.renderFor(1)},wt.prototype._singleRender=function(){let e=this;this.videoRenderArray.forEach((t=>{const{x:r,y:i,width:a,ssrc:n,height:o,enableMultiDecodeVideoWithoutSAB:s}=t,d=t.display,l=e.isSelfVideo(n),c={x:r,y:i,width:a,height:o};s?l?d.drawSelfVideo(c):d.drawRemoteVideo(c):d.drawNextOutputPictureFrame(d.getTextureWidth(),d.getTextureHeight(),d.getCroppingParams(),null,d.getRotation(),void 0,c,!1)}))},wt.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,r=this.videoTimestamp+this.pacingTime-t,i=this.currentactive?this.currentactive:this.audioPlaySsrc,a=this.videoQueue.GetQueueLength(this.Get_Logical_SSrc(i));r>65&&r<1e4&&a>=1&&(this.pacingTime=1.5*this.pacingTime),r<-65&&(this.pacingTime=1*this.pacingTime/2)}else this.timestamp||(this.pacingTime>150?this.pacingTime=1*this.pacingTime/2:this.pacingTime=this.pacingTime-10)},wt.prototype.getRenderManager=function(){return this.renderManager},wt.prototype.cleanup=function(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.renderManager.cleanup(e,t,r)},wt.prototype.setActiveSpeakerSsrc=function(e){this.activeSpeakssrc=e},wt.prototype.getActiveSpeakerSsrc=function(e){return this.activeSpeakssrc},wt.prototype.isActiveSeakerSsrc=function(e){return this.activeSpeakssrc&&this.activeSpeakssrc>>10==e>>10},wt.prototype.isActiveSsrcVideo=function(e){let t=e>>10;return t==this.currentactive>>10||t==this.audioPlaySsrc>>10},wt.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)},wt.prototype.isSelfVideo=function(e){return!!this.selfvideossrc&&(this.Get_Logical_SSrc(e)==this.Get_Logical_SSrc(this.selfvideossrc)||this.isActiveSeakerSsrc(this.selfvideossrc)&&!(e>>10))},wt.prototype.reDraw=function(){this.renderMode?this._singleRender():this._render()},wt.prototype.getUserIdVideo=function(e){let t=null,r=1==e||this.isActiveSeakerSsrc(e);for(let i=0;i<this.videoRenderArray.length;i++){const a=this.videoRenderArray[i];if(a.ssrc>>10==e>>10||r&&1==a.ssrc){const{width:e,height:r}=a;(!t||e*r>t.width*t.height)&&(t=a)}}if(!t||!t.display)return null;const i=t.canvas,a=t.rendercanvasID;let n=t.display.getTextureWidth(),o=t.display.getTextureHeight(),s=t.display.getRotation(),d=t.display.getViewPosition();if(1==s||3==s){let e=n;n=o,o=e}const{x:l,y:c,width:u,height:h}=t;let _=u,f=h,p=Math.floor(u*d[1]),m=Math.floor(h*d[0]);_=u-2*p,f=h-2*m;let g=i.height-h-c+m,v=l+p;return o=Math.floor(Math.min(f,o)),n=Math.floor(o*_/f),{canvasId:a,canvas:i,options:{x:v,y:g,width:_,height:f,displayWidth:n,displayHeight:o}}};var Tt=0;const xt=wt,At={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5",WORKER_SERVICE:"6",COMMON:"7",NET:"net",MESH:"mesh"};(()=>{const e={};for(const t in At)e[At[t]]="WCL_"+t})(),At.AUDIO_ENCODE,At.AUDIO_DECODE,At.VIDEO_ENCODE,At.VIDEO_DECODE,At.SHARING_ENCODE,At.SHARING_DECODE,At.NET,At.MESH;class Ct{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],a=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=a,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,a,1),this.read_ptr=new Uint32Array(this.buf,a+4,1),this.storageUint8sByteOffset=a+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,n-8),this.byteLength=n,this.label=r,this.usingOneElementBuffer=i,o&&(this.wasmMemory=o),i&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(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 ot);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&&(Q.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),r&&r("vqslclear")),i>0&&r){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,r&&r("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 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,a,n=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=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,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+n[0]),i=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,a=t*this._BYTES_PER_ELEMENT+8+4+n[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:i,end:a}}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 kt{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,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof Ct))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=a}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))}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_count<e;){this.consoume_count++;let e=this.rb.dequeue(this.bCopyData);this.dataCallback(e),this.bCopyData||this.rb.addReadPtr()}}_consumeForAnimationFrame(){this._dequeue(),this.requestID=requestAnimationFrame(this._consumeForAnimationFrame.bind(this))}consumeUsingRequestAnimationFrame(){let e=!(arguments.length>0&&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 Ft{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,a=Number(t.getBigUint64(8,!0)),n=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,a);return this.bCopyData,i=n,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 Pt(e){return e[0]<<24|e[1]<<16|e[2]<<8|e[3]}const It=function(e){return 21==e[4]&&0==e[13]},Lt=function(e){return 104==e[0]||16!=e[4]&&1!=e[5]?Pt(e.slice(19,23)):Pt(e.slice(15,19))},Dt=function(e){return 103==e[0]};class Ot{constructor(e){let t=e||{};this.last_report_time=0,this.timeout_count=0,this.interval_report_time=t.interval||3e3,this.tag=t.tag||"monitor",this.max_timeout=0,this.min_timeout=2147483647,this.reportcallback=t.reportcallback,this._timeoutid=0}_report(){this.reportcallback&&this.reportcallback(this.tag,Math.ceil(this.max_timeout),Math.ceil(this.min_timeout),this.timeout_count),this.timeout_count=0,this.max_timeout=0,this.min_timeout=2147483647}timeoutReport(e,t){if(this.timeout_count++,e>this.max_timeout&&(this.max_timeout=e),e<this.min_timeout&&(this.min_timeout=e),this._timeoutid)return;let r=this;this._timeoutid=setTimeout((()=>{r._report(),r._timeoutid=0}),this.interval_report_time)}}var Wt=function(e){let t=e||{};this._report_interval=t.interval||3e4,this._customer_callback=t.report_call,this._group_interval=t.group_interval||1e3,this._tag=t.tag||"WCL_M,V",this.last_capture_time=0,this._init_report_interval=t._report_interval<1e4?t._report_interval:1e4,this.threshold=200,this._enabled=!1,this.capture_fps=0,this.capture_fps_history=[],this.capture_total_fps=0,this.capture_timeout_report=new Ot({interval:this._report_interval,tag:this._tag+"CAPTUREDEL",reportcallback:this._capture_timeout_report.bind(this)}),this.close_frames=0,this.close_frames_history=[],this.close_total_frames=0,this.capture_ticket_count=0,this.ref_counts=0,this.unref_counts=0,this._interval_id=0,this._timeout_id=0,this._last_update_time=0};Wt.prototype._capture_timeout_report=function(e,t,r,i){if(this._customer_callback){let a="".concat(t,",").concat(r,",").concat(i);this._customer_callback(e,a)}},Wt.prototype._report=function(){if(!this._customer_callback)return;let e=(new Date).getTime(),t="".concat(this.capture_fps_history.length,"-").concat(this.capture_fps_history.join("|")),r="".concat(this.close_frames_history.length,"-").concat(this.close_frames_history.join("|")),i="".concat(e,"-").concat(this.capture_ticket_count,"-").concat(this.capture_total_fps,"-").concat(this.ref_counts,"-").concat(t),a="".concat(e,"-").concat(this.close_total_frames,"-").concat(this.unref_counts,"-").concat(r);this._customer_callback(this._tag+"CAPTURE",i),this._customer_callback(this._tag+"FCLOSE",a)},Wt.prototype._timeout_report=function(){this._timeout_id=0,this._report()},Wt.prototype._group=function(){this.capture_fps_history.push(this.capture_fps),this.close_frames_history.push(this.close_frames),this.capture_fps=0,this.close_frames=0;let e=performance.now();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_interval<this._report_interval&&(this._init_report_interval+=5e3,this._init_report_interval>this._report_interval&&(this._init_report_interval=this._report_interval)))},Wt.prototype.closeSample=function(){this.close_frames++,this.close_total_frames++},Wt.prototype.setCloseTotalFrames=function(e){this.close_total_frames=e},Wt.prototype.captureTicket=function(){this._enabled&&this.capture_ticket_count++},Wt.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},Wt.prototype.ref=function(){this.ref_counts++},Wt.prototype.unref=function(){this.unref_counts++},Wt.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)},Wt.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)))};const Bt=e=>btoa(String.fromCharCode(...new Uint8Array(e)));class Ut{constructor(e){tt(this,"process",(async()=>{if(this.processList.length){const e=this.processList.splice(0,30),t=await this.encryptData(this.mergeBuffer(e));this.writeLog(Bt(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(Bt(t.buffer)),this.writeLog(this.EOL);const r=[e,this.iv];this.writeLog("h"),this.writeLog(this.EOL),this.writeLog(Bt(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){return await this.initEncryptPromise,await crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}startProcess(){requestAnimationFrame(this.process)}}class Nt{constructor(e){this.port=null,this.cache=[],this.stopCache=!1,e&&(this.logProcesser=new Ut(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),a=oe().subarray(e+0,e+t);return i.set(a,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 Vt extends Nt{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)}}let Gt;const jt=()=>Gt,Ht=function(e,t=""){if(e)return;const r=new Error(t);jt().tracing.Log_Error(`Assert: ${t}`,r)},$t=function(e){const t=new Error(e);jt().tracing.Log_Error(`AssertWithFailed: ${e}`,t)};function zt(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function qt(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}const Yt={NO_CONFIG:0,FALLBACK_TO_TAG_RENDERER_ON_CHROME:1,FALLBACK_TO_TAG_RENDERER_ON_SAFARI:2,FALLBACK_TO_TAG_RENDERER_ON_FIREFOX:4,LOWER_PERFORMANCE_DEVICE:8},Xt={NO_CONFIG:0,TAG_RENDERER_ON_CHROME:1,TAG_RENDERER_ON_SAFARI:2,TAG_RENDERER_ON_FIREFOX:4},Kt=new class{constructor(){tt(this,"_platformDesc",{supportGraphicsAcceleration:!1,supportVideoFrame:!1,supportMediaStreamTrackGenerator:!1,supportTransferableStream:!1,supportDrawWatermark:!1,supportVideoFrameInWorker:!1,supportVideoTrackGeneratorInWorker:!1,supportOffscreenCanvasInWorker:!1,supportImageBitmapRenderingInWorker:!1,supportTransferableTrackAcrossWork:!1,supportsRequestAnimationFrameInWork:!1}),tt(this,"_inferedDesc",{supportVideoTagRenderer:!1}),tt(this,"_analyzing_promise",null),tt(this,"_main_analyzed",!1),tt(this,"_remote_analyzed",!1),tt(this,"_analyzedPromise",void 0),tt(this,"_resolveAnalyzedPromise",void 0),this._analyzedPromise=new Promise(((e,t)=>{this._resolveAnalyzedPromise=e}))}init(e){this._platformDesc=e.platform,this._inferedDesc=e.infered,this._main_analyzed=!0,this._remote_analyzed=!0,this._resolveAnalyzedPromise(this._remote_analyzed)}desc(){return{platform:this._platformDesc,infered:this._inferedDesc}}analyzed(){return this._remote_analyzed}analyzedPromise(){return this._analyzedPromise}_analyzeInferredCapabilites(){this._inferedDesc.supportVideoTagRenderer=this._platformDesc.supportVideoFrame&&this._platformDesc.supportVideoFrameInWorker&&(!0===this._platformDesc.supportMediaStreamTrackGenerator&&!0===this._platformDesc.supportTransferableStream||!0===this._platformDesc.supportVideoTrackGeneratorInWorker)}analyze(e){if(this._analyzing_promise)return this._analyzing_promise;const t=e.analyzeMainCapabilites();return Object.assign(this._platformDesc,t),this._main_analyzed=!0,this._analyzing_promise=new Promise(((t,r)=>{e.analyzeRemoteCapabilities().then((e=>{Object.assign(this._platformDesc,e),this._analyzeInferredCapabilites(),this._remote_analyzed=!0,this._resolveAnalyzedPromise(this._remote_analyzed),t(!0)})).catch((e=>{this._resolveAnalyzedPromise(this._remote_analyzed),t(!1)}))})),this._analyzing_promise}supportGraphicsAcceleration(){return Ht(this._main_analyzed),this._platformDesc.supportGraphicsAcceleration}supportTransferableStream(){return Ht(this._main_analyzed),this._platformDesc.supportTransferableStream}supportDrawWatermark(){return Ht(this._main_analyzed),this._platformDesc.supportDrawWatermark}supportVideoTagRenderer(){return!!this._remote_analyzed&&this._inferedDesc.supportVideoTagRenderer}supportMediaStreamTrackGenerator(){return Ht(this._main_analyzed),this._platformDesc.supportMediaStreamTrackGenerator}supportVideoTrackGeneratorInWorker(){return!!this._remote_analyzed&&this._platformDesc.supportVideoTrackGeneratorInWorker}supportTransferableTrackAcrossWork(){return!!this._remote_analyzed&&this._platformDesc.supportTransferableTrackAcrossWork}supportsRequestAnimationFrameInWork(){return!!this._remote_analyzed&&this._platformDesc.supportsRequestAnimationFrameInWork}supportMediaStreamTrackProcessor(){return!!this._remote_analyzed&&this._platformDesc.supportMediaStreamTrackProcessor}};var Qt=r(1265),Jt=r.n(Qt);const Zt=new class{constructor(){tt(this,"_info",void 0),this._info={browser:{brand:"",version:"",isBlink:!1,isWebkit:!1},sysinfo:{osType:"",os:"",osVersion:""},gpuinfo:{vendor:"",renderInfo:"",isAstcSupported:!1,isWebGLContextInvalid:!1},browserVersionInfo:{ie:"",edge:"",firefox:"",opera:"",chrome:"",safari:""},isLowerPerformanceDevice:!1,isSwiftShader:!1,isMacIntelSafari:!1},this._derived={gpuArchitecture:"unknown",normalizedOS:"",normalizedBrowser:""},this._updateDerivedInfo()}init(e){this._info=e,this._updateDerivedInfo()}info(){return this._info}browserInfo(){return this._info.browser}browserVersionInfo(){return this._info.browserVersionInfo}browserName(){var e;return null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase()}isChrome(){var e;return"chrome"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isSafari(){var e;return"safari"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isFirefox(){var e;return"firefox"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isEdge(){var e;return"edge"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isBlink(){return this._info.browser.isBlink}isWebkit(){return this._info.browser.isWebkit}isLowerPerformanceDevice(){return!!this._info.isLowerPerformanceDevice}_updateDerivedInfo(){this._derived.normalizedOS=this._computeNormalizedOS(),this._derived.normalizedBrowser=this._computeNormalizedBrowser(),this._derived.gpuArchitecture=this._computeGPUArchitecture()}_computeGPUArchitecture(){var e,t;const r=(null===(e=this._info.gpuinfo)||void 0===e?void 0:e.vendor)||"",i=(null===(t=this._info.gpuinfo)||void 0===t?void 0:t.renderInfo)||"",a=r.toLowerCase(),n=i.toLowerCase(),o=e=>a.includes(e)||n.includes(e);if(this.isSafari())return this._info.isMacIntelSafari?"intel":"apple";if(o("intel"))return"intel";if(o("nvidia")||o("geforce"))return"nvidia";if(o("amd")||o("radeon")||o("ati"))return"amd";if(o("apple")||o("m1")||o("m2")||o("m3"))return"apple";if(o("qualcomm")||o("adreno"))return"qualcomm";if(o("mediatek")||o("mtk"))return"mediatek";if(o("mali"))return"mali";if(o("arm"))return"arm";if(a){var s;const e=Jt()(s=a.replace(/[^a-z0-9]+/g," ")).call(s).split(" ")[0];if(e)return e.toLowerCase()}return"unknown"}_computeNormalizedOS(){var e;const t=(null===(e=this._info.sysinfo)||void 0===e||null===(e=e.os)||void 0===e?void 0:e.toLowerCase())||"";return"ios"===t?"ios":t.includes("android")?"android":t.includes("chrome os")||t.includes("chromium os")?"chromeos":t.includes("mac")?"mac":t.includes("win")?"win":t.includes("linux")?"linux":t}_computeNormalizedBrowser(){var e,t;return(null===(e=this._info.browser)||void 0===e||null===(e=e.brand)||void 0===e||null===(t=e.toLocaleLowerCase)||void 0===t?void 0:t.call(e))||""}isOnWhitelist(e){if(!Array.isArray(e)||0===e.length)return!1;const t=this._derived.gpuArchitecture,r=this._derived.normalizedOS,i=this._derived.normalizedBrowser,a=!!this._info.isLowerPerformanceDevice,n=!!this._info.isSwiftShader;return e.some((e=>{var o;if("string"!=typeof e)return!1;const s=Jt()(e).call(e).toLowerCase();if("low-device"===s)return a;if("swift-shader"===s)return n;const[d,l,c]=s.split("/");if(!d||!l)return!1;const u=Jt()(d).call(d),h=Jt()(l).call(l),_=Jt()(o=c||"").call(o);return!(u&&u!==t||h&&!r.includes(h)&&!h.includes(r)||_&&_!==i)}))}},er=new class{constructor(){tt(this,"_desc",{blockConfig:void 0,defaultRendererType:1,isEnableCanvasCtxOptionsOpt:!1,isEnableFallbackToTagRender:!1,isEnableWasmTagRenderer:!1,safariYuvPaddingFixVer:void 0,chromeYuvLeftTopPaddingFixVer:void 0,disableVideoTagOnEdge:void 0,preferredUseSsrcStream:void 0,canUseSsrcStream:void 0,isUseSsrcStream:!1,shouldCropWasmFrameOnPosMismatch:void 0,shouldCropWasmFrameOnSizeMismatchOnly:void 0,avStreamMode:void 0,baseScriptUrl:"",cssPixelScale:1,isVideoHasWaterMark:!1,isSharingHasWaterMark:!1,videoWatermarkInfo:void 0,sharingWatermarkInfo:void 0}),tt(this,"_configDone",!1),tt(this,"_configDonePromise",void 0),tt(this,"_resolveConfigDonePromise",void 0),this._configDonePromise=new Promise(((e,t)=>{this._resolveConfigDonePromise=e}))}_tryResetDerivedConfigIfNeeded(){this._configDone&&(this._desc.canUseSsrcStream=void 0,this._desc.shouldCropWasmFrameOnPosMismatch=void 0,this._desc.shouldCropWasmFrameOnSizeMismatchOnly=void 0)}init(e){this._desc=e,this._configDone=!0}setBlockConfig(e){if(!e)return;this._desc.blockConfig=e;const t=e.safariYuvPaddingFixVer;t&&this.setSafariYuvPaddingFixVer(t);const r=e.chromeYuvLeftTopPaddingFixVer;r&&this.setChromeYuvLeftTopPaddingFixVer(r);const i=e.disableVideoTagOnEdge;"true"===i&&this.setDisableVideoTagOnEdge(i)}configDone(){return this._configDone}configDonePromise(){return this._configDonePromise}markConfigDone(){this._configDone=!0,this._resolveConfigDonePromise(!0)}desc(){return this._desc}preferredUseSsrcStream(){var e;return void 0!==this._desc.preferredUseSsrcStream?!!this._desc.preferredUseSsrcStream:this.canUseSsrcStream()?(this._desc.preferredUseSsrcStream=Zt.isOnWhitelist((null===(e=this._desc.blockConfig)||void 0===e?void 0:e.SsrcStreamPreferredWhitelist)||[]),this._desc.preferredUseSsrcStream):(this._desc.preferredUseSsrcStream=!1,!1)}defaultRendererType(){return this._desc.defaultRendererType}setDefaultRendererType(e){this._desc.defaultRendererType=e,this._tryResetDerivedConfigIfNeeded()}isEnableCanvasCtxOptionsOpt(){return this._desc.isEnableCanvasCtxOptionsOpt}setIsEnableCanvasCtxOptionsOpt(e){this._desc.isEnableCanvasCtxOptionsOpt=e,this._tryResetDerivedConfigIfNeeded()}isEnableWasmTagRenderer(){return this._desc.isEnableWasmTagRenderer}setWasmTagRendererFlags(e){let t=!1;Zt.isBlink()?(t=!!(e&Xt.TAG_RENDERER_ON_CHROME),Zt.isEdge()&&this._desc.disableVideoTagOnEdge&&(t=!1)):Zt.isWebkit()?t=!!(e&Xt.TAG_RENDERER_ON_SAFARI):Zt.isFirefox()&&(t=!!(e&Xt.TAG_RENDERER_ON_FIREFOX)),this._desc.isEnableWasmTagRenderer=t,this._tryResetDerivedConfigIfNeeded()}isEnableFallbackToTagRender(){return this._desc.isEnableFallbackToTagRender}setFallbackToTagRenderFlags(e){let t=!1;Zt.isBlink()?t=!!(e&Yt.FALLBACK_TO_TAG_RENDERER_ON_CHROME):Zt.isWebkit()?t=!!(e&Yt.FALLBACK_TO_TAG_RENDERER_ON_SAFARI):Zt.isFirefox()&&(t=!!(e&Yt.FALLBACK_TO_TAG_RENDERER_ON_FIREFOX)),t||Zt.isLowerPerformanceDevice()&&(t=!!(e&Yt.LOWER_PERFORMANCE_DEVICE)),this._desc.isEnableFallbackToTagRender=t,this._tryResetDerivedConfigIfNeeded()}canUseSsrcStream(){return!!this._configDone&&(void 0!==this._desc.canUseSsrcStream?this._desc.canUseSsrcStream:Kt.supportVideoTagRenderer()?Kt.supportGraphicsAcceleration()&&!Zt.isLowerPerformanceDevice()||!this.isEnableFallbackToTagRender()?this.isEnableWasmTagRenderer()?(this._desc.canUseSsrcStream=!0,this._desc.canUseSsrcStream):(this._desc.canUseSsrcStream=!1,!1):(this._desc.canUseSsrcStream=!0,this._desc.canUseSsrcStream):(this._desc.canUseSsrcStream=!1,!1))}isUseSsrcStream(){return this._desc.isUseSsrcStream}setIsUseSsrcStream(e){this._desc.isUseSsrcStream=e}setSafariYuvPaddingFixVer(e){"[object String]"===Object.prototype.toString.call(e)&&(this._desc.safariYuvPaddingFixVer=e)}setChromeYuvLeftTopPaddingFixVer(e){"[object String]"===Object.prototype.toString.call(e)&&(this._desc.chromeYuvLeftTopPaddingFixVer=e)}setDisableVideoTagOnEdge(e){this._desc.disableVideoTagOnEdge=e}_versionGreaterThan(e,t){const r=t.toString().split("."),i=e.toString().split("."),a=r.length,n=i.length,o=Math.min(a,n);for(let e=0;e<o;e++){const t=parseInt(r[e],10),a=parseInt(i[e],10);if(t!==a)return a>t}return n>=a}_logWasmFrameOnPosMismatch(e){jt().tracing.Log_DT("[vtagq] WasmFrameOnPosMismatch: ".concat(e?"Crop":"No Crop"))}shouldCropWasmFrameOnPosMismatch(){return!!this._configDone&&(void 0!==this._desc.shouldCropWasmFrameOnPosMismatch?this._desc.shouldCropWasmFrameOnPosMismatch:this.isUseSsrcStream()?(this._desc.shouldCropWasmFrameOnPosMismatch=!0,Zt.isChrome()?this._desc.chromeYuvLeftTopPaddingFixVer&&this._versionGreaterThan(Zt.browserVersionInfo().chrome,this._desc.chromeYuvLeftTopPaddingFixVer)&&(this._desc.shouldCropWasmFrameOnPosMismatch=!1):Zt.isSafari()&&this._desc.safariYuvPaddingFixVer&&this._versionGreaterThan(Zt.browserVersionInfo().safari,this._desc.safariYuvPaddingFixVer)&&(this._desc.shouldCropWasmFrameOnPosMismatch=!1),this._logWasmFrameOnPosMismatch(this._desc.shouldCropWasmFrameOnPosMismatch),this._desc.shouldCropWasmFrameOnPosMismatch):(this._desc.shouldCropWasmFrameOnPosMismatch=!1,this._logWasmFrameOnPosMismatch(!1),!1))}_logWasmFrameOnSizeMismatch(e){jt().tracing.Log_DT("[vtagq] WasmFrameOnSizeMismatch: ".concat(e?"Crop":"No Crop"))}shouldCropWasmFrameOnSizeMismatchOnly(){return!!this._configDone&&(void 0!==this._desc.shouldCropWasmFrameOnSizeMismatchOnly?this._desc.shouldCropWasmFrameOnSizeMismatchOnly:this.isUseSsrcStream()&&Zt.isWebkit()?(Zt.isSafari()&&this._desc.safariYuvPaddingFixVer&&this._versionGreaterThan(Zt.browserVersionInfo().safari,this._desc.safariYuvPaddingFixVer)?this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!1:this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!0,this._logWasmFrameOnSizeMismatch(this._desc.shouldCropWasmFrameOnSizeMismatchOnly),this._desc.shouldCropWasmFrameOnSizeMismatchOnly):(this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!1,this._logWasmFrameOnSizeMismatch(!1),!1))}shouldCropWasmFrame(e,t,r){return!!this._configDone&&(e!=r.width||t!=r.height)&&(er.shouldCropWasmFrameOnSizeMismatchOnly()||er.shouldCropWasmFrameOnPosMismatch()&&(0!=r.x||0!=r.y))}getAVStreamMode(){return this._configDone?(void 0!==this._desc.avStreamMode||(Kt.supportTransferableStream()?this._desc.avStreamMode="writable-stream":Kt.supportTransferableTrackAcrossWork()?this._desc.avStreamMode="track":this._desc.avStreamMode="none"),this._desc.avStreamMode):"none"}getBaseScriptUrl(){return this._desc.baseScriptUrl}setBaseScriptUrl(e){this._desc.baseScriptUrl=e}getCssPixelScale(){return this._desc.cssPixelScale}setCssPixelScale(e){this._desc.cssPixelScale=e}isVideoHasWaterMark(){return this._desc.isVideoHasWaterMark}setIsVideoHasWaterMark(e){this._desc.isVideoHasWaterMark=e,this._tryResetDerivedConfigIfNeeded()}isSharingHasWaterMark(){return this._desc.isSharingHasWaterMark}setIsSharingHasWaterMark(e){this._desc.isSharingHasWaterMark=e,this._tryResetDerivedConfigIfNeeded()}getVideoWatermarkInfo(){return this._desc.videoWatermarkInfo}setVideoWatermarkInfo(e){this._desc.videoWatermarkInfo=e}getSharingWatermarkInfo(){return this._desc.sharingWatermarkInfo}setSharingWatermarkInfo(e){this._desc.sharingWatermarkInfo=e}},tr={mgr:null,config:er,capabilities:Kt,userAgent:Zt,tracing:{add_monitor(e){te(e)},globaltracing_error(e,t=null){ie(e,t)},Log_Error(e,t=null){re(e,t)},Log_DT(e){var t;t=e,ee?Q.directReport(t):ae(t)}},graphics:{create_webgl_context_failed_monitor(e){ne(e)},calculateUVCoord:(e,t,r,i)=>function(e,t,r,i){if(!e||!t||!r)return null;const a=t.width/t.height;let n=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,a=Math.min(r,i);n*=a,o*=a}let s=0,d=0;e.width/e.height>a?(d=Math.floor(e.height/o)*o,s=Math.floor(d*a/n)*n,s>e.width&&(s=Math.floor(e.width/n)*n,d=Math.floor(s/a/o)*o)):(s=Math.floor(e.width/n)*n,d=Math.floor(s/a/o)*o,d>e.height&&(d=Math.floor(e.height/o)*o,s=Math.floor(d*a/n)*n));let l=0,c=0,u=0,h=0,_={x:c,y:l,w:u,h};0==i?(l=1-(l+(o-1)/e.height),c=t.left/e.width,h=1-t.top/e.height,u=c+n/e.width,_.x=c,_.y=1-h,_.w=u,_.h=1-l):1==i?(c=1-(l+(o-1)/e.height),u=1-t.top/e.height,l=t.left/e.width,h=c+n/e.width):2==i?(l=t.top/e.height,c=t.left/e.width,h=l+(o-1)/e.height,u=c+n/e.width):3==i&&(c=t.top/e.height,u=l+(o-1)/e.height,l=t.left/e.width,h=c+n/e.width);let f=[],p=[{x:u,y:h},{x:u,y:l},{x:c,y:l},{x:u,y:h},{x:c,y:h},{x:c,y:l}];for(let e=0;e<p.length;++e){let t={u:p[e].x,v:p[e].y};f.push(t)}let m=[];for(let e=0;e<f.length;++e){let t=f[e];m.push(t.u),m.push(t.v)}return{uvCoords:m,uvRect:_}}(e,t,r,i),calculateUVCoordsForMultiView:(e,t,r,i,a,n)=>function(e,t,r,i,a,n){let o=0,s=0,d=0,l=0,c={x:s,y:o,w:d,h:l};if(e){const e=1==a||3==a?t.height/t.width:t.width/t.height,n=i.left||0,c=i.top||0;if(i.width/i.height>e){const t=i.height*e;o=c/r.height,s=(Math.round((i.width-t)/2)+n)/r.width,l=o+(i.height-1)/r.height,d=s+t/r.width}else{const t=i.width/e;o=(Math.round((i.height-t)/2)+c)/r.height,s=n/r.width,l=o+(t-1)/r.height,d=s+i.width/r.width}0==a?(o=1-(o+(i.height-1)/r.height),s=i.left/r.width,l=1-i.top/r.height,d=s+i.width/r.width):1==a?(s=1-(o+(i.height-1)/r.height),d=1-i.top/r.height,o=i.left/r.width,l=s+i.width/r.width):2==a?(o=i.top/r.height,s=i.left/r.width,l=o+(i.height-1)/r.height,d=s+i.width/r.width):3==a&&(s=i.top/r.height,d=o+(i.height-1)/r.height,o=i.left/r.width,l=s+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,n=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,a=r.height/i.height,o=Math.min(e,a);t*=o,n*=o}let u=0,h=0;r.width/r.height>e?(h=Math.floor(r.height/n)*n,u=Math.floor(h*e/t)*t,u>r.width&&(u=Math.floor(r.width/t)*t,h=Math.floor(u/e/n)*n)):(u=Math.floor(r.width/t)*t,h=Math.floor(u/e/n)*n,h>r.height&&(h=Math.floor(r.height/n)*n,u=Math.floor(h*e/t)*t)),0==a?(o=1-(o+(n-1)/r.height),s=i.left/r.width,l=1-i.top/r.height,d=s+t/r.width,c.x=s,c.y=1-l,c.w=d,c.h=1-o,i.height>i.width&&(s=qt(s,2),d=zt(d,2))):1==a?(s=1-(o+(n-1)/r.height),d=1-i.top/r.height,o=i.left/r.width,l=s+t/r.width):2==a?(o=i.top/r.height,s=i.left/r.width,l=o+(n-1)/r.height,d=s+t/r.width):3==a&&(s=i.top/r.height,d=o+(n-1)/r.height,o=i.left/r.width,l=s+t/r.width)}let u=[],h=[{x:d,y:l},{x:d,y:o},{x:s,y:o},{x:d,y:l},{x:s,y:l},{x:s,y:o}];for(let e=0;e<h.length;++e){let t=null;if(n){let r=-1*Math.abs(h[e].x);h[e].x=r,t={u:h[e].x+1,v:h[e].y}}else t={u:h[e].x,v:h[e].y};u.push(t)}let _=[];for(let e=0;e<u.length;++e){let t=u[e];_.push(t.u),_.push(t.v)}return{uvCoords:_,uvRect:c}}(e,t,r,i,a,n),calculateRenderRect:(e,t)=>function(e,t){let r=0,i=0,a=0,n=0;const o=t.width/t.height;return e.width/e.height>o?(i=e.height,r=i*o,a=(e.width-r)/2,n=0):(r=e.width,i=r/o,a=0,n=(e.height-i)/2),r<=e.canvas.width&&(a=(e.canvas.width-r)/2),i<=e.canvas.height&&(n=(e.canvas.height-i)/2),{x:a,y:n,width:r,height:i}}(e,t),evalCroppingRect:(e,t)=>function(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return 1===t||3===t?{top:e.top,left:e.left,width:e.height,height:e.width}:e}(e,t)},assertion:{assert(e,t=""){Ht(e,t)},assertWithFailed(e){$t(e)},abstractMethod(){!function(){const e=new Error("call abstract method!");jt().tracing.Log_Error("AbstractMethod!",e)}()},unreachable(){!function(){const e=new Error("Unreachable code reached!");jt().tracing.Log_Error("Unreachable!",e)}()}}},rr=new class{constructor(){this.moduleCache=new Map,globalThis.__dyn_modules__={}}loadModuleFromBlob(e,t,r){if(this.moduleCache.has(e))return this.moduleCache.get(e);this.moduleCache.set(e,void 0);try{let i;const a=URL.createObjectURL(t);return Ht("function"==typeof importScripts),importScripts(a),i=globalThis.__dyn_modules__[e],i&&"function"==typeof i.init&&(i.init(tr,r),this.moduleCache.set(e,i)),i}catch(t){re(`[DynModuleMgr] loadModuleFromBlob Error: ${e}`,t)}}getModule(e){return this.moduleCache.get(e)||void 0}};function ir(e,t,r){ar(e,t),t.set(e,r)}function ar(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nr(e,t,r){return e.set(sr(e,t),r),r}function or(e,t){return e.get(sr(e,t))}function sr(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var dr=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,hr=new WeakSet;function _r(){return!0}function fr(){if(or(cr,this)){let e={};return e.architecture=or(cr,this).architecture,e.vendor=or(cr,this).vendor,e}return null}async function pr(){if(!navigator.gpu)return nr(dr,this,1),!1;const e=await navigator.gpu.requestAdapter();return e?await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(nr(cr,this,await e.requestAdapterInfo()),or(cr,this)&&console.log("adapter info: ".concat(or(cr,this).architecture,", ").concat(or(cr,this).vendor))):"info"in e&&nr(cr,this,e.info),nr(dr,this,0),!0):(nr(dr,this,3),!1):(nr(dr,this,2),!1)}function mr(e){if(!e)return!1;const t=e.vendor;return-1!==rt.indexOf(t)}function gr(e,t,r){return vr.produce(e,t,r)}class vr{static produce(e,t,r){let i=null;return 2===e&&(i=rr.getModule("webgpu_renderer_dynmod").exports.createWebGPURenderer(t,r)),i}}const yr=class{constructor(){var e;ar(this,e=hr),e.add(this),ir(this,dr,0),ir(this,lr,1),ir(this,cr,null),ir(this,ur,new Map)}async evaluate(e){if(nr(lr,this,1),!sr(hr,this,_r).call(this))return or(lr,this);if(!e.allowedOnTargetPlatforms)return or(lr,this);if(!e.allowedOnTargetBrowsers)return or(lr,this);if(!await sr(hr,this,pr).call(this))return or(lr,this);const t=sr(hr,this,fr).call(this);if(!sr(hr,this,mr).call(this,t))return or(lr,this);let r=new OffscreenCanvas(1,1);return r.getContext("webgpu")?(r=null,nr(lr,this,2),or(lr,this)):(r=null,or(lr,this))}acquireRenderer(e,t){let r=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&or(ur,this).clear(),or(ur,this).has(e)&&(r=or(ur,this).get(e),r&&(e&&(r.setCanvas(e),r.initialize(e)),t&&r.setDevice(t.acquireGPUDevice()))),null==r&&(r=sr(hr,this,gr).call(this,or(lr,this),e,t),r&&or(ur,this).set(e,r)),r}rendererReinitialize(){if(or(ur,this))for(const[e,t]of or(ur,this))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(or(ur,this))for(const[e,t]of or(ur,this))t&&t.unconfigureGPUContext()}getRendererType(){return or(lr,this)}loadRenderModuleFromBlob(e,t){t&&(2===e?rr.loadModuleFromBlob("webgpu_renderer_dynmod",t):$t("Invalid render module for ".concat(e)))}setRendererType(e){nr(lr,this,e)}isWebGPURendererType(){return 2===or(lr,this)}isWebGLRendererType(){return 1===or(lr,this)}isWebGL2RendererType(){return 3===or(lr,this)}cleanup(){for(const[e,t]of or(ur,this))t&&t.cleanup();or(ur,this).clear()}};function br(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var wr=new WeakSet;function Sr(e){e.forEach((e=>{e.consumePendingGPUEvents()}))}function Er(e){return!e||0==e.length||-1==e.findIndex((e=>!!e&&(!!e.getTextureLayerByZIndex(0)&&e.isRenderingStateReady())))}const Mr=class{constructor(){var e,t;(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e=this,t=wr),t.add(e)}render(e,t){e?e.isGPUDeviceReady()?t&&0!=t.length?(br(wr,this,Sr).call(this,t),br(wr,this,Er).call(this,t)||e.render(t)):te("WGPU RendererController_render() displays are not available!"):te("WGPU RendererController_render() GPU device is not ready!"):te("WGPU RendererController_render() renderer is not attached!")}};function Rr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function Tr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rr(Object(r),!0).forEach((function(t){tt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let xr=new Map,Ar=[];function Cr(e){e.preventDefault()}function kr(e,t,r,i,a,n,o){let s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=a,this.textureindex=r||0,this.initmask=!!o,this.isEnableCanvasAlphaChannel=s,kr.prototype.ROTATION_CLOCK0=0,kr.prototype.ROTATION_CLOCK90=1,kr.prototype.ROTATION_CLOCK180=2,kr.prototype.ROTATION_CLOCK270=3,this.webGLResources=n,n||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.vertexPos=[0,0,0,0],this.texturePos=[0,0,0,0],this.reinit(n);var d=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(d),this.dummpyWaterMark=new Uint8Array(d),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.lastcursorSyncId=-1,this.hasWaterMark=0,this.watermarkOpacity=.15,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.viewWidth=0,this.viewHeight=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=We,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0,this.viewPostion=null,this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=it,this.viewport_rect=null}kr.prototype.isLocalDisplay=function(){return 0==this.textureindex},kr.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.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer,this.webglTexturePos=this.webGLResources.webglTexturePos,this.webglVertexPos=this.webGLResources.webglVertexPos,this.initTextures(!1);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}},kr.prototype.webGLContextLostSimulate=function(){const e=ge(this.contextGL,"WEBGL_lose_context");null==e||e.loseContext()},kr.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout((()=>{this.canvasElement.reportcontextloss||(this.canvasElement.reportcontextloss=!0,ne("WebGLRestoreTimeout")),this.canvasElement.restoreTimeoutId=0}),1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext())}catch(e){re("webgl restoreContext exception",e)}},kr.prototype.webgGLContextLostCallback=function(e){ae("webglcontextlost event: canvas listener size=".concat(Ar.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(Ar.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},kr.prototype.removeEventListener=function(e,t){if(e&&t){e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=Ar.indexOf(this.canvasID);Ar.splice(r,1),xr.delete(e)}},kr.prototype.webGLContextRestoredCallback=function(e){var t,r;ae("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.reinit(),null===(t=this.contextOptions)||void 0===t||null===(r=t.webglcontextrestoredCallback)||void 0===r||r.call(t,e,this.contextOptions.params)},kr.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=ge(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=xr.get(e);t&&this.removeEventListener(e,t),xr.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===Ar.indexOf(this.canvasID)&&(Ar.push(this.canvasID),Ar.length>4&&ae("webglcanvas listener size=".concat(Ar.length,", ids:").concat(Ar.join())))},kr.prototype.isWebGL=function(){return this.contextGL},kr.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},kr.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,a=null,n=["webgl","experimental-webgl","moz-webgl","webkit-3d"],o=0;!a&&o<n.length;){var s=n[o];try{if(jt().config.isEnableCanvasCtxOptionsOpt()){let e={depth:!1,stencil:!1,antialias:!1,alpha:this.isEnableCanvasAlphaChannel};if(this.contextOptions){let t=Tr(Tr({},this.contextOptions),e);a=i.getContext(s,t)}else a=i.getContext(s,e)}else a=this.contextOptions?i.getContext(s,this.contextOptions):i.getContext(s)}catch(e){a=null}a&&"function"==typeof a.getParameter||(a=null),++o}if(this.contextGL=a,!a||a.isContextLost())return re("Failed when trying to get WebGLContext on canvas(".concat(null===(e=this.canvasElement)||void 0===e?void 0:e.width,",").concat(null===(t=this.canvasElement)||void 0===t?void 0:t.height,"), gl=").concat(a,", lost=").concat(null===(r=a)||void 0===r?void 0:r.isContextLost())),void ne("InitWebGLFail");a.glInitSucceed=0},kr.prototype.initProgram=function(){var e=this.contextGL,t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,"\n attribute vec4 vertexPos;\n attribute vec4 texturePos;\n attribute vec4 masktexturePos;\n varying vec2 textureCoord;\n varying vec2 masktextureCoord;\n\n void main() {\n gl_Position = vertexPos;\n textureCoord = texturePos.xy;\n masktextureCoord = masktexturePos.xy;\n }\n "),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||e.isContextLost()||ae("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(t));var r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,"\n precision highp float;\n varying highp vec2 textureCoord;\n varying highp vec2 masktextureCoord;\n\n uniform sampler2D ySampler;\n uniform sampler2D uSampler;\n uniform sampler2D vSampler;\n uniform sampler2D cursorSampler;\n uniform sampler2D waterMarkSampler;\n uniform sampler2D previewVideoSampler;\n uniform sampler2D maskSampler;\n\n uniform vec4 cursorInfo;\n uniform int onlyRGBA;\n uniform int bgraMode;\n uniform int colorRange;\n uniform int waterMarkFlag;\n uniform int cursorFlag;\n uniform int yuvmode;\n\n const int MAX_ELLIPSE_COUNT = 10;\n uniform int maskFlag; // 0: mask disabled; 1: mask enabled;\n uniform int maskMode; // 0: static mask; 1: dynamic mask;\n uniform vec4 uEllipses[MAX_ELLIPSE_COUNT]; // each ellipse contains (cx, cy, rx, ry) 4-coords\n uniform int uEllipseCount; // how many ellipses will draw\n\n // rounded corner feature in gl shader\n uniform float u_enable_rounded_corner;\n uniform float u_radius_lt_x;\n uniform float u_radius_lt_y;\n uniform float u_radius_lb_x;\n uniform float u_radius_lb_y;\n uniform float u_radius_rt_x;\n uniform float u_radius_rt_y;\n uniform float u_radius_rb_x;\n uniform float u_radius_rb_y;\n uniform float u_aa_width;\n uniform vec4 u_viewport_rect;\n\n const mat4 YUV2RGB_L = mat4(\n 1.1643828125, 0, 1.59602734375, -0.87078515625,\n 1.1643828125, -0.39176171875, -0.81296875, 0.52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1\n );\n\n const mat4 YUV2RGB_F = mat4(\n 1.0, 0, 1.402, -0.701,\n 1.0, -0.34413, -0.71414, 0.529135,\n 1.0, 1.772, 0, -0.886,\n 0, 0, 0, 1\n );\n\n void main(void) {\n vec4 c;\n if (waterMarkFlag != 1) {\n if (onlyRGBA == 0) {\n highp float y = texture2D(ySampler, textureCoord).r;\n highp float u;\n highp float v;\n\n if (yuvmode == 1) {\n u = texture2D(uSampler, textureCoord).r;\n v = texture2D(vSampler, textureCoord).r;\n } else {\n u = texture2D(uSampler, textureCoord).r;\n v = texture2D(uSampler, textureCoord).a;\n }\n\n if (colorRange == 0) {\n c = vec4(y, u, v, 1) * YUV2RGB_L;\n } else {\n c = vec4(y, u, v, 1) * YUV2RGB_F;\n }\n\n if (cursorFlag == 1) {\n if (cursorInfo.z > 0.0 &&\n textureCoord.x >= cursorInfo.x &&\n textureCoord.y >= cursorInfo.y &&\n textureCoord.x < cursorInfo.x + cursorInfo.z &&\n textureCoord.y < cursorInfo.y + cursorInfo.w) {\n\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture2D(cursorSampler, cursorCoord);\n c = c * (1.0 - cursor.a) + cursor * cursor.a;\n }\n }\n } else {\n c = texture2D(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n } else {\n c = texture2D(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 = texture2D(maskSampler, masktextureCoord);\n if (maskMode == 0) {\n // -- handle static mask --\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 } else if (maskMode == 1) {\n // -- handle dynamic mask --\n bool inEllipse = false; // variable for checking whether the pixel to be drawn hits ellipse\n for (int i = 0; i < MAX_ELLIPSE_COUNT; i++) {\n if (i > uEllipseCount) break;\n\n vec2 ellipseCenter = uEllipses[i].xy;\n vec2 ellipseRadii = uEllipses[i].zw;\n vec2 ellipsePos = masktextureCoord - ellipseCenter;\n\n float ellipseEq = (ellipsePos.x * ellipsePos.x) / (ellipseRadii.x * ellipseRadii.x) +\n (ellipsePos.y * ellipsePos.y) / (ellipseRadii.y * ellipseRadii.y);\n if (ellipseEq <= 1.0) {\n // the pixel in the ellipse range\n inEllipse = true;\n break;\n }\n }\n\n if (inEllipse) {\n c = mask * mask.a + c * (1.0 - mask.a);\n }\n }\n }\n\n if (waterMarkFlag != 1) {\n c.a = 1.0;\n }\n\n if (u_enable_rounded_corner < 0.5) {\n gl_FragColor = c;\n return;\n }\n\n // step 1: viewport coordinate mapping\n // convert the fragment coordinate(canvas coordinate) to the viewport coordinate\n // for example, a viewport={x: 100, y: 100, w: 200, h: 160}, a fragCoord.xy={x:120, y: 120}\n // we can get the pos={x: 20, y: 20}\n vec2 pos = gl_FragCoord.xy - u_viewport_rect.xy;\n vec2 viewportSize = u_viewport_rect.zw;\n\n // convert the normalized radius to pixel value\n float r_lt_x = u_radius_lt_x * viewportSize.x;\n float r_lt_y = u_radius_lt_y * viewportSize.y;\n float r_rt_x = u_radius_rt_x * viewportSize.x;\n float r_rt_y = u_radius_rt_y * viewportSize.y;\n float r_lb_x = u_radius_lb_x * viewportSize.x;\n float r_lb_y = u_radius_lb_y * viewportSize.y;\n float r_rb_x = u_radius_rb_x * viewportSize.x;\n float r_rb_y = u_radius_rb_y * viewportSize.y;\n\n // step 2: calculate the rounded corner mask (as alpha)\n float alpha = 1.0;\n\n // --- calculation of the left-top corner ---\n // Condition: if (pos.x < r_lt_x && pos.y < r_lt_y)\n float in_lt = (1.0 - step(r_lt_x, pos.x)) * (1.0 - step(r_lt_y, pos.y));\n // the circle center of the left-top corner in pixel coordinate\n vec2 center_lt = vec2(r_lt_x, r_lt_y);\n // calculate and normalize the distance between the fragment and the center\n vec2 diff_lt = (pos - center_lt) / vec2(r_lt_x, r_lt_y);\n float normDist_lt = length(diff_lt);\n // smoothstep function is used to calculate the alpha value\n float mask_lt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lt);\n float final_lt = mix(1.0, mask_lt, in_lt);\n\n // --- calculation of the right-top corner ---\n float in_rt = (1.0 - step(r_rt_x, viewportSize.x - pos.x)) * (1.0 - step(r_rt_y, pos.y));\n vec2 center_rt = vec2(viewportSize.x - r_rt_x, r_rt_y);\n vec2 diff_rt = (pos - center_rt) / vec2(r_rt_x, r_rt_y);\n float normDist_rt = length(diff_rt);\n float mask_rt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rt);\n float final_rt = mix(1.0, mask_rt, in_rt);\n\n // --- calculation of the left-bottom corner ---\n float in_lb = (1.0 - step(r_lb_x, pos.x)) * (1.0 - step(r_lb_y, viewportSize.y - pos.y));\n vec2 center_lb = vec2(r_lb_x, viewportSize.y - r_lb_y);\n vec2 diff_lb = (pos - center_lb) / vec2(r_lb_x, r_lb_y);\n float normDist_lb = length(diff_lb);\n float mask_lb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lb);\n float final_lb = mix(1.0, mask_lb, in_lb);\n\n // --- calculation of the right-bottom corner ---\n float in_rb = (1.0 - step(r_rb_x, viewportSize.x - pos.x)) * (1.0 - step(r_rb_y, viewportSize.y - pos.y));\n vec2 center_rb = vec2(viewportSize.x - r_rb_x, viewportSize.y - r_rb_y);\n vec2 diff_rb = (pos - center_rb) / vec2(r_rb_x, r_rb_y);\n float normDist_rb = length(diff_rb);\n float mask_rb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rb);\n float final_rb = mix(1.0, mask_rb, in_rb);\n\n // Get the minimum value from the four corners (to ensure that if any corner requires transparency it is applied)\n float finalAlpha = min(min(final_lt, final_rt), min(final_lb, final_rb));\n\n // Final output color\n gl_FragColor = vec4(c.rgb, c.a * finalAlpha);\n }\n"),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||ae("webgl 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()||ae("webgl Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},kr.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 a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),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=a},kr.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var i=this.initTexture();this.yTextureRef=i,this.oyTextureRef=i;var a=this.initTexture();this.uTextureRef=a,this.ouTextureRef=a;var n=this.initTexture();this.vTextureRef=n,this.ovTextureRef=n,e&&this.BindTextures(Ue),this.waterMarkTextureRef=this.initTexture();var o=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(o,5),this.waterMarkSamplerRef=o;var s=this.initTexture(),d=t.getUniformLocation(r,"cursorSampler");if(t.uniform1i(d,4),this.cursorTextureRef=s,this.cursorSamplerRef=d,this.cursorInfoRef=t.getUniformLocation(r,"cursorInfo"),this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var l=this.initTexture(),c=t.getUniformLocation(r,"maskSampler");t.uniform1i(c,4),this.maskTextureRef=l}this.colorRangeRef=t.getUniformLocation(r,"colorRange"),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"),this.ul_enable_rounded_corner=t.getUniformLocation(r,"u_enable_rounded_corner"),this.ul_radius_lt_x=t.getUniformLocation(r,"u_radius_lt_x"),this.ul_radius_lt_y=t.getUniformLocation(r,"u_radius_lt_y"),this.ul_radius_lb_x=t.getUniformLocation(r,"u_radius_lb_x"),this.ul_radius_lb_y=t.getUniformLocation(r,"u_radius_lb_y"),this.ul_radius_rt_x=t.getUniformLocation(r,"u_radius_rt_x"),this.ul_radius_rt_y=t.getUniformLocation(r,"u_radius_rt_y"),this.ul_radius_rb_x=t.getUniformLocation(r,"u_radius_rb_x"),this.ul_radius_rb_y=t.getUniformLocation(r,"u_radius_rb_y"),this.ul_aa_width=t.getUniformLocation(r,"u_aa_width"),this.ul_viewport_rect=t.getUniformLocation(r,"u_viewport_rect")},kr.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==Ue){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let a=t.getUniformLocation(r,"vSampler");t.uniform1i(a,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 a=t.getUniformLocation(r,"uSampler");t.uniform1i(a,0);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}else if(2==e){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let a=t.getUniformLocation(r,"vSampler");t.uniform1i(a,0)}let i=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(i,0);let a=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+4),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(a,4)):t.uniform1i(a,0);let n=t.getUniformLocation(r,"cursorSampler");t.uniform1i(n,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,5)},kr.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},kr.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},kr.prototype.cleanup=function(){let e=this.canvasElement,t=xr.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=Cr,e.addEventListener("webglcontextlost",Cr,{capture:!1})),this.cleanupRoundedCornerRadius(),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE3),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5),r.bindTexture(r.TEXTURE_2D,null),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},kr.prototype.updataVertexInfoForSharing=function(){const[e,t,r,i]=this.vertexPos,a=this.webglVertexPos[0],n=this.webglVertexPos[3];if(e!=a||n!=i){this.webglVertexPos[0]=e,this.webglVertexPos[1]=t,this.webglVertexPos[2]=r,this.webglVertexPos[3]=i;var o=new Float32Array([r,t,e,t,r,i,e,i,1,1,-1,1,1,-1,-1,-1]),s=this.contextGL;s.bindBuffer(s.ARRAY_BUFFER,this.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW)}},kr.prototype.updateTextureInfoForSharing=function(){const[e,t,r,i]=this.texturePos,a=this.webglTexturePos[0],n=this.webglTexturePos[3];if(e!=a||n!=i){this.webglTexturePos[0]=e,this.webglTexturePos[1]=t,this.webglTexturePos[2]=r,this.webglTexturePos[3]=i;var o=new Float32Array([r,t,e,t,r,i,e,i,1,0,0,0,1,1,0,1]),s=this.contextGL;s.bindBuffer(s.ARRAY_BUFFER,this.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW)}},kr.prototype.updateVertexInfoForMultiView=function(e,t,r,i,a){var n,o,s,d,l=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:a}))n=0,o=0,s=1,d=1;else{var c=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?i:r,u=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?r:i,h=c/u*t;h>e?(n=0,s=1,d=1-(o=(t-u/c*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 _=new Float32Array([s,o,n,o,s,d,n,d,1,1,-1,1,1,-1,-1,-1]);this.viewPostion=_,l.bindBuffer(l.ARRAY_BUFFER,this.vertexPosBuffer),l.bufferData(l.ARRAY_BUFFER,_,l.DYNAMIC_DRAW)},kr.prototype.getViewPosition=function(){let e=[0,0,1,1];if(!this.viewPostion)return e;const t=this.viewPostion[0],r=this.viewPostion[1],i=this.viewPostion[2],a=this.viewPostion[5];return e[0]=(1-r)/2,e[1]=(1+i)/2,e[2]=(1-a)/2,e[3]=(1+t)/2,e},kr.prototype.updateTextureInfoForMultiView=function(e,t,r,i,a,n,o){var s,d,l,c,u=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const a=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/n:n/o,u=r.left||0,h=r.top||0;if(r.width/r.height>a){const i=r.height*a;s=h/t,d=(Math.round((r.width-i)/2)+u)/e,l=(h+r.height)/t,c=d+i/e}else{const i=r.width/a;l=(s=(Math.round((r.height-i)/2)+h)/t)+i/t,c=(d=u/e)+r.width/e}}else s=qt(r.top/t,2),d=qt(r.left/e,2),l=zt((r.top+r.height)/t,2),c=zt((r.width+r.left)/e,2);var h=[d,s,c,s,c,l,d,l];i==this.ROTATION_CLOCK90&&(h.unshift(h[6],h[7]),h=h.slice(0,8)),i==this.ROTATION_CLOCK180&&(h.unshift(h[4],h[5],h[6],h[7]),h=h.slice(0,8)),i==this.ROTATION_CLOCK270&&(h.push(h[0],h[1]),h=h.slice(2,10));var _=h[0],f=h[1];if(h[0]=h[2],h[1]=h[3],h[2]=_,h[3]=f,a)if(i==this.ROTATION_CLOCK90||i==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 p=new Float32Array([...h,1,0,0,0,1,1,0,1]);u.bindBuffer(u.ARRAY_BUFFER,this.texturePosBuffer),u.bufferData(u.ARRAY_BUFFER,p,u.DYNAMIC_DRAW)},kr.prototype.drawNextOutputPictureFrame=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6?arguments[6]:void 0,s=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var d=this.contextGL,l=this.yTextureRef,c=this.uTextureRef,u=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA),a=a||this.ROTATION_CLOCK0;var h=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,_=(r.top!=this.croppingParams.top||(r.left,this.croppingParams.left),o.width!=this.viewWidth||o.height!=this.viewHeight),f=(e!=this.textureWidth||this.textureHeight,a!=this.picRotation);(h||_||f)&&function(e,t,r,i,a){let n=a.width,o=a.height;var s,d,l,c,u=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,h=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,_=u/h*o;_>n?(s=0,l=1,c=1-(d=(o-h/u*n)/2/o)):(d=0,c=1,l=1-(s=(n-_)/2/n)),s=parseFloat((2*s-1).toFixed(3)),l=parseFloat((2*l-1).toFixed(3)),d=parseFloat((1-2*d).toFixed(3)),c=parseFloat((1-2*c).toFixed(3)),e.vertexPos=[s,d,l,c]}(this,r.width,r.height,a,o),this.updataVertexInfoForSharing(),function(e,t,r,i,a){var n=i.top/r,o=i.left/t,s=(i.top+i.height)/r,d=(i.left+i.width)/t,l=[o,n,d,n,d,s,o,s];a==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),a==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),a==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],u=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=u;var h=new Float32Array([...l,1,0,0,0,1,1,0,1]),_=e.contextGL;_.bindBuffer(_.ARRAY_BUFFER,e.texturePosBuffer),_.bufferData(_.ARRAY_BUFFER,h,_.DYNAMIC_DRAW)}(this,e,t,r,a);let p=n?0:1;p!=this.colorRange&&(d.uniform1i(this.colorRangeRef,p),this.colorRange=p),d.viewport(o.x,o.y,o.width,o.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([o.x,o.y,o.width,o.height],0),d.uniform4fv(this.ul_viewport_rect,this.viewport_rect),d.uniform1i(this.onlyRGBARef,0),d.uniform1i(this.yuvmodeRef,Ue),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=a,this.viewWidth=o.width,this.viewHeight=o.height;var m=i,g=e*t;if(d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,l),s){var v=m.subarray(0,g);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,v)}var y=e/2*t/2;if(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,c),s){var b=m.subarray(g,g+y);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,b)}var w=y;if(d.activeTexture(d.TEXTURE2),d.bindTexture(d.TEXTURE_2D,u),s){var S=m.subarray(g+y,g+y+w);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S)}d.activeTexture(d.TEXTURE0+4),d.bindTexture(d.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?d.uniform1i(this.cursorFlagRef,1):s&&d.texImage2D(d.TEXTURE_2D,0,d.RGBA,1,1,0,d.RGBA,d.UNSIGNED_BYTE,this.dummpyCursor),d.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),this.render(),this.hasWholeFrame=1},kr.prototype.updateCursor=function(e,t,r,i){if(this.isAvaiable()){var a=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||i!=this.lastcursorSyncId&&(this.lastcursorSyncId=i,a.activeTexture(a.TEXTURE0+4),a.bindTexture(a.TEXTURE_2D,this.cursorTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},kr.prototype.updateCursorPosInfo=function(e,t,r,i,a){if(e&&this.hasCursor){let e=t/this.croppingParams.width,n=r/this.croppingParams.height,o=i/this.croppingParams.width,s=a/this.croppingParams.height;this.cx=e,this.cy=n,this.cw=o,this.ch=s}else this.cx=0,this.cy=0,this.cw=0,this.ch=0},kr.prototype.isHasWholeFrame=function(){return this.hasWholeFrame},kr.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.hasWaterMark=1,this.watermarkWidth=e,this.watermarkHeight=t,i.activeTexture(i.TEXTURE0+5),i.bindTexture(i.TEXTURE_2D,this.waterMarkTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.watermarkWidth,this.watermarkHeight,0,i.RGBA,i.UNSIGNED_BYTE,r))}},kr.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;this.isSetWatermark()&&this.watermarkWidth&&this.watermarkHeight&&(e.uniform1i(this.waterMarkFlagRef,1),e.activeTexture(e.TEXTURE0+5),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4))}},kr.prototype.drawRoundedCorner=function(){if(this.isAvaiable()){var e=this.contextGL;e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.uniform1f(this.ul_enable_rounded_corner,this.enable_rounded_corner),e.uniform1f(this.ul_radius_lt_x,this.radius_lt_x),e.uniform1f(this.ul_radius_lt_y,this.radius_lt_y),e.uniform1f(this.ul_radius_lb_x,this.radius_lb_x),e.uniform1f(this.ul_radius_lb_y,this.radius_lb_y),e.uniform1f(this.ul_radius_rt_x,this.radius_rt_x),e.uniform1f(this.ul_radius_rt_y,this.radius_rt_y),e.uniform1f(this.ul_radius_rb_x,this.radius_rb_x),e.uniform1f(this.ul_radius_rb_y,this.radius_rb_y),e.uniform1f(this.ul_aa_width,this.aa_width)}},kr.prototype.cleanupRoundedCornerRadius=function(){this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=it,this.viewport_rect=null},kr.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;this.drawRoundedCorner(),e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},kr.prototype.clear=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.hasCursor=0,this.watermarkHeight=0,this.watermarkWidth=0,this.watermarkRepeated=!1,this.hasWholeFrame=0,this.lastcursorSyncId=-1,this.cleanupRoundedCornerRadius(),e&&this.clearCanvas({R:0,G:0,B:0,A:0})},kr.prototype.clearCanvas=function(e){if(this.cleanupRoundedCornerRadius(),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)}},kr.prototype.isRGBAMode=function(e){return-1!==[Be,Ne].indexOf(e)},kr.prototype.updateRemoteVideoTextures=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6?arguments[6]:void 0,s=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,l=this.yTextureRef,c=this.uTextureRef,u=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||!i||!i.length||i.length!=e*t*3/2&&!h||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let _=n?0:1;if(this.colorRange=_,this.rotation=a,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.viewWidth=o.width,this.viewHeight=o.height,!s)return;if(d.bindTexture(d.TEXTURE_2D,l),h)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,i);var f=i,p=e*t,m=f.subarray(0,p);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,m);let g=0,v=0;this.videoMode==Ue?(g=e/2*t/2,v=g):2==this.videoMode&&(g=e*t/2,v=0);var y=f.subarray(p,p+g);if(d.bindTexture(d.TEXTURE_2D,c),v){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,y);var b=f.subarray(p+g,p+g+v);d.bindTexture(d.TEXTURE_2D,u),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,b)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,y);return!0},kr.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var o=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(a)||(this.rotation=a),Object.assign(this.croppingParams,i),!n)return;o.bindTexture(o.TEXTURE_2D,this.yTextureRef);const s=o.RGBA,d=o.RGBA,l=o.UNSIGNED_BYTE;o.texImage2D(o.TEXTURE_2D,0,s,d,l,r)},kr.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)}},kr.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},kr.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.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),r.uniform4fv(this.ul_viewport_rect,this.viewport_rect),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()},kr.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var a,n=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),a=this.destination,n.flush(),n.readPixels(e,t,r,i,n.RGBA,n.UNSIGNED_BYTE,a),a}},kr.prototype.updateSelfVideoTextures=function(e,t,r,i){let a=!(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)&&r&&r.length%4==0&&this.isAvaiable()){var o=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=n,Object.assign(this.croppingParams,i),a&&(o.bindTexture(o.TEXTURE_2D,this.yTextureRef),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,e,t,0,o.RGBA,o.UNSIGNED_BYTE,r))}},kr.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 i=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),i.uniform4fv(this.ul_viewport_rect,this.viewport_rect),t?(i.enable(i.BLEND),i.blendFunc(i.ZERO,i.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(Be),this.render()}},kr.prototype.isSetWatermark=function(){return this.hasWaterMark},kr.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},kr.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;i.uniform1i(this.onlyRGBARef,e),i.uniform1i(this.bgraModeRef,e&&r===Ne?1:0),i.uniform1i(this.cursorFlagRef,t),e||i.uniform1i(this.yuvmodeRef,r)}},kr.prototype.setVideoMode=function(e){this.videoMode=e},kr.prototype.getVideoMode=function(e){return this.videoMode},kr.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},kr.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},kr.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},kr.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},kr.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},kr.prototype.getWatermarkPosition=function(){return this.watermarkPosition},kr.prototype.setMultiView=function(e){return this.isMultiView=e},kr.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},kr.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},kr.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},kr.prototype.getFillMode=function(){return this.fillMode},kr.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},kr.prototype.getTextureIndex=function(){return this.textureindex},kr.prototype.getTextureWidth=function(){return this.textureWidth},kr.prototype.getTextureHeight=function(){return this.textureHeight},kr.prototype.getRotation=function(){return this.rotation},kr.prototype.getCroppingParams=function(){return this.croppingParams},kr.prototype.getIndex=function(){return this.textureindex},kr.prototype.getWatermarkWidth=function(){return this.watermarkWidth},kr.prototype.getWatermarkHeight=function(){return this.watermarkHeight},kr.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},kr.prototype.getAttachedCanvas=function(){return this.canvasElement},kr.prototype.getCanvasId=function(){return this.canvasID},kr.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},kr.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 a=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(a-e)<.01))},kr.prototype.setRoundedCornerRadius=function(e){e?(this.radius_lt_x=e.radius_lt_x,this.radius_lt_y=e.radius_lt_y,this.radius_lb_x=e.radius_lb_x,this.radius_lb_y=e.radius_lb_y,this.radius_rt_x=e.radius_rt_x,this.radius_rt_y=e.radius_rt_y,this.radius_rb_x=e.radius_rb_x,this.radius_rb_y=e.radius_rb_y,0===this.radius_lt_x&&0===this.radius_lt_y&&0===this.radius_lb_x&&0===this.radius_lb_y&&0===this.radius_rt_x&&0===this.radius_rt_y&&0===this.radius_rb_x&&0===this.radius_rb_y?this.enable_rounded_corner=0:this.enable_rounded_corner=1):this.enable_rounded_corner=0},kr.prototype.setAntialiasWidth=function(e){(e<=0||e>=1)&&(e=it),this.aa_width=e};const Fr=kr;class Pr{getVideoRenderDisplay(e,t,r,i,a){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getRenderDisplay(e,t,r){throw new Error("getRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,r){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}function Ir(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)}function Lr(e,t){return e.get(Or(e,t))}function Dr(e,t,r){return e.set(Or(e,t),r),r}function Or(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Wr=new WeakMap,Br=new WeakMap;class Ur extends Pr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),Ir(this,Wr,new Map),Ir(this,Br,!1),Dr(Br,this,e)}setCanvasAlphaChannelEnability(e){Dr(Br,this,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=null,n=null,o=null,s=!1;return i&&(a=i.forceNoGL,n=i.contextOptions,o=i.webGLResources,s=i.initMask),new Fr(e,t,r,a,n,o,s,Lr(Br,this))}getVideoRenderDisplay(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=Lr(Wr,this).get(e);if(!n){let i=[];n=[i,[]],Lr(Wr,this).set(e,n);let o=new Fr(e,t,0,void 0,void 0,void 0,void 0,Lr(Br,this));o.setMultiView(!0),a&&a.set(e,o);let s=1;for(;s<=r;s++){const r=new Fr(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,Lr(Br,this));r.setMultiView(!0),i.push(r)}}let o,s=Lr(Wr,this).get(e),d=s[0],l=s[1];if(s&&d[0]&&(o=d.pop(),l.push(o)),!o){const e=s?"".concat(s.length):"undefined",t=d?"".concat(d.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}onWebglContextLostForMulti(e,t){const{canvas:r}=t;let i=Lr(Wr,this).get(r);var[a,n,o]=i;[...a,...n].forEach((e=>e.clear()))}onRestoredFromLostForMulti(e,t){if(!t)return;const{canvas:r}=t;let i=Lr(Wr,this).get(r);var[a,n,o]=i;const s=[...a,...n];let d=s.find((e=>e.isLocalDisplay()));d.webglVertexPos=[0,0,0,0],d.webglTexturePos=[0,0,0,0],o.args={program:d.shaderProgram,contextgl:d.contextGL,vBuffer:d.vertexPosBuffer,tBuffer:d.texturePosBuffer,webglVertexPos:d.webglVertexPos,webglTexturePos:d.webglTexturePos},s.forEach((e=>{e!=d&&e.reinit(o.args)}))}getRenderDisplay(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=Lr(Wr,this).get(e);if(!i){let a=[],n={canvasId:t,size:1,args:{}};i=[a,[],n],Lr(Wr,this).set(e,i);const o={webglcontextlostCallback:this.onWebglContextLostForMulti.bind(this),webglcontextrestoredCallback:this.onRestoredFromLostForMulti.bind(this),params:{canvas:e,rendercanvasID:t}};let s=new Fr(e,t,0,void 0,o,void 0,void 0,Lr(Br,this));r&&r.set(e,s),a.push(s),n.args={program:s.shaderProgram,contextgl:s.contextGL,vBuffer:s.vertexPosBuffer,tBuffer:s.texturePosBuffer,webglVertexPos:s.webglVertexPos,webglTexturePos:s.webglTexturePos}}if(!i[0].length){const r=new Fr(e,t,i[2].size,void 0,void 0,i[2].args,void 0,Lr(Br,this));i[2].size++,i[0].push(r)}let a=i[0].pop();return i[1].push(a),a}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(We),t.clear(r);let i=Lr(Wr,this).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,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=Lr(Wr,this).get(r);(!o||o.length<2)&&a("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 r!==t&&(Lr(Wr,this).delete(r),Lr(Wr,this).set(t,o),n&&(n.delete(r),n.set(t,s))),null}}getRenderDisplayMap(){return Lr(Wr,this)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t,null);for(const[e,t]of Lr(Wr,this)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}Dr(Wr,this,new Map)}cleanupByCanvas(e){if(Lr(Wr,this).get(e)){let t=Lr(Wr,this).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=[],Lr(Wr,this).delete(e)}}else{var t,r;null===(t=e.display)||void 0===t||null===(r=t.cleanup)||void 0===r||r.call(t)}}}function Nr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function Vr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nr(Object(r),!0).forEach((function(t){tt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Gr=new Map,jr=[];function Hr(e){e.preventDefault()}function $r(e,t,r,i,a,n,o){let s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=a,this.textureindex=r||0,this.initmask=!!o,this.isEnableCanvasAlphaChannel=s,$r.prototype.ROTATION_CLOCK0=0,$r.prototype.ROTATION_CLOCK90=1,$r.prototype.ROTATION_CLOCK180=2,$r.prototype.ROTATION_CLOCK270=3,this.webGLResources=n,n||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.vertexPos=[0,0,0,0],this.texturePos=[0,0,0,0],this.reinit(n);var d=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(d),this.dummpyWaterMark=new Uint8Array(d),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.lastcursorSyncId=-1,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.viewWidth=0,this.viewHeight=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=We,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0,this.viewPostion=null,this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=it,this.uv_rect=null}$r.prototype.isLocalDisplay=function(){return 0==this.textureindex},$r.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.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer,this.webglTexturePos=this.webGLResources.webglTexturePos,this.webglVertexPos=this.webGLResources.webglVertexPos,this.initTextures(!1);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}},$r.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(ge(this.contextGL,"WEBGL_lose_context"))},$r.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((()=>{this.canvasElement.reportcontextloss||(this.canvasElement.reportcontextloss=!0,ne("WebGL2RestoreTimeout")),this.canvasElement.restoreTimeoutId=0}),1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){re("webgl restoreContext exception2",e)}},$r.prototype.webgGLContextLostCallback=function(e){ae("webglcontextlost2 event: canvas listener size=".concat(jr.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(jr.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},$r.prototype.removeEventListener=function(e,t){if(e&&t){e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const r=jr.indexOf(this.canvasID);jr.splice(r,1),Gr.delete(e)}},$r.prototype.webGLContextRestoredCallback=function(e){var t,r;ae("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.reinit(),null===(t=this.contextOptions)||void 0===t||null===(r=t.webglcontextrestoredCallback)||void 0===r||r.call(t,e,this.contextOptions.params)},$r.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=ge(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=Gr.get(e);t&&this.removeEventListener(e,t),Gr.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===jr.indexOf(this.canvasID)&&(jr.push(this.canvasID),jr.length>4&&ae("webgl2canvas listener size=".concat(jr.length,", ids:").concat(jr.join())))},$r.prototype.isWebGL2=function(){return this.contextGL},$r.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},$r.prototype.initContextGL=function(){for(var e,t,r,i=this.canvasElement,a=null,n=["webgl2"],o=0;!a&&o<n.length;){var s=n[o];try{if(jt().config.isEnableCanvasCtxOptionsOpt()){let e={depth:!1,stencil:!1,antialias:!1,alpha:this.isEnableCanvasAlphaChannel};if(this.contextOptions){let t=Vr(Vr({},this.contextOptions),e);a=i.getContext(s,t)}else a=i.getContext(s,e)}else a=this.contextOptions?i.getContext(s,this.contextOptions):i.getContext(s)}catch(e){a=null}a&&"function"==typeof a.getParameter||(a=null),++o}if(this.contextGL=a,!a||a.isContextLost())return re("Failed when trying to get WebGLContext2 on canvas(".concat(null===(e=this.canvasElement)||void 0===e?void 0:e.width,",").concat(null===(t=this.canvasElement)||void 0===t?void 0:t.height,"), gl=").concat(a,", lost=").concat(null===(r=a)||void 0===r?void 0:r.isContextLost())),void ne("initWebGL2Fail");a.glInitSucceed=0},$r.prototype.initProgram=function(){var e=this.contextGL,t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,"#version 300 es\n in vec4 vertexPos;\n in vec4 texturePos;\n in vec4 masktexturePos;\n out vec2 textureCoord;\n out vec2 masktextureCoord;\n\n void main() {\n gl_Position = vertexPos;\n textureCoord = texturePos.xy;\n masktextureCoord = masktexturePos.xy;\n }\n "),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||e.isContextLost()||ae("webgl2 Vertex shader failed to compile: "+e.getShaderInfoLog(t));var r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,"#version 300 es\n precision highp float;\n\n in highp vec2 textureCoord;\n in highp vec2 masktextureCoord;\n uniform sampler2D ySampler;\n uniform sampler2D uSampler;\n uniform sampler2D vSampler;\n uniform sampler2D cursorSampler;\n uniform sampler2D waterMarkSampler;\n uniform sampler2D previewVideoSampler;\n uniform sampler2D maskSampler;\n uniform vec4 cursorInfo;\n uniform int onlyRGBA;\n uniform int bgraMode;\n uniform int colorRange;\n uniform int waterMarkFlag;\n uniform int cursorFlag;\n uniform int maskFlag;\n uniform int yuvmode;\n\n // rounded corner feature in gl shader\n uniform float u_enable_rounded_corner;\n uniform float u_radius_lt_x;\n uniform float u_radius_lt_y;\n uniform float u_radius_lb_x;\n uniform float u_radius_lb_y;\n uniform float u_radius_rt_x;\n uniform float u_radius_rt_y;\n uniform float u_radius_rb_x;\n uniform float u_radius_rb_y;\n uniform float u_aa_width;\n uniform vec4 u_viewport_rect;\n\n const mat4 YUV2RGB_L = mat4(\n 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1\n );\n\n const mat4 YUV2RGB_F = mat4(\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 out vec4 outputColor;\n\n void main(void) {\n vec4 c;\n if (waterMarkFlag != 1) {\n if (onlyRGBA == 0) {\n highp float y = texture(ySampler, textureCoord).r;\n highp float u;\n highp float v;\n if (yuvmode == 1) {\n u = texture(uSampler, textureCoord).r;\n v = texture(vSampler, textureCoord).r;\n } else {\n u = texture(uSampler, textureCoord).r;\n v = texture(uSampler, textureCoord).a;\n }\n\n if (colorRange == 0) {\n c = vec4(y, u, v, 1) * YUV2RGB_L;\n } else {\n c = vec4(y, u, v, 1) * YUV2RGB_F;\n }\n\n if (cursorFlag == 1) {\n if (cursorInfo.z > 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 if (u_enable_rounded_corner < 0.5) {\n outputColor = c;\n return;\n }\n\n // step 1: viewport coordinate mapping\n // convert the fragment coordinate(canvas coordinate) to the viewport coordinate\n // for example, a viewport={x: 100, y: 100, w: 200, h: 160}, a fragCoord.xy={x:120, y: 120}\n // we can get the pos={x: 20, y: 20}\n vec2 pos = gl_FragCoord.xy - u_viewport_rect.xy;\n vec2 viewportSize = u_viewport_rect.zw;\n\n // convert the normalized radius to pixel value\n float r_lt_x = u_radius_lt_x * viewportSize.x;\n float r_lt_y = u_radius_lt_y * viewportSize.y;\n float r_rt_x = u_radius_rt_x * viewportSize.x;\n float r_rt_y = u_radius_rt_y * viewportSize.y;\n float r_lb_x = u_radius_lb_x * viewportSize.x;\n float r_lb_y = u_radius_lb_y * viewportSize.y;\n float r_rb_x = u_radius_rb_x * viewportSize.x;\n float r_rb_y = u_radius_rb_y * viewportSize.y;\n\n // step 2: calculate the rounded corner mask (as alpha)\n float alpha = 1.0;\n\n // --- calculation of the left-top corner ---\n // Condition: if (pos.x < r_lt_x && pos.y < r_lt_y)\n float in_lt = (1.0 - step(r_lt_x, pos.x)) * (1.0 - step(r_lt_y, pos.y));\n // the circle center of the left-top corner in pixel coordinate\n vec2 center_lt = vec2(r_lt_x, r_lt_y);\n // calculate and normalize the distance between the fragment and the center\n vec2 diff_lt = (pos - center_lt) / vec2(r_lt_x, r_lt_y);\n float normDist_lt = length(diff_lt);\n // smoothstep function is used to calculate the alpha value\n float mask_lt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lt);\n float final_lt = mix(1.0, mask_lt, in_lt);\n\n // --- calculation of the right-top corner ---\n float in_rt = (1.0 - step(r_rt_x, viewportSize.x - pos.x)) * (1.0 - step(r_rt_y, pos.y));\n vec2 center_rt = vec2(viewportSize.x - r_rt_x, r_rt_y);\n vec2 diff_rt = (pos - center_rt) / vec2(r_rt_x, r_rt_y);\n float normDist_rt = length(diff_rt);\n float mask_rt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rt);\n float final_rt = mix(1.0, mask_rt, in_rt);\n\n // --- calculation of the left-bottom corner ---\n float in_lb = (1.0 - step(r_lb_x, pos.x)) * (1.0 - step(r_lb_y, viewportSize.y - pos.y));\n vec2 center_lb = vec2(r_lb_x, viewportSize.y - r_lb_y);\n vec2 diff_lb = (pos - center_lb) / vec2(r_lb_x, r_lb_y);\n float normDist_lb = length(diff_lb);\n float mask_lb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lb);\n float final_lb = mix(1.0, mask_lb, in_lb);\n\n // --- calculation of the right-bottom corner ---\n float in_rb = (1.0 - step(r_rb_x, viewportSize.x - pos.x)) * (1.0 - step(r_rb_y, viewportSize.y - pos.y));\n vec2 center_rb = vec2(viewportSize.x - r_rb_x, viewportSize.y - r_rb_y);\n vec2 diff_rb = (pos - center_rb) / vec2(r_rb_x, r_rb_y);\n float normDist_rb = length(diff_rb);\n float mask_rb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rb);\n float final_rb = mix(1.0, mask_rb, in_rb);\n\n // step 3: Get the minimum value from the four corners (to ensure that if any corner requires transparency it is applied)\n float finalAlpha = min(min(final_lt, final_rt), min(final_lb, final_rb));\n\n // step 4: Final output color\n outputColor = vec4(c.rgb, c.a * finalAlpha);\n }\n "),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||e.isContextLost()||ae("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()||ae("webgl2 Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},$r.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 a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),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=a},$r.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var i=this.initTexture();this.yTextureRef=i,this.oyTextureRef=i;var a=this.initTexture();this.uTextureRef=a,this.ouTextureRef=a;var n=this.initTexture();this.vTextureRef=n,this.ovTextureRef=n,e&&this.BindTextures(Ue),this.waterMarkTextureRef=this.initTexture();var o=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(o,5),this.waterMarkSamplerRef=o;var s=this.initTexture(),d=t.getUniformLocation(r,"cursorSampler");if(t.uniform1i(d,4),this.cursorTextureRef=s,this.cursorSamplerRef=d,this.cursorInfoRef=t.getUniformLocation(r,"cursorInfo"),this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var l=this.initTexture(),c=t.getUniformLocation(r,"maskSampler");t.uniform1i(c,4),this.maskTextureRef=l}this.colorRangeRef=t.getUniformLocation(r,"colorRange"),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"),this.ul_enable_rounded_corner=t.getUniformLocation(r,"u_enable_rounded_corner"),this.ul_radius_lt_x=t.getUniformLocation(r,"u_radius_lt_x"),this.ul_radius_lt_y=t.getUniformLocation(r,"u_radius_lt_y"),this.ul_radius_lb_x=t.getUniformLocation(r,"u_radius_lb_x"),this.ul_radius_lb_y=t.getUniformLocation(r,"u_radius_lb_y"),this.ul_radius_rt_x=t.getUniformLocation(r,"u_radius_rt_x"),this.ul_radius_rt_y=t.getUniformLocation(r,"u_radius_rt_y"),this.ul_radius_rb_x=t.getUniformLocation(r,"u_radius_rb_x"),this.ul_radius_rb_y=t.getUniformLocation(r,"u_radius_rb_y"),this.ul_aa_width=t.getUniformLocation(r,"u_aa_width"),this.ul_viewport_rect=t.getUniformLocation(r,"u_viewport_rect")},$r.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==Ue){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let a=t.getUniformLocation(r,"vSampler");t.uniform1i(a,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 a=t.getUniformLocation(r,"uSampler");t.uniform1i(a,0);let n=t.getUniformLocation(r,"vSampler");t.uniform1i(n,0)}else if(2==e){let e=t.getUniformLocation(r,"ySampler");t.uniform1i(e,0);let i=t.getUniformLocation(r,"uSampler");t.uniform1i(i,1);let a=t.getUniformLocation(r,"vSampler");t.uniform1i(a,0)}let i=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(i,0);let a=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+4),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(a,4)):t.uniform1i(a,0);let n=t.getUniformLocation(r,"cursorSampler");t.uniform1i(n,0);let o=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(o,5)},$r.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},$r.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},$r.prototype.cleanup=function(){let e=this.canvasElement,t=Gr.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=Hr,e.addEventListener("webglcontextlost",Hr,{capture:!1})),this.cleanupRoundedCornerRadius(),this.isAvaiable()){var r=this.contextGL;r.deleteProgram(this.program),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE2),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE3),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE4),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE5),r.bindTexture(r.TEXTURE_2D,null),r.deleteTexture(this.yTextureRef),r.deleteTexture(this.uTextureRef),r.deleteTexture(this.vTextureRef),r.deleteTexture(this.cursorTextureRef),r.deleteTexture(this.waterMarkTextureRef),r.bindBuffer(r.ARRAY_BUFFER,null),r.deleteBuffer(this.vertexPosBuffer),r.deleteBuffer(this.texturePosBuffer),this.maskTextureRef&&r.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&r.deleteBuffer(this.masktexturePosBuffer),r.glInitSucceed=0}},$r.prototype.updateVertexInfoForSharing=function(){const[e,t,r,i]=this.vertexPos,a=this.webglVertexPos[0],n=this.webglVertexPos[3];if(e!=a||n!=i){this.webglVertexPos[0]=e,this.webglVertexPos[1]=t,this.webglVertexPos[2]=r,this.webglVertexPos[3]=i;var o=new Float32Array([r,t,e,t,r,i,e,i,1,1,-1,1,1,-1,-1,-1]),s=this.contextGL;s.bindBuffer(s.ARRAY_BUFFER,this.vertexPosBuffer),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW)}},$r.prototype.updateTextureInfoForSharing=function(){const[e,t,r,i]=this.texturePos,a=this.webglTexturePos[0],n=this.webglTexturePos[3];if(e!=a||n!=i){this.webglTexturePos[0]=e,this.webglTexturePos[1]=t,this.webglTexturePos[2]=r,this.webglTexturePos[3]=i;var o=new Float32Array([r,t,e,t,r,i,e,i,1,0,0,0,1,1,0,1]),s=this.contextGL;s.bindBuffer(s.ARRAY_BUFFER,this.texturePosBuffer),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW)}},$r.prototype.updateVertexInfoForMultiView=function(e,t,r,i,a){var n,o,s,d,l=this.contextGL;if(this.isUseFillMode({width:r,height:i,rotation:a}))n=0,o=0,s=1,d=1;else{var c=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?i:r,u=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?r:i,h=c/u*t;h>e?(n=0,s=1,d=1-(o=(t-u/c*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 _=new Float32Array([s,o,n,o,s,d,n,d,1,1,-1,1,1,-1,-1,-1]);this.viewPostion=_,l.bindBuffer(l.ARRAY_BUFFER,this.vertexPosBuffer),l.bufferData(l.ARRAY_BUFFER,_,l.DYNAMIC_DRAW)},$r.prototype.updateTextureInfoForMultiView=function(e,t,r,i,a,n,o){var s,d,l,c,u=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:i})){const a=i==this.ROTATION_CLOCK90||i==this.ROTATION_CLOCK270?o/n:n/o,u=r.left||0,h=r.top||0;if(r.width/r.height>a){const i=r.height*a;s=h/t,d=(Math.round((r.width-i)/2)+u)/e,l=(h+r.height)/t,c=d+i/e}else{const i=r.width/a;l=(s=(Math.round((r.height-i)/2)+h)/t)+i/t,c=(d=u/e)+r.width/e}}else s=qt(r.top/t,2),d=qt(r.left/e,2),l=zt((r.top+r.height)/t,2),c=zt((r.width+r.left)/e,2);var h=[d,s,c,s,c,l,d,l];i==this.ROTATION_CLOCK90&&(h.unshift(h[6],h[7]),h=h.slice(0,8)),i==this.ROTATION_CLOCK180&&(h.unshift(h[4],h[5],h[6],h[7]),h=h.slice(0,8)),i==this.ROTATION_CLOCK270&&(h.push(h[0],h[1]),h=h.slice(2,10));var _=h[0],f=h[1];if(h[0]=h[2],h[1]=h[3],h[2]=_,h[3]=f,a)if(i==this.ROTATION_CLOCK90||i==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 p=new Float32Array([...h,1,0,0,0,1,1,0,1]);u.bindBuffer(u.ARRAY_BUFFER,this.texturePosBuffer),u.bufferData(u.ARRAY_BUFFER,p,u.DYNAMIC_DRAW)},$r.prototype.getViewPosition=function(){let e=[0,0,1,1];if(!this.viewPostion)return e;const t=this.viewPostion[0],r=this.viewPostion[1],i=this.viewPostion[2],a=this.viewPostion[5];return e[0]=(1-r)/2,e[1]=(1+i)/2,e[2]=(1-a)/2,e[3]=(1+t)/2,e},$r.prototype.drawNextOutputPictureFrame=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6?arguments[6]:void 0,s=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var d=this.contextGL,l=this.yTextureRef,c=this.uTextureRef,u=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA),a=a||this.ROTATION_CLOCK0;var h=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,_=(r.top!=this.croppingParams.top||(r.left,this.croppingParams.left),o.width!=this.viewWidth||o.height!=this.viewHeight),f=(e!=this.textureWidth||this.textureHeight,a!=this.picRotation);(h||_||f)&&function(e,t,r,i,a){e.contextGL;let n=a.width,o=a.height;var s,d,l,c,u=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?r:t,h=i==e.ROTATION_CLOCK90||i==e.ROTATION_CLOCK270?t:r,_=u/h*o;_>n?(s=0,l=1,c=1-(d=(o-h/u*n)/2/o)):(d=0,c=1,l=1-(s=(n-_)/2/n)),s=parseFloat((2*s-1).toFixed(3)),l=parseFloat((2*l-1).toFixed(3)),d=parseFloat((1-2*d).toFixed(3)),c=parseFloat((1-2*c).toFixed(3)),e.vertexPos=[s,d,l,c]}(this,r.width,r.height,a,o),this.updateVertexInfoForSharing(),function(e,t,r,i,a){var n=i.top/r,o=i.left/t,s=(i.height+i.top)/r,d=(i.left+i.width)/t,l=[o,n,d,n,d,s,o,s];a==e.ROTATION_CLOCK90&&(l.unshift(l[6],l[7]),l=l.slice(0,8)),a==e.ROTATION_CLOCK180&&(l.unshift(l[4],l[5],l[6],l[7]),l=l.slice(0,8)),a==e.ROTATION_CLOCK270&&(l.push(l[0],l[1]),l=l.slice(2));var c=l[0],u=l[1];l[0]=l[2],l[1]=l[3],l[2]=c,l[3]=u;var h=new Float32Array([...l,1,0,0,0,1,1,0,1]),_=e.contextGL;_.bindBuffer(_.ARRAY_BUFFER,e.texturePosBuffer),_.bufferData(_.ARRAY_BUFFER,h,_.DYNAMIC_DRAW)}(this,e,t,r,a);let p=n?0:1;p!=this.colorRange&&(d.uniform1i(this.colorRangeRef,p),this.colorRange=p),d.viewport(o.x,o.y,o.width,o.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([o.x,o.y,o.width,o.height],0),d.uniform4fv(this.ul_viewport_rect,this.viewport_rect),d.uniform1i(this.onlyRGBARef,0),d.uniform1i(this.yuvmodeRef,Ue),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=a,this.viewWidth=o.width,this.viewHeight=o.height;var m=i,g=e*t;if(d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,l),s){var v=m.subarray(0,g);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,v)}var y=e/2*t/2;if(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,c),s){var b=m.subarray(g,g+y);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,b)}var w=y;if(d.activeTexture(d.TEXTURE2),d.bindTexture(d.TEXTURE_2D,u),s){var S=m.subarray(g+y,g+y+w);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S)}d.activeTexture(d.TEXTURE0+4),d.bindTexture(d.TEXTURE_2D,this.cursorTextureRef),d.uniform1i(this.cursorSamplerRef,4),this.hasCursor?d.uniform1i(this.cursorFlagRef,1):s&&d.texImage2D(d.TEXTURE_2D,0,d.RGBA,1,1,0,d.RGBA,d.UNSIGNED_BYTE,this.dummpyCursor),d.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),this.render(),this.hasWholeFrame=1},$r.prototype.updateCursor=function(e,t,r,i){if(this.isAvaiable()){var a=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||i!=this.lastcursorSyncId&&(this.lastcursorSyncId=i,a.activeTexture(a.TEXTURE0+4),a.bindTexture(a.TEXTURE_2D,this.cursorTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},$r.prototype.updateCursorPosInfo=function(e,t,r,i,a){if(e&&this.hasCursor){let e=t/this.croppingParams.width,n=r/this.croppingParams.height,o=i/this.croppingParams.width,s=a/this.croppingParams.height;this.cx=e,this.cy=n,this.cw=o,this.ch=s}else this.cx=0,this.cy=0,this.cw=0,this.ch=0},$r.prototype.isHasWholeFrame=function(){return this.hasWholeFrame},$r.prototype.updateWatermark=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;e<=0||t<=0||!r||r.length!=e*t*4||(this.hasWaterMark=1,this.watermarkWidth=e,this.watermarkHeight=t,i.activeTexture(i.TEXTURE0+5),i.bindTexture(i.TEXTURE_2D,this.waterMarkTextureRef),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.watermarkWidth,this.watermarkHeight,0,i.RGBA,i.UNSIGNED_BYTE,r))}},$r.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;this.isSetWatermark()&&this.watermarkWidth&&this.watermarkHeight&&(e.uniform1i(this.waterMarkFlagRef,1),e.activeTexture(e.TEXTURE0+5),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4))}},$r.prototype.drawRoundedCorner=function(){if(this.isAvaiable()){var e=this.contextGL;e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.uniform1f(this.ul_enable_rounded_corner,this.enable_rounded_corner),e.uniform1f(this.ul_radius_lt_x,this.radius_lt_x),e.uniform1f(this.ul_radius_lt_y,this.radius_lt_y),e.uniform1f(this.ul_radius_lb_x,this.radius_lb_x),e.uniform1f(this.ul_radius_lb_y,this.radius_lb_y),e.uniform1f(this.ul_radius_rt_x,this.radius_rt_x),e.uniform1f(this.ul_radius_rt_y,this.radius_rt_y),e.uniform1f(this.ul_radius_rb_x,this.radius_rb_x),e.uniform1f(this.ul_radius_rb_y,this.radius_rb_y),e.uniform1f(this.ul_aa_width,this.aa_width)}},$r.prototype.cleanupRoundedCornerRadius=function(){this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=it,this.viewport_rect=null},$r.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;this.drawRoundedCorner(),e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},$r.prototype.clear=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.hasCursor=0,this.watermarkHeight=0,this.watermarkWidth=0,this.watermarkRepeated=!1,this.hasWholeFrame=0,this.lastcursorSyncId=-1,this.cleanupRoundedCornerRadius(),e&&this.clearCanvas({R:0,G:0,B:0,A:0})},$r.prototype.clearCanvas=function(e){if(this.cleanupRoundedCornerRadius(),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)}},$r.prototype.isRGBAMode=function(e){return-1!==[Be,Ne].indexOf(e)},$r.prototype.updateRemoteVideoTextures=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=arguments.length>6?arguments[6]:void 0,s=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,l=this.yTextureRef,c=this.uTextureRef,u=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||!i||!i.length||i.length!=e*t*3/2&&!h||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;let _=n?0:1;if(this.colorRange=_,this.rotation=a,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.viewWidth=o.width,this.viewHeight=o.height,!s)return;if(d.bindTexture(d.TEXTURE_2D,l),h)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,i);var f=i,p=e*t,m=f.subarray(0,p);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,m);let g=0,v=0;this.videoMode==Ue?(g=e/2*t/2,v=g):2==this.videoMode&&(g=e*t/2,v=0);var y=f.subarray(p,p+g);if(d.bindTexture(d.TEXTURE_2D,c),v){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,y);var b=f.subarray(p+g,p+g+v);d.bindTexture(d.TEXTURE_2D,u),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,b)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,y);return!0},$r.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,r,i,a){let n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!r)return;if(!this.isAvaiable())return;var o=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(a)||(this.rotation=a),Object.assign(this.croppingParams,i),!n)return;o.bindTexture(o.TEXTURE_2D,this.yTextureRef);const s=o.RGBA,d=o.RGBA,l=o.UNSIGNED_BYTE;o.texImage2D(o.TEXTURE_2D,0,s,d,l,r)},$r.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)}},$r.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},$r.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.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),r.uniform4fv(this.ul_viewport_rect,this.viewport_rect),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()},$r.prototype.readPixelsSyncRequest=function(e,t,r,i){if(this.isAvaiable()){var a,n=this.contextGL;return this.destination&&this.destination.length==r*i*4||(this.destination=new Uint8Array(r*i*4)),a=this.destination,n.flush(),n.readPixels(e,t,r,i,n.RGBA,n.UNSIGNED_BYTE,a),a}},$r.prototype.updateSelfVideoTextures=function(e,t,r,i){let a=!(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)&&r&&r.length%4==0&&this.isAvaiable()){var o=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=n,Object.assign(this.croppingParams,i),a&&(o.bindTexture(o.TEXTURE_2D,this.yTextureRef),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,e,t,0,o.RGBA,o.UNSIGNED_BYTE,r))}},$r.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 i=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),i.uniform4fv(this.ul_viewport_rect,this.viewport_rect),t?(i.enable(i.BLEND),i.blendFunc(i.ZERO,i.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(Be),this.render()}},$r.prototype.isSetWatermark=function(){return this.hasWaterMark},$r.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},$r.prototype.setUniformFlag=function(e,t,r){if(this.isAvaiable()){var i=this.contextGL;i.uniform1i(this.onlyRGBARef,e),i.uniform1i(this.bgraModeRef,e&&r===Ne?1:0),i.uniform1i(this.cursorFlagRef,t),e||i.uniform1i(this.yuvmodeRef,r)}},$r.prototype.setVideoMode=function(e){this.videoMode=e},$r.prototype.getVideoMode=function(e){return this.videoMode},$r.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},$r.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},$r.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},$r.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},$r.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},$r.prototype.getWatermarkPosition=function(){return this.watermarkPosition},$r.prototype.setMultiView=function(e){return this.isMultiView=e},$r.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},$r.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},$r.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},$r.prototype.getFillMode=function(){return this.fillMode},$r.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},$r.prototype.getTextureIndex=function(){return this.textureindex},$r.prototype.getIndex=function(){return this.textureindex},$r.prototype.getWatermarkWidth=function(){return this.watermarkWidth},$r.prototype.getWatermarkHeight=function(){return this.watermarkHeight},$r.prototype.getTextureWidth=function(){return this.textureWidth},$r.prototype.getTextureHeight=function(){return this.textureHeight},$r.prototype.getRotation=function(){return this.rotation},$r.prototype.getCroppingParams=function(){return this.croppingParams},$r.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},$r.prototype.getAttachedCanvas=function(){return this.canvasElement},$r.prototype.getCanvasId=function(){return this.canvasID},$r.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},$r.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 a=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(a-e)<.01))},$r.prototype.setRoundedCornerRadius=function(e){e?(this.radius_lt_x=e.radius_lt_x,this.radius_lt_y=e.radius_lt_y,this.radius_lb_x=e.radius_lb_x,this.radius_lb_y=e.radius_lb_y,this.radius_rt_x=e.radius_rt_x,this.radius_rt_y=e.radius_rt_y,this.radius_rb_x=e.radius_rb_x,this.radius_rb_y=e.radius_rb_y,0===this.radius_lt_x&&0===this.radius_lt_y&&0===this.radius_lb_x&&0===this.radius_lb_y&&0===this.radius_rt_x&&0===this.radius_rt_y&&0===this.radius_rb_x&&0===this.radius_rb_y?this.enable_rounded_corner=0:this.enable_rounded_corner=1):this.enable_rounded_corner=0},$r.prototype.setAntialiasWidth=function(e){(e<=0||e>=1)&&(e=it),this.aa_width=e};const zr=$r;function qr(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)}function Yr(e,t){return e.get(Kr(e,t))}function Xr(e,t,r){return e.set(Kr(e,t),r),r}function Kr(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Qr=new WeakMap,Jr=new WeakMap;class Zr extends Pr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),qr(this,Qr,new Map),qr(this,Jr,!1),Xr(Jr,this,e)}setCanvasAlphaChannelEnability(e){Xr(Jr,this,e)}createVideoRenderDisplay(e,t,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=null,n=null,o=null,s=!1;return i&&(a=i.forceNoGL,n=i.contextOptions,o=i.webGLResources,s=i.initMask),new zr(e,t,r,a,n,o,s,Yr(Jr,this))}getVideoRenderDisplay(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=Yr(Qr,this).get(e);if(!n){let i=[];n=[i,[]],Yr(Qr,this).set(e,n);let o=new zr(e,t,0,void 0,void 0,void 0,void 0,Yr(Jr,this));o.setMultiView(!0),a&&a.set(e,o);let s=1;for(;s<=r;s++){const r=new zr(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,Yr(Jr,this));r.setMultiView(!0),i.push(r)}}let o,s=Yr(Qr,this).get(e),d=s[0],l=s[1];if(s&&d[0]&&(o=d.pop(),l.push(o)),!o){const e=s?"".concat(s.length):"undefined",t=d?"".concat(d.length):"undefined";i("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return o}onWebglContextLostForMulti(e,t){const{canvas:r}=t;let i=Yr(Qr,this).get(r);var[a,n,o]=i;[...a,...n].forEach((e=>e.clear()))}onRestoredFromLostForMulti(e,t){if(!t)return;const{canvas:r}=t;let i=Yr(Qr,this).get(r);var[a,n,o]=i;const s=[...a,...n];let d=s.find((e=>e.isLocalDisplay()));d.webglVertexPos=[0,0,0,0],d.webglTexturePos=[0,0,0,0],o.args={program:d.shaderProgram,contextgl:d.contextGL,vBuffer:d.vertexPosBuffer,tBuffer:d.texturePosBuffer,webglVertexPos:d.webglVertexPos,webglTexturePos:d.webglTexturePos},s.forEach((e=>{e!=d&&e.reinit(o.args)}))}getRenderDisplay(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=Yr(Qr,this).get(e);if(!i){let a=[],n={canvasId:t,size:1,args:{}};i=[a,[],n],Yr(Qr,this).set(e,i);const o={webglcontextlostCallback:this.onWebglContextLostForMulti.bind(this),webglcontextrestoredCallback:this.onRestoredFromLostForMulti.bind(this),params:{canvas:e,rendercanvasID:t}};let s=new zr(e,t,0,void 0,o,void 0,void 0,Yr(Jr,this));r&&r.set(e,s),a.push(s),n.args={program:s.shaderProgram,contextgl:s.contextGL,vBuffer:s.vertexPosBuffer,tBuffer:s.texturePosBuffer,webglVertexPos:s.webglVertexPos,webglTexturePos:s.webglTexturePos}}if(!i[0].length){const r=new zr(e,t,i[2].size,void 0,void 0,i[2].args,void 0,Yr(Jr,this));i[2].size++,i[0].push(r)}let a=i[0].pop();return i[1].push(a),a}recycleRenderDisplay(e,t,r){t.setWatermarkFlag(0),t.setVideoMode(We),t.clear(r);let i=Yr(Qr,this).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,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=Yr(Qr,this).get(r);(!o||o.length<2)&&a("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 r!==t&&(Yr(Qr,this).delete(r),Yr(Qr,this).set(t,o),n&&(n.delete(r),n.set(t,s))),null}}getRenderDisplayMap(){return Yr(Qr,this)}cleanup(e,t){var r;null==t||null===(r=t.cleanup)||void 0===r||r.call(t);for(const[e,t]of Yr(Qr,this)){const e=t[0],r=t[1];for(const t of e)t.cleanup();for(const e of r)e.cleanup()}Xr(Qr,this,new Map)}cleanupByCanvas(e){if(Yr(Qr,this).get(e)){let t=Yr(Qr,this).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=[],Yr(Qr,this).delete(e)}}else{var t,r;null===(t=e.display)||void 0===t||null===(r=t.cleanup)||void 0===r||r.call(t)}}}function ei(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)}function ti(e,t){return e.get(ii(e,t))}function ri(e,t,r){return e.set(ii(e,t),r),r}function ii(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var ai=new WeakMap,ni=new WeakMap,oi=new WeakMap,si=new WeakMap,di=new WeakMap;const li=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];ei(this,ai,null),ei(this,ni,null),ei(this,oi,null),ei(this,si,null),ei(this,di,!1),ri(di,this,e)}setGPUResourceMgrGetter(e){ri(si,this,e)}isEnableCanvasAlphaChannel(){return ti(di,this)}setCanvasAlphaChannelEnability(e){ri(di,this,e),ti(ai,this)&&ti(ai,this).setCanvasAlphaChannelEnability(e),ti(ni,this)&&ti(ni,this).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return ti(ai,this)||(ri(ai,this,new Ur(ti(di,this))),te("[Render] getWebGLRenderDisplayMgr")),ti(ai,this)}getWebGL2RenderDisplayMgr(){return ti(ni,this)||ri(ni,this,new Zr(ti(di,this))),ti(ni,this)}getWebGPURenderDisplayMgr(){if(!ti(oi,this)){const e=rr.getModule("webgpu_renderer_dynmod");ri(oi,this,e.exports.createWebGPURenderDisplayMgr()),ti(oi,this).setGPUResourceMgrGetter(ti(si,this).call(this,2))}return ti(oi,this)}getRenderDisplayMgr(e){switch(e){case 1:return this.getWebGLRenderDisplayMgr();case 3:return this.getWebGL2RenderDisplayMgr();case 2:return this.getWebGPURenderDisplayMgr();case 4:return $t("VIDEO_TAG has no RenderDisplayMgr!"),null;default:return null}}getVideoRenderDisplay(e,t,r,i,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=this.getRenderDisplayMgr(e).getVideoRenderDisplay(t,r,i,a,o);return s&&2===e&&(s.addRenderer(n),s.attachCanvas(t,r),s.setGPUResMgr(ti(si,this).call(this,e))),s}getRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=this.getRenderDisplayMgr(e).getRenderDisplay(t,r,a);return n&&2===e&&(n.addRenderer(i),n.attachCanvas(t,r),n.setGPUResMgr(ti(si,this).call(this,e))),n}createVideoRenderDisplay(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=this.getRenderDisplayMgr(e).createVideoRenderDisplay(t,r,i,a,n);return o&&2===e&&(o.addRenderer(a),o.attachCanvas(t,r),o.setGPUResMgr(ti(si,this).call(this,e))),o}recycleRenderDisplay(e,t,r,i){let a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];switch(e){case 2:ti(oi,this)&&ti(oi,this).recycleRenderDisplay(r,i,a);break;case 1:ti(ai,this)&&ti(ai,this).recycleRenderDisplay(t,r,a);break;case 3:ti(ni,this)&&ti(ni,this).recycleRenderDisplay(t,r,a);break;case 4:$t("VIDEO_TAG has no display")}}collectInUseRenderDisplays(e,t){let r=null;return 2===e&&ti(oi,this)&&(r=ti(oi,this).collectInUseRenderDisplays(t)),r}collectInUseRenderDisplaysByCanvas(e,t,r){let i=null;return 2===e&&ti(oi,this)&&(i=ti(oi,this).collectInUseRenderDisplaysByCanvas(t,r)),i}getRenderDisplayMap(e,t){if(1===e){if(ti(ai,this))return ti(ai,this).getRenderDisplayMap()}else if(2===e){if(ti(oi,this))return ti(oi,this).getRenderDisplayMap(t)}else if(3===e&&ti(ni,this))return ti(ni,this).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,r,i,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return ti(ai,this)?ti(ai,this).onRestoredFromContextLost(e,t,r,i,a,n):ti(ni,this)?ti(ni,this).onRestoredFromContextLost(e,t,r,i,a,n):null}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==ti(ai,this)&&ti(ai,this).cleanup(e,t),ti(ni,this)&&ti(ni,this).cleanup(e,t),null!==ti(oi,this)&&ti(oi,this).cleanup(t,r)}cleanupByCanvas(e){null!==ti(ai,this)&&ti(ai,this).cleanupByCanvas(e),null!==ti(ni,this)&&ti(ni,this).cleanupByCanvas(e),null!==ti(oi,this)&&ti(oi,this).cleanupByCanvas(e)}};function ci(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)}function ui(e,t){return e.get(_i(e,t))}function hi(e,t,r){return e.set(_i(e,t),r),r}function _i(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var fi=new WeakMap,pi=new WeakMap,mi=new WeakMap,gi=new WeakMap,vi=new WeakMap;var yi=r(7201),bi=r.n(yi);function wi(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 Ot({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}wi.prototype._qos_report_timeout=function(e,t,r,i){if(this._customer_callback){let a="".concat(e,",").concat(t,",").concat(r,",").concat(i);this._customer_callback(this._tag+"TimeOut",a)}},wi.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=bi()(t).call(t,",","|"),r=bi()(r).call(r,",","|"),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))},wi.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<t;e++)this._samples.push(-1)}this._lasted_group_time=e,this._samples.push(this._current_count),this._qos_report_samples.push(this._cureen_qos_report),this._cureen_qos_report=0,this._current_count=0,e>=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},wi.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)},wi.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},wi.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(It(e))return void this._cureen_qos_report++;if(Dt(e)){let t=Lt(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}}};class Si{constructor(e,t){this.sendsize=0,this.dropsize=0,this.presamples={sendsize:0,drop:0,time:0,size:0,nosendcount:0,dckbps:0,updatetime:0,smoothsend:0},this.channel=t,this.id=0,this.wraper=e,this.overusetime=0}send(e){this.sendsize+=e}drop(e){this.dropsize+=e}setbuffer(e){const t=performance.now(),{sendsize:r,drop:i,size:a,time:n}=this.presamples,o=t-n,s=this.sendsize-r,d=this.dropsize-i,l=e-a;if(o>150&&s>5e3){const r=100*d/s,i=8e3*(s-d-l)/(o*(this.presamples.nosendcount+1)),a=8e3*s/o,n=8e3*(e+d+Math.max(l/2,0)),c=0==i?5e3:n/i;if(0==i?this.presamples.nosendcount++:(this.presamples.nosendcount=0,this.presamples.dckbps=i),0==this.presamples.smoothsend)this.presamples.smoothsend=a;else{const e=.5;this.presamples.smoothsend=e*this.presamples.smoothsend+a*(1-e)}r>10&&e>16384||o<500&&c>500?0==this.overusetime?this.overusetime=Math.min(250,o)/2:this.overusetime+=Math.min(250,o):e<16384&&c<100&&(this.overusetime=0);const u=i||this.presamples.dckbps/(this.presamples.nosendcount+1),h=u/this.presamples.smoothsend;if(this.overusetime>700&&h<.75&&t>this.presamples.updatetime+3e3){const e={status:1,dckbps:u,sendkbps:this.presamples.smoothsend,overusetime:this.overusetime,nosendcount:this.presamples.nosendcount};this.wraper._onbadnet(e),this.presamples.updatetime=t}this.presamples.sendsize=this.sendsize,this.presamples.drop=this.dropsize,this.presamples.size=e,this.presamples.time=t}}start(){this.id||(this.presamples.time=performance.now(),this.id=setInterval((()=>{let e=this.channel.bufferedAmount;this.setbuffer(e)}),100))}stop(){this.id&&(clearInterval(this.id),this.id=0)}}class Ei{constructor(e,t,r,i,a,n){this.id=e,this.tag=a||"",this.type=t,this.datachannel=r,this._recv_statistic=null,this.onmessageFn=()=>{},this.disconnectedFn=null,this.connectedFn=null,this._status=Ei.UNINIT,this.target_thread=i,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{},this.bsuppend=!1,this.mgr=n,this.bufferIncreaseCount=0,this.lastBufferedAmount=0,this.highWaterMarkCount=0,this.sendcount=0,this.sendStatic=null,this.enableSendStatic=!1,this.onnetbadFn=e=>{}}isReady(){return this._status===Ei.CONNECTED}isTransfered(){return!!this.transfered}send(e){if(this.enableSendStatic){if(this.sendcount++,this.sendStatic.send(e.length),this.datachannel.bufferedAmount>65536)return void this.sendStatic.drop(e.length);if(this.datachannel.bufferedAmount>32768&&(this.sendcount%5==0||21==e[4]&&1==e[1]&&51==e[13]))return void this.sendStatic.drop(e.length)}this.datachannel.send(e),this._send_statistic.sample(!1)}open(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.target_thread)try{var t;return this.target_thread.postMessage({command:134,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists,tag:this.tag},[this.datachannel]),this.transfered=!0,this.datachannel=null,void(null===(t=this.mgr)||void 0===t||t.addRTCChannel(this))}catch(e){this.target_thread=null}this._addEventListener(e)}close(){var e;null===(e=this.mgr)||void 0===e||e.removeRTCChannel(this);let t=this.disconnectedFn;this.transfered&&this.target_thread&&this.target_thread.postMessage({command:135,id:this.id,type:this.type}),this._status!=Ei.DISCONNECT&&this._clear(),this._status=Ei.DISCONNECT,null==t||t()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}onbadnet(e){this.onnetbadFn=e||(e=>{})}_onbadnet(e){this.onnetbadFn(e)}_addEventListener(e){this.datachannel.onmessage=e?this._onmessage2.bind(this):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==Ei.UNINIT&&this._onopen()}_onmessage2(e){this._status==Ei.UNINIT&&this._onopen(),this._recv_statistic.sample(!1),this.onmessageFn(e)}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;if(this._status=Ei.CONNECTED,!this.transfered){const e=this.report_monitor_func;if(!this._send_statistic){const t=this.tag?this.tag+"_SEND":3==this.type?"VDCS":"ADCS";this._send_statistic=new wi({tag:t,report_call:e})}if(!this._recv_statistic){const t=this.tag?this.tag+"_RECV":3==this.type?"VDCR":"ADCR";this._recv_statistic=new wi({tag:t,report_call:e})}this._send_statistic.start(),this._recv_statistic.start(),this.enableSendStatic=3==this.type,this.sendStatic=new Si(this,this.datachannel),this.enableSendStatic&&this.sendStatic.start()}var r;t!=Ei.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=Ei.DISCONNECT;let r=this.disconnectedFn;this._clear(),t!=Ei.DISCONNECT&&(null==r||r())}_clear(){var e,t,r;!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===(r=this.sendStatic)||void 0===r||r.stop(),null==i||i.close()}mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case 126:this._onclose();break;case 124:this._onopen();break;case 125:this._onerror(t.ev);break;case s:this.report_monitor_func(t.tag,t.data)}}}tt(Ei,"UNINIT",0),tt(Ei,"CONNECTED",1),tt(Ei,"DISCONNECT",2);function Mi(e,t,r){if(!e)return;let i=Fi.dataTransportMgr;i.type===Ri.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:T,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:T,transportId:e.id,sender:r,reciver:t}))}class Ri{constructor(e){let t=e||{};this.type=t.type||Ri.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.transportListeners=[],this.onRemoteTransportFn=()=>{}}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,a=this.transportlists.find((e=>e.id===r));if(a||t==R)switch(t){case R:this.addRemoteTransport(e.data,null);break;case 136:a.setMsgPort(i||new Pi);break;case T:a.setSabBuffer(e.data.sender,e.data.reciver);break;case 132:a.remote=null,this.removeTransport(a)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i}=t.data,a=this.transportlists.find((e=>e.id===i));switch(r){case R:this.addRemoteTransport(t.data,e);break;case T:this.setSabBufferInfo(a,t.data.sender,t.data.reciver);break;case 132:a.remote==e&&(a.remote=null),this.removeTransport(a)}}createTransport(e){this.transportlists.push(e),setTimeout((()=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!0)}))}),0)}transportIsExit(e){return-1!=this.transportlists.indexOf(e)}closeTransport(e){let t=this.transportlists.indexOf(e);return-1!=t&&(this.transportlists.splice(t,1),setTimeout((()=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!1)}))}),0),!0)}createRemoteTransportRPC(e,t){let r={cmd:R,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransportRPC(e,t){t.postMessage({cmd:132,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUfferRPC(e,t){var r,i,a,n;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:T,transportId:e.id,sender:null===(a=e.sabInfo)||void 0===a?void 0:a.sender,reciver:null===(n=e.sabInfo)||void 0===n?void 0:n.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:a}=e,n=this.createMsgSocketTransport(a,r);var o;n.id=r,n.remote=t,n.portInfo=i,i?n.setMsgPort(n.portInfo):this.bindMessageChannel(n),i&&(null===(o=this.onRemoteTransportFn)||void 0===o||o.call(this,n))}removeTransport(e){-1!=this.transportlists.indexOf(e)&&(this.closeTransport(e),e.close(),e.remote&&this.closeRemoteTransportRPC(e,e.remote),this.closeTransportForTargetThread(e))}createMsgSocketTransport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null;return r=new Fi({mgr:this,sock:new Ci,type:e,local:!0,id:t}),r}bindMessageChannel(e){if(this.type!=Ri.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:136,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,r){this.type==Ri.THREAD_MAIN&&(e.sabInfo||(e.sabInfo={}),r&&(r.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:r},0!=e.target_thread&&(1!=e.target_thread?this.setRemoteTransportSABBUfferRPC(e,e.target_thread):e.setSabBuffer(t,r)))}removeTransportByRemote(e){let t=[];for(let r=0;r<this.transportlists.length;r++){let i=this.transportlists[r];i.remote===e&&t.push(i)}for(let e=0;e<t.length;e++)this.removeTransport(t[e])}reinit(){let e=[...this.transportlists];for(let t=0;t<e.length;t++)this.removeTransport(e[t])}getTransportByType(e){for(let t in this.transportlists){let r=this.transportlists[t],i=1==r.target_thread;if(r.type==e&&i)return r}return null}addTransportListChangeListener(e){-1==this.transportListeners.indexOf(e)&&this.transportListeners.push(e)}remoteTransportListChangeListener(e){let t=this.transportListeners.indexOf(e);-1!=t&&this.transportListeners.splice(t,1)}checkTransport(e){this.transportlists.forEach((t=>{if(!e.transportlists.includes(t.type))return;let r=e.target_thread||1;this.addTransportForTargetThread(t,r)}))}checkTransportForThread(){setTimeout((()=>{this.transportlists.forEach((e=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!0)}))}))}),0)}addTransportForTargetThread(e,t){const r=t;var i,a,n,o;e.target_thread!=r&&0!=r&&(this.type==Ri.THREAD_MAIN&&0!=e.target_thread&&e.target_thread!=r&&(this.closeTransportForTargetThread(e),this.bindMessageChannel(e)),e.target_thread=r,1!=r?(this.createRemoteTransportRPC(e,r),this.setRemoteTransportSABBUfferRPC(e,r)):(e.portInfo&&e.setMsgPort(e.portInfo),(null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(a=e.sabInfo)&&void 0!==a&&a.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)))}closeTransportForTargetThread(e){0!=e.target_thread&&1!=e.target_thread&&this.type==Ri.THREAD_MAIN&&this.closeRemoteTransportRPC(e,e.target_thread),e.target_thread=0}}tt(Ri,"THREAD_MAIN",1),tt(Ri,"THREAD_SUB",2);const Ti={AUDIO_ENCODE:4,AUDIO_DECODE:5,MAUDIO_DECODE:7,SHARE_ENCODE:8,SHARE_DECODE:9,MSHARE_DECODE:11,VIDEO_ENCODE:12,VIDEO_DECODE:13,AUDIO_NETRTC:64,VIDEO_NETRTC:128,MESH_NETRTC:256,CUSTOME_TYPE:1<<31,MESHBRIDGEAUDIO:1<<31|1,MESHBRIDGE:1<<31|2},xi=e=>{};class Ai{constructor(){this.onmessage=xi,this.status=Ai.CLOSED,this.onopen=xi,this.onclose=xi,this.onwer=null}send(e){}delete(){this.onmessage=xi,this.onopen=xi,this.onclose=xi,this.close()}sendVideo(e,t){}sendWasm(e){}sendCommand(e){}open(){this.status=Ai.OPEN,this.onopen()}close(){this.status=Ai.CLOSED,this.onclose()}isReady(){return!1}}tt(Ai,"OPEN",1),tt(Ai,"CLOSED",2);class Ci extends Ai{constructor(){super({}),this.sab={},this.port=null,this.onmessage=xi,this.sender=xi,this.videoSender=xi,this.reciver=xi,this.wasmSender=xi,this.oncommand=e=>{}}sendCommand(e){var t;null===(t=this.port)||void 0===t||t.postMessage({cmd:130,data:e})}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=xi,this.sender=xi,this.videoSender=xi,this.reciver=xi,this.wasmSender=xi;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(xi),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=xi),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=Ai.OPEN||this.onopen()}close(){this.status=Ai.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case M:this.reciver();break;case E:this.onmessage(r,0);break;case 129:this.status=r,this.status==Ai.OPEN?this.onopen():this.onclose();break;case 130:this.oncommand(r)}}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:M})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:M})},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:M})}):(this.sender=e=>{this.port.postMessage({cmd:E,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:E,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:E,data:r},[r.buffer])});let{sabqueue:a,consumer:n,useCopy:o,interval:s,offset:d}=t||{};if(n&&(n.cancelConsume(),n=null),a){const e=o?e=>{this.onmessage(e,0)}:d?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=Fi.dataTransportMgr.monitorlogfn;if(s&&i){var l;let e=new Ot({tag:"WCL_M,VDRB"+(null===(l=this.onwer)||void 0===l?void 0:l.type),interval:1e4,reportcallback:Ii});r=e.timeoutReport.bind(e)}n=new kt(a,e,r),t.consumer=n,s?n.consume(s,o):this.reciver=()=>{n.consumeAll(o)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=xi,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:a,length:n,useOneElement:o}=e,s=new Ct(a>0?t.buffer:t,void 0,void 0,!!o,a,n,a>0?t:null);this.sab.sender={sabqueue:s,interval:i,useCopy:r,offset:a}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:a,offset:n,length:o,useOneElement:s}=t,d=new Ct(n>0?e.buffer:e,void 0,void 0,!!s,n,o,n>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:d,interval:a,useCopy:i,offset:n}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:129,data:e})):console.error("MsgQueueSocket not initialized")}}class ki{constructor(){}TransportListChange(e,t){}}class Fi{constructor(e){this.onmessage=xi,this.onopen=xi,this.onclose=xi,this.oncommand=xi,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new Ai,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.oncommand=this._oncommand.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=0,this.local=!!e.local,this.args=e.args,this._create()}_create(){let e=Fi.dataTransportMgr;e.createTransport(this),!this.local&&e&&e.mainThread&&e.type==Ri.THREAD_SUB&&e.createRemoteTransportRPC(this,e.mainThread)}_close(){let e=Fi.dataTransportMgr;const t=e.transportIsExit(this);!this.local&&t&&e.type==Ri.THREAD_SUB&&e.closeRemoteTransportRPC(this,e.mainThread),t&&e.closeTransport(this)}_oncommand(e){this.oncommand(e)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendCommand(e){this.sock.sendCommand(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 Ci))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof Ci))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof Ci&&this.sock.setStatus(e)}}tt(Fi,"UDP",0),tt(Fi,"TCP",1),tt(Fi,"RLB_UDP",2),tt(Fi,"dataTransportMgr",null);class Pi{constructor(e){this.sock=null,this.onmessage=xi}isReady(){return!1}send(){}sendVideo(){}sendCommand(){}setStatus(e){}}function Ii(e,t,r,i){var a;null===(a=Ri.monitorlogfn)||void 0===a||a.call(Ri,e,"".concat(t,",").concat(r,",").concat(i))}class Li extends ki{constructor(){super()}TransportListChange(e,t){}TransportStatus(e,t,r){}DataChannelStatus(e,t){}}class Di extends ki{constructor(e){super(),this.transportMap={},this.type=e.type,this.mgr=e,this.channellists=[],this.channelListeners=[]}addDataChannel(e){if(e instanceof Ei){if(-1==this.channellists.findIndex((t=>t==e))){this.channellists.push(e);try{this.mgr.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!0)}))}}else console.error("channel must be a DataChannelWrapper")}TransportListChange(e,t){let r=this.getChannelByTransportType(e.type);if(t&&null!=r&&r.isReady()){let t=r.target_thread||1;this.mgr.addTransportForTargetThread(e,t)}t||this.mgr.closeTransportForTargetThread(e),r&&this.channelListeners.forEach((i=>{i.TransportStatus(e,r,t)})),this.channelListeners.forEach((r=>{r.TransportListChange(e,t)}))}removeDataChannel(e){if(!(e instanceof Ei))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1),this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!1)}))}addMediaChannelController(e){e instanceof Li?-1==this.channelListeners.findIndex((t=>t==e))&&this.channelListeners.push(e):console.error("controller must be a MediaChannelController")}rmMediaChannelController(e){let t=this.channelListeners.findIndex((t=>t==e));-1!=t&&this.channelListeners.splice(t,1)}getChannelByTransportType(e){for(let t=0;t<this.channellists.length;t++){let r=this.channellists[t];if(r.isReady()&&r.transportlists.includes(e))return r}return null}reinit(){let e=this.channellists;this.channellists=[],e.forEach((e=>{e.isReady()&&(e.close(),this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!1)})))}))}}tt(Di,"target",null);class Oi{constructor(){this._interval=-1,this.monitorworkers={},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.timeoutcount=0,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===x&&(e.lastedtimestamp=r.timestamp,e.timeoutcount=0)}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:x,timestamp:Date.now()})}),Oi.INTREVAL_TIME_MS));const r=()=>{this._interval=setTimeout((()=>{r();let e=Oi.instance,t=Object.keys(e.monitorworkers),i=Date.now();t.forEach((t=>{let r=e.monitorworkers[t];r.timeoutcount>5?i-r.lastedtimestamp>Oi.HEART_TIMEOUT_MS&&(e.timeoutcallbackfn(r.id,i-r.lastedtimestamp),r.lastedtimestamp=i):(r.timeoutcount++,r.worker.postMessage({command:138}))}))}),Oi.INTREVAL_TIME_MS)};r()}close(){try{this._interval&&clearTimeout(this._interval),this._interval=-1,Object.keys(this.monitorworkers).forEach((e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}))}catch(e){}}}var Wi,Bi,Ui,Ni,Vi,Gi,ji,Hi,$i;tt(Oi,"INTREVAL_TIME_MS",3e3),tt(Oi,"HEART_TIMEOUT_MS",15e3),tt(Oi,"MAX_HEART_TIMEOUT_MS",3e4),tt(Oi,"instance",null),function(e){e.ADD_VIDEO_PORT="add_video_port",e.ADD_SHADOW_PORT="add_shadow_port",e.ADD_VIDEO_PROCESSOR="add_video_processor",e.PROCESSOR_READY="processor_ready",e.PROCESSOR_ERROR="processor_error"}(Wi||(Wi={})),function(e){e.ADD_SHARE_PORT="add_share_port",e.ADD_SHADOW_PORT="add_shadow_port",e.ADD_SHARE_PROCESSOR="add_share_processor",e.ADD_SHARE_ENCODE_PORT="add_share_encode_port",e.PROCESSOR_READY="processor_ready",e.PROCESSOR_ERROR="processor_error"}(Bi||(Bi={})),($i=Ui||(Ui={})).INIT_PROCESSOR="init_processor",$i.UNINIT_PROCESSOR="uninit_processor",$i.INIT_OUTPUT_CANVAS="init_output_canvas",$i.OUTPUT_WRITABLE_STREAM="output_writable_stream",$i.INPUT_READABLE_STREAM="input_readable_stream",$i.FRAME_DATA="frame_data",$i.START_REQUEST_FRAME="start_request_frame",$i.STOP_REQUEST_FRAME="stop_request_frame",$i.REQUEST_FRAME="request_frame",$i.FRAME_CALLBACK="frame_callback",$i.RESOLUTION_CHANGE="RESOLUTION_CHANGE",$i.PROCESSOR_WORKER_ERROR="PROCESSOR_WORKER_ERROR",$i.PROCESSOR_STOP_COMPLETE="PROCESSOR_STOP_COMPLETE",Ni||(Ni={});class zi{constructor(e,t,r){this.port=e,this.name=t,this.VideoFrameNeeded=r}setStream(e){const t=e.getVideoTracks()[0],r=t.getSettings(),{frameRate:i=24}=r;this.trackProcessor=new MediaStreamTrackProcessor({track:t});const a=this.trackProcessor.readable;this.port.postMessage({cmd:Ui.INPUT_READABLE_STREAM,frameRate:Math.min(i,24),readableStream:a,processorName:this.name},[a]),this.port.postMessage({cmd:Ui.START_REQUEST_FRAME,frameRate:i,processorName:this.name,VideoFrameNeeded:this.VideoFrameNeeded})}removeStream(){this.port.postMessage({cmd:Ui.STOP_REQUEST_FRAME,processorName:this.name})}destroy(){this.removeStream()}}class qi{constructor(e,t,r=!1,i=!1){this.port=e,this.name=t,this.isIOSDevice=r,this.VideoFrameNeeded=i,this.onMessage=e=>{if(e.data.cmd===Ui.REQUEST_FRAME&&this.captureVideoEleLoaded){let e=this.captureVideoEle.videoWidth,t=this.captureVideoEle.videoHeight;if(e<=0||t<=0)return;this.isIOSDevice&&(this.captureCanvasEle.width=e,this.captureCanvasEle.height=t,this.captureCanvasEleCtx.drawImage(this.captureVideoEle,0,0,e,t));const r=new VideoFrame(this.isIOSDevice?this.captureCanvasEle:this.captureVideoEle,{timestamp:1e3*performance.now()});this.port.postMessage({cmd:Ui.FRAME_DATA,frame:r,processorName:this.name}),r.close()}},this.port.addEventListener("message",this.onMessage)}createCaptureVideoElement(e){this.captureVideoEle=document.querySelector("#video-processor-video"),this.captureVideoEle||(this.captureVideoEle=document.createElement("video"),this.captureVideoEle.autoplay=!0,this.captureVideoEle.playsInline=!0,this.captureVideoEle.id="video-processor-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.isIOSDevice&&!this.captureCanvasEle&&(this.captureCanvasEle=document.createElement("canvas"),this.captureCanvasEleCtx=this.captureCanvasEle.getContext("2d")),this.captureVideoEle.srcObject=e,this.captureVideoEle.addEventListener("loadedmetadata",(()=>{this.captureVideoEleLoaded=!0})),this.captureVideoEle.play()}setStream(e){const t=e.getVideoTracks()[0].getSettings(),{frameRate:r=24}=t;this.createCaptureVideoElement(e),this.port.postMessage({cmd:Ui.START_REQUEST_FRAME,frameRate:Math.min(r,24),processorName:this.name,VideoFrameNeeded:this.VideoFrameNeeded})}removeStream(){this.port.postMessage({cmd:Ui.STOP_REQUEST_FRAME,processorName:this.name})}destroy(){this.port.removeEventListener("message",this.onMessage)}}class Yi{constructor(e,t){this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"});const r=this.trackGenerator.writable;e.postMessage({cmd:Ui.OUTPUT_WRITABLE_STREAM,writableStream:r,processorName:t},[r]),this.stream=new MediaStream([this.trackGenerator])}getStream(){return this.stream}}class Xi{constructor(e,t,r){this.canvas=document.createElement("canvas"),this.canvas.width=1,this.canvas.height=1,this.stream=this.canvas.captureStream(24),r?r.canCanvasAsOffscreenAfterCaptureStream?this.offScreenCanvas=this.canvas.transferControlToOffscreen():this.offScreenCanvas=null:this.offScreenCanvas=this.canvas.transferControlToOffscreen()}getOutputCanvas(){return this.offScreenCanvas}getStream(){return this.stream}getStreamingCanvas(){return this.canvas}}class Ki{constructor(e,t,r=!1,i=!1){this.processorName=e,this.port=t,this.isIOSDevice=r,this.VideoFrameNeeded=i,this.frameCallback=null,this.callback=null,this.onMessage=e=>{var t,r;e.data.cmd===Ui.FRAME_CALLBACK?null===(t=this.frameCallback)||void 0===t||t.call(this,e.data.frame):null===(r=this.callback)||void 0===r||r.call(this,e.data.cmd,e.data.data)},this.port.start(),this.port.addEventListener("message",this.onMessage);const a=this.getOutPutCanvas();a?this.port.postMessage({cmd:Ui.INIT_OUTPUT_CANVAS,canvas:a,processorName:e},[a]):this.port.postMessage({cmd:Ui.INIT_OUTPUT_CANVAS,processorName:e})}init(){this.port.postMessage({cmd:Ui.INIT_PROCESSOR,processorName:this.processorName})}addCallback(e){this.callback=e}removeCallback(){this.callback=null}uninit(){this.port.postMessage({cmd:Ui.UNINIT_PROCESSOR,processorName:this.processorName}),this.port.removeEventListener("message",this.onMessage)}getOutPutCanvas(){return null}getStream(){throw new Error("Method not implemented.")}setStream(e){throw new Error("Method not implemented.")}removeStream(){}onFrame(e){throw new Error("Method not implemented.")}addFrameCallback(e){throw new Error("Method not implemented.")}removeFrameCallback(){}}class Qi extends Ki{constructor(e,t){super(e,t),this.processorName=e,this.port=t}onFrame(e){this.port.postMessage({cmd:Ui.FRAME_DATA,frame:e,processorName:this.processorName})}addFrameCallback(e){this.frameCallback=e}removeFrameCallback(){this.frameCallback=null}}class Ji extends Ki{constructor(e,t,r,i){super(e,t,r,i),this.processorName=e,this.port=t,this.isIOSDevice=r,this.VideoFrameNeeded=i,this.initGenerator()}initGenerator(){this.originGenerator||(this.originGenerator="function"==typeof MediaStreamTrackProcessor?new zi(this.port,this.processorName,this.VideoFrameNeeded):new qi(this.port,this.processorName,this.isIOSDevice,this.VideoFrameNeeded)),this.targetGenerator||(this.targetGenerator="function"==typeof MediaStreamTrackGenerator?new Yi(this.port,this.processorName):new Xi(this.port,this.processorName))}uninit(){var e,t,r,i;null===(t=null===(e=this.originGenerator)||void 0===e?void 0:e.destroy)||void 0===t||t.call(e),null===(i=null===(r=this.targetGenerator)||void 0===r?void 0:r.destroy)||void 0===i||i.call(r),super.uninit()}getOutPutCanvas(){var e,t;return this.initGenerator(),null===(t=(e=this.targetGenerator).getOutputCanvas)||void 0===t?void 0:t.call(e)}getStream(){return this.targetGenerator.getStream()}setStream(e){this.originGenerator.setStream(e)}removeStream(){this.originGenerator.removeStream()}addFrameCallback(e){this.frameCallback=e}}class Zi{static hasProcessor(){return this.videoProcessorAgentMap.size>0}static hasMediaStreamFrameProcessor(){return[...this.videoProcessorAgentMap.values()].some((e=>e instanceof Ji))}static addFrameCallback(e,t){this.frameCallbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addFrameCallback(t)}static addCallback(e,t){this.callbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addCallback(t)}static onFrame(e){for(const t of this.videoProcessorAgentMap.values())t.onFrame(e)}static getStream(){return[...this.videoProcessorAgentMap.values()].pop().getStream()}static setStream(e){for(const t of this.videoProcessorAgentMap.values())t.setStream(e)}static removeStream(){for(const e of this.videoProcessorAgentMap.values())e.removeStream()}static getProcessor(e){return this.videoProcessorAgentMap.get(e)}static startProcessor(e,t){t.init();const r=this.frameCallbackMap.get(e);r&&t.addFrameCallback(r);const i=this.callbackMap.get(e);i&&t.addCallback(i),this.videoProcessorAgentMap.set(e,t)}static stopProcessor(e){const t=this.getProcessor(e);t&&(t.removeFrameCallback(),t.removeCallback(),this.frameCallbackMap.delete(e),this.callbackMap.delete(e),t.removeStream(),t.uninit()),this.videoProcessorAgentMap.delete(e)}static resetProcessorManager(){for(const e of this.videoProcessorAgentMap.keys())this.stopProcessor(e)}}Zi.videoProcessorAgentMap=new Map,Zi.frameCallbackMap=new Map,Zi.callbackMap=new Map;class ea{constructor(e,t,r,i){var a;this.url=e,this.onopen=()=>{},this.onclose=()=>{},this.oncommand=()=>{},this.transportopened=!1,this.websockClosed=!1,this.dataTransport=(a=t,new Fi({sock:new Ci,type:a,local:!1,userArgs:undefined})),this.dataTransport.onopen=this._dataTransportOpen.bind(this),this.dataTransport.onclose=this._dataTransportClose.bind(this),this.dataTransport.oncommand=this._dataTransportCommand.bind(this),this.websocketopen=!1,this.senderSab=null,this.reciverSab=null,this.webtransporturl=null,this.disabletcp=!!r,this.isLSSPlayer=!!i}_dataTransportCommand(e){let{cmd:t}=e;182!=t||this.websockClosed||(this.websocketopen=!0,this.onopen()),t==P&&this.onclose(),this.oncommand(e)}_dataTransportOpen(){this.transportopened=!0,this.disabletcp&&this.onopen();{const e=this.isLSSPlayer,t={cmd:175,data:this.disabletcp,isLSSPlayer:e};this.dataTransport.sendCommand(t)}const e={cmd:180,data:this.url};this.url&&!this.disabletcp&&this.dataTransport.sendCommand(e);const t={cmd:176,data:this.webtransporturl};this.webtransporturl&&this.dataTransport.sendCommand(t),(this.senderSab||this.reciverSab)&&Mi(this.dataTransport,this.senderSab,this.reciverSab)}_dataTransportClose(){this.transportopened=!1}resetURL(e){this.websockClosed=!1;let t=this.url;this.url=e;const r={cmd:180,data:this.url};this.transportopened&&this.url&&t!=this.url&&this.dataTransport.sendCommand(r)}resetWebrTransportUrl(e){let t=this.webtransporturl;this.webtransporturl=e;const r={cmd:176,data:e};this.transportopened&&this.webtransporturl&&t!=this.webtransporturl&&this.dataTransport.sendCommand(r)}closeWebsocket(){let e=this.url;this.websockClosed=!0,this.url=null;const t={cmd:181,data:this.url};this.transportopened&&e&&this.dataTransport.sendCommand(t)}closeWebTransport(){let e=this.webtransporturl;this.webtransporturl=null;const t={cmd:177,data:e};this.transportopened&&e&&this.dataTransport.sendCommand(t)}isReady(){return this.websocketopen||this.disabletcp&&this.transportopened}setOnMessage(e){this.dataTransport.onmessage=e}sendWasm(e){this.dataTransport.sendWasmData(e)}send(e){this.dataTransport.send(e)}sendVideo(e,t){this.dataTransport.sendVideo(e,t)}sendCommand(e){this.transportopened&&this.dataTransport.sendCommand(e)}close(){this.dataTransport&&(this.dataTransport.onopen=()=>{},this.dataTransport.onclose=()=>{},this.dataTransport.oncommand=()=>{},this.dataTransport.sendCommand({cmd:181}),this.dataTransport.sendCommand({cmd:177}),this.dataTransport.close())}setSabBuffer(e,t){this.senderSab=e,this.reciverSab=t,this.transportopened&&Mi(this.dataTransport,e,t)}sendCmdData(e){const t={cmd:198,data:new Uint8Array(e)};this.dataTransport.sendCommand(t)}}!function(e){e[e.Unknow=0]="Unknow",e[e.MediaCommand=1]="MediaCommand",e[e.P2PControl=2]="P2PControl",e[e.MeshControl=3]="MeshControl"}(Vi||(Vi={})),function(e){e[e.normal=0]="normal",e[e.child=1]="child",e[e.parent=2]="parent",e[e.invalid=31]="invalid"}(Gi||(Gi={})),function(e){e[e.bridge=0]="bridge",e[e.setRole=1]="setRole",e[e.connectTestParams=2]="connectTestParams",e[e.reportConnectedSet=3]="reportConnectedSet",e[e.notifyChildParentLeave=4]="notifyChildParentLeave",e[e.notifyParentChildLeave=5]="notifyParentChildLeave",e[e.availableParents=6]="availableParents",e[e.updateNodeStatus=7]="updateNodeStatus",e[e.joinSuccess=8]="joinSuccess",e[e.kickChild=9]="kickChild",e[e.leaveParent=10]="leaveParent",e[e.subscriptionMap=11]="subscriptionMap",e[e.channelopt=12]="channelopt",e[e.joinSuccessConfirm=13]="joinSuccessConfirm",e[e.registerMeshNode=14]="registerMeshNode",e[e.meshAllowTalk=15]="meshAllowTalk",e[e.statInfo=16]="statInfo",e[e.adapt=17]="adapt",e[e.refershConnectParams=18]="refershConnectParams",e[e.joinConnectedSetConfirm=19]="joinConnectedSetConfirm",e[e.registerMeshNodeResult=20]="registerMeshNodeResult",e[e.meshSigType=21]="meshSigType",e[e.meshSigKey=22]="meshSigKey",e[e.mediaAccess=23]="mediaAccess",e[e.unknown=1e3]="unknown"}(ji||(ji={})),function(e){e[e.Unknow=0]="Unknow",e[e.Offer=1]="Offer",e[e.Answer=2]="Answer"}(Hi||(Hi={}));var ta=Object.defineProperty,ra=(e,t,r)=>((e,t,r)=>t in e?ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const ia=new class{constructor(){ra(this,"_enabled",!1),ra(this,"_reportLog",(()=>{})),ra(this,"_cacheName",""),ra(this,"_enableLocalDebugLog",!1),ra(this,"_resourcePath","")}get enabled(){return this._enabled}set enabled(e){this._enabled=e}get reportLog(){return this._reportLog}set reportLog(e){this._reportLog=e}get cacheName(){return this._cacheName}set cacheName(e){this._cacheName=e}get enableLocalDebugLog(){return this._enableLocalDebugLog}set enableLocalDebugLog(e){this._enableLocalDebugLog=e}get resourcePath(){return this._resourcePath}set resourcePath(e){this._resourcePath=e}},aa=(...e)=>{if(!ia.enableLocalDebugLog)return;const t=e[0];console.log(`FWB | ${t} -`,...e.slice(1))},na=e=>{let t=`/${e.fileName}`;e.hash&&(t=`/${e.fileName}/${e.hash}`);const r=[];return e.cdnPath&&r.push(`v=${e.cdnPath}`),e.timestamp&&r.push(`t=${e.timestamp}`),r.length>0?`${t}?${r.join("&")}`:t},oa=()=>ia.cacheName,sa=e=>"function"==typeof e,da=void 0!==self.caches&&void 0!==self.Cache&&!!(sa(self.caches.open)&&sa(self.caches.delete)&&sa(self.Cache.prototype.match)&&sa(self.Cache.prototype.put)&&sa(self.Cache.prototype.delete)&&sa(self.Cache.prototype.keys)),la=e=>new Promise((t=>setTimeout(t,e))),ca=(e,t,r)=>Number.isInteger(null==r?void 0:r.maxRetries)&&(null==r?void 0:r.maxRetries)>1?(async(e,t,r)=>{let i;const a=null==r?void 0:r.maxRetries,n=(null==r?void 0:r.delayMs)??-1;for(let r=0;r<a;r++)try{const r=await self.fetch(e,t);if(!r.ok)throw new Error(`Fetch resource error: ${r.status}`);return r}catch(e){if(i=e,"AbortError"===(null==e?void 0:e.name))break;r<a-1&&n>=0&&await la(n)}throw i})(e,t,r):self.fetch(e,t),ua=async({cdnPath:e,fileName:t,hash:r,size:i,fetchOptions:a,fetchCustomOptions:n})=>{try{const a=await(async(e,t)=>(async e=>{const t=await caches.open(oa()),r=new URL(e,self.location.origin),i=await t.match(r,{ignoreSearch:!0});if(!i)throw new Error("Not Found");return i})(na({fileName:e,hash:t})))(t,r),n=a.url||"",o=n.slice(0,n.length-t.length-1);return aa(`/${e}/${t}`,"get file from cache"),ia.reportLog({isHitCache:!0,isCrossRelease:o!==e,fileName:t,hash:r,size:i}),a}catch{try{const o=await(async({cdnPath:e,fileName:t,hash:r,fetchOptions:i,fetchCustomOptions:a})=>{const n=`${e}/${t}`,o=await ca(n,i,a),s=na({cdnPath:e,fileName:t,hash:r,timestamp:Date.now()});try{await(async(e,t)=>{try{const r=await caches.open(oa()),i=new URL(e,self.location.origin);await r.put(i,t.clone())}catch(e){console.error("Failed to save to cache",e)}})(s,o)}catch(r){aa(`/${e}/${t}`,"save to cache failed",r)}return o})({cdnPath:e,fileName:t,hash:r,fetchOptions:a,fetchCustomOptions:n});return aa(`/${e}/${t}`,"get file from network"),ia.reportLog({isHitCache:!1,isCrossRelease:!1,fileName:t,hash:r,size:i,cachedVersion:""}),o}catch(r){throw aa(`/${e}/${t}`,"get file from network - Failed"),r}}},ha={},_a=async(e,t)=>{ha[e]||(ha[e]={}),aa(`/${e}/${t}`,"start to get manifest");let r=ha[e].manifest;return r?(aa(`/${e}/${t}`,"get manifest from memory"),{manifest:r}):(r=await(async(e,t)=>{const r=ha[e];if(null==r?void 0:r.manifest)return r.manifest;const i=await(async(e,t)=>{const r=`${e}/manifest.json`,i=ha[e];let a=null==i?void 0:i.ongoingPromise;return a?(aa(`/${e}/${t}`,"fetchManifest","existing fetch pending"),a):(a=fetch(r,{headers:{Accept:"application/json"}}).then((async r=>{if(aa(`/${e}/${t}`,"fetchManifest","get response",r.status),ha[e].lastResponseStatus=r.status,!r.ok)throw r;const i=await r.json();return ha[e].manifest=i,aa(`/${e}/${t}`,"fetchManifest","success"),i})).finally((()=>{ha[e].ongoingPromise=void 0})),ha[e].ongoingPromise=a,aa(`/${e}/${t}`,"fetchManifest","send request"),a)})(e,t);return i})(e,t),aa(`/${e}/${t}`,"get manifest from network"),{manifest:r})},fa=async(e,t,r)=>{const i=((e,t)=>{if(!e.startsWith(t))return null;t.endsWith("/")&&(t=t.slice(0,-1));const r=e.slice(t.length+1);return r?{cdnPath:t,fileName:r}:null})(new URL(e.toString()).href,ia.resourcePath);if(!i)return ca(e,t,r);const{cdnPath:a,fileName:n}=i;aa(`/${a}/${n}`,"get file request");let o=null;try{const{manifest:e}=await _a(a,n);o=e,aa(`/${a}/${n}`,"get manifest success")}catch{return aa(`/${a}/${n}`,"get manifest failed => fallback to browser"),ca(e,t,r)}const s=null==o?void 0:o[n];return(null==s?void 0:s.hash)?ua({cdnPath:a,fileName:n,hash:s.hash,size:s.size,fetchOptions:t,fetchCustomOptions:r}):ca(e,t,r)};let pa;self.setTimeout((async()=>{const e=oa(),t=await caches.open(e);let r=[];try{r=await t.keys()}catch{return}const i=new Map;for(const e of r){const t=new URL(e.url),r=t.searchParams.get("t");if(!r)continue;const a=parseInt(r,10);if(isNaN(a))continue;const n=t.pathname.split("/").slice(0,-1).join("/");n&&(i.has(n)||i.set(n,[]),i.get(n).push({request:e,timestamp:a}))}for(const[e,r]of i){if(r.sort(((e,t)=>t.timestamp-e.timestamp)),r.length<=1)continue;let e=r.slice(2);r[0].timestamp-r[1].timestamp>5184e6&&(e=r.slice(1));for(const r of e){try{await t.delete(r.request)}catch{continue}aa(`delete from cache: ${r.request.url}`)}}}),6e4);const ma=(e,t)=>pa&&"function"==typeof pa?pa(e,t):(console.log("initializeFetchWithCache not initialized: ",e),fetch(e,t));var ga=function(e,t,r,i){return new(r||(r=Promise))((function(a,n){function o(e){try{d(i.next(e))}catch(e){n(e)}}function s(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}d((i=i.apply(e,t||[])).next())}))};function va(e){console.log(e)}self.wasmSuccessEvent=7,self.wasmFailEvent=-7,self.downloadAndInstantiateWebAssembly=async function(e,t){try{const r=await new Promise(((e,t)=>{const r=i=>{let a=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===a.command?(te("DE"),self.removeEventListener("message",r),e(a.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===a.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),te("DS"),postMessage({status:30,url:wasmUrl})}));let i=await WebAssembly.instantiate(r,e);i.instance?(self.wasmModuleToShare=i.module,t(i.instance)):(self.wasmModuleToShare=r,t(i))}catch(e){te("IF"),ie("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}},self.addEventListener("unhandledrejection",(e=>{ie("Unhandled rejection in video worker: ".concat(JSON.stringify(e.reason)),e.reason instanceof Error?e.reason:null),Ce()})),self.addEventListener("error",(e=>{ie("Unhandled exception in video worker",e),Ce()}));var ya=new ot;const ba=new class{constructor(e){ci(this,fi,""),ci(this,pi,new yr),ci(this,mi,new li),ci(this,gi,new Mr),ci(this,vi,null),hi(fi,this,e),ui(mi,this).setGPUResourceMgrGetter((()=>this.getWebGPUResMgr()))}isEnableCanvasAlphaChannel(){return ui(mi,this).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){ui(mi,this).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await ui(pi,this).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const n=ui(pi,this).getRendererType(),o=ui(pi,this).acquireRenderer(e,this.getWebGPUResMgr(n));return ui(mi,this).getVideoRenderDisplay(n,e,t,r,i,o,a)}getRenderDisplay(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const n=ui(pi,this).getRendererType(),o=ui(pi,this).acquireRenderer(e,ui(vi,this));return ui(mi,this).getRenderDisplay(n,e,t,o,a)}createWebGLVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return ui(pi,this).isWebGL2RendererType()?ui(mi,this).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):ui(pi,this).isWebGLRendererType()?ui(mi,this).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,r,null,i):($t("Can not create webgl display!!"),null)}createVideoRenderDisplay(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const a=ui(pi,this).getRendererType(),n=ui(pi,this).acquireRenderer(e,this.getWebGPUResMgr(a));return ui(mi,this).createVideoRenderDisplay(a,e,t,r,n,i)}recycleRenderDisplay(e,t,r){const i=ui(pi,this).getRendererType();ui(mi,this).recycleRenderDisplay(i,e,t,this.getWebGPUResMgr(i),r)}renderFor(e){if(ui(pi,this).isWebGPURendererType()){const t=ui(pi,this).getRendererType(),r=ui(mi,this).collectInUseRenderDisplays(t,e);r&&r.forEach((e=>{const r=ui(pi,this).acquireRenderer(e.canvas,this.getWebGPUResMgr(t));ui(gi,this).render(r,e.renderDisplays)}))}}renderWith(e){if(ui(pi,this).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const r=ui(pi,this).getRendererType(),i=ui(pi,this).acquireRenderer(t,this.getWebGPUResMgr(r)),a=[];a.push(e),ui(gi,this).render(i,a)}}}getRenderDisplayMap(e){const t=ui(pi,this).getRendererType();return ui(mi,this).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,r,i,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return ui(pi,this).isWebGLRendererType()||ui(pi,this).isWebGL2RendererType()?ui(mi,this).onRestoredFromContextLost(e,t,r,i,a,n):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&ui(pi,this).isWebGPURendererType()&&e.close()}getRendererProvider(){return ui(pi,this)}getRenderDisplayManager(){return ui(mi,this)}getWebGPUResMgr(e){if(ui(vi,this))return ui(vi,this);if(2===e){const e=rr.getModule("webgpu_renderer_dynmod");hi(vi,this,e.exports.createWebGPUResManager()),ui(vi,this).addRendererProviderModule(ui(pi,this)),ui(vi,this).setLabel(ui(fi,this))}return ui(vi,this)}cleanup(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];ui(pi,this)&&ui(pi,this).cleanup(),ui(mi,this)&&ui(mi,this).cleanup(e,t,r),r||ui(vi,this)&&ui(vi,this).cleanup()}clearOffscreenCanvas(e){ui(mi,this)&&ui(mi,this).cleanupByCanvas(e)}}("video");var wa=!1;let Sa=1,Ea=!1;var Ma,Ra,Ta,xa,Aa,Ca,ka,Fa,Pa,Ia,La,Da,Oa,Wa,Ba,Ua,Na,Va,Ga=!0;let ja;var Ha,$a,za,qa,Ya,Xa,Ka,Qa,Ja,Za,en,tn,rn,an,nn,on,sn,dn,ln,cn,un,hn,_n,fn,pn,mn=!1,gn=0,vn=0,yn=!1,bn=!1,wn=!1,Sn=new class{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,this.isVbEnabled=!1,this.isVideoCaptured=!1,this.hasWasmMemoryError=!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){let e=!1;this.videoType&&this.isVbEnabled&&this.isVideoCaptured&&!this.hasWasmMemoryError&&(e=!0),performance.now()-this.lastsubformetime>2e4&&postMessage({status:this.callBackEvent,videoType:this.videoType,subforme:this.subforme,hasRTPPackets:this.hasRTPPackets,vberror:e})}this.hasRTPPackets=!1,this.isVideoCaptured=!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())}setVBFlag(e){this.isVbEnabled=e}setVideoCaptured(e){this.isVideoCaptured=e}setWasmMemoryError(e){this.hasWasmMemoryError=e}setPaused(e){e||(this.lastsubformetime=performance.now()),this.paused=e,this.hasRTPPackets=!1}}(-130,!0),En=!1,Mn=!1;let Rn=-1;var Tn,xn=!1,An=!1,Cn=!1,kn=null,Fn=!1,Pn=!1,In=0,Ln=5;self.onWasmModuleReady=()=>{Ra=Module.cwrap("_Video_Init","number",["number","number","number","number","number","number","number","boolean","boolean","boolean","number","boolean","boolean","boolean","boolean"]),Ta=Module.cwrap("_Video_UnInit","number",["number"]),Module.cwrap("_Video_Decode","number",["number","array","number"]),xa=Module.cwrap("_Video_Encode","number",["number","number","number","number","number","number","number","boolean","number","number","boolean","number"]),Aa=Module.cwrap("_Video_Encode_YUV","number",["number","number","number","number","number","number","number","number","number","number","number","number","number","boolean","number","number","boolean","number"]),Ca=Module.cwrap("_Video_Try_Analysis","number",["number","array","number"]),sn=Module.cwrap("_set_video_network_info","number",["number","number","number","number","number","number","number","number","number"]),nn=Module.cwrap("_set_video_fec_info","number",["number","number","number","number"]),an=Module.cwrap("_set_video_bandwidth_alloc","number",["number","number","number","number"]),on=Module.cwrap("_set_video_retran_info","number",["number","number","boolean","boolean","number"]),ka=Module.cwrap("_Video_Websocket_Speed","number",["number","number","number"]),Fa=Module.cwrap("_Video_Start_Encode","number",["number","number","number","number","number"]),Pa=Module.cwrap("_Video_Stop_Encode","number",["number"]),Ia=Module.cwrap("_Video_Update_Format","number",["number","number","number","number","number"]),Module.cwrap("_rotate_video","number",["number","number"]),Module.cwrap("_Video_VirtualBackground_Special_Action","number",["number","number","number","number","number","number","number"]),ja=Module.cwrap("_Request_Video_Qos_Data","number",["number"]),La=Module.cwrap("_Video_Set_Data_Encryption","number",["number","number"]),Da=Module.cwrap("_Add_Video_Cooker_info","number",["number","number","number","number"]),Oa=Module.cwrap("_Remove_Video_Cooker_Info","number",["number","number"]),Wa=Module.cwrap("_Get_Video_Meat_Weight","number",["number","number"]),Ba=Module.cwrap("_Set_Max_Receiving_Channel_Num","number",["number","number"]),Ua=Module.cwrap("_update_sync_time","number",["number","number","number"]),Na=Module.cwrap("_release_video_receiving_channel","number",["number","number"]),Va=Module.cwrap("_change_hw_status","number",["number","boolean"]),Module.cwrap("_Change_Connect_Type","number",["number","number"]),Ha=Module.cwrap("_update_video_uplink_bandwidth_limitation_by_server","number",["number","number"]),$a=Module.cwrap("_create_vb_thread","number",[]),za=Module.cwrap("_create_vb_no_sab_thread","number",[]),qa=Module.cwrap("_signal_vb_thread_bg","number",["number","number","number","number"]),Ya=Module.cwrap("_signal_vb_thread_blur","number",["number","number"]),Xa=Module.cwrap("_signal_vb_thread_video_yuv","number",["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"]),Ka=Module.cwrap("_signal_vb_thread_video_rgba","number",["number","number","number","number","number","number","number","number"]),Qa=Module.cwrap("_update_video_cropping_mode","number",["number","number"]),Ja=Module.cwrap("_Video_Try_Analysis","number",["number","number","number"]),ln=Module.cwrap("_collect_video_monitor_info","number",["number","boolean"]),cn=Module.cwrap("_signal_vb_thread_close","number",[]),pn=Module.cwrap("_Create_HW_Encode","number",[]),Za=Module.cwrap("_set_mmr_signature_info","number",["number","number","array","number"]),en=Module.cwrap("_set_singature_info","number",["number","number","number"]),tn=Module.cwrap("_set_meeting_uuid_for_signature","number",["number","number","string","number"]),rn=Module.cwrap("_update_signagure_verify_action","number",["number","number","boolean"]),fn=Module.cwrap("_set_video_statistics_flag","number",["number","boolean"]),Module._malloc=function(){let e=Module.asm.malloc.apply(null,arguments);return e||yn||(yn=!0,te("MEMERR:VIDEO-".concat(io,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0])),ie("memry malloc error",new Error("memry malloc error VIDEO-".concat(io,"-").concat(wasmMemory.buffer.byteLength,"-").concat(arguments[0])))),e},"undefined"!=typeof _malloc&&(_malloc=Module._malloc)};var Dn=null,On=0,Wn=null,Bn=!1,Un=!1,Nn=!1,Vn=!1,Gn=!1,jn=null,Hn=0,$n=0,zn=0,qn=null;var Yn,Xn,Kn,Qn,Jn,Zn,eo,to,ro,io=!1,ao=!1,no=!1,oo=!1,so=!1,lo=!1,co=null,uo=null,ho=null,_o=null,fo=null,po=null,mo=0,go=new Map,vo=null,yo=new Map,bo=null,wo=[],So=!1,Eo=!1,Mo="",Ro=!1,To={ssrc:null,firstflag:!1},xo=1,Ao=0,Co=2,ko=!1,Fo=new class{constructor(){this.readStream=null,this.reader=null,this.streamProcessor=null,this.videotrack=null,this.rotation=0,this.videotag=!1,this.isSafari=!1}setReadStream(e){this.closeReadStream(),e&&(this.rotation=0,this.videotag=!1,this.readStream=e,this.reader=e.getReader(),this.isSafari=!1)}closeReadStream(){try{var e;null===(e=this.videotrack)||void 0===e||e.stop(),this.videotag||(this.reader&&this.reader.releaseLock&&this.reader.releaseLock(),this.readStream&&this.readStream.cancel&&this.readStream.cancel())}catch(e){}finally{this.reader=null,this.readStream=null,this.streamProcessor=null,this.videotrack=null}}createReadStream(e,t){this.closeReadStream(),this.rotation=t,this.videotag=!0,this.isSafari=!0,e&&(this.videotrack=e,this.streamProcessor=new MediaStreamTrackProcessor({track:e}),this.readStream=this.streamProcessor.readable,this.reader=this.readStream.getReader())}setRotation(e){this.isSafari&&this.videotrack&&(this.rotation=e)}async read(){let{done:e,value:t}=await this.reader.read();return{done:e,value:t,rotation:this.rotation,videotag:this.videotag}}},Po=!1,Io=!1,Lo=!1,Do=!1,Oo=!1,Wo=!1,Bo=new Map,Uo=navigator.hardwareConcurrency?navigator.hardwareConcurrency:4,No=Ge,Vo=31,Go=0,jo={rgba_x:0,rgba_y:0,rgba_stride:0},Ho=!1;self.isPreviewMode=!1;var $o={qosIntervalId:0,renderFlag:!1,monitorPanelFlag:!1,messageIndex:0,panelpollingInterval:0},zo={videoStatisticsFlag:!1},qo=!0;let Yo;var Xo=!1,Ko=0,Qo=!1;function Jo(e,t,r,i){Me(e,"".concat(t,",").concat(r,",").concat(i))}var Zo=new Ot({tag:"WCL_M,VMERR",interval:1e4,reportcallback:Jo}),es=new Ot({tag:"WCL_M,DISCARD",interval:15e3,reportcallback:Jo}),ts=new Wt({report_call:Me});const rs=new class{constructor(){this.intervalTimer=null}start(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;this.stop(),this.intervalTimer=setInterval(e,t)}stop(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}};function is(e,t,r,i,a,n){if(isPreviewMode&&!n)return null;const o=Cc==At.VIDEO_ENCODE?Ti.VIDEO_ENCODE:Ti.VIDEO_DECODE;var s=new ea(e,o,Fn&&!Pn,Fn);return s.setOnMessage(r),s.onopen=t,s.onclose=a,s.oncommand=i,s}function as(){var e;if(!io&&null!==(e=Wn)&&void 0!==e&&e.isReady()&&Gs==qe.IPHONE){let e=new Uint8Array(8);e[0]=139,Wn.send(e)}}function ns(e){Rn=e,Sn.setSubForMe(e)}function os(e,t){if(as(),postMessage({status:a}),to){const e={cmd:B,data:to};Wn.sendCommand(e)}io&&mn&&nu(Ve.SESSION_TYPE_VIDEO,!0)}var ss,ds,ls,cs=!1,us=!1,hs={threadCreatedFlag:!1};hs.threadPoolBufferMGR=new Map,hs.needReloaddHelpThread=!1,hs.SSrcWaitForThread=[],hs.initParseThread=!1,hs.unusedworkerarray=[],hs.countThread=3,hs.totalNumbofParseThread=3,hs.newworker=0,hs.totalthread=0,hs.preusedcount=0,hs.realusedcount=0,hs.zombiethreadssrc=0,hs.videodecodethreadnumb=1,hs.isSupportMultiThread=!1,hs.isSupportOffscreenCanvas=!1,hs.isVideoCodecHelpThreadWorker=null,hs.isEnableVideoDecodeHardWareThread=!1;var _s=1,fs=1280,ps=!1,ms={isTeslaMode:!1};function gs(){js.nextWorker=js.threadarray.shift()}function vs(e){(e=e>>10<<10)&&hs.threadPoolBufferMGR.get(e)&&hs.threadPoolBufferMGR.delete(e)}function ys(){}function bs(e){e=e>>10<<10;let t=hs.threadPoolBufferMGR.get(e);return t?t.threadState!=Le||0==hs.unusedworkerarray.length?-1:0:-1}const ws=(()=>{let e=null,t=null;return{inited:!1,start(){this.inited=!0,this.clear(),e=setTimeout((()=>{Kl||postMessage({status:"VBPredictAbout3s"})}),3e3),t=setTimeout((()=>{Kl||postMessage({status:"VBPredictAbout10s",isVBPredictIn5s:!0})}),1e4)},clear(){clearTimeout(e),clearTimeout(t),e=null,t=null}}})();const Ss=()=>"undefined"!=typeof PThread,Es=function(e,t){e.onmessage=r=>{if(!bn){var i=r.data,a=i.cmd;if(e.pthread_ptr&&(PThread.currentProxiedOperationCallerThread=e.pthread_ptr),i.targetThread&&i.targetThread!=_pthread_self()){var n=PThread.pthreads[i.targetThread];return n?n.postMessage(i,i.transferList):ie('Internal error! Worker sent a message "'+a+'" to target pthread '+i.targetThread+", but that thread no longer exists!"),void(Ss&&(PThread.currentProxiedOperationCallerThread=void 0))}if("processProxyingQueue"===a)executeNotifiedProxyingQueue(i.queue);else if("spawnThread"===a)spawnThread(i);else if("cleanupThread"===a)cleanupThread(i.thread);else if("killThread"===a)killThread(i.thread);else if("cancelThread"===a)cancelThread(i.thread);else if("loaded"===a)e.loaded=!0,t&&t(e),e.runPthread&&e.runPthread();else if("size"==a)Module.decode_callback&&Module.decode_callback(r.data.ssrc,r.data.size);else if("decoded"==a)Module.put_data&&Module.put_data(r.data);else if("js_info_from_wcl"==a)Module.js_info_from_wcl_thread&&Module.js_info_from_wcl_thread(r.data);else if("wcl_trace_log"==a)Module.wcl_trace_log&&Module.wcl_trace_log(r.data);else if("on_psl_mix_share_info_changed"===a){let e=r.data.shared_source_id,t=r.data.rect_x_norm,i=r.data.rect_y_norm,a=r.data.rect_cx_norm,n=r.data.rect_cy_norm;Module.on_psl_mix_share_info_changed(e,t,i,a,n)}else if("js_info_from_wcl_video_data"===a){let e=r.data.ssrc,t=r.data.data,i=r.data.is_sent_by_data;Module.js_info_from_wcl_video_data(e,t,0,void 0,void 0,i,!0)}else if("change_capture_resolution"==a)Module.change_capture_resolution&&Module.change_capture_resolution(r.data.type);else if("APP_Troubleshoting_Info"==a)Module.APP_Troubleshoting_Info&&Module.APP_Troubleshoting_Info(r.data.data,r.data.len);else if("SAVE_IV"==a){let e=r.data.ptr,t=r.data.len;Module.SAVE_IV(e,t)}else if("processed_capture_data_callback"==a){let e=r.data.ssrc,t=r.data.data,i=r.data.len_of_data,a=r.data.format_width,n=r.data.format_height,o=r.data.valid_x,s=r.data.valid_y,d=r.data.valid_width,l=r.data.valid_height,c=r.data.yuv_limited;Module.processed_capture_data_callback(e,t,i,a,n,o,s,d,l,c)}else if("modelReady"===a)Yl=performance.now(),ws.start();else if("vbInitializeFailed"===a)postMessage({status:"vbInitializeFailed"});else if("addMonitorLog"===a)te(i.log);else if("vbPredictDone"===a)Kl=!0,Xl=performance.now()-Yl,js.nextWorker=js.vbThreadWorker,js.nextWorker.postMessage({cmd:"vb"}),$a(),js.vbThreadCreatedFlag=!0,js.nextWorker=null,postMessage({status:"VBPredictDone",predictCostTime:Xl}),il&&(Oo||rc({data:ll}));else if("VideoEncodeInit"===r.data.cmd){let e=r.data.id,t=r.data.context;Module.codecMRG.initEncodeWebCodec(e,t)}else if("VideoEncodeConfigure"===r.data.cmd){let e=r.data.Width,t=r.data.Height,i=r.data.id,a=r.data.Bitrate,n=r.data.Framerate;Module.codecMRG.configEncodeWebCodec(i,a,n,e,t)}else if("VideoEncode"===r.data.cmd){let e=r.data.videoFrameId,t=r.data.dataLength,i=r.data.id,a=r.data.NewIDR,n=r.data.rawData;Module.codecMRG.encodeVideoFrame(i,e,a,n,t)}else if("decoded_webcodec"===r.data.cmd){const{id:e,data:t,frameIndex:i,ssrc:a}=r.data||{};Module.codecMRG.put_data({id:e,ssrc:a,data:t,frameIndex:i})}else if("decoded_webcodec_render"===r.data.cmd){const{id:e,ssrc:t,iFrameNum:i,rotation:a,rendering_x:n,rendering_y:o,rendering_width:s,rendering_height:d,format_width:l,format_height:c}=r.data||{};Module.codecMRG.render({id:e,iFrameNum:i,ssrc:t,rotation:a,x:n,y:o,vwidth:s,vheight:d,format_width:l,format_height:c})}else if("print"===a)out("Thread "+i.threadId+": "+i.text);else if("printErr"===a)err("Thread "+i.threadId+": "+i.text);else if("alert"===a)alert("Thread "+i.threadId+": "+i.text);else if("setimmediate"===i.target)e.postMessage(i);else if("callHandler"===a)Module[i.handler](...i.args);else if("tCrashed"==r.data.cmd){let e="WCL_M,"+r.data.data.toString();postMessage({status:s,data:e})}else if("MCM_VIDEO_LOG"==r.data.cmd){let e=r.data;Module.MCMMonitor_Video_LOG(e.data)}else"video_un_ref"==r.data.cmd?ts.unref():"WCES"==r.data.cmd?ae("webcodec encode start, config ".concat(Os)):"THWEC"==r.data.cmd?postMessage({status:109,type:0}):"WCEF"==r.data.cmd?Ec(r.data.data,r.data.code,r.data.retry,r.data.subCode,r.data.inHWThread):"TFJSWLF"==r.data.cmd?te("TFJSWLF"):"globalTracingError"===r.data.cmd?ie("Error from pthread worker: ".concat(r.data.data),r.data.error):"GlobalTracingDT"===r.data.cmd?ae("message from pthread worker: ".concat(r.data.data)):"WCDF"==r.data.cmd?(ie("E:H webcodec decode failed ".concat(r.data.data)),eu(!1,r.data.data),te("WCDF:".concat(r.data.data))):"vb-fin"==r.data.cmd||(-35==r.data.cmd?(Sn.setWasmMemoryError(!0),postMessage(r.data)):"webcodecperformance"==r.data.cmd?postMessage({status:123,data:r.data}):a==x||a&&err("worker sent an unknown command "+a));Ss()&&(PThread.currentProxiedOperationCallerThread=void 0)}};var r=[];for(var i of["onExit","onAbort","print","printErr"])Object.prototype.hasOwnProperty.call(Module,i)&&r.push(i);Ss()?e.postMessage({cmd:"load",urlOrBlob:Module.mainScriptUrlOrBlob||_scriptDir,wasmMemory,wasmModule:self.wasmModuleToShare,handlers:r,isTeslaMode:!!ms.isTeslaMode,is360penablehwenc:!!Is,is360penablehwdec:!!Ls,isAndroid:!0,encAdditionalConfig:Ds,encAddConIdx:Os,supportHWEncRetry:Ws,encRetryConIdx:Bs,encRetryConfig:Us}):e.postMessage({cmd:"load",isSingleThreadVBWorker:e.isSingleThreadVBWorker})};function Ms(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];PThread.loadWasmModuleToWorker=Es,e?(PThread.getNewWorker=function(){return js.nextWorker},PThread.returnWorkerToPool=function(e){var t=e.pthread_ptr;delete PThread.pthreads[t],e.pthread_ptr=0,__emscripten_thread_free_data(t),js.threadarray.push(e),PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(e),1)}):(PThread.getNewWorker=function(){let e;return hs.newworker?(e=hs.newworker,hs.newworker=0):e=hs.unusedworkerarray.shift(),e?hs.realusedcount++:ie("get video decode worker thread is null"),e},PThread.returnWorkerToPool=function(e){if(e!=hs.isVideoCodecHelpThreadWorker){var t=e.pthread_ptr;delete PThread.pthreads[t],e.pthread_ptr=0,__emscripten_thread_free_data(t),hs.realusedcount--,setTimeout((()=>{Fs(e,!1)}),0),PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(e),1)}else ie("video decode codec help thread worker was released")})}function Rs(e){return e?e>>10<<10:-1}function Ts(e){let{canvas:t,oldCanvas:r,newDisplayMap:i}=e;for(let e=0;e<wo.length;e++)if(wo[e].canvas===r||wo[e].canvas===t){r!==t&&(wo[e].canvas=t);const a=wo[e].display.getFillMode();wo[e].display=i?i.get(wo[e].display.getTextureIndex()):this._Create_WebGL_Canvas({videoRenderArrayIndex:e,canvas:t,canvasId:wo[e].rendercanvasID}),a&&wo[e].display&&wo[e].display.setFillMode(a,wo[e].display.getFillModeForResolution()),wo[e].borderRadius&&wo[e].display&&wo[e].display.setRoundedCornerRadius(wo[e].borderRadius)}}function xs(e){hs.threadPoolBufferMGR.set(hs.zombiethreadssrc,{pduBuffer:new ot,threadState:Pe,threadnumb:1,workerArray:[]}),hs.threadPoolBufferMGR.get(hs.zombiethreadssrc).threadState=e?Ie:Le}function As(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t)if(r.threadState===Ie){let e=new Uint8Array(t);r.pduBuffer.enqueue(e)}else{let n=r.pduBuffer.dequeue();for(;n;)i(e,n,n.length),n=r.pduBuffer.dequeue();a?Ja(e,a,t.length):i(e,t,t.length)}else{let t=r.pduBuffer.dequeue();for(;t;)i(e,t,t.length),t=r.pduBuffer.dequeue()}}function Cs(e,t){e.threadState=Ie,hs.SSrcWaitForThread.push(t),e.isCreateWorkers=!0;let r=e.threadnumb;for(let e=0;e<r;e++)hs.preusedcount<hs.totalthread?Fs(null,!1):hs.totalthread<_s&&(PThread.allocateUnusedWorker(),PThread.loadWasmModuleToWorker(PThread.unusedWorkers[hs.totalthread],Fs),hs.preusedcount++,hs.totalthread=hs.totalthread+1)}function ks(e){return er.isUseSsrcStream()?wo.filter((t=>Yc.ssrcEquals(t.ssrc,e))).length>0:!!bo&&bo.Decode_Ssrc(e)}function Fs(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(hs.SSrcWaitForThread.length&&hs.SSrcWaitForThread[0]===hs.zombiethreadssrc&&!hs.isVideoCodecHelpThreadWorker){let t=hs.threadPoolBufferMGR.get(hs.zombiethreadssrc);return t.threadnumb=t.threadnumb-1,e&&e.postMessage({cmd:"webcodec",decHAOption:Ac}),hs.isVideoCodecHelpThreadWorker=e,hs.newworker=e,void pn()}!function(e,t){if(e&&!e.msc&&hs.isVideoCodecHelpThreadWorker){let r=new MessageChannel;e.msc=!0,e.postMessage({cmd:"vdmsc1"},[r.port1]),t.postMessage({cmd:"vdmsc2"},[r.port2])}}(e,hs.isVideoCodecHelpThreadWorker),e&&-1==hs.unusedworkerarray.indexOf(e)&&hs.unusedworkerarray.push(e);let r=!1;for(;hs.SSrcWaitForThread.length;){let e=hs.SSrcWaitForThread[0];if(!(e===hs.zombiethreadssrc||ks(e)||To.ssrc&&e==To.ssrc>>10<<10)){hs.SSrcWaitForThread.shift(),hs.threadPoolBufferMGR.delete(e);continue}let i=hs.threadPoolBufferMGR.get(e);i&&(i.threadnumb=i.threadnumb-1,t||hs.preusedcount++,r=!0,i.threadnumb||(hs.SSrcWaitForThread.shift(),i.threadState=Le,Dn?As(Dn,null,i,Ca):console.error("<<< ExecutePdu video handle is null")));break}!r&&t&&hs.preusedcount--}function Ps(e,t,r){let i,a,n,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!bn&&Gc()&&(io||++vn%2400==0&&postMessage({status:s,data:"WCL_M,RTCPVN"+vn}),t&&r&&e)){if(us&&2==e[0]&&e.length>15){if(a=e[12]<<24|e[13]<<16|e[14]<<8|e[15],!ks(a)&&!Wc(a))return;if(a=a>>10<<10,i=hs.threadPoolBufferMGR.get(a),bd(),i)n=hs.threadPoolBufferMGR.get(a);else{if(n={},n.isCreateWorkers=!1,n.threadState=Pe,n.pduBuffer=new ot,!hs.initParseThread){let e=hs.threadPoolBufferMGR.get(hs.zombiethreadssrc);e.threadnumb=hs.totalNumbofParseThread,Ms(!1),Cs(e,hs.zombiethreadssrc),hs.initParseThread=!0}n.threadnumb=1,n.workerArray=[],hs.threadPoolBufferMGR.set(a>>10<<10,n),Ad.set(a>>10<<10,2),Cs(n,a)}}else a=hs.zombiethreadssrc,n=hs.threadPoolBufferMGR.get(a);As(t,e,n,r,o)}}var Is=!1,Ls=!1;let Ds={},Os=0,Ws=!1,Bs=0,Us={};var Ns=!1,Vs=!0,Gs=qe.DESKTOP,js={},Hs=!1;js.encodeThreadCreatedFlag=!1,js.codecThreadCreatedFlag=!1,js.threadPoolBufferMGR=new Map,js.waitingThread=[],js.vbThreadWorker=null,js.vbReadySetSpecialActionTrue=!1,js.threadState=Pe,js.isEnableVideoEncodeHardWareThread=!1,js.isSupportVirtualBackground=!1,js.enableVBWasmBackend=!1,js.videoencodethreadnumb=1,js.videoencodethreadmaxnumb=1,js.nextWorker=null,js.loadedThreadCount=0,js.vbThreadCreatedFlag=!1,js.Signal_Encode_Thread={status:Pe,handle:null,initwebcodecflag:!1,latestflag:!1},js.threadarray=[];class $s{constructor(e){this.workerJsUrl=e,this.worker=null,this.videoRenderObj=null,this.currentUserSsrc=0,this.vbDataQueueCounter=0}setCurrentUserSsrc(e){this.currentUserSsrc=e}generateVideoRenderObj(){this.videoRenderObj||(this.videoRenderObj=new xt({Notify_APPUI:null,isSupportOffscreenCanvas:!0,jsMediaEngine:null,videodecodethreadnumb:1,renderManager:ba,isLSSPlayer:Fn}),this.videoRenderObj.setMirrorMyVideoOption(Po),ac&&this.videoRenderObj.Change_Current_SSRC(ac),jd&&this.videoRenderObj.Set_LocalVideo_Buffer(jd),Gd&&this.videoRenderObj.Set_LocalVideo_Ptr(Gd))}setMirrorMyVideoOption(e){this.videoRenderObj&&this.videoRenderObj.setMirrorMyVideoOption(e)}replace_Canvas(e,t){this.videoRenderObj&&this.videoRenderObj.Replace_Canvas(e,t)}render(e){let{width:t,height:r,croppingParams:i,ptr:a,mode:n}=e;const o=n&&n!==Ne?t*r*3/2:t*r*4,s="number"==typeof a?se().subarray(a,a+o):a;this.videoRenderObj&&this.videoRenderObj.Update_SelfVideo_Texture(t,r,s,Rs(this.currentUserSsrc),n,i)}createVBThread(e){this.workerJsUrl&&(this.worker=new Worker(this.workerJsUrl),this.worker.addEventListener("message",(e=>{30===e.data.status?this.postMessage({command:"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK",data:self.wasmModuleToShare}):7===e.data.status?this.postMessage({cmd:"loadWasmSuccess"}):"vb-fin"==e.data.cmd&&this.updateVBDataQueueCounter(!1)})),this.worker.addEventListener("error",(e=>{ie("Error from VB thread",e)})),this.worker.isSingleThreadVBWorker=!0,Es(this.worker,e),this.generateVideoRenderObj())}hasSubWorker(){return!!this.worker}postMessage(e){if(this.worker){if("vbYuv"===e.cmd||"vbRgba"===e.cmd){if(!this.canTransferVBData(!0))return;this.updateVBDataQueueCounter(!0)}this.worker.postMessage(e)}}updateVBDataQueueCounter(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.vbDataQueueCounter++:this.vbDataQueueCounter>0&&this.vbDataQueueCounter--}canTransferVBData(e){return this.hasSubWorker()&&(!e||this.vbDataQueueCounter<=2)}}let zs=null;class qs{constructor(){this.initWasmSuccess=!1,this.tfjsUrl=null,this.modelArtifacts={},this.model=null,this.initTfSuccess=!1,this.IOhandle={load:()=>this.modelArtifacts,save:()=>{}},this.afnModel,this.afnModelArtifacts={},this.afnIOHandle={load:()=>this.afnModelArtifacts,save:()=>{}},this.baseModel,this.baseModelArtifacts={},this.baseIOHandle={load:()=>this.baseModelArtifacts,save:()=>{}},this.dualModelOKCount=0,this.tfLoad=!1,this.tfInitPromise=null,this.enableVBWasmBackend=0,self.addEventListener("message",this.handleMessageFromEncodeWorker.bind(this)),self.execute=this.execute.bind(this),self.execute_afn=this.execute_afn.bind(this),self.execute_base=this.execute_base.bind(this)}initTf(e){if(!this.tfLoad){if("string"==typeof e)importScripts(e);else{var t=i().createObjectURL(e);importScripts(t),i().revokeObjectURL(t)}this.tfLoad=!0,this.tfInitPromise=tf.setBackend("webgl").then((e=>{if(!e)return Promise.reject("init tf fail 1")})).catch((()=>{if(!this.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"))))}))}}handleMessageFromEncodeWorker(e){switch(e.data.cmd){case"load":break;case"loadWasmSuccess":this.initWasmSuccess=!0,this.checkVBThreadReady();break;case"vbObj0":{this.tfjsUrl=e.data.tfjsUrl;let t=e.data.modelJSON;if(this.modelArtifacts.modelTopology=t.modelTopology,this.modelArtifacts.format=t.format,this.modelArtifacts.generatedBy=t.generatedBy,this.modelArtifacts.convertedBy=t.convertedBy,t.weightsManifest)for(let e=0;e<t.weightsManifest.length;e++)this.modelArtifacts.weightSpecs=t.weightsManifest[e].weights;t.trainingConfig&&(this.modelArtifacts.trainingConfig=t.trainingConfig),t.userDefinedMetadata&&(this.modelArtifacts.userDefinedMetadata=t.userDefinedMetadata),this.modelArtifacts.weightData=e.data.weightData,this.initTf(this.tfjsUrl),this.tfInitPromise.then((()=>{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(this.IOhandle).then((e=>{this.model=e,postMessage({cmd:"modelReady"});var t=new Float32Array(110592),r=tf.tensor4d(t,[1,144,256,3],"float32");this.model.predict(r),this.initTfSuccess=!0,this.checkVBThreadReady()}))}));break}case"vbObj1":this.tfjsUrl=e.data.tfjsUrl;var t=e.data.modelJSON;if(this.afnModelArtifacts.modelTopology=t.modelTopology,this.afnModelArtifacts.format=t.format,this.afnModelArtifacts.generatedBy=t.generatedBy,this.afnModelArtifacts.convertedBy=t.convertedBy,t.weightsManifest)for(var r=0;r<t.weightsManifest.length;r++)this.afnModelArtifacts.weightSpecs=t.weightsManifest[r].weights;t.trainingConfig&&(this.afnModelArtifacts.trainingConfig=t.trainingConfig),t.userDefinedMetadata&&(this.afnModelArtifacts.userDefinedMetadata=t.userDefinedMetadata),this.afnModelArtifacts.weightData=e.data.weightData,this.initTf(this.tfjsUrl),this.tfInitPromise.then((()=>{postMessage({cmd:"addMonitorLog",log:"TFBE-"+tf.getBackend()}),tf.loadGraphModel(this.afnIOHandle).then((e=>{this.afnModel=e,0==this.dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),r=new Float32Array(110592),i=new Float32Array(36864),a=tf.tensor4d(t,[1,144,256,3],"float32"),n=tf.tensor4d(r,[1,144,256,3],"float32"),o=tf.tensor4d(i,[1,144,256,1],"float32");this.afnModel.predict([a,n,o]),this.dualModelOKCount++,2==this.dualModelOKCount&&(this.initTfSuccess=!0,this.checkVBThreadReady())}))}));break;case"vbObj2":{this.tfjsUrl=e.data.tfjsUrl;let t=e.data.modelJSON;if(this.baseModelArtifacts.modelTopology=t.modelTopology,this.baseModelArtifacts.format=t.format,this.baseModelArtifacts.generatedBy=t.generatedBy,this.baseModelArtifacts.convertedBy=t.convertedBy,t.weightsManifest)for(let e=0;e<t.weightsManifest.length;e++)this.baseModelArtifacts.weightSpecs=t.weightsManifest[e].weights;t.trainingConfig&&(this.baseModelArtifacts.trainingConfig=t.trainingConfig),t.userDefinedMetadata&&(this.baseModelArtifacts.userDefinedMetadata=t.userDefinedMetadata),this.baseModelArtifacts.weightData=e.data.weightData,this.initTf(this.tfjsUrl),this.tfInitPromise.then((()=>{tf.loadGraphModel(this.baseIOHandle).then((e=>{this.baseModel=e,0==this.dualModelOKCount&&postMessage({cmd:"modelReady"});var t=new Float32Array(110592),r=tf.tensor4d(t,[1,144,256,3],"float32");this.baseModel.predict(r),this.dualModelOKCount++,2==this.dualModelOKCount&&(this.initTfSuccess=!0,this.checkVBThreadReady())}))}));break}case"vbBg":if(e.data.data){const{length:t,width:r,height:i}=e.data;tc.sendBg(e.data.data,t,r,i)}break;case"vbBlur":tc.sendBlur();break;case"vbYuv":if(e.data.data){const{length:t,width:r,height:i,yDataLength:a,uDataLength:n,vDataLength:o,yStride:s,uStride:d,vStride:l,xOffset:c,yOffset:u,dataFormat:h}=e.data,_=Od(e.data.data);tc.sendYuvData(_,t,r,i,a,n,o,s,d,l,c,u,h)}break;case"vbRgba":if(e.data.data){const{length:t,width:r,height:i,rgbaStride:a,xOffset:n,yOffset:o,dataFormat:s}=e.data,d=Od(e.data.data);tc.sendRgbaData(d,t,r,i,a,n,o,s)}break;case"vbFlag":this.enableVBWasmBackend=e.data.enableVBWasmBackend;break;default:console.warn("unknown message in single thread vb worker:",e.data.cmd)}}checkVBThreadReady(){this.initWasmSuccess&&this.initTfSuccess&&(postMessage({cmd:"vbPredictDone"}),za())}execute(e,t,r,i){if(this.model)try{const i=new Float32Array(se().buffer,e,t),a=tf.tensor4d(i,[1,144,256,3],"float32"),n=this.model.predict(a),o=Float32Array.from(n.as1D(36864).arraySync());return le().set(o,r>>2),a.dispose(),n.dispose(),0}catch(r){return ie("Error in SingleThreadVBWorker.execute: ".concat(e,", ").concat(t,", ").concat(input_data),r),-1}}execute_base(e,t,r,i){if(this.baseModel){try{tf.tidy((()=>{var a,n,o=new Float32Array(wasmMemory.buffer,e,t),s=tf.tensor4d(o,[1,144,256,3],"float32"),d=this.baseModel.predict(s);1==d[0].size?(a=Float32Array.from(d[0].as1D(36864).arraySync()),n=Float32Array.from(d[1].as1D(1).arraySync())):(a=Float32Array.from(d[1].as1D(36864).arraySync()),n=Float32Array.from(d[0].as1D(1).arraySync()));let l=new Float32Array(wasmMemory.buffer);l.set(n,r>>2),l.set(a,i>>2)}))}catch(r){return ie("Error in SingleThreadVBWorker.execute: ".concat(r,", ").concat(e,", ").concat(t,", ").concat(input_data)),-1}return 0}}execute_afn(e,t,r,i,a){if(this.afnModel){try{tf.tidy((()=>{var n=new Float32Array(se().buffer,e,i),o=new Float32Array(se().buffer,t,i),s=new Float32Array(se().buffer,r,i/3),d=tf.tensor4d(n,[1,144,256,3],"float32"),l=tf.tensor4d(o,[1,144,256,3],"float32"),c=tf.tensor4d(s,[1,144,256,1],"float32"),u=this.afnModel.predict([d,l,c]);const h=Float32Array.from(u.as1D(36864).arraySync());le().set(h,a>>2)}))}catch(e){return ie("Error in SingleThreadVBWorker.execute: ".concat(e,", ").concat(input_buffer,", ").concat(i,", ").concat(input_data)),-1}return 0}}}let Ys=null;function Xs(e,t,r){let i=js.threadPoolBufferMGR.get(e);if(i)i.threadState==Le&&(postMessage({status:8}),Kl&&postMessage({status:"VBPredictDone",predictCostTime:0}));else{js.threadPoolBufferMGR.set(e,{threadState:Pe,workerArray:[],threadnumb:t});var a=js.threadPoolBufferMGR.get(e);if(a.threadState==Pe){a.threadState=Ie,js.waitingThread.push(e);for(let e=0;e<t;e++)if(Ss()){PThread.allocateUnusedWorker();let e=PThread.unusedWorkers.pop();PThread.loadWasmModuleToWorker(e,(e=>{e.postMessage({cmd:"vbFlag",enableVBWasmBackend:r}),Js(e)}))}else zs&&zs.createVBThread((e=>{e.postMessage({cmd:"vbFlag",enableVBWasmBackend:r}),Js(e)}))}}}!function(){if(!Ss()){const e=t=>{"load"===t.data.cmd&&t.data.isSingleThreadVBWorker&&(Ys=new qs,postMessage({cmd:"loaded"}),self.removeEventListener("message",e))};self.addEventListener("message",e)}}();const Ks=(Qs=null,async e=>{Qs||(Qs=new Promise(((e,t)=>{if(!cs)return void e(!0);js.threadState=Ie;let r=js.videoencodethreadnumb;js.Signal_Encode_Thread.status=Ie,r+=7;for(var i=0;i<r;i++){PThread.allocateUnusedWorker();let t=PThread.unusedWorkers.pop();PThread.loadWasmModuleToWorker(t,(function(t){js.loadedThreadCount++,1==js.loadedThreadCount?js.threadarray.push(t):js.isEnableVideoEncodeHardWareThread&&2==js.loadedThreadCount?(js.Signal_Encode_Thread.status=Le,js.Signal_Encode_Thread.handle=t,__Create_HW_Encode&&(js.nextWorker=t,t.postMessage({cmd:"webcodec"}),__Create_HW_Encode(),js.nextWorker=null),Dn&&Va(Dn,js.Signal_Encode_Thread.latestflag)):js.threadarray.push(t),js.loadedThreadCount==r&&(te("ECWS"),js.threadState=Le,e(!0))}))}}))),await Qs,al(e)});var Qs;function Js(e){let t=js.waitingThread[0];if(void 0!==t){let r=js.threadPoolBufferMGR.get(t);r&&(r.threadnumb=r.threadnumb-1,r.workerArray.push(e),r.threadnumb||(js.waitingThread.shift(),r.threadState=Le,"VB"==t&&(postMessage({status:8}),js.vbThreadWorker=e,Zl(0),Zl(1),Zl(2))))}}function Zs(){return cs?1:0}function ed(){return navigator.hardwareConcurrency||1}function td(){return hs.videodecodethreadnumb>1&&hs.isEnableVideoDecodeHardWareThread?1:0}function rd(){return un}function id(){return hn}function ad(){return Sa}function nd(){return!Ea}function od(){return!!Is}function sd(){return!!Ls}function dd(){return!!ms.isTeslaMode}function ld(){return 1}function cd(){return 8}function ud(e,t,r,i,a,n,o,s,d,l,c,u,h,_,f){postMessage({nodeId:e,timestamp:t,roundTripTime:r,jitter:i,frameWidthInput:a,frameHeightInput:n,frameWidthSent:o,frameHeightSent:s,frameRateInput:d,framesPerSecond:l,bytesSent:c,packetsSent:u,totalPacketSendDelay:h,totalEncodeTime:_,framesEncoded:f,cmd:202,status:202,kind:"video",type:"outbound-rtp",isSharing:!1})}function hd(e,t,r,i,a,n,o,s,d,l,c,u,h,_,f){postMessage({nodeId:e,timestamp:t,rtt:r,jitter:i,frameWidth:a,frameHeight:n,framesPerSecond:o,bytesReceived:s,packetsLost:d,packetsReceived:l,estimatedPlayoutTimestamp:c,totalDecodeTime:u,framesDecoded:h,jitterBufferDelay:_,jitterBufferEmittedCount:f,cmd:203,kind:"video",status:203,type:"inbound-rtp",isSharing:!1})}const _d=(()=>{let e;return{updateKey:t=>{if(t&&(e=t),Dn&&e){let t=new Uint8Array(44);t[0]=102,t[4]=2,t[8]=32,t.set(e,12,e.length),Ca(Dn,t,t.length)}}}})();function fd(e,t){e.length<4||102==e[0]?102==e[0]&&Xo&&_d.updateKey(e.subarray(12)):io?function(e,t){const r=e[0];(16==r||142==r)&&e.length>5&&(Mn!=e[4]&&(Mn=!!e[4]),jn=e),Gc()&&Dn&&(t?Ja(Dn,t,e.length,!1):Ca(Dn,e,e.length,!1))}(e,t):Ps(e,Dn,Ca)}function pd(e,t){postMessage({status:w}),va("video_websocket_on_close")}function md(e){const{cmd:t}=e;switch(t){case I:{const{rtt:t,jitter:r,avg_loss:i,max_loss:a,bandwidth:n,rate:o,lost_packet_num:s,issend:d}=e;Dn&&sn(Dn,d,t,r,i,a,n,o,s);break}case L:{const{type:t,payload_type:r,issend:i}=e;Dn&&nn(Dn,i,t,r);break}case O:{const{retran:t,retran_switched:r,lostrate:i,issend:a}=e;Dn&&on(Dn,a,t,r,i);break}case D:{const{bandwidth:t,lostrate:r,issend:i}=e;Dn&&an(Dn,i,t,r);break}case W:ao=e.data,function(){let e=ao||no;Dn&&e!=oo&&te("VQOS-S-"+(e?1:0)+"-"+(ao?1:0)+"-"+(no?1:0)),oo=e}();break;case U:{const{type:t,networkLevel:r,bwLevel:i}=e;postMessage({status:S,isUplink:0===t,networkLevel:r,bwLevel:i});break}case P:postMessage({status:G}),ie("NetWork is Bad, Don't to reconnect the serer!");break;case k:postMessage({status:v}),no=!0;break;case F:postMessage({status:y}),no=!1;break;case z:{let t=e.data;postMessage({status:z,data:t},[t.buffer])}}}function gd(e){if(e==Oe&&Ns&&1280!==Hn){if(Gs==qe.DESKTOP&&Re())return;if(postMessage({status:m,width:1280,height:720}),Gs==qe.IPHONE){let e=He;e=Mc(e),rs.start(rl,1e3/e)}else if(Gs==qe.ANDROID){let e=$e;e=Mc(e),rs.start(rl,1e3/e)}ts.start()}else e==De&&postMessage({status:m,width:640,height:360})}function vd(e,t,r){let i=oe().subarray(t+0,t+r),a=new Uint8Array(r);a.set(i,0,r),Fn?12!==a[0]?postMessage({status:q,data:a},[a.buffer]):postMessage({status:z,data:a},[a.buffer]):Wn.send(a)}var yd=0;function bd(){no&&1!==yd?(yd=1,postMessage({status:b,type:yd})):ao&&!no&&2!==yd?(yd=2,postMessage({status:b,type:yd})):ao||no||3===yd||(yd=3,postMessage({status:b,type:yd}))}function wd(e,t,r,i,a){Qo=!!e,postMessage({status:A,data:{shared_source_id:e,rect_x_norm:t,rect_y_norm:r,rect_cx_norm:i,rect_cy_norm:a}})}function Sd(e,t,r,i,a,n,o){if(2==i&&Sn.setRtpPackets(),!isPreviewMode)if(o)Wn.send(t);else{const e=oe().subarray(t+0,t+r);let n=new Uint8Array(4);n[0]=i,n[1]=a,Wn.sendVideo(n,e)}}function Ed(e,t,r,i,a,n,o,s,d,l){if(!t)return;if(Ys){const c=se().subarray(t,t+r);let u=new Uint8Array(r);return u.set(c,0,r),postMessage({cmd:"processed_capture_data_callback",ssrc:e,data:u,len_of_data:r,format_width:i,format_height:a,valid_x:n,valid_y:o,valid_width:s,valid_height:d,yuv_limited:l}),u=null,void(t&&Module._free(t))}const c="number"==typeof t;if(!so&&!bl&&!Do)return void(c&&(t&&Module._free(t),po&&Atomics.store(po,0,0)));if(Hn!=s||$n!=d)return c&&t&&Module._free(t),void es.timeoutReport(0,0);if(!Wo)return void(c&&t&&Module._free(t));let u,h;if(c)Xd=Atomics.load(fo,0),Yd=Atomics.load(fo,1),qd=ho+4+(ze+4+8+2)*Yd+4+8,u=se().subarray(t+0,t+r),se().subarray(qd,qd+r).set(u,0,r),po[2+(ze+4+8+2)*Yd/2]=i,po[2+((ze+4+8+2)*Yd+2)/2]=a,po[2+((ze+4+8+2)*Yd+4)/2]=o,po[2+((ze+4+8+2)*Yd+6)/2]=n,po[2+((ze+4+8+2)*Yd+8)/2]=s,po[2+((ze+4+8+2)*Yd+10)/2]=d,po[2+((ze+4+8+2)*Yd+12)/2]=Co-1;else if(so)if(u=t,er.isUseSsrcStream()&&!ps)h=new VideoFrame(u,{format:"I420",timestamp:1e3*performance.now(),duration:0,codedWidth:i,codedHeight:a,visibleRect:{left:n,top:o,width:s,height:d}}),Kd(h);else{qd=Od(u);let e={width:i,height:a,croppingParams:{top:o,left:n,width:s,height:d},ptr:t,data:0,mode:Co-1,yuv:Ue,ssrc:to,rotation:Ao,cmd:"SVIEW"};var _;qo?(e.data=u,e.ptr=0,null===(_=ds)||void 0===_||_.postMessage(e)):zs.render(e)}let f=i*a,p=i*a/4,m=i*a/4,g=i,v=i/2,y=i/2,b=n,w=o;2!=xo&&(xo=2,lc());let S=Hd();(S||_n&&self.VideoFrame||ps||er.isUseSsrcStream())&&(h=new VideoFrame(u,{format:"I420",timestamp:1e3*performance.now(),duration:0,codedWidth:i,codedHeight:a,visibleRect:{left:n,top:o,width:s,height:d}}),_n&&postMessage({status:X,frame:h}),S&&(ts.captureSample(),$d(h),ts.closeSample()),ps&&Kd(h)),h&&h.close(),Aa(Dn,qd,f,qd+f,p,qd+f+p,m,g,v,y,b,w,xo,S,0,zd++,En,Ao),c&&(Atomics.store(fo,1,(Yd+1)%Ln),fo[2]=Co-1),Do&&Zn&&!er.isUseSsrcStream()&&fc(i,a,u,{top:o,left:n,width:s,height:d},Co-1,Ao),c?t&&Module._free(t):(u=null,Wd(qd))}let Md=null;function Rd(e){let t=e.data;Fn?12!==t[0]?postMessage({status:q,data:t},[t.buffer]):postMessage({status:z,data:t},[t.buffer]):Wn.send(t)}const Td=function(){let e=!1;return(t,r,i)=>{!e&&t&&r&&i&&(e=!0,postMessage({status:"FIRST_VIDEO_FRAME"}))}}();function xd(e,t,r,i,a,n,o,s,l,c,u,h){try{var _=se().subarray(e+0,e+t),f=oe().subarray(r,r+8),p=new Uint8Array(8);p.set(f,0,8);var m=0;for(let e=0;e<8;e++)m+=p[e]*Math.pow(256,e);var g=i>>10<<10,v=a,y=n;if(Td(g,Hn=v,$n=y),Ko&&Qo&&g===Ko&&Ae(g,l,c,u),Bd&&we({ssrc:i,r_w:l,r_h:c,rotation:u},Ud,void 0,Fn),Wc(i)&&!To.firstflag&&(postMessage({status:"NewActiveSpeakerFirstframeCallback",ssrc:To.ssrc}),To.firstflag=!0),er.isUseSsrcStream()){let e=_;er.shouldCropWasmFrame(a,n,{x:o,y:s,width:l,height:c})&&(e=Ee(_,a,n,{x:o,y:s,width:l,height:c}),v=l,y=c,o=0,s=0),qc.pushRemoteVideoData(i,e,"I420",v,y,{left:o,top:s,width:l,height:c},{rotation:u})}else if(Eo){if(!So)return;if(Ga){const e=new Uint8Array(_.length);e.set(_,0,_.length);let t={cmd:"decoded",yuvdataptr:0,yuvdata:e,yuvlength:_.length,data:e,ntptime:m,ssrc:g,width:v,height:y,r_y:s,r_x:o,r_h:c,r_w:l,rotation:u,yuv_limited:h,enableMultiDecodeVideoWithoutSAB:Ga};return void bo.Put_Video_Data_Queue(t)}Md||(Md=new fe(10,32e5));let e=new pe(Md);if(e.storeSync(_)){let t={yuvdata:e,ntptime:m,ssrc:g,width:v,height:y,r_x:o,r_y:s,r_w:l,r_h:c,rotation:u,yuv_limited:h};bo&&bo.Put_Video_Data_Queue(t,8)}}else if(self.videoDecodeFrameBackSABRingBuffer){let e=new Ft;e.setOBJ({data:_,video_timestamp:m,video_ssrc:g,video_width:v,video_height:y,rendering_x:o,rendering_y:s,rendering_w:l,rendering_h:c,rotation:u,yuv_limited:h}),self.videoDecodeFrameBackSABRingBuffer.enqueue(e.obj2buffer()),postMessage({status:d})}else{const e=new Uint8Array(t);e.set(_,0,t),postMessage({status:0,data:e,video_timestamp:m,video_ssrc:g,video_width:v,video_height:y,rendering_x:o,rendering_y:s,rendering_w:l,rendering_h:c,rotation:u,yuv_limited:h},[e.buffer])}}catch(e){Zo.timeoutReport(0,0)}}var Ad=new Map;function Cd(e,t){Re()&&Zc>=4&&t>2&&(t=2),Ad.set(e>>10<<10,t);let r=Array.from(Ad.values()),i=Math.max.apply(null,r);zn!==i&&(zn=i,postMessage({status:n,ssrc:e,size:zn}))}function kd(e,t){var r=new Uint8Array(t),i=oe().subarray(e+0,e+t);r.set(i,0,t),Wn.send(r)}function Fd(e,t){var r=new Uint8Array(t),i=oe().subarray(e+0,e+t);r.set(i,0,t),postMessage({status:l,data:Ld(r)})}function Pd(e,t){qn&&qn.writeWasmLog(e,t)}function Id(e,t){qn&&qn.writeWasmLog(e,t)}function Ld(e){var t,r,i,a,n,o;for(t="",i=e.length,r=0;r<i;)switch((a=e[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(a);break;case 12:case 13:n=e[r++],t+=String.fromCharCode((31&a)<<6|63&n);break;case 14:n=e[r++],o=e[r++],t+=String.fromCharCode((15&a)<<12|(63&n)<<6|63&o)}return t}function Dd(e,t){ro||(ro=setInterval((function(){Dn&&Wa(Dn)}),6e4));let r=new Uint8Array(t),i=oe().subarray(e+0,e+t);r.set(i,0,t),postMessage({status:h,data:r})}function Od(e){if(!e)return 0;let t=Module._malloc(e.length);return se().subarray(t,t+e.length).set(e,0,e.length),t}function Wd(e){e&&Module._free(e)}new ot;let Bd=!1,Ud=!0;function Nd(e){if(!So)return Module._free(e.yuvdataptr),void(e.yuvdataptr=null);if(Td(e.ssrc,e.width,e.height),Ko&&Qo&&e.ssrc===Ko&&Ae(e.ssrc,e.r_w,e.r_h,e.rotation),Bd&&we(e,Ud,void 0,Fn),Wc(e.ssrc)&&!To.firstflag&&(postMessage({status:"NewActiveSpeakerFirstframeCallback",ssrc:To.ssrc}),To.firstflag=!0),er.isUseSsrcStream()){let t;t=e.enableMultiDecodeVideoWithoutSAB?e.data:se().subarray(e.yuvdataptr,e.yuvdataptr+e.yuvlength);let r=e.width,i=e.height,a=e.r_x,n=e.r_y;er.shouldCropWasmFrame(e.width,e.height,{left:e.r_x,top:e.r_y,width:e.r_w,height:e.r_h})&&(t=Ee(t,e.width,e.height,{left:e.r_x,top:e.r_y,width:e.r_w,height:e.r_h}),r=e.r_w,i=e.r_h,a=0,n=0),qc.pushRemoteVideoData(e.ssrc,t,"I420",r,i,{left:a,top:n,width:e.r_w,height:e.r_h},{rotation:e.rotation}),e.yuvdataptr&&Module._free(e.yuvdataptr)}else bo&&bo.Update_RemoteVideo_Texture(e)}var Vd,Gd=null,jd=null;function Hd(){return Hn>=fs&&js.Signal_Encode_Thread.status==Le}function $d(e){js.Signal_Encode_Thread.handle&&(js.Signal_Encode_Thread.handle.postMessage({cmd:"videoframe",data:e}),ts.ref())}var zd=0;let qd,Yd,Xd;function Kd(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r;er.isUseSsrcStream()?qc.pushLocalVideoFrame(e,{rotation:Ao,isRotationInFrame:t,mirror:Po}):null===(r=ds)||void 0===r||r.postMessage({cmd:"SVIEW",rotation:Ao,mode:1,data:e,fromVideoTag:t})}async function Qd(e){!function(e){ho||(hs.isSupportMultiThread?((Nn||Vn||Gn||Gs==qe.ANDROID)&&self.VideoFrame&&e.frame instanceof VideoFrame&&(Ln=1,ps=!0),mo=4+ze*Ln+12*Ln+2*Ln,ho=Module._malloc(mo),fo=se().subarray(ho,ho+mo),po=(self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16).subarray(ho/2,(ho+mo)/2),Atomics.store(po,0,0),ps||postMessage({status:u,data:ho,wasmMemory})):(mo=ze,ho=Module._malloc(mo)))}(e);let t,r,i,a=null,n=null,o=0,d=0,l=0,c=0,h=0,_=0,f=0,p=0,m=0,g=0,v=0,y=0;if(function(){let e=Hd(),t=Hs&&Mn&&Rn>1&&ps&&!Oo&&!Wo&&!bl&&!Do&&e&&js.Signal_Encode_Thread.latestflag;if(t!=En){let r="WCL_M,UEP|abOption:".concat(Hs,"|dualCall:").concat(Mn,"|mask:").concat(Oo,"|vb:").concat(Wo,"|setting:").concat(bl||Do,"|webcodec:").concat(e&&js.Signal_Encode_Thread.latestflag,"|video:").concat(ps,"|maxSubVideo:").concat(Rn,"|optCopyFrame:").concat(t);postMessage({status:s,data:r}),ae(r),En=t}}(),Wo){let e=ze;t=Module._malloc(e),Uo<8&&No>$e&&(No=$e,rs.start(rl,1e3/No))}else hs.isSupportMultiThread?(Xd=Atomics.load(fo,0),Yd=Atomics.load(fo,1),(Yd+1)%Ln==Xd?(_o||(ps?_o=ho+4+4+8+2:(mo=ze,_o=Module._malloc(mo))),qd=_o):qd=ho+4+(ze+4+8+2)*Yd+4+8+2,r=0):qd=ho,t=qd;if(!ps||Wo||Oo||Kd(e.frame,Vn),Sn.setVideoCaptured(!0),e.frame&&e.format&&(2==e.format||4==e.format)){if(i=e.frame,p=i.visibleRect?i.visibleRect.width:i.cropWidth,m=i.visibleRect?i.visibleRect.height:i.cropHeight,g=i.visibleRect?i.visibleRect.left:i.cropLeft,v=i.visibleRect?i.visibleRect.top:i.cropTop,p!==Hn||m!==$n)return i.close(),void ts.closeSample();d=p,o=m,l=d/2,c=d/2,h=p*m,_=p*m/4,f=p*m/4,y=p*m*3/2,r=y,g=0,v=0;let s={top:v,left:g,width:p,height:m};if(Oo&&wn){let t,r=cc(s.width);if(ko)t=Nl(i,s,qd,r),ts.captureSample();else{if(4==e.format){let e=p*m*5/2;sl&&n&&n.length==e||(sl&&Module._free(sl),sl=Module._malloc(e))}else wl&&wl.length==y||(wl=new Uint8Array(y));if(4==e.format){let e=p*m*5/2;n=se().subarray(sl,sl+e),await i.copyTo(n),wl=new Uint8Array(n.buffer,sl,y)}else await i.copyTo(wl);t=ql(d,o,wl,qd,s,2,r),ts.captureSample()}if(Wo||1==xo||(xo=1,lc()),so){let e=Hd();e&&$d(t),xa(Dn,qd,pl,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,xo,e,0,zd++,En,Ao)}ps&&t&&Kd(t),t&&(t.close(),ts.closeSample()),Vs=!0,d=Hn,o=$n,p=Hn,m=$n,g=0,v=0}else{if(!En)if(2==e.format)a=se().subarray(t,t+y),await i.copyTo(a);else{let e=p*m*5/2;a=se().subarray(t,t+e),await i.copyTo(a)}if(Wo||2==xo||(xo=2,lc()),uc(i,s,d,o,xo,t,y),!Oo&&Wo)tc.sendYuvData(t,0,Hn,$n,h,_,_,d,l,l,g,v,2);else{let e=Hd();e&&$d(i),Aa(Dn,t,h,t+h,_,t+h+_,f,d,l,c,g,v,xo,e,0,zd++,En,Ao)}Vs=!0}}else if(e.frame&&e.format&&3==e.format){if(i=e.frame,p=i.visibleRect?i.visibleRect.width:i.cropWidth,m=i.visibleRect?i.visibleRect.height:i.cropHeight,g=i.visibleRect?i.visibleRect.left:i.cropLeft,v=i.visibleRect?i.visibleRect.top:i.cropTop,p!==Hn||m!==$n)return i.close(),void ts.closeSample();d=p,o=m,l=d,h=p*m,_=p*m/2,y=p*m*3/2,r=y,g=0,v=0;let n={top:v,left:g,width:p,height:m};if(Oo&&wn){let e,t=cc(n.width);if(ko?(e=Nl(i,n,qd,t),ts.captureSample()):(wl&&wl.length==y||(wl=new Uint8Array(y)),i.copyTo(wl),e=ql(d,o,wl,qd,n,3,t),ts.captureSample()),Wo||1==xo||(xo=1,lc()),so){let t=Hd();t&&$d(e),xa(Dn,qd,pl,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,xo,t,0,zd++,En,Ao)}ps&&e&&Kd(e),e&&(e.close(),ts.closeSample()),Vs=!0,d=Hn,o=$n,p=Hn,m=$n,g=0,v=0}else{if(En||(a=se().subarray(t,t+y),await i.copyTo(a)),Wo||3==xo||(xo=3,lc()),uc(i,n,d,o,3,t,y),!Oo&&Wo)tc.sendYuvData(t,0,Hn,$n,h,_,_,d,l,l,g,v,3);else{let e=Hd();e&&$d(i),Aa(Dn,t,h,t+h,_,t+h,_,d,l,l,g,v,xo,e,0,zd++,En,Ao)}Vs=!0}}else if(e.frame&&e.format&&(5==e.format||1==e.format)){if(i=e.frame,p=i.visibleRect?i.visibleRect.width:i.cropWidth,m=i.visibleRect?i.visibleRect.height:i.cropHeight,g=i.visibleRect?i.visibleRect.left:i.cropLeft,v=i.visibleRect?i.visibleRect.top:i.cropTop,p!==Hn||m!==$n)return i.close(),void ts.closeSample();y=p*m*4,r=y,d=p,o=m,g=0,v=0;let a=5==e.format?4:1,n={top:v,left:g,width:p,height:m};if(Oo){let e,r=cc(n.width);if(ko?(e=Nl(i,n,t,r),ts.captureSample()):(wl&&wl.length==y||(wl=new Uint8Array(y)),await i.copyTo(wl),e=ql(d,o,wl,t,n,a,r),ts.captureSample()),Wo||1==xo||(xo=1,lc()),so){let r=Hd();r&&$d(e),xa(Dn,t,y,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,xo,r,0,zd++,En,Ao)}ps&&e&&Kd(e),e&&(e.close(),ts.closeSample()),Vs=!0,d=Hn,o=$n,p=Hn,m=$n,g=0,v=0}else{if(!En){const e=se().subarray(t,t+y);await i.copyTo(e)}if(Wo||xo==a||(xo=a,lc()),uc(i,n,d,o,a,t,y),!Oo&&Wo)tc.sendRgbaData(t,y,Hn,$n,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,a);else{let e=Hd();e&&$d(i),xa(Dn,t,y,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,xo,e,0,zd++,En,Ao)}Vs=!0}}else{Wo||1==xo||(xo=1,lc()),nc&&(js.isEnableVideoEncodeHardWareThread&&(js.Signal_Encode_Thread.latestflag=!1,Va(Dn,!1)),nc=!1),d=Hn,o=$n,p=Hn,m=$n,g=0,v=0;let i=se().subarray(t,t+e.length);r=e.length,pl=e.length,i.set(e,0,r),Wo?tc.sendRgbaData(t,pl,d,o,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,1):Dn&&xa(Dn,t,pl,4*jo.rgba_stride,jo.rgba_x,jo.rgba_y,1,!1,0,zd++,En,Ao)}if(!Wo)if(er.isUseSsrcStream()&&!ps){const t=!!i&&Vn;1!=xo||i||(i=new VideoFrame(e,{format:"RGBA",timestamp:1e3*performance.now(),duration:0,codedWidth:d,codedHeight:o,visibleRect:{left:g,top:v,width:p,height:m}})),Kd(i,t)}else{if(hs.isSupportMultiThread)qd!=_o&&(po[2+(ze+4+8+2)*Yd/2]=d,po[2+((ze+4+8+2)*Yd+2)/2]=o,po[2+((ze+4+8+2)*Yd+4)/2]=v,po[2+((ze+4+8+2)*Yd+6)/2]=g,po[2+((ze+4+8+2)*Yd+8)/2]=p,po[2+((ze+4+8+2)*Yd+10)/2]=m,po[2+((ze+4+8+2)*Yd+12)/2]=xo-1|Ao<<8,Atomics.store(fo,1,(Yd+1)%Ln),fo[2]=xo-1);else if(zs){let r={width:d,height:o,croppingParams:{top:v,left:g,width:p,height:m},ptr:t,mode:xo-1,ssrc:to,cmd:"SVIEW",data:null,rotation:Ao,fromVideoTag:!1};var b;1!=xo||i?(r.data=i,r.fromVideoTag=Vn,r.mode=1):r.data=e,qo?null===(b=ds)||void 0===b||b.postMessage(r):(r.mode=xo-1,zs.render(r))}if(Do&&Zn){let e={top:v,left:g,width:p,height:m};fc(d,o,new Uint8Array(se().subarray(qd,qd+r)),e,xo-1,Ao)}}i&&(i.close(),ts.closeSample())}let Jd=0;const Zd=20;function el(e){return Gs==qe.ANDROID&&e.displayWidth<e.displayHeight?(kn||(kn=new OffscreenCanvas(1,1)),Ao=3,function(e,t){const r=t.getContext("2d");let i=e.displayHeight,a=e.displayWidth;lo&&!An||(e.displayHeight>640||e.displayWidth>640)&&(i/=2,a/=2),t.width===i&&t.height===a||(t.width=i,t.height=a,r.setTransform(0,1,-1,0,t.width,0)),r.drawImage(e,0,0,a,i)}(e,kn),e.close(),e=new VideoFrame(kn,{timestamp:1e3*performance.now()})):kn&&kn.width>1&&(kn.width=1,kn.height=1),e}async function tl(e){let{done:t,value:r,processed:i,rotation:a}=e;if(t)return void(r&&r.close());if(Zi.hasProcessor()&&!i&&!Wo)return Vs=!0,Zi.onFrame(r),void r.close();Ao=a,ts.captureSample();let n,o=el(r);if("undefined"==o||null==o||null==o.format||"undefined"==o.format)return ie("video frame reader read null frame"),void o.close();if(o.format&&"I420"==o.format)n={frame:o,format:2};else if(o.format&&"NV12"==o.format)n={frame:o,format:3};else if(o.format&&"I420A"==o.format)n={frame:o,format:4};else if("BGRA"==(null==o?void 0:o.format))n={frame:o,format:5};else if("RGBA"==(null==o?void 0:o.format))n={frame:o,format:1};else if(o.format)return ie("Frame format ".concat(o.format," is not supported")),Lo||(Lo=!0,postMessage({status:g,format:o.format})),void o.close();let s=o.visibleRect?o.visibleRect.width:o.cropWidth,d=o.visibleRect?o.visibleRect.height:o.cropHeight;"BGRA"==o.format||"I420A"===o.format||n.format,Hn===s&&$n===d||(Hn=s,$n=d,jo.rgba_stride=s,jo.rgba_x=0,jo.rgba_y=0,lc(),postMessage({status:p,width:Hn,height:$n})),await Qd(n)}function rl(){let e=performance.now();if(!(e-Jd<Zd)){for(Jd=e,++gn%1440==0&&postMessage({status:s,data:"WCL_M,VCTN"+gn}),ts.captureTicket();ya.getLength()>2;){let e=ya.dequeue();e&&e.frame?(e.frame.close(),ts.closeSample()):Qn||!Nn&&null!=e&&e.data&&postMessage({data:e.data},[e.data.buffer])}if(cs&&(js.isSupportVirtualBackground&&ll&&!Oo&&!js.vbThreadCreatedFlag||js.threadState==Pe)){let e=ya.dequeue();e&&e.frame?(e.frame.close(),ts.closeSample()):Jn||(su(0),!Nn&&null!=e&&e.data&&postMessage({status:$,data:e.data},[e.data.buffer]))}else{if(!xn&&Qn&&Fo.reader&&Vs)Vs=!1,Fo.read().then(tl).catch((e=>{ie("Error trying to process video frame",e),Vs=!0}));else{const e=ya.dequeue();e&&(Ao=e.orientation);var t=null==e?void 0:e.data;if(t){const{stride:r,x:i,y:a,frame_width:n,frame_height:o}=e;jo.rgba_stride==r&&jo.rgba_x==i&&jo.rgba_y==a||(jo.rgba_stride=r,jo.rgba_x=i,jo.rgba_y=a),n==Hn&&o==$n||(Hn=n,$n=o,lc()),ts.captureSample(),Sn.setVideoCaptured(!0),Qd(t)}else e&&(ts.captureSample(),Sn.setVideoCaptured(!0),Qd(e))}0!=go.size||Qn||xn||Jn||(su(0),!Nn&&t&&t.length&&postMessage({status:$,data:t},[t.buffer]))}}}var il=!1;function al(e){if(!Dn||On!=e.ssid&&e.ssid){if(Dn&&(Ta(Dn),Dn=null),Dn=Ra(e.ssid,e.mtu_size,Yn,Xn,0,0,js.videoencodethreadmaxnumb,js.isEnableVideoEncodeHardWareThread,io,!1,Go,!1,Ho,er.shouldCropWasmFrameOnPosMismatch(),er.shouldCropWasmFrameOnSizeMismatchOnly()),nc=js.isEnableVideoEncodeHardWareThread,!Dn)return void postMessage({status:V});if(On=e.ssid,_d.updateKey(),Wa(Dn),eo){let e=Module._malloc(eo.length);se().subarray(e,e+eo.length).set(eo,0,eo.length),Da(Dn,to,e,eo.length),Module._free(e)}jn&&Ca(Dn,jn,jn.length),La(Dn,Un?1:0),Hn=e.width,$n=e.height,jo.rgba_stride=e.width,il=!0,Fa(Dn,e.width,e.height,e.fps,xo),dc(),ao?ka(Dn,16e5,1):ka(Dn,2e6,0),so=!0,fn(Dn,Bn)}Sn.startCheck(),so=!0,Qn||su(0),Gs!=qe.IPHONE&&Gs!=qe.ANDROID||(No=Ge),No=Mc(No),te("HCIW=".concat(Uo)),rs.start(rl,1e3/No),ts.start()}var nl,ol,sl,dl=null,ll=null,cl=null,ul=null,hl={vcanvas:null,mcanvas:null},_l=null,fl=null,pl=0,ml=0,gl=0,vl=0,yl={dx:0,dy:0,dWidth:0,dHeight:0},bl=!1,wl=null,Sl=new Uint8Array(4),El={sx:0,sy:0,sw:0,sh:0};function Ml(e){"BgImage"==e.imagename?ll=e.data:"MaskImage"==e.imagename&&(dl=e.data,yl=Object.assign(yl,e.maskCoordinate),Hn=Hn||e.width,$n=$n||e.height,jo.rgba_stride=Hn),Wl(yl,Hn,$n)}class Rl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.id=e,this.decodeInputIndex=1,this.context=null,this.decodeOutputIndex=0,this.videoFrameBuffer=[]}destory(){this.videoFrameBuffer.forEach((e=>e.videoFrame.close())),this.videoFrameBuffer=[]}getFrameIdData(e){let t=0;return this.videoFrameBuffer.some(((r,i)=>{if(r.frameIndex<e)r.videoFrame.close();else if(r.frameIndex===e)return t=r.videoFrame,this.videoFrameBuffer.splice(0,i+1),!0;return!1})),t}putFrameIdData(e,t){this.videoFrameBuffer.push({videoFrame:e,frameIndex:t})}deleteOneFrame(){if(this.videoFrameBuffer.length){let e=this.videoFrameBuffer.shift();if(e)return e.videoFrame.close(),1}return 0}getVideoFrameNumbers(){return this.videoFrameBuffer.length}}function Tl(){return 1}function xl(e,t){return js.Signal_Encode_Thread.handle&&js.Signal_Encode_Thread.handle.postMessage({cmd:"VideoEncodeInit",id:e,context:t}),0}function Al(e,t,r,i,a,n){return js.Signal_Encode_Thread.handle&&js.Signal_Encode_Thread.handle.postMessage({cmd:"VideoEncodeConfigure",id:e,Bitrate:t,Framerate:r,Width:i,Height:a,buffer:n}),0}function Cl(e,t,r,i,a,n){return js.Signal_Encode_Thread.handle&&js.Signal_Encode_Thread.handle.postMessage({cmd:"VideoEncode",id:e,videoFrameId:t,NewIDR:r,rawData:i,dataLength:a,timeout:n}),0}function kl(){js.Signal_Encode_Thread.handle&&js.Signal_Encode_Thread.handle.postMessage({cmd:"CloseVideoEncode"})}function Fl(e){Yo=e}var Pl,Il,Ll,Dl,Ol=new class{constructor(){this.decodeCodecHandles=new Map,this.ssrcToMap=new Map,this.totalVideoFrameNumbers=0,this.activeIds=[],this.usingVideoFrameList=[],this.videowebcodecencodestate=1}_checkUnusefulId(e,t){if(this.ssrcToMap.has(e)&&this.ssrcToMap.get(e)!==t){const r=this.decodeCodecHandles.get(t);r&&(r.destory(),this._deleteActiveId(t)),this.ssrcToMap.delete(e)}this.ssrcToMap.has(e)||this.ssrcToMap.set(e,t)}_getTotalVideoFrameNumbers(){let e=0;for(let t of this.decodeCodecHandles.keys()){let r=this.decodeCodecHandles.get(t);r&&(e+=r.getVideoFrameNumbers())}return e}_setActiveIds(e){this._deleteActiveId(e),this.activeIds.unshift(e),this.activeIds.length>9&&this.activeIds.splice(9,this.activeIds.length-9)}_deleteActiveId(e){this.activeIds.some(((t,r)=>{if(t===e)return this.activeIds.splice(r,1),!0}))}render(e){let{id:t,iFrameNum:r,ssrc:i,rotation:a,x:n,y:o,vwidth:s,vheight:d,format_width:l,format_height:c}=e;i=Rs(i),t=i,this._checkUnusefulId(i,t);const u=this.decodeCodecHandles.get(i);if(!u)return;this._setActiveIds(t);let h=u.getFrameIdData(r);if(h){if(this.totalVideoFrameNumbers=this._getTotalVideoFrameNumbers(),bo){const{displayWidth:e,displayHeight:t}=h;Td(i,e,t),Ko&&Qo&&i===Ko&&Ae(i,e,t,a),Bd&&we({ssrc:i,r_w:e,r_h:t,rotation:a},Ud,void 0,Fn),Wc(i)&&!To.firstflag&&(postMessage({status:"NewActiveSpeakerFirstframeCallback",ssrc:To.ssrc}),To.firstflag=!0);let r=l==h.codedWidth?{x:n,y:o,width:s,height:d}:null;bo.Update_RemoteVideo_Texture(h,!0,i,a,r)}er.isUseSsrcStream()&&qc.pushRemoteVideoFrame(i,h,{rotation:a}),(ba.getRendererProvider().isWebGLRendererType()||ba.getRendererProvider().isWebGL2RendererType()||er.isUseSsrcStream())&&h.close()}}closeFrame(e){try{const t=this.usingVideoFrameList.indexOf(e);-1!==t&&this.usingVideoFrameList.splice(t,1),e.close&&e.close()}catch(e){ie("Error when closing a video frame",e)}}_checkMaxVideoFrameNumbers(e){if(this.totalVideoFrameNumbers>9-this.usingVideoFrameList.length)for(let e=this.activeIds.length-1;e>=0;e--){const t=this.activeIds[e],r=this.decodeCodecHandles.get(t);if(r||this._deleteActiveId(),r.getVideoFrameNumbers()>1){r.deleteOneFrame(),this.totalVideoFrameNumbers=this._getTotalVideoFrameNumbers();break}}if(this.totalVideoFrameNumbers>9-this.usingVideoFrameList.length){const t=this.decodeCodecHandles.get(e);t&&(t.deleteOneFrame(),this.totalVideoFrameNumbers=this._getTotalVideoFrameNumbers())}}put_data(e){let{id:t,ssrc:r,data:i,frameIndex:a}=e;if(r=Rs(r),!ks(r)&&Rs(null==To?void 0:To.ssrc)!==r)return void i.close();let n=this.decodeCodecHandles.get(r);n?t!=n.id&&(n.destory(),n.id=t):(n=new Rl(t),this.decodeCodecHandles.set(r,n)),n.putFrameIdData(i,a),this.totalVideoFrameNumbers++,this._checkMaxVideoFrameNumbers(r)}clearAll(){for(let e of this.decodeCodecHandles.keys()){const t=this.decodeCodecHandles.get(e);t&&t.destory()}this.decodeCodecHandles.clear(),this.ssrcToMap.clear(),this.activeIds=[]}clear(e){const t=this.decodeCodecHandles.get(e);t&&(t.destory(),this.decodeCodecHandles.delete(e));const r=this.ssrcToMap.get(e);r&&(this.ssrcToMap.delete(e),this._deleteActiveId(r))}};function Wl(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{"object"==typeof t&&t.ideal&&(t=t.ideal),"object"==typeof r&&r.ideal&&(r=r.ideal),cl&&ul||(cl=new OffscreenCanvas(t,r),ul=_e(cl)),cl.width==t&&cl.height==r||(cl.width=t,cl.height=r)}catch(e){ie("Update_Mask_Texture, width=$".concat(JSON.stringify(t),", height=").concat(JSON.stringify(r),". "),e),t=cl.width,r=cl.height}if(ul.clearRect(0,0,t,r),nl=null,dl&&ll&&"blur"!==ll){if(e.dWidth>0&&e.dHeight>0&&gl>0&&vl>0&&t>0&&r>0){let i=e.dx/(gl/t),a=e.dy/(vl/r),n=e.dWidth/(gl/t),o=e.dHeight/(vl/r);ul.drawImage(dl,i,a,n,o)}let a,n,o,s;if(ul.globalCompositeOperation="source-out",Bl(),a=El.sx,n=El.sy,o=El.sw,s=El.sh,ul.drawImage(ll,a,n,o,s,0,0,t,r),i){let e=ul.getImageData(0,0,t,r);nl=new Uint8Array(e.data.buffer),i.updateSelfMaskImage(t,r,nl)}}else i&&(nl=Sl,i.updateSelfMaskImage(1,1,nl))}function Bl(){let e,t,r,i=0,a=16/9,n=ll.width,o=ll.height;a*o>=n?(r=n,i=n/a,e=0,t=(o-i)/2):(r=o*a,i=o,e=(n-r)/2,t=0),El.sx=e,El.sy=t,El.sw=r,El.sh=i}function Ul(e,t,r){if(!Bo.get(ol)||!Bo.get(ol).canvas)return;let i=t||e.width,a=r||e.height;Bo.get(ol).display||(Bo.get(ol).display=Bo.get(ol).canvas.getContext("2d"));const n=ml?vt(i,a,void 0,void 0,Bo.get(ol).canvas.width/Bo.get(ol).canvas.height):ic?vt(i,a):null;Po?(Io||(Bo.get(ol).display.scale(-1,1),Io=!0),Bo.get(ol).display.clearRect(0-Bo.get(ol).canvas.width,0,Bo.get(ol).canvas.width,Bo.get(ol).canvas.height),Bo.get(ol).display.drawImage(e,...n?[n.left,n.top,n.width,n.height]:[],0-Bo.get(ol).canvas.width,0,Bo.get(ol).canvas.width,Bo.get(ol).canvas.height)):(Io&&(Bo.get(ol).display.setTransform(1,0,0,1,0,0),Io=!1),Bo.get(ol).display.clearRect(0,0,Bo.get(ol).canvas.width,Bo.get(ol).canvas.height),Bo.get(ol).display.drawImage(e,...n?[n.left,n.top,n.width,n.height]:[],0,0,Bo.get(ol).canvas.width,Bo.get(ol).canvas.height))}function Nl(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=t.width,n=t.height;if(wn&&(hl.mcanvas&&_l||(hl.mcanvas=new OffscreenCanvas(a,n),_l=_e(hl.mcanvas)),hl.mcanvas.width==a&&hl.mcanvas.height==n||(hl.mcanvas.width=a,hl.mcanvas.height=n),_l.clearRect(0,0,a,n),_l.drawImage(e,0,0,a,n),cl?_l.drawImage(cl,0,0,a,n):Wl(yl,a,n)),Bo.get(ol)&&Bo.get(ol).canvas&&(wn?Ul(hl.mcanvas):Ul(e,a,n)),wn){let e=_l.getImageData(0,0,a,n),t=new Uint8Array(e.data.buffer);return se().subarray(r,r+t.length).set(t,0,t.length),pl=t.length,i?new VideoFrame(hl.mcanvas,{timestamp:1e3*performance.now()}):null}}function Vl(){}function Gl(){var e,t;if(fl){if(!1===(null===(e=(t=fl).isAvaiable)||void 0===e?void 0:e.call(t))){var r,i;null===(r=(i=fl).restoreContext)||void 0===r||r.call(i)}}else{const e={forceNoGL:void 0,contextOptions:{webglcontextlostCallback:Vl,webglcontextrestoredCallback:jl},webGLResources:void 0,initMask:!0};fl=ba.createWebGLVideoRenderDisplay(hl.vcanvas,"MixMask",0,e)}}function jl(){fl=null,Gl()}function Hl(e,t){let{canvas:r,rendercanvasID:i}=t;ce(i)}function $l(e,t){let{canvas:r,rendercanvasID:i}=t;ue(i)}function zl(){return 1}function ql(e,t,r,i,a,n){let o,s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],d=a.width,l=a.height;if(wn){var c;if(hl.vcanvas||(hl.vcanvas=new OffscreenCanvas(d,l)),null===(c=fl)||void 0===c||!c.isAvaiable())return void Gl();hl.vcanvas.width==d&&hl.vcanvas.height==l||(hl.vcanvas.width=d,hl.vcanvas.height=l),fl.setVideoMode(n-1),nl?fl.updateSelfMaskImage(d,l,nl):Wl(yl,d,l,fl);let i={x:0,y:0,width:d,height:l};fl.updateRemoteVideoTextures(e,t,a,r,0,!0,i,!1),fl.drawRemoteVideo(i),o=fl.readPixelsSyncRequest(0,0,d,l)}else o=r;let u=Bo.get(ol)?Bo.get(ol).canvas:null;if(u){!function(e,t){var r,i;if(Bo.get(t).display){if(!1===(null===(r=(i=Bo.get(t).display).isAvaiable)||void 0===r?void 0:r.call(i))){var a,n;null===(a=(n=Bo.get(t).display).restoreContext)||void 0===a||a.call(n)}}else{const r={forceNoGL:void 0,contextOptions:{webglcontextlostCallback:Hl,webglcontextrestoredCallback:$l,params:{canvas:e,rendercanvasID:t}},webGLResources:void 0,initMask:!1};Bo.get(t).display=ba.createVideoRenderDisplay(e,t,0,r)}Bo.get(t).display.setFillMode(ml)}(u,ol);let i=u?Bo.get(ol).display:null,s={left:0,top:0,width:d,height:l},c={x:0,y:0,width:u.width,height:u.height};wn?(i.setVideoMode(0),i.updateSelfVideoTextures(d,l,o,s),i.drawSelfVideo(c,!1,Po)):(i.setVideoMode(n-1),i.updateRemoteVideoTextures(e,t,a,r,0,!0,c,!1),i.drawRemoteVideo(c,Po)),ba.renderWith(i)}return wn&&(se().subarray(i,i+o.length).set(o,0,o.length),pl=o.length),s?wn?new VideoFrame(o,{format:"RGBA",timestamp:1e3*performance.now(),codedWidth:d,codedHeight:l}):void 0:null}var Yl,Xl,Kl=!1,Ql=(new Object,[{dataReady:!1,configReady:!1,modelArtifacts:new Object,modelJSON:null},{dataReady:!1,configReady:!1,modelArtifacts:new Object,modelJSON:null},{dataReady:!1,configReady:!1,modelArtifacts:new Object,modelJSON:null}]);async function Jl(e,t){if(!Ql[t].dataReady||!Ql[t].configReady){if(Ql[t].dataReady=!0,Ql[t].modelJSON=JSON.parse(e.json),Ql[t].modelArtifacts.modelTopology=Ql[t].modelJSON.modelTopology,Ql[t].modelArtifacts.format=Ql[t].modelJSON.format,Ql[t].modelArtifacts.generatedBy=Ql[t].modelJSON.generatedBy,Ql[t].modelArtifacts.convertedBy=Ql[t].modelJSON.convertedBy,null!=Ql[t].modelJSON.weightsManifest)for(const e of Ql[t].modelJSON.weightsManifest)Ql[t].modelArtifacts.weightSpecs=e.weights;null!=Ql[t].modelJSON.trainingConfig&&(Ql[t].modelArtifacts.trainingConfig=Ql[t].modelJSON.trainingConfig),null!=Ql[t].modelJSON.userDefinedMetadata&&(Ql[t].modelArtifacts.userDefinedMetadata=Ql[t].modelJSON.userDefinedMetadata),Ql[t].configReady=!0,Ql[t].modelArtifacts.weightData=e.bin,Il&&Zl(t)}}function Zl(e){Ql[e].dataReady&&Ql[e].configReady&&Il&&js&&!js.vbThreadCreatedFlag&&js.vbThreadWorker&&(js.vbThreadWorker.postMessage({cmd:"vbObj"+e,tfjsUrl:Ll,modelJSON:Ql[e].modelJSON,weightData:Ql[e].modelArtifacts.weightData,vbBaseUrl:Dl}),Ql[e].modelArtifacts.weightData=null,Ql[e].modelJSON=null)}async function ec(e){if(Il)return;Dl=e.substr(0,e.lastIndexOf("/")+1);const t=await function(e){return ga(this,void 0,void 0,(function*(){const t=yield ma(e);return yield t.blob()}))}(e);Ll=t,Il=!0,Zl(0),Zl(1),Zl(2)}const tc={sendBg:function(e,t,r,i){let a=new Uint8Array(e);if(Ss()||Ys){let e=Od(a);qa(e,t,r,i)}else zs&&zs.canTransferVBData()?zs.postMessage({cmd:"vbBg",data:a,length:t,width:r,height:i}):a=null},sendBlur:function(){Ss()||Ys?Ya(0,0):zs&&zs.canTransferVBData()&&zs.postMessage({cmd:"vbBlur"})},sendYuvData:function(e,t,r,i,a,n,o,s,d,l,c,u,h){const _=3===h?a+n:a+n+o,f=e+a,p=3===h?f:f+n;if(Ss()||Ys)return Xa(e,t,r,i,e,a,f,n,p,o,s,d,l,c,u,h),void(Ys&&postMessage({cmd:"vb-fin"}));if(zs&&zs.canTransferVBData(!0)){let f=se().subarray(e,e+_),p=new Uint8Array(_);p.set(f,0,_),zs.postMessage({cmd:"vbYuv",data:p,length:t,width:r,height:i,yDataLength:a,uDataLength:n,vDataLength:o,yStride:s,uStride:d,vStride:l,xOffset:c,yOffset:u,dataFormat:h}),p=null}Wd(e)},sendRgbaData:function(e,t,r,i,a,n,o,s){if(Ss()||Ys)return Ka(e,t,r,i,a,n,o,s),void(Ys&&postMessage({cmd:"vb-fin"}));if(zs&&zs.canTransferVBData(!0)){let d=se().subarray(e,e+t),l=new Uint8Array(t);l.set(d,0,t),zs.postMessage({cmd:"vbRgba",data:l,length:t,width:r,height:i,rgbaStride:a,xOffset:n,yOffset:o,dataFormat:s})}Wd(e)}};function rc(e){if(e.data){if("blur"==(ll=e.data))tc.sendBlur();else{let e,t,r,i,a,n;Bl(),e=El.sx,t=El.sy,r=El.sw,i=El.sh,r>1280?(a=1280,n=720):(a=r,n=i),Pl||(Pl=new OffscreenCanvas(a,n)),Pl.width=a,Pl.height=n;let o=Pl.getContext("2d");o.drawImage(ll,e,t,r,i,0,0,Pl.width,Pl.height);let s=o.getImageData(0,0,Pl.width,Pl.height);tc.sendBg(s.data,s.data.length,Pl.width,Pl.height)}Wo=!0,Sn.setVBFlag(!0)}else ll=null,Wo=!1,Sn.setVBFlag(!1)}let ic=!1;var ac,nc=!1,oc=!0,sc=!1;function dc(){if(!Dn)return;let e=Is||dd(),t=Hn,r=$n,i=function(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}(t,r),a=function(e,t,r,i,a){if(!a&&!i||1==e)return!1;let n=i&&t>=640,o=a&&t>=1280;return 2!=e||640==t&&480==r?n||o:((n||o)&&re("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}(i,t,r,oc&&e&&lo,oc&&lo);ic&&(3==i||sc||(sc=!0,ae("disable original ratio ".concat(t," x ").concat(r))),a=a&&3==i,i=3),Qa(Dn,i),js.isEnableVideoEncodeHardWareThread&&(nc=a,js.Signal_Encode_Thread.latestflag=a&&oc,Va(Dn,js.Signal_Encode_Thread.latestflag))}function lc(){Dn&&(Ia(Dn,Hn,$n,No,xo),dc())}function cc(e){return ps||e>=fs&&js.Signal_Encode_Thread.status==Le}function uc(e,t,r,i,a,n,o){Oo&&(ko?Nl(e,t,0,!1):ql(r,i,se().subarray(n,n+o),0,t,a,!1))}function hc(e,t){let{canvas:r,rendercanvasID:i}=t;ce(i)}function _c(e,t){let{canvas:r,rendercanvasID:i}=t;ue(i)}function fc(e,t,r,i,a){var n,o;let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!Bo.get(Zn)||!Bo.get(Zn).canvas)return;if(function(e,t){var r,i;if(Bo.get(t).display){if(!1===(null===(r=(i=Bo.get(t).display).isAvaiable)||void 0===r?void 0:r.call(i))){var a,n;null===(a=(n=Bo.get(t).display).restoreContext)||void 0===a||a.call(n)}}else{const r={forceNoGL:void 0,contextOptions:{preserveDrawingBuffer:!1,webglcontextlostCallback:hc,webglcontextrestoredCallback:_c,params:{canvas:e,rendercanvasID:t}},webGLResources:void 0,initMask:!1};Bo.get(t).display=ba.createVideoRenderDisplay(e,t,0,r)}Bo.get(t).display.setFillMode(ml)}(Bo.get(Zn).canvas,Zn),null===(n=Bo.get(Zn).display)||void 0===n||null===(o=n.isAvaiable)||void 0===o||!o.call(n))return;let d={x:0,y:0,width:Bo.get(Zn).canvas.width,height:Bo.get(Zn).canvas.height};Bo.get(Zn).display.setVideoMode(a);const l=ic?vt(i.width,i.height):null,c=Bo.get(Zn).display;a===Be?c.updateSelfVideoTextures(e,t,r,i,!0,s):c.updateRemoteVideoTextures(e,t,l||i,r,s,!0,d,!1),c.drawRemoteVideo(d,Po),ba.renderWith(c)}function pc(){if(ya)for(;ya.getLength()>0;){let e=ya.dequeue();e.frame&&e.frame.close()}ya=new ot}function mc(){if(Bo.size>4){let e=Array.from(Bo.keys());ie("settingRenderCanvas set more than 4 canvas, size=".concat(Bo.size,", ids:").concat(e.join()))}}function gc(e,t,r,i,a,n,o,s,d){$o.monitorPanelFlag&&postMessage({status:Y,data:{width:e,height:t,fps:r,rtt:i,jitter:a,avg_loss:n,max_loss:o,bandwidth:s,rate:d}}),io||!$o.renderFlag||$o.messageIndex++%Fe==0||$o.monitorPanelFlag}function vc(){const e=()=>{Dn&&ja(Dn)};if($o.qosIntervalId&&clearInterval($o.qosIntervalId),$o.monitorPanelFlag||$o.renderFlag){if($o.monitorPanelFlag)return void($o.qosIntervalId=setInterval(e,$o.panelpollingInterval||ke));if($o.renderFlag)return void($o.qosIntervalId=setInterval(e,Fe*ke))}}function yc(e){Dn&&fn(Dn,e),Bn=e}function bc(e,t,r){postMessage({status:S,isUplink:0===e,networkLevel:t,bwLevel:r})}function wc(e,t){var r=se().subarray(e+0,e+t);postMessage({status:s,data:Ld(r)})}function Sc(e){switch(e.status){case 0:So&&bo&&bo.Set_SSRC_Latest_Time_Stamp(e.data);break;case 1:if(Dn){let t=Module._malloc(e.data.length);se().subarray(t,t+e.data.length).set(e.data),Ua(Dn,t,e.data.length),Module._free(t);let r=new Uint32Array(e.data.buffer),i=null;for(let t=0;t<e.data.length/16;t++)if(512&r[4*t]){i=r.subarray(4*t,4*t+4);break}if(!i)return;if(hs.isSupportOffscreenCanvas&&ls){let e=232.8*i[1]/1e9+1e3*i[2];ls.postMessage(e)}}break;case 2:So&&bo&&e.data&&bo.Set_SSRC_Latest_Time_Stamp(e.data,e.ssrc),hs.isSupportOffscreenCanvas&&ls&&e.sdata&&ls.postMessage(e.sdata)}}function Ec(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ie("E:H webcodec encode failed code ".concat(t," ").concat(e,", config ").concat(Os,", retry ").concat(r,", subCode ").concat(i,", inHWThread=").concat(a)),a||(r=(t===Xe.WEBCODEC_RETRY||t===Xe.WEBCODEC_TIMEOUT_ERROR)&&Ws&&Os<Bs,r&&postMessage({cmd:"webcodecRetry",id:e,errCode:t})),r){Os=Bs,Ds=Us,Ea=!1;try{let e=JSON.stringify(Ds);Sa=e.includes("L1T2")?1:0}catch(e){}te("WCEF-retry=".concat(!Ea,"|code=").concat(t,"|id=").concat(e,"|subCode=").concat(i,"|l1t2=").concat(Sa,"|inHWThread=").concat(a))}else if(eu(!0,e,t),te("WCEF-code=".concat(t,"|id=").concat(e,"|subCode=").concat(i,"|l1t2=").concat(Sa,"|inHWThread=").concat(a)),An=!0,!Cn&&(Gs==qe.IPHONE||Gs==qe.ANDROID)){let e=je;rs.start(rl,1e3/e),Rc(e)}}function Mc(e){let t=e;return Cn||Gs!=qe.IPHONE&&Gs!=qe.ANDROID||(t=lo&&!An?Ge:je),Rc(t),t}function Rc(e){(e>30||e<0)&&(e=Ge),Vo=Math.floor(1e3/e)-3}function Tc(){return Ma}function xc(e,t){te("TO: ".concat(Ma,", CT ").concat(performance.now(),", NT: ").concat(e>>>0,", ").concat(t>>>0))}var Ac,Cc=-1;self.addEventListener("message",(async function(e){var t=e.data;let r=e.data;switch(t.command){case"start_video_processor":Zi.addFrameCallback(r.name,(e=>{tl({done:!1,value:e,processed:!0,rotation:0})})),Zi.startProcessor(r.name,new Qi(r.name,Tn));break;case"stop_video_processor":Zi.stopProcessor(r.name);break;case"processor_message_port":Tn=t.data;break;case 136:Cc=r.workerType;break;case 1:try{if(f={enabled:!!r.enableFetchWithCache,reportLog(e){ae("FetchCache: ".concat(JSON.stringify(e)))},resourcePath:r.mediaSDKCDNPath},p=Object.assign({enabled:!0,cacheName:"zm-media",reportLog(e){console.log("FetchCache",e)}},f),ia.enabled=p.enabled??!1,ia.reportLog=p.reportLog??aa,ia.cacheName=p.cacheName??"zm-media",ia.enableLocalDebugLog=p.enableLocalDebugLog??!1,ia.resourcePath=p.resourcePath,pa=da&&ia.enabled&&ia.resourcePath?fa:ca,te("STARTMEDIA:".concat(function(e){let t=e.confId,r=!!e.isPreviewMode?1:0;return r|=Gc()?2:0,"".concat(t,":").concat(r)}(r))),r.pslVideoId&&(Ko=r.pslVideoId),Fn=!!r.isLSSPlayer,Pn=!!r.enableTCP,isPreviewMode&&!r.isPreviewMode&&(Dn&&Ta(Dn),Dn=null,ws.inited&&(ws.clear(),ws.start()),Oo=!1),isPreviewMode=!!r.isPreviewMode,r.MaskFlag&&(wn=!0),function(e){let t=e;if(Ma=e.currentTime-performance.now(),t._id,un=e.graphicalname,hn=e.vendorname,io=t.sendvideo,Go=t.uplimit?t.uplimit:0,Gs=e.platformType,Nn=!!t.isChromeOrEdge,Vn=!!t.isArmSafari,Gn=!!t.isFirefox,Kn=t.mtu_size,t.isSafari,Yn=t.meetingnumb+"",Xn=t.meetingid,Ga=!!t.enableMultiDecodeVideoWithoutSAB,wa=e.isWebCodecDecoderOnWhitelist,Xo=e.isVDIWebview,Gt=tr,Zt.init(e.renderUserAgentInfo),Kt.init(e.renderCapabilitiesDesc),er.init(e.renderConfigDesc),4===e.rendererType){er.setIsUseSsrcStream(!0);const t=rr.loadModuleFromBlob("wasm_ssrc_stream_service_dynmod",e.wasmSsrcStreamServiceDynmodBlob);zc=t,Yc=zc.exports.getSsrcManager(),qc=zc.exports.getWasmSsrcStreamPublisher(),zc.exports.setRegistryServicePort(e.registryServicePort),zc.exports.exposeService(io?"local":"remote|default")}if(Ga?(io||!t.isSupportMultiThread?hs.videodecodethreadnumb=1:(hs.videodecodethreadnumb=25,Ga=!1),t.IsRenderInWorker||(qo=!1)):(qo=!1,hs.videodecodethreadnumb=t.videodecodethreadnumb),t.isSupportMultiThread&&au.isSupportOffScreenCanvasWebgl()||(hs.videodecodethreadnumb=1),hs.isSupportMultiThread=t.isSupportMultiThread,hs.isSupportOffscreenCanvas=t.isSupportOffscreenCanvas&&au.isSupportOffScreenCanvasWebgl(),ms.isTeslaMode=e.isTeslaMode,to=t.confId,Ho=Gs==qe.IPHONE||Gs==qe.ANDROID,io){Is=e.is360penablehwenc,Ns=e.enable720p,Hs=!!e.enableOptCopyFrame,fs=Is?640:1280,hs.videodecodethreadnumb=1,js.isSupportVirtualBackground=t.isSupportVirtualBackground,js.enableVBWasmBackend=t.enableVBWasmBackend,js.videoencodethreadmaxnumb=e.videoencodethreadnumb,lo=e.initWebCodecFlag,js.Signal_Encode_Thread.initwebcodecflag=lo,js.Signal_Encode_Thread.latestflag=lo,js.isEnableVideoEncodeHardWareThread=e.isSupportWebCodecEnocde,js.videoencodethreadnumb=e.isSupportWebCodecEnocde?2:1,Ds=e.hwEncAdditionalConfig,Os=e.hwEncAddConIdx,Ws=e.supportHWEncRetry,Bs=e.hwEncRetryConIdx,Us=e.hwEncRetryConfig,Ea=e.supportHWEncRetry&&e.hwEncAddConIdx<e.hwEncRetryConIdx;try{let e=JSON.stringify(Ds);Sa=e.includes("L1T2")?1:0}catch(e){}}else us=hs.videodecodethreadnumb>1&&t.isSupportMultiThread&&au.isSupportOffScreenCanvasWebgl(),Ls=e.is360penablehwdec,lo=!!(t.isenablehw&&hs.videodecodethreadnumb>1),hs.isEnableVideoDecodeHardWareThread=t.isEnableVideoDecodeHardWareThread,hs.isEnableVideoDecodeHardWareThread||(hs.totalNumbofParseThread=3,lo=!1),_s=hs.videodecodethreadnumb>1?hs.videodecodethreadnumb+3:1,e.isPreviewMode||as()}(r),Kc||(function(e){var t;qn||null===(t=qn=function(){let e=!1;try{e=!1}catch(e){}return e?new Vt:null}())||void 0===t||t.init({workerType:e})}(io?At.VIDEO_ENCODE:At.VIDEO_DECODE),Module.wcl_trace_log=Id,Module.codecMRG=Ol,Module.MCMMonitor_Video_LOG=wc,Module.put_data=Nd,Module.js_info_from_wcl_thread=Rd,Module.decode_callback=Cd,Module.on_psl_mix_share_info_changed=wd,Module.js_info_from_wcl_video_data=Sd,Module.change_capture_resolution=gd,Module.APP_Troubleshoting_Info=Fd,Module.SAVE_IV=Dd,Module.processed_capture_data_callback=Ed,Kc=!0),Xc||(io?(xs(!1),js.videoencodethreadmaxnumb>1&&(Ms(!0),cs="function"==typeof Worker)):xs(!!us),Xc=!0),isPreviewMode){!function(e){postMessage({status:27}),io&&js.isSupportVirtualBackground?io&&js.isSupportVirtualBackground&&Xs("VB",1,js.enableVBWasmBackend):postMessage({status:8}),Hc(e),$c(e)}(r);break}if(to){var i;const e={cmd:B,data:to};null===(i=Wn)||void 0===i||i.sendCommand(e)}Gc()||(Vc=!1,te("RSTHOLD")),dn||(dn=setInterval((()=>{Gc()&&mn&&Dn&&ln(Dn,!!io)}),1e3)),$c(r),Hc(r),io?js.isSupportVirtualBackground?js.isSupportVirtualBackground&&Xs("VB",1,js.enableVBWasmBackend):postMessage({status:8}):(Ac=r.decHAOption,te("decHAOption:".concat(Ac)),jc()),setTimeout((()=>{const e=ao||no;ae("VIDEO_NETWORK_".concat(io?"SEND":"RECV",":").concat(e))}),3e4)}catch(e){postMessage({status:V}),ie("Error in startMedia",e)}break;case 5:ou(t.websocket_ip_address,!0);break;case 3:var a;null===(a=Wn)||void 0===a||a.closeWebsocket();break;case 6:var n;null===(n=Wn)||void 0===n||n.resetWebrTransportUrl(t.webtransportURL);break;case 4:var o;null===(o=Wn)||void 0===o||o.closeWebTransport();break;case"failover":ou(t.websocket_ip_address,!1);break;case 2:bn=!0,io&&cn(),Wn&&(Wn.close(),Wn=null),ro&&(clearInterval(ro),ro=null),Sn.stopCheck(),Dn&&(Pa(Dn),Ta(Dn)),close(),function(){try{const e=!1;bo&&wo.length?wo.forEach((t=>{bo.cleanup(t.canvas,t.display,e)})):ba.cleanup(null,null,e)}catch(e){console.error("Video cleanup:",e)}}();break;case"encodeVideoFrame":ya.enqueue(t);break;case"startVideoEncode":if(te("startVideoEncode:".concat(!!io)),void 0!==t.disableOriginalRatio&&(ic=!!t.disableOriginalRatio),er.isUseSsrcStream()&&Yc.setLocalVideoSsrc(t.ssid),!io)return void(bo&&(bo.Set_Capture_Video_Flag(!0),bo.Set_LocalVideo_SSRC(t.ssid),bo.Set_Cropping_Mode(!!ic)));zs&&zs.setCurrentUserSsrc(t.ssid),mn=!0,Vs=!0,Qn=!!t.isSupportMediaStreamTrackProcessor,ko=!!t.isSupport2DCanvasDrawFrame,Jn=!!t.isSupportVideoFrame,Rc(No=t.fps||No),No!=Ge&&(Cn=!0),Ks(t),nu(Ve.SESSION_TYPE_VIDEO,!0);break;case"releaseStream":Fo.closeReadStream();break;case"frameStream":Fo.setReadStream(t.data);break;case"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK":if("js"==t.type){ec(t.data);break}Jl(t.data,t.index);break;case"updateVideoPara":Dn&&(pc(),Hn=t.width,$n=t.height,jo.rgba_stride=t.width,jo.rgba_x=0,jo.rgba_y=0,lc());break;case"stopVideoEncode":if(te("stopVideoEncode:".concat(!!io)),io)mn=!1,so=!1,bl||(fl&&fl.clearDisplay(),_l&&_l.clearRect(0,0,hl.mcanvas.width,hl.mcanvas.height)),Do||(Bo.get(Zn)&&Bo.get(Zn).display&&Bo.get(Zn).display.clearDisplay(),Zn=null),bl||Do||(clearInterval(ro),ro=null,rs.stop(),ts.stop(),Sn.stopCheck(),po&&Atomics.store(po,0,0),pc());else if(bo)return void bo.Set_Capture_Video_Flag(!1);break;case"ENCRYPT":Dn&&(Un=t.encrypt,La(Dn,Un?1:0));break;case"SOCKET_RECONNECT":self.IS_DISABLE_SOCKET_RECONNECT=!0===r.disable;break;case 7:!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var r;(r=e instanceof Uint8Array?e:new Uint8Array(e)).length<4||0==r[0]||(Dn?Ps(r,Dn,Ca,t):console.log("video handle is not ready!",r[0]))}(t.data);break;case"OfflineCanvas":t.canvasname&&t.canvas.getContext("2d")&&go.set(t.canvasname,t.canvas.getContext("2d"));break;case"mirrorMyVideo":Po=t.isMirrorMyVideo,!io&&t.isSupportOffscreenCanvas?bo&&bo.setMirrorMyVideoOption(Po):zs&&zs.setMirrorMyVideoOption(Po);break;case"yuvVideoFrame":{let r=t.data;if(!r)return ts.captureSample(),void su(Vo);if(Zi.hasProcessor()&&!Wo)return Zi.onFrame(r),r.close(),void su(Vo);let i=t.rotation||0;Ao=Gn&&Gs===qe.ANDROID?0:i;let a=performance.now();try{if(r=el(r),r.format&&"I420"==r.format)ya.enqueue({frame:r,format:2,rotation:i});else if(r.format&&"NV12"==r.format)ya.enqueue({frame:r,format:3,rotation:i});else if(r.format&&"I420A"==r.format)ya.enqueue({frame:r,format:4,rotation:i});else if(r.format&&"BGRA"==r.format)ya.enqueue({frame:r,format:5,rotation:i});else if(r.format&&"RGBA"==r.format)ya.enqueue({frame:r,format:1,rotation:i});else if(r.format)return ie("Frame format ".concat(r.format," is not supported")),Lo||(Lo=!0,postMessage({status:g,format:r.format})),void r.close();let e=r.visibleRect?r.visibleRect.width:r.cropWidth,t=r.visibleRect?r.visibleRect.height:r.cropHeight;Hn===e&&$n===t||(Hn=e,$n=t,jo.rgba_stride=e,jo.rgba_x=0,jo.rgba_y=0,Ao=i,lc());let a=ya.dequeue();ts.captureSample(),await Qd(a)}catch(e){ie("video process exception")}let n=performance.now(),o=Vo-(n-a);o<=0&&(o=0),su(o)}break;case"VideoPlayStatus":So=t.data.isVideoPlayWork;break;case"startvideointerval":Qn=!!t.isSupportMediaStreamTrackProcessor,ko=!!t.isSupport2DCanvasDrawFrame,Do=!!t.isVBSettingOn,Jn=!!t.isSupportVideoFrame,bl=!!t.isMaskSettingOn,Vs=!0,Rc(No=t.fps||No),Ks(t);break;case"StartVBSetting":Do=!0,bl=!1,Oo=!1,pc(),t.isSwitch&&po&&Atomics.store(po,0,0),rs.start(rl,1e3/No),ts.start();break;case"VBOfflineCanvas":if(t.canvas){let e=Bo.get(t.rendercanvasID);e&&ba.cleanup(e.canvas,e.display);let r=null;(ba.getRendererProvider().isWebGLRendererType()||ba.getRendererProvider().isWebGL2RendererType())&&(r={forceNoGL:void 0,contextOptions:{preserveDrawingBuffer:!1,webglcontextlostCallback:hc,webglcontextrestoredCallback:_c,params:{canvas:t.canvas,rendercanvasID:t.rendercanvasID}},webGLResources:void 0,initMask:!1});const i=ba.createVideoRenderDisplay(t.canvas,t.rendercanvasID,0,r);Bo.set(t.rendercanvasID,{canvas:t.canvas,id:t.rendercanvasID,display:i}),mc()}Zn=t.rendercanvasID;break;case"MaskOfflineCanvas":if(t.canvas){let e=Bo.get(t.rendercanvasID);e&&ba.cleanup(e.canvas,e.display),Bo.set(t.rendercanvasID,{canvas:t.canvas,id:t.rendercanvasID,display:null}),mc()}ol=t.rendercanvasID,gl=Bo.get(t.rendercanvasID).canvas.width,vl=Bo.get(t.rendercanvasID).canvas.height;break;case"vbbgimagebitmap":rc(t);break;case"addExtVbReceiver":_n=!0;break;case"removeExtVbReceiver":_n=!1;break;case"finishVBSetting":po&&Atomics.store(po,0,0),Bo.get(Zn)&&Bo.get(Zn).display&&Bo.get(Zn).display.clearDisplay(),Zn=null,Do=!1,so||bl||(clearInterval(ro),ro=null,fl&&fl.clearDisplay(),_l&&_l.clearRect(0,0,hl.mcanvas.width,hl.mcanvas.height),self.resizeCanvas&&self.resizeCanvas());break;case"WORKER_BOLB_URL":t.blobUrl&&!Ss()&&(zs=new $s(t.blobUrl));break;case"StartMaskSetting":bl=!0,Do=!1,Wo=!1,Oo=!!t.enabled,ml=t.fillMode?1:0,Bo.get(ol)&&Bo.get(ol).display&&Bo.get(ol).display.setFillMode&&Bo.get(ol).display.setFillMode(ml),t.isSwitch&&(Wl(yl,Hn,$n),po&&Atomics.store(po,0,0));break;case"update_setting_canvas_size":Bo.get(t.rendercanvasID)&&Bo.get(t.rendercanvasID).canvas&&(t.rendercanvasID===ol||t.rendercanvasID===Zn)&&(Bo.get(t.rendercanvasID).canvas.width=t.width,Bo.get(t.rendercanvasID).canvas.height=t.height);break;case"maskandbgimagebitmap":bl=!0,Ml(t);break;case"finishMaskSetting":po&&Atomics.store(po,0,0),Bo.get(ol)&&Bo.get(ol).display&&Bo.get(ol).canvas&&(ko?(Bo.get(ol).display.setTransform(1,0,0,1,0,0),Bo.get(ol).display.clearRect(0,0,Bo.get(ol).canvas.width,Bo.get(ol).canvas.height)):Bo.get(ol).display.clearDisplay()),ol=null,bl=!1,Io=!1,ll||(Oo=!1),so||Do||(fl&&fl.clearDisplay(),_l&&_l.clearRect(0,0,hl.mcanvas.width,hl.mcanvas.height),rs.stop(),ts.stop(),pc());break;case"healthCheck":if(t.type===Ye)switch(t.op){case 0:rs.stop(),ts.stop(),Sn.setPaused(!0);break;case 1:rs.start(rl,1e3/No),ts.start(),Sn.setPaused(!1);break;case 2:rs.stop(),ts.stop(),Sn.stopCheck()}break;case"renderOfflineCanvas":{const e=io?zs.videoRenderObj:bo;if(t.canvas)yo.get(t.rendercanvasID)&&Nc(e,t.rendercanvasID),yo.set(t.rendercanvasID,{canvas:t.canvas});else{let e=yo.get(t.rendercanvasID);e&&(t.canvas=e.canvas)}var s;if(Fn&&bo&&bo.Remove_Pause(t),So=!0,Eo=!0,er.isUseSsrcStream()||(Mo=t.waterMarkText,Ro=t.isCreateVideoWaterMark,e.Set_WaterMark_Info({waterMarkCanvas:!1,isCreateVideoWaterMark:Ro,videoWaterMarkName:Mo,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}),Fc(e)),te("OFFRENDER:".concat(t.ssrc)),1!=t.ssrc||To.ssrc||(er.isUseSsrcStream()?To.ssrc=Yc.getActiveSpeakerSsrc():To.ssrc=null===(s=bo)||void 0===s?void 0:s.getActiveSpeakerSsrc()),wo.length)for(let e=0;e<wo.length;e++)if(wo[e].ssrc==t.ssrc&&wo[e].zone==t.zone)return void te("SAME:".concat(t.ssrc));if(wo.push(t),!er.isUseSsrcStream()){if((Ga||hs.videodecodethreadnumb>1)&&(t.display=e.Get_Display(t.canvas,t.rendercanvasID,t.ssrc,Ts),t.display&&t.display.setFillMode(t.fillMode,t.fillModeForResolution)),t.borderRadius){var d;const e=yt(t.borderRadius,t.width,t.height);t.borderRadius=e,null===(d=t.display)||void 0===d||d.setRoundedCornerRadius(e)}wo.length>0&&e.Set_Render_Array(wo)}mn=!0,$o.renderFlag||io||1==wo.length&&e.Get_Capture_Video_Flag()||($o.renderFlag=!0,vc())}break;case 128:Nc(bo,t.rendercanvasID);break;case 153:{var l;let e=null===(l=t.data)||void 0===l?void 0:l.ssrc;if(!e||To.ssrc==e)break;var c;Bc(To.ssrc),To.ssrc=e,To.firstflag=!1,So=!0,er.isUseSsrcStream()?Yc.setActiveSpeakerSsrc(e):null===(c=bo)||void 0===c||c.setActiveSpeakerSsrc(e)}break;case"cancelNewActiveSpeakerSsrcBefreCallback":Bc(t.ssrc),To.ssrc==t.ssrc&&(To.ssrc=null,To.firstflag=!1),0==wo.length&&(So=!1);break;case"CHANGE_CURRENT_ACTIVE_SSRC":ac=t.ssrc,bo&&bo.Change_Current_SSRC(t.ssrc);break;case"stopVideoRender":{if(t.MFlag)return void(mn=!1);Ro=!1,Mo="";const e=io?zs.videoRenderObj:bo;let r=yo.get(t.canvas);if(wo.length&&(r||er.isUseSsrcStream()))for(let r=0;r<wo.length;r++)if(wo[r].ssrc==t.ssrc&&wo[r].zone==t.zone)if(Fn){if(t.doNotClean)bo.Add_Pause(t),bo.Draw_Last_Frame();else{let e=wo.splice(r,1);bo.clearUseridRender(e,t.RGBA),bo.Set_Render_Array(wo,Ga),bo.GiveBack_Display(e)}$o.renderFlag&&!io&&(1==wo.length&&bo.Get_Capture_Video_Flag()||0==wo.length)&&($o.renderFlag=!1,vc())}else Uc(e,wo.splice(r,1),t.RGBA)}break;case"removeVideoPlay":if(vo){let e=io?zs.videoRenderObj:bo;e&&Pc(e),vo=null,So=!1}break;case"decodeVideoPortWithAudio":t.port.onmessage=function(e){Sc(e.data)};break;case"audioDecodeTime":Sc(t);break;case 129:{let e=r.data.userNodeList;e&&e.forEach((e=>{let t=parseInt(e.userid);if(e.bremove)return void(Dn&&Oa(Dn,t));let r=e.sn;if(16!=r.length&&32!=r.length)return;let i=Od(r);if(Dn){let e=!1;io&&to!=t||(e=!0),e&&Da(Dn,t,i,r.length)}io&&to==t&&(eo=r),Wd(i)}));break}case 149:{let e=r.data.interval,t=Gs==qe.DESKTOP?10:20;if(hs.isSupportMultiThread){const r=601508;if(null==co){if(null==(co=Module._malloc(r)))return void console.log("malloc failed");Atomics.store(de().subarray(co/4,co/4+r),0,0),Atomics.store(de().subarray(co/4,co/4+r),1,0)}ru.sender={sab:wasmMemory,length:r,offset:co,useCopy:!1,useOneElement:!1,interval:e?t:0}}else{let i=r.data.data.buffer,a=0,n=r.data.data.length;ru.sender={sab:i,length:n,offset:a,useCopy:!1,useOneElement:!1,interval:e?t:0}}Wn&&Wn.setSabBuffer(ru.sender,null);break}case 11:$o.monitorPanelFlag=r.data.enable,$o.panelpollingInterval=r.data.pollingInterval,vc();break;case 160:r.data.isVideo&&(zo.videoStatisticsFlag=r.data.enable,yc(zo.videoStatisticsFlag));break;case 150:{let e=Gs==qe.DESKTOP?10:20;if(hs.isSupportMultiThread){const t=601508;if(null==uo){if(null==(uo=Module._malloc(t)))return void console.log("malloc failed");Atomics.store(de().subarray(uo/4,uo/4+t),0,0),Atomics.store(de().subarray(uo/4,uo/4+t),1,0)}ru.reciver={sab:wasmMemory,offset:uo,length:t,interval:e,useCopy:!1,useOneElement:!1}}else{let t=r.data.buffer,i=r.data.offset,a=r.data.length;ru.reciver={sab:t,offset:i,length:a,interval:e,useCopy:!1,useOneElement:!1}}Wn&&Wn.setSabBuffer(null,ru.reciver);break}case"VIDEO_DECODE_FRAME_BACK_SAB":{let e=r.data.buffer,t=r.data.bytesPerEle;self.videoDecodeFrameBackSABRingBuffer=new Ct(e,t);break}case"decodeVideoPort":ss&&ss.close(),(ss=e.ports[0]).onmessage=function(e){if("SVIEW"!=e.data.cmd);else if(e.data.mode&&!e.data.yuv){var t,r;null!==(t=e.data)&&void 0!==t&&t.data&&(null===(r=bo)||void 0===r||r.Update_LocalVideo(e.data.data,e.data.rotation,!!e.data.fromVideoTag),(ba.getRendererProvider().isWebGLRendererType()||ba.getRendererProvider().isWebGL2RendererType()||er.isUseSsrcStream())&&e.data.data.close())}else{let t=e.data;bo.Update_SelfVideo_Texture(t.width,t.height,t.data,t.ssrc,t.mode,t.croppingParams)}};break;case"encodeVideoPort":ds&&(ds.close(),ds=null),ds=e.ports[0];break;case"vsport":ls&&(ls.close(),ls=null),ls=e.ports[0];break;case"update_canvas_size":{let e=yo.get(r.rendercanvasID);e?(e.canvas.width=r.width,e.canvas.height=r.height):te("USNC:".concat(r.rendercanvasID))}break;case"encodedimagebitmapwasmptr":Gd=r.data,jd=r.wasmMemory,bo&&(bo.Set_LocalVideo_Buffer(jd),bo.Set_LocalVideo_Ptr(Gd));break;case"zoomrender":if(t.isPaused&&bo&&bo.Zoom_Render_Paused(t),wo.length){let e=yo.get(t.canvas);for(let r=0;e&&r<wo.length;r++)if(wo[r].ssrc==t.ssrc&&wo[r].zone==t.zone){var u=[wo[r]];let e={};const i=ba.getRendererProvider().isWebGLRendererType(),a=ba.getRendererProvider().isWebGL2RendererType();if((i||a)&&(e.x=wo[r].x,e.y=wo[r].y,e.width=wo[r].width,e.height=wo[r].height),wo[r].x=t.x,wo[r].y=t.y,wo[r].width=t.width,wo[r].height=t.height,t.borderRadius){var h;const e=yt(t.borderRadius,t.width,t.height);wo[r].borderRadius=e,null===(h=wo[r].display)||void 0===h||h.setRoundedCornerRadius(e)}bo&&(bo.clearUseridRender(u,t.RGBA,e,t.isPaused),bo.Zoom_Render(wo[r]));break}}break;case"update_border_radius":if(wo.length&&t.borderRadius)for(let e=0;e<wo.length;e++)if(wo[e].ssrc==t.ssrc&&wo[e].zone==t.zone){if(t.borderRadius){var _;const r=yt(t.borderRadius,wo[e].width,wo[e].height);wo[e].borderRadius=r,null===(_=wo[e].display)||void 0===_||_.setRoundedCornerRadius(r)}break}break;case"hwstatus":Dn&&(io&&js.isEnableVideoEncodeHardWareThread||hs.videodecodethreadnumb>1&&hs.isEnableVideoDecodeHardWareThread)&&lo!=t.enable&&(lo=t.enable,io&&js.Signal_Encode_Thread.status==Le?(js.Signal_Encode_Thread.latestflag=oc&&lo,Va(Dn,js.Signal_Encode_Thread.latestflag)):io||Va(Dn,oc&&lo));break;case"videohd":Ns=t.videohd;break;case"SWITCH_WATER_MARK_FLAG":er.isUseSsrcStream()&&(er.setIsVideoHasWaterMark(r.isCreateSharingWaterMark),er.setVideoWatermarkInfo({name:r.videoWaterMarkName,opacity:r.watermarkOpacity,repeated:r.watermarkRepeated,position:r.watermarkPosition})),bo&&(Ro=r.isCreateVideoWaterMark,Mo=r.videoWaterMarkName||"",Ro||bo.Set_WaterMark_Flag(!1),bo.Set_WaterMark_Info({waterMarkCanvas:!1,isCreateVideoWaterMark:Ro,videoWaterMarkName:Mo,watermarkOpacity:r.watermarkOpacity,watermarkRepeated:r.watermarkRepeated,watermarkPosition:r.watermarkPosition}));break;case"startsharingencode":Go/=2,Dn&&Ha(Dn,Go);break;case"stopsharingencode":Go*=2,Dn&&Ha(Dn,Go);break;case 127:{const{canvas:e,canvasId:t}=r.data||{};if(e)t&&t===ol?(Bo.set(ol,{canvas:e,id:ol,display:null}),ol=t,gl=Bo.get(ol).canvas.width,vl=Bo.get(ol).canvas.height):io?zs&&(zs.replace_Canvas(e,t),yo.get(t)&&yo.set(t,{canvas:e})):wo.length>0&&(bo.Replace_Canvas(e,t),yo.get(t)&&yo.set(t,{canvas:e}));else if(io){if(hl.mcanvas&&_l){const{width:e,height:t}=hl.mcanvas;hl.mcanvas=new OffscreenCanvas(e,t),_l=hl.mcanvas.getContext("2d")}if(cl){const{width:e,height:t}=cl;cl=new OffscreenCanvas(e,t),ul=cl.getContext("2d"),Wl(yl,Hn,$n)}if(Pl){const{width:e,height:t}=Pl;Pl=new OffscreenCanvas(e,t)}Bo.get(ol)&&Bo.get(ol).canvas&&ce(ol)}break}case"ENABLE_VIDEO_OBSERVER":Bd=!!r.data,Ud=!!r.enablefps;break;case 156:if(Xo)return;_d.updateKey(r.data.KK);break;case"RenderInMain":mn=!0;break;case 130:{let e=r.data||{},t=!!e.hold;te("HOLD:".concat(t,":").concat(e.userid,":").concat(e.reinit)),t?function(e){if(Vc)return;if(to&&e.userid&&e.userid>>10!=to>>10)return void te("HOLDINVALID");if(Vc=!0,!Dn)return;if(io?(mn=!1,so=!1,bl||(fl&&fl.clearDisplay(),_l&&_l.clearRect(0,0,hl.mcanvas.width,hl.mcanvas.height)),Do||(Bo.get(Zn)&&Bo.get(Zn).display&&Bo.get(Zn).display.clearDisplay(),Zn=null),bl||Do||(clearInterval(ro),ro=null,rs.stop(),ts.stop(),po&&Atomics.store(po,0,0),pc())):bo&&bo.Set_Capture_Video_Flag(!1),nu(Ve.SESSION_TYPE_VIDEO,!1),io){const e=zs.videoRenderObj;if(e){let t=e.clearColor.map((e=>e/255));for(;wo.length;)Uc(e,[wo.shift()],t)}}else yo.forEach(((e,t)=>{Nc(bo,t)}));eo=null,jn=null;let t=Dn;Dn=null,t&&Ta(t)}(e):(m=e,Vc&&(Vc=!1,null!=m&&m.reinit&&(to=m.userid,jn=null,io?js.isSupportVirtualBackground?Xs("VB",1,js.enableVBWasmBackend):postMessage({status:8}):jc())));break}case 133:!function(e){let t=e.content_type,r=e.cmd,i=e.type;"PDU"==t&&(r=Se(r),2==i&&fd(r,0))}(r.data);break;case 137:(xn=r.flag)||Qn||!Jn||su(Vo);break;case 138:self.postMessage({cmd:x,timestamp:Date.now()});break;case 12:Fo.createReadStream(r.data,r.orientation);break;case 139:{const{ssrc:e,type:t,id:i}=r;!function(e,t,r,i){let a={id:i,status:138,success:!1};try{const{canvasId:r,options:i}=(null==e?void 0:e.getUserIdVideo(t))||{};a.success=!!r,a.data={canvasId:r,options:i},postMessage(a)}catch(e){postMessage(a)}}(io?zs.videoRenderObj:bo,e,0,i);break}case 1147:if(Dn){const e=r.data;Ca(Dn,e,e.length)}break;case 144:(kc=r.data)!=Gi.child&&rn(Dn,3,!1);break;case 147:{const{type:e,meetinguuid:t,mmrsigkey:i}=r,a=2==e||1==e;if(kc==Gi.child&&Dn&&a){if(tn(Dn,3,t,t.length),2==e){let e=Se(i);Za(Dn,3,e,e.length)}en(Dn,3,e),rn(Dn,3,a)}else Dn&&rn(Dn,3,!1);break}case 148:Fo.setRotation(r.data);break;case 158:Ko=r.data;break;case 159:Ko=0}var f,p,m}));var kc=0;function Fc(e){if(!Vd&&e){Vd=!0;let t=e.Start_Draw.bind(e);vo=Ga||hs.videodecodethreadnumb>1?t(0):t(1,30),So=!0}}function Pc(e){Vd&&(Vd=!1,e.Stop_Draw.bind(e)(),vo=null,e.ClearQueue(),e.Set_WaterMark_Info({waterMarkCanvas:!1,isCreateVideoWaterMark:Ro,videoWaterMarkName:Mo}),So=!1)}function Ic(e){te("WGLFSTOPRAF"),e&&(e.videoRenderWGLFSTOP=!0,Pc(e))}function Lc(e){te("WGLRESTORE"),e&&e.videoRenderWGLFSTOP&&(Fc(e),e.videoRenderWGLFSTOP=!1)}function Dc(){return!1}function Oc(e){}function Wc(e){return To.ssrc&&Rs(To.ssrc)==Rs(e)}function Bc(e){if(e=e>>10<<10,bo&&e&&!ks(e)){let t=hs.threadPoolBufferMGR.get(e);if((null==t?void 0:t.threadState)==Le)Na(Dn,e),hs.preusedcount--;else if((null==t?void 0:t.threadState)==Ie){let t=hs.SSrcWaitForThread.findIndex((t=>t>>10==e>>10));t>=0&&hs.SSrcWaitForThread.splice(t,1)}vs(e),Ol&&(Ol.clear(e),Ad.delete(e))}}function Uc(e,t,r){if(!e)return;er.isUseSsrcStream()||(e.clearUseridRender(t,r),e.GiveBack_Display(t,0==wo.length),e.Set_Render_Array(wo));let i=t[0].ssrc;To.ssrc>>10!=i>>10&&1!=i&&Bc(i),To.ssrc&&To.ssrc>>10==i>>10&&!ks(1)&&Bc(i),1!=i||ks(1)||(Bc(To.ssrc),i=To.ssrc,To.ssrc=0),mn=!!wo.length,0==wo.length&&(Ol&&Ol.clearAll(),Pc(e)),$o.renderFlag&&!io&&(1==wo.length&&wo[0].ssrc>>10==to>>10||0==wo.length)&&($o.renderFlag=!1,vc())}function Nc(e,t){let r=yo.get(t)||Bo.get(t);if(e&&r&&null!=wo&&wo.length){let r=e.clearColor.map((e=>e/255));for(let i=0;i<wo.length;)if(wo[i].rendercanvasID==t){let t=wo.splice(i,1);try{Uc(e,t,r)}catch(e){ie("StopUserVideo has error: ",e)}}else i++}r&&ba.clearOffscreenCanvas(r),e&&r&&e.Clear_OffScreenCanvas(r.canvas),r&&(yo.delete(t),Bo.delete(t))}var Vc=!1;function Gc(){return!Vc}function jc(){Gc()&&(Dn&&On==to||(Dn&&(Ta(Dn),Dn=null),Dn=Ra(to,Kn,Yn,Xn,0,0,hs.videodecodethreadnumb,lo,io,!1,Go,!1,!1,!1,er.shouldCropWasmFrameOnPosMismatch(),er.shouldCropWasmFrameOnSizeMismatchOnly()),On=to),Dn?(_d.updateKey(),hs.videodecodethreadnumb>1&&Ba(Dn,hs.videodecodethreadnumb),postMessage({status:8})):postMessage({status:V}))}function Hc(e){var t;ou(e.websocket_ip_address),e.webtransportURL&&(null===(t=Wn)||void 0===t||t.resetWebrTransportUrl(e.webtransportURL))}function $c(e){ba.getRendererProvider().setRendererType(e.rendererType),e.rendererDynModBlob&&ba.getRendererProvider().loadRenderModuleFromBlob(e.rendererType,e.rendererDynModBlob),ba.setCanvasAlphaChannelEnability(e.isEnableCanvasAlphaChannel),ba.getRendererProvider().isWebGPURendererType()&&ba.getWebGPUResMgr(2).initialize(),io||hs.isSupportOffscreenCanvas&&(bo||((bo=new xt({Notify_APPUI:null,isSupportOffscreenCanvas:!0,jsMediaEngine:null,videodecodethreadnumb:Ga?25:hs.videodecodethreadnumb,onStopDrawCallback:Ic,onReStoreCallback:Lc,renderManager:ba,isLSSPlayer:Fn})).setMirrorMyVideoOption(Po),ac&&bo.Change_Current_SSRC(ac),jd&&bo.Set_LocalVideo_Buffer(jd),Gd&&bo.Set_LocalVideo_Ptr(Gd),null!=To&&To.ssrc&&(er.isUseSsrcStream()?Yc.setActiveSpeakerSsrc(To.ssrc):bo.setActiveSpeakerSsrc(To.ssrc))))}let zc,qc,Yc;var Xc=!1,Kc=!1;function Qc(){if(!td())return-1;if(dd())return 0;if("function"!=typeof OffscreenCanvas)return-1;var e=rd(),t=id();return e&&t&&wa?0:-1}function Jc(){return!0}let Zc=0;function eu(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e?js.Signal_Encode_Thread.handle:hs.isVideoCodecHelpThreadWorker;if(i&&i.postMessage({cmd:"webcodecfailed",encode:e,id:t,code:r}),e)return oc=!1,js.Signal_Encode_Thread.latestflag=!1,void(Dn&&Va(Dn,!1));Zc++,Zc>=4&&(oc=!1,Dn&&Va(Dn,!1),Re()&&postMessage({status:n,size:2}))}var tu,ru={};!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(Fi.dataTransportMgr)return;let r=new Ri({type:t?Ri.THREAD_SUB:Ri.THREAD_MAIN,remote:t?self:null});Fi.dataTransportMgr=r,r.monitorlogfn=e,Di.target||(Di.target=new Di(r),r.addTransportListChangeListener(Di.target)),t&&self.addEventListener("message",r._onrecvmainthreadlistener.bind(r))}catch(e){console.error("<<<< InitDataTransportModule",e)}}(Me),tu=self,Oi.instance||(Oi.instance=new Oi),Oi.instance.start(tu);let iu=function(){let e=0;try{const t="function"==typeof MediaStreamTrack,r="function"==typeof MediaStreamTrackProcessor,i="function"==typeof VideoTrackGenerator;if(e|="function"==typeof OffscreenCanvas?1:0,e|=r&&t?4:0,e|=i&&t?8:0,1&e){let t=new OffscreenCanvas(1,1),r=t.getContext("webgl");e|=null!=r?2:0,r=null,t=null}}catch(e){}return e}();var au=new class{constructor(e){this.featurebit=e}isSupportOffScreenCanvas(){return 1&this.featurebit}isSupportOffScreenCanvasWebgl(){return 2&this.featurebit}isSupportMediaTrackProcessor(){return 4&this.featurebit}}(iu);function nu(e,t){const r={cmd:N,appid:e,enable:t};3==e&&Wn.sendCommand(r)}function ou(e,t){var r,i;(Fn&&!Pn&&postMessage({status:a}),e)&&(e=Fn?null===(r=e)||void 0===r?void 0:r.replace("&mode=5","").replace("/wc",""):e,te("WSURL:".concat(isPreviewMode&&!t,":").concat(e.replace(/(\/media\/)\d+/,"$1".concat("meetingNumber")))),Wn?(Wn.url&&Wn.url!=e&&ie("video websocket cid changed"),Wn.resetURL(e)):(Wn=is(e,os,fd,md,pd,t),(ru.sender||ru.reciver)&&(null===(i=Wn)||void 0===i||i.setSabBuffer(ru.sender,ru.reciver))))}function su(e){In&&(clearTimeout(In),In=0),In=setTimeout((()=>{xn||postMessage({status:o}),In=0}),e)}self.postMessage({status:139,data:iu}),Object.keys(e).forEach((t=>self[t]=e[t]))})()})(),self.__wasmCodeDataEndFlag=1;var Module=void 0!==Module?Module:{};Module.locateFile=function(e){return e.endsWith("wasm")?wasmUrl:URL.createObjectURL(new Blob(['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,d=t.extraDataLen,a=t.Width,i=t.Height,r=new Uint8Array(d),c=GROWABLE_HEAP_U8().subarray(o,o+d);return r.set(c),_free(o),WebcodecDecoders[e].configure(r,a,i),"configured"==WebcodecDecoders[e].videoDecoder.state?0:(globalTracingError("Failed to configure VideoDecoder, state:"+WebcodecDecoders[e].videoDecoder.state+", width:"+a+", height:"+i+",config_data:"+r),-1)}case"decode":{let e=t.id,o=t.NewIDR,d=t.buffer,a=t.vclBufferSize,i=(t.vclNalCount,t.ssrc),r=GROWABLE_HEAP_U8().subarray(d,d+a),c=new Uint8Array(a);c.set(r),WebcodecDecoders[e].decode(c,o,i)}}}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=32e3,MAX_TIMEOUT_MS=40,TIMEOUT_UP_STEP=20,SLOW_START_TIMEOUT=100,MAX_CACHE_SIZE=20,WASM_INIT_ERROR=1,BITSTREAM_ERROR=2,WEBCODEC_ERROR=3,WEBCODEC_TIMEOUT_ERROR=4,WEBCODEC_RETRY=5,WEBCODEC_ENCODE_CHECK_LENGTH=30,WEBCODEC_ENCODE_OVERTIME_THRESHOLD=10,WEBCODEC_ENCODE_STATISTICS_INTERVAL=3e3;function globalTracingError(e,t){if(t){const o={name:t?.name,code:t?.code,message:t?.message,stack:t?.stack};try{e=e+", errInfo:"+JSON.stringify(o)}catch(e){}}postMessage({cmd:"globalTracingError",data:e})}function globalTraingReport(e){postMessage({cmd:"GlobalTracingDT",data:e})}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.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,this.inputTS=0,this.outputTS=0,this.errCode=0,this.keyFrameIdx=0,this.deltaFrameIdx=0,this.totalCodecTime=0,this._timeInterval=null,this.dropped=0,this.frameTimeoutCount=0,this.keyFrameTimeoutCount=0}_report(e){let t=performance.now();this.enabled=!1;let o=Math.round((t-this.startTs)/1e3*10)/10,d=Math.round(this.totalCodecTime/1e3*10)/10,a=d>0?d:o,i=Math.round(this.inputIndex/a*10)/10,r=Math.round(this.outputIndex/a*10)/10,c=Math.round(this.sumDelay/(this.outputIndex||1)*10)/10,n=Math.max(0,this.inputIndex-this.outputIndex-this.dropped),s=Module.codecMRG.getEncodeConfig(this.id);postMessage({cmd:"webcodecperformance",id:this.id,encode:this.encode,failed:this.isFailed,width:s.width,height:s.height,bitrate:s.bitrate,avgDelay:c,minDelay:this.minDelay,maxDelay:this.maxDelay,inputIndex:this.inputIndex,outputIndex:this.outputIndex,dropped:this.dropped,timeout:n,inavgFps:i,outavgFps:r,elapsed:o,codeced:d,errCode:this.errCode,subCode:webcodec_encode_subcode,configIdx:e,deltaTimeout:this.frameTimeoutCount,keyTimeout:this.keyFrameTimeoutCount,retried:!retry_flag,l1t2:l1t2_flag})}start(){if(this.isFailed=!1,this.errCode=0,webcodec_encode_subcode=0,-1==this.timeout_id){this.enabled=!0,this.startTs=performance.now();let e=Module.encAddConIdx;this.timeout_id=setTimeout((()=>{this._report(e)}),32e3)}this.encode&&(this._interval=setInterval((()=>{(this.keyFrameIdx>0||this.deltaFrameIdx>5)&&(this.totalCodecTime+=3e3,this.keyFrameIdx=0,this.deltaFrameIdx=0)}),3e3))}stop(e){this.isFailed=e,-1!=this.timeout_id&&(clearTimeout(this.timeout_id),this.timeout_id=-1),this._timeInterval&&(clearInterval(this._timeInterval),this._timeInterval=null),this._report(Module.encAddConIdx)}inputInc(e=!1){this.inputIndex++,e?this.keyFrameIdx++:this.deltaFrameIdx++}outputInc(e=0){this.outputIndex++,e>0&&(this.sumDelay+=e,e>this.maxDelay&&(this.maxDelay=e),e<this.minDelay&&(this.minDelay=e))}}var Module={},initializedJS=!1,pendingNotifiedProxyingQueues=[],enableVBWasmBackend=0,codecMRG=new CodecMRG;Module.codecMRG=codecMRG;var multiThreadFlag,model,tfjsUrl,vbBaseUrl,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,l1t2_flag=1,retry_flag=!1,webcodec_encode_subcode=0,wasmDecodeWorkerMSC=null;function initTf(e){if(!tfLoad){if("string"==typeof e)importScripts(e);else{var t=URL.createObjectURL(e);importScripts(t),URL.revokeObjectURL(t)}tfLoad=!0,tfInitPromise=tf.setBackend("webgl").then((e=>{if(!e)return Promise.reject("init tf fail 1");tf.env().set("WEBGL_PACK_CONV2DTRANSPOSE",!1)})).catch((()=>{if(!enableVBWasmBackend)return postMessage({cmd:"vbInitializeFailed"}),Promise.reject("init tf fail 2");const e=vbBaseUrl;return importScripts(e+"tf-backend-wasm.min.js"),tf.wasm.setWasmPaths(e),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)}Module.encAdditionalConfig=e.data.encAdditionalConfig,Module.encAddConIdx=e.data.encAddConIdx,Module.encRetryConIdx=e.data.encRetryConIdx,Module.encRetryConfig=e.data.encRetryConfig,Module.supportHWEncRetry=e.data.supportHWEncRetry,retry_flag=e.data.supportHWEncRetry&&e.data.encAddConIdx<e.data.encRetryConIdx;try{let e=JSON.stringify(Module.encAdditionalConfig);l1t2_flag=e.includes("L1T2")?1:0}catch(e){}}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,d=e.data.Height,a=e.data.id,i=e.data.Bitrate,r=e.data.Framerate,c=e.data.buffer;Module.codecMRG.configEncodeWebCodec(a,i,r,o,d,c)}else if("VideoEncodeInit"===e.data.cmd){let t=e.data.id;var n=e.data.context;Module.codecMRG.initEncodeWebCodec(t,n)}else if("VideoEncode"===e.data.cmd){var s=e.data.videoFrameId,l=e.data.dataLength;let t=e.data.id;var u=e.data.NewIDR,h=e.data.rawData,f=e.data.timeout;Module.codecMRG.encodeVideoFrame(t,s,u,h,l,f)}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,vbBaseUrl=e.data.vbBaseUrl;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 b=0;b<m.weightsManifest.length;b++)modelArtifacts.weightSpecs=m.weightsManifest[b].weights;m.trainingConfig&&(modelArtifacts.trainingConfig=m.trainingConfig),m.userDefinedMetadata&&(modelArtifacts.userDefinedMetadata=m.userDefinedMetadata),modelArtifacts.weightData=e.data.weightData,initTf(tfjsUrl),tfInitPromise.then((()=>{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,vbBaseUrl=e.data.vbBaseUrl;let t=e.data.modelJSON;if(afnModelArtifacts.modelTopology=t.modelTopology,afnModelArtifacts.format=t.format,afnModelArtifacts.generatedBy=t.generatedBy,afnModelArtifacts.convertedBy=t.convertedBy,t.weightsManifest)for(let e=0;e<t.weightsManifest.length;e++)afnModelArtifacts.weightSpecs=t.weightsManifest[e].weights;t.trainingConfig&&(afnModelArtifacts.trainingConfig=t.trainingConfig),t.userDefinedMetadata&&(afnModelArtifacts.userDefinedMetadata=t.userDefinedMetadata),afnModelArtifacts.weightData=e.data.weightData,initTf(tfjsUrl),tfInitPromise.then((()=>{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),d=new Float32Array(36864),a=tf.tensor4d(t,[1,144,256,3],"float32"),i=tf.tensor4d(o,[1,144,256,3],"float32"),r=tf.tensor4d(d,[1,144,256,1],"float32");afnModel.predict([a,i,r]),2==++dualModelOKCount&&postMessage({cmd:"vbPredictDone"})}))}))}else if("vbObj2"===e.data.cmd){tfjsUrl=e.data.tfjsUrl,vbBaseUrl=e.data.vbBaseUrl;let t=e.data.modelJSON;if(baseModelArtifacts.modelTopology=t.modelTopology,baseModelArtifacts.format=t.format,baseModelArtifacts.generatedBy=t.generatedBy,baseModelArtifacts.convertedBy=t.convertedBy,t.weightsManifest)for(let e=0;e<t.weightsManifest.length;e++)baseModelArtifacts.weightSpecs=t.weightsManifest[e].weights;t.trainingConfig&&(baseModelArtifacts.trainingConfig=t.trainingConfig),t.userDefinedMetadata&&(baseModelArtifacts.userDefinedMetadata=t.userDefinedMetadata),baseModelArtifacts.weightData=e.data.weightData,initTf(tfjsUrl),tfInitPromise.then((()=>{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,d=e.data.code;t?codecMRG?.webcodecFailed(o,d):WebcodecDecoders[o]?.failed()}else if("webcodecRetry"==e.data.cmd){let t=e.data.id,o=e.data.errCode;Module.encAdditionalConfig=Module.encRetryConfig,Module.codecMRG.webcodecRetry(t,Module.encRetryConIdx,o)}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",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,d,a){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:d,Height:a}),0}return-1}function VideoDecoder_js(e,t,o,d,a){return wasmDecodeWorkerMSC?(wasmDecodeWorkerMSC.postMessage({cmd:"decode",id:e,buffer:t,vclBufferSize:o,NewIDR:d,vclNalCount:a,ssrc:decodeThreadSSRC}),0):-1}function GetEncThreadNum(){return 1}function GetCscThreadNum(){return 1}function js_info_from_wcl(e,t,o){var d=new Uint8Array(o),a=GROWABLE_HEAP_I8().subarray(t+0,t+o);d.set(a,0,o),postMessage({cmd:"js_info_from_wcl",data:d},[d.buffer])}function decode_callback(e,t){postMessage({cmd:"size",ssrc:e,size:t})}function frame_callback(e,t,o,d,a,i,r,c,n,s,l,u){var h=d;h=h>>10<<10,postMessage({cmd:"decoded",status:0,yuvdataptr:e,yuvdata:e,yuvlength:t,ntptime:0,ssrc:h,width:a,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,d,a,i,r,c,n,s,l,u){postMessage({cmd:"decoded_webcodec_render",status:0,id:e,iFrameNum:t,timestamp:o,ssrc:d,format_width:a,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("Failed to create VideoDecoder"),this.context=e,this.webcodecStatus.start()},WebcodecDecoder.prototype.configure=function(e,t,o){try{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,o){try{this.ssrc=o,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.webcodecStatus=new WebCodecPerformanceStatus({encode:!0,id:e}),this.chunkArr=[],this.timing=[],this.lastKeyTS=0,this.callbackInvoked=!0,this.retryFlag=!1,this.config={bitrate:15e5,framerate:30,width:1280,height:720,buffer:0}}function CodecMRG(){this.decodeCodecHandles=new Map,this.encodeCodecHandles=new Map}function UserAgentIsTesla_js(){return Module.isTeslaMode}function GetWebCodecsEncoderL1T2Flag_js(){return l1t2_flag}function GetWebCodecsEncoderFallbackFlag_js(){return!retry_flag}function LimitWebCodecsEncoderTo360_js(){return Module.is360penablehwenc}function LimitWebCodecsDecoderTo360_js(){return Module.is360penablehwdec}function on_psl_mix_share_info_changed(e,t,o,d,a){postMessage({cmd:"on_psl_mix_share_info_changed",shared_source_id:e,rect_x_norm:t,rect_y_norm:o,rect_cx_norm:d,rect_cy_norm:a})}function js_info_from_wcl_video_data(e,t,o,d,a,i){var r=new Uint8Array(o+4),c=GROWABLE_HEAP_I8().subarray(t+0,t+o);r[0]=d,r[1]=a,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,d,a,i,r,c,n,s){postMessage({cmd:"processed_capture_data_callback",ssrc:e,data:t,len_of_data:o,format_width:d,format_height:a,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,d){if(model)try{var a=new Float32Array(GROWABLE_HEAP_U8().buffer,e,t),i=tf.tensor4d(a,[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,d){return tf.tidy((()=>{var a=new Float32Array(wasmMemory.buffer,e,t),i=tf.tensor4d(a,[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,d>>2)})),0}function execute_afn(e,t,o,d,a){return tf.tidy((()=>{var i=new Float32Array(GROWABLE_HEAP_U8().buffer,e,d),r=new Float32Array(GROWABLE_HEAP_U8().buffer,t,d),c=new Float32Array(GROWABLE_HEAP_U8().buffer,o,d/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,a>>2)})),0}function MCMMonitor_Video_LOG(e,t){var o=new Uint8Array(t),d=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(d),postMessage({cmd:"MCM_VIDEO_LOG",data:o},[o.buffer])}function wcl_trace_log(e,t){var o=new Uint8Array(t),d=GROWABLE_HEAP_I8().subarray(e+0,e+t);o.set(d,0,t),postMessage({cmd:"wcl_trace_log",data:o},[o.buffer])}function WebCodecsEncoderFail_js(e,t,o=0){let d=0==e&&4===t&&Module.supportHWEncRetry&&Module.encAddConIdx<Module.encRetryConIdx,a=webcodec_encode_subcode;if(d){Module.encAddConIdx=Module.encRetryConIdx,Module.encAdditionalConfig=Module.encRetryConfig;try{let e=JSON.stringify(Module.encAdditionalConfig);l1t2_flag=e.includes("L1T2")?1:0}catch(e){}Module.codecMRG.webcodecRetry(e,Module.encAddConIdx,t)}else postMessage({cmd:"WCEF",data:e,code:t,subCode:a,retry:d,inHWThread:o})}function WebCodecsDecoderFail_js(e){postMessage({cmd:"WCDF",data:e})}function UserWebCodecController_js(){return Module.isAndroid}WebcodecEncoder.prototype.FeedbackEncodeChunk=function(){if(0===this.chunkArr.length||-1===this.timeoutid)return;if(this._stopTimeout(),this.callbackInvoked)return;const e=this.chunkArr.shift();let t=e.byteLength,o=GROWABLE_HEAP_U8().subarray(this.bsBuffer,this.bsBuffer+t);e.copyTo(o),this.callback(this.context,0,t)},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.retry=function(e,t){if(globalTraingReport("webcodec encode retry, config "+e+", retry "+retry_flag),retry_flag){this.webcodecStatus.errCode=t,this.webcodecStatus.stop(!0),retry_flag=!1,Module.encAddConIdx=e,this.webcodecStatus=new WebCodecPerformanceStatus({encode:!0,id:this.id}),webcodecEncodeFlag=!1,this.retryFlag=!0;try{let e=JSON.stringify(Module.encAdditionalConfig);l1t2_flag=e.includes("L1T2")?1:0}catch(e){}this.webcodecStatus.start()}},WebcodecEncoder.prototype.EncodedVideoChunkOutputCallback=function(e){let t=e.timestamp;if(t<this.lastKeyTS)return void(this.chunkArr=[]);for(;this.timing.length>0&&this.timing[0].captureTS<t;)this.webcodecStatus.dropped++,this.timing.shift();if(0==this.timing.length)return void globalTraingReport("webcodec encode error: timing is empty, iid="+this.webcodecStatus.inputIndex+", oid="+this.webcodecStatus.outputIndex+", its="+this.webcodecStatus.inputTS+", ots="+this.webcodecStatus.outputTS+", dropped="+this.webcodecStatus.dropped);1==this.timing[0].isKeyFrame&&"key"!==e.type&&globalTraingReport("webcodec encode error: not key frame, key="+this.timing[0].isKeyFrame+", type="+e.type+", iid="+this.webcodecStatus.inputIndex+", oid="+this.webcodecStatus.outputIndex+", its="+this.webcodecStatus.inputTS+", ots="+this.webcodecStatus.outputTS);const o=Math.round(performance.now()-this.timing[0].encodeTS);this.timing.shift(),this.webcodecStatus.outputInc(o),this.webcodecStatus.outputTS=t,this.webcodecStatus.frameTimeoutCount=0,this.webcodecStatus.keyFrameTimeoutCount=0,this.chunkArr.push(e),this.FeedbackEncodeChunk()},WebcodecEncoder.prototype.onEncoderError=function(e){encodereclaim=e&&-1!==e.toString().indexOf("reclaimed"),frame&&(frame.close(),frame=null),encodereclaim?globalTracingError("VideoEncoder reclaimed"):(WebCodecsEncoderFail_js(this.id,3,!0),globalTracingError("webcodec encode error: VideoEncoder error, codecSize:("+this.config.width+","+this.config.height+")",e),codecMRG.closeVideoEncode())},WebcodecEncoder.prototype.configure=function(e,t,o,d,a){try{if((encodereclaim||this.retryFlag)&&("closed"!=this.handle.state&&this.handle.close(),this.handle=new VideoEncoder({output:this.EncodedVideoChunkOutputCallback.bind(this),error:this.onEncoderError.bind(this)}),encodereclaim&&(encodereclaim=0)),this.config={bitrate:e,framerate:t,width:o,height:d,buffer:a},this.handle){let i={...{bitrate:e,width:o,height:d,avc:{format:"annexb"},framerate:t,hardwareAcceleration:"no-preference",latencyMode:"realtime"},...Module.encAdditionalConfig};this.handle.configure(i),this.bsBuffer=a}}catch(e){this.onEncoderError(e)}},WebcodecEncoder.prototype.callback=function(e,t,o){this.callbackInvoked||(this.callbackInvoked=!0,e&&Module._OnEncodedVideoChunkOutputCallback(e,t,o))},WebcodecEncoder.prototype.encode=function(e,t,o,d,a){if(this.callbackInvoked=!1,(encodereclaim||this.retryFlag)&&this.configure(this.config.bitrate,this.config.framerate,this.config.width,this.config.height,this.config.buffer),this.retryFlag&&(t=1,this.retryFlag=!1),this._startTimeout(t,a),this.webcodecStatus.isFailed||!this._checkTimoutRatio())return this._stopTimeout(),this.webcodecStatus.isFailed||WebCodecsEncoderFail_js(this.id,4,!0),this.callback(this.context,1,0),frame.close(),frame=null,void postMessage({cmd:"video_un_ref"});if(this.handle){var i={keyFrame:!1};webcodecEncodeFlag||(webcodecEncodeFlag=!0,postMessage({cmd:"WCES"})),this.webcodecStatus.inputInc(t),this.webcodecStatus.inputTS=frame.timestamp,this.webcodecStatus.inputIndex%200==0&&postMessage({cmd:"THWEC"}),1==t&&(i.keyFrame=!0,this.chunkArr=[],this.lastKeyTS=frame.timestamp),this.timing.push({captureTS:frame.timestamp,encodeTS:Math.round(performance.now()),isKeyFrame:t}),this.handle.encode(frame,i),this.FeedbackEncodeChunk(),frame.close(),frame=null,postMessage({cmd:"video_un_ref"})}else globalTracingError("webcodec encode error: handle is null")},WebcodecEncoder.prototype._stopTimeout=function(){-1!=this.timeoutid&&(clearTimeout(this.timeoutid),this.timeoutid=-1)},WebcodecEncoder.prototype._checkTimoutRatio=function(){if(this.webcodecStatus.frameTimeoutCount>=6||this.webcodecStatus.keyFrameTimeoutCount>=3)return webcodec_encode_subcode=1,globalTracingError("webcodec encode error: many frames timeout in webcodec, iid="+this.webcodecStatus.inputIndex+", oid="+this.webcodecStatus.outputIndex+", its="+this.webcodecStatus.inputTS+", ots="+this.webcodecStatus.outputTS+", timeout="+this.webcodecStatus.frameTimeoutCount+", keyTimeout="+this.webcodecStatus.keyFrameTimeoutCount),!1;if(this.webcodecStatus.inputIndex%30)return!0;let e=this.webcodecStatus.timeoutIndex-this.timeoutCount;return this.timeoutCount=this.webcodecStatus.timeoutIndex,!(e>=10)||(webcodec_encode_subcode=2,globalTracingError("webcodec encode error: timed out ratio: "+Math.round(100*e/30)),!1)},WebcodecEncoder.prototype._startTimeout=function(e,t){this._stopTimeout(),this.timeoutid=setTimeout((()=>{e&&this.webcodecStatus.keyFrameTimeoutCount++,this.timeoutid=-1,this.webcodecStatus.frameTimeoutCount++,this.callback(this.context,1,0),this.webcodecStatus.timeoutIndex++}),t)},WebcodecEncoder.prototype.close=function(){"closed"!=this.handle.state&&(this.handle.close(),this.handle=null),this.callbackInvoked=!0,codecMRG.clear_encodestate()},WebcodecEncoder.prototype.failed=function(e){this.webcodecStatus.errCode=e,this.webcodecStatus.stop(!0),this.context&&Module._OnEncodedVideoChunkOutputCallback(this.context,2,0)},WebcodecEncoder.prototype.getConfig=function(){return this.config},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,d,a,i){var r=this.encodeCodecHandles.get(e);r&&r.configure(t,o,d,a,i)},CodecMRG.prototype.getEncodeConfig=function(e){var t=this.encodeCodecHandles.get(e);return t?t.getConfig():{}},CodecMRG.prototype.encodeVideoFrame=function(e,t,o,d,a,i){var r=this.encodeCodecHandles.get(e);r&&r.encode(t,o,d,a,i)},CodecMRG.prototype.webcodecFailed=function(e,t){var o=this.encodeCodecHandles.get(e);o&&o.failed(t)},CodecMRG.prototype.webcodecRetry=function(e,t,o){var d=this.encodeCodecHandles.get(e);d&&d.retry(t,o)},CodecMRG.prototype.closeVideoEncode=function(){var e=this.encodeCodecHandles.get(0);e&&e.close()},CodecMRG.prototype.clear_encodestate=function(){this.encodeCodecHandles&&this.encodeCodecHandles.clear()};'],{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_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<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}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<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var 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();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={556480:$0=>{console.log("Video Version: ",$0)},556517:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},556551:$0=>{change_capture_resolution($0)},556586:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},556663:($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)},556733:($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)},556812:($0,$1)=>{decode_callback($0,$1)},556841:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},556875:($0,$1)=>{video_rtp_data($0,$1)},556900:($0,$1,$2)=>{video_rtcp_data($0,$1,$2)},556930:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},556987:$0=>{Exit_Thread($0)},557005:$0=>{return Before_Create_Thread($0)},557042:$0=>{return Before_Create_Thread($0)},557079:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},557113:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},557153:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},557183:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)=>{sender_stats_log($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)},557273:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)=>{receiver_stats_log($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)},557365:$0=>{SubScribeUpdateVideo($0)},557393:($0,$1)=>{send_data($0,$1)},557416:$0=>{SubScribeUpdateVideo($0)},557444:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},557505:($0,$1)=>{SAVE_IV($0,$1)},557523:()=>{return Date.now()},557546:()=>{return getNTPBaseTime()},557575:()=>{return performance.now()},557605:($0,$1)=>{reportSenderNTPTime($0,$1)},557638:($0,$1)=>{Update_Required_Bandwidth($0,$1)},557674:$0=>{Update_Video_Hd_Info($0)},557702:($0,$1,$2,$3,$4)=>{on_psl_mix_share_info_changed($0,$1,$2,$3,$4)},557754:$0=>{console.log("Sharing Version: ",$0)},557793:($0,$1)=>{share_rtp_data($0,$1)},557818:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},557840:($0,$1,$2)=>{share_rtp_raw_data($0,$1,$2)},557873:($0,$1,$2,$3)=>{share_rtcp_data($0,$1,$2,$3)},557906:($0,$1,$2,$3)=>{share_rtcp_raw_data($0,$1,$2,$3)},557943:($0,$1,$2,$3)=>{share_mouse_data($0,$1,$2,$3)},557978:($0,$1,$2)=>{share_mouse_raw_data($0,$1,$2)},558013:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},558051:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},558088:($0,$1,$2)=>{on_keyframe_request($0,$1,$2)},558125:($0,$1,$2)=>{on_keyframe_request_ex($0,$1,$2)},558165:($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)},558256:($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)},558343:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},558375:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},558420:$0=>{SubScribeUpdateSharing($0)},558450:$0=>{SubScribeUpdateSharing($0)},558480:$0=>{Update_WebSokcet_Speed($0)},558512:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},558575:($0,$1)=>{SAVE_IV($0,$1)},558593:$0=>{console.error("tjDecompressHeader3 error %d ",$0)},558646:$0=>{console.error("tjDecompress2 error %d ",$0)},558693:($0,$1)=>{on_share_encode_start($0,$1)},558725:($0,$1)=>{on_share_encode_start($0,$1)},558757:($0,$1,$2,$3)=>{sharing_decode_channel_change($0,$1,$2,$3)},558804:($0,$1,$2,$3)=>{sharing_decode_channel_change($0,$1,$2,$3)},558851:($0,$1)=>{Update_Required_Bandwidth($0,$1)},558887:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},558918:($0,$1)=>{Recieve_Wb_Packet($0,$1)},558945:($0,$1)=>{video_hw_retry_info($0,$1)},558978:$0=>{release_video_receiving_channle($0)},559018:()=>{videocodec_create_helpthread()},559052:($0,$1)=>{video_hw_retry_info($0,$1)},559085:()=>{console.error("_do_sharing_controller_decode: start")},559141:()=>{console.error("_do_sharing_controller_decode: waiting msg ")},559204:$0=>{console.error("_do_sharing_controller_decode: ",$0)},559259:($0,$1,$2)=>{console.error("_do_sharing_controller_decode: Try_Analysis ",$0,$1,$2)},559334:()=>{console.error("_do_sharing_controller_decode: main session _Set_Sharing_Encryption_Key_Directly ")},559435:()=>{console.error("_do_sharing_controller_decode: _Set_Sharing_Encryption_Key_Directly ")},559523:()=>{console.error("SHARING_DECODE_NETWORK_INFO WCLSharing is null")},559589:()=>{console.error("SHARING_DECODE_REQUEST_CHECK_ONE_TYPE WCLSharing is null")},559665:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA WCLSharing is null",$0,$1)},559738:($0,$1)=>{console.error("SHARING_DECODE_MEDIA_DATA type unknwon",$0,$1)},559805:($0,$1)=>{wcl_sharing_inited($0,$1)},559834:($0,$1)=>{COMMIT_PRINT($0,$1)},559856:()=>{return Module.getRandomValue()},559892:()=>{if(Module.getRandomValue===undefined){try{var window_="object"===typeof window?window:self;var crypto_=typeof window_.crypto!=="undefined"?window_.crypto:window_.msCrypto;var randomValuesStandard=function(){var buf=new Uint32Array(1);crypto_.getRandomValues(buf);return buf[0]>>>0};randomValuesStandard();Module.getRandomValue=randomValuesStandard}catch(e){try{var crypto=require("crypto");var randomValueNodeJS=function(){var buf=crypto["randomBytes"](4);return(buf[0]<<24|buf[1]<<16|buf[2]<<8|buf[3])>>>0};randomValueNodeJS();Module.getRandomValue=randomValueNodeJS}catch(e){throw"No secure random number generator found"}}}},560614:()=>{videoencode_create_helpthread()},560649:($0,$1)=>{LOG_OUT($0,$1)},560670:($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 zeroMemory(address,size){GROWABLE_HEAP_U8().fill(0,address,address+size);return address}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<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var 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;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.timestamp=Date.now()}return i}},default_tty_ops:{get_char:function(tty){if(!tty.input.length){var result=null;if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){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 alignMemory(size,alignment){return Math.ceil(size/alignment)*alignment}function mmapAlloc(size){size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(!ptr)return 0;return zeroMemory(ptr,size)}var MEMFS={ops_table:null,mount: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<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage: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;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write:function(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===GROWABLE_HEAP_I8().buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.timestamp=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate:function(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap:function(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===buffer){allocated=false;ptr=contents.byteOffset}else{if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}GROWABLE_HEAP_I8().set(contents,ptr)}return{ptr:ptr,allocated:allocated}},msync:function(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};function asyncLoad(url,onload,onerror,noRunDep){var dep=!noRunDep?getUniqueRunDependency("al "+url):"";readAsync(url,arrayBuffer=>{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;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}current=FS.lookupNode(current,parts[i]);current_path=PATH.join2(current_path,parts[i]);if(FS.isMountpoint(current)){if(!islast||islast&&opts.follow_mount){current=current.mounted.root}}if(!islast||opts.follow){var count=0;while(FS.isLink(current.mode)){var link=FS.readlink(current_path);current_path=PATH_FS.resolve(PATH.dirname(current_path),link);var lookup=FS.lookupPath(current_path,{recurse_count:opts.recurse_count+1});current=lookup.node;if(count++>40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,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<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev:(path,mode,dev)=>{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}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="<generic error, no 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<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},getMode:(canRead,canWrite)=>{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<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}return node},createDevice:(parent,name,input,output)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);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<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write:(stream,buffer,offset,length,pos)=>{for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.timestamp=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile:obj=>{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){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<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,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 _GetWebCodecsEncoderFallbackFlag(){return GetWebCodecsEncoderFallbackFlag_js()}function _GetWebCodecsEncoderL1T2Flag(){return GetWebCodecsEncoderL1T2Flag_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}var exceptionCaught=[];function exception_addRef(info){info.add_ref()}var uncaughtExceptionCount=0;function ___cxa_begin_catch(ptr){var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);exception_addRef(info);return info.get_exception_ptr()}var exceptionLast=0;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}}function ___cxa_free_exception(ptr){return _free(new ExceptionInfo(ptr).ptr)}function exception_decRef(info){if(info.release_ref()&&!info.get_rethrown()){var destructor=info.get_destructor();if(destructor){getWasmTableEntry(destructor)(info.excPtr)}___cxa_free_exception(info.excPtr)}}function ___cxa_end_catch(){_setThrew(0);var info=exceptionCaught.pop();exception_decRef(info);exceptionLast=0}function ___resumeException(ptr){if(!exceptionLast){exceptionLast=ptr}throw ptr}function ___cxa_find_matching_catch_2(){var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var i=0;i<arguments.length;i++){var caughtType=arguments[i];if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown}function ___cxa_find_matching_catch_3(){var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var i=0;i<arguments.length;i++){var caughtType=arguments[i];if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown}function ___cxa_find_matching_catch_4(){var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var i=0;i<arguments.length;i++){var caughtType=arguments[i];if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown}function ___cxa_rethrow(){var info=exceptionCaught.pop();if(!info){abort("no exception to throw")}var ptr=info.excPtr;if(!info.get_rethrown()){exceptionCaught.push(info);info.set_rethrown(true);info.set_caught(false);uncaughtExceptionCount++}exceptionLast=ptr;throw ptr}function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function ___cxa_uncaught_exceptions(){return uncaughtExceptionCount}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 ___stack_chk_fail(){err("missing function: __stack_chk_fail");abort(-1)}function setErrNo(value){GROWABLE_HEAP_I32()[___errno_location()>>2]=value;return value}function ___syscall_fcntl64(fd,cmd,varargs){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,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;GROWABLE_HEAP_I16()[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_fstat64(fd,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(5,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(6,1,buf,size);try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getdents64(fd,dirp,count){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(7,1,fd,dirp,count);try{var stream=SYSCALLS.getStreamFromFD(fd);if(!stream.getdents){stream.getdents=FS.readdir(stream.path)}var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var idx=Math.floor(off/struct_size);while(idx<stream.getdents.length&&pos+struct_size<=count){var id;var type;var name=stream.getdents[idx];if(name==="."){id=stream.node.id;type=4}else if(name===".."){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4}else{var child=FS.lookupNode(stream.node,name);id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8}tempI64=[id>>>0,(tempDouble=id,+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()[dirp+pos>>2]=tempI64[0],GROWABLE_HEAP_I32()[dirp+pos+4>>2]=tempI64[1];tempI64=[(idx+1)*struct_size>>>0,(tempDouble=(idx+1)*struct_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()[dirp+pos+8>>2]=tempI64[0],GROWABLE_HEAP_I32()[dirp+pos+12>>2]=tempI64[1];GROWABLE_HEAP_I16()[dirp+pos+16>>1]=280;GROWABLE_HEAP_I8()[dirp+pos+18>>0]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size;idx+=1}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(8,1,fd,op,varargs);SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();GROWABLE_HEAP_I32()[argp>>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(9,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(10,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(11,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(12,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;i<pipe.buckets.length;i++){var bucket=pipe.buckets[i];if(bucket.offset-bucket.roffset>0){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<pipe.buckets.length;i++){var bucket=pipe.buckets[i];currentLength+=bucket.offset-bucket.roffset}assert(buffer instanceof ArrayBuffer||buffer instanceof SharedArrayBuffer||ArrayBuffer.isView(buffer));var data=buffer.subarray(offset,offset+length);if(length<=0){return 0}if(currentLength==0){throw new FS.ErrnoError(6)}var toRead=Math.min(currentLength,length);var totalRead=toRead;var toRemove=0;for(var i=0;i<pipe.buckets.length;i++){var currBucket=pipe.buckets[i];var bucketSize=currBucket.offset-currBucket.roffset;if(toRead<=bucketSize){var tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);if(toRead<bucketSize){tmpSlice=tmpSlice.subarray(0,toRead);currBucket.roffset+=toRead}else{toRemove++}data.set(tmpSlice);break}else{var tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);data.set(tmpSlice);data=data.subarray(tmpSlice.byteLength);toRead-=tmpSlice.byteLength;toRemove++}}if(toRemove&&toRemove==pipe.buckets.length){toRemove--;pipe.buckets[toRemove].offset=0;pipe.buckets[toRemove].roffset=0}pipe.buckets.splice(0,toRemove);return totalRead},write:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;assert(buffer instanceof ArrayBuffer||buffer instanceof SharedArrayBuffer||ArrayBuffer.isView(buffer));var data=buffer.subarray(offset,offset+length);var dataLen=data.byteLength;if(dataLen<=0){return 0}var currBucket=null;if(pipe.buckets.length==0){currBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0};pipe.buckets.push(currBucket)}else{currBucket=pipe.buckets[pipe.buckets.length-1]}assert(currBucket.offset<=PIPEFS.BUCKET_BUFFER_SIZE);var freeBytesInCurrBuffer=PIPEFS.BUCKET_BUFFER_SIZE-currBucket.offset;if(freeBytesInCurrBuffer>=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;i<numBuckets;i++){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:PIPEFS.BUCKET_BUFFER_SIZE,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data.subarray(0,PIPEFS.BUCKET_BUFFER_SIZE));data=data.subarray(PIPEFS.BUCKET_BUFFER_SIZE,data.byteLength)}if(remElements>0){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(13,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(14,1,fds,nfds,timeout);try{var nonzero=0;for(var i=0;i<nfds;i++){var pollfd=fds+8*i;var fd=GROWABLE_HEAP_I32()[pollfd>>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_stat64(path,buf){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(15,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 __munmap_js(addr,len,prot,flags,fd,offset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(16,1,addr,len,prot,flags,fd,offset);try{var stream=SYSCALLS.getStreamFromFD(fd);if(prot&2){SYSCALLS.doMsync(addr,stream,len,flags,offset)}FS.munmap(stream)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}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<winterOffset){GROWABLE_HEAP_U32()[tzname>>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_double(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}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()}function getHeapMax(){return 2097152e3}function _emscripten_get_heap_max(){return getHeapMax()}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_num_logical_cores(){return navigator["hardwareConcurrency"]}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<numCallArgs;i++){var arg=outerArgs[2+i];GROWABLE_HEAP_F64()[b+i]=arg}return _emscripten_run_in_main_runtime_thread_js(index,serializedNumCallArgs,args,sync)})}var _emscripten_receive_on_main_thread_js_callArgs=[];function _emscripten_receive_on_main_thread_js(index,numCallArgs,args){_emscripten_receive_on_main_thread_js_callArgs.length=numCallArgs;var b=args>>3;for(var i=0;i<numCallArgs;i++){_emscripten_receive_on_main_thread_js_callArgs[i]=GROWABLE_HEAP_F64()[b+i]}var isEmAsmConst=index<0;var func=!isEmAsmConst?proxiedFunctionTable[index]:ASM_CONSTS[-index-1];return func.apply(null,_emscripten_receive_on_main_thread_js_callArgs)}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=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<str.length;++i){GROWABLE_HEAP_I8()[buffer++>>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(17,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(18,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(19,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<iovcnt;i++){var ptr=GROWABLE_HEAP_U32()[iov>>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<len)break}return ret}function _fd_read(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(20,1,fd,iov,iovcnt,pnum);try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(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 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(21,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<iovcnt;i++){var ptr=GROWABLE_HEAP_U32()[iov>>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(22,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 _llvm_eh_typeid_for(type){return type}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.length<digits){str=character[0]+str}return str}function leadingNulls(value,digits){return leadingSomething(value,digits,"0")}function compareByDay(date1,date2){function sgn(value){return value<0?-1:value>0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0: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;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func.apply(null,cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret}function cwrap(ident,returnType,argTypes,opts){argTypes=argTypes||[];var numericArgs=argTypes.every(type=>type==="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_fcntl64,___syscall_fstat64,___syscall_getcwd,___syscall_getdents64,___syscall_ioctl,___syscall_lstat64,___syscall_mkdirat,___syscall_newfstatat,___syscall_openat,___syscall_pipe,___syscall_poll,___syscall_stat64,__munmap_js,_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,"GetWebCodecsEncoderFallbackFlag":_GetWebCodecsEncoderFallbackFlag,"GetWebCodecsEncoderL1T2Flag":_GetWebCodecsEncoderL1T2Flag,"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_begin_catch":___cxa_begin_catch,"__cxa_end_catch":___cxa_end_catch,"__cxa_find_matching_catch_2":___cxa_find_matching_catch_2,"__cxa_find_matching_catch_3":___cxa_find_matching_catch_3,"__cxa_find_matching_catch_4":___cxa_find_matching_catch_4,"__cxa_free_exception":___cxa_free_exception,"__cxa_rethrow":___cxa_rethrow,"__cxa_throw":___cxa_throw,"__cxa_uncaught_exceptions":___cxa_uncaught_exceptions,"__emscripten_init_main_thread_js":___emscripten_init_main_thread_js,"__emscripten_thread_cleanup":___emscripten_thread_cleanup,"__pthread_create_js":___pthread_create_js,"__resumeException":___resumeException,"__stack_chk_fail":___stack_chk_fail,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_getdents64":___syscall_getdents64,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__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,"_munmap_js":__munmap_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_double":_emscripten_asm_const_double,"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_heap_max":_emscripten_get_heap_max,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_num_logical_cores":_emscripten_num_logical_cores,"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_diii":invoke_diii,"invoke_fiii":invoke_fiii,"invoke_i":invoke_i,"invoke_ii":invoke_ii,"invoke_iii":invoke_iii,"invoke_iiii":invoke_iiii,"invoke_iiiii":invoke_iiiii,"invoke_iiiiii":invoke_iiiiii,"invoke_iiiiiii":invoke_iiiiiii,"invoke_iiiiiiii":invoke_iiiiiiii,"invoke_iiiiiiiiiii":invoke_iiiiiiiiiii,"invoke_iiiiiiiiiiii":invoke_iiiiiiiiiiii,"invoke_iiiiiiiiiiiii":invoke_iiiiiiiiiiiii,"invoke_jiiii":invoke_jiiii,"invoke_v":invoke_v,"invoke_vi":invoke_vi,"invoke_vii":invoke_vii,"invoke_viii":invoke_viii,"invoke_viiii":invoke_viiii,"invoke_viiiiiii":invoke_viiiiiii,"invoke_viiiiiiiiii":invoke_viiiiiiiiii,"invoke_viiiiiiiiiiiiiii":invoke_viiiiiiiiiiiiiii,"invoke_viiiij":invoke_viiiij,"invoke_viijii":invoke_viijii,"invoke_vij":invoke_vij,"llvm_eh_typeid_for":_llvm_eh_typeid_for,"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 _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).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 __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 __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 __set_video_network_info=Module["__set_video_network_info"]=function(){return(__set_video_network_info=Module["__set_video_network_info"]=Module["asm"]["_set_video_network_info"]).apply(null,arguments)};var __set_video_fec_info=Module["__set_video_fec_info"]=function(){return(__set_video_fec_info=Module["__set_video_fec_info"]=Module["asm"]["_set_video_fec_info"]).apply(null,arguments)};var __set_video_retran_info=Module["__set_video_retran_info"]=function(){return(__set_video_retran_info=Module["__set_video_retran_info"]=Module["asm"]["_set_video_retran_info"]).apply(null,arguments)};var __set_video_bandwidth_alloc=Module["__set_video_bandwidth_alloc"]=function(){return(__set_video_bandwidth_alloc=Module["__set_video_bandwidth_alloc"]=Module["asm"]["_set_video_bandwidth_alloc"]).apply(null,arguments)};var __set_video_statistics_flag=Module["__set_video_statistics_flag"]=function(){return(__set_video_statistics_flag=Module["__set_video_statistics_flag"]=Module["asm"]["_set_video_statistics_flag"]).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_sharing_statistics_flag=Module["__set_sharing_statistics_flag"]=function(){return(__set_sharing_statistics_flag=Module["__set_sharing_statistics_flag"]=Module["asm"]["_set_sharing_statistics_flag"]).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 __set_sharing_network_info=Module["__set_sharing_network_info"]=function(){return(__set_sharing_network_info=Module["__set_sharing_network_info"]=Module["asm"]["_set_sharing_network_info"]).apply(null,arguments)};var __set_sharing_fec_info=Module["__set_sharing_fec_info"]=function(){return(__set_sharing_fec_info=Module["__set_sharing_fec_info"]=Module["asm"]["_set_sharing_fec_info"]).apply(null,arguments)};var __set_sharing_retran_info=Module["__set_sharing_retran_info"]=function(){return(__set_sharing_retran_info=Module["__set_sharing_retran_info"]=Module["asm"]["_set_sharing_retran_info"]).apply(null,arguments)};var __set_sharing_bandwidth_alloc=Module["__set_sharing_bandwidth_alloc"]=function(){return(__set_sharing_bandwidth_alloc=Module["__set_sharing_bandwidth_alloc"]=Module["asm"]["_set_sharing_bandwidth_alloc"]).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 __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 __signal_video_controller_encode_statistics_flag=Module["__signal_video_controller_encode_statistics_flag"]=function(){return(__signal_video_controller_encode_statistics_flag=Module["__signal_video_controller_encode_statistics_flag"]=Module["asm"]["_signal_video_controller_encode_statistics_flag"]).apply(null,arguments)};var __signal_video_controller_encode_hw_retry_info=Module["__signal_video_controller_encode_hw_retry_info"]=function(){return(__signal_video_controller_encode_hw_retry_info=Module["__signal_video_controller_encode_hw_retry_info"]=Module["asm"]["_signal_video_controller_encode_hw_retry_info"]).apply(null,arguments)};var __set_mmr_signature_info=Module["__set_mmr_signature_info"]=function(){return(__set_mmr_signature_info=Module["__set_mmr_signature_info"]=Module["asm"]["_set_mmr_signature_info"]).apply(null,arguments)};var __set_singature_info=Module["__set_singature_info"]=function(){return(__set_singature_info=Module["__set_singature_info"]=Module["asm"]["_set_singature_info"]).apply(null,arguments)};var __set_meeting_uuid_for_signature=Module["__set_meeting_uuid_for_signature"]=function(){return(__set_meeting_uuid_for_signature=Module["__set_meeting_uuid_for_signature"]=Module["asm"]["_set_meeting_uuid_for_signature"]).apply(null,arguments)};var __update_signagure_verify_action=Module["__update_signagure_verify_action"]=function(){return(__update_signagure_verify_action=Module["__update_signagure_verify_action"]=Module["asm"]["_update_signagure_verify_action"]).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 __signal_video_controller_decode_statistics_flag=Module["__signal_video_controller_decode_statistics_flag"]=function(){return(__signal_video_controller_decode_statistics_flag=Module["__signal_video_controller_decode_statistics_flag"]=Module["asm"]["_signal_video_controller_decode_statistics_flag"]).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_statistics_flag=Module["__signal_sharing_controller_encode_statistics_flag"]=function(){return(__signal_sharing_controller_encode_statistics_flag=Module["__signal_sharing_controller_encode_statistics_flag"]=Module["asm"]["_signal_sharing_controller_encode_statistics_flag"]).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 __signal_sharing_controller_encode_hw_info=Module["__signal_sharing_controller_encode_hw_info"]=function(){return(__signal_sharing_controller_encode_hw_info=Module["__signal_sharing_controller_encode_hw_info"]=Module["asm"]["_signal_sharing_controller_encode_hw_info"]).apply(null,arguments)};var __signal_sharing_controller_encode_hw_retry_info=Module["__signal_sharing_controller_encode_hw_retry_info"]=function(){return(__signal_sharing_controller_encode_hw_retry_info=Module["__signal_sharing_controller_encode_hw_retry_info"]=Module["asm"]["_signal_sharing_controller_encode_hw_retry_info"]).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 __signal_sharing_controller_decode_statistics_flag=Module["__signal_sharing_controller_decode_statistics_flag"]=function(){return(__signal_sharing_controller_decode_statistics_flag=Module["__signal_sharing_controller_decode_statistics_flag"]=Module["asm"]["_signal_sharing_controller_decode_statistics_flag"]).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 getTempRet0=Module["getTempRet0"]=function(){return(getTempRet0=Module["getTempRet0"]=Module["asm"]["getTempRet0"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _htonl=Module["_htonl"]=function(){return(_htonl=Module["_htonl"]=Module["asm"]["htonl"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _pthread_self=Module["_pthread_self"]=function(){return(_pthread_self=Module["_pthread_self"]=Module["asm"]["pthread_self"]).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 setTempRet0=Module["setTempRet0"]=function(){return(setTempRet0=Module["setTempRet0"]=Module["asm"]["setTempRet0"]).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_builtin_memalign=Module["_emscripten_builtin_memalign"]=function(){return(_emscripten_builtin_memalign=Module["_emscripten_builtin_memalign"]=Module["asm"]["emscripten_builtin_memalign"]).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 _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 __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_can_catch=Module["___cxa_can_catch"]=function(){return(___cxa_can_catch=Module["___cxa_can_catch"]=Module["asm"]["__cxa_can_catch"]).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_iijii=Module["dynCall_iijii"]=function(){return(dynCall_iijii=Module["dynCall_iijii"]=Module["asm"]["dynCall_iijii"]).apply(null,arguments)};var dynCall_iiijiji=Module["dynCall_iiijiji"]=function(){return(dynCall_iiijiji=Module["dynCall_iiijiji"]=Module["asm"]["dynCall_iiijiji"]).apply(null,arguments)};var dynCall_iiijiii=Module["dynCall_iiijiii"]=function(){return(dynCall_iiijiii=Module["dynCall_iiijiii"]=Module["asm"]["dynCall_iiijiii"]).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_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).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_viiiij=Module["dynCall_viiiij"]=function(){return(dynCall_viiiij=Module["dynCall_viiiij"]=Module["asm"]["dynCall_viiiij"]).apply(null,arguments)};var dynCall_viiijii=Module["dynCall_viiijii"]=function(){return(dynCall_viiijii=Module["dynCall_viiijii"]=Module["asm"]["dynCall_viiijii"]).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_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_iiji=Module["dynCall_iiji"]=function(){return(dynCall_iiji=Module["dynCall_iiji"]=Module["asm"]["dynCall_iiji"]).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_jiiii=Module["dynCall_jiiii"]=function(){return(dynCall_jiiii=Module["dynCall_jiiii"]=Module["asm"]["dynCall_jiiii"]).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_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==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)}}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_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}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_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}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_iiiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_i(index){var sp=stackSave();try{return getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_fiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_diii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vij(index,a1,a2,a3){var sp=stackSave();try{dynCall_vij(index,a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiij(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{dynCall_viiiij(index,a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viijii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{dynCall_viijii(index,a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_jiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return dynCall_jiiii(index,a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==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();
2
+ `,Module.instantiateWasm=function(e,t){return self.downloadAndInstantiateWebAssembly(e,t),{}},Module.onRuntimeInitialized=function(){postMessage({status:wasmSuccessEvent}),self.onWasmModuleReady()},Module.onAbort=function(e){postMessage({status:wasmFailEvent,data:e})};var objectUrl=URL.createObjectURL(new Blob([Module.mainScriptUrlOrBlob],{type:"application/javascript"}));Module.mainScriptUrlOrBlob=new Blob([Module.mainScriptUrlOrBlob],{type:"application/javascript"}),function(){let e=self;return new Promise(((t,r)=>{postMessage({status:"WFMO"});const i=r=>{let a=r.data;"wasmMemory"===a.command&&(Module.wasmMemory=a.data,e.removeEventListener("message",i),t())};e.addEventListener("message",i)}))}().then((()=>{importScripts(objectUrl),URL.revokeObjectURL(objectUrl)}));
3
+ //# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/video_mtsimd.min.js-a0386a23562ff8d5beb5.map