1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8796],{558631:function(e,t,r){var n=r(929143);e.exports=function(){var e={194:function(e){e.exports=(()=>{"use strict";var e={895:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SEGMENTIO_API_KEY=void 0,t.SEGMENTIO_API_KEY="KeNeyutYrobpfwK1PBQEzmM8Pp3ESOWS"},114:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(456),t),i(r(959),t),i(r(2),t)},959:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;let n=r(456);t.timer="u">typeof AudioContext&&(0,n.isChromium)()?function(e,t){let r=new AudioContext,n=r.createGain();n.gain.value=0,n.connect(r.destination);let i=t/1e3,a=null,o=null,s=()=>{a&&(clearTimeout(a),a=null),o&&(o.onended=null,o.stop(),o.disconnect(n),o=null)},u=c=>{c||console.debug("timer: Oscillator based scheduling failed, recovered via setTimeout"),s(),(o=r.createOscillator()).onended=u,o.connect(n);let{currentTime:l}=r;o.start(l),o.stop(l+i),a=setTimeout(u,t+10),e(1e3*l)};return u(new CustomEvent("start")),function(){s(),n.disconnect(),r.close().catch(()=>{})}}:function(e,t){let r=0,n=!1,i=a=>{n||(requestAnimationFrame(i),a-r>=t&&(r=a,e(a)))};return requestAnimationFrame(i),function(){n=!0}}},2:function(e,t,r){let n;var i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.createTracker=void 0;let a=r(895),o=r(286),s="__segmentAnonymousId",u="https://api.segment.io/v1";class c{track(e){}}"u">typeof window&&window.localStorage&&((n=window.localStorage.getItem(s))||(n=(0,o.v4)(),window.localStorage.setItem(s,n)));class l{constructor(){if(this.enabled=!0,this.internalDisabled=!0,this.pendingEvents=[],this.context={library:{name:"effects-sdk-common",version:r(147).i8},page:{url:"u">typeof window?window.location.href:""},userAgent:navigator.userAgent},this.segmentBlocked||null===n)return;const e=btoa(`${a.SEGMENTIO_API_KEY}:`);this.headers=new Headers({"Content-Type":"application/json",Authorization:`Basic ${e}`}),i(void 0,void 0,void 0,function*(){if(200!==(yield fetch(`${u}/t`,{method:"POST",body:"{}"})).status)throw Error("Invalid response from segment test url")}).then(()=>{this.segmentBlocked=!1,this.checkPendingEvents()}).catch(e=>{this.segmentBlocked=!0,this.pendingEvents=[]})}track(e){this.enabled&&!0!==this.segmentBlocked&&(this.pendingEvents.push({eventName:e.eventName,properties:e.properties,time:new Date}),this.checkPendingEvents())}enable(){this.internalDisabled||(this.enabled=!0)}disable(){this.enabled=!1}flush(){if(!1===this.segmentBlocked)for(;this.pendingEvents.length>0;)this.sendEvents(this.pendingEvents.slice(0,50)),this.pendingEvents=this.pendingEvents.slice(50)}checkPendingEvents(){if(!1!==this.segmentBlocked)return;if(this.pendingEvents.length>1e3)return void(this.pendingEvents=[]);let e=this.pendingEvents[0];for(;this.pendingEvents.length>=50||e&&Date.now()-(null==e?void 0:e.time.getTime())>5e3;)this.sendEvents(this.pendingEvents.slice(0,50)),this.pendingEvents=this.pendingEvents.slice(50),e=this.pendingEvents[0];this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0),this.pendingEvents.length>0&&(this.batchTimeout=setTimeout(()=>{this.checkPendingEvents()},5e3))}sendEvents(e){let t=e.map(e=>({type:"track",anonymousId:n,event:e.eventName,properties:e.properties,timestamp:e.time.toISOString()}));fetch(`${u}/batch`,{method:"POST",headers:this.headers,body:JSON.stringify({batch:t,context:this.context})}).catch(e=>{})}}t.createTracker=function(e=!0){return a.SEGMENTIO_API_KEY&&e&&n?new l:new c}},456:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})};
1Object.defineProperty(t,"__esModule",{value:!0}),t.isWindows=t.isMac=t.isChromium=t.isSafari=t.isiOS=t.limitSimultaneousExecution=void 0,t.limitSimultaneousExecution=function(e){let t=!1;return function(...n){return r(this,void 0,void 0,function*(){if(!t){t=!0;try{yield e.apply(this,n)}finally{t=!1}}})}},t.isiOS=()=>/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,t.isSafari=()=>/apple/i.test(navigator.vendor)||(0,t.isiOS)(),t.isChromium=()=>"u">typeof window&&window.chrome,t.isMac=()=>{var e;return/^Mac/.test(null==(e=globalThis.navigator)?void 0:e.platform)},t.isWindows=()=>{var e;return/^Win/.test(null==(e=globalThis.navigator)?void 0:e.platform)}},286:(e,t,r)=>{r.r(t),r.d(t,{NIL:()=>O,parse:()=>g,stringify:()=>c,v1:()=>m,v3:()=>T,v4:()=>S,v5:()=>A,validate:()=>o,version:()=>P});var n=new Uint8Array(16);function i(){if(!l&&!(l="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"u">typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(n)}let a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,o=function(e){return"string"==typeof e&&a.test(e)};for(var s=[],u=0;u<256;++u)s.push((u+256).toString(16).substr(1));let c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase();if(!o(r))throw TypeError("Stringified UUID is invalid");return r};var l,h,f,d=0,p=0;let m=function(e,t,r){var n=t&&r||0,a=t||Array(16),o=(e=e||{}).node||h,s=void 0!==e.clockseq?e.clockseq:f;if(null==o||null==s){var u=e.random||(e.rng||i)();null==o&&(o=h=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==s&&(s=f=16383&(u[6]<<8|u[7]))}var l=void 0!==e.msecs?e.msecs:Date.now(),m=void 0!==e.nsecs?e.nsecs:p+1,g=l-d+(m-p)/1e4;if(g<0&&void 0===e.clockseq&&(s=s+1&16383),(g<0||l>d)&&void 0===e.nsecs&&(m=0),m>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");d=l,p=m,f=s;var v=(1e4*(0xfffffff&(l+=122192928e5))+m)%0x100000000;a[n++]=v>>>24&255,a[n++]=v>>>16&255,a[n++]=v>>>8&255,a[n++]=255&v;var b=l/0x100000000*1e4&0xfffffff;a[n++]=b>>>8&255,a[n++]=255&b,a[n++]=b>>>24&15|16,a[n++]=b>>>16&255,a[n++]=s>>>8|128,a[n++]=255&s;for(var w=0;w<6;++w)a[n+w]=o[w];return t||c(a)},g=function(e){if(!o(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/0x10000000000&255,r[11]=t/0x100000000&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};function v(e,t,r){function n(e,n,i,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=g(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=r(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,i){a=a||0;for(var s=0;s<16;++s)i[a+s]=o[s];return i}return c(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function b(e){return 14+(e+64>>>9<<4)+1}function w(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function y(e,t,r,n,i,a){var o;return w((o=w(w(t,e),w(n,a)))<<i|o>>>32-i,r)}function k(e,t,r,n,i,a,o){return y(t&r|~t&n,e,t,i,a,o)}function x(e,t,r,n,i,a,o){return y(t&n|r&~n,e,t,i,a,o)}function _(e,t,r,n,i,a,o){return y(t^r^n,e,t,i,a,o)}function E(e,t,r,n,i,a,o){return y(r^(t|~n),e,t,i,a,o)}let T=v("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var a=e[i>>5]>>>i%32&255,o=parseInt(n.charAt(a>>>4&15)+n.charAt(15&a),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[b(t)-1]=t;
1for(var r=0x67452301,n=-0x10325477,i=-0x67452302,a=0x10325476,o=0;o<e.length;o+=16){var s=r,u=n,c=i,l=a;r=k(r,n,i,a,e[o],7,-0x28955b88),a=k(a,r,n,i,e[o+1],12,-0x173848aa),i=k(i,a,r,n,e[o+2],17,0x242070db),n=k(n,i,a,r,e[o+3],22,-0x3e423112),r=k(r,n,i,a,e[o+4],7,-0xa83f051),a=k(a,r,n,i,e[o+5],12,0x4787c62a),i=k(i,a,r,n,e[o+6],17,-0x57cfb9ed),n=k(n,i,a,r,e[o+7],22,-0x2b96aff),r=k(r,n,i,a,e[o+8],7,0x698098d8),a=k(a,r,n,i,e[o+9],12,-0x74bb0851),i=k(i,a,r,n,e[o+10],17,-42063),n=k(n,i,a,r,e[o+11],22,-0x76a32842),r=k(r,n,i,a,e[o+12],7,0x6b901122),a=k(a,r,n,i,e[o+13],12,-0x2678e6d),i=k(i,a,r,n,e[o+14],17,-0x5986bc72),r=x(r,n=k(n,i,a,r,e[o+15],22,0x49b40821),i,a,e[o+1],5,-0x9e1da9e),a=x(a,r,n,i,e[o+6],9,-0x3fbf4cc0),i=x(i,a,r,n,e[o+11],14,0x265e5a51),n=x(n,i,a,r,e[o],20,-0x16493856),r=x(r,n,i,a,e[o+5],5,-0x29d0efa3),a=x(a,r,n,i,e[o+10],9,0x2441453),i=x(i,a,r,n,e[o+15],14,-0x275e197f),n=x(n,i,a,r,e[o+4],20,-0x182c0438),r=x(r,n,i,a,e[o+9],5,0x21e1cde6),a=x(a,r,n,i,e[o+14],9,-0x3cc8f82a),i=x(i,a,r,n,e[o+3],14,-0xb2af279),n=x(n,i,a,r,e[o+8],20,0x455a14ed),r=x(r,n,i,a,e[o+13],5,-0x561c16fb),a=x(a,r,n,i,e[o+2],9,-0x3105c08),i=x(i,a,r,n,e[o+7],14,0x676f02d9),r=_(r,n=x(n,i,a,r,e[o+12],20,-0x72d5b376),i,a,e[o+5],4,-378558),a=_(a,r,n,i,e[o+8],11,-0x788e097f),i=_(i,a,r,n,e[o+11],16,0x6d9d6122),n=_(n,i,a,r,e[o+14],23,-0x21ac7f4),r=_(r,n,i,a,e[o+1],4,-0x5b4115bc),a=_(a,r,n,i,e[o+4],11,0x4bdecfa9),i=_(i,a,r,n,e[o+7],16,-0x944b4a0),n=_(n,i,a,r,e[o+10],23,-0x41404390),r=_(r,n,i,a,e[o+13],4,0x289b7ec6),a=_(a,r,n,i,e[o],11,-0x155ed806),i=_(i,a,r,n,e[o+3],16,-0x2b10cf7b),n=_(n,i,a,r,e[o+6],23,0x4881d05),r=_(r,n,i,a,e[o+9],4,-0x262b2fc7),a=_(a,r,n,i,e[o+12],11,-0x1924661b),i=_(i,a,r,n,e[o+15],16,0x1fa27cf8),r=E(r,n=_(n,i,a,r,e[o+2],23,-0x3b53a99b),i,a,e[o],6,-0xbd6ddbc),a=E(a,r,n,i,e[o+7],10,0x432aff97),i=E(i,a,r,n,e[o+14],15,-0x546bdc59),n=E(n,i,a,r,e[o+5],21,-0x36c5fc7),r=E(r,n,i,a,e[o+12],6,0x655b59c3),a=E(a,r,n,i,e[o+3],10,-0x70f3336e),i=E(i,a,r,n,e[o+10],15,-1051523),n=E(n,i,a,r,e[o+1],21,-0x7a7ba22f),r=E(r,n,i,a,e[o+8],6,0x6fa87e4f),a=E(a,r,n,i,e[o+15],10,-0x1d31920),i=E(i,a,r,n,e[o+6],15,-0x5cfebcec),n=E(n,i,a,r,e[o+13],21,0x4e0811a1),r=E(r,n,i,a,e[o+4],6,-0x8ac817e),a=E(a,r,n,i,e[o+11],10,-0x42c50dcb),i=E(i,a,r,n,e[o+2],15,0x2ad7d2bb),n=E(n,i,a,r,e[o+9],21,-0x14792c6f),r=w(r,s),n=w(n,u),i=w(i,c),a=w(a,l)}return[r,n,i,a]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(b(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))}),S=function(e,t,r){var n=(e=e||{}).random||(e.rng||i)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return c(n)};function R(e,t){return e<<t|e>>>32-t}let A=v("v5",80,function(e){var t=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],r=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,o=Math.ceil(a/16),s=Array(o),u=0;u<o;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];s[u]=c}s[o-1][14]=8*(e.length-1)/0x100000000,s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(e.length-1)|0;for(var h=0;h<o;++h){for(var f=new Uint32Array(80),d=0;d<16;++d)f[d]=s[h][d];for(var p=16;p<80;++p)f[p]=R(f[p-3]^f[p-8]^f[p-14]^f[p-16],1);for(var m=r[0],g=r[1],v=r[2],b=r[3],w=r[4],y=0;y<80;++y){var k=Math.floor(y/20),x=R(m,5)+function(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}(k,g,v,b)+w+t[k]+f[y]>>>0;w=b,b=v,v=R(g,30)>>>0,g=m,m=x}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+w>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]}),O="00000000-0000-0000-0000-000000000000",P=function(e){if(!o(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}
1,147:e=>{e.exports={i8:"0.0.8"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}return r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(114)})()},931:e=>{self,e.exports=function(){var e={3058:function(e,t,r){"use strict";function n(){return"u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}function i(){return n()?(self.isWorker=!0,self):(window.isWorker=!1,window)}function a(e){return n()?e instanceof OffscreenCanvasRenderingContext2D:e instanceof CanvasRenderingContext2D}r.d(t,{uL:function(){return u},Th:function(){return s},yb:function(){return o},Hy:function(){return j},ZS:function(){return z}});var o=function(e,t){let r;"string"==typeof e&&(e=document.getElementById(e));let n=t.preserveDrawingBuffer||!1,a=1;if("true"===t.use_webgl1?r=e.getContext("webgl",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}):(r=e.getContext("webgl2",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}),a=2,r||(a=1,r=e.getContext("webgl",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}))),r.getExtension("WEBGL_draw_buffers")?r.disable_multi_draw=t.disable_multi_draw||!1:r.disable_multi_draw=!0,r.extensions={},r.getVersion=function(){return a},1===r.getVersion()){if("float32"===t.float_type){if(r.extensions.EXT_FLOAT=r.getExtension("OES_texture_float"),!r.extensions.EXT_FLOAT)throw Error("Extension not found: OES_texture_float");r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_float_linear"),r.extensions.EXT_FLOAT_LINEAR,r.texture_format=r.RGBA,r.texture_type=r.FLOAT}else{if(r.extensions.EXT_FLOAT=r.getExtension("OES_texture_half_float"),!r.extensions.EXT_FLOAT)throw Error("Extension not found: OES_texture_half_float");r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_half_float_linear"),r.extensions.EXT_FLOAT_LINEAR,r.texture_format=r.RGBA,r.texture_type=r.extensions.EXT_FLOAT.HALF_FLOAT_OES}if(!r.disable_multi_draw&&(r.extensions.WEBGL_draw_buffers=r.getExtension("WEBGL_draw_buffers"),!r.extensions.WEBGL_draw_buffers))throw Error("Extension not found: WEBGL_draw_buffers")}else{if(r.extensions.EXT_FLOAT=r.getExtension("EXT_color_buffer_float"),!r.extensions.EXT_FLOAT)throw Error("Extension not found: EXT_color_buffer_float");"float32"===t.float_type?(r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_float_linear"),r.texture_format=r.RGBA32F):(r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_half_float_linear"),r.texture_format=r.RGBA16F),r.texture_type=r.FLOAT}return 1===r.getVersion()?(r.getCOLOR_ATTACHMENT=function(e=0){return r.disable_multi_draw?r.COLOR_ATTACHMENT0:r.extensions.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL+e},r.getDrawBuffers=function(e=[r.getCOLOR_ATTACHMENT(0)]){r.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(e)}):(r.getCOLOR_ATTACHMENT=function(e=0){return r.COLOR_ATTACHMENT0+e},r.getDrawBuffers=function(e=[r.getCOLOR_ATTACHMENT(0)]){r.drawBuffers(e)}),i().gl=r,r.canvas.w=r.canvas.width,r.canvas.h=r.canvas.height,r.clearCanvas=function(){r.clearColor(0,0,0,1),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT)},r.input={h:t.h,w:t.w},r.render_scale={h:1,w:1},r.viewport(0,0,e.width,e.height),r.createAndCompileShader=function(e,t){let n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(r.getShaderInfoLog(n));return n},r.createAndLinkProgram=function(e,t){let n=r.createProgram();if(r.attachShader(n,e),r.attachShader(n,t),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS))throw Error(r.getProgramInfoLog(n));return n},r.resizeCanvasToDisplaySize=function(t,r){return(e.width!==t||e.height!==r)&&(e.width=t,e.height=r,!0)},r.resizeRenderSize=function(e,t,n){let i=n*r.input.w,a=n*r.input.h;i=e>i?e:i,a=t>a?t:a,r.render_scale={w:e/i,h:t/a},r.resizeCanvasToDisplaySize(i,a)},r._refs={textures:[],buffers:[]},r.storeRef=(e,t)=>{"texture"===e?r._refs.textures.push(t):"buffer"===e&&r._refs.buffers.push(t)},r.clearRefs=()=>
1{r._refs.textures.forEach(e=>r.deleteTexture(e)),r._refs.buffers.forEach(e=>r.deleteBuffer(e)),r._refs={textures:[],buffers:[]}},r.log=function(e){},r},s=class{constructor(e,t,r,n){this.gl=e,this.network=t,this.network.upscaleFactor=this.network.upscaleFactor||1,this.frameBuffer=r,this.renderSize={w:n.w,h:n.h},this.metrics={"Render Size":this.renderSize,"Original Size":e.input,"Upscale Factor":this.network.upscaleFactor,FPS:0},this.setProperties(n)}setProperties(e={w:1278,h:720,disableVideoToCanvas:!1}){let t=this;!0!==e.disableVideoToCanvas&&this.frameBuffer.setInputFrameCanvas(),void 0===e.w&&(e.w=this.network.upscaleFactor*this.gl.input.w),void 0===e.h&&(e.h=this.network.upscaleFactor*this.gl.input.h),this.renderSize=e,this.gl.resizeRenderSize(e.w,e.h,this.network.upscaleFactor),null!==this.frameBuffer.inputTex&&setTimeout(()=>{t.network.renderRGB&&t.network.renderRGB(t.gl.render_scale)}),t.metrics["Render Size"]=e}setInputSize(e={w:426,h:240},t=null){this.gl.input={w:e.w,h:e.h},this.network.resetTextureBuffers(),this.setProperties(t||this.renderSize)}async resetNetwork(e){this.frameBuffer.clearall(),this.gl.clearRefs(),this.network=await async function(e={name:"",version:"",tag:"",token:""},t,r){let n=null,i=null;try{i=await z(e.name,e.tag,e.version,e.token)}catch(e){throw console.error("%cParameter load failed:","background:black; color: yellow"),Error(e)}if(!i)throw console.error("%cParameter load failed:","background:black; color: yellow"),Error("");try{let a=j(e.name,e.token);n=new(n=await a)(t,r,i)}catch(e){throw console.error("%cNetwork load failed:","background:black; color: yellow"),Error(e)}return n}({name:e.name,version:e.version,tag:e.tag},this.gl,this.network.frameBuffer),this.frameBuffer=this.network.frameBuffer,this.gl=this.network.gl,this.setProperties(this.renderSize)}changeNetwork(e){this.network=e,this.frameBuffer=this.network.frameBuffer,this.gl=this.network.gl}async loadBitmap(e){let t=this.frameBuffer;this.network,t.setInputImage(e),await this.render()}loadImage(e){let t=new Image;t.src=e;let r=this.frameBuffer,n=this;t.onload=async function(){r.setInputImage(t),await n.render()}}async render(e){let t=this.gl,r=this.network;t.clearColor(0,0,0,1),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),r.initialized&&await r.initialized,await r.feedForward(t.render_scale,e),t.flush()}async previewRender(e){let t=this.gl,r=this.network;r.initialized&&await r.initialized,await r.previewForward(e),t.flush()}},u=class{constructor(e){this.gl=e,this.iterations=0,this.textures=[{},{}],this.frame_buffers=[{},{}],this.inputTex=null,this.inputCanvas=null,this.frame_difference=0}drawToCanvas(){let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null)}setBuffer(e){let t=this.gl,r=this.iterations%2*this.frame_difference;t.bindFramebuffer(t.FRAMEBUFFER,this.frame_buffers[r][e])}setInputFrameCanvas(){i(),a(this.inputCanvas)||(this.inputCanvas=(function(e,t){if(n())return new OffscreenCanvas(e,t);{let r=document.createElement("canvas");return r.width=e,r.height=t,r}})(this.gl.input.w,this.gl.input.h).getContext("2d")),this.inputCanvas.canvas.width=this.gl.input.w,this.inputCanvas.canvas.height=this.gl.input.h}videoToCanvas(e){return this.inputCanvas.drawImage(e,0,0,this.gl.input.w,this.gl.input.h),this.inputCanvas.canvas}getInputTexture(e=!1){let t=this.gl;if(null===this.inputTex||e){e&&this.inputTex instanceof WebGLTexture&&t.deleteTexture(this.inputTex);let r=t.createTexture();this.inputTex=this._setTextureSize(r,t.input.w,t.input.h)}return this.inputTex}updateInputTexture(){this.getInputTexture(!0)}setInputImage(e){this.input=e;let t=this.gl;a(this.inputCanvas)&&1===t.getVersion()&&(e=this.videoToCanvas(e));let r=this.getInputTexture();t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.texture_format,t.RGBA,t.texture_type,e);for(let e=0;e<=this.frame_difference;e++)this.textures[e].INPUT=[r]}setImageAsTexture(e,t){let r=this.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,r.texture_format,r.RGBA,r.texture_type,e);for(let e=0;e<=this.frame_difference;e++)this.textures[e][t]=[n]}createBufferWithTextures(e,t,r=1,n=null){let i=this.gl;for(let a=0;a<=this.frame_difference;a++){let o=i.createFramebuffer();this.frame_buffers[a][e]=o,i.bindFramebuffer(i.FRAMEBUFFER,o);let s=[];this.textures[a][e]=null;for(let e=0;e<t;++e){let t=this.createAndSetupTexture(n);t=this._setTextureSize(t,i.input.w*r,i.input.h*r),s.push(t),i.bindTexture(i.TEXTURE_2D,t),i.texImage2D(i.TEXTURE_2D,0,i.texture_format,i.input.w*r,i.input.h*r,0,i.RGBA,i.texture_type,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.getCOLOR_ATTACHMENT(e),i.TEXTURE_2D,t,0)}this.textures[a][e]=s}}createBufferWithTextures2(e,t,r,n,i={}){let a=this.gl;if(r<=0||n<=0)throw Error("Texture width and height must be greater than 0");let o=i.format||a.RGBA,s=i.minFilter||a.NEAREST,u=i.magFilter||a.NEAREST,c=i.type||a.texture_type||a.UNSIGNED_BYTE,l=i.internalFormat||a.texture_format||a.RGBA;for(let i=0;i<=this.frame_difference;i++){let h=a.createFramebuffer();this.frame_buffers[i][e]=h,a.bindFramebuffer(a.FRAMEBUFFER,h);let f=[];this.textures[i][e]=null;for(let e=0;e<t;++e){let t;1===a.getVersion()?t=this.createTexture_webgl1(l,r,n,o,c,s,u):(l===a.RGBA&&(l=
1a.RGBA8),t=this.createTexture_webgl2(l,r,n,s,u)),a.framebufferTexture2D(a.FRAMEBUFFER,a.getCOLOR_ATTACHMENT(e),a.TEXTURE_2D,t,0),f.push(t)}this.textures[i][e]=f}}getTextureSize(e,t=0,r=0){if(!this.textures[t][e][r])throw Error(`Failed to get resolution of textures for layer: ${e} at index: ${index}`);return this.textures[t][e][r].size}createTexture_webgl2(e,t,r,n,i){n=n||gl.NEAREST,i=i||gl.NEAREST,e=e||gl.texture_format||gl.RGBA;let a=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,a),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,n),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,i),gl.texStorage2D(gl.TEXTURE_2D,1,e,t,r),a=this._setTextureSize(a,t,r)}createTexture_webgl1(e,t,r,n,i,a,o){n=n||gl.RGBA,a=a||gl.NEAREST,o=o||gl.NEAREST,i=i||gl.texture_type||gl.UNSIGNED_BYTE,e=e||gl.texture_format||gl.RGBA;let s=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,s),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,a),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,o),gl.texImage2D(gl.TEXTURE_2D,0,e,t,r,0,n,i,null),s=this._setTextureSize(s,t,r)}createFloatTextureFromArrayBuffer(e,t,r,n,i,a,o,s){a=a||gl.RGBA,o=o||gl.NEAREST,s=s||gl.NEAREST,i=i||gl.texture_type||gl.UNSIGNED_BYTE,t=t||gl.texture_format||gl.RGBA;let u=new Float32Array(e),c=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,c),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,o),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,s),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA32F,r,n,0,gl.RGBA,gl.FLOAT,u),c=this._setTextureSize(c,r,n)}_setTextureSize(e,t,r){return t>0&&r>0&&(e.size={},e.size.width=t,e.size.height=r),e}setBufferForLayer(e,t){for(let r=0;r<=this.frame_difference;r++){let n=gl.createFramebuffer();this.frame_buffers[r][e]=n,gl.bindFramebuffer(gl.FRAMEBUFFER,n);for(let e=0;e<t.length;e++)gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.getCOLOR_ATTACHMENT(e),gl.TEXTURE_2D,t[e],0);this.textures[r][e]=t}}getTexture(e){let t=this.iterations%2*this.frame_difference;return this.textures[t][e]}getLastFrameTexture(e){let t=1-this.iterations%2;return this.textures[t][e]}clearall(){Object.keys(this.textures[0]).forEach(e=>{destroyTextureAndBuffer(e)}),this.gl.deleteTexture(this.inputTex),this.inputTex=null,this.inputCanvas=null,this.frame_buffers=[{},{}],this.textures=[{},{}],this.gl.clearCanvas()}destroyTextureAndFrameBuffer(e){for(let t=0;t<=this.frame_difference;t++)if(this.frame_buffers[t][e]&&(this.gl.deleteFramebuffer(this.frame_buffers[t][e]),this.frame_buffers[t][e]=null),this.textures[t][e])for(let r=0;r<this.textures[t][e].length;++r)this.gl.deleteTexture(this.textures[t][e][r]),this.textures[t][e][r]=null}createAndSetupTexture(e=null){let t=this.gl;t.extensions.EXT_FLOAT_LINEAR||(e=null),null===e&&(e=t.NEAREST);let r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),r}};r(3259);var c=r(7618),l=r(2497),h=r.n(l),f=r(8958),d=r.n(f),p="u">typeof globalThis&&globalThis||"u">typeof self&&self||void 0!==p&&p,m="URLSearchParams"in p,g="Symbol"in p&&"iterator"in Symbol,v="FileReader"in p&&"Blob"in p&&function(){try{return new Blob,!0}catch(e){return!1}}(),b="FormData"in p,w="ArrayBuffer"in p;if(w)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(e){return e&&y.indexOf(Object.prototype.toString.call(e))>-1};function x(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function _(e){return"string"!=typeof e&&(e=String(e)),e}function E(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return g&&(t[Symbol.iterator]=function(){return t}),t}function T(e){this.map={},e instanceof T?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function S(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function R(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function A(e){var t=new FileReader,r=R(t);return t.readAsArrayBuffer(e),r}function O(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function P(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:v&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:b&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:m&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():w&&v&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=O(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):w&&(ArrayBuffer.prototype.isPrototypeOf(e)||k(e))?this._bodyArrayBuffer=O(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):m&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v&&(this.blob=function(){var e=S(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?S(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(A)}),this.text=function(){var e,t,r,n=S(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=R(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},b&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}T.prototype.append=function(e,t){e=x(e),t=_(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},T.prototype.delete=function(e){delete this.map[x(e)]},T.prototype.get=function(e){return e=x(e),this.has(e)?this.map[e]:null},T.prototype.has=function(e){return this.map.hasOwnProperty(x(e))},T.prototype.set=function(e,t){this.map[x(e)]=_(t)},T.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},T.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),E(e)},T.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),E(e)},T.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),E(e)},g&&(T.prototype[Symbol.iterator]=T.prototype.entries);
1var C=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function I(e,t){if(!(this instanceof I))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,i=(t=t||{}).body;if(e instanceof I){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new T(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new T(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),C.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),("GET"===this.method||"HEAD"===this.method)&&("no-store"===t.cache||"no-cache"===t.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function F(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}}),t}function B(e,t){if(!(this instanceof B))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new T(t.headers),this.url=t.url||"",this._initBody(e)}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})},P.call(I.prototype),P.call(B.prototype),B.prototype.clone=function(){return new B(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new T(this.headers),url:this.url})},B.error=function(){var e=new B(null,{status:0,statusText:""});return e.type="error",e};var M=[301,302,303,307,308];B.redirect=function(e,t){if(-1===M.indexOf(t))throw RangeError("Invalid status code");return new B(null,{status:t,headers:{location:e}})};var L=p.DOMException;try{new L}catch(e){(L=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),L.prototype.constructor=L}function N(e,t){return new Promise(function(r,n){var i=new I(e,t);if(i.signal&&i.signal.aborted)return n(new L("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new T,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}}),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;setTimeout(function(){r(new B(i,n))},0)},a.onerror=function(){setTimeout(function(){n(TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){n(TypeError("Network request failed"))},0)},a.onabort=function(){setTimeout(function(){n(new L("Aborted","AbortError"))},0)},a.open(i.method,function(e){try{return""===e&&p.location.href?p.location.href:e}catch(t){return e}}(i.url),!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&(v?a.responseType="blob":w&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof T?i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}):Object.getOwnPropertyNames(t.headers).forEach(function(e){a.setRequestHeader(e,_(t.headers[e]))}),i.signal&&(i.signal.addEventListener("abort",o),a.onreadystatechange=function(){4===a.readyState&&i.signal.removeEventListener("abort",o)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})}N.polyfill=!0,p.fetch||(p.fetch=N,p.Headers=T,p.Request=I,p.Response=B);let U=i(),j=async(e,t={})=>{var n;let i,a=((t=t||{}).path||r.p)+`models/${e}.js`;return t.token&&(a=a+"?"+t.token),U.vectorlyBasePath=t.path||r.p,"background_selfie"===e&&(i=(async()=>{let e;if(U.tflite)e=U.tflite;else{let t=U.vectorlyBasePath||"";try{if(!0!==c.feature.simd)throw Error("SIMD feature check is false");e=await h()({basePath:t})}catch(r){e=await d()({basePath:t})}}return e})()),U.isWorker?importScripts(a):await (n=a,new Promise((e,t)=>
1{let r,i="$importModule$"+Math.random().toString(32).slice(2),a=document.createElement("script"),o=()=>{delete window[i],a.onerror=null,a.onload=null,a.remove(),URL.revokeObjectURL(a.src),a.src=""};a.defer="defer",a.type="module",a.onerror=()=>{t(Error(`Failed to import: ${n}`)),o()},a.onload=()=>{e(window[i]),o()};let s=((r=document.createElement("a")).setAttribute("href",n),r.cloneNode(!1).href),u=new Blob([`import * as m from "${s}"; window.${i} = m;`],{type:"text/javascript"});a.src=URL.createObjectURL(u),document.head.appendChild(a)})),"background_selfie"===e&&(U.tflite=await i),U.vectorly.models[e]},z=async(e,t,n,i)=>{if(i=i||{},"background_selfie"===e){let a=(i.path||r.p)+`./data/${e}/${t}_v${n}.tflite`;i.token&&(a=a+"?"+i.token);let o=await fetch(a);if(!o.ok)throw Error(`Response fetching "${a}": ${o.statusText}`);return{model:await o.arrayBuffer()}}if("background_webgl2"===e||"background_webgl2_v2"===e||"background_webgl"===e||"background_webgl_unet"===e||"background_rbnet"===e||"relighting_zdce"===e){"background_webgl2_v2"===e&&(e="background_webgl2");let a=(i.path||r.p)+`./data/${e}/${t}_v${n}.json`,o=(i.path||r.p)+`./data/${e}/${t}_v${n}.weights`;i.token&&(a+="?"+i.token,o+="?"+i.token);let[s,u]=await Promise.all([fetch(a),fetch(o)]),[c,l]=await Promise.all([s.json(),u.arrayBuffer()]),h=JSON.parse(JSON.stringify(c)),f=new Float32Array(l),d=Object.keys(c),p=["weights","biases"];for(let e of(c[d[0]].debugImage&&p.push("debugImage"),d))for(let t of p){let[r,n]=c[e][t];h[e][t]=f.slice(n,n+r)}return h}{let a=(i.path||r.p)+`./data/${e}/${t}_v${n}.json`;i.token&&(a=a+"?"+i.token);let o=await fetch(a);return await o.json()}}},3259:function(e){e.exports=["cnn_demo","residual_3k_3x","residual_4k_2x","residual_5k_2x","residual_5k_3x","denoise_10k_1x","background_selfie","background_webgl_unet","background_webgl","background_webgl2","background_webgl2_v2","upscaler_4krgb_2x","background_rbnet","relighting_zdce"]},2497:function(e){var t;t=(t="u">typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",e.exports=function(e){var r,i,a=void 0!==(e=e||{})?e:{};a.ready=new Promise(function(e,t){r=e,i=t});var o,s={};for(o in a)a.hasOwnProperty(o)&&(s[o]=a[o]);var u,c,l,h=[],f="./this.program",d=function(e,t){throw t};u="object"==typeof window,c="function"==typeof importScripts,l="object"==typeof n&&"object"==typeof n.versions&&"string"==typeof n.versions.node;var p,m,g="";(u||c)&&(c?g=self.location.href:"u">typeof document&&document.currentScript&&(g=document.currentScript.src),t&&(g=t),g=0!==g.indexOf("blob:")?g.substr(0,g.lastIndexOf("/")+1):"",c&&(m=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var v,b=a.print||console.log.bind(console),w=a.printErr||console.warn.bind(console);for(o in s)s.hasOwnProperty(o)&&(a[o]=s[o]);s=null,a.arguments&&(h=a.arguments),a.thisProgram&&(f=a.thisProgram),a.quit&&(d=a.quit),a.wasmBinary&&(v=a.wasmBinary);var y,k=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&U("no native wasm support detected");var x,_,E,T,S=!1,R="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function A(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.subarray&&R)return R.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)a+=String.fromCharCode(o);else{var c=o-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function O(e){x=e,a.HEAP8=_=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=T=new Int32Array(e),a.HEAPU8=E=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=new Float64Array(e)}a.INITIAL_MEMORY;var P,C=[],I=[],F=[],B=[];I.push({func:function(){Q()}});var M=0,L=null,N=null;function U(e){a.onAbort&&a.onAbort(e),w(e+=""),S=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}function j(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}function z(e){return j(e,"data:application/octet-stream;base64,")}function D(e){return j(e,"file://")}a.preloadedImages={},a.preloadedAudios={};var W,H,V="./tflite/tflite-simd.wasm";function G(e){try{if(e==V&&v)return new Uint8Array(v);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}catch(e){U(e)}}function X(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?P.get(r)():P.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(a)}}function Z(e){return T[ee()>>2]=e,e}z(V)||(W=V,V=a.locateFile?a.locateFile(W,g):(g=a.basePath||g)+W),H=l?function(){var e=n.hrtime();return 1e3*e[0]+e[1]/1e6}:"u">typeof dateNow?dateNow:function(){return performance.now()};var q={};function $(){if(!$.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(var t in q)e[t]=q[t];var r=[];for(var t in e)r.push(t+"="+e[t]);$.strings=r}return $.strings}var Y,K={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var r=K.buffers[e];0===t||10===t?((1===e?b:w)(A(r,0)),r.length=0):r.push(t)},varargs:void 0,get:function(){return K.varargs+=4,T[K.varargs-4>>2]},getStr:function(e){return e?A(E,e,void 0):""},get64:function(e,t){return e}},J={a:function(){U()},n:function(e,t){var r;if(0===e)r=Date.now();else{if(1!==e&&4!==e)return Z(28),-1;r=H()}return T[t>>2]=r/1e3|0,T[t+4>>2]=r%1e3*1e6|0,0},i:function(e,t){U("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},e:function(e,t){U("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},l:function(e,t,r){E.copyWithin(e,t,t+r)},m:function(e){var t,r=E.length;if(e>0x80000000)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);if(i=Math.min(i,e+0x6000000),function(e){try{return y.grow(e-x.byteLength+65535>>>16),O(y.buffer),1}catch(e){}}(Math.min(0x80000000,((t=Math.max(e,i))%65536>
10&&(t+=65536-t%65536),t))))return!0}return!1},o:function(e){for(var t=H();H()-t<e;);},p:function(e,t){var r=0;return $().forEach(function(n,i){var a=t+r;T[e+4*i>>2]=a,function(e,t){for(var r=0;r<e.length;++r)_[0|t++]=e.charCodeAt(r);_[0|t]=0}(n,a),r+=n.length+1}),0},g:function(e,t){var r=$();T[e>>2]=r.length;var n=0;return r.forEach(function(e){n+=e.length+1}),T[t>>2]=n,0},j:function(e){k||(a.onExit&&a.onExit(e),S=!0),d(e,new et(e))},h:function(e){return 0},k:function(e,t,r,n,i){},c:function(e,t,r,n){for(var i=0,a=0;a<r;a++){for(var o=T[t+8*a>>2],s=T[t+(8*a+4)>>2],u=0;u<s;u++)K.printChar(e,E[o+u]);i+=s}return T[n>>2]=i,0},d:function(){return 6},f:function(){return 28},b:function(e){switch(e){case 30:case 75:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return -1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 0x7fffffff;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return Z(28),-1}},Q=(function(){var e={a:J};function t(e,t){a.asm=e.exports,O((y=a.asm.q).buffer),P=a.asm.D,function(){if(M--,a.monitorRunDependencies&&a.monitorRunDependencies(M),0==M&&(null!==L&&(clearInterval(L),L=null),N)){var e=N;N=null,e()}}()}function r(e){t(e.instance)}function n(t){return(function(){if(!v&&(u||c)){if("function"==typeof fetch&&!D(V))return fetch(V,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+V+"'";return e.arrayBuffer()}).catch(function(){return G(V)});if(p)return new Promise(function(e,t){p(V,function(t){e(new Uint8Array(t))},t)})}return Promise.resolve().then(function(){return G(V)})})().then(function(t){return WebAssembly.instantiate(t,e)}).then(t,function(e){w("failed to asynchronously prepare wasm: "+e),U(e)})}if(M++,a.monitorRunDependencies&&a.monitorRunDependencies(M),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}(v||"function"!=typeof WebAssembly.instantiateStreaming||z(V)||D(V)||"function"!=typeof fetch?n(r):fetch(V,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,e).then(r,function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),n(r)})})).catch(i)}(),a.___wasm_call_ctors=function(){return(Q=a.___wasm_call_ctors=a.asm.r).apply(null,arguments)}),ee=(a._getModelBufferMemoryOffset=function(){return(a._getModelBufferMemoryOffset=a.asm.s).apply(null,arguments)},a._getInputMemoryOffset=function(){return(a._getInputMemoryOffset=a.asm.t).apply(null,arguments)},a._getInputHeight=function(){return(a._getInputHeight=a.asm.u).apply(null,arguments)},a._getInputWidth=function(){return(a._getInputWidth=a.asm.v).apply(null,arguments)},a._getInputChannelCount=function(){return(a._getInputChannelCount=a.asm.w).apply(null,arguments)},a._getOutputMemoryOffset=function(){return(a._getOutputMemoryOffset=a.asm.x).apply(null,arguments)},a._getOutputHeight=function(){return(a._getOutputHeight=a.asm.y).apply(null,arguments)},a._getOutputWidth=function(){return(a._getOutputWidth=a.asm.z).apply(null,arguments)},a._getOutputChannelCount=function(){return(a._getOutputChannelCount=a.asm.A).apply(null,arguments)}
1,a._loadModel=function(){return(a._loadModel=a.asm.B).apply(null,arguments)},a._runInference=function(){return(a._runInference=a.asm.C).apply(null,arguments)},a.___errno_location=function(){return(ee=a.___errno_location=a.asm.E).apply(null,arguments)});function et(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function er(e){function t(){Y||(Y=!0,a.calledRun=!0,S||(X(I),X(F),r(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){var e;if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),B.unshift(e);X(B)}()))}e=e||h,M>0||(function(){var e;if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),C.unshift(e);X(C)}(),M>0||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),t()},1)):t()))}if(N=function e(){Y||er(),Y||(N=e)},a.run=er,a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return er(),e.ready}},8958:function(e){var t;t=(t="u">typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",e.exports=function(e){var r,i,a=void 0!==(e=e||{})?e:{};a.ready=new Promise(function(e,t){r=e,i=t});var o,s={};for(o in a)a.hasOwnProperty(o)&&(s[o]=a[o]);var u,c,l,h=[],f="./this.program",d=function(e,t){throw t};u="object"==typeof window,c="function"==typeof importScripts,l="object"==typeof n&&"object"==typeof n.versions&&"string"==typeof n.versions.node;var p,m,g="";(u||c)&&(c?g=self.location.href:"u">typeof document&&document.currentScript&&(g=document.currentScript.src),t&&(g=t),g=0!==g.indexOf("blob:")?g.substr(0,g.lastIndexOf("/")+1):"",c&&(m=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var v,b=a.print||console.log.bind(console),w=a.printErr||console.warn.bind(console);for(o in s)s.hasOwnProperty(o)&&(a[o]=s[o]);s=null,a.arguments&&(h=a.arguments),a.thisProgram&&(f=a.thisProgram),a.quit&&(d=a.quit),a.wasmBinary&&(v=a.wasmBinary);var y,k=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&U("no native wasm support detected");var x,_,E,T,S=!1,R="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function A(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.subarray&&R)return R.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)a+=String.fromCharCode(o);else{var c=o-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function O(e){x=e,a.HEAP8=_=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=T=new Int32Array(e),a.HEAPU8=E=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=new Float64Array(e)}a.INITIAL_MEMORY;var P,C=[],I=[],F=[],B=[];I.push({func:function(){Q()}});var M=0,L=null,N=null;function U(e){a.onAbort&&a.onAbort(e),w(e+=""),S=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}function j(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}function z(e){return j(e,"data:application/octet-stream;base64,")}function D(e){return j(e,"file://")}a.preloadedImages={},a.preloadedAudios={};var W,H,V="./tflite/tflite.wasm";function G(e){try{if(e==V&&v)return new Uint8Array(v);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}catch(e){U(e)}}function X(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?P.get(r)():P.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(a)}}function Z(e){return T[ee()>>2]=e,e}z(V)||(W=V,V=a.locateFile?a.locateFile(W,g):(g=a.basePath||g)+W),H=l?function(){var e=n.hrtime();return 1e3*e[0]+e[1]/1e6}:"u">typeof dateNow?dateNow:function(){return performance.now()};var q={};function $(){if(!$.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(var t in q)e[t]=q[t];var r=[];for(var t in e)r.push(t+"="+e[t]);$.strings=r}return $.strings}var Y,K={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var r=K.buffers[e];0===t||10===t?((1===e?b:w)(A(r,0)),r.length=0):r.push(t)},varargs:void 0,get:function(){return K.varargs+=4,T[K.varargs-4>>2]},getStr:function(e){return e?A(E,e,void 0):""},get64:function(e,t){return e}},J={a:function(){U()},n:function(e,t){var r;if(0===e)r=Date.now();else{if(1!==e&&4!==e)return Z(28),-1;r=H()}return T[t>>2]=r/1e3|0,T[t+4>>2]=r%1e3*1e6|0,0},i:function(e,t){U("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},e:function(e,t){U("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},l:function(e,t,r){E.copyWithin(e,t,t+r)},m:function(e){var t,r=E.length;if(e>0x80000000)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);if(i=Math.min(i,e+0x6000000),function(e){try{return y.grow(e-x.byteLength+65535>>>16),O(y.buffer),1}catch(e){}}(Math.min(0x80000000,((t=Math.max(e,i))%65536>
10&&(t+=65536-t%65536),t))))return!0}return!1},o:function(e){for(var t=H();H()-t<e;);},p:function(e,t){var r=0;return $().forEach(function(n,i){var a=t+r;T[e+4*i>>2]=a,function(e,t){for(var r=0;r<e.length;++r)_[0|t++]=e.charCodeAt(r);_[0|t]=0}(n,a),r+=n.length+1}),0},g:function(e,t){var r=$();T[e>>2]=r.length;var n=0;return r.forEach(function(e){n+=e.length+1}),T[t>>2]=n,0},j:function(e){k||(a.onExit&&a.onExit(e),S=!0),d(e,new et(e))},h:function(e){return 0},k:function(e,t,r,n,i){},c:function(e,t,r,n){for(var i=0,a=0;a<r;a++){for(var o=T[t+8*a>>2],s=T[t+(8*a+4)>>2],u=0;u<s;u++)K.printChar(e,E[o+u]);i+=s}return T[n>>2]=i,0},d:function(){return 6},f:function(){return 28},b:function(e){switch(e){case 30:case 75:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return -1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 0x7fffffff;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return Z(28),-1}},Q=(function(){var e={a:J};function t(e,t){a.asm=e.exports,O((y=a.asm.q).buffer),P=a.asm.D,function(){if(M--,a.monitorRunDependencies&&a.monitorRunDependencies(M),0==M&&(null!==L&&(clearInterval(L),L=null),N)){var e=N;N=null,e()}}()}function r(e){t(e.instance)}function n(t){return(function(){if(!v&&(u||c)){if("function"==typeof fetch&&!D(V))return fetch(V,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+V+"'";return e.arrayBuffer()}).catch(function(){return G(V)});if(p)return new Promise(function(e,t){p(V,function(t){e(new Uint8Array(t))},t)})}return Promise.resolve().then(function(){return G(V)})})().then(function(t){return WebAssembly.instantiate(t,e)}).then(t,function(e){w("failed to asynchronously prepare wasm: "+e),U(e)})}if(M++,a.monitorRunDependencies&&a.monitorRunDependencies(M),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}(v||"function"!=typeof WebAssembly.instantiateStreaming||z(V)||D(V)||"function"!=typeof fetch?n(r):fetch(V,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,e).then(r,function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),n(r)})})).catch(i)}(),a.___wasm_call_ctors=function(){return(Q=a.___wasm_call_ctors=a.asm.r).apply(null,arguments)}),ee=(a._getModelBufferMemoryOffset=function(){return(a._getModelBufferMemoryOffset=a.asm.s).apply(null,arguments)},a._getInputMemoryOffset=function(){return(a._getInputMemoryOffset=a.asm.t).apply(null,arguments)},a._getInputHeight=function(){return(a._getInputHeight=a.asm.u).apply(null,arguments)},a._getInputWidth=function(){return(a._getInputWidth=a.asm.v).apply(null,arguments)},a._getInputChannelCount=function(){return(a._getInputChannelCount=a.asm.w).apply(null,arguments)},a._getOutputMemoryOffset=function(){return(a._getOutputMemoryOffset=a.asm.x).apply(null,arguments)},a._getOutputHeight=function(){return(a._getOutputHeight=a.asm.y).apply(null,arguments)},a._getOutputWidth=function(){return(a._getOutputWidth=a.asm.z).apply(null,arguments)},a._getOutputChannelCount=function(){return(a._getOutputChannelCount=a.asm.A).apply(null,arguments)}
1,a._loadModel=function(){return(a._loadModel=a.asm.B).apply(null,arguments)},a._runInference=function(){return(a._runInference=a.asm.C).apply(null,arguments)},a.___errno_location=function(){return(ee=a.___errno_location=a.asm.E).apply(null,arguments)});function et(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function er(e){function t(){Y||(Y=!0,a.calledRun=!0,S||(X(I),X(F),r(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){var e;if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),B.unshift(e);X(B)}()))}e=e||h,M>0||(function(){var e;if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),C.unshift(e);X(C)}(),M>0||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),t()},1)):t()))}if(N=function e(){Y||er(),Y||(N=e)},a.run=er,a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return er(),e.ready}},8129:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r.d(t,{default:function(){return R}});var i,a=r(5861),o=r(5671),s=r(3144),u=r(4942),c=r(4687),l=r.n(c),h=r(2045),f=r(4147),d=r(7055),p=r(7337),m=r(7618),g=r(8190),v=r.n(g),b=r(2238),w=r.n(b),y=r(3109),k=function(){function e(t){(0,o.Z)(this,e),this.names=t.names||[],this.prefix=t.prefix||"evb",this.initEvents(),this.listeners={}}return(0,s.Z)(e,[{key:"initEvents",value:function(){var e=this,t={};this.names.forEach(function(r){t[r]=new Event(e.prefix+"-"+r)}),this.events=t}},{key:"getNames",value:function(){return this.names}},{key:"getEventName",value:function(e){return this.prefix+"-"+e}},{key:"on",value:function(e,t){if(!(this.names.indexOf(e)>-1))throw Error("In on: Event of type: ".concat(e," not registered"));document.addEventListener(this.getEventName(e),t),this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t)}},{key:"dispatch",value:function(e,t){if(!(this.names.indexOf(e)>-1))throw Error("In dispatch: Event of type: ".concat(e," not registered"));var r=new CustomEvent(this.getEventName(e),{detail:t});document.dispatchEvent(r)}}]),e}(),x=r(7783),_=r.n(x);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var T=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach(function(t){(0,u.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},m.feature);(0,d.ok)()&&console.log(T),(0,d.ok)()&&console.log("SIMD",m.feature.simd);var S=function(){var e,t,r,i,u,c,m,g,b,w,y,x,E,T,S,R,A,O,P,C;function I(e,t){(0,o.Z)(this,I),this.times={ref:performance.now()},this.times.init=performance.now()-this.times.ref,this.type="background",this.params=t||{},this.debug=this.params.debug||(0,d.ok)(),!1===this.params.analyticsEnabled||!1===I.analyticsEnabled?this.analyticsEnabled=!1:this.analyticsEnabled=!0,this.analyticsUpdateInterval=t.analyticsUpdateInterval||3e5,this.tracker=I.getTracker(this.debug,this.analyticsEnabled),this.eventHandler=new k({names:["error","load","stop","start","lowperf"],tracker:this.tracker}),this.initEvents(),this.params.token=this.params.token||I.defaultToken,this.model=t.model||"webgl_v2",this.model_version=t.version,this.enableOffscreen=this.checkSupport(t.offscreen),this.id=t.id||(0,h.Z)(),this.version=f.i8,this.serverType=this.params.serverType||"",this.frameRate=t.frameRate||30,this.segmentationFrameRate=t.segmentationFrameRate||15,this.use_webgl1=t.use_webgl1||!1,this.passthrough=t.passthrough||!1,this.periodicAudio=t.periodicAudio,this.antiFlicker=t.antiFlicker,this.fallbackEnabled=!1!==this.params.fallbackEnabled;var r=navigator&&navigator.userAgent||"";this.trackEvent({eventName:"vbConstructor_Start",properties:{input:this.input,params:this.params,model:this.model,model_version:this.model_version,enableOffscreen:this.enableOffscreen,debug:this.debug,id:this.id,version:this.version,serverType:this.serverType,frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate,passthrough:this.passthrough,background:this.background,blurRadius:this.blurRadius,userAgent:I.parseUserAgent(r),supportedInBrowserList:_().test(r)}}),"production"!==this.serverType&&""!==this.serverType||(0,p.EK)(e,t),this.defaultBackgroun
1d="https://files.vectorly.io/demo/background-filter/images/virtual-background-1.jpg",this.defaultBlurRadius=5,this.defaultObjectFitStrategy="fill",this.background=this.params.background||this.defaultBackground,this.objectFitStrategy=this.params.objectFit||this.defaultObjectFitStrategy,this.blurRadius=this.params.blurRadius||this.defaultBlurRadius,this.error=null,this.loadP=this.loadCore();try{this.input=this._getInput(e),this.inputClone=this.input?this.input.clone():null,this.registerInputListeners(),this.log("Input to BackgroundFilter is",this.input),this.video=this.video||this._initVideo(),this.video.id="vid-"+this.id,this.processorP=this._initializeCoreNetwork(),this.outputP=this._createNewStream(),this.trackEvent({eventName:"vbConstructor_End",properties:{input:this.input,inputSettings:this.input instanceof MediaStreamTrack?this.input.getSettings():this.input.getVideoTracks()[0].getSettings(),inputConstraints:this.input instanceof MediaStreamTrack?this.input.getConstraints():this.input.getVideoTracks()[0].getConstraints(),inputCapabilities:"function"==typeof MediaStreamTrack.prototype.getCapabilities?this.input instanceof MediaStreamTrack?this.input.getCapabilities():this.input.getVideoTracks()[0].getCapabilities():null,params:this.params,model:this.model,model_version:this.model_version,enableOffscreen:this.enableOffscreen,debug:this.debug,id:this.id,version:this.version,serverType:this.serverType,frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate,passthrough:this.passthrough,background:this.background,blurRadius:this.blurRadius,error:this.error,times:this.times}}),this.log({init_core_start:this.times.init_core_start},{init_core_end:this.times.init_core_end})}catch(e){throw this.error=e,this.trackEvent({eventName:"vbConstructor_Error",properties:{params:this.params,error:this.error}},"error"),e}}return(0,s.Z)(I,[{key:"trackEvent",value:function(e,t){var r=e.eventName,n=e.properties;this.analyticsEnabled&&(((n=n||{}).level||t)&&(n.level=n.level||t),n.id=n.id||this.id,this.tracker.trackEvent({eventName:r,properties:n}))}},{key:"loadCore",value:(C=(0,a.Z)(l().mark(function e(){return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.times.load_core_start=performance.now()-this.times.ref,e.next=3,(0,p.Zq)();case 3:return this.vectorlyCore=e.sent,e.abrupt("return",!0);case 5:case"end":return e.stop()}},e,this)})),function(){return C.apply(this,arguments)})},{key:"checkSupport",value:function(e){try{this.trackEvent({eventName:"vbCheckSupport_Start",properties:{enableOffscreen:e}});var t=!!HTMLCanvasElement.prototype.transferControlToOffscreen;return null==e?(this.trackEvent({eventName:"vbCheckSupport_End",properties:{enableOffscreen:e,canSupportOffscreen:t,returnVal:t}}),t):!0===e||"true"===e?(t||console.warn("transferControlToOffscreen is not supported but params.offscreen is set to ".concat(e,"; Set params.offscreen to null to default to offscreen if supported")),this.trackEvent({eventName:"vbCheckSupport_End",properties:{enableOffscreen:e,canSupportOffscreen:t,returnVal:!0}}),!0):(this.log("params.offscreen is ".concat(e,"; running on main thread")),this.trackEvent({eventName:"vbCheckSupport_End",properties:{enableOffscreen:e,canSupportOffscreen:t,returnVal:!1}}),!1)}catch(e){throw this.error=e,this.trackEvent({eventName:"vbCheckSupport_Error",properties:{error:this.error}},"error"),e}}},{key:"registerInputListeners",value:function(){var e,t=this,r=this.input,n=this.originalInput;if(r instanceof MediaStream){n instanceof MediaStream?e=n.getVideoTracks():n instanceof MediaStreamTrack&&(e=[n]);var i=[];this.log("Input tracks in registerInputListeners",e,n);for(var a=0;a<e.length;a++){var o=e[a];this.log(a,"tracks",o.id),i.push(o.id),o.addEventListener("ended",function(){t.log("In listener",t.stop),t.stop()})}var s=this;MediaStreamTrack.prototype._stop=MediaStreamTrack.prototype._stop||MediaStreamTrack.prototype.stop,MediaStreamTrack.prototype._iter=(MediaStreamTrack.prototype._iter||-1)+1;var u=MediaStreamTrack.prototype._stop,c=MediaStreamTrack.prototype._inputFilterMap||{};
1i.forEach(function(e){c[e]=c[e]||[],c[e].push(s)}),MediaStreamTrack.prototype._inputFilterMap=c,0===MediaStreamTrack.prototype._iter&&(MediaStreamTrack.prototype.stop=function(){var e=arguments;s.log("in proto",e,this,s,i),u.call(this);var t=MediaStreamTrack.prototype._inputFilterMap[this.id];t&&t.forEach(function(e){e.stop()})})}}},{key:"_getInput",value:function(e){if(this.log("_getInput",e),e instanceof MediaStream){this.originalInput=e;var t,r=this.originalInput.getVideoTracks()[0];this.frameRate=(this.params.frameRate?Math.min(this.params.frameRate,r.getSettings().frameRate):r.getSettings().frameRate)||30,this.segmentationFrameRate=Math.min(this.frameRate,this.params.segmentationFrameRate||15);var i=Math.ceil(this.frameRate/this.segmentationFrameRate);return this.segmentationFrameRate=this.frameRate/i,this.log("_getInput ======= Original input fps is",r.getSettings().frameRate,r.getSettings()),e.clone()}if(e instanceof MediaStreamTrack){if("video"===e.kind){this.originalInput=e;var a=this.originalInput;this.frameRate=(this.params.frameRate?Math.min(this.params.frameRate,a.getSettings().frameRate):a.getSettings().frameRate)||30,this.segmentationFrameRate=Math.min(this.frameRate,this.params.segmentationFrameRate||15);var o=Math.ceil(this.frameRate/this.segmentationFrameRate);return this.segmentationFrameRate=this.frameRate/o,this.log("_getInput ======= Original input fps is",a.getSettings().frameRate,a.getSettings()),new MediaStream([e.clone()])}var s="Input to BackgroundFilter is: ".concat(e,"; Expected input.kind to be video but it is ").concat(e.kind);throw console.error(s),this.trackEvent({eventName:"vbGetInput_Error",properties:{input:e,error:s}},"error"),Error(s)}if(e instanceof HTMLMediaElement)return e.captureStream?e.captureStream():e.mozCaptureStream?e.mozCaptureStream():(this.video=e,null);try{t=e.constructor.name}catch(r){t=n(e)}var u="In _getInput; input is of invalid type: type ".concat(t," - ").concat(e);throw console.error(u),this.trackEvent({eventName:"vbGetInput_Error",properties:{input:e,type:n(e),error:u}},"error"),Error(u)}},{key:"setFirstRenderTime",value:function(e){this.times.tffr=e-this.times.ref,this.log("TFFR",this.times.tffr,this.times);var t={times:this.times,loadTime:this.times.load_core_done-this.times.load_core_start,initTime:this.times.init_core_end-this.times.init_core_start,tffr:this.times.tffr},r=function(e){return parseFloat(e/1e3).toFixed(2)};this.trackEvent("vb_setFirstRenderTime_End",t),this.debug&&this.eventHandler.dispatch("load","TFFR is ".concat(r(this.times.tffr),"s; loadTime is ").concat(r(t.loadTime),"s; initTime is ").concat(r(t.initTime),"s"))}},{key:"_initializeCoreNetwork",value:(P=(0,a.Z)(l().mark(function e(t){var r,n,i,a,o,s,u,c;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=this.getFunctionTracker("InitializeCoreNetwork",t))("Start",{model:this.model}),e.prev=2,this.times.init_core_start=performance.now()-this.times.ref,e.next=6,(0,d.uF)(this.video);case 6:return n=e.sent,e.next=9,this.loadP;case 9:return this.times.load_core_done=performance.now()-this.times.ref,e.next=12,(0,p.$A)(this.model);case 12:if((i=e.sent)||!this.fallbackEnabled){e.next=25;break}return e.next=16,(0,p.go)();case 16:if(!(a=e.sent)){e.next=23;break}this.log("Originally requested model ".concat(this.model,", model not supported, falling back to ").concat(a)),r("Log",{originalModel:this.model,fallback:a,supportFlag:i}),this.model=a,e.next=25;break;case 23:throw r("Error",{model:this.model,isModelSupported:i,isSupported:I.isSupported()},"error"),Error("model ".concat(this.model," is not supported"));case 25:return e.next=27,this._getBackground(this.background);case 27:return o=e.sent,s={stream:this.input,token:this.params.token,offscreen:this.enableOffscreen,id:this.id,networkParams:(0,p.PD)(this.model),networkOptions:{passthrough:this.passthrough||!1,skipFactor:Math.ceil(this.frameRate/this.segmentationFrameRate),background:o,antiFlicker:!!this.antiFlicker&&this.antiFlicker},renderSize:{w:n.width,h:n.height},debug:this.debug,framerate:this.frameRate,periodicAudio:this.periodicAudio,use_webgl1:this.use_webgl1,debugRender:!1,container:"disable",serverType:this.serverType,analyticsEnabled:!this.analyticsEnabled||this.analyticsEnabled,eventHandler:this.eventHandler,updateInterval:this.analyticsUpdateInterval,setFirstRenderTime:this.setFirstRenderTime.bind(this),tracker:this.tracker},u=new this.vectorlyCore(this.video,s),this.log(u,u.initialized),e.next=33,u.initialized;case 33:if(c=e.sent,this.log("In _initializeCoreNetwork",c,u),this.times.init_core_end=performance.now()-this.times.ref,!1!==c){e.next=40;break}throw this.log("Initialized is",this.initialized,u.error),r("Error",{coreParams:s,processorInitialized:c,processorError:u.error}),Error(u.error);case 40:return r("End",{coreParams:s,processorInitialized:c,processorError:u.error,times:this.times,loadTime:this.times.load_core_done-this.times.load_core_start,initTime:this.times.init_core_end-this.times.init_core_start}),this.log({loadTime:this.times.load_core_done-this.times.load_core_start},{initTime:this.times.init_core_end-this.times.init_core_start},{init_core_start:this.times.init_core_start},{init_core_end:this.times.init_core_end},{load_core_start:this.times.load_core_start},{load_core_done:this.times.load_core_done}),u.canvas.style.visibility="hidden",e.abrupt("return",{canvas:u.renderCanvas||u.canvas,processor:u});case 46:throw e.prev=46,e.t0=e.catch(2),r("Error",{error:e.t0},"error"),console.error("Error in calling _initializeCoreNetwork",e.t0),e.t0;case 51:case"end":return e.stop()}},e,this,[[2,46]])})),function(e){return P.apply(this,arguments)})}
1,{key:"_getBackground",value:(O=(0,a.Z)(l().mark(function e(t){var r,n,i,a,o,s,u,c;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("blur"!==t){e.next=4;break}return e.abrupt("return",{type:"blur",radius:this.blurRadius});case 4:if("binary"!==t&&"transparent"!==t){e.next=8;break}return e.abrupt("return",{type:t});case 8:if(t&&"string"!=typeof t){e.next=32;break}return t?(n=t,v()(n)&&(n=document.URL.substr(0,document.URL.lastIndexOf("/"))+"/"+n)):(n=this.defaultBackground,console.warn("in background is not given; Setting to defaultBackground",this.defaultBackground)),e.next=12,(0,p.po)(n);case 12:if(i=e.sent,!("contain"===this.objectFitStrategy&&i.width<i.height)){e.next=20;break}return a=(0,p.F2)(i),e.next=17,createImageBitmap(a);case 17:case 24:r=e.sent,e.next=30;break;case 20:if(!("cover"===this.objectFitStrategy&&i.width<i.height)){e.next=27;break}return o=(0,p.Xu)(i),e.next=24,createImageBitmap(o);case 27:return e.next=29,createImageBitmap(i);case 29:r=e.sent;case 30:e.next=67;break;case 32:if(!(t instanceof HTMLImageElement)){e.next=56;break}return e.next=35,(0,p.po)(t);case 35:if(s=e.sent,!("contain"===this.objectFitStrategy&&s.width<s.height)){e.next=43;break}return u=(0,p.F2)(s),e.next=40,createImageBitmap(u);case 40:case 47:r=e.sent,e.next=53;break;case 43:if(!("cover"===this.objectFitStrategy&&s.width<s.height)){e.next=50;break}return c=(0,p.Xu)(s),e.next=47,createImageBitmap(c);case 50:return e.next=52,createImageBitmap(s);case 52:r=e.sent;case 53:case 67:return e.abrupt("return",{type:"virtual",image:r});case 56:if(!(t instanceof HTMLVideoElement)){e.next=63;break}return e.next=59,createImageBitmap(t);case 59:return r=e.sent,e.abrupt("return",{type:"video",image:r,video:t});case 63:return e.next=65,createImageBitmap(t);case 65:return r=e.sent,e.abrupt("return",{type:"virtual",image:r});case 68:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"_getBlurRadius",value:function(e){return(!e||e<1)&&(console.warn("in blurRadius:",e,"should be greater than equal to 1; Setting to defaultBlurRadius",this.defaultBlurRadius),e=this.defaultBlurRadius),{type:"blur",radius:e}}},{key:"changeBackground",value:(A=(0,a.Z)(l().mark(function e(t){var r,n;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log("Change background to",t,"from",this.background),this.trackEvent({eventName:"vbChangeBackground_Start",properties:{background:this.background,newBackground:t}}),e.prev=2,e.next=5,this.processorP;case 5:return r=e.sent.processor,e.next=9,this._getBackground(t);case 9:return n=e.sent,e.next=12,r.updateNetworkOptions({background:n});case 12:this.background=t,this.trackEvent({eventName:"vbChangeBackground_End",properties:{background:this.background}}),e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(2),this.trackEvent({eventName:"vbChangeBackground_Error",properties:{background:this.background,error:e.t0}},"error"),e.t0;case 20:case"end":return e.stop()}},e,this,[[2,16]])})),function(e){return A.apply(this,arguments)})},{key:"changeObjectFitStrategy",value:(R=(0,a.Z)(l().mark(function e(t){return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log("Change object fit Strategy to ",t,"from",this.objectFitStrategy),this.objectFitStrategy=t||"fill",e.next=4,this.changeBackground(this.background);case 4:case"end":return e.stop()}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"requestFrameRate",value:(S=(0,a.Z)(l().mark(function e(t){var r,n,i,a,o;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.frameRate,n=t.segmentationFrameRate,this.trackEvent({eventName:"vbRequestFrameRate_Start",properties:{frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate,newFrameRate:r,newSegmentationFrameRate:n}}),e.prev=2,e.next=5,this.processorP;case 5:return i=e.sent.processor,this.frameRate=r||this.frameRate||30,this.segmentationFrameRate=Math.min(this.frameRate,n||this.segmentationFrameRate||15),a=Math.ceil(this.frameRate/this.segmentationFrameRate),this.segmentationFrameRate=this.frameRate/a,e.next=13,i.updateNetworkOptions({framerate:this.frameRate,skipFactor:a});case 13:if(!i.glHandle||i.glHandle.framerate===this.frameRate){e.next=20;break}return this.log(i.glHandle.framerate,this.frameRate),this.frameRate=i.glHandle.framerate,o=Math.ceil(this.frameRate/this.segmentationFrameRate),this.segmentationFrameRate=this.frameRate/o,e.next=20,i.updateNetworkOptions({framerate:this.frameRate,skipFactor:o});case 20:return this.trackEvent({eventName:"vbRequestFrameRate_End",properties:{frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate}}),e.abrupt("return",{frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate});case 24:throw e.prev=24,e.t0=e.catch(2),console.error(e.t0),this.trackEvent({eventName:"vbRequestFrameRate_Error",properties:{frameRate:this.frameRate,segmentationFrameRate:this.segmentationFrameRate,error:e.t0}},"error"),e.t0;case 29:case"end":return e.stop()}},e,this,[[2,24]])})),function(e){return S.apply(this,arguments)})},{key:"changeBlurRadius",value:(T=(0,a.Z)(l().mark(function e(t){var r;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.trackEvent({eventName:"vbChangeBlurRadius_Start",properties:{blurRadius:this.blurRadius,newBlurRadius:t}}),e.next=4,this.processorP;case 4:return r=e.sent.processor,this.log("Change blur radius to",t,"from",this.blurRadius),e.next=9,r.updateNetworkOptions({background:this._getBlurRadius(t)});case 9:this.blurRadius=t,this.trackEvent({eventName:"vbChangeBlurRadius_End",properties:{blurRadius:this.blurRadius}}),e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(0),console.error(e.t0),this.trackEvent({eventName:"vbChangeBlurRadius_Error",properties:{blurRadius:this.blurRadius,error:e.t0}},"error"),e.t0;case 18:case"end":return e.stop()}},e,this,[[0,13]])})),function(e){return T.apply(this,arguments)})},{key:"_createNewStream",value:(E=(0,a.Z)(l().mark(function e(){var t,r,n;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.processorP;case 3:return r=(t=e.sent).canvas,n=t.processor,this.canvas=r,this.processor=n,this.processOutput=r.captureStream(),this.output=this.processOutput,e.abrupt("return",this.output);case 13:throw e.prev=13,e.t0=e.catch(0),console.error("ERROR in createNewStream",e.t0),this.trackEvent({eventName:"vbCreateNewStream_Error",properties:{error:e.t0}},"error"),e.t0;case 18:case"end":return e.stop()}},e,this,[[0,13]])})),function(){return E.apply(this,arguments)})},{key:"_getOrCreateOutput",value:(x=(0,a.Z)(l().mark(function e(){var t;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.outputP;case 2:if("ended"!==(t=e.sent).getVideoTracks()[0].readyState){e.next=9;break}return this.outputP=this._createNewStream(),e.next=8,this.outputP;case 8:t=e.sent;case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}},e,this)})),function(){return x.apply(this,arguments)})},{key:"getOutput",value:(y=(0,a.Z)(l().mark(function e(){var t;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.trackEvent({eventName:"vbGetOutput_Start"}),e.next=4,this._getOrCreateOutput();case 4:return t=e.sent,this.trackEvent({eventName:"vbGetOutput_End"}),e.abrupt("return",t);case 9:throw e.prev=9,e.t0=e.catch(0),console.error(this.error),this.trackEvent({eventName:"vbGetOutput_Error",properties:{error:e.t0}},"error"),e.t0;case 14:case"end":return e.stop()}},e,this,[[0,9]])})),function(){return y.apply(this,arguments)})},{key:"getOutputTrack",value:(w=(0,a.Z)(l().mark(function e(){var t;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.trackEvent({eventName:"vbGetOutputTrack_Start"}),e.next=4,this._getOrCreateOutput();case 4:return t=e.sent,this.trackEvent({eventName:"vbGetOutputTrack_End"}),e.abrupt("return",t.getVideoTracks()[0]);case 9:throw e.prev=9,e.t0=e.catch(0),console.error(this.error),this.trackEvent({eventName:"vbGetOutputTrack_Error",properties:{error:e.t0}},"error"),e.t0;case 14:case"end":return e.stop()}},e,this,[[0,9]])})),function(){return w.apply(this,arguments)})},{key:"disable",value:(b=(0,a.Z)(l().mark(function e(){return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.trackEvent({eventName:"vbDisable_Start"}),e.next=4,this.processorP;case 4:if(!this.passthrough||!this.input.active){e.next=9;break}return e.next=7,this.processor.updateNetworkOptions({passthrough:!0});case 7:e.next=11;break;case 9:this.processor.disable(),this.output=this.inputClone;case 11:return this.video.style.visibility="hidden",this.trackEvent({eventName:"vbDisable_End"}),e.abrupt("return",this.output);case 16:throw e.prev=16,e.t0=e.catch(0),this.trackEvent({eventName:"vbDisable_Error",properties:{error:e.t0}},"error"),console.error("Error in calling disable",e.t0),e.t0;case 21:case"end":return e.stop()}},e,this,[[0,16]])})),function(){return b.apply(this,arguments)})},{key:"enable",value:(g=(0,a.Z)(l().mark(function e(){return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.trackEvent({eventName:"vbEnable_Start"}),e.next=4,this.processorP;case 4:if(!this.passthrough||!this.input.active){e.next=9;break}return e.next=7,this.processor.updateNetworkOptions({passthrough:!1});case 7:e.next=10;break;case 9:this.processor.enable();case 10:return this.output=this.processOutput,this.canvas.style.visibility="hidden",this.trackEvent({eventName:"vbEnable_End"}),e.abrupt("return",this.output);case 16:throw e.prev=16,e.t0=e.catch(0),this.trackEvent({eventName:"vbEnable_Error",properties:{error:e.t0}},"error"),console.error("Error in calling enable",e.t0),e.t0;case 21:case"end":return e.stop()}},e,this,[[0,16]])})),function(){return g.apply(this,arguments)})},{key:"_initVideo",value:function(){var e=document.createElement("video");return e.style.visibility="hidden",e.style.display="none",e.id="vid-"+this.id,e.setAttribute("playsinline",null),e.setAttribute("autoplay",null),e.srcObject=this.input,document.body.appendChild(e),(0,d.yA)(e)||e.play(),e}},{key:"_getVideoTrack",value:function(e){return e instanceof MediaStream?e.getVideoTracks()[0]:e instanceof MediaStreamTrack?"video"===e.kind?e:void console.warn("Error in _getVideoTrack; input.kind expected to be video but is",e.kind):void 0}},{key:"_isSameTrack",value:function(e,t){var r=this._getVideoTrack(e),n=this._getVideoTrack(t);return r&&n&&r.id===n.id}},{key:"getFunctionTracker",value:function(e,t){var r=this;return t=t||(0,h.Z)(),function(n,i,a){i.func={name:e,type:n,instance:t},r.trackEvent({eventName:"vb".concat(e,"_").concat(n),properties:i},a)}}},{key:"changeInput",value:(m=(0,a.Z)(l().mark(function e(t){var r,n,i,a,o=arguments;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>1&&void 0!==o[1]&&o[1],n=o.length>2&&void 0!==o[2]?o[2]:null,i=this.getFunctionTracker("ChangeInput",n),e.prev=3,i("Start",{newInput:t,input:this.input,originalInput:this.originalInput,stopPreviousStream:r}),!this._isSameTrack(t,this.originalInput)){e.next=9;break}return console.warn("changeInput called with same input as the one current filter is using; returning without changing"),i("End",{input:t,originalInput:this.originalInput,sameInput:!0}
1,"warn"),e.abrupt("return");case 9:return r&&this.stop(),this.input=this._getInput(t),e.next=13,this.processorP;case 13:return this.input&&(this.inputClone=this.input?this.input.clone():null,this.video.srcObject=this.input,this.processor.updateStream&&this.processor.updateStream(this.input)),this.registerInputListeners(),e.next=17,(0,d.uF)(this.video);case 17:a=e.sent,this.processor.setRenderSize({w:a.width,h:a.height}),i("End",{input:this.input,inputSettings:this.input instanceof MediaStreamTrack?this.input.getSettings():this.input.getVideoTracks()[0].getSettings(),inputConstraints:this.input instanceof MediaStreamTrack?this.input.getConstraints():this.input.getVideoTracks()[0].getConstraints(),inputCapabilities:"function"==typeof MediaStreamTrack.prototype.getCapabilities?this.input instanceof MediaStreamTrack?this.input.getCapabilities():this.input.getVideoTracks()[0].getCapabilities():null}),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(3),i("Error",{error:e.t0,input:t,stopPreviousStream:r},"error"),console.error("Error in calling changeInput",e.t0),e.t0;case 27:case"end":return e.stop()}},e,this,[[3,22]])})),function(e){return m.apply(this,arguments)})},{key:"stop",value:function(e){var t=this.getFunctionTracker("Stop",e);try{t("Start",{input:this.input,originalInput:this.originalInput,inputClone:this.inputClone});var r=this.input.getVideoTracks();this.log("Stopping input tracks",this.input,r);for(var n=0;n<r.length;++n)r[n]._stop();if(this.originalInput){if(this.log("Original Input",this.originalInput),this.originalInput instanceof MediaStreamTrack)this.originalInput._stop();else if(this.originalInput instanceof MediaStream){r=this.originalInput.getTracks(),this.log("Stopping originalInput",this.originalInput,r);for(var i=0;i<r.length;++i)r[i]._stop()}}r=this.inputClone.getVideoTracks(),this.log("Stopping",this.inputClone,r,this.inputClone.getTracks());for(var a=0;a<r.length;++a)r[a]._stop();t("End",{input:this.input,originalInput:this.originalInput,inputClone:this.inputClone})}catch(e){throw t("Error",{input:this.input,originalInput:this.originalInput,inputClone:this.inputClone},"error"),console.error("Error in calling stop",e),e}}},{key:"destroy",value:(c=(0,a.Z)(l().mark(function e(){var t,r,n;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.trackEvent({eventName:"vbDestroy_Start"}),e.prev=1,e.next=4,this.processorP;
1case 4:(t=e.sent.processor).glHandle&&t.glHandle.destroy(),(r=document.getElementById("canv-"+t.id))&&r.remove(),(n=document.getElementById("vid-"+this.id))&&n.remove(),this.destroyPreviewContext(),this.trackEvent({eventName:"vbDestroy_End"}),e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(1),this.trackEvent({eventName:"vbDestroy_Error",properties:{error:e.t0}},"error"),console.error("Error in destroy",e.t0),e.t0;case 20:case"end":return e.stop()}},e,this,[[1,15]])})),function(){return c.apply(this,arguments)})},{key:"getPreviewOutput",value:(u=(0,a.Z)(l().mark(function e(){var t,r;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.trackEvent({eventName:"vbPreview_Start"}),e.prev=1,document.getElementById("preview-".concat(this.id))instanceof HTMLCanvasElement){e.next=13;break}return e.next=5,(0,d.uF)(this.video);case 5:t=e.sent,this.previewCanvas=document.createElement("canvas"),this.previewCanvas.id="preview-".concat(this.id),this.previewCanvas.width=t.width,this.previewCanvas.height=t.height,this.previewCanvas.style.visibility="hidden",this.previewCanvas.style.display="none",document.body.appendChild(this.previewCanvas);case 13:return this.previewContext||(this.previewContext=this.previewCanvas.getContext("bitmaprenderer")),this.previewStream||(this.previewStream=this.previewCanvas.captureStream()),e.next=17,this.processorP;case 17:return(r=e.sent.processor)&&r.updateNetworkOptions({preview:{previewType:"none"},previewContext:this.previewContext,previewCamView:this.passthrough}),this.trackEvent({eventName:"vbPreview_End"}),e.abrupt("return",this.previewStream);case 24:throw e.prev=24,e.t0=e.catch(1),this.trackEvent({eventName:"vbPreview_Start_Error",properties:{error:e.t0}},"error"),console.error("Error in vbPreview_Start",e.t0),e.t0;case 29:case"end":return e.stop()}},e,this,[[1,24]])})),function(){return u.apply(this,arguments)})},{key:"previewBackground",value:(i=(0,a.Z)(l().mark(function e(){var t,r,n,i,a=arguments;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{background:"blur",blurRadius:5,previewCamView:!1},this.trackEvent({eventName:"vbPreviewBackground_Start"}),e.prev=2,e.next=5,this.processorP;case 5:if(n=e.sent.processor,!(this.previewCanvas instanceof HTMLCanvasElement)){e.next=20;break}if(!t.background||t.previewCamView){e.next=17;break}return e.next=11,this._getBackground(t.background);case 11:i=e.sent,t.blurRadius=t.blurRadius||5,r={previewType:i.type,previewImage:i.image,previewRadius:t.blurRadius,previewVideo:i.video},n&&n.updateNetworkOptions({preview:r,previewContext:this.previewContext,previewCamView:!1}),e.next=18;break;case 17:n&&(r={previewType:"none",previewImage:null,previewRadius:null,previewVideo:null},n.updateNetworkOptions({preview:r,previewContext:this.previewContext,previewCamView:!0}));case 18:e.next=21;break;case 20:console.warn("No preview rendering context found.");case 21:this.trackEvent({eventName:"vbPreviewBackground_End"}),e.next=29;break;case 24:throw e.prev=24,e.t0=e.catch(2),this.trackEvent({eventName:"vbPreviewBackground_Start_Error",properties:{error:e.t0}},"error"),console.error("Error in vbPreviewBackground_Start",e.t0),e.t0;case 29:case"end":return e.stop()}},e,this,[[2,24]])})),function(){return i.apply(this,arguments)})},{key:"__loseContext",value:(r=(0,a.Z)(l().mark(function e(){var t;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processorP;case 2:return t=e.sent.processor,e.next=6,t.__loseContext();case 6:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"applyPreview",value:(t=(0,a.Z)(l().mark(function e(){var t,r,n,i,a=arguments;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{background:"blur",blurRadius:5,previewCamView:!1,destroyPreviewRenderContext:!1},this.trackEvent({eventName:"vbApplyPreview_Start"}),e.prev=2,r=this.getOutput(),!(this.previewCanvas instanceof HTMLCanvasElement)){e.next=24;break}return e.next=7,this.processorP;case 7:if(n=e.sent.processor,!t.background||t.previewCamView){e.next=20;break}
1return e.next=12,this.changeBackground(t.background);case 12:if(!(t.blurRadius>1&&"blur"===t.background)){e.next=15;break}return e.next=15,this.changeBlurRadius(t.blurRadius);case 15:i={previewType:"none"},n.updateNetworkOptions({passthrough:!1,preview:i,previewCamView:!1}),r=this.getOutput(),e.next=21;break;case 20:!0===t.previewCamView&&(n.updateNetworkOptions({passthrough:!0,preview:{previewType:"none"},previewCamView:!0}),r=this.inputClone);case 21:t.destroyPreviewRenderContext&&this.destroyPreviewContext(),e.next=25;break;case 24:console.warn("No preview rendering context found.");case 25:return this.trackEvent({eventName:"vbApplyPreview_End"}),e.abrupt("return",r);case 29:throw e.prev=29,e.t0=e.catch(2),this.trackEvent({eventName:"vbApplyPreview_Error",properties:{error:e.t0}},"error"),console.error("Error in vbApplyPreview",e.t0),e.t0;case 34:case"end":return e.stop()}},e,this,[[2,29]])})),function(){return t.apply(this,arguments)})},{key:"destroyPreviewContext",value:(e=(0,a.Z)(l().mark(function e(){var t,r;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.trackEvent({eventName:"vbDestroyPreviewContext_Start"}),e.prev=1,!this.previewCanvas){e.next=14;break}return e.next=5,this.processorP;case 5:(t=e.sent.processor)&&(t.previewVideo instanceof HTMLVideoElement&&t.previewVideo.pause(),r={previewType:"none",previewImage:null,previewRadius:null,previewVideo:null},t.updateNetworkOptions({preview:r,previewContext:null,previewCamView:!1})),this.previewStream.getTracks().forEach(function(e){e.stop()}),this.previewCanvas.remove(),this.previewCanvas=void 0,this.previewContext=void 0,this.previewStream=void 0,this.trackEvent({eventName:"vbDestroyPreviewContext_End"});case 14:e.next=21;break;case 16:throw e.prev=16,e.t0=e.catch(1),this.trackEvent({eventName:"vbDestroyPreviewContext_Error",properties:{error:e.t0}},"error"),(0,d.ok)()&&console.log("Error in vbDestroyPreviewContext",e.t0),e.t0;case 21:case"end":return e.stop()}},e,this,[[1,16]])})),function(){return e.apply(this,arguments)})},{key:"initEvents",value:function(){var e=this,t={};this.eventHandler.names.forEach(function(r){t[r]=function(t){"error"!==r&&"lowperf"!==r||e.trackEvent({eventName:"vbEventsCallback-".concat(r,"_Event"),properties:{detail:t.detail}})},e.eventHandler.on(r,t[r])})}},{key:"on",value:function(e,t){return!!this.eventHandler&&(this.eventHandler.on(e,t),this)}},{key:"log",value:function(){this.debug&&console.log.apply(null,arguments)}}]),I}();S.isSupported=(0,a.Z)(l().mark(function e(){var t,r;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=S.getTracker(),e.prev=1,t.trackEvent({eventName:"vbIsSupported_Start",properties:{}}),e.next=5,(0,p.Gb)();case 5:if(r=e.sent){e.next=11;break}return t.trackEvent({eventName:"vbIsSupported_End",properties:{isSupported:!1,features:r}}),e.abrupt("return",!1);case 11:return t.trackEvent({eventName:"vbIsSupported_End",properties:{isSupported:!0,features:r}}),e.abrupt("return",r);case 13:e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(1),t.trackEvent({eventName:"vbIsSupported_Error",properties:{error:e.t0}},"error"),console.error("Error in calling isSupported",e.t0),e.t0;case 20:case"end":return e.stop()}},e,null,[[1,15]])})),i=(0,a.Z)(l().mark(function e(t){var r,n;return l().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=S.getTracker(),e.next=3,(0,p.$A)(t);case 3:return n=e.sent,r.trackEvent({eventName:"vbIsModelSupported_End",properties:{returnVal:n,model:t}}),e.abrupt("return",n);case 6:case"end":return e.stop()}},e)})),S.isModelSupported=function(e){return i.apply(this,arguments)},S.setDefaultToken=function(e){S.defaultToken=e},S.setTracker=function(e){e&&(S.tracker=new y.fX({name:"effects-common",track:e.track.bind(e)}),S.analyticsEnabled=!0)},S.setTrackerCreator=function(e){S.trackerCreateFunction=e,S.trackerCreationInProgress=!1},S.createTracker=function(){S.trackerCreationInProgress=!0;var e=S.trackerCreateFunction();S.setTracker(e),S.trackerCreationInProgress=!1},S.getTracker=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return S.trackerCreationInProgress?{trackEvent:function(){}}:(t&&S.trackerCreateFunction&&S.createTracker(),e)?S.tracker?(S.tracker.hasConsoleTracker()||S.tracker.addTracker({track:y.F6,name:"console",enabled:!0}),S.tracker):(S.consoleTracker?S.consoleTracker.enableTracker("console"):S.consoleTracker=new y.fX({name:"console",track:y.F6,enabled:!0}),S.consoleTracker):S.tracker?(S.tracker.hasConsoleTracker()||S.tracker.addTracker({track:y.F6,name:"console",enabled:!1}),S.tracker):(S.consoleTracker||(S.consoleTracker=new y.fX({name:"console",track:y.F6,enabled:!1})),S.consoleTracker)},S.parseUserAgent=function(e){var t=new(w()),r=e||navigator.userAgent;return t.setUA(r),t.getResult()},S.checkPerformance=p.$_;var R=S},8371:function(e,t,r){"use strict";r.d(t,{default:function(){return b}});var n=r(5861),i=r(5671),a=r(3144),o=r(4687),s=r.n(o),u=r(2045),c=r(4147),l=r(7055),h=r(7337),f=r(8190),d=r.n(f),p=r(2982),m=r(4942),g=r(885);function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}!function(){var e,t,r,i,a=["_imageBitmapOptions","resizeWidth","resizeHeight","resizeQuality","imageOrientation"],o=["_Blob","_ImageData","_SVGBlob","_SVGImageElement"],u=["resizeWidth","resizeHeight","resizeQuality","imageOrientation","premultiplyAlpha","colorSpaceConversion"],c={ResizeQuality:["pixelated","low","medium","high"],ImageOrientation:["none","flipY"]},l="Failed to execute 'createImageBitmap': ",h="Provided image was in an invali
1d state.",f=["HTMLImageElement","SVGImageElement","HTMLVideoElement","HTMLCanvasElement","OffscreenCanvas","ImageBitmap"],d="http://www.w3.org/2000/svg",b="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",w=new Int32Array(1);function y(e){return Number.isFinite(e)?(w[0]=e,w[0]):NaN}function k(e){var t=y(e);if(isNaN(t))throw TypeError("Invalid long value");return t}function x(e,t){var r=Object.assign(document.createElement("canvas"),{width:e,height:t}).getContext("2d");if(e&&t&&!function(e){if(e.isContextLost)return e.translate(0,0),!e.isContextLost();var t=!1;try{e.fillRect(0,0,1,1),t=0!==e.getImageData(0,0,1,1).data[3]}finally{return e.clearRect(0,0,1,1),t}}(r))throw new DOMException("The ImageBitmap couldn't be allocated.","InvalidStateError");return r}function _(e){return function(t){var r=globalThis[t];return r&&e instanceof r}}var E=globalThis.createImageBitmap,T=!!E&&function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return E.call.apply(E,[globalThis].concat(t))};function S(e){var t=new Image;return t.src=e,new Promise(function(e,r){t.onload=function(r){M(t),e(t)},t.onerror=function(e){r(new DOMException(h,"InvalidStateError"))}})}function R(e,t,r){var n=c[r],i=e[t];if(void 0!==i&&!n.includes(i))throw TypeError("'%v' is not a valid value for enumeration %e".replace("%v",i).replace("%e",r))}function A(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i,a=r.map(y),o=(0,g.Z)(a,4),s=o[0],u=o[1],c=o[2],h=o[3],f=(1===r.length?r[0]:r[4])||{},d="resizeWidth"in f&&k(f.resizeWidth),p="resizeHeight"in f&&k(f.resizeHeight);R(f,"resizeQuality","ResizeQuality"),R(f,"imageOrientation","ImageOrientation");var b=arguments.length;if(!b)throw TypeError(l+"At least one argument is required.");if(b>2&&b<5)throw"%s is not a valid argument count for any overload".replace("%s",b),TypeError(l+err_count_msg);if(b>=5){if(!c||!h)throw RangeError(l+"The crop rect width passed to createImageBitmap must be nonzero");i={sx:s=s||0,sy:u=u||0,sw:c,sh:h}}if(0===d||0===p)throw new DOMException(l+"The ImageBitmap could not be allocated.","InvalidStateError");return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){(0,m.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({cropRect:i},f)}function O(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=r.length;return e.has("_imageBitmapOptions")&&[2,6].includes(i)?r.slice(0,i-1):r}function P(e){var t=_(e);return t("HTMLImageElement")?{width:e.naturalWidth,height:e.naturalHeight}:t("HTMLVideoElement")?{width:e.videoWidth,height:e.videoHeight}:t("SVGImageElement")?{width:NaN,height:NaN}:t("HTMLCanvasElement")||t("OffscreenCanvas")||t("ImageBitmap")||t("ImageData")?e:{width:NaN,height:NaN}}function C(e,t){var r,n,i,a,o,s,u,c,l,h,f,d,p,m,g,v,b,w,y,k,_,E,T=(v=(g=P(e)).width,b=g.height,w=t.resizeWidth,y=t.resizeHeight,k=t.cropRect||{sx:0,sy:0,sw:v,sh:b},_={dx:0,dy:0,dw:w||Math.abs(k.sw),dh:y||Math.abs(k.sh)},(r=k.sx,n=k.sy,i=k.sw,a=k.sh,o=_.dx,s=_.dy,u=_.dw,c=_.dh,i<0&&(r+=i,i=Math.abs(i)),a<0&&(n+=a,a=Math.abs(a)),u<0&&(o+=u,u=Math.abs(u)),c<0&&(s+=c,c=Math.abs(c)),l=Math.max(r,0),h=Math.min(r+i,v),f=Math.max(n,0),d=Math.min(n+a,b),p=u/i,m=c/a,E={sx:l,sy:f,sw:h-l,sh:d-f,dx:r<0?o-r*p:o,dy:n<0?s-n*m:s,dw:(h-l)*p,dh:(d-f)*m}).resizeQuality=t.resizeQuality,E.flipY="flipY"===t.imageOrientation,E.width=_.dw,E.height=_.dh,E),S=(P(e).height,T.sx),R=T.sy,A=T.sw,O=T.sh,C=T.dx,I=T.dy,F=T.dw,B=T.dh,M=T.flipY,L=T.resizeQuality,N=x(T.width,T.height),U=N.canvas;return"pixelated"===L?N.imageSmoothingEnabled=!1:L&&(N.imageSmoothingQuality=L),N.drawImage(e,S,R,A,O,C,I,F,B),M&&(N.globalCompositeOperation="copy",N.setTransform(1,0,0,-1,0,U.height),N.drawImage(U,0,0)),U}function I(){return(I=(0,n.Z)(s().mark(function e(t,r){var n,i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=globalThis.URL.createObjectURL(t),e.next=3,S(n);case 3:return i=e.sent,e.abrupt("return",(globalThis.URL.revokeObjectURL(t),C(i,r)));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function F(){return(F=(0,n.Z)(s().mark(function e(t,r){var n,i,a,o,u,c,l,h,f,d,p,m,g,v,b,w,y;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.resizeWidth,i=r.resizeHeight,a=r.resizeQuality,o=r.imageOrientation,c=(u=r.cropRect||{}).sx||0,l=u.sy||0,h=u.sw||t.width,f=u.sh||t.height,d=h<0?-1*h-c:-c,p=f<0?-1*f-l:-l,(m=x(Math.abs(h),Math.abs(f))).putImageData(t,d,p,c,l,h,f),g="flipY"===o,v=n||g,n?(b=x(n,i),"pixelated"===a?b.imageSmoothingEnabled=!1:b.imageSmoothingQuality=a):(b=m,m.globalCompositeOperation="copy"),w=m.canvas,y=b.canvas,e.abrupt("return",(g&&b.setTransform(1,0,0,-1,0,y.height),v&&b.drawImage(w,0,0,w.width,w.height,0,0,y.width,y.height),y)
1);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function B(){throw new DOMException(l+h,"InvalidStateError")}function M(e){var t=_(e);if(t("HTMLCanvasElement")||t("OffscreenCanvas")||t("ImageBitmap"))0!==e.width&&0!==e.height||B();else if(t("HTMLImageElement")||t("HTMLVideoElement")||t("SVGImageElement")){var r=P(e),n=r.width,i=r.height;0!==n&&0!==i||B();var a=!1;try{a=!x(0,0).createPattern(e,"no-repeat")}catch(e){return"maybe"}a&&B()}return!0}var L=!1,N=function(){if(!T)return new Set(a.concat(o));var e,t,r=new Set([(e=[],t={},u.forEach(function(r){Object.defineProperty(t,r,{get:function(){e.push(r)}})}),T(new ImageData(1,1),t).then(function(e){return e.close()}).catch(function(){}),e.length&&e.push("_imageBitmapOptions"),e)].flat());return new Set(a.filter(function(e){return!r.has(e)}))}(),U=(0,n.Z)(s().mark(function e(){var t,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(T){e.next=2;break}return e.abrupt("return",(L=!0,N));case 2:return t=[function(){return j.apply(this,arguments)}(),function(){return z.apply(this,arguments)}(),function(){return D.apply(this,arguments)}(),function(){return W.apply(this,arguments)}()],e.next=5,Promise.all(t);case 5:return r=new Set(e.sent.flat()),e.abrupt("return",(o.filter(function(e){return!r.has(e)}).forEach(function(e){return N.add(e)}),L=!0,N));case 8:case"end":return e.stop()}},e)}))();function j(){return(j=(0,n.Z)(s().mark(function e(){var t,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,fetch(b).then(function(e){return e.ok&&e.blob()});case 3:return r=e.sent,e.prev=4,e.next=7,T(r);case 7:if(e.t0=e.sent.width,e.t1=1===e.t0,!e.t1){e.next=11;break}t.push("_Blob");case 11:e.next=16;break;case 13:e.prev=13,e.t2=e.catch(4),console.log(e.t2);case 16:return e.abrupt("return",t);case 17:case"end":return e.stop()}}
1,e,null,[[4,13]])}))).apply(this,arguments)}function z(){return(z=(0,n.Z)(s().mark(function e(){var t,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=function(){try{return new ImageData(1,1)}catch(e){return create2dContext(0,0).createImageData(1,1)}}(),e.prev=1,e.next=4,T(r);case 4:if(e.t0=e.sent.width,e.t1=1===e.t0,!e.t1){e.next=8;break}t.push("_ImageData");case 8:e.next=12;break;case 10:e.prev=10,e.t2=e.catch(1);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)}function D(){return(D=(0,n.Z)(s().mark(function e(){var t,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=new Blob(['<svg width="1" height="1" xmlns="'.concat(d,'">\n <rect width="1" height="1"/>\n </svg>')],{type:"image/svg+xml"}),e.prev=1,e.next=4,T(r);case 4:if(e.t0=e.sent.width,e.t1=1===e.t0,!e.t1){e.next=8;break}t.push("_SVGBlob");case 8:e.next=12;break;case 10:e.prev=10,e.t2=e.catch(1);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)}function W(){return(W=(0,n.Z)(s().mark(function e(){var t,r,n,i,a;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=[],"SVGImageElement"in globalThis){e.next=3;break}return e.abrupt("return",t);case 3:r=function(e){return new Promise(function(t){return setTimeout(t,e)})},(n=document.createElementNS(d,"image")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b),i=function(){try{return M(n),!1}catch(e){return!0}},a=0;case 7:return e.next=9,r(10);case 9:if(i()&&++a<300){e.next=7;break}case 10:return e.prev=10,e.next=13,T(n);case 13:t.push("_SVGImageElement"),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(10),console.error(e.t0);case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}},e,null,[[10,16]])}))).apply(this,arguments)}var H=function(e){return Object.getOwnPropertyDescriptor(HTMLCanvasElement.prototype,e)};function V(){throw TypeError("Illegal Constructor")}V.prototype=Object.create((r={close:function(){H("width").set.call(this,0),H("height").set.call(this,0)},get width(){return H("width").get.call(this)},get height(){return H("height").get.call(this)}},(i={})[t=Symbol.toStringTag]=i[t]||{},i[t].get=function(){return"ImageBitmap"},function(e,t){for(var r in t)(a=t[r]).configurable=a.enumerable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,r,a);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(t),i=0;i<n.length;i++){var a,o=n[i];(a=t[o]).configurable=a.enumerable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,o,a)}}(r,i),r)),T||(globalThis.ImageBitmap=V),globalThis.createImageBitmap=(e=(0,n.Z)(s().mark(function e(t){var r,n,i,a,o,u,c,l=arguments;return s().wrap(function(e){for(var s,h;;)switch(e.prev=e.next){case 0:for(n=Array((r=l.length)>1?r-1:0),i=1;i<r;i++)n[i-1]=l[i];if(a=A.apply(void 0,l),s=t,!(!L&&["Blob","ImageData","SVGImageElement"].some(_(s)))){e.next=8;break}return e.next=5,U;case 5:e.t0=e.sent,e.next=9;break;case 8:e.t0=N;case 9:if(0!==(o=e.t0).size){e.next=12;break}return e.abrupt("return",T.apply(void 0,l));case 12:if(!T||function(e,t,r){var n=_(r);return!!(n("Blob")&&(e.has("_Blob")||(null!=r&&r.type,e.has("_SVGBlob"))))||!(!n("ImageData")||!e.has("_ImageData"))||!(!n("SVGImageElement")||!e.has("_SVGImageElement"))||!!Object.keys(t).some(function(t){return e.has(t)})}(o,a,t)){e.next=14;break}return e.abrupt("return",T.apply(void 0,(0,p.Z)(O.apply(void 0,[o].concat(Array.prototype.slice.call(l))))));case 14:if(u=_(t),!f.some(u)){e.next=26;break}if(M(t),e.t1=u("SVGImageElement"),!e.t1){e.next=22;break}return e.next=21,S((h=t).getAttribute("href")||h.getAttributeNS("http://www.w3.org/1999/xlink","href"));case 21:t=e.sent;case 22:u("HTMLImageElement")&&(t.naturalWidth||t.naturalHeight||a.resizeWidth&&a.resizeHeight||B()),c=C(t,a),e.next=38;break;case 26:if(!u("Blob")){e.next=32;break}return e.next=29,function(e,t){return I.apply(this,arguments)}(t,a);case 29:c=e.sent,e.next=38;break;case 32:if(e.t2=u("ImageData"),!e.t2){e.next=38;break}return function(e){try{return e.slice(0,0),!1}catch(e){return!0}}(t.data.buffer)&&B(),e.next=37,function(e,t){return F.apply(this,arguments)}(t,a);case 37:c=e.sent;case 38:if(c){e.next=40;break}throw TypeError("Argument 1 could not be converted to any of: HTMLImageElement, SVGImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap, Blob, CanvasRenderingContext2D, ImageData.");case 40:return e.next=42,function(e){var t;return e instanceof globalThis.ImageBitmap?e:T?T(e):((t=e)instanceof HTMLCanvasElement||(t=C(t)),Object.setPrototypeOf(t,V.prototype),t)}(c);case 42:return e.abrupt("return",e.sent);case 43:case"end":return e.stop()}},e)})),function(t){return e.apply(this,arguments)}),globalThis.createImageBitmap._original=T}();var b=function(){var e,t,r,o,f,p,m,g,v,b,w,y;function k(){(0,i.Z)(this,k)}return(0,a.Z)(k,[{key:"load",value:(y=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.params=t||{},this.model=t.model||"selfie",this.model_version=t.version,this.debug=this.params.debug||(0,l.ok)(),this.id=t.id||(0,u.Z)(),this.version=c.i8,this.serverType=this.params.serverType||"",this.defaults={},this.defaults.frameRate=30,this.defaults.segmentationFrameRate=15,this.frameRate=t.frameRate||this.defaults.frameRate,this.segmentationFrameRate=t.segmentationFrameRate||this.defaults.segmentationFrameRate,this.passthrough=t.passthrough||!1,"production"!==this.serverType&&""!==this.serverType||(0,h.EK)(null,t),this.defaultBackgroun
1d="https://files.vectorly.io/demo/background-filter/images/virtual-background-1.jpg",this.defaultBlurRadius=5,this.background=this.params.background||this.defaultBackground,this.blurRadius=this.params.blurRadius||this.defaultBlurRadius,this.error=null,this.loadP=this.loadCoreModule(),this.inputSize=t.inputSize||{w:100,h:100},parseInt(this.inputSize.w)&&parseInt(this.inputSize.h)||console.warn("INVALID inputSize parameter set as",t.inputSize,"; Defaulting to {w: 100, h: 100}"),this.canvas=t.canvas||this._initCanvas(),e.prev=23,this.processorP=this._initializeCoreNetwork(),e.abrupt("return",this.processorP);case 28:throw e.prev=28,e.t0=e.catch(23),this.error=e.t0,e.t0;case 32:case"end":return e.stop()}},e,this,[[23,28]])})),function(e){return y.apply(this,arguments)})},{key:"loadCoreModule",value:(w=(0,n.Z)(s().mark(function e(){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.Zq)(!1,!0);case 2:return this.vectorlyCore=e.sent,(0,l.ok)()&&console.log("VectorlyCore",this.vectorlyCore),e.abrupt("return",!0);case 5:case"end":return e.stop()}},e,this)})),function(){return w.apply(this,arguments)})},{key:"_initVideo",value:function(){var e=document.createElement("video");return e.style.visibility="hidden",e.style.display="none",e.id="vid-"+this.id,e.setAttribute("playsinline",null),e.setAttribute("autoplay",null),this.input&&(e.srcObject=this.input),document.body.appendChild(e),(0,l.yA)(e)||e.play(),e}},{key:"_initializeCoreNetwork",value:(b=(0,n.Z)(s().mark(function e(){var t,r,n;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadP;case 2:return e.t0=t=new this.vectorlyCore,e.t1=this.params.token,e.t2=this.inputSize.w,e.t3=this.inputSize.h,e.t4=this.id,e.t5=(0,h.PD)(this.model),e.t6=this.passthrough||!1,e.t7=Math.ceil(this.frameRate/this.segmentationFrameRate),e.next=13,this._getBackground(this.background);case 13:return e.t8=e.sent,e.t9={passthrough:e.t6,skipFactor:e.t7,background:e.t8},e.t10=this.inputSize,e.t11=this.debug,e.t12=this.canvas,e.t13=this.serverType,e.t14={token:e.t1,w:e.t2,h:e.t3,id:e.t4,networkParams:e.t5,networkOptions:e.t9,renderSize:e.t10,debug:e.t11,canvas:e.t12,serverType:e.t13,analyticsEnabled:!1},r=e.t0.load.call(e.t0,e.t14),(0,l.ok)()&&console.log(t,r),e.next=24,r;case 24:if(n=e.sent,this.processor=t,(0,l.ok)()&&console.log("In _initializeCoreNetwork",n,t),!1!==n){e.next=30;break}throw(0,l.ok)()&&console.log("Initialized is",this.initialized,t.error),Error(t.error);case 30:return e.abrupt("return",{canvas:this.canvas,processor:t});case 31:case"end":return e.stop()}},e,this)})),function(){return b.apply(this,arguments)})},{key:"_initCanvas",value:function(){var e=document.createElement("canvas");return e.id="canv-"+this.id,e.style.display="none",e}},{key:"setInputSize",value:(v=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processorP;case 2:return e.next=4,this.processor.updateInputResolution(t);case 4:return e.next=6,this.processor.updateRenderResolution(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return v.apply(this,arguments)})},{key:"setInput",value:(g=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processorP;case 2:return e.next=4,this.processor.setInput(t);case 4:case"end":return e.stop()}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"render",value:(m=(0,n.Z)(s().mark(function e(){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processorP;case 2:return e.next=4,this.processor.render();case 4:case"end":return e.stop()}},e,this)})),function(){return m.apply(this,arguments)})},{key:"getOutputBitmap",value:(p=(0,n.Z)(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,createImageBitmap(this.canvas);case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e,this)})),function(){return p.apply(this,arguments)})},{key:"getOutput",value:(f=(0,n.Z)(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getOrCreateOutput();case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e,this)})),function(){return f.apply(this,arguments)})},{key:"_getOrCreateOutput",value:(o=(0,n.Z)(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processorP;case 2:if(this.output&&(t=this.output.getVideoTracks()[0]),this.output&&(!t||"ended"!==t.readyState)){e.next=8;break}return this.outputP=this._createNewStream(),e.next=7,this.outputP;case 7:this.output=e.sent;case 8:return e.abrupt("return",this.output);case 9:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_createNewStream",value:(r=(0,n.Z)(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.processorP;case 3:return this.processOutput=this.canvas.captureStream(),t=this.processOutput,e.abrupt("return",t);case 8:throw e.prev=8,e.t0=e.catch(0),console.error("ERROR in createNewStream",e.t0),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,8]])})),function(){return r.apply(this,arguments)})}
1,{key:"_getBackground",value:(t=(0,n.Z)(s().mark(function e(t){var r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("blur"!==t){e.next=4;break}return e.abrupt("return",{type:"blur",radius:this.blurRadius});case 4:if("binary"!==t&&"transparent"!==t){e.next=8;break}return e.abrupt("return",{type:t});case 8:if(t){e.next=13;break}r=this.defaultBackground,console.warn("in background is not given; Setting to defaultBackground",this.defaultBackground),e.next=29;break;case 13:if("string"!=typeof t){e.next=18;break}r=t,d()(t)&&(r=document.URL.substr(0,document.URL.lastIndexOf("/"))+"/"+t),e.next=29;break;case 18:if(!(t instanceof HTMLImageElement)){e.next=26;break}return e.next=21,(0,h.po)(t);case 21:return e.next=23,createImageBitmap(t);case 23:r=e.sent,e.next=29;break;case 26:return e.next=28,createImageBitmap(t);case 28:r=e.sent;case 29:return e.abrupt("return",{type:"virtual",image:r});case 30:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"changeBackground",value:(e=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,l.ok)()&&console.log("Change background to",t,"from",this.background),e.prev=1,e.next=4,this.processorP;case 4:return e.t0=this.processor,e.next=7,this._getBackground(t);case 7:return e.t1=e.sent,e.t2={background:e.t1},e.next=11,e.t0.updateNetworkOptions.call(e.t0,e.t2);case 11:this.background=t,e.next=18;break;case 14:throw e.prev=14,e.t3=e.catch(1),console.error(e.t3),e.t3;case 18:case"end":return e.stop()}},e,this,[[1,14]])})),function(t){return e.apply(this,arguments)})}]),k}()},9279:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return R}});var n=r(2982),i=r(5861),a=r(4942),o=r(5671),s=r(3144),u=r(4687),c=r.n(u),l=r(885),h=r(2045),f=r(7055),d=r(477),p=r.n(d);function m(){return p()('!function(){var e={259:function(e){e.exports=["cnn_demo","residual_3k_3x","residual_4k_2x","residual_5k_2x","residual_5k_3x","denoise_10k_1x","background_selfie","background_webgl_unet","background_webgl","background_webgl2","background_webgl2_v2","upscaler_4krgb_2x","background_rbnet","relighting_zdce"]},497:function(e){var t,r=(t=(t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var r,n,a=void 0!==(e=e||{})?e:{};a.ready=new Promise((function(e,t){r=e,n=t}));var i,o={};for(i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);var s,u,c,f=[],l="./this.program",h=function(e,t){throw t};s="object"==typeof window,u="function"==typeof importScripts,c="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;var p,d,g="";(s||u)&&(u?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),t&&(g=t),g=0!==g.indexOf("blob:")?g.substr(0,g.lastIndexOf("/")+1):"",u&&(d=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var m,y=a.print||console.log.bind(console),w=a.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(a[i]=o[i]);o=null,a.arguments&&(f=a.arguments),a.thisProgram&&(l=a.thisProgram),a.quit&&(h=a.quit),a.wasmBinary&&(m=a.wasmBinary);var _,E=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&D("no native wasm support detected");var b,v,T,x,A=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&R)return R.decode(e.subarray(t,a));for(var i="";t<a;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var c=o-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&o)<<6|s)}else i+=String.fromCharCode(o)}return i}function O(e){b=e,a.HEAP8=v=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=x=new Int32Array(e),a.HEAPU8=T=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=new
1Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=new Float64Array(e)}a.INITIAL_MEMORY;var B,I=[],S=[],P=[],L=[];S.push({func:function(){Z()}});var C=0,U=null,F=null;function D(e){a.onAbort&&a.onAbort(e),w(e+=""),A=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}function M(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}function N(e){return M(e,"data:application/octet-stream;base64,")}function X(e){return M(e,"file://")}a.preloadedImages={},a.preloadedAudios={};var G,W,j="./tflite/tflite-simd.wasm";function z(e){try{if(e==j&&m)return new Uint8Array(m);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}catch(e){D(e)}}function H(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?B.get(r)():B.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(a)}}function $(e){return x[ee()>>2]=e,e}function q(e){try{return _.grow(e-b.byteLength+65535>>>16),O(_.buffer),1}catch(e){}}N(j)||(G=j,j=a.locateFile?a.locateFile(G,g):(g=a.basePath||g)+G),W=c?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof dateNow?dateNow:function(){return performance.now()};var V={};function Y(){if(!Y.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l||"./this.program"};for(var t in V)e[t]=V[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Y.strings=r}return Y.strings}var J,K={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var r=K.buffers[e];0===t||10===t?((1===e?y:w)(k(r,0)),r.length=0):r.push(t)},varargs:void 0,get:function(){return K.varargs+=4,x[K.varargs-4>>2]},getStr:function(e){var t=function(e,t){return e?k(T,e,t):""}(e);return t},get64:function(e,t){return e}},Q={a:function(){D()},n:function(e,t){var r;if(0===e)r=Date.now();else{if(1!==e&&4!==e)return $(28),-1;r=W()}return x[t>>2]=r/1e3|0,x[t+4>>2]=r%1e3*1e3*1e3|0,0},i:function(e,t){D("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},e:function(e,t){D("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},l:function(e,t,r){T.copyWithin(e,t,t+r)},m:function(e){var t,r,n=T.length,a=2147483648;if(e>a)return!1;for(var i=1;i<=4;i*=2){var o=n*(1+.2/i);if(o=Math.min(o,e+100663296),q(Math.min(a,((t=Math.max(e,o))%(r=65536)>0&&(t+=r-t%r),t))))return!0}return!1},o:function(e){for(var t=W();W()-t<e;);},p:function(e,t){var r=0;return Y().forEach((function(n,a){var i=t+r;x[e+4*a>>2]=i,function(e,t,r){for(var n=0;n<e.length;++n)v[t++>>0]=e.charCodeAt(n);r||(v[t>>0]=0)}(n,i),r+=n.length+1})),0},g:function(e,t){var r=Y();x[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),x[t>>2]=n,0},j:function(e){!function(e,t){t&&E&&0===e||(E||(a.onExit&&a.onExit(e),A=!0),h(e,new te(e)))}(e)},h:function(e){return 0},k:function(e,t,r,n,a){},c:function(e,t,r,n){for(var a=0,i=0;i<r;i++){for(var o=x[t+8*i>>2],s=x[t+(8*i+4)>>2],u=0;u<s;u++)K.printChar(e,T[o+u]);a+=s}return x[n>>2]=a,0},d:function(){return 6},f:function(){return 28},b:function(e){switch(e){case 30:case 75:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;
1case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return $(28),-1}},Z=(function(){var e={a:Q};function t(e,t){var r=e.exports;a.asm=r,O((_=a.asm.q).buffer),B=a.asm.D,function(e){if(C--,a.monitorRunDependencies&&a.monitorRunDependencies(C),0==C&&(null!==U&&(clearInterval(U),U=null),F)){var t=F;F=null,t()}}()}function r(e){t(e.instance)}function i(t){return function(){if(!m&&(s||u)){if("function"==typeof fetch&&!X(j))return fetch(j,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at \'"+j+"\'";return e.arrayBuffer()})).catch((function(){return z(j)}));if(p)return new Promise((function(e,t){p(j,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return z(j)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){w("failed to asynchronously prepare wasm: "+e),D(e)}))}if(C++,a.monitorRunDependencies&&a.monitorRunDependencies(C),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}(m||"function"!=typeof WebAssembly.instantiateStreaming||N(j)||X(j)||"function"!=typeof fetch?i(r):fetch(j,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(r,(function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),i(r)}))}))).catch(n)}(),a.___wasm_call_ctors=function(){return(Z=a.___wasm_call_ctors=a.asm.r).apply(null,arguments)}),ee=(a._getModelBufferMemoryOffset=function(){return(a._getModelBufferMemoryOffset=a.asm.s).apply(null,arguments)},a._getInputMemoryOffset=function(){return(a._getInputMemoryOffset=a.asm.t).apply(null,arguments)},a._getInputHeight=function(){return(a._getInputHeight=a.asm.u).apply(null,arguments)},a._getInputWidth=function(){return(a._getInputWidth=a.asm.v).apply(null,arguments)},a._getInputChannelCount=function(){return(a._getInputChannelCount=a.asm.w).apply(null,arguments)},a._getOutputMemoryOffset=function(){return(a._getOutputMemoryOffset=a.asm.x).apply(null,arguments)},a._getOutputHeight=function(){return(a._getOutputHeight=a.asm.y).apply(null,arguments)},a._getOutputWidth=function(){return(a._getOutputWidth=a.asm.z).apply(null,arguments)},a._getOutputChannelCount=function(){return(a._getOutputChannelCount=a.asm.A).apply(null,arguments)},a._loadModel=function(){return(a._loadModel=a.asm.B).apply(null,arguments)},a._runInference=function(){return(a._runInference=a.asm.C).apply(null,arguments)},a.___errno_location=function(){return(ee=a.___errno_location=a.asm.E).apply(null,arguments)});function te(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function re(e){function t(){J||(J=!0,a.calledRun=!0,A||(H(S),H(P),r(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),L.unshift(e);var e;H(L)}()))}e=e||f,C>0||(function(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),I.unshift(e);var e;H(I)}(),C>0||(a.setStatus?(a.setStatus("Running..."),setTimeout((function(){setTimeout((function(){a.setStatus("")}),1),t()}),1)):t()))}if(F=function e(){J||re(),J||(F=e)},a.run=re,a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return re(),e.ready});e.exports=r},958:function(e){var t,r=(t=(t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var r,n,a=void 0!==(e=e||{})?e:{};a.ready=new Promise((function(e,t){r=e,n=t}));var i,o={};for(i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);var s,u,c,f=[],l="./this.program",h=function(e,t){throw t};s="object"==typeof window,u="function"==typeof importScripts,c="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;var p,d,g="";(s||u)&&(u?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),t&&(g=t),g=0!==g.indexOf("blob:")?g.substr(0,g.lastIndexOf("/")+1):"",u&&(d=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var m,y=a.print||console.log.bind(console),w=a.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(a[i]=o[i]);o=null,a.arguments&&(f=a.arguments),a.thisProgram&&(l=a.thisProgram),a.quit&&(h=a.quit),a.wasmBinary&&(m=a.wasmBinary);var _,E=a.noExitRuntime||!0;
1"object"!=typeof WebAssembly&&D("no native wasm support detected");var b,v,T,x,A=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&R)return R.decode(e.subarray(t,a));for(var i="";t<a;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var c=o-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&o)<<6|s)}else i+=String.fromCharCode(o)}return i}function O(e){b=e,a.HEAP8=v=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=x=new Int32Array(e),a.HEAPU8=T=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=new Float64Array(e)}a.INITIAL_MEMORY;var B,I=[],S=[],P=[],L=[];S.push({func:function(){Z()}});var C=0,U=null,F=null;function D(e){a.onAbort&&a.onAbort(e),w(e+=""),A=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}function M(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}function N(e){return M(e,"data:application/octet-stream;base64,")}function X(e){return M(e,"file://")}a.preloadedImages={},a.preloadedAudios={};var G,W,j="./tflite/tflite.wasm";function z(e){try{if(e==j&&m)return new Uint8Array(m);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}catch(e){D(e)}}function H(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?B.get(r)():B.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(a)}}function $(e){return x[ee()>>2]=e,e}function q(e){try{return _.grow(e-b.byteLength+65535>>>16),O(_.buffer),1}catch(e){}}N(j)||(G=j,j=a.locateFile?a.locateFile(G,g):(g=a.basePath||g)+G),W=c?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof dateNow?dateNow:function(){return performance.now()};var V={};function Y(){if(!Y.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l||"./this.program"};for(var t in V)e[t]=V[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Y.strings=r}return Y.strings}var J,K={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var r=K.buffers[e];0===t||10===t?((1===e?y:w)(k(r,0)),r.length=0):r.push(t)},varargs:void 0,get:function(){return K.varargs+=4,x[K.varargs-4>>2]},getStr:function(e){var t=function(e,t){return e?k(T,e,t):""}(e);return t},get64:function(e,t){return e}},Q={a:function(){D()},n:function(e,t){var r;if(0===e)r=Date.now();else{if(1!==e&&4!==e)return $(28),-1;r=W()}return x[t>>2]=r/1e3|0,x[t+4>>2]=r%1e3*1e3*1e3|0,0},i:function(e,t){D("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},e:function(e,t){D("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},l:function(e,t,r){T.copyWithin(e,t,t+r)},m:function(e){var t,r,n=T.length,a=2147483648;if(e>a)return!1;for(var i=1;i<=4;i*=2){var o=n*(1+.2/i);if(o=Math.min(o,e+100663296),q(Math.min(a,((t=Math.max(e,o))%(r=65536)>0&&(t+=r-t%r),t))))return!0}return!1},o:function(e){for(var t=W();W()-t<e;);},p:function(e,t){var r=0;return Y().forEach((function(n,a){var i=t+r;x[e+4*a>>2]=i,function(e,t,r){for(var n=0;n<e.length;++n)v[t++>>0]=e.charCodeAt(n);r||(v[t>>0]=0)}(n,i),r+=n.length+1})),0},g:function(e,t){var r=Y();x[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),x[t>>2]=n,0},j:function(e){!function(e,t){t&&E&&0===e||(E||(a.onExit&&a.onExit(e),A=!0),h(e,new te(e)))}(e)},h:function(e){return 0},k:function(e,t,r,n,a){},c:function(e,t,r,n){for(var a=0,i=0;i<r;i++){for(var o=x[t+8*i>>2],s=x[t+(8*i+4)>>2],u=0;u<s;u++)K.printChar(e,T[o+u]);a+=s}return x[n>>2]=a,0},d:function(){return 6},f:function(){return 28},b:function(e){switch(e){case 30:case 75:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;
1case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return $(28),-1}},Z=(function(){var e={a:Q};function t(e,t){var r=e.exports;a.asm=r,O((_=a.asm.q).buffer),B=a.asm.D,function(e){if(C--,a.monitorRunDependencies&&a.monitorRunDependencies(C),0==C&&(null!==U&&(clearInterval(U),U=null),F)){var t=F;F=null,t()}}()}function r(e){t(e.instance)}function i(t){return function(){if(!m&&(s||u)){if("function"==typeof fetch&&!X(j))return fetch(j,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at \'"+j+"\'";return e.arrayBuffer()})).catch((function(){return z(j)}));if(p)return new Promise((function(e,t){p(j,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return z(j)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){w("failed to asynchronously prepare wasm: "+e),D(e)}))}if(C++,a.monitorRunDependencies&&a.monitorRunDependencies(C),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}(m||"function"!=typeof WebAssembly.instantiateStreaming||N(j)||X(j)||"function"!=typeof fetch?i(r):fetch(j,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(r,(function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),i(r)}))}))).catch(n)}(),a.___wasm_call_ctors=function(){return(Z=a.___wasm_call_ctors=a.asm.r).apply(null,arguments)}),ee=(a._getModelBufferMemoryOffset=function(){return(a._getModelBufferMemoryOffset=a.asm.s).apply(null,arguments)},a._getInputMemoryOffset=function(){return(a._getInputMemoryOffset=a.asm.t).apply(null,arguments)},a._getInputHeight=function(){return(a._getInputHeight=a.asm.u).apply(null,arguments)},a._getInputWidth=function(){return(a._getInputWidth=a.asm.v).apply(null,arguments)},a._getInputChannelCount=function(){return(a._getInputChannelCount=a.asm.w).apply(null,arguments)},a._getOutputMemoryOffset=function(){return(a._getOutputMemoryOffset=a.asm.x).apply(null,arguments)},a._getOutputHeight=function(){return(a._getOutputHeight=a.asm.y).apply(null,arguments)},a._getOutputWidth=function(){return(a._getOutputWidth=a.asm.z).apply(null,arguments)},a._getOutputChannelCount=function(){return(a._getOutputChannelCount=a.asm.A).apply(null,arguments)},a._loadModel=function(){return(a._loadModel=a.asm.B).apply(null,arguments)},a._runInference=function(){return(a._runInference=a.asm.C).apply(null,arguments)},a.___errno_location=function(){return(ee=a.___errno_location=a.asm.E).apply(null,arguments)});function te(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function re(e){function t(){J||(J=!0,a.calledRun=!0,A||(H(S),H(P),r(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),L.unshift(e);var e;H(L)}()))}e=e||f,C>0||(function(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),I.unshift(e);var e;H(I)}(),C>0||(a.setStatus?(a.setStatus("Running..."),setTimeout((function(){setTimeout((function(){a.setStatus("")}),1),t()}),1)):t()))}if(F=function e(){J||re(),J||(F=e)},a.run=re,a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return re(),e.ready});e.exports=r},618:function(e){"use strict";function t(e,t){if(!n)return!1;const a=e.buffer;let i=l.get(a);if(null==i){if((i=r.validate(a))&&t)try{new r.Instance(new r.Module(a)).exports[0]()}catch(e){i=!1}l.set(a,i)}return i}const r=this.WebAssembly||globalThis.WebAssembly,n="object"==typeof r,a=e=>void 0!==e,i=(...e)=>Uint8Array.of(0,97,115,109,1,0,0,0,...e),o=(...e)=>Uint32Array.of(1836278016,1,...e),s=(...e)=>o(1610679297,33751040,...e,40239360,259),u=(...e)=>i(1,4,1,96,0,0,3,2,1,0,...e,11,0,10,4,110,97,109,101,2,3,1,0,0),c=(...e)=>Uint16Array.of(24832,28019,1,0,1025,24577,0,515,1,...e),f=(...e)=>c(...e,2842,4096,28164,28001,357,260,256,560,259,0),l=new WeakMap,h=o(1610679553,58589440,117440770,805372165,101318656,1107297281,268438272,1835101700,17039717,36700416,259),p=i(5,3,1,4,1,0,8,4,110,97,109,101,2,1,0),d=c(773,1,2561,269,11,65,65,65,3068,2816,2560,28164,28001,613,259,0),g=o(1610679297,33751040,134873089,100664833,185276736),m=i(2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1,0,8,4,110,97,109,101,2,1,0),y=Uint16Array.of(24832,28019,1,0,1537,24577,512,32639,515,1,2058,1537,16640,16640,2816,2560,28164,28001,613,259,0),w=f(3082,2561,17152,0,0,252),_=f(2058,1537,16640,49152),E=s(101318657,301990913,268438272,1835101700,17039717),b=u(5,4,1,3,1,1,10,7,1,5,0,254,3,0),v=s(84344833,6357249,17369600,4259847,186257917,1845758464),T=u(10,7,1,5,0,208,112,26);e.exports={support:(e=1)=>n&&t(Uint32Array.of(1836278016,e)),get supportStreaming(){return n&&a(r.instantiateStreaming)},feature:{get bigInt(){return t(h,!0)},get bulk(){return t(d)},get exceptions(){return t(g)},get memory64(){return t(p)},get mutableGlobal(){return t(m)},get multiValue(){return t(y)},get saturateConversions(){return t(w)},get signExtensions(){return t(_)},get tailCall(){return t(E)},get threads(){return t(b)},get simd(){return t(v)},get references(){return t(T)},get typeReflection(){return n&&a(r.Memory.type)},get funcReferences(){return n&&a(r.Function)}}}},61:function(e,t,r){var n=r(698).default;function a(){"use strict";\n/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exp
vendor: 4,513 bytes, line 1
1orts=a=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof d?t:d,i=Object.create(a.prototype),o=new R(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(a,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw i;return O()}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p={};function d(){}function g(){}function m(){}var y={};f(y,s,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(k([])));_&&_!==r&&i.call(_,s)&&(y=_);var E=m.prototype=d.prototype=Object.create(y);function b(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){function r(a,o,s,u){var c=h(e[a],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&i.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(l).then((function(e){f.value=e,s(f)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var a;this._invoke=function(e,n){function i(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(i,i):i()}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a \'throw\' method")}return p}var n=h(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function k(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:O}}function O(){return{value:void 0,done:!0}}return g.prototype=m,f(E,"constructor",m),f(m,"constructor",g),g.displayName=f(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,f(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},b(v.prototype),f(v.prototype,u,(function(){return this})),t.AsyncIterator=v,t.async=function(e,r,n,a,i){void 0===i&&(i=Promise);var o=new v(l(e,r,n,a),i);return t.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(E),f(E,c,"Generator"),f(E,s,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
1h(A),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;A(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,r){var n=r(61)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",function(){"use strict";function e(e,t,r,n,a,i,o){try{var s=e[i](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(a,i){var o=t.apply(r,n);function s(t){e(o,a,i,s,u,"next",t)}function u(t){e(o,a,i,s,u,"throw",t)}s(void 0)}))}}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=r(687),i=r.n(a);function o(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}function s(){return o()?(self.isWorker=!0,self):(window.isWorker=!1,window)}function u(e){return o()?e instanceof OffscreenCanvasRenderingContext2D:e instanceof CanvasRenderingContext2D}var c=function(e,t){let r;"string"==typeof e&&(e=document.getElementById(e));let n=t.preserveDrawingBuffer||!1,a=1;if("true"===t.use_webgl1?r=e.getContext("webgl",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}):(r=e.getContext("webgl2",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}),a=2,r||(a=1,r=e.getContext("webgl",{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:n}))),r.getExtension("WEBGL_draw_buffers")?r.disable_multi_draw=t.disable_multi_draw||!1:r.disable_multi_draw=!0,r.extensions={},r.getVersion=function(){return a}
1,1===r.getVersion()){if("float32"===t.float_type){if(r.extensions.EXT_FLOAT=r.getExtension("OES_texture_float"),!r.extensions.EXT_FLOAT)throw new Error("Extension not found: OES_texture_float");r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_float_linear"),r.extensions.EXT_FLOAT_LINEAR,r.texture_format=r.RGBA,r.texture_type=r.FLOAT}else{if(r.extensions.EXT_FLOAT=r.getExtension("OES_texture_half_float"),!r.extensions.EXT_FLOAT)throw new Error("Extension not found: OES_texture_half_float");r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_half_float_linear"),r.extensions.EXT_FLOAT_LINEAR,r.texture_format=r.RGBA,r.texture_type=r.extensions.EXT_FLOAT.HALF_FLOAT_OES}if(!r.disable_multi_draw&&(r.extensions.WEBGL_draw_buffers=r.getExtension("WEBGL_draw_buffers"),!r.extensions.WEBGL_draw_buffers))throw new Error("Extension not found: WEBGL_draw_buffers")}else{if(r.extensions.EXT_FLOAT=r.getExtension("EXT_color_buffer_float"),!r.extensions.EXT_FLOAT)throw new Error("Extension not found: EXT_color_buffer_float");"float32"===t.float_type?(r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_float_linear"),r.texture_format=r.RGBA32F,r.texture_type=r.FLOAT):(r.extensions.EXT_FLOAT_LINEAR=r.getExtension("OES_texture_half_float_linear"),r.texture_format=r.RGBA16F,r.texture_type=r.FLOAT)}return 1===r.getVersion()?(r.getCOLOR_ATTACHMENT=function(e=0){return r.disable_multi_draw?r.COLOR_ATTACHMENT0:r.extensions.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL+e},r.getDrawBuffers=function(e=[r.getCOLOR_ATTACHMENT(0)]){r.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(e)}):(r.getCOLOR_ATTACHMENT=function(e=0){return r.COLOR_ATTACHMENT0+e},r.getDrawBuffers=function(e=[r.getCOLOR_ATTACHMENT(0)]){r.drawBuffers(e)}),s().gl=r,r.canvas.w=r.canvas.width,r.canvas.h=r.canvas.height,r.clearCanvas=function(){r.clearColor(0,0,0,1),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT)},r.input={h:t.h,w:t.w},r.render_scale={h:1,w:1},r.viewport(0,0,e.width,e.height),r.createAndCompileShader=function(e,t){let n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(n));return n},r.createAndLinkProgram=function(e,t){let n=r.createProgram();if(r.attachShader(n,e),r.attachShader(n,t),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS))throw new Error(r.getProgramInfoLog(n));return n},r.resizeCanvasToDisplaySize=function(t,r){return(e.width!==t||e.height!==r)&&(e.width=t,e.height=r,!0)},r.resizeRenderSize=function(e,t,n){let a=n*r.input.w,i=n*r.input.h;a=e>a?e:a,i=t>i?t:i,r.render_scale={w:e/a,h:t/i},r.resizeCanvasToDisplaySize(a,i)},r._refs={textures:[],buffers:[]},r.storeRef=(e,t)=>{"texture"===e?r._refs.textures.push(t):"buffer"===e&&r._refs.buffers.push(t)},r.clearRefs=()=>{r._refs.textures.forEach((e=>r.deleteTexture(e))),r._refs.buffers.forEach((e=>r.deleteBuffer(e))),r._refs={textures:[],buffers:[]}},r.log=function(e){},r};var f=class{constructor(e,t,r,n){this.gl=e,this.network=t,this.network.upscaleFactor=this.network.upscaleFactor||1,this.frameBuffer=r,this.renderSize={w:n.w,h:n.h},this.metrics={"Render Size":this.renderSize,"Original Size":e.input,"Upscale Factor":this.network.upscaleFactor,FPS:0},this.setProperties(n)}setProperties(e={w:1278,h:720,disableVideoToCanvas:!1}){const t=this;!0!==e.disableVideoToCanvas&&this.frameBuffer.setInputFrameCanvas(),void 0===e.w&&(e.w=this.network.upscaleFactor*this.gl.input.w),void 0===e.h&&(e.h=this.network.upscaleFactor*this.gl.input.h),this.renderSize=e,this.gl.resizeRenderSize(e.w,e.h,this.network.upscaleFactor),null!==this.frameBuffer.inputTex&&setTimeout((()=>{t.network.renderRGB&&t.network.renderRGB(t.gl.render_scale)})),t.metrics["Render Size"]=e}setInputSize(e={w:426,h:240},t=null){this.gl.input={w:e.w,h:e.h},this.network.resetTextureBuffers(),this.setProperties(t||this.renderSize)}async resetNetwork(e){this.frameBuffer.clearall(),this.gl.clearRefs(),this.network=await async function(e={name:"",version:"",tag:"",token:""},t,r){let n=null,a=null;try{a=await H(e.name,e.tag,e.version,e.token)}catch(e){throw console.error("%cParameter load failed:","background:black; color: yellow"),new Error(e)}if(!a)throw console.error("%cParameter load failed:","background:black; color: yellow"),new Error("");try{const i=z(e.name,e.token);n=await i,n=new n(t,r,a)}catch(e){throw console.error("%cNetwork load failed:","background:black; color: yellow"),new Error(e)}return n}({name:e.name,version:e.version,tag:e.tag},this.gl,this.network.frameBuffer),this.frameBuffer=this.network.frameBuffer,this.gl=this.network.gl,this.setProperties(this.renderSize)}changeNetwork(e){this.network=e,this.frameBuffer=this.network.frameBuffer,this.gl=this.network.gl}async loadBitmap(e){const t=this.frameBuffer;this.network;t.setInputImage(e),await this.render()}loadImage(e){const t=new Image;t.src=e;const r=this.frameBuffer,n=this;t.onload=async function(){r.setInputImage(t),await n.render()}}async render(e){const t=this.gl,r=this.network;t.clearColor(0,0,0,1),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),r.initialized&&await r.initialized,await r.feedForward(t.render_scale,e),t.flush()}async previewRender(e){const t=this.gl,r=this.network;r.initialized&&await r.initialized,await r.previewForward(e),t.flush()}};var l=class{constructor(e){this.gl=e,this.iterations=0,this.textures=[{},{}],this.frame_buffers=[{},{}],this.inputTex=null,this.inputCanvas=null,this.frame_difference=0}drawToCanvas(){const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null)}setBuffer(e){const t=this.gl,r=this.iterations%2*this.frame_difference;t.bindFramebuffer(t.FRAMEBUFFER,this.frame_buffers[r][e])}setInputFrameCanvas(){s();u(this.inputCanvas)||(this.inputCanvas=function(e,t){if(o())return new OffscreenCanvas(e,t);{const r=document.createElement("canvas");return r.width=e,r.height=t,r}}(this.gl.input.w,this.gl.input.h).getContext("2d")),this.inputCanvas.canvas.width=this.gl.input.w,this.inputCanvas.canvas.height=this.gl.input.h}videoToCanvas(e){return this.inputCanvas.drawImage(e,0,0,this.gl.input.w,this.gl.input.h),this.inputCanvas.canvas}getInputTexture(e=!1){const t=this.gl;if(null===this.inputTex||e){e&&this.inputTex instanceof WebGLTexture&&t.deleteTexture(this.inputTex);let r=t.createTexture();this.inputTex=this._setTextureSize(r,t.input.w,t.input.h)}return this.inputTex}updateInputTexture(){this.getInputTexture(!0)}setInputImage(e){this.input=e;const t=this.gl;u(this.inputCanvas)&&1===t.getVersion()&&(e=this.videoToCanvas(e));let r=this.getInputTexture();t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.texture_format,t.RGBA,t.texture_type,e);for(let e=0;e<=this.frame_difference;e++)this.textures[e].INPUT=[r]}setImageAsTexture(e,t){const r=this.gl;let n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,r.texture_format,r.RGBA,r.texture_type,e);for(let e=0;e<=this.frame_difference;e++)this.textures[e][t]=[n]}createBufferWithTextures(e,t,r=1,n=null){const a=this.gl;for(let i=0;i<=this.frame_difference;i++){const o=a.createFramebuffer();this.frame_buffers[i][e]=o,a.bindFramebuffer(a.FRAMEBUFFER,o);const s=[];this.textures[i][e]=null;for(let e=0;e<t;++e){let t=this.createAndSetupTexture(n);t=this._setTextureSize(t,a.input.w*r,a.input.h*r),s.push(t),a.bindTexture(a.TEXTURE_2D,t),a.texImage2D(a.TEXTURE_2D,0,a.texture_format,a.input.w*r,a.input.h*r,0,a.RGBA,a.texture_type,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.getCOLOR_ATTACHMENT(e),a.TEXTURE_2D,t,0)}this.textures[i][e]=s}}createBufferWithTextures2(e,t,r,n,a={}){const i=this.gl;if(r<=0||n<=0)throw new Error("Texture width and height must be greater than 0");let o=a.format||i.RGBA,s=a.minFilter||i.NEAREST,u=a.magFilter||i.NEAREST,c=a.type||i.texture_type||i.UNSIGNED_BYTE,f=a.internalFormat||i.texture_format||i.RGBA;for(let a=0;a<=this.frame_difference;a++){const l=i.createFramebuffer();this.frame_buffers[a][e]=l,i.bindFramebuffer(i.FRAMEBUFFER,l);const h=[];this.textures[a][e]=null;for(let e=0;e<t;++e){let t;1===i.getVersion()?t=this.createTexture_webgl1(f,r,n,o,c,s,u):(f===i.RGBA&&(f=i.RGBA8),t=this.createTexture_webgl2(f,r,n,s,u)),i.framebufferTexture2D(i.FRAMEBUFFER,i.getCOLOR_ATTACHMENT(e),i.TEXTURE_2D,t,0),h.push(t)}this.textures[a][e]=h}}getTextureSize(e,t=0,r=0){if(!this.textures[t][e][r])throw new Error(`Failed to get resolution of textures for layer: ${e} at index: ${index}`);return this.textures[t][e][r].size}createTexture_webgl2(e,t,r,n,a){n=n||gl.NEAREST,a=a||gl.NEAREST,e=e||gl.texture_format||gl.RGBA;let i=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,i),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,n),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,a),gl.texStorage2D(gl.TEXTURE_2D,1,e,t,r),i=this._setTextureSize(i,t,r),i}createTexture_webgl1(e,t,r,n,a,i,o){n=n||gl.RGBA,i=i||gl.NEAREST,o=o||gl.NEAREST,a=a||gl.texture_type||gl.UNSIGNED_BYTE,e=e||gl.texture_format||gl.RGBA;let s=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,s),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,i),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,o),gl.texImage2D(gl.TEXTURE_2D,0,e,t,r,0,n,a,null),s=this._setTextureSize(s,t,r),s}createFloatTextureFromArrayBuffer(e,t,r,n,a,i,o,s){i=i||gl.RGBA,o=o||gl.NEAREST,s=s||gl.NEAREST,a=a||gl.texture_type||gl.UNSIGNED_BYTE,t=t||gl.texture_format||gl.RGBA;const u=new Float32Array(e);let c=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,c),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,o),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,s),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA32F,r,n,0,gl.RGBA,gl.FLOAT,u),c=this._setTextureSize(c,r,n),c}_setTextureSize(e,t,r){return t>0&&r>0&&(e.size={},e.size.width=t,e.size.height=r),e}setBufferForLayer(e,t){for(let r=0;r<=this.frame_difference;r++){const n=gl.createFramebuffer();this.frame_buffers[r][e]=n,gl.bindFramebuffer(gl.FRAMEBUFFER,n);for(let e=0;e<t.length;e++)gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.getCOLOR_ATTACHMENT(e),gl.TEXTURE_2D,t[e],0);this.textures[r][e]=t}}getTexture(e){const t=this.iterations%2*this.frame_difference;return this.textures[t][e]}getLastFrameTexture(e){const t=1-this.iterations%2;return this.textures[t][e]}
1clearall(){Object.keys(this.textures[0]).forEach((e=>{destroyTextureAndBuffer(e)})),this.gl.deleteTexture(this.inputTex),this.inputTex=null,this.inputCanvas=null,this.frame_buffers=[{},{}],this.textures=[{},{}],this.gl.clearCanvas()}destroyTextureAndFrameBuffer(e){for(let t=0;t<=this.frame_difference;t++)if(this.frame_buffers[t][e]&&(this.gl.deleteFramebuffer(this.frame_buffers[t][e]),this.frame_buffers[t][e]=null),this.textures[t][e])for(let r=0;r<this.textures[t][e].length;++r)this.gl.deleteTexture(this.textures[t][e][r]),this.textures[t][e][r]=null}createAndSetupTexture(e=null){const t=this.gl;t.extensions.EXT_FLOAT_LINEAR||(e=null),null===e&&(e=t.NEAREST);const r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),r}};r(259);function h(e){return new Promise(((t,r)=>{const n="$importModule$"+Math.random().toString(32).slice(2),a=document.createElement("script"),i=()=>{delete window[n],a.onerror=null,a.onload=null,a.remove(),URL.revokeObjectURL(a.src),a.src=""};a.defer="defer",a.type="module",a.onerror=()=>{r(new Error(`Failed to import: ${e}`)),i()},a.onload=()=>{t(window[n]),i()};const o=function(e){const t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e),s=new Blob([`import * as m from "${o}"; window.${n} = m;`],{type:"text/javascript"});a.src=URL.createObjectURL(s),document.head.appendChild(a)}))}var p=r(618),d=r(497),g=r.n(d),m=r(958),y=r.n(m),w="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==w&&w,_="URLSearchParams"in w,E="Symbol"in w&&"iterator"in Symbol,b="FileReader"in w&&"Blob"in w&&function(){try{return new Blob,!0}catch(e){return!1}}(),v="FormData"in w,T="ArrayBuffer"in w;if(T)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(e){return e&&x.indexOf(Object.prototype.toString.call(e))>-1};function R(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\\-#$%&\'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError(\'Invalid character in header field name: "\'+e+\'"\');return e.toLowerCase()}function k(e){return"string"!=typeof e&&(e=String(e)),e}function O(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return E&&(t[Symbol.iterator]=function(){return t}),t}function B(e){this.map={},e instanceof B?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function I(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function S(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function P(e){var t=new FileReader,r=S(t);return t.readAsArrayBuffer(e),r}function L(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function C(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:b&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:v&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:_&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():T&&b&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=L(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):T&&(ArrayBuffer.prototype.isPrototypeOf(e)||A(e))?this._bodyArrayBuffer=L(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):_&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},b&&(this.blob=function(){var e=I(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=I(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(P)}),this.text=function(){var e,t,r,n=I(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=S(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},v&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}B.prototype.append=function(e,t){e=R(e),t=k(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},B.prototype.delete=function(e){delete this.map[R(e)]},B.prototype.get=function(e){return e=R(e),this.has(e)?this.map[e]:null},B.prototype.has=function(e){return this.map.hasOwnProperty(R(e))},B.prototype.set=function(e,t){this.map[R(e)]=k(t)},B.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},B.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),O(e)},B.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),O(e)},B.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),O(e)},E&&(B.prototype[Symbol.iterator]=B.prototype.entries);
1var U=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function F(e,t){if(!(this instanceof F))throw new TypeError(\'Please use the "new" operator, this DOM object constructor cannot be called as a function.\');var r,n,a=(t=t||{}).body;if(e instanceof F){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new B(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new B(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),U.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(a),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function D(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\\+/g," "),a=r.join("=").replace(/\\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(a))}})),t}function M(e,t){if(!(this instanceof M))throw new TypeError(\'Please use the "new" operator, this DOM object constructor cannot be called as a function.\');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new B(t.headers),this.url=t.url||"",this._initBody(e)}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})},C.call(F.prototype),C.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new B(this.headers),url:this.url})},M.error=function(){var e=new M(null,{status:0,statusText:""});return e.type="error",e};var N=[301,302,303,307,308];M.redirect=function(e,t){if(-1===N.indexOf(t))throw new RangeError("Invalid status code");return new M(null,{status:t,headers:{location:e}})};var X=w.DOMException;try{new X}catch(e){(X=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),X.prototype.constructor=X}function G(e,t){return new Promise((function(r,n){var a=new F(e,t);if(a.signal&&a.signal.aborted)return n(new X("Aborted","AbortError"));var i=new XMLHttpRequest;function o(){i.abort()}i.onload=function(){var e,t,n={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",t=new B,e.replace(/\\r?\\n[\\t ]+/g," ").split("\\r").map((function(e){return 0===e.indexOf("\\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var a=r.join(":").trim();t.append(n,a)}})),t)};n.url="responseURL"in i?i.responseURL:n.headers.get("X-Request-URL");var a="response"in i?i.response:i.responseText;setTimeout((function(){r(new M(a,n))}),0)},i.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},i.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},i.onabort=function(){setTimeout((function(){n(new X("Aborted","AbortError"))}),0)},i.open(a.method,function(e){try{return""===e&&w.location.href?w.location.href:e}catch(t){return e}}(a.url),!0),"include"===a.credentials?i.withCredentials=!0:"omit"===a.credentials&&(i.withCredentials=!1),"responseType"in i&&(b?i.responseType="blob":T&&a.headers.get("Content-Type")&&-1!==a.headers.get("Content-Type").indexOf("application/octet-stream")&&(i.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof B?a.headers.forEach((function(e,t){i.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){i.setRequestHeader(e,k(t.headers[e]))})),a.signal&&(a.signal.addEventListener("abort",o),i.onreadystatechange=function(){4===i.readyState&&a.signal.removeEventListener("abort",o)}),i.send(void 0===a._bodyInit?null:a._bodyInit)}))}G.polyfill=!0,w.fetch||(w.fetch=G,w.Headers=B,w.Request=F,w.Response=M);const W=s(),j=async()=>{let e;if(W.tflite)e=W.tflite;else{let t=W.vectorlyBasePath||"";try{if(!0!==p.feature.simd)throw new Error("SIMD feature check is false");e=await g()({basePath:t})}catch(r){e=await y()({basePath:t})}}return e};let z=async(e,t={})=>{let n,a=((t=t||{}).path||r.p)+`models/${e}.js`;if(t.token&&(a=a+"?"+t.token),W.vectorlyBasePath=t.path||r.p,"background_selfie"===e&&(n=j()),W.isWorker)importScripts(a);else{await h(a)}return"background_selfie"===e&&(W.tflite=await n),W.vectorly.models[e]},H=async(e,t,n,a)=>
1{if(a=a||{},"background_selfie"===e){let i=(a.path||r.p)+`./data/${e}/${t}_v${n}.tflite`;a.token&&(i=i+"?"+a.token);const o=await fetch(i);if(!o.ok)throw Error(`Response fetching "${i}": ${o.statusText}`);return{model:await o.arrayBuffer()}}if("background_webgl2"===e||"background_webgl2_v2"===e||"background_webgl"===e||"background_webgl_unet"===e||"background_rbnet"===e||"relighting_zdce"===e){"background_webgl2_v2"===e&&(e="background_webgl2");let i=(a.path||r.p)+`./data/${e}/${t}_v${n}.json`,o=(a.path||r.p)+`./data/${e}/${t}_v${n}.weights`;a.token&&(i+="?"+a.token,o+="?"+a.token);const[s,u]=await Promise.all([fetch(i),fetch(o)]),[c,f]=await Promise.all([s.json(),u.arrayBuffer()]),l=JSON.parse(JSON.stringify(c)),h=new Float32Array(f),p=Object.keys(c),d=["weights","biases"];c[p[0]].debugImage&&d.push("debugImage");for(let e of p)for(let t of d){let[r,n]=c[e][t];l[e][t]=h.slice(n,n+r)}return l}{let i=(a.path||r.p)+`./data/${e}/${t}_v${n}.json`;a.token&&(i=i+"?"+a.token);const o=await fetch(i);return await o.json()}};var $=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var r,a,o,s,u,h,p,d,g,m,y,w,_,E,b;return r=e,a=[{key:"preloadBackground",value:(b=t(i().mark((function e(t){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t.background){e.next=17;break}return e.prev=1,e.next=4,fetch(t.background);case 4:return r=e.sent,e.next=7,r.blob();case 7:return self.preloadedBackground=e.sent,e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(1),console.warn("Vectorly: unable to load ".concat(t.background," as a background image")),e.abrupt("return",!1);case 15:e.next=20;break;case 17:if(!(t.background instanceof ImageBitmap)){e.next=20;break}return self.preloadedBackground=t.background,e.abrupt("return",!0);case 20:case"end":return e.stop()}}),e,null,[[1,11]])}))),function(e){return b.apply(this,arguments)})},{key:"getNetwork",value:(E=t(i().mark((function e(t){var r,n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.token,e.next=3,z(r,n);case 3:this.NetworkClass=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"getParameters",value:(_=t(i().mark((function e(t){var r,n,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.tag,a=t.version,o=t.token,this.networkParams={name:r,tag:n,version:a},e.next=4,H(r,n,a,o);case 4:this.networkParameters=e.sent;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"initWebGLContext",value:(w=t(i().mark((function e(t){var r,n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.options,this.gl=new c(r,n),this.canvas=r,this.setupLostContextListener(),e.abrupt("return",!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"setupLostContextListener",value:function(){this.canvas.addEventListener("webglcontextlost",(function(){console.warn("The WebGL Context was lost")}))}},{key:"loseContext",value:(y=t(i().mark((function e(){var t;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.gl){e.next=10;break}if(!(t=this.gl.getExtension("WEBGL_lose_context"))){e.next=7;break}return t.loseContext(),e.abrupt("return",!0);case 7:case 10:return e.abrupt("return",!1);case 8:e.next=11;break;case 11:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"render",value:(m=t(i().mark((function e(t){var r,n,a,o,s,u;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.inputImage,!this.gl.isContextLost()){e.next=3;break}throw new Error("WebGL context is lost");case 3:if(this.frameBuffer&&this.frameBuffer.setInputImage(r),!0!==t.preview){e.next=31;break}if(e.t0=this.renderer,!e.t0){e.next=9;break}return e.next=9,this.renderer.render({videoBitmap:t.videoBitmap,computeMask:!0});case 9:return t&&t.videoBitmap&&t.videoBitmap.close(),e.next=12,createImageBitmap(this.gl.canvas);case 12:if(a=e.sent,!0===t.previewCamView){e.next=24;break}if(e.t1=this.renderer,!e.t1){e.next=18;break}return e.next=18,this.renderer.previewRender({previewVideoBitmap:t.previewVideoBitmap});case 18:return e.next=20,createImageBitmap(this.gl.canvas);case 20:o=e.sent,n={bitmap:a,previewBitmap:o},e.next=29;break;case 24:if(!0!==t.previewCamView){e.next=29;break}return e.next=27,createImageBitmap(r);case 27:s=e.sent,n={bitmap:a,previewBitmap:s};case 29:e.next=39;break;case 31:if(e.t2=this.renderer,!e.t2){e.next=35;break}return e.next=35,this.renderer.render({videoBitmap:t.videoBitmap});case 35:return e.next=37,createImageBitmap(this.gl.canvas);case 37:u=e.sent,n={bitmap:u};case 39:return r.close(),e.abrupt("return",n);case 41:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"instantiateNetwork",value:(g=t(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.networkOptions=t.networkOptions,!this.gl){e.next=11;break}return this.frameBuffer=new l(this.gl),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.initialized=this.networkInstance.initialized,e.next=8,this.initialized;case 8:return e.abrupt("return",!0);case 11:throw Error("this.gl is ".concat(this.gl,": maybe called instantiateNetwork without calling initWebGLContext?"));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"initRenderer",value:(d=t(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.renderInputSize=t.renderInputSize,this.renderer=new f(this.gl,this.networkInstance,this.frameBuffer,this.renderInputSize),e.abrupt("return",!0);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"setRenderSize",value:(p=t(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.renderInputSize=t.renderInputSize,this.renderer&&this.renderer.setProperties(this.renderInputSize);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setInputSize",value:(h=t(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.inputSize=t.inputSize,this.renderer&&this.renderer.setInputSize(this.inputSize);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"changeNetwork",value:(u=t(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.networkOptions=t.networkOptions,this.gl&&(this.frameBuffer&&this.frameBuffer.clearall(),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.renderer.changeNetwork(this.networkInstance));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"updateOptions",value:(s=t(i().mark((function e(t){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.update,e.next=3,this.networkInstance.updateOptions(r);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})}
1],a&&n(r.prototype,a),o&&n(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(),q=$;function V(e,t){const{cmd:r,msgId:n}=e,a="w-"+r;"render"===r&&t.bitmap?(t.previewBitmap?(self.postMessage({cmd:a,msgId:n,ret:t},[t.bitmap,t.previewBitmap]),t.previewBitmap.close()):self.postMessage({cmd:a,msgId:n,ret:t},[t.bitmap]),t.bitmap.close()):self.postMessage({cmd:a,msgId:n,ret:t})}self.glWorker=new q,self.onmessage=async function(e){const{cmd:t,params:r}=e.data;if(self.glWorker[t]&&"function"==typeof self.glWorker[t])try{const n=await self.glWorker[t](r);V(e.data,n)}catch(t){console.error("Caught error",t),V(e.data,{error:t.toString()})}else console.error(`No function ${t} for glWorker`),V(e.data,{error:`No function ${t} for glWorker`})}}()}();',"Worker",void 0,void 0)}var g=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o.Z)(this,e);var r=new AudioContext,n=r.createOscillator(),i=r.createMediaStreamDestination(),a=r.createGain();a.gain.setValueAtTime(0,r.currentTime),n.connect(a),a.connect(r.destination),n.type=t.waveform||"sine",n.frequency.setValueAtTime(t.frequency||50,r.currentTime),n.start();var s=document.createElement("audio");s.srcObject=i.stream,document.body.appendChild(s),s.play(),this.audio=s,this.gainNode=a,this.audioContext=r,this.volume=t.volume||5e-4,this.duration=t.duration||.2,this.interval=t.interval||1e4}return(0,s.Z)(e,[{key:"pulse",value:function(){this.gainNode.gain.setValueAtTime(this.volume,this.audioContext.currentTime),this.gainNode.gain.setValueAtTime(0,this.audioContext.currentTime+this.duration)}},{key:"enable",value:function(){var e=this;e.pulse(),e.intervalHandle=setInterval(function(){e.pulse()},this.interval)}},{key:"disable",value:function(){clearInterval(this.intervalHandle)}}]),e}(),v=function(){var e,t,r;function n(e){(0,o.Z)(this,n),this.worker=new m,this.id=e.id||(0,h.Z)(),this.framerate=e.framerate,this.preview=!1,this.periodicAudio=e.periodicAudio}return(0,s.Z)(n,[{key:"destroy",value:function(){this.worker&&this.worker.terminate()}},{key:"__loseContext",value:function(){return this.sendMessageToWorker("loseContext",{}).retValP}},{key:"preloadBackground",value:(r=(0,i.Z)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",!1);case 2:return"string"==typeof t?r=this.sendMessageToWorker("preloadBackground",{background:t}).retValP:(this.preloaded=t,r=this.sendMessageToWorker("preloadBackground",{background:t},[t]).retValP),e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"getParameters",value:function(e,t,r,n){return this.sendMessageToWorker("getParameters",{name:e,tag:t,version:r,token:n}).retValP}},{key:"getNetwork",value:function(e,t){return this.sendMessageToWorker("getNetwork",{name:e,token:t}).retValP}},{key:"initWebGLContext",value:function(e,t){return this.sendMessageToWorker("initWebGLContext",{canvas:e,options:t},[e]).retValP}},{key:"initRenderer",value:function(e){return this.sendMessageToWorker("initRenderer",{renderInputSize:e}).retValP}},{key:"setRenderSize",value:function(e){return this.sendMessageToWorker("setRenderSize",{renderInputSize:e}).retValP}},{key:"setInputSize",value:function(e){return this.sendMessageToWorker("setInputSize",{inputSize:e}).retValP}},{key:"instantiateNetwork",value:function(e){return"string"!=typeof e.background.image&&delete e.background.image,this.sendMessageToWorker("instantiateNetwork",{networkOptions:e}).retValP}},{key:"changeNetwork",value:function(e){return this.sendMessageToWorker("changeNetwork",{networkOptions:e}).retValP}},{key:"updateOptions",value:function(e){return e.framerate&&(this.framerate=Math.min(e.framerate||24,this.trackFrameRate)),(0,f.ok)()&&console.log(e),this.preview=!!(e&&e.preview&&e.preview.previewType),this.previewCamView=!(!e||!e.previewCamView),e.background&&e.background.image instanceof ImageBitmap?this.sendMessageToWorker("updateOptions",{update:e},[e.background.image]):e.preview&&e.preview.previewImage instanceof ImageBitmap?this.sendMessageToWorker("updateOptions",{update:e},[e.preview.previewImage]):this.sendMessageToWorker("updateOptions",{update:e})}},{key:"_getImageCapture",value:function(e){if(e instanceof MediaStream)t=e;else{if(!(e instanceof HTMLVideoElement))throw Error("input in _getImageCapture is neither MediaStream nor HTMLVideoElement: ".concat(e));t=e.captureStream()}var t,r=t.getVideoTracks(),n=(0,l.Z)(r,1)[0];(0,f.ok)()&&console.log("In _getImageCapture",n);var i=document.createElement("video");if(i.width=n.getSettings().width,i.height=n.getSettings().height,this.periodicAudio){var a=new g(this.periodicAudio);document.addEventListener("visibilitychange",function(){document.hidden?a.enable():a.disable()})}return i.srcObject=t,i.play(),this.video=i,this.trackFrameRate=n.getSettings().frameRate,this.framerate=Math.min(this.framerate||24,this.trackFrameRate),this.lastRenderTime=performance.now(),i}},{key:"_setInput",value:function(e){(0,f.ok)()&&console.log("imageCapInstance",this.imageCapInstance),e instanceof ImageBitmap?this.imageBitmap=e:this.imageCapInstance=this._getImageCapture(e)}},{key:"render",value:(t=(0,i.Z)(c().mark(function e(t){var r,n,i,a,o,s;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.imageCapInstance&&!this.imageBitmap){e.next=44;break}if(e.prev=1,e.t0=this.imageBitmap,e.t0){e.next=7;break}return e.next=6,createImageBitmap(this.video);case 6:e.t0=e.sent;case 7:if(r=e.t0,e.t1=void 0!==t.bgVideo,!e.t1){e.next=13;break}return e.next=12,createImageBitmap(t.bgVideo);case 12:e.t1=e.sent;case 13:if(n=e.t1,e.t2=t.previewVideo instanceof HTMLVideoElement,!e.t2){e.next=19;break}return e.next=18,createImageBitmap(t.previewVideo);case 18:e.t2=e.sent;case 19:if(i=e.t2,(0,f.ok)()&&console.log("grabFrame.then",this,r),!((a=Math.round(1e3/this.framerate)-(performance.now()-this.lastRenderTime))>0)){e.next=25;break}return e.next=25,new Promise(function(e){setTimeout(e,a)});case 25:if(this.lastRenderTime=performance.now(),!t.passthrough||this.preview&&!this.previewCamView){e.next=28;break}return e.abrupt("return",new Promise(function(e){e({bitmap:r})}));case 28:return o=[r],n&&o.push(n),i&&o.push(i),s=this.sendMessageToWorker("render",{preview:this.preview||!1,previewCamView:this.previewCamView||!1,passthrough:t.passthrough,inputImage:r,videoBitmap:n,previewVideoBitmap:i},o).retValP,n&&n.close(),i&&i.close(),r.close(),e.abrupt("return",s);case 38:return e.prev=38,e.t3=e.catch(1),(0,f.ok)()&&console.error("in render",e.t3),e.abrupt("return",!1);case 42:e.next=46;break;case 44:return(0,f.ok)()&&console.error("this.imageCapInstance",this.imageCapInstance),e.abrupt("return",!1);case 46:case"end":return e.stop()}},e,this,[[1,38]])})),function(e){return t.apply(this,arguments)})},{key:"sendMessageToWorker",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];(0,f.ok)()&&"render"!==e&&console.log("sendMessageToWorker",e,t,r);var n=(0,h.Z)(),i=this.getWorkerMessage(e,n);return this.worker.postMessage({cmd:e,msgId:n,params:t},r),{msgId:n,retValP:i}}},{key:"getWorkerMessage",value:(e=(0,i.Z)(c().mark(function e(t,r){var n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.worker,e.abrupt("return",new Promise(function(e,i){var a="w-"+t,o=new AbortController;n.addEventListener("message",function(n){if((0,f.ok)()&&"render"!==t&&console.log("Message event",n),n.data.cmd===a&&n.data.msgId===r){if((0,f.ok)()&&"render"!==t&&console.log("Aborting",n.data),n.data.ret&&n.data.ret.error)i(n.data.ret.error);else{var s=void 0===n.data.ret||n.data.ret;(0,f.ok)()&&"render"!==t&&console.log("resolving",n.data,s),e(s)}o.abort()}},{signal:o.signal})}));case 2:case"end":return e.stop()}},e,this)})),function(t,r){return e.apply(this,arguments)})}]),n}(),b=r(1033),w=r(7337),y=r(3820),k=r(3058),x=function(){var e,t,r,n,a,u,l,h,f,d,p,m;function g(){(0,o.Z)(this,g)}
1return(0,s.Z)(g,[{key:"preloadBackground",value:(m=(0,i.Z)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t.background){e.next=17;break}return e.prev=1,e.next=4,fetch(t.background);case 4:return r=e.sent,e.next=7,r.blob();case 7:return self.preloadedBackground=e.sent,e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(1),console.warn("Vectorly: unable to load ".concat(t.background," as a background image")),e.abrupt("return",!1);case 15:e.next=20;break;case 17:if(!(t.background instanceof ImageBitmap)){e.next=20;break}return self.preloadedBackground=t.background,e.abrupt("return",!0);case 20:case"end":return e.stop()}},e,null,[[1,11]])})),function(e){return m.apply(this,arguments)})},{key:"getNetwork",value:(p=(0,i.Z)(c().mark(function e(t){var r,n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.token,e.next=3,(0,k.Hy)(r,n);case 3:this.NetworkClass=e.sent;case 4:case"end":return e.stop()}},e,this)})),function(e){return p.apply(this,arguments)})},{key:"getParameters",value:(d=(0,i.Z)(c().mark(function e(t){var r,n,i,a;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.tag,i=t.version,a=t.token,this.networkParams={name:r,tag:n,version:i},e.next=4,(0,k.ZS)(r,n,i,a);case 4:this.networkParameters=e.sent;case 5:case"end":return e.stop()}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"initWebGLContext",value:(f=(0,i.Z)(c().mark(function e(t){var r,n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.options,this.gl=new k.yb(r,n),this.canvas=r,this.setupLostContextListener(),e.abrupt("return",!0);case 5:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"setupLostContextListener",value:function(){this.canvas.addEventListener("webglcontextlost",function(){console.warn("The WebGL Context was lost")})}},{key:"loseContext",value:(h=(0,i.Z)(c().mark(function e(){var t;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.gl){e.next=10;break}if(!(t=this.gl.getExtension("WEBGL_lose_context"))){e.next=7;break}return t.loseContext(),e.abrupt("return",!0);case 7:case 10:return e.abrupt("return",!1);case 8:e.next=11;break;case 11:case"end":return e.stop()}},e,this)})),function(){return h.apply(this,arguments)})},{key:"render",value:(l=(0,i.Z)(c().mark(function e(t){var r,n,i,a,o;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.inputImage,!this.gl.isContextLost()){e.next=3;break}throw Error("WebGL context is lost");case 3:if(this.frameBuffer&&this.frameBuffer.setInputImage(r),!0!==t.preview){e.next=31;break}if(e.t0=this.renderer,!e.t0){e.next=9;break}return e.next=9,this.renderer.render({videoBitmap:t.videoBitmap,computeMask:!0});case 9:return t&&t.videoBitmap&&t.videoBitmap.close(),e.next=12,createImageBitmap(this.gl.canvas);case 12:if(i=e.sent,!0===t.previewCamView){e.next=24;break}if(e.t1=this.renderer,!e.t1){e.next=18;break}return e.next=18,this.renderer.previewRender({previewVideoBitmap:t.previewVideoBitmap});case 18:return e.next=20,createImageBitmap(this.gl.canvas);case 20:a=e.sent,n={bitmap:i,previewBitmap:a},e.next=29;break;case 24:if(!0!==t.previewCamView){e.next=29;break}return e.next=27,createImageBitmap(r);case 27:o=e.sent,n={bitmap:i,previewBitmap:o};case 29:e.next=39;break;case 31:if(e.t2=this.renderer,!e.t2){e.next=35;break}return e.next=35,this.renderer.render({videoBitmap:t.videoBitmap});case 35:return e.next=37,createImageBitmap(this.gl.canvas);case 37:n={bitmap:e.sent};case 39:return r.close(),e.abrupt("return",n);case 41:case"end":return e.stop()}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"instantiateNetwork",value:(u=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.networkOptions=t.networkOptions,!this.gl){e.next=11;break}return this.frameBuffer=new k.uL(this.gl),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.initialized=this.networkInstance.initialized,e.next=8,this.initialized;case 8:return e.abrupt("return",!0);case 11:throw Error("this.gl is ".concat(this.gl,": maybe called instantiateNetwork without calling initWebGLContext?"));case 12:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"initRenderer",value:(a=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.renderInputSize=t.renderInputSize,this.renderer=new k.Th(this.gl,this.networkInstance,this.frameBuffer,this.renderInputSize),e.abrupt("return",!0);case 3:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"setRenderSize",value:(n=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.renderInputSize=t.renderInputSize,this.renderer&&this.renderer.setProperties(this.renderInputSize);case 2:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setInputSize",value:(r=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.inputSize=t.inputSize,this.renderer&&this.renderer.setInputSize(this.inputSize);case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"changeNetwork",value:(t=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.networkOptions=t.networkOptions,this.gl&&(this.frameBuffer&&this.frameBuffer.clearall(),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.renderer.changeNetwork(this.networkInstance));case 2:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"updateOptions",value:(e=(0,i.Z)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.update,e.next=3,this.networkInstance.updateOptions(r);case 3:case"end":return e.stop()}},e,this)})),function(t){return e.apply(this,arguments)})}]),g}(),_=function(){var e,t;function r(e){(0,o.Z)(this,r),this.id=e.id||(0,h.Z)(),this.framerate=e.framerate,this.preview=!1,this.periodicAudio=e.periodicAudio,this.worker=new x}return(0,s.Z)(r,[{key:"destroy",value:function(){}},{key:"__loseContext",value:function(){return this.worker.loseContext()}}
1,{key:"preloadBackground",value:(t=(0,i.Z)(c().mark(function e(t){return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",!1);case 2:return e.abrupt("return",this.worker.preloadBackground({background:t}));case 3:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"getParameters",value:function(e,t,r,n){return this.worker.getParameters({name:e,tag:t,version:r,token:n})}},{key:"getNetwork",value:function(e,t){return this.worker.getNetwork({name:e,token:t})}},{key:"initWebGLContext",value:function(e,t){return this.worker.initWebGLContext({canvas:e,options:t})}},{key:"initRenderer",value:function(e){return this.worker.initRenderer({renderInputSize:e})}},{key:"setRenderSize",value:function(e){return this.worker.setRenderSize({renderInputSize:e})}},{key:"setInputSize",value:function(e){return this.worker.setInputSize({inputSize:e})}},{key:"instantiateNetwork",value:function(e){return this.worker.instantiateNetwork({networkOptions:e})}},{key:"changeNetwork",value:function(e){return this.worker.changeNetwork({networkOptions:e})}},{key:"updateOptions",value:function(e){return e.framerate&&(this.framerate=Math.min(e.framerate||24,this.trackFrameRate)),(0,f.ok)()&&console.log(e),this.preview=!!(e&&e.preview&&e.preview.previewType),this.previewCamView=!(!e||!e.previewCamView),this.worker.updateOptions({update:e})}},{key:"_getImageCapture",value:function(e){if(e instanceof MediaStream)t=e;else{if(!(e instanceof HTMLVideoElement))throw Error("input in _getImageCapture is neither MediaStream nor HTMLVideoElement: ".concat(e));t=e.captureStream()}var t,r=t.getVideoTracks(),n=(0,l.Z)(r,1)[0];(0,f.ok)()&&console.log("In _getImageCapture",n);var i=document.createElement("video");if(i.width=n.getSettings().width,i.height=n.getSettings().height,this.periodicAudio){var a=new g(this.periodicAudio);document.addEventListener("visibilitychange",function(){document.hidden?a.enable():a.disable()})}return i.srcObject=t,i.play(),this.video=i,this.trackFrameRate=n.getSettings().frameRate,this.framerate=Math.min(this.framerate||24,this.trackFrameRate),this.lastRenderTime=performance.now(),i}},{key:"_setInput",value:function(e){(0,f.ok)()&&console.log("imageCapInstance",this.imageCapInstance),e instanceof ImageBitmap?this.imageBitmap=e:this.imageCapInstance=this._getImageCapture(e)}},{key:"render",value:(e=(0,i.Z)(c().mark(function e(t){var r,n,i,a,o,s;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.imageCapInstance&&!this.imageBitmap){e.next=44;break}if(e.prev=1,e.t0=this.imageBitmap,e.t0){e.next=7;break}return e.next=6,createImageBitmap(this.video);case 6:e.t0=e.sent;case 7:if(r=e.t0,e.t1=void 0!==t.bgVideo,!e.t1){e.next=13;break}return e.next=12,createImageBitmap(t.bgVideo);case 12:e.t1=e.sent;case 13:if(n=e.t1,e.t2=t.previewVideo instanceof HTMLVideoElement,!e.t2){e.next=19;break}return e.next=18,createImageBitmap(t.previewVideo);case 18:e.t2=e.sent;case 19:if(i=e.t2,(0,f.ok)()&&console.log("grabFrame.then",this,r),!((a=Math.round(1e3/this.framerate)-(performance.now()-this.lastRenderTime))>0)){e.next=25;break}return e.next=25,new Promise(function(e){setTimeout(e,a)});case 25:if(this.lastRenderTime=performance.now(),!t.passthrough||this.preview&&!this.previewCamView){e.next=28;break}return e.abrupt("return",new Promise(function(e){e({bitmap:r})}));case 28:return o=this.worker.render({preview:this.preview||!1,previewCamView:this.previewCamView||!1,passthrough:t.passthrough,inputImage:r,videoBitmap:n,previewVideoBitmap:i}),e.next=31,o;case 31:return s=e.sent,r.close(),n&&n.close(),i&&i.close(),e.abrupt("return",s);case 38:return e.prev=38,e.t3=e.catch(1),(0,f.ok)()&&console.error("in render",e.t3),e.abrupt("return",!1);case 42:e.next=46;break;case 44:return(0,f.ok)()&&console.error("this.imageCapInstance",this.imageCapInstance),e.abrupt("return",!1);case 46:case"end":return e.stop()}},e,this,[[1,38]])})),function(t){return e.apply(this,arguments)})}]),r}();function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?T(Object(r),!0).forEach(function(t){(0,a.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var R=function(){var e,t,r,a,u,l,d;function p(e,t){var r=this;(0,o.Z)(this,p),(0,f.ok)()&&console.log("Initialized processor with",e),this.params=t,this.tracker=t.tracker,this.analyticsEnabled=t.analyticsEnabled,this.video=e,this.stream=t.stream,this.id=t.id||(0,h.Z)(),this.videoParent=e.parentNode,this.token=t.token,this.serverType=t.serverType,this.mainthread=!t.offscreen,this.framerate=t.framerate,this.periodicAudio=t.periodicAudio||!1,this.firstRender={done:!1,callback:function(){var e=performance.now();r.params.setFirstRenderTime&&r.params.setFirstRenderTime(e)}},this.fixaspectratio=t.fixaspectratio||!0,this.inputChangePreHook=t.inputChangePreHook||function(){return!0},this.renderSize=t.renderSize,"disable"===t.container?this.container=null:this.container=t.container||e.parentNode,(0,f.ok)()&&console.log("Container is",this.container),this.container&&(this.container.style.background="black",this.container.style.resize="both",this.container.style.overflow="hidden",this.ro=this.getResizeObserver(this.setRenderSize.bind(this)),this.ro.observe(this.container)),this.margin={top:0,left:0},this.use_webgl1=t.use_webgl1||"false",this.float_type=t.float_type||"float16",t.networkParams=t.networkParams||{},this.networkParams={name:"background_webgl2",tag:"general",version:"1"},this.networkParams=Object.assign(this.networkParams,t.networkParams),this.networkOptions=t.networkOptions||{},this.passthrough=this.networkOptions.passthrough||!1,(t.network||t.tag||t.version)&&(this.networkParams.name=t.network||this.networkParams.name,this.networkParams.tag=t.tag||this.networkParams.tag,this.networkParams.version=t.version||t.networkParams.version||"0"),(0,f.ok)()&&console.log("Loading BackgroundFilter network ".concat(this.networkParams.name," - tag - ").concat(this.networkParams.tag," - version ").concat(this.networkParams.version));var n={id:this.id,framerate:this.framerate,periodicAudio:this.periodicAudio},i=this.mainthread?_:v;this.glHandle=new i(n);var a=this.initCanvas(),s=a.canvas,u=a.offscreen;this.canvas=s,this.offscreen=u,this.instantiateP=this.instantiateNetwork(),this.setupMetrics(),this.eventHandler=t.eventHandler,this.reqHandle={noDelay:!1,handle:(0,w.cY)()},this.reqHandle.noDelay=!0,t.reqHandle=t.reqHandle||{},this.reqHandle=S(S({},this.reqHandle),t.reqHandle),this.enabled=void 0===t.enabled||!!t.enabled,this.enabled?this.enable():this.disable(),this.isPlaying=!1,this.playerInitTime=performance.now(),this.initialized=this.initializeNetwork(e),this.error=null,this.updateInterval=t.updateInterval||3e5,this.debug=!0===t.debug,this.debugRender=!0===t.debugRender}return(0,s.Z)(p,[{key:"trackEventListener",value:function(e){var t=this;return function(){t.debug&&console.log("TrackEventListener",e),t.trackEvent("vb"+e.camelCase()+"_Event",{processor:t.enabled,type:t.eventHandler.events[e].type,currentTime:t.video.currentTime})}}},{key:"trackEvent",value:function(e,t,r){this.debug&&console.log("Tracking: ",event,t),this.analyticsEnabled&&((t=t||{}).level=t.level||r,t.id=t.id||this.id,this.tracker&&this.tracker.trackEvent({eventName:e,properties:t}))}},{key:"updateStream",value:function(e){this.stream=e,this.glHandle._setInput(this.stream)}},{key:"setupMetrics",value:function(){this.prv=performance.now(),this.prvFPS=performance.now(),this.frames={rendered:{sinceTimestamp:0,total:0,perSecond:0},video:{total:0},interval:{duration:0,videoFrames:0,processedFrames:0,droppedFrames:0,droppedPercent:0}},this.metrics={renderSize:{w:1278,h:720},originalSize:{w:this.video.videoWidth,h:this.video.videoHeight},fps:0,aggregatedFPS:{mean:0,min:0,max:0,median:0},videoFrames:0,processedFrames:0,droppedFrames:0}}},{key:"changeNetwork",value:(d=(0,i.Z)(c().mark(function e(t){var r,n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.debug&&console.log("Changing network from",this.networkParams,"to",t),this.networkParams.name=t.name||this.networkParams.name,this.networkParams.tag=t.tag||this.networkParams.tag,this.networkParams.version=t.version||this.networkParams.version,e.next=6,(0,f.re)(this.networkParams,this.token,this.serverType);case 6:return r=e.sent,e.prev=7,n=this.glHandle.getParameters(this.networkParams.name,this.networkParams.tag,this.networkParams.version,r),e.next=11,this.glHandle.getNetwork(this.networkParams.name,r);case 11:return this.NetworkClass=e.sent,e.next=14,n;case 14:return this.networkParameters=e.sent,e.next=17,this.glHandle.changeNetwork(this.networkOptions);case 17:this.renderSize&&this.setRenderSize(this.renderSize),this.render(),e.next=26;break;case 21:e.prev=21,e.t0=e.catch(7),console.error("Error fetching network parameters and model or changing model",e.t0),this.eventHandler.dispatch("error"),this.disable();case 26:case"end":return e.stop()}},e,this,[[7,21]])})),function(e){return d.apply(this,arguments)})},{key:"instantiateNetwork",value:(l=(0,i.Z)(c().mark(function e(){var t,r,n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.re)(this.networkParams,this.token,this.serverType);case 2:return t=e.sent,e.prev=3,r=this.glHandle.preloadBackgroun
1d(this.networkOptions.background.image),n=this.glHandle.getParameters(this.networkParams.name,this.networkParams.tag,this.networkParams.version,t),e.next=8,this.glHandle.getNetwork(this.networkParams.name,t);case 8:return this.NetworkClass=e.sent,e.next=11,n;case 11:return this.networkParameters=e.sent,e.next=14,r;case 14:e.sent||"virtual"!==this.networkOptions.background.type&&"video"!==this.networkOptions.background.type||console.warn("Unable to load ".concat(this.networkOptions.background.image," as background image")),this._getBackgroundElement=this._getBackgroundElementCallback(),this.container?this.container.insertBefore(this.canvas,this.video.nextSibling):document.body.appendChild(this.canvas),e.next=28;break;case 20:throw e.prev=20,e.t0=e.catch(3),console.error("Error in instantiateNetwork",e.t0),this.eventHandler.dispatch("error","Error in instantiateNetwork"),this.initialized=!1,this.error=e.t0,this.disable(),e.t0;case 28:case"end":return e.stop()}},e,this,[[3,20]])})),function(){return l.apply(this,arguments)})},{key:"disable",value:function(){var e=this.video;e.style.height="100%",e.style.width="100%",this.canvas.style.visibility="hidden",e.style.visibility="visible",this.enabled=!1,this.trackEvent("vbprocessorDisable_End",{processor:this.enabled})}},{key:"enable",value:function(){this.video.style.visibility="hidden",this.canvas.style.visibility="hidden",this.enabled=!0,this.debug&&console.log("isPlaying",(0,f.yA)(this.video)),this.metrics.frameCount=0,(0,f.yA)(this.video)&&this.render(),this.trackEvent("vbprocessorEnable_End",{processor:this.enabled})}},{key:"getResizeObserver",value:function(e){return new b.Z(function(t){var r,n=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return E(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?E(e,void 0):void 0}}(e))){t&&(e=t);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(o)throw i}}}}(t);try{for(n.s();!(r=n.n()).done;){var i=r.value.contentRect,a=i.width,o=i.height;e({w:a,h:o})}}catch(e){n.e(e)}finally{n.f()}})}},{key:"setRenderSize",value:function(e){var t=this.renderSize;this.debug&&console.log("Setting renderSize","w",e.w,"h",e.h),this.renderSize=e;var r=this.canvas;if(this.videoSize&&this.fixaspectratio){this.debug&&console.log("video",this.videoSize,"size",e);var n=this.videoSize.width/this.videoSize.height,i={},a={top:0,left:0,w:e.w,h:e.h};i.w=Math.round(e.h*n),i.h=Math.round(e.w/n),this.debug&&console.log("Expected w h",{w:i.w,h:e.h},{w:e.w,h:i.h}),i.w>e.w?(a.w=e.w,a.h=i.h,a.top=(e.h-a.h)/2):i.h>e.h&&(a.w=i.w,a.h=e.h,a.left=(e.w-a.w)/2),this.margin={left:Math.round(a.left),top:Math.round(a.top)},this.renderInputSize={w:a.w,h:a.h},this.metrics.renderSize=this.renderInputSize,this.debug&&console.log("this.margin",this.margin)}else this.renderInputSize=this.renderSize;this.debug&&console.log("===== IN setRenderSize",this.renderInputSize,this.renderSize,this.renderer),this.renderCanvas&&(this.renderCanvas.width=this.renderInputSize.w,this.renderCanvas.height=this.renderInputSize.h),this.renderer&&(this.glHandle.setRenderSize(this.renderInputSize),r.style.left="".concat(this.margin.left,"px"),r.style.top="".concat(this.margin.top,"px"),this.initialRender(),this.initRenderLoop(),this.trackEvent("vbprocessorSetRenderSize_End",{renderSize:this.metrics.renderSize,previousRenderSize:t}))}},{key:"setVideoSize",value:function(e){this.debug&&console.log("Setting videoSize to",e,"from",this.videoSize);var t=!1;if(this.videoSize){var r={currentSrc:this.video.currentSrc!==this.videoSrc.currentSrc,srcObject:this.video.srcObject!==this.videoSrc.srcObject};r.currentSrc||r.srcObject?(this.videoSrc={currentSrc:this.video.currentSrc,srcObject:this.video.srcObject},this.reqHandle=this.reqHandle||{},this.reqHandle.handle="requestAnimationFrame",t=!0):t=e.width!==this.videoSize.
1width||e.height!==this.videoSize.height}else this.videoSrc={currentSrc:this.video.currentSrc,srcObject:this.video.srcObject},t=!0;if(t){var n=this.inputChangePreHook({before:this.videoSize,after:e},this);this.videoSize=e,this.trackEvent("vbprocessorSetVideoSize_End",{videoSize:e,previousVideoSize:this.videoSize,resizedProcessed:n}),n?(this.inputSize={w:e.width,h:e.height},this.renderer&&this.glHandle.setInputSize(this.inputSize),this.renderSize&&this.setRenderSize(this.renderSize)):(this.debug&&console.log("not changing as Prehook for inputChange returned",n),this.disable())}}},{key:"initializeNetwork",value:(u=(0,i.Z)(c().mark(function e(t){var r,n,i,a=this;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.debug&&console.log("Waiting for",this.canvas.id),r=(0,f.br)("canvas#"+this.canvas.id),n=(0,f.uF)(t),e.next=6,Promise.all([r,n,this.instantiateP]);case 6:return this.debug&&console.log("Found canvas ",this.canvas.id),e.next=9,n;case 9:return i=e.sent,this.setVideoSize(i),t.addEventListener("resize",function(){a.setVideoSize({width:t.videoWidth,height:t.videoHeight}),a.metrics.originalSize={w:t.videoWidth,h:t.videoHeight},t.requestVideoFrameCallback&&t.requestVideoFrameCallback((function(){this.renderAFrame()}).bind(a))}),this.renderSize=this.renderSize||{w:1278,h:720},this.setRenderSize(this.renderSize),e.next=16,this.initializeWebGL();case 16:return e.abrupt("return",!0);case 19:return e.prev=19,e.t0=e.catch(0),this.error=e.t0,e.abrupt("return",!1);case 23:case"end":return e.stop()}},e,this,[[0,19]])})),function(e){return u.apply(this,arguments)})},{key:"renderAFrame",value:(a=(0,i.Z)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.debugRender&&(this.lastTime=this.lastTime||performance.now(),this.currentTime=performance.now(),console.log("renderAFrame",t,this.currentTime-this.lastTime),this.lastTime=this.currentTime),e.next=3,this.glHandle.render({passthrough:this.passthrough,bgVideo:this._getBackgroundElement(),previewVideo:this.previewVideo});case 3:if(r=e.sent){e.next=6;break}return e.abrupt("return",!1);case 6:if(!this.passthrough||r.previewBitmap){e.next=10;break}return e.next=9,createImageBitmap(r.bitmap);case 9:r.previewBitmap=e.sent;case 10:return this.renderContext&&this.renderContext.transferFromImageBitmap(r.bitmap),r.bitmap.close(),r.previewBitmap&&(this.previewContext&&this.previewContext.transferFromImageBitmap(r.previewBitmap),r.previewBitmap.close()),this.previewVideo&&this.previewVideo.play(),r&&!this.firstRender.done&&(this.firstRender.callback(),this.firstRender.done=!0),e.abrupt("return",!0);case 16:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"initializeWebGL",value:(r=(0,i.Z)(c().mark(function e(){var t;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.debug&&console.log("Initializing WebGL context and network",this.inputSize,this.renderInputSize),e.prev=1,e.next=4,this.glHandle.initWebGLContext(this.offscreen,{h:this.inputSize.h,w:this.inputSize.w,use_webgl1:this.use_webgl1,float_type:this.float_type});case 4:this.gl=e.sent,this.debug&&console.log("this.gl initialized",this.gl.input),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),this.gl=null;case 11:if(!this.gl){e.next=32;break}return(t=this.networkOptions.background.video)&&delete this.networkOptions.background.video,this.initialized=this.glHandle.instantiateNetwork(this.networkOptions),t&&(this.networkOptions.background.video=t),e.next=18,this.initialized;case 18:return this.frameBuffer=e.sent,e.next=21,this.glHandle.initRenderer(this.renderInputSize);case 21:this.renderer=e.sent,this.debug&&console.log("this.renderer",this.renderer),this.canvas.style.left="".concat(this.margin.left,"px"),this.canvas.style.top="".concat(this.margin.top,"px"),this.debug&&console.log("this.stream",this.stream),this.glHandle._setInput(this.stream),this.initialRender(),this.initVideoEventRender(),this.initRenderLoop(),e.next=34;break;case 32:this.eventHandler.dispatch("error","In initializeWebGL this.gl is undefined"),this.disable();case 34:case"end":return e.stop()}},e,this,[[1,8]])})),function(){return r.apply(this,arguments)})},{key:"initRenderLoop",value:function(){var e=this.video;(0,f.yA)(this.video)&&this.render(),e.addEventListener("play",(function(){this.render()}).bind(this)),this.eventHandler.dispatch("load","initRenderLoop success")}},{key:"initialRender",value:function(){var e=this,t=this.video;this.debug&&console.log("Calling Initial Render"),4===t.readyState&&setTimeout(function(){e.renderAFrame()},100),t.requestVideoFrameCallback&&t.requestVideoFrameCallback((function(){if((0,f.yA)(t))return null;this.renderAFrame()}).bind(this))}},{key:"initVideoEventRender",value:function(){var e=this.video;e.oncanplaythrough=(function(){this.renderAFrame()}).bind(this),e.onloadeddata=(function(){this.renderAFrame()}).bind(this)}},{key:"median",value:function(e){if(e.length){var t=(0,n.Z)(e).sort(function(e,t){return e-t}),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}}},{key:"updateFPS",value:function(e){this.fpsArray||(this.fpsArray=[]),this.fps=Math.round(e),this.fpsArray.push(this.fps)}},{key:"updateAggregateFPS",value:function(){var e=this.fpsArray;this.metrics.aggregatedFPS={},this.metrics.aggregatedFPS.mean=e.reduce(function(e,t){return e+t},0)/e.length,this.metrics.aggregatedFPS.median=this.median(e),this.metrics.aggregatedFPS.min=Math.min.apply(Math,(0,n.Z)(e)),this.metrics.aggregatedFPS.max=Math.max.apply(Math,(0,n.Z)(e)),this.fpsArray=[]}},{key:"updateFrameMetrics",value:function(){var e=this.updateInterval||5e3;this.frames.rendered.total++,this.frames.rendered.perSecond++,this.frames.rendered.sinceTimestamp++,this.metrics.processedFrames++;var t=performance.now();if(t-this.prvFPS>1e3&&(this.prvFPS=t,this.updateFPS(this.frames.rendered.perSecond),this.frames.rendered.perSecond=0),t-this.prv>e){this.updateAggregateFPS();var r={duration:0,videoFrames:0,processedFrames:0,droppedFrames:0,droppedPercent:0};r.duration=t-this.prv,this.prv=t,this.metrics.fps=Math.round(JSON.parse(JSON.stringify(this.frames.rendered.sinceTimestamp))/(e/1e3)),this.frames.rendered.sinceTimestamp=0;var n=this.video,i=n.webkitDecodedFrameCount||n.mozPresentedFrames||n.decodedFrames||n.presentedFrames;i&&(this.frames.video.total=i,this.metrics.videoFrames=i,this.metrics.videoFrames>=this.metrics.processedFrames?this.metrics.droppedFrames=this.metrics.videoFrames-this.metrics.processedFrames:(this.metrics.videoFrames=this.frames.rendered.total,this.metrics.droppedFrames=0),this.metrics.droppedPercent=this.metrics.droppedFrames/this.metrics.videoFrames*100,r.videoFrames=this.metrics.videoFrames-this.frames.interval.videoFrames,r.processedFrames=this.metrics.processedFrames-this.frames.interval.processedFrames,r.droppedFrames=r.videoFrames-r.processedFrames,r.droppedPercent=r.droppedFrames/r.videoFrames*100,this.frames.interval=r,this.metrics.aggregatedFPS.mean<=10&&this.eventHandler.dispatch("lowperf","mean FPS is ".concat(this.metrics.aggregatedFPS.mean,"; droppedFrames is ").concat(this.metrics.droppedFrames,"; videoFrames is ").concat(this.metrics.videoFrames,"; droppedPercent is ").concat(parseFloat(this.metrics.droppedPercent).toFixed(2),"%")),this.trackEvent("vbprocessorUpdateFrameMetrics_End",{FPS:this.metrics.fps,aggregatedFPS:this.metrics.aggregatedFPS,droppedFrames:this.metrics.droppedFrames,videoFrames:this.metrics.videoFrames,processedFrames:this.metrics.processedFrames,droppedPercent:this.metrics.droppedFrames/this.metrics.videoFrames*100,interval:this.frames.interval,framerate:this.framerate,currentTime:this.video.currentTime}))}}},{key:"renderVideoFrame",value:(t=(0,i.Z)(c().mark(function e(t){var r,n,i=this;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.debugRender&&console.log("Calling renderVideoFrame in a loop",t),!this.cancelledRenderers||!((r=this.cancelledRenderers.indexOf(t))>
1-1)){e.next=7;break}return delete this.cancelledRenderers[r],e.abrupt("return");case 7:if(!(this.video&&this.frameBuffer&&this.renderer)){e.next=26;break}return e.next=10,this.renderAFrame(t);case 10:if((n=e.sent)&&(this.updateFrameMetrics(),this.metrics.frameCount+=1),!this.reqHandle.noDelay){e.next=26;break}if(!this.enabled){e.next=24;break}if(!n){e.next=20;break}return e.next=17,this.renderVideoFrame(t);case 17:return e.abrupt("return");case 20:return setTimeout(function(){return i.renderVideoFrame(t)},16),e.abrupt("return");case 22:e.next=26;break;case 24:return this.eventHandler.dispatch("stop"),e.abrupt("return");case 26:(0,f.yA)(this.video)&&this.enabled?(this.debugRender&&console.log("calling requestFrame"),this.requestFrame(this.video,this.renderVideoFrame.bind(this)),this.isPlaying=!0):(this.debugRender&&console.log("STOPPED playing"),this.eventHandler.dispatch("stop"),this.isPlaying=!1),e.next=33;break;case 29:e.prev=29,e.t0=e.catch(0),console.error("Error in renderVideoFrame",e.t0),this.eventHandler.dispatch("error","Error in renderVideoFrame: ".concat(e.t0));case 33:case"end":return e.stop()}},e,this,[[0,29]])})),function(e){return t.apply(this,arguments)})},{key:"requestFrame",value:function(e,t){if(this.reqHandle=this.reqHandle||{},"requestVideoFrameCallback"===this.reqHandle.handle){var r=e.requestVideoFrameCallback(t);this.reqHandle.video=e,this.reqHandle.rfvc=r}else if("setTimeout"===this.reqHandle.handle){var n=setTimeout(t,0);this.reqHandle.st=n}else if("requestAnimationFrame"===this.reqHandle.handle){var i=(0,y.U7)(t);this.reqHandle.raf=i}}},{key:"updateNetworkOptions",value:(e=(0,i.Z)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=t&&t.background&&t.background.video)&&delete t.background.video,t&&t.previewContext&&(this.previewContext=t.previewContext,t.previewContext=void 0),t.preview&&t.preview.previewVideo?(this.previewVideo=t.preview.previewVideo,t.preview.previewVideo=void 0):this.previewVideo=null,e.next=6,this.glHandle.updateOptions(t);case 6:r&&(t.background.video=r),void 0!==t.passthrough&&(this.passthrough=t.passthrough),this._getBackgroundElement=this._getBackgroundElementCallback(t);case 9:case"end":return e.stop()}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"cancelLastRender",value:function(){if(this.debugRender&&console.log("Canceling last render"),this.reqHandle=this.reqHandle||{},this.reqHandle.noDelay&&this.previousRenderCaller&&(this.cancelledRenderers=this.cancelledRenderers||[],this.cancelledRenderers.push("my-render-".concat(this.previousRenderCaller))),this.reqHandle.rfvc){var e=this.reqHandle,t=e.video,r=e.rfvc;t.cancelVideoFrameCallback(r),this.reqHandle.rfvc=null}if(this.reqHandle.raf){var n=this.reqHandle.raf;(0,y.Wx)(n),this.reqHandle.raf=null}this.reqHandle.st&&(clearTimeout(this.reqHandle.st),this.reqHandle.st=null)}},{key:"render",value:function(){this.previousRenderCaller=this.renderCaller,this.renderCaller=(this.renderCaller||0)+1,this.debugRender&&console.log("Starting render call with isPlaying",this.isPlaying),this.prv=performance.now(),this.prvFPS=performance.now(),this.cancelLastRender(),this.renderVideoFrame("my-render-".concat(this.renderCaller)),this.eventHandler.dispatch("start")}},{key:"_getBackgroundElementCallback",value:function(e){var t=this;return this.networkOptions.background&&this.networkOptions.background.video&&this.networkOptions.background.video.pause(),this.networkOptions.background=e&&e.background||this.networkOptions.background,"video"===this.networkOptions.background.type&&this.networkOptions.background.video instanceof HTMLVideoElement?!1===this.passthrough?function(){return(0,f.yA)(t.networkOptions.background.video)||t.networkOptions.background.video.play(),t.networkOptions.background.video}:((0,f.yA)(this.networkOptions.background.video)&&this.networkOptions.background.video.pause(),function(){}):function(){}}},{key:"__loseContext",value:function(){return this.glHandle.__loseContext()}},{key:"initCanvas",value:function(){var e=document.createElement("canvas");e.id="canv-"+this.id,e.style.position="absolute",e.style.left=this.margin.left,e.style.top=this.margin.top;var t,r=document.createElement("canvas");return this.renderContext=r.getContext("bitmaprenderer"),this.renderCanvas=r,window.processors=window.processors||{},window.processors[e.id]=this,t=this.mainthread?e:e.transferControlToOffscreen(),{canvas:e,offscreen:t}}}]),p}()},7337:function(e,t,r){"use strict";r.d(t,{$A:function(){return H},$_:function(){return $},go:function(){return D},PD:function(){return z},cY:function(){return M},EK:function(){return K},Gb:function(){return U},Zq:function(){return F},po:function(){return G},Xu:function(){return q},F2:function(){return Z}});var i=r(5861),a=r(4687),o=r.n(a),s=r(2045);function u(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})}let c=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function l(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"")}let h="u"<typeof window,f=(()=>
1{if(h)return;let{userAgent:e,platform:t,maxTouchPoints:r}=window.navigator,n=/(iphone|ipod|ipad)/i.test(e),i="iPad"===t||"MacIntel"===t&&r>0&&!window.MSStream;return{isIpad:i,isMobile:/android/i.test(e)||n||i,isSafari12:/Version\/12.+Safari/.test(e)}})(),d=[],p=[];function m(e){return null!=e}class g extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}let v=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:r={},glContext:n,failIfMajorPerformanceCaveat:i=!1,benchmarksURL:a="https://unpkg.com/[email protected]/dist/benchmarks"}={})=>u(void 0,void 0,void 0,function*(){let o={};if(h)return{tier:0,type:"SSR"};let{isIpad:s=!!(null==f?void 0:f.isIpad),isMobile:v=!!(null==f?void 0:f.isMobile),screenSize:b=window.screen,loadBenchmarks:w=e=>u(void 0,void 0,void 0,function*(){let t=yield fetch(`${a}/${e}`).then(e=>e.json());if(4>parseInt(t.shift().split(".")[0],10))throw new g("Detect GPU benchmark data is out of date. Please update to version 4x");return t})}=r,{renderer:y}=r,k=(e,t,r,n,i)=>({device:i,fps:n,gpu:r,isMobile:v,tier:e,type:t}),x,_="";if(y)x=[y=l(y)];else{var E;let e=n||function(e,t=!1){let r={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete r.powerPreference;let n=window.document.createElement("canvas"),i=n.getContext("webgl",r)||n.getContext("experimental-webgl",r);return null!=i?i:void 0}(null==f?void 0:f.isSafari12,i);if(!e)return k(0,"WEBGL_UNSUPPORTED");let t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(y=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!y)return k(1,"FALLBACK");_=y,y=l(y),x="apple gpu"===(E=y)?function(e,t,r){let n;if(!r)return[t];let i=function(e){let t=e.createShader(35633),r=e.createShader(35632),n=e.createProgram();if(!(r&&t&&n))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;
1\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(r,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(r),e.attachShader(n,t),e.attachShader(n,r),e.linkProgram(n),e.detachShader(n,t),e.detachShader(n,r),e.deleteShader(t),e.deleteShader(r),e.useProgram(n);let i=e.createBuffer();e.bindBuffer(34962,i),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);let a=e.getAttribLocation(n,"aPosition");e.vertexAttribPointer(a,3,5126,!1,0,0),e.enableVertexAttribArray(a),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);let o=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,o),e.deleteProgram(n),e.deleteBuffer(i),o.join("")}(e),a="801621810",o="8016218135",s="80162181161",u=(null==f?void 0:f.isIpad)?[["a7",s,12],["a8",o,15],["a8x",o,15],["a9",o,15],["a9x",o,15],["a10",o,15],["a10x",o,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["m1",a,15]]:[["a7",s,12],["a8",o,12],["a9",o,15],["a10",o,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15]];return"80162181255"===i?n=u.filter(([,,e])=>e>=14):(n=u.filter(([,e])=>e===i)).length||(n=u),n.map(([e])=>`apple ${e} gpu`)}(e,E,v):[E]}let T=(yield Promise.all(x.map(e=>u(void 0,void 0,void 0,function*(){var t,r,n;let i,a,u=(e=>{for(let t of v?["adreno","apple","mali-t","mali","nvidia","powervr"]:["intel","apple","amd","radeon","nvidia","geforce"])if(e.includes(t))return t})(e);if(!u)return;let c=`${v?"m":"d"}-${u}${s?"-ipad":""}.json`,l=o[c]=null!=(t=o[c])?t:w(c);try{i=yield l}catch(e){if(e instanceof g)throw e;return}let h=null!=(n=null==(a=(r=(r=e).replace(/\([^)]+\)/,"")).match(/\d+/)||r.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g))?void 0:a.join("").replace(/\W|amd/g,""))?n:"",f=i.filter(([,e])=>e===h);f.length||(f=i.filter(([t])=>t.includes(e)));let m=f.length;if(0===m)return;let y,[k,,,x]=m>1?f.map(t=>[t,function(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let n=e.length,i=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-i);)n--,i--;let a,o=0;for(;o<n&&e.charCodeAt(o)===t.charCodeAt(o);)o++;if(n-=o,i-=o,0===n)return i;let s,u,c=0,l=0,h=0;for(;l<n;)p[l]=e.charCodeAt(o+l),d[l]=++l;for(;h<i;)for(a=t.charCodeAt(o+h),s=h++,c=h,l=0;l<n;l++)u=a===p[l]?s:s+1,s=d[l],c=d[l]=s>c?u>c?c+1:u:u>s?s+1:u;return c}(e,t[0])]).sort(([,e],[,t])=>e-t)[0][0]:f[0],_=Number.MAX_VALUE,{devicePixelRatio:E}=window,T=b.width*E*b.height*E;for(let e of x){let[t,r]=e,n=Math.abs(T-t*r);n<_&&(_=n,y=e)}if(!y)return;let[,,S,R]=y;return[_,S,k,R]})))).filter(m).sort(([e=Number.MAX_VALUE,t],[r=Number.MAX_VALUE,n])=>e===r?t-n:e-r);if(!T.length){let e=c.find(e=>y.includes(e));return e?k(0,"BLOCKLISTED",e):k(1,"FALLBACK",`${y} (${_})`)}let[,S,R,A]=T[0];if(-1===S)return k(0,"BLOCKLISTED",R,S,A);let O=v?e:t,P=0;for(let e=0;e<O.length;e++)S>=O[e]&&(P=e);return k(P,"BENCHMARK",R,S,A)});var b=r(7618),w=r(8161),y=r(3109),k=r(7055),x=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},_=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"},E=function(e){this.version=e,this.type="node",this.name="node",this.os=n.platform},T=function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"},S=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},R=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},A=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,O=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;
1\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],P=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function C(e){return e?I(e):"u"<typeof document&&"u">typeof navigator&&"ReactNative"===navigator.product?new R:"u">typeof navigator?I(navigator.userAgent):void 0!==n&&n.version?new E(n.version.slice(1)):null}function I(e){var t=""!==e&&O.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var a=i.exec(e);return!!a&&[n,a]},!1);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new S;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<3&&(i=x(x([],i,!0),function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(3-i.length),!0)):i=[];var a=i.join("."),o=function(e){for(var t=0,r=P.length;t<r;t++){var n=P[t],i=n[0];if(n[1].exec(e))return i}return null}(e),s=A.exec(e);return s&&s[1]?new T(r,a,o,s[1]):new _(r,a,o)}function F(){return B.apply(this,arguments)}function B(){return(B=(0,i.Z)(o().mark(function e(){var t,n=arguments;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==(n.length>0&&void 0!==n[0]&&n[0])){e.next=6;break}return e.next=4,Promise.resolve().then(r.bind(r,1055));case 4:return t=e.sent,e.abrupt("return",t.default.core);case 6:return e.next=8,Promise.resolve().then(r.bind(r,9279));case 8:return t=e.sent,e.abrupt("return",t.default);case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function M(){var e=C();return"requestVideoFrameCallback"in HTMLVideoElement.prototype?"requestVideoFrameCallback":e&&"firefox"===e.name?"setTimeout":"requestAnimationFrame"}var L=null;function N(){return(N=(0,i.Z)(o().mark(function e(){return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==L){e.next=7;break}return e.next=3,v();case 3:return L=e.sent,e.abrupt("return",L);case 7:return e.abrupt("return",L);case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}function U(){return j.apply(this,arguments)}function j(){return(j=(0,i.Z)(o().mark(function e(){var t;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t={}).wasm=b.support(),t.simd=b.feature.simd,t.webgl=(0,w.HR)(),t.webgl2=(0,w.W8)(),t.offscreen=!!HTMLCanvasElement.prototype.transferControlToOffscreen,t.browser=C(),e.next=9,function(){return N.apply(this,arguments)}();case 9:if(t.gpu=e.sent,t.gpu.hwaccel=t.gpu.tier>0,t.wasm&&t.webgl){e.next=15;break}return e.abrupt("return",!1);case 15:return e.abrupt("return",t);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}function z(e){var t=(0,y.zi)();if(t.trackEvent({eventName:"vbGetModel_Start",properties:{model:e}}),"selfie"===e){var r={name:"background_selfie",tag:"general",version:"0"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:r}}),r}if("selfie_v2"===e){var n={name:"background_selfie",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:n}}),n}if("webgl_unet"===e){var i={name:"background_webgl_unet",tag:"general",version:"2"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:i}}),i}if("webgl"===e){var a={name:"background_webgl",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:a}}),a}if("webgl_v2"===e){var o={name:"background_webgl2",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:o}}),o}if("webgl_v2_2"===e){var s={name:"background_webgl2_v2",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:s}}),s}if("rbnet_v0"===e){var u={name:"background_rbnet",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:u}}),u}if("relighting_zdce"===e){var c={name:"relighting_zdce",tag:"general",version:"1"};return t.trackEvent({eventName:"vbGetModel_End",properties:{model:e,modelParams:c}}),c}throw t.trackEvent({eventName:"vbGetModel_Error",properties:{model:e,error:"params.model passed is invali
1d"}},"error"),Error("params.model passed is invalid",e)}function D(){return W.apply(this,arguments)}function W(){return(W=(0,i.Z)(o().mark(function e(){var t,r,n;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t=(0,y.zi)()).trackEvent({eventName:"vbGetFallback_Start"}),e.next=4,U();case 4:if(!(r=e.sent).wasm||!r.webgl&&!r.webgl2){e.next=11;break}return n="selfie_v2",t.trackEvent({eventName:"vbGetFallback_End",properties:{features:r,returnVal:n}}),e.abrupt("return",n);case 11:return t.trackEvent({eventName:"vbGetFallback_End",properties:{features:r,returnVal:!1}}),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function H(e){return V.apply(this,arguments)}function V(){return(V=(0,i.Z)(o().mark(function e(t){var r,n,i,a,s,u;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U();case 2:if(r=e.sent,n=(0,y.zi)(),"selfie"!==t&&"selfie_v2"!==t){e.next=9;break}return i=r.wasm&&(r.webgl||r.webgl2),e.abrupt("return",i);case 9:if("webgl_unet"!==t&&"webgl"!==t&&"webgl_v2"!==t&&"rbnet_v0"!==t){e.next=15;break}return a=C(),s=r.webgl2&&("Mac OS"!==a.os||r.gpu.tier>=2),e.abrupt("return",s);case 15:if("webgl_v2_2"!==t&&"relighting_zdce"!==t){e.next=20;break}return u=r.webgl2&&r.gpu.tier>=1,e.abrupt("return",u);case 20:throw n.trackEvent({eventName:"vbCheckModelSupport_Error",properties:{model:t,error:"params.model passed is invalid"}}),Error("params.model passed is invalid",t);case 22:case"end":return e.stop()}},e)}))).apply(this,arguments)}function G(e){return X.apply(this,arguments)}function X(){return(X=(0,i.Z)(o().mark(function e(t){var r;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(e,t,r){if("string"==typeof r){var n=document.createElement("img");return n.crossOrigin="anonymous",n.addEventListener("load",function(){e(n)}),n.src&&n.complete?n.complete&&e(n):n.src=r,{img:n,src:r}}if(r instanceof HTMLImageElement){var i=r.src;return r.addEventListener("load",function(){e(r)}),r.complete?0===r.naturalWidth?t("Image is empty"):e(r):r.src=r,{img:r,src:i}}},e.abrupt("return",new Promise(function(e,n){r(e,n,t)}));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Z(e){var t=document.createElement("canvas"),r=t.getContext("2d");t.width=640,t.height=320;var n=Math.min(t.width/e.width,t.height/e.height),i=t.width/2-e.width/2*n,a=t.height/2-e.height/2*n;return r.drawImage(e,i,a,e.width*n,e.height*n),t}function q(e){var t=document.createElement("canvas"),r=t.getContext("2d");t.width=640,t.height=320;var n=Math.max(t.width/e.width,t.height/e.height),i=t.width/2-e.width/2*n,a=t.height/2-e.height/2*n;return r.drawImage(e,i,a,e.width*n,e.height*n),t}function $(e){return Y.apply(this,arguments)}function Y(){return(Y=(0,i.Z)(o().mark(function e(t){var r;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=(0,y.zi)()).trackEvent({eventName:"vbCheckPerformance_Start"}),e.abrupt("return",new Promise(function(e,n){function a(){return(a=(0,i.Z)(o().mark(function e(t,r){return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=t||720,r=r||"https://cdn.vectorly.io/public-demos/videocall-720p.jpg",e.abrupt("return",new Promise(function(e){var n=document.createElement("img");n.display="none",n.crossOrigin="anonymous",n.onload=function(){var r=t*n.naturalWidth/n.naturalHeight;createImageBitmap(n,{resizeWidth:r,resizeHeight:t,resizeQuality:"high"}).then(function(t){e({img:n,imgBmp:t})}).catch(function(t){console.warn(t),createImageBitmap(n).then(function(t){e({img:n,imgBmp:t})})})},n.src=r}));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function u(){return(u=(0,i.Z)(o().mark(function r(){var i,u,c,l,h,f,d,p,m,g,v,b;return o().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return i=(0,y.zi)(),u=Number(t.timeout)||2e3,c=Number(t.height)||720,h=(l=U())&&l.offscreen,r.next=7,F(h);case 7:return f=r.sent,r.next=10,function(e,t){return a.apply(this,arguments)}(c);case 10:return p=(d=r.sent).img,m=d.imgBmp,g=new f(p,{stream:m,token:t.token,id:(0,s.Z)(),networkParams:z(t.model||"selfie"),networkOptions:{background:{type:"blur",radiu
1s:5}},renderSize:{w:m.width,h:m.height},debug:!1,debugRender:!1,container:"disable",serverType:t.serverType,enabled:!1,reqHandle:{useRAF:!0}}),r.next=16,g.initialized;case 16:if(r.sent){r.next=22;break}return console.error("Error in initialization"),i.trackEvent({eventName:"vbCheckPerformance_Error",properties:{error:g.error}},"error"),n(g.error),r.abrupt("return");case 22:g.canvas.style.visibility="hidden",(0,k.ok)()&&console.log("processor is initialized"),g.on("start",function(){v=Date.now()}),g.on("stop",function(){b=Date.now(),(0,k.ok)()&&console.log("Metrics",g.metrics),(0,k.ok)()&&console.log("time diff",v,b,b-v),i.trackEvent({eventName:"vb_CheckPerformance_End",properties:{inputSize:"".concat(m.width,"x").concat(m.height),frameCount:g.metrics.frameCount,time:b-v,fps:g.metrics.frameCount/(b-v)*1e3}}),e({inputSize:"".concat(m.width,"x").concat(m.height),frameCount:g.metrics.frameCount,time:b-v,fps:g.metrics.frameCount/(b-v)*1e3})}),g.on("error",function(e){console.error("error",e),i.trackEvent({eventName:"vbCheckPerformance_Error",properties:{error:"Processor.on ERROR, ".concat(e)}},"error"),n(e)}),g.enable(),setTimeout(function(){g.disable(),p.style.visibility="hidden"},u);case 29:case"end":return r.stop()}},r)}))).apply(this,arguments)}t=t||{};try{!function(){u.apply(this,arguments)}()}catch(e){r.trackEvent({eventName:"vbCheckPerformance_Error",properties:{error:"HIGH LEVEL ERROR, ".concat(e)}}),(0,k.ok)()&&console.log("HIGH LEVEL ERROR in _checkPerformance",e),n(e)}}));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function K(e,t){var r=(0,y.zi)();if(!U())throw r.trackEvent({eventName:"vbInputCheck_Error",properties:{error:"Browser not supported"}},"error"),Error("Browser not supported");if(e&&!(e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLVideoElement))throw r.trackEvent({eventName:"vbInputCheck_Error",properties:{error:"Input is not a MediaStream, MediaStreamTrack or HTML5 Video Element."}},"error"),TypeError("Input is not a MediaStream, MediaStreamTrack or HTML5 Video Element. See https://cdn.vectorly.io/ai-filters/docs/latest/BackgroundFilter.html for proper setup instructions");
1if(!t.token)throw r.trackEvent({eventName:"vbInputCheck_Error",properties:{error:"Vectorly token not defined."}},"error"),Error("Vectorly token not defined. Please check https://cdn.vectorly.io/ai-filters/docs/latest/BackgroundFilter.html for proper setup instructions");if("string"!=typeof t.token)throw r.trackEvent({eventName:"vbInputCheck_Error",properties:{error:"Token parameter is not a string."}},"error"),Error("Token parameter is not a string. Please check https://cdn.vectorly.io/ai-filters/docs/latest/BackgroundFilter.html for proper setup instructions");if(void 0!==t.background&&"string"!=typeof t.background&&![HTMLImageElement,HTMLVideoElement,ImageBitmap,ImageData,HTMLCanvasElement].some(function(e){return t.background instanceof e}))throw r.trackEvent({eventName:"vbInputCheck_Error",properties:{error:"Background is not a valid type (Image / Video / Bitmap / Canvas etc...)"}},"error"),TypeError("Background is not a valid type (Image / Video / Bitmap / Canvas etc...) See https://cdn.vectorly.io/ai-filters/docs/latest/BackgroundFilter.html for proper setup instructions")}},7783:function(e){e.exports=/((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(12[_.]2|12[_.]([3-9]|\d{2,})|12[_.]5|12[_.]([6-9]|\d{2,})|(1[3-9]|[2-9]\d|\d{3,})[_.]\d+|13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|(Opera Mini(?:\/att)?\/?(\d+)?(?:\.\d+)?(?:\.\d+)?)|(Opera\/.+Opera Mobi.+Version\/(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+))|(Opera\/(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+).+Opera Mobi)|(Opera Mobi.+Opera(?:\/|\s+)(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+))|((?:Chrome).*OPR\/(81\.0|81\.([1-9]|\d{2,})|(8[2-9]|9\d|\d{3,})\.\d+)\.\d+)|(SamsungBrowser\/(7\.2|7\.([3-9]|\d{2,})|7\.4|7\.([5-9]|\d{2,})|([8-9]|\d{2,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+))|(Edge\/(96(?:\.0)?|96(?:\.([1-9]|\d{2,}))?|(9[7-9]|\d{3,})(?:\.\d+)?|100(?:\.0)?|100(?:\.([1-9]|\d{2,}))?|(10[1-9]|1[1-9]\d|[2-9]\d\d|\d{4,})(?:\.\d+)?))|((Chromium|Chrome)\/(79\.0|79\.([1-9]|\d{2,})|([8-9]\d|\d{3,})\.\d+|83\.0|83\.([1-9]|\d{2,})|(8[4-9]|9\d|\d{3,})\.\d+|87\.0|87\.([1-9]|\d{2,})|(8[8-9]|9\d|\d{3,})\.\d+|89\.0|89\.([1-9]|\d{2,})|(9\d|\d{3,})\.\d+)(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(91\.0|91\.([1-9]|\d{2,})|(9[2-9]|\d{3,})\.\d+|94\.0|94\.([1-9]|\d{2,})|(9[5-9]|\d{3,})\.\d+|99\.0|99\.([1-9]|\d{2,})|([1-9]\d\d|\d{4,})\.\d+)\.\d+)|(Firefox\/(91\.0|91\.([1-9]|\d{2,})|(9[2-9]|\d{3,})\.\d+|94\.0|94\.([1-9]|\d{2,})|(9[5-9]|\d{3,})\.\d+|99\.0|99\.([1-9]|\d{2,})|([1-9]\d\d|\d{4,})\.\d+)(pre|[ab]\d+[a-z]*)?)/},6296:function(e,t,r){"use strict";var n=r(5861),i=r(5671),a=r(3144),o=r(4687),s=r.n(o),u=r(3058),c=r(1033),l=r(7055),h=r(2045);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}t.default=function(){var e,t,r,o,d,p,m;function g(e,t){switch((0,i.Z)(this,g),(0,l.ok)()&&console.log("Initialized upscaler with",e),this.video=e,this.id=t.id||(0,h.Z)(),this.videoParent=e.parentNode,this.token=t.token,this.serverType=t.serverType,this.fixaspectratio=t.fixaspectratio||!0,this.inputChangePreHook=t.inputChangePreHook||function(){return!0},this.renderSize=t.renderSize,"disable"===t.container?this.container=null:this.container=t.container||e.parentNode,(0,l.ok)()&&console.log("Container is",this.container),this.container&&(this.container.style.background="black",this.container.style.resize="both",this.container.style.overflow="hidden",this.ro=this.getResizeObserver(this.setRenderSize.bind(this)),this.ro.observe(this.container)),this.margin={top:0,left:0},this.use_webgl1=t.use_webgl1||"false",this.float_type=t.float_type||"float16",this.scale=t.scale||3,t.networkParams=t.networkParams||{},this.networkParams={name:"residual_3k_3x",tag:"general",version:"2.1"},this.networkParams=Object.assign(this.networkParams,t.networkParams),this.networkOptions=t.networkOptions||{},(t.network||t.tag||t.version)&&(this.networkParams.name=t.network||this.networkParams.name,this.networkParams.tag=t.tag||this.networkParams.tag,"residual_3k_3x"===this.networkParams.name?this.networkParams.version=t.version||t.networkParams.version||"2.1":this.networkParams.version=t.version||t.networkParams.version||"0"),"residual_3k"===t.network?this.networkParams={name:"residual_3k_3x",tag:"general",version:"2.1"}:"residual_5k"===t.network&&(this.networkParams={name:"residual_5k_3x",tag:"general",version:"0"}),this.networkParams.name){case"residual_3k_3x":case"residual_5k_3x":case"residual_4k_3x":case"residual_4k_2x":case"residual_10k_1x":case"cnn_demo":this.networkType="upscaler";break;case"background_selfie":case"background_webgl":case"background_webgl2":case"background_webgl_unet":this.networkType="background";break;default:console.warn("INVALID networkType for network with params",this.networkParams),this.networkType="INVALID"}this.canvas=this.initCanvas(),this.instantiateP=this.instantiateNetwork(),this.setupMetrics(),this.initEvents(),this.reqHandle={useRAF:!("requestVideoFrameCallback"in HTMLVideoElement.prototype)},this.enable(),this.isPlaying=!1,this.playerInitTime=Date.now(),this.initialized=this.initializeNetwork(e),this.error=null,this.analyticsEnabled=!1,this.debug=!0===t.debug,this.debugRender=!0===t.debugRender,this.initAnalytics()}return(0,a.Z)(g,[{key:"initAnalytics",value:(m=(0,n.Z)(s().mark(function e(){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)})),function(){return m.apply(this,arguments)})},{key:"trackEventListener",value:function(e){var t=this;return function(){t.debug&&console.log("TrackEventListener",e),t.trackA
1nalytics(e+" Event",{upscale:t.enabled,type:t.events[e].type,currentTime:t.video.currentTime})}}},{key:"trackAnalytics",value:function(e,t){this.debug&&console.log("Tracking",e,t)}},{key:"setupMetrics",value:function(){this.prv=performance.now(),this.frames={rendered:{sinceTimestamp:0,total:0},video:{total:0}},this.metrics={renderSize:{w:1278,h:720},originalSize:{w:this.video.videoWidth,h:this.video.videoHeight},upscaleFactor:this.scale,droppedFrames:0,fps:0,upscaledFrames:0,videoFrames:0}}},{key:"changeNetwork",value:(p=(0,n.Z)(s().mark(function e(t){var r,n;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.debug&&console.log("Changing network from",this.networkParams,"to",t),this.networkParams.name=t.name||this.networkParams.name,this.networkParams.tag=t.tag||this.networkParams.tag,this.networkParams.version=t.version||this.networkParams.version,e.next=6,(0,l.re)(this.networkParams,this.token,this.serverType);case 6:return r=e.sent,e.prev=7,n=(0,u.ZS)(this.networkParams.name,this.networkParams.tag,this.networkParams.version,r),e.next=11,(0,u.Hy)(this.networkParams.name,r);case 11:return this.NetworkClass=e.sent,e.next=14,n;case 14:this.networkParameters=e.sent,this.frameBuffer.clearall(),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.renderer.changeNetwork(this.networkInstance),this.renderSize&&this.setRenderSize(this.renderSize),this.render(),e.next=28;break;case 23:e.prev=23,e.t0=e.catch(7),console.error("Error fetching network parameters and model or changing model",e.t0),document.dispatchEvent(this.events.error),this.disable();case 28:case"end":return e.stop()}},e,this,[[7,23]])})),function(e){return p.apply(this,arguments)})},{key:"instantiateNetwork",value:(d=(0,n.Z)(s().mark(function e(){var t,r,n;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.re)(this.networkParams,this.token,this.serverType);case 2:return t=e.sent,e.prev=3,"background"===this.networkType&&this.networkOptions.background&&(r=this.preloadBackground(this.networkOptions.background.image)),n=(0,u.ZS)(this.networkParams.name,this.networkParams.tag,this.networkParams.version,t),e.next=8,(0,u.Hy)(this.networkParams.name,t);case 8:return this.NetworkClass=e.sent,e.next=11,n;case 11:if(this.networkParameters=e.sent,!r){e.next=15;break}return e.next=15,r;case 15:this.container?this.container.insertBefore(this.canvas,this.video.nextSibling):document.body.appendChild(this.canvas),e.next=26;break;case 18:throw e.prev=18,e.t0=e.catch(3),console.error("Error in instantiateNetwork",e.t0),document.dispatchEvent(this.events.error),this.initialized=!1,this.error=e.t0,this.disable(),e.t0;case 26:case"end":return e.stop()}},e,this,[[3,18]])})),function(){return d.apply(this,arguments)})},{key:"disable",value:function(){var e=this.video;e.style.height="100%",e.style.width="100%",this.canvas.style.visibility="hidden",e.style.visibility="visible",this.enabled=!1,this.trackAnalytics("Disabled",{upscale:this.enabled})}},{key:"enable",value:function(){this.video.style.visibility="hidden",this.canvas.style.visibility="visible",this.enabled=!0,(0,l.yA)(this.video)&&this.render(),this.trackAnalytics("Enabled",{upscale:this.enabled})}},{key:"initEvents",value:function(){var e={};this.eventList=["load","error","stop","start"],this.eventList.forEach(function(t){e[t]=new Event("vectorly-upscaler-"+t)}),this.events=e}},{key:"on",value:function(e,t){return document.addEventListener("vectorly-upscaler-"+e,t),this}},{key:"getResizeObserver",value:function(e){return new c.Z(function(t){var r,n=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return f(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?f(e,void 0):void 0}}(e))){t&&(e=t);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(o)throw i}}}}(t);try{for(n.s();!(r=n.n()).done;){var i=r.value.contentRect,a=i.width,o=i.height;e({w:a,h:o})}}catch(e){n.e(e)}finally{n.f()}})}},{key:"setRenderSize",value:function(e){var t=this.renderSize;this.debug&&console.log("Setting renderSize","w",e.w,"h",e.h),this.renderSize=e;var r=this.canvas;if(this.videoSize&&this.fixaspectratio){this.debug&&console.log("video",this.videoSize,"size",e);
1var n=this.videoSize.width/this.videoSize.height,i={},a={top:0,left:0,w:e.w,h:e.h};i.w=Math.round(e.h*n),i.h=Math.round(e.w/n),this.debug&&console.log("Expected w h",{w:i.w,h:e.h},{w:e.w,h:i.h}),i.w>e.w?(a.w=e.w,a.h=i.h,a.top=(e.h-a.h)/2):i.h>e.h&&(a.w=i.w,a.h=e.h,a.left=(e.w-a.w)/2),this.margin={left:Math.round(a.left),top:Math.round(a.top)},this.renderInputSize={w:a.w,h:a.h},this.metrics.renderSize=this.renderInputSize,this.debug&&console.log("this.margin",this.margin)}else this.renderInputSize=this.renderSize;this.debug&&console.log("===== IN setRenderSize",this.renderInputSize,this.renderSize,this.renderer),this.renderer&&(this.renderer.setProperties(this.renderInputSize),r.style.left="".concat(this.margin.left,"px"),r.style.top="".concat(this.margin.top,"px"),this.initialRender(),this.initRenderLoop(),this.trackAnalytics("Render Resize",{renderSize:this.metrics.renderSize,previousRenderSize:t}))}},{key:"setVideoSize",value:function(e){this.debug&&console.log("Setting videoSize to",e,"from",this.videoSize);var t=!1;if(this.videoSize){var r={currentSrc:this.video.currentSrc!==this.videoSrc.currentSrc,srcObject:this.video.srcObject!==this.videoSrc.srcObject};r.currentSrc||r.srcObject?(this.videoSrc={currentSrc:this.video.currentSrc,srcObject:this.video.srcObject},this.reqHandle=this.reqHandle||{},this.reqHandle.useRAF=!0,t=!0):t=e.width!==this.videoSize.width||e.height!==this.videoSize.height}else this.videoSrc={currentSrc:this.video.currentSrc,srcObject:this.video.srcObject},t=!0;if(t){var n=this.inputChangePreHook({before:this.videoSize,after:e},this);this.videoSize=e,this.trackAnalytics("Video Resize",{videoSize:e,previousVideoSize:this.videoSize,resizedProcessed:n}),n?(this.inputSize={w:e.width,h:e.height},this.renderer&&this.renderer.setInputSize(this.inputSize),this.renderSize&&this.setRenderSize(this.renderSize)):(this.debug&&console.log("not changing as Prehook for inputChange returned",n),this.disable())}}},{key:"initializeNetwork",value:(o=(0,n.Z)(s().mark(function e(t){var r,n,i,a=this;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.debug&&console.log("Waiting for",this.canvas.id),r=(0,l.br)("canvas#"+this.canvas.id),n=(0,l.uF)(t),e.next=6,Promise.all([r,n,this.instantiateP]);case 6:return this.debug&&console.log("Found canvas ",this.canvas.id),e.next=9,n;case 9:return i=e.sent,this.setVideoSize(i),t.addEventListener("resize",function(){a.setVideoSize({width:t.videoWidth,height:t.videoHeight}),a.metrics.originalSize={w:t.videoWidth,h:t.videoHeight},t.requestVideoFrameCallback&&t.requestVideoFrameCallback((function(){this.renderAFrame()}).bind(a))}),this.renderSize=this.renderSize||{w:1278,h:720},this.setRenderSize(this.renderSize),this.initializeWebGL(),e.abrupt("return",!0);case 18:return e.prev=18,e.t0=e.catch(0),this.error=e.t0,e.abrupt("return",!1);case 22:case"end":return e.stop()}},e,this,[[0,18]])})),function(e){return o.apply(this,arguments)})},{key:"renderAFrame",value:function(){this.frameBuffer&&this.frameBuffer.setInputImage(this.video),this.renderer&&this.renderer.render()}},{key:"initializeWebGL",value:(r=(0,n.Z)(s().mark(function e(){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.debug&&console.log("Initializing WebGL context and network",this.inputSize,this.renderInputSize);try{this.gl=new u.yb(this.canvas.id,{h:this.inputSize.h,w:this.inputSize.w,use_webgl1:this.use_webgl1,float_type:this.float_type}),this.debug&&console.log("this.gl initialized",this.gl.input)}catch(e){console.warn("Error in intializing WebGLContext",e),this.gl=null}if(!this.gl){e.next=17;break}return this.frameBuffer=new u.uL(this.gl),this.networkOptions.networkParams=this.networkParams,this.networkInstance=new this.NetworkClass(this.gl,this.frameBuffer,this.networkParameters,this.networkOptions),this.initialized=this.networkInstance.initialized,e.next=9,this.initialized;case 9:this.renderer=new u.Th(this.gl,this.networkInstance,this.frameBuffer,this.renderInputSize),this.canvas.style.left="".concat(this.margin.left,"px"),this.canvas.style.top="".concat(this.margin.top,"px"),this.initialRender(),this.initVideoEventRender(),this.initRenderLoop(),e.next=19;break;case 17:document.dispatchEvent(this.events.error),this.disable();case 19:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"initRenderLoop",value:function(){var e=this.video;(0,l.yA)(this.video)&&this.render(),e.addEventListener("play",(function(){this.render()}).bind(this)),document.dispatchEvent(this.events.load)}},{key:"initialRender",value:function(){var e=this,t=this.video;this.debug&&console.log("Calling Initial Render"),4===t.readyState&&setTimeout(function(){e.renderAFrame()},100),t.requestVideoFrameCallback&&t.requestVideoFrameCallback((function(){if((0,l.yA)(t))return null;this.renderAFrame()}).bind(this))}},{key:"initVideoEventRender",value:function(){var e=this.video;e.oncanplaythrough=(function(){this.renderAFrame()}).bind(this),e.onloadeddata=(function(){this.renderAFrame()}).bind(this)}},{key:"updateFrameMetrics",value:function(){if(this.frames.rendered.total++,this.frames.rendered.sinceTimestamp++,this.metrics.upscaledFrames++,performance.now()-this.prv>1e4){this.metrics.fps=JSON.parse(JSON.stringify(this.frames.rendered.sinceTimestamp)),this.prv=performance.now(),this.frames.rendered.sinceTimestamp=0;var e=this.video,t=e.webkitDecodedFrameCount||e.mozPresentedFrames||e.decodedFrames||e.presentedFrames;t&&(this.frames.video.total=t,this.metrics.videoFrames=t,this.metrics.droppedFrames=this.metrics.videoFrames-this.metrics.upscaledFrames,this.debug&&console.log("currentTime: ".concat(this.video.currentTime,", FPS: ").concat(this.metrics.fps,", Dropped frames: ").concat(this.metrics.droppedFrames,", Video Frame: ").concat(this.metrics.videoFrames,", Rendered frames: ").concat(this.metrics.upscaledFrames)),this.trackAnalytics("Playback Metrics",{FPS:this.metrics.fps,droppedFrames:this.metrics.droppedFrames,videoFrames:this.metrics.videoFrames,upscaledFrames:this.metrics.upscaledFrames,currentTime:this.video.currentTime}))}}},{key:"renderVideoFrame",value:function(e){try{this.debugRender&&console.log("Calling renderVideoFrame in a loop",e),this.video&&this.frameBuffer&&this.renderer&&(this.renderAFrame(),this.updateFrameMetrics()),(0,l.yA)(this.video)&&this.enabled?(this.debugRender&&console.log("calling requestFrame"),this.requestFrame(this.video,this.renderVideoFrame.bind(this)),this.isPlaying=!0):(this.debugRender&&console.log("STOPPED playing"),document.dispatchEvent(this.events.stop),this.isPlaying=!1)}catch(e){console.error("Error in renderVideoFrame",e)}}},{key:"requestFrame",value:function(e,t){if(this.reqHandle=this.reqHandle||{},this.reqHandle.useRAF){var r=setTimeout(t,30);this.reqHandle.raf=r}else{var n=e.requestVideoFrameCallback(t);this.reqHandle.video=e,this.reqHandle.rfvc=n}}},{key:"updateNetworkOptions",value:(t=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.networkInstance.updateOptions(t);case 2:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"cancelLastRender",value:function(){if(this.debugRender&&console.log("Canceling last render"),this.reqHandle=this.reqHandle||{},this.reqHandle.rfvc){var e=this.reqHandle,t=e.video,r=e.rfvc;t.cancelVideoFrameCallback(r),this.reqHandle.rfvc=null}this.reqHandle.raf&&(cancelAnimationFrame(this.reqHandle.raf),this.reqHandle.raf=null)}}
1,{key:"preloadBackground",value:(e=(0,n.Z)(s().mark(function e(t){var r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"string"!=typeof t){e.next=9;break}return e.next=4,fetch(t);case 4:return r=e.sent,e.next=7,r.blob();case 7:return self.preloadedBackground=e.sent,e.abrupt("return",!0);case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(0),console.warn("Vectorly: unable to load ".concat(t," as a background image")),e.abrupt("return",!1);case 15:case"end":return e.stop()}},e,null,[[0,11]])})),function(t){return e.apply(this,arguments)})},{key:"render",value:function(){this.renderCaller=(this.renderCaller||0)+1,this.debugRender&&console.log("Starting render call with isPlaying",this.isPlaying),this.prv=performance.now(),this.cancelLastRender(),this.renderVideoFrame("my-render-".concat(this.renderCaller)),document.dispatchEvent(this.events.start)}},{key:"initCanvas",value:function(){var e=document.createElement("canvas");return e.id="canv-"+this.id,e.style.position="absolute",e.style.left=this.margin.left,e.style.top=this.margin.top,window.upscalers=window.upscalers||{},window.upscalers[e.id]=this,e}}]),g}()},7055:function(e,t,r){"use strict";r.d(t,{Qy:function(){return m},br:function(){return u},ok:function(){return g},re:function(){return p},uF:function(){return c},yA:function(){return l}});var n,i,a=r(5861),o=r(4687),s=r.n(o);function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e5;return new Promise(function(r,n){var i=document.querySelector(e),a=setTimeout(function(){n("waitForElement failed for"+e)},t);if(i)r(i);else{var o=new MutationObserver(function(t){t.forEach(function(t){for(var n=0,i=Array.from(t.addedNodes);n<i.length;n++){var s=i[n];if(s.matches&&s.matches(e))return o.disconnect(),r(s),void clearTimeout(a)}})});o.observe(document.documentElement,{childList:!0,subtree:!0})}})}function c(e){return new Promise(function(t,r){if(e instanceof HTMLVideoElement){if(e.videoWidth*e.videoHeight>0)return void t({width:e.videoWidth,height:e.videoHeight});e.onloadedmetadata=function(){t({width:e.videoWidth,height:e.videoHeight})},e.onerror=function(){r()}}else e instanceof HTMLImageElement&&t({width:e.naturalWidth,height:e.naturalHeight})})}var l=function(e){return e instanceof HTMLMediaElement?!(e.paused||e.ended):e instanceof HTMLImageElement||void 0},h=function(e){var t;switch(e||"production"){case"local":t="http://localhost:4000";break;case"staging":t="https://stream-staging.vectorly.io";break;default:t="https://stream.vectorly.io"}return t},f=function(){return"https://cdn.vectorly.io/ai-filters/v1/".concat("1.14.4","/")},d=(n=(0,a.Z)(s().mark(function e(t,r,n){var i,a,o,u;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=f(),e.abrupt("return",atob("RXhwaXJlcz0xOTU4NjgzNTUwJlBvbGljeT1leUpUZEdGMFpXMWxiblFpT2x0N0lsSmxjMjkxY21ObElqb2lhSFIwY0hNNkx5OWpaRzR1ZG1WamRHOXliSGt1YVc4dllXa3RabWxzZEdWeWN5OTJNUzhxS2lvaUxDSkRiMjVrYVhScGIyNGlPbnNpUkdGMFpVeGxjM05VYUdGdUlqcDdJa0ZYVXpwRmNHOWphRlJwYldVaU9qRTVOVGcyT0RNMU5UQjlmWDFkZlFfXyZTaWduYXR1cmU9WDZMZTItV0xOR28wbDVpRFloWEFKWTdFR0lmSThPSk4zY2lROUNNU3BxM3VxNmNScURJTEFIYVRqZlpRUGpvNjhUVnR6Rk80bEFkZFBQY1pLMHNyamZ6MWFaTjZZNi1HeUdyS1lkU3FFVjdrb1k0eTZTLXkwZmtVOHlFSERaU3BWWTdHOHE5Qk9GQ0QtQ2YtUXcwcUhXamk2N2k0Un55VWgzWkFpbmVSNHk1c1g3UDJpOVY4VW5hMVA1YU9qQ1ZydnFqeTFYTXlaNnluT21PQ0lSdFAtbkVoV3ByVVp2SThTY21FdUJuY1N0M1FmNDl0YX4zWmhkR2pOdTRNQ2hMNk93T2NOeEg0aVF6OW9QN1g4WTVDVEhvVm5xRmdOdHJlVVRvYlZEVjhpem14Zm9jaE83WG9zaUdreVV3SFNIVDItSXlSbzFOUlZTTkpiZVFHSkF2OW53X18mS2V5LVBhaXItSWQ9QVBLQUlCS1JWUVlRRzRPUUFWTUE="));case 4:return a="".concat(h(n),"/upscaler/models/").concat(t.name,"?token=").concat(r,"&path=").concat(encodeURI(i),"&version=").concat(t.version,"&tag=").concat(t.tag),e.next=7,fetch(a);case 7:if(!(o=e.sent).ok){e.next=17;break}return e.next=11,o.json();case 11:return u=e.sent.token,e.abrupt("return",u);case 17:case 18:case"end":return e.stop()}},e)})),function(e,t,r){return n.apply(this,arguments)}),p=(i=(0,a.Z)(s().mark(function e(t,r,n){var i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i={path:f()},n&&("staging"===n||"local"===n)){e.next=5;break}return e.next=4,d(t,r,n);case 4:i.token=e.sent;case 5:return e.abrupt("return",i);case 6:case"end":return e.stop()}},e)})),function(e,t,r){return i.apply(this,arguments)});function m(){var e={};return["load","error","stop","start"].forEach(function(t){e[t]=new Event("vectorly-upscaler-"+t)}),e}function g(){return!1}},1055:function(e,t,r){"use strict";r.r(t);var n=r(5861),i=r(5671),a=r(3144),o=r(4687),s=r.n(o),u=r(3058),c=r(2045),l=r(7055);t.default={core:function(){var e,t,r,o,h,f,d,p;function m(){(0,i.Z)(this,m),this.events=(0,l.Qy)()}return(0,a.Z)(m,[{key:"load",value:(p=(0,n.Z)(s().mark(function e(t){var r,n,i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}throw document.dispatchEvent(this.events.error),Error("Invalid load config");case 3:return this.token=t.token,this.serverType=t.serverType,r=this.initCanvasWebGL(t),n=this.initFrameBufferWebGL(r),e.next=9,this.importNetwork(n,t.networkParams,t.networkOptions);case 9:return i=e.sent,this.networkInstance=i,e.next=13,this.initRenderer(i,n,t.renderSize);case 13:this.renderer=e.sent;case 14:case"end":return e.stop()}},e,this)})),function(e){return p.apply(this,arguments)})},{key:"on",value:function(e,t){return document.addEventListener("vectorly-upscaler-"+e,t),this}},{key:"initCanvasWebGL",value:function(e){try{return e&&e.canvas&&e.w&&e.h,(0,u.yb)(e.canvas,e)}catch(e){throw console.error("Error in initCanvasWebGL: ",e),document.dispatchEvent(this.events.error),e}}},{key:"initFrameBufferWebGL",value:function(e){try{if(!e)throw Error("WebGLContext not found");return new u.uL(e)}catch(e){throw console.error("Error in initFrameBufferWebGL: ",e),document.dispatchEvent(this.events.error),e}}},{key:"importNetwork",value:(d=(0,n.Z)(s().mark(function e(t,r,n){var i,a,o,c;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.clearall()&&r.name&&r.tag&&r.version,e.next=4,(0,l.re)(r,this.token,this.serverType);case 4:return i=e.sent,e.next=7,(0,u.ZS)(r.name,r.tag,r.version,i);case 7:return a=e.sent,e.next=10,(0,u.Hy)(r.name,i);case 10:return o=e.sent,n.networkParams=r,c=new o(t.gl,t,a,n),e.abrupt("return",c);case 16:throw e.prev=16,e.t0=e.catch(0),console.error("Error in importNetwork: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 21:case"end":return e.stop()}},e,this,[[0,16]])})),function(e,t,r){return d.apply(this,arguments)})},{key:"updateNetworkOptions",value:(f=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.renderer,!e.t0){e.next=4;break}return e.next=4,this.renderer;case 4:if(e.t1=this.networkInstance,!e.t1){e.next=8;break}return e.next=8,this.networkInstance.updateOptions(t);case 8:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"initRenderer",value:(h=(0,n.Z)(s().mark(function e(t,r,n){var i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,null==n&&(n={}),e.next=4,t;case 4:return t=e.sent,i=new u.Th(r.gl,t,r,n),document.dispatchEvent(this.events.load),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),console.error("Error in initRenderer: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 15:case"end":return e.stop()}},e,this,[[0,10]])})),function(e,t,r){return h.apply(this,arguments)})},{key:"render",value:(o=(0,n.Z)(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.renderer;case 3:(t=e.sent)&&t.render(),e.next=12;break;case 7:throw e.prev=7,e.t0=e.catch(0),console.error("Error in render: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,7]])})),function(){return o.apply(this,arguments)})},{key:"updateInputResolution",value:(r=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.w&&t.h||console.warn("warning: Invalid InputSize width and height"),e.next=4,this.renderer;case 4:e.sent.setInputSize(t),e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(0),console.error("Error in updateInputResolution: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 13:case"end":return e.stop()}},e,this,[[0,8]])})),function(e){return r.apply(this,arguments)})},{key:"updateRenderResolution",value:(t=(0,n.Z)(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.w&&t.h||console.warn("warning: Invalid renderSize width and height passed"),e.next=4,this.renderer;case 4:e.sent.setProperties(t),e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(0),console.error("Error in updateInputResolution: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 13:case"end":return e.stop()}},e,this,[[0,8]])})),function(e){return t.apply(this,arguments)})},{key:"setInput",value:(e=(0,n.Z)(s().mark(function e(t){var r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.renderer;case 3:(r=e.sent).frameBuffer.setInputImage(t),r.frameBuffer.iterations+=1,e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(0),console.error("Error in setInput: ",e.t0),document.dispatchEvent(this.events.error),e.t0;case 13:case"end":return e.stop()}},e,this,[[0,8]])})),function(t){return e.apply(this,arguments)})},{key:"createCanvas",value:function(e){try{var t=document.createElement("canvas");return t.id=e.id||"canv-"+(0,c.Z)(),t.width=e.w||100,t.height=e.h||100,t}catch(e){throw console.error("Error in canvasConfig: ",e),document.dispatchEvent(this.events.error),e}}}]),m}()}},3109:function(e,t,r){"use strict";r.d(t,{F6:function(){return o},fX:function(){return u},zi:function(){return l}});var n=r(5671),i=r(3144),a=r(2045);function o(e){for(var t,r=e.eventName,n=e.properties,i=Object.keys(n),a=["Tracking:",r],o=0;o<i.length;++o)a.push("".concat(i[o]," :")),a.push(n[i[o]]);((t=n.level)?"error"===t?console.error:"warn"===t?console.warn:"info"===t?console.info:"debug"===t?console.debug:console.log:console.log).apply(void 0,a)}var s,u=function(){function e(t){var r=t.track,i=t.name,o=t.enabled;(0,n.Z)(this,e),this.trackerList=[{name:i,track:r,enabled:void 0===o||o}],this.trackerNames=[i],this.id=(0,a.Z)(),l()||c(this)}return(0,i.Z)(e,[{key:"addTracker",value:function(e){var t=e.track,r=e.name,n=e.enabled;this.trackerList.push({name:r,enabled:void 0===n||n,track:t}),this.trackerNames.push(r)}},{key:"enableTracker",value:function(e){var t=this.trackerNames.indexOf(e);t>-1&&(this.trackerList[t].enabled=!0)}},{key:"disableTracker",value:function(e){var t=this.trackerNames.indexOf(e);t>-1&&(this.trackerList[t].enabled=!1)}},{key:"hasConsoleTracker",value:function(){for(var e=0;e<this.trackerList.length;++e)if(this.trackerList[e].track===o)return!0}},{key:"trackEvent",value:function(e){var t=e.eventName,r=e.properties;(r=r||{}).trackerId=this.id;for(var n=0;n<this.trackerList.length;++n){var i=this.trackerList[n],a=i.track;i.enabled&&a({eventName:t,properties:r})}}}]),e}(),c=function(e){s=e},l=function(){return s}},3444:function(e){"use strict";e.exports=e=>{if("string"!=typeof e)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!/^[a-zA-Z]:\\/.test(e)&&/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)}},8190:function(e,t,r){"use strict";let n=r(3444);e.exports=e=>!n(e)},3820:function(e,t,r){"use strict";r.d(t,{U7:function(){return h},Wx:function(){return f}}),e=r.hmd(e);let n=1,i="object"==typeof self&&self.self==self?self:"object"==typeof r.g&&r.g.global==r.g?r.g:{},a=Date.now(),o={},s=Date.now(),u=e=>{if("function"!=typeof e)throw TypeError(e+" is not a function");let t=Date.now(),r=t-s,u=n++;return o[u]=e,Object.keys(o).length>1||setTimeout(()=>{s=t;let e=o;o={},Object.keys(e).forEach(t=>e[t](i.performance&&"function"==typeof i.performance.now?i.performance.now():Date.now()-a))},r>16?0:16-r),u},c=e=>
1"string"!=typeof e?u:""===e?i.requestAnimationFrame:i[e+"RequestAnimationFrame"],l=((e,t)=>{let r=0;for(;void 0!==e[r];){if(t(e[r]))return e[r];r+=1}})(["","webkit","moz","ms","o"],e=>!!c(e)),h=c(l),f="string"!=typeof l?e=>{delete o[e]}:""===l?i.cancelAnimationFrame:i[l+"CancelAnimationFrame"]||i[l+"CancelRequestAnimationFrame"];i.requestAnimationFrame=h,i.cancelAnimationFrame=f,e.exports&&(e.exports={requestAnimationFrame:h,cancelAnimationFrame:f})},1033:function(e,t,r){"use strict";var n=function(){if("u">typeof Map)return Map;function e(e,t){var r=-1;return e.some(function(e,n){return e[0]===t&&(r=n,!0)}),r}function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var r=0,n=this.__entries__;r<n.length;r++){var i=n[r];e.call(t,i[1],i[0])}},t}(),i="u">typeof window&&"u">typeof document&&window.document===document,a=void 0!==r.g&&r.g.Math===Math?r.g:"u">typeof self&&self.Math===Math?self:"u">typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(a):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},s=["top","right","bottom","left","width","height","size","weight"],u="u">typeof MutationObserver,c=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e){var t=!1,r=!1,n=0;function i(){t&&(t=!1,e()),r&&s()}function a(){o(i)}function s(){var e=Date.now();if(t){if(e-n<2)return;r=!0}else t=!0,r=!1,setTimeout(a,20);n=e}return s}(this.refresh.bind(this))}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){i&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),u?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){i&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=void 0===t?"":t;s.some(function(e){return!!~r.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),l=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},h=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||a},f=g(0,0,0,0);function d(e){return parseFloat(e)||0}function p(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(t,r){return t+d(e["border-"+r+"-width"])},0)}var m="u">typeof SVGGraphicsElement?function(e){return e instanceof h(e).SVGGraphicsElement}:function(e){return e instanceof h(e).SVGElement&&"function"==typeof e.getBBox};function g(e,t,r,n){return{x:e,y:t,width:r,height:n}}var v=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=g(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e,t,r=(e=this.target,i?m(e)?g(0,0,(t=e.getBBox()).width,t.height):function(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return f;var n=h(e).getComputedStyle(e),i=function(e){for(var t={},r=0,n=["top","right","bottom","left"];r<n.length;r++){var i=n[r],a=e["padding-"+i];t[i]=d(a)}return t}(n),a=i.left+i.right,o=i.top+i.bottom,s=d(n.width),u=d(n.height);if("border-box"===n.boxSizing&&(Math.round(s+a)!==t&&(s-=p(n,"left","right")+a),Math.round(u+o)!==r&&(u-=p(n,"top","bottom")+o)),e!==h(e).document.documentElement){var c=Math.round(s+a)-t,l=Math.round(u+o)-r;1!==Math.abs(c)&&(s-=c),1!==Math.abs(l)&&(u-=l)}return g(i.left,i.top,s,u)}(e):f);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),b=function(e,t){var r,n,i,a,o,s=(r=t.x,n=t.y,i=t.width,a=t.height,l(o=Object.create(("u">typeof DOMRectReadOnly?DOMRectReadOnly:Object).prototype),{x:r,y:n,width:i,height:a,top:n,r
1ight:r+i,bottom:a+n,left:r}),o);l(this,{target:e,contentRect:s})},w=function(){function e(e,t,r){if(this.activeObservations_=[],this.observations_=new n,"function"!=typeof e)throw TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return e.prototype.observe=function(e){if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");if("u">typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new v(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");if("u">typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new b(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),y="u">typeof WeakMap?new WeakMap:new n,k=function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var r=new w(t,c.getInstance(),this);y.set(this,r)};["observe","unobserve","disconnect"].forEach(function(e){k.prototype[e]=function(){var t;return(t=y.get(this))[e].apply(t,arguments)}}),t.Z=void 0!==a.ResizeObserver?a.ResizeObserver:k},2238:function(e,t,r){var n;!function(i){"use strict";var a="function",o="undefined",s="object",u="string",c="model",l="name",h="type",f="vendor",d="version",p="architecture",m="console",g="mobile",v="tablet",b="smarttv",w="wearable",y="embedded",k="Amazon",x="Apple",_="ASUS",E="BlackBerry",T="Google",S="Huawei",R="Microsoft",A="Motorola",O="Samsung",P="Sony",C="Xiaomi",I="Zebra",F="Facebook",B=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},M=function(e,t){return typeof e===u&&-1!==L(t).indexOf(L(e))},L=function(e){return e.toLowerCase()},N=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,255)},U=function(e,t){for(var r,n,i,o,u,c,l=0;l<t.length&&!u;){var h=t[l],f=t[l+1];for(r=n=0;r<h.length&&!u;)if(u=h[r++].exec(e))for(i=0;i<f.length;i++)c=u[++n],typeof(o=f[i])===s&&o.length>0?2===o.length?typeof o[1]==a?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:3===o.length?typeof o[1]!==a||o[1].exec&&o[1].test?this[o[0]]=c?c.replace(o[1],o[2]):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:4===o.length&&(this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0):this[o]=c||void 0;l+=2}},j=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(M(t[r][n],e))return"?"===r?void 0:r}else if(M(t[r],e))return"?"===r?void 0:r;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},D={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,d],[/opios[\/ ]+([\w\.]+)/i],[d,[l,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[d,[l,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,d],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[l,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[d,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[d,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[d,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure Browser"],d],[/\bfocus\/([\w\.]+)/i],[d,[l,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[d,[l,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[l,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[l,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[d,[l,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 Browser"],d],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,d],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],d],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[l,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,"Chrome WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[l,"Android Browser"]],[/(chrome|omniweb|arora|[t
vendor: 4,668 bytes, line 1
1izenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,d],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[d,[l,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[d,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[d,j,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[l,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,d]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,L]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",L]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,L]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[f,O],[h,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[f,O],[h,g]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[f,x],[h,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[f,x],[h,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[f,S],[h,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[f,S],[h,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[f,C],[h,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[f,C],[h,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[f,"OPPO"],[h,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[f,"Vivo"],[h,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[f,"Realme"],[h,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[f,A],[h,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[f,A],[h,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[f,"LG"],[h,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[f,"LG"],[h,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[f,"Lenovo"],[h,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[f,"Nokia"],[h,g]],[/(pixel c)\b/i],[c,[f,T],[h,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[f,T],[h,g]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[f,P],[h,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[f,P],[h,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[f,"OnePlus"],[h,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[f,k],[h,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[f,k],[h,g]],[/(playbook);[-\w\),; ]+(rim)/i],[c,f,[h,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[f,E],[h,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[f,_],[h,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[f,_],[h,g]],[/(nexus 9)/i],[c,[f,"HTC"],[h,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[f,[c,/_/g," "],[h,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[f,"Acer"],[h,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[f,"Meizu"],[h,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[f,"Sharp"],[h,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 6,025 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,c,[h,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,c,[h,v]],[/(surface duo)/i],[c,[f,R],[h,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[f,"Fairphone"],[h,g]],[/(u304aa)/i],[c,[f,"AT&T"],[h,g]],[/\bsie-(\w*)/i],[c,[f,"Siemens"],[h,g]],[/\b(rct\w+) b/i],[c,[f,"RCA"],[h,v]],[/\b(venue[\d ]{2,7}) b/i],[c,[f,"Dell"],[h,v]],[/\b(q(?:mv|ta)\w+) b/i],[c,[f,"Verizon"],[h,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[f,"Barnes & Noble"],[h,v]],[/\b(tm\d{3}\w+) b/i],[c,[f,"NuVision"],[h,v]],[/\b(k88) b/i],[c,[f,"ZTE"],[h,v]],[/\b(nx\d{3}j) b/i],[c,[f,"ZTE"],[h,g]],[/\b(gen\d{3}) b.+49h/i],[c,[f,"Swiss"],[h,g]],[/\b(zur\d{3}) b/i],[c,[f,"Swiss"],[h,v]],[/\b((zeki)?tb.*\b) b/i],[c,[f,"Zeki"],[h,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],c,[h,v]],[/\b(ns-?\w{0,9}) b/i],[c,[f,"Insignia"],[h,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[f,"NextBook"],[h,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],c,[h,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],c,[h,g]],[/\b(ph-1) /i],[c,[f,"Essential"],[h,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[f,"Envizen"],[h,v]],[/\b(trio[-\w\. ]+) b/i],[c,[f,"MachSpeed"],[h,v]],[/\btu_(1491) b/i],[c,[f,"Rotor"],[h,v]],[/(shield[\w ]+) b/i],[c,[f,"Nvidia"],[h,v]],[/(sprint) (\w+)/i],[f,c,[h,g]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[f,R],[h,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[f,I],[h,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[f,I],[h,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,c,[h,m]],[/droid.+; (shield) bui/i],[c,[f,"Nvidia"],[h,m]],[/(playstation [345portablevi]+)/i],[c,[f,P],[h,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[f,R],[h,m]],[/smart-tv.+(samsung)/i],[f,[h,b]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[f,O],[h,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,"LG"],[h,b]],[/(apple) ?tv/i],[f,[c,"Apple TV"],[h,b]],[/crkey/i],[[c,"Chromecast"],[f,T],[h,b]],[/droid.+aft(\w)( bui|\))/i],[c,[f,k],[h,b]],[/\(dtv[\);].+(aquos)/i],[c,[f,"Sharp"],[h,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,N],[c,N],[h,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,b]],[/((pebble))app/i],[f,c,[h,w]],[/droid.+; (glass) \d/i],[c,[f,T],[h,w]],[/droid.+; (wt63?0{2,3})\)/i],[c,[f,I],[h,w]],[/(quest( 2)?)/i],[c,[f,F],[h,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[h,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[h,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[h,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,v]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[h,g]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,d],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,d],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[d,j,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[d,j,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[d,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,d],[/\(bb(10);/i],[d,[l,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[d,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[l,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[d,[l,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],d],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,d],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,d]]},W=function(e,t){if(typeof e===s&&(t=e,e=void 0),!(this instanceof W))return new W(e,t).getResult();var r=e||(typeof i!==o&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),n=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(D,t):D;return this.getBrowser=function(){var e,t={};return t.name=void 0,t.version=void 0,U.call(t,r,n.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e.architecture=void 0,U.call(e,r,n.cpu),e},this.getDevice=function(){var e={};return e.vendor=void 0,e.model=void 0,e.type=void 0,U.call(e,r,n.device),e},this.getEngine=function(){var e={};
1return e.name=void 0,e.version=void 0,U.call(e,r,n.engine),e},this.getOS=function(){var e={};return e.name=void 0,e.version=void 0,U.call(e,r,n.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>255?N(e,255):e,this},this.setUA(r),this};W.VERSION="1.0.2",W.BROWSER=B([l,d,"major"]),W.CPU=B([p]),W.DEVICE=B([c,f,h,m,g,b,v,w,y]),W.ENGINE=W.OS=B([l,d]),typeof t!==o?(e.exports&&(t=e.exports=W),t.UAParser=W):r.amdO?void 0===(n=(function(){return W}).call(t,r,t,e))||(e.exports=n):typeof i!==o&&(i.UAParser=W);var H=typeof i!==o&&(i.jQuery||i.Zepto);if(H&&!H.ua){var V=new W;H.ua=V.getResult(),H.ua.get=function(){return V.getUA()},H.ua.set=function(e){V.setUA(e);var t=V.getResult();for(var r in t)H.ua[r]=t[r]}}}("object"==typeof window?window:this)},8893:function(e,t){"use strict";t.Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},3653:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n,i=new Uint8Array(16);function a(){if(!n&&!(n="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"u">typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)}},3958:function(e,t,r){"use strict";for(var n=r(7283),i=[],a=0;a<256;++a)i.push((a+256).toString(16).substr(1));t.Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase();if(!(0,n.Z)(r))throw TypeError("Stringified UUID is invalid");return r}},2045:function(e,t,r){"use strict";var n=r(3653),i=r(3958);t.Z=function(e,t,r){var a=(e=e||{}).random||(e.rng||n.Z)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=a[o];return t}return(0,i.Z)(a)}},7283:function(e,t,r){"use strict";var n=r(8893);t.Z=function(e){return"string"==typeof e&&n.Z.test(e)}},7618:function(e){"use strict";function t(e,t){if(!n)return!1;let i=e.buffer,a=l.get(i);if(null==a){if((a=r.validate(i))&&t)try{new r.Instance(new r.Module(i)).exports[0]()}catch(e){a=!1}l.set(i,a)}return a}let r=this.WebAssembly||globalThis.WebAssembly,n="object"==typeof r,i=(...e)=>Uint8Array.of(0,97,115,109,1,0,0,0,...e),a=(...e)=>Uint32Array.of(0x6d736100,1,...e),o=(...e)=>a(0x60010401,0x2030000,...e,0x2660100,259),s=(...e)=>i(1,4,1,96,0,0,3,2,1,0,...e,11,0,10,4,110,97,109,101,2,3,1,0,0),u=(...e)=>Uint16Array.of(24832,28019,1,0,1025,24577,0,515,1,...e),c=(...e)=>u(...e,2842,4096,28164,28001,357,260,256,560,259,0),l=new WeakMap,h=a(0x60010501,0x37e0100,0x7000102,0x30010105,0x60a0000,0x42000401,0x10000b00,0x6d616e04,0x1040165,0x2300100,259),f=i(5,3,1,4,1,0,8,4,110,97,109,101,2,1,0),d=u(773,1,2561,269,11,65,65,65,3068,2816,2560,28164,28001,613,259,0),p=a(0x60010401,0x2030000,0x80a0001,0x6000601,0xb0b1940),m=i(2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1,0,8,4,110,97,109,101,2,1,0),g=Uint16Array.of(24832,28019,1,0,1537,24577,512,32639,515,1,2058,1537,16640,16640,2816,2560,28164,28001,613,259,0),v=c(3082,2561,17152,0,0,252),b=c(2058,1537,16640,49152),w=o(0x60a0001,0x12000401,0x10000b00,0x6d616e04,0x1040165),y=s(5,4,1,3,1,1,10,7,1,5,0,254,3,0),k=o(0x5070001,6357249,0x1090a00,4259847,0xb1a11fd,0x6e040a00),x=s(10,7,1,5,0,208,112,26);e.exports={support:(e=1)=>n&&t(Uint32Array.of(0x6d736100,e)),get supportStreaming(){return n&&void 0!==r.instantiateStreaming},feature:{get bigInt(){return t(h,!0)},get bulk(){return t(d)},get exceptions(){return t(p)},get memory64(){return t(f)},get mutableGlobal(){return t(m)},get multiValue(){return t(g)},get saturateConversions(){return t(v)},get signExtensions(){return t(b)},get tailCall(){return t(w)},get threads(){return t(y)},get simd(){return t(k)},get references(){return t(x)}
1,get typeReflection(){return n&&void 0!==r.Memory.type},get funcReferences(){return n&&void 0!==r.Function}}}},8161:function(e,t){"use strict";t.HR=function(){if(void 0!==(null==window?void 0:window.WebGLRenderingContext)){var e=document.createElement("canvas");return null!=e.getContext("webgl")||null!=e.getContext("experimental-webgl")}return!1},t.W8=function(){return void 0!==(null==window?void 0:window.WebGLRenderingContext)&&null!=document.createElement("canvas").getContext("webgl2")}},477:function(e){"use strict";e.exports=function(e,t,r,n){var i=self||window;try{try{try{a=new i.Blob([e])}catch(t){(a=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(e),a=a.getBlob()}var a,o=i.URL||i.webkitURL,s=o.createObjectURL(a),u=new i[t](s,r);return o.revokeObjectURL(s),u}catch(n){return new i[t]("data:application/javascript,".concat(encodeURIComponent(e)),r)}}catch(e){if(!n)throw Error("Inline worker is not supported");return new i[t](n,r)}}},7061:function(e,t,r){var n=r(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,a=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i,a=Object.create((t&&t.prototype instanceof p?t:p).prototype),o=new T(n||[]);return i="suspendedStart",a._invoke=function(t,n){if("executing"===i)throw Error("Generator is already running");if("completed"===i){if("throw"===t)throw n;return{value:void 0,done:!0}}for(o.method=t,o.arg=n;;){var a=o.delegate;if(a){var s=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return d;r.method="throw",r.arg=TypeError("The iterator does not provide a 'throw' method")}return d}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,d):a:(r.method="throw",r.arg=TypeError("iterator result is not an object"),r.delegate=null,d)}(a,o);if(s){if(s===d)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===i)throw i="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i="executing";var u=f(e,r,o);if("normal"===u.type){if(i=o.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:o.done}}"throw"===u.type&&(i="completed",o.method="throw",o.arg=u.arg)}},a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d={};function p(){}function m(){}function g(){}var v={};l(v,s,function(){return this});var b=Object.getPrototypeOf,w=b&&b(b(S([])));w&&w!==r&&a.call(w,s)&&(v=w);var y=g.prototype=p.prototype=Object.create(v);function k(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function x(e,t){var r;this._invoke=function(i,o){function s(){return new t(function(r,s){!function r(i,o,s,u){var c=f(e[i],e,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&a.call(h,"__await")?t.resolve(h.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):t.resolve(h).then(function(e){l.value=e,s(l)},function(e){return r("throw",e,s,u)})}u(c.arg)}(i,o,r,s)})}return r=r?r.then(s,s):s()}}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function S(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(a.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:R}}function R(){return{value:void 0,done:!0}}return m.prototype=g,l(y,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,l(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},t.awrap=function(e){return{__await:e}},k(x.prototype),l(x.prototype,u,function(){return this}),t.AsyncIterator=x,t.async=function(e,r,n,i,a){void 0===a&&(a=Promise);var o=new x(h(e,r,n,i),a);return t.isGeneratorFunction(r)?o:o.next().then(function(e){return e.done?e.value:o.next()})},k(y),l(y,c,"Generator"),l(y,s,function(){return this}),l(y,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
1h(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,r){var n=r(7061)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},907:function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,{Z:function(){return n}})},5861:function(e,t,r){"use strict";function n(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,u,"next",e)}function u(e){n(o,i,a,s,u,"throw",e)}s(void 0)})}}r.d(t,{Z:function(){return i}})},5671:function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}r.d(t,{Z:function(){return n}})},3144:function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}r.d(t,{Z:function(){return i}})},4942:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{Z:function(){return n}})},885:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(181);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||(0,n.Z)(e,t)||function(){throw TypeError("Invalid attempt to de
1structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},2982:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(907),i=r(181);function a(e){return function(e){if(Array.isArray(e))return(0,n.Z)(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||(0,i.Z)(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},181:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(907);function i(e,t){if(e){if("string"==typeof e)return(0,n.Z)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?(0,n.Z)(e,t):void 0}}},4147:function(e){"use strict";e.exports={i8:"1.14.4"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.amdO={},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="";var i={};return function(){"use strict";var e=r(6296),t=r(8129),n=r(1055),a=r(8371);i.default={UpscaleFilter:e.default,BackgroundFilter:t.default,BackgroundCoreFilter:a.default,UpscaleCoreFilter:n.default.core}}(),i.default}()},396:function(e,t,r){(function(){"use strict";function e(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var t="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){return e==Array.prototype||e==Object.prototype||(e[t]=r.value),e},n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof r.g&&r.g];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(e,r){if(r)e:{var i=n;e=e.split(".");for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break e;i=i[o]}(r=r(a=i[e=e[e.length-1]]))!=a&&null!=r&&t(i,e,{configurable:!0,writable:!0,value:r})}}function a(t){var r="u">typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return r?r.call(t):{next:e(t)}}function o(e){if(!(e instanceof Array)){e=a(e);for(var t,r=[];!(t=e.next()).done;)r.push(t.value);e=r}return e}i("Symbol",function(e){function r(e,r){this.g=e,t(this,"description",{configurable:!0,writable:!0,value:r})}if(e)return e;r.prototype.toString=function(){return this.g};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",i=0;return function e(t){if(this instanceof e)throw TypeError("Symbol is not a constructor");return new r(n+(t||"")+"_"+i++,t)}}),i("Symbol.iterator",function(r){if(r)return r;r=Symbol("Symbol.iterator");for(var i="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),a=0;a<i.length;a++){var o=n[i[a]];"function"==typeof o&&"function"!=typeof o.prototype[r]&&t(o.prototype,r,{configurable:!0,writable:!0,value:function(){var t;return(t={next:t=e(this)})[Symbol.iterator]=function(){return this},t}})}return r});var s,u,c="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)u=Object.setPrototypeOf;else{e:{var l={};try{l.__proto__={a:!0},S=l.a;break e}catch(e){}S=!1}u=S?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw TypeError(e+" is not extensible");return e}:null}var h=u;function f(e,t){if(e.prototype=c(t.prototype),e.prototype.constructor=e,h)h(e,t);else for(var r in t)if("prototype"!=r)if(Object.defineProperties){var n=Object.getOwnPropertyDescriptor(t,r);n&&Object.defineProperty(e,r,n)}else e[r]=t[r];e.ea=t.prototype}function d(){this.l=!1,this.i=null,this.h=void 0,this.g=1,this.s=this.m=0,this.j=null}function p(e){if(e.l)throw TypeError("Generator is already running");e.l=!0}function m(e,t){e.j={U:t,V:!0},e.g=e.m||e.s}function g(e,t,r){return e.g=r,{value:t}}function v(e){this.g=new d,this.h=e}function b(e,t,r,n){try{var i=t.call(e.g.i,r);if(!(i instanceof Object))throw TypeError("Iterator result "+i+" is not an object");
1if(!i.done)return e.g.l=!1,i;var a=i.value}catch(t){return e.g.i=null,m(e.g,t),w(e)}return e.g.i=null,n.call(e.g,a),w(e)}function w(e){for(;e.g.g;)try{var t=e.h(e.g);if(t)return e.g.l=!1,{value:t.value,done:!1}}catch(t){e.g.h=void 0,m(e.g,t)}if(e.g.l=!1,e.g.j){if(t=e.g.j,e.g.j=null,t.V)throw t.U;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function y(e){this.next=function(t){return p(e.g),e.g.i?t=b(e,e.g.i.next,t,e.g.o):(e.g.o(t),t=w(e)),t},this.throw=function(t){return p(e.g),e.g.i?t=b(e,e.g.i.throw,t,e.g.o):(m(e.g,t),t=w(e)),t},this.return=function(t){var r;return p(e.g),(r=e.g.i)?b(e,"return"in r?r.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),w(e))},this[Symbol.iterator]=function(){return this}}function k(e,t){return t=new y(new v(t)),h&&e.prototype&&h(t,e.prototype),t}d.prototype.o=function(e){this.h=e},d.prototype.return=function(e){this.j={return:e},this.g=this.s};var x="function"==typeof Object.assign?Object.assign:function(e,t){for(var r=1;r<arguments.length;r++){var n=arguments[r];if(n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};i("Object.assign",function(e){return e||x}),i("Promise",function(e){function t(e){this.h=0,this.i=void 0,this.g=[],this.o=!1;var t=this.j();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function r(){this.g=null}function i(e){return e instanceof t?e:new t(function(t){t(e)})}if(e)return e;r.prototype.h=function(e){if(null==this.g){this.g=[];var t=this;this.i(function(){t.l()})}this.g.push(e)};var o=n.setTimeout;r.prototype.i=function(e){o(e,0)},r.prototype.l=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var t=0;t<e.length;++t){var r=e[t];e[t]=null;try{r()}catch(e){this.j(e)}}}this.g=null},r.prototype.j=function(e){this.i(function(){throw e})},t.prototype.j=function(){function e(e){return function(n){r||(r=!0,e.call(t,n))}}var t=this,r=!1;return{resolve:e(this.C),reject:e(this.l)}},t.prototype.C=function(e){if(e===this)this.l(TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.F(e);else{switch(typeof e){case"object":var r=null!=e;break;case"function":r=!0;break;default:r=!1}r?this.u(e):this.m(e)}},t.prototype.u=function(e){var t=void 0;try{t=e.then}catch(e){return void this.l(e)}"function"==typeof t?this.G(t,e):this.m(e)},t.prototype.l=function(e){this.s(2,e)},t.prototype.m=function(e){this.s(1,e)},t.prototype.s=function(e,t){if(0!=this.h)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.h);this.h=e,this.i=t,2===this.h&&this.D(),this.A()},t.prototype.D=function(){var e=this;o(function(){if(e.B()){var t=n.console;void 0!==t&&t.error(e.i)}},1)},t.prototype.B=function(){if(this.o)return!1;var e=n.CustomEvent,t=n.Event,r=n.dispatchEvent;return void 0===r||("function"==typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"==typeof t?e=new t("unhandledrejection",{cancelable:!0}):(e=n.document.createEvent("CustomEvent")).initCustomEvent("unhandledrejection",!1,!0,e),e.promise=this,e.reason=this.i,r(e))},t.prototype.A=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)s.h(this.g[e]);this.g=null}};var s=new r;return t.prototype.F=function(e){var t=this.j();e.J(t.resolve,t.reject)},t.prototype.G=function(e,t){var r=this.j();try{e.call(t,r.resolve,r.reject)}catch(e){r.reject(e)}},t.prototype.then=function(e,r){function n(e,t){return"function"==typeof e?function(t){try{i(e(t))}catch(e){a(e)}}:t}var i,a,o=new t(function(e,t){i=e,a=t});return this.J(n(e,i),n(r,a)),o},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.J=function(e,t){function r(){switch(n.h){case 1:e(n.i);break;case 2:t(n.i);break;default:throw Error("Unexpected state: "+n.h)}}var n=this;null==this.g?s.h(r):this.g.push(r),this.o=!0},t.resolve=i,t.reject=function(e){return new t(function(t,r){r(e)})},t.race=function(e){return new t(function(t,r){for(var n=a(e),o=n.next();!o.done;o=n.next())i(o.value).J(t,r)})},t.all=function(e){var r=a(e),n=r.next();return n.done?i([]):new t(function(e,t){var a=[],o=0;do a.push(void 0),o++,i(n.value).J(function(t){return function(r){a[t]=r,0==--o&&e(a)}}(a.length-1),t),n=r.next();while(!n.done)})},t}),i("Object.is",function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}}),i("Array.prototype.includes",function(e){return e||function(e,t){var r=this;r instanceof String&&(r=String(r));var n=r.length;for(0>(t=t||0)&&(t=Math.max(t+n,0));t<n;t++){var i=r[t];if(i===e||Object.is(i,e))return!0}return!1}}),i("String.prototype.includes",function(e){return e||function(e,t){if(null==this)throw TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(e instanceof RegExp)throw TypeError("First argument to String.prototype.includes must not be a regular expression");return -1!==this.indexOf(e,t||0)}}),i("Array.prototype.keys",function(e){return e||function(){var e,t,r,n,i;return e=this,t=function(e){return e},e instanceof String&&(e+=""),r=0,n=!1,(i={next:function(){if(!n&&r<e.length){var i=r++;return{value:t(i,e[i]),done:!1}}return n=!0,{done:!0,value:void 0}}})[Symbol.iterator]=function(){return i},i}});var _=this||self;function E(e,t){e=e.split(".");var r,n=_;for((e[0]in n)||void 0===n.execScript||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||void 0===t?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t}function T(e,t){return t=String.fromCharCode.apply(null,t),null==e?t:e+t}var S,R,A,O="u">typeof TextDecoder,P="u">typeof TextEncoder;function C(e){if(P)e=(A||(A=new TextEncoder)).encode(e);else{var t=void 0;t=void 0!==t&&t;for(var r=0,n=new Uint8Array(3*e.length),i=0;i<e.length;i++){var a=e.charCodeAt(i);if(128>a)n[r++]=a;else{if(2048>a)n[r++]=a>>6|192;else{if(55296<=a&&57343>=a){if(56319>=a&&i<e.length){var o=e.charCodeAt(++i);if(56320<=o&&57343>=o){a=1024*(a-55296)+o-56320+65536,n[r++]=a>>18|240,n[r++]=a>>12&63|128,n[r++]=a>>6&63|128,n[r++]=63&a|128;continue}i--}if(t)throw Error("Found an unpaired surrogate");a=65533}n[r++]=a>>12|224,n[r++]=a>>6&63|128}n[r++]=63&a|128}}e=n.subarray(0,r)}return e}var I={},F=null;function B(e,t){void 0===t&&(t=0),M(),t=I[t];for(var r=Array(Math.floor(e.length/3)),n=t[64]||"",i=0,a=0;i<e.length-2;i+=3){var o=e[i],s=e[i+1],u=e[i+2],c=t[o>>2];o=t[(3&o)<<4|s>>4],s=t[(15&s)<<2|u>>6],u=t[63&u],r[a++]=c+o+s+u}switch(c=0,u=n,e.length-i){case 2:u=t[(15&(c=e[i+1]))<<2]||n;case 1:e=e[i],r[a]=t[e>>2]+t[(3&e)<<4|c>>4]+u+n}return r.join("")}function M(){if(!F){F={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=e.concat(t[r].split(""));I[r]=n;for(var i=0;i<n.length;i++){var a=n[i];void 0===F[a]&&(F[a]=i)}}}}var L,N="function"==typeof Uint8Array.prototype.slice;function U(e,t,r){return t===r?L||(L=new Uint8Array(0)):N?e.slice(t,r):new Uint8Array(e.subarray(t,r))}var j=0;function z(e,t){t=void 0!==(t=void 0===t?{}:t).v&&t.v,this.h=null,this.g=this.i=this.j=0,this.l=!1,this.v=t,e&&D(this,e)}function D(e,t){var r,n,i,a,o;e.h=t=t.constructor===Uint8Array?t:t.constructor===ArrayBuffer||t.constructor===Array?new Uint8Array(t):t.constructor===String?((i=3*(n=(r=t).length)/4)%3?i=Math.floor(i):-1!="=.".indexOf(r[n-1])&&(i=-1!="=.".indexOf(r[n-2])?i-2:i-1),a=new Uint8Array(i),o=0,function(e,t){function r(t){for(;n<e.length;){var r=e.charAt(n++),i=F[r];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(r))throw Error("Unknown base64 encoding at char: "+r)}return t}M();for(var n=0;;){var i=r(-1),a=r(0),o=r(64),s=r(64);if(64===s&&-1===i)break;t(i<<2|a>>4),64!=o&&(t(a<<4&240|o>>2),64!=s&&t(o<<6&192|s))}}(r,function(e){a[o++]=e}),a.subarray(0,o)):t instanceof Uint8Array?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e.j=0,e.i=e.h.length,e.g=e.j}function W(e){var t=e.h,r=t[e.g],n=127&r;return 128>r?(e.g+=1,n):(n|=(127&(r=t[e.g+1]))<<7,128>r?(e.g+=2,n):(n|=(127&(r=t[e.g+2]))<<14,128>r?(e.g+=3,n):(n|=(127&(r=t[e.g+3]))<<21,128>r?(e.g+=4,n):(n|=(15&(r=t[e.g+4]))<<28,128>r?(e.g+=5,n>>>0):(e.g+=5,128<=t[e.g++]&&128<=t[e.g++]&&128<=t[e.g++]&&128<=t[e.g++]&&e.g++,n)))))}function H(e){var t=e.h[e.g],r=e.h[e.g+1],n=e.h[e.g+2],i=e.h[e.g+3];return e.g+=4,e=2*((r=(t|r<<8|n<<16|i<<24)>>>0)>>31)+1,t=r>>>23&255,r&=8388607,255==t?r?NaN:1/0*e:0==t?1401298464324817e-60*e*r:e*Math.pow(2,t-150)*(r+8388608)}z.prototype.reset=function(){this.g=this.j};var V=[];function G(){this.g=new Uint8Array(64),this.h=0}function X(e,t){for(;127<t;)e.push(127&t|128),t>>>=7;e.push(t)}function Z(e){var t={},r=void 0!==t.N&&t.N;this.o={v:void 0!==t.v&&t.v},this.N=r,t=this.o,V.length?(r=V.pop(),t&&(r.v=t.v),e&&D(r,e),e=r):e=new z(e,t),this.g=e,this.m=this.g.g,this.h=this.i=this.l=-1,this.j=!1}function q(e){var t=e.g;if((t=t.g==t.i)||(t=e.j)||(t=(t=e.g).l||0>t.g||t.g>t.i),t)return!1;e.m=e.g.g;var r=7&(t=W(e.g));return 0!=r&&5!=r&&1!=r&&2!=r&&3!=r&&4!=r?(e.j=!0,!1):(e.i=t,e.l=t>>>3,e.h=r,!0)}function $(e,t,r){var n=e.g.i,i=W(e.g);return i=e.g.g+i,e.g.i=i,r(t,e),e.g.g=i,e.g.i=n,t}function Y(e){var t,r=W(e.g),n=(e=e.g).g;if(e.g+=r,e=e.h,O)(t=R)||(t=R=new TextDecoder("utf-8",{fatal:!1})),t=t.decode(e.subarray(n,n+r));else{r=n+r;for(var i,a,o,s=[],u=null;n<r;)128>(i=e[n++])?s.push(i):224>i?n>=r?s.push(65533):(a=e[n++],194>i||128!=(192&a)?(n--,s.push(65533)):s.push((31&i)<<6|63&a)):240>i?n>=r-1?s.push(65533):128!=(192&(a=e[n++]))||224===i&&160>a||237===i&&160<=a||128!=(192&(t=e[n++]))?(n--,s.push(65533)):s.push((15&i)<<12|(63&a)<<6|63&t):244>=i?n>=r-2?s.push(65533):128!=(192&(a=e[n++]))||0!=a-144+(i<<28)>>30||128!=(192&(t=e[n++]))||128!=(192&(o=e[n++]))?(n--,s.push(65533)):(i=((7&i)<<18|(63&a)<<12|(63&t)<<6|63&o)-65536,s.push(55296+(i>>
110&1023),56320+(1023&i))):s.push(65533),8192<=s.length&&(u=T(u,s),s.length=0);t=T(u,s)}return t}function K(){this.h=[],this.i=0,this.g=new G}function J(e,t){0!==t.length&&(e.h.push(t),e.i+=t.length)}function Q(e){var t=e.i+e.g.length();if(0===t)return new Uint8Array(0);t=new Uint8Array(t);for(var r=e.h,n=r.length,i=0,a=0;a<n;a++){var o=r[a];0!==o.length&&(t.set(o,i),i+=o.length)}return 0!==(n=(r=e.g).h)&&(t.set(r.g.subarray(0,n),i),r.h=0),e.h=[t],t}function ee(e,t,r){if(null!=r){X(e.g,8*t+5),e=e.g;var n=r;0===(n=(r=+(0>n))?-n:n)?j=0<1/n?0:0x80000000:isNaN(n)?j=0x7fffffff:34028234663852886e22<n?j=(r<<31|0x7f800000)>>>0:11754943508222875e-54>n?j=(r<<31|(n=Math.round(n/1401298464324817e-60)))>>>0:(t=Math.floor(Math.log(n)/Math.LN2),n*=Math.pow(2,-t),j=(r<<31|t+127<<23|(n=8388607&Math.round(8388608*n)))>>>0),r=j,e.push(r>>>0&255),e.push(r>>>8&255),e.push(r>>>16&255),e.push(r>>>24&255)}}G.prototype.push=function(e){if(!(this.h+1<this.g.length)){var t=this.g;this.g=new Uint8Array(Math.ceil(1+2*this.g.length)),this.g.set(t)}this.g[this.h++]=e},G.prototype.length=function(){return this.h},G.prototype.end=function(){var e=this.g,t=this.h;return this.h=0,U(e,0,t)},Z.prototype.reset=function(){this.g.reset(),this.h=this.l=-1};var et="function"==typeof Uint8Array;function er(e,t,r){if(null!=e)return"object"==typeof e?et&&e instanceof Uint8Array?r(e):en(e,t,r):t(e)}function en(e,t,r){if(Array.isArray(e)){for(var n=Array(e.length),i=0;i<e.length;i++)n[i]=er(e[i],t,r);return Array.isArray(e)&&e.W&&es(n),n}for(i in n={},e)n[i]=er(e[i],t,r);return n}function ei(e){return"number"==typeof e?isFinite(e)?e:String(e):e}var ea,eo={W:{value:!0,configurable:!0}};function es(e){return Array.isArray(e)&&!Object.isFrozen(e)&&Object.defineProperties(e,eo),e}function eu(e,t,r){var n=ea;if(ea=null,e||(e=n),n=this.constructor.ca,e||(e=n?[n]:[]),this.j=n?0:-1,this.i=null,this.g=e,e=(n=this.g.length)-1,n&&null!==(n=this.g[e])&&"object"==typeof n&&n.constructor===Object?(this.l=e-this.j,this.h=n):void 0!==t&&-1<t?(this.l=Math.max(t,e+1-this.j),this.h=null):this.l=Number.MAX_VALUE,r)for(t=0;t<r.length;t++)(e=r[t])<this.l?(e+=this.j,(n=this.g[e])?es(n):this.g[e]=ec):(el(this),(n=this.h[e])?es(n):this.h[e]=ec)}var ec=Object.freeze(es([]));function el(e){var t=e.l+e.j;e.g[t]||(e.h=e.g[t]={})}function eh(e,t,r){return -1===t?null:void 0!==r&&r||t>=e.l?e.h?e.h[t]:void 0:e.g[t+e.j]}function ef(e){var t=void 0!==t&&t,r=eh(e,1,t);return null==r&&(r=ec),r===ec&&ep(e,1,r=es([]),t),r}function ed(e,t,r){return null==(e=null==(e=eh(e,t))?e:+e)?void 0===r?0:r:e}function ep(e,t,r,n){void 0!==n&&n||t>=e.l?(el(e),e.h[t]=r):e.g[t+e.j]=r}function em(e,t){e.i||(e.i={});var r=e.i[1];if(!r){var n=ef(e);r=[];for(var i=0;i<n.length;i++)r[i]=new t(n[i]);e.i[1]=r}return r}function eg(e,t,r,n){var i=em(e,r);t=t||new r,e=ef(e),null!=n?(i.splice(n,0,t),e.splice(n,0,ev(t,!1))):(i.push(t),e.push(ev(t,!1)))}function ev(e,t){if(e.i)for(var r in e.i){var n=e.i[r];if(Array.isArray(n))for(var i=0;i<n.length;i++)n[i]&&ev(n[i],t);else n&&ev(n,t)}return e.g}function eb(e,t){return null==(e=eh(e,t))?0:e}function ew(e,t){return null==(e=eh(e,t))?"":e}function ey(e,t){if(e=e.m){J(t,t.g.end());for(var r=0;r<e.length;r++)J(t,e[r])}}function ek(e,t){if(4==t.h)return!1;var r=t.m;return function e(t){switch(t.h){case 0:if(0!=t.h)e(t);else{for(t=t.g;128&t.h[t.g];)t.g++;t.g++}break;case 1:1!=t.h?e(t):(t=t.g).g+=8;break;case 2:if(2!=t.h)e(t);else{var r=W(t.g);(t=t.g).g+=r}break;case 5:5!=t.h?e(t):(t=t.g).g+=4;break;case 3:for(r=t.l;;){if(!q(t)){t.j=!0;break}if(4==t.h){t.l!=r&&(t.j=!0);break}e(t)}break;default:t.j=!0}}(t),t.N||(t=U(t.g.h,r,t.g.g),(r=e.m)?r.push(t):e.m=[t]),!0}function ex(e,t){var r=void 0;return new(r||(r=Promise))(function(n,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function o(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(a,o)}s((t=t.apply(e,void 0)).next())})}function e_(e){eu.call(this,e)}function eE(e,t){for(;q(t);)switch(t.i){case 8:var r=W(t.g);ep(e,1,r);break;case 21:ep(e,2,r=H(t.g));break;case 26:ep(e,3,r=Y(t));break;case 34:ep(e,4,r=Y(t));break;default:if(!ek(e,t))return e}return e}function eT(e){eu.call(this,e,-1,eS)}
1eu.prototype.toJSON=function(){return en(ev(this,!1),ei,B)},eu.prototype.toString=function(){return ev(this,!1).toString()},f(e_,eu),f(eT,eu),eT.prototype.addClassification=function(e,t){eg(this,e,e_,t)};var eS=[1];function eR(e){eu.call(this,e)}function eA(e,t){for(;q(t);)switch(t.i){case 13:var r=H(t.g);ep(e,1,r);break;case 21:ep(e,2,r=H(t.g));break;case 29:ep(e,3,r=H(t.g));break;case 37:ep(e,4,r=H(t.g));break;case 45:ep(e,5,r=H(t.g));break;default:if(!ek(e,t))return e}return e}function eO(e){eu.call(this,e,-1,eP)}f(eR,eu),f(eO,eu);var eP=[1];function eC(e){eu.call(this,e)}function eI(e,t,r){if(r=e.createShader(0===r?e.VERTEX_SHADER:e.FRAGMENT_SHADER),e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error("Could not compile WebGL shader.\n\n"+e.getShaderInfoLog(r));return r}function eF(e){return{x:ed(e,1),y:ed(e,2),z:ed(e,3),visibility:null!=eh(e,4)?ed(e,4):void 0}}function eB(e,t){this.h=e,this.g=t,this.l=0}function eM(e,t,r){return function(e,t){var r=e.g;if(void 0===e.m){var n=eI(r,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",0),i=eI(r,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D sampler0;\n void main(){\n gl_FragColor = texture2D(sampler0, vTex);\n }",1),a=r.createProgram();if(r.attachShader(a,n),r.attachShader(a,i),r.linkProgram(a),!r.getProgramParameter(a,r.LINK_STATUS))throw Error("Could not compile WebGL program.\n\n"+r.getProgramInfoLog(a));n=e.m=a,r.useProgram(n),i=r.getUniformLocation(n,"sampler0"),e.j={I:r.getAttribLocation(n,"aVertex"),H:r.getAttribLocation(n,"aTex"),da:i},e.s=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,e.s),r.enableVertexAttribArray(e.j.I),r.vertexAttribPointer(e.j.I,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),e.o=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,e.o),r.enableVertexAttribArray(e.j.H),r.vertexAttribPointer(e.j.H,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.uniform1i(i,0)}n=e.j,r.useProgram(e.m),r.canvas.width=t.width,r.canvas.height=t.height,r.viewport(0,0,t.width,t.height),r.activeTexture(r.TEXTURE0),e.h.bindTexture2d(t.glName),r.enableVertexAttribArray(n.I),r.bindBuffer(r.ARRAY_BUFFER,e.s),r.vertexAttribPointer(n.I,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(n.H),r.bindBuffer(r.ARRAY_BUFFER,e.o),r.vertexAttribPointer(n.H,2,r.FLOAT,!1,0,0),r.bindFramebuffer(r.DRAW_FRAMEBUFFER?r.DRAW_FRAMEBUFFER:r.FRAMEBUFFER,null),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.colorMask(!0,!0,!0,!0),r.drawArrays(r.TRIANGLE_FAN,0,4),r.disableVertexAttribArray(n.I),r.disableVertexAttribArray(n.H),r.bindBuffer(r.ARRAY_BUFFER,null),e.h.bindTexture2d(0)}(e,t),"function"==typeof e.g.canvas.transferToImageBitmap?Promise.resolve(e.g.canvas.transferToImageBitmap()):r?Promise.resolve(e.g.canvas):"function"==typeof createImageBitmap?createImageBitmap(e.g.canvas):(void 0===e.i&&(e.i=document.createElement("canvas")),new Promise(function(t){e.i.height=e.g.canvas.height,e.i.width=e.g.canvas.width,e.i.getContext("2d",{}).drawImage(e.g.canvas,0,0,e.g.canvas.width,e.g.canvas.height),t(e.i)}))}function eL(e){this.g=e}f(eC,eu);var eN=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function eU(e,t){return t+e}function ej(e){if(this.g=e,this.listeners={},this.j={},this.F={},this.m={},this.s={},this.G=this.o=this.R=!0,this.C=Promise.resolve(),this.P="",this.B={},this.locateFile=e&&e.locateFile||eU,"object"==typeof window)var t=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else{if("u"<typeof location)throw Error("solutions can only be loaded on a web page or in a web worker");t=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"}if(this.S=t,e.options)for(var r=(t=a(Object.keys(e.options))).next();!r.done;r=t.next()){r=r.value;var n=e.options[r].default;void 0!==n&&(this.j[r]="function"==typeof n?n():n)}}function ez(e,t){return ex(e,function e(){var r,n=this;return k(e,function(e){return t in n.F?e.return(n.F[t]):(r=fetch(n.locateFile(t,"")).then(function(e){return e.arrayBuffer()}),n.F[t]=r,e.return(r))})})}function eD(e){return void 0===e&&(e=0),1===e?"selfie_segmentation_landscape.tflite":"selfie_segmentation.tflite"}function eW(e){var t=this;e=e||{},this.g=new ej({locateFile:e.locateFile,files:function(e){return[{simd:!0,url:"selfie_segmentation_solution_simd_wasm_bin.js"},{simd:!1,url:"selfie_segmentation_solution_wasm_bin.js"},{data:!0,url:eD(e.modelSelection)}]},graph:{url:"selfie_segmentation.binarypb"},listeners:[{wants:["segmentation_mask","image_transformed"],outs:{image:{type:"texture",stream:"image_transformed"},segmentationMask:{type:"texture",stream:"segmentation_mask"}}}
1],inputs:{image:{type:"video",stream:"input_frames_gpu"}},options:{useCpuInference:{type:0,graphOptionXref:{calculatorType:"InferenceCalculator",fieldName:"use_cpu_inference"},default:"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},selfieMode:{type:0,graphOptionXref:{calculatorType:"GlScalerCalculator",calculatorIndex:1,fieldName:"flip_horizontal"}},modelSelection:{type:1,graphOptionXref:{calculatorType:"ConstantSidePacketCalculator",calculatorName:"ConstantSidePacketCalculatorModelSelection",fieldName:"int_value"},onChange:function(e){return ex(t,function t(){var r,n,i,a=this;return k(t,function(t){return 1==t.g?(n="third_party/mediapipe/modules/selfie_segmentation/"+(r=eD(e)),g(t,ez(a.g,r),2)):(i=t.h,a.g.overrideFile(n,i),t.return(!0))})})}}}})}(s=ej.prototype).close=function(){return this.i&&this.i.delete(),Promise.resolve()},s.reset=function(){return ex(this,function e(){var t=this;return k(e,function(e){t.i&&(t.i.reset(),t.m={},t.s={}),e.g=0})})},s.setOptions=function(e,t){var r=this;if(t=t||this.g.options){for(var n=[],i=[],o={},s=a(Object.keys(e)),u=s.next();!u.done;o={K:o.K,L:o.L},u=s.next()){var c=u.value;c in this.j&&this.j[c]===e[c]||(this.j[c]=e[c],void 0!==(u=t[c])&&(u.onChange&&(o.K=u.onChange,o.L=e[c],n.push(function(e){return function(){return ex(r,function t(){var r=this;return k(t,function(t){if(1==t.g)return g(t,e.K(e.L),2);!0===t.h&&(r.o=!0),t.g=0})})}}(o))),u.graphOptionXref&&(c={valueNumber:1===u.type?e[c]:0,valueBoolean:0===u.type&&e[c],valueString:2===u.type?e[c]:""},u=Object.assign(Object.assign(Object.assign({},{calculatorName:"",calculatorIndex:0}),u.graphOptionXref),c),i.push(u))))}0===n.length&&0===i.length||(this.o=!0,this.A=(void 0===this.A?[]:this.A).concat(i),this.u=(void 0===this.u?[]:this.u).concat(n))}},s.initialize=function(){return ex(this,function e(){var t=this;return k(e,function(e){return 1==e.g?g(e,ex(t,function e(){var t,r,n,i,a,s,u,c,l,h,f,d=this;return k(e,function(e){var p,m,v;switch(e.g){case 1:return t=d,d.R?(p=d.j,r=void 0===d.g.files?[]:"function"==typeof d.g.files?d.g.files(p):d.g.files,g(e,function(){return ex(this,function e(){return k(e,function(e){switch(e.g){case 1:return e.m=2,g(e,WebAssembly.instantiate(eN),4);case 4:e.g=3,e.m=0;break;case 2:return e.m=0,e.j=null,e.return(!1);case 3:return e.return(!0)}})})}(),2)):e.return();case 2:if(n=e.h,"object"==typeof window)return m={locateFile:d.locateFile},window.createMediapipeSolutionsWasm=m,v={locateFile:d.locateFile},window.createMediapipeSolutionsPackedAssets=v,s=r.filter(function(e){return void 0!==e.data}),u=r.filter(function(e){return void 0===e.data}),c=Promise.all(s.map(function(e){var r=ez(t,e.url);if(void 0!==e.path){var n=e.path;r=r.then(function(e){return t.overrideFile(n,e),Promise.resolve(e)})}return r})),l=Promise.all(u.map(function(e){var r,i;return void 0===e.simd||e.simd&&n||!e.simd&&!n?(r=t.locateFile(e.url,t.S),(i=document.createElement("script")).setAttribute("src",r),i.setAttribute("crossorigin","anonymous"),new Promise(function(e){i.addEventListener("load",function(){e()},!1),i.addEventListener("error",function(){e()},!1),document.body.appendChild(i)})):Promise.resolve()})).then(function(){return ex(t,function e(){var t=this;return k(e,function(e){if(1==e.g)return g(e,(0,window.createMediapipeSolutionsWasm)(window.createMediapipeSolutionsPackedAssets),2);t.h=e.h,e.g=0})})}),h=ex(t,function e(){var t=this;return k(e,function(e){return t.g.graph&&t.g.graph.url?e=g(e,ez(t,t.g.graph.url),0):(e.g=0,e=void 0),e})}),g(e,Promise.all([l,c,h]),7);if("function"!=typeof importScripts)throw Error("solutions can only be loaded on a web page or in a web worker");return i=r.filter(function(e){return void 0===e.simd||e.simd&&n||!e.simd&&!n}).map(function(e){return t.locateFile(e.url,t.S)}),importScripts.apply(null,o(i)),g(e,createMediapipeSolutionsWasm(Module),6);case 6:d.h=e.h,d.l=new OffscreenCanvas(1,1),d.h.canvas=d.l,a=d.h.GL.createContext(d.l,{antialias:!1,alpha:!1,ba:"u">typeof WebGL2RenderingContext?2:1}),d.h.GL.makeContextCurrent(a),e.g=4;break;case 7:if(d.l=document.createElement("canvas"),!(f=d.l.getContext("webgl2",{}))&&!(f=d.l.getContext("webgl",{})))return alert("Failed to create WebGL canvas context when passing video frame."),e.return();d.D=f,d.h.canvas=d.l,d.h.createContext(d.l,!0,!0,{});case 4:d.i=new d.h.SolutionWasm,d.R=!1,e.g=0}})}),2):3!=e.g?g(e,ex(t,function e(){var t,r,n,i,s,u,c,l=this;return k(e,function(e){if(1==e.g)return l.g.graph&&l.g.graph.url&&l.P===l.g.graph.url?e.return():(l.o=!0,l.g.graph&&l.g.graph.url?(l.P=l.g.graph.url,g(e,ez(l,l.g.graph.url),3)):void(e.g=2));for(2!=e.g&&(t=e.h,l.i.loadGraph(t)),n=(r=a(Object.keys(l.B))).next();!n.done;n=r.next())i=n.value,l.i.overrideFile(i,l.B[i]);if(l.B={},l.g.listeners)for(u=(s=a(l.g.listeners)).next();!u.done;u=s.next())!function(e,t){for(var r=t.name||"$",n=[].concat(o(t.wants)),i=new e.h.StringList,s=a(t.wants),u=s.next();!u.done;u=s.next())i.push_back(u.value);s=e.h.PacketListener.implement({onResults:function(i){for(var o,s={},u=0;u<t.wants.length;++u)s[n[u]]=i.get(u);var c=e.listeners[r];c&&(e.C=(o=t.outs,ex(e,function e(){var t,r,n,i,u,c,l,h,f,d,p,m,v,b=this;return k(e,function(e){switch(e.g){case 1:if(!o)return e.return(s);for(t={},r=0,i=(n=a(Object.keys(o))).next();!i.done;i=n.next())"string"!=typeof(u=o[i.value])&&"texture"===u.type&&void 0!==s[u.stream]&&++r;1<r&&(b.G=!1),i=(c=a(Object.keys(o))).next();case 2:if(i.done){e.g=4;break}if("string"==typeof(h=o[l=i.value])){var w,y;return m=t,v=l,g(e,(w=l,y=s[h],ex(b,function e(){var t,r=this;return k(e,function(e){return"number"==typeof y||y instanceof Uint8Array||y instanceof r.h.Uint8BlobList?e.return(y):y instanceof r.h.Texture2dDataOut?((t=r.s[w])||(t=new eB(r.h,r.D),r.s[w]=t),e.return(eM(t,y,r.G))):e.return(void 0)})})),14)}if(f=s[h.stream],"detection_list"===h.type){if(f){for(var x=f.getRectList(),_=f.getLandmarksList(),E=f.getClassificationsList(),T=[],S=0;S<x.size();++S){var R=x.get(S);e:{var A=new eC;for(R=new Z(R);q(R);)switch(R.i){case 13:var O=H(R.g);ep(A,1,O);break;case 21:ep(A,2,O=H(R.g));break;case 29:ep(A,3,O=H(R.g));break;case 37:ep(A,4,O=H(R.g));break;case 45:ep(A,5,O=H(R.g));break;case 48:for(var P=R.g,C=128,I=0,F=O=0;4>F&&128<=C;F++)I|=(127&(C=P.h[P.g++]))<<7*F;if(128<=C&&(I|=(127&(C=P.h[P.g++]))<<28,O|=(127&C)>>4),128<=C)for(F=0;5>F&&128<=C;F++)O|=(127&(C=P.h[P.g++]))<<7*F+3;128>C?(P=I>>>0,(O=0x80000000&(C=O>>>0))&&(C=~C>>>0,0==(P=1+~P>>>0)&&(C=C+1>>>0)),P=0x100000000*C+(P>>>0),O=O?-P:P):(P.l=!0,O=void 0),ep(A,6,O);break;default:if(!ek(A,R))break e}}for(A={Z:ed(A,1),$:ed(A,2),height:ed(A,3),width:ed(A,4),rotation:ed(A,5,0),X:eb(A,6)},O=_.get(S),R=new eO,O=new Z(O);q(O);)if(10===O.i)eg(R,P=$(O,new eR,eA),eR,void 0);else if(!ek(R,O))break;
1for(R=em(R,eR).map(eF),P=E.get(S),O=new eT,P=new Z(P);q(P);)if(10===P.i)O.addClassification($(P,new e_,eE));else if(!ek(O,P))break;A={T:A,O:R,M:em(O,e_).map(function(e){return{index:eb(e,1),Y:ed(e,2),label:null!=eh(e,3)?ew(e,3):void 0,displayName:null!=eh(e,4)?ew(e,4):void 0}})},T.push(A)}x=T}else x=[];t[l]=x,e.g=7;break}if("proto_list"===h.type){if(f){for(x=Array(f.size()),_=0;_<f.size();_++)x[_]=f.get(_);f.delete()}else x=[];t[l]=x,e.g=7;break}if(void 0===f){e.g=3;break}if("float_list"===h.type||"proto"===h.type){t[l]=f,e.g=7;break}if("texture"!==h.type)throw Error("Unknown output config type: '"+h.type+"'");return(d=b.s[l])||(d=new eB(b.h,b.D),b.s[l]=d),g(e,eM(d,f,b.G),13);case 13:p=e.h,t[l]=p;case 7:h.transform&&t[l]&&(t[l]=h.transform(t[l])),e.g=3;break;case 14:m[v]=e.h;case 3:i=c.next(),e.g=2;break;case 4:return e.return(t)}})})).then(function(r){r=c(r);for(var i=0;i<t.wants.length;++i){var a=s[n[i]];"object"==typeof a&&a.hasOwnProperty&&a.hasOwnProperty("delete")&&a.delete()}r&&(e.C=r)}))}}),e.i.attachMultiListener(i,s),i.delete()}(l,u.value);c=l.j,l.j={},l.setOptions(c),e.g=0})}),3):g(e,ex(t,function e(){var t,r,n,i,o,s,u=this;return k(e,function(e){switch(e.g){case 1:if(!u.o)return e.return();if(!u.u){e.g=2;break}r=(t=a(u.u)).next();case 3:if(r.done){e.g=5;break}return g(e,(0,r.value)(),4);case 4:r=t.next(),e.g=3;break;case 5:u.u=void 0;case 2:if(u.A){for(n=new u.h.GraphOptionChangeRequestList,o=(i=a(u.A)).next();!o.done;o=i.next())s=o.value,n.push_back(s);u.i.changeOptions(n),n.delete(),u.A=void 0}u.o=!1,e.g=0}})}),0)})})},s.overrideFile=function(e,t){this.i?this.i.overrideFile(e,t):this.B[e]=t},s.clearOverriddenFiles=function(){this.B={},this.i&&this.i.clearOverriddenFiles()},s.send=function(e,t){return ex(this,function r(){var n,i,o,s,u,c,l,h,f,d=this;return k(r,function(r){switch(r.g){case 1:return d.g.inputs?(n=1e3*(null==t?performance.now():t),g(r,d.C,2)):r.return();case 2:return g(r,d.initialize(),3);case 3:for(i=new d.h.PacketDataList,s=(o=a(Object.keys(e))).next();!s.done;s=o.next())if(u=s.value,c=d.g.inputs[u]){e:{var p=d,m=e[u];switch(c.type){case"video":var v=p.m[c.stream];if(v||(v=new eB(p.h,p.D),p.m[c.stream]=v),0===(p=v).l&&(p.l=p.h.createTexture()),"u">typeof HTMLVideoElement&&m instanceof HTMLVideoElement){var b=m.videoWidth;v=m.videoHeight}else"u">typeof HTMLImageElement&&m instanceof HTMLImageElement?(b=m.naturalWidth,v=m.naturalHeight):(b=m.width,v=m.height);v={glName:p.l,width:b,height:v},(b=p.g).canvas.width=v.width,b.canvas.height=v.height,b.activeTexture(b.TEXTURE0),p.h.bindTexture2d(p.l),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,m),p.h.bindTexture2d(0),p=v;break e;case"detections":for((v=p.m[c.stream])||(v=new eL(p.h),p.m[c.stream]=v),(p=v).data||(p.data=new p.g.DetectionListData),p.data.reset(m.length),v=0;v<m.length;++v){b=m[v];var w=p.data,y=w.setBoundingBox,k=v,x=b.T,_=new eC;ep(_,1,x.Z),ep(_,2,x.$),ep(_,3,x.height),ep(_,4,x.width),ep(_,5,x.rotation),ep(_,6,x.X);var E=x=new K;ee(E,1,eh(_,1)),ee(E,2,eh(_,2)),ee(E,3,eh(_,3)),ee(E,4,eh(_,4)),ee(E,5,eh(_,5));var T=eh(_,6);if(null!=T&&null!=T){X(E.g,48);var S=E.g,R=T;T=0>R;var A=(R=Math.abs(R))>>>0;for(R=Math.floor((R-A)/0x100000000)>>>0,T&&(R=~R>>>0,0xffffffff<(A=1+(~A>>>0))&&(A=0,0xffffffff<++R&&(R=0))),T=j=A,A=R;0<A||127<T;)S.push(127&T|128),T=(T>>>7|A<<25)>>>0,A>>>=7;S.push(T)}if(ey(_,E),x=Q(x),y.call(w,k,x),b.O)for(w=0;w<b.O.length;++w)E=!!(_=b.O[w]).visibility,k=(y=p.data).addNormalizedLandmark,x=v,_=Object.assign(Object.assign({},_),{visibility:E?_.visibility:0}),ep(E=new eR,1,_.x),ep(E,2,_.y),ep(E,3,_.z),_.visibility&&ep(E,4,_.visibility),ee(S=_=new K,1,eh(E,1)),ee(S,2,eh(E,2)),ee(S,3,eh(E,3)),ee(S,4,eh(E,4)),ee(S,5,eh(E,5)),ey(E,S),_=Q(_),k.call(y,x,_);if(b.M)for(w=0;w<b.M.length;++w){if(k=(y=p.data).addClassification,x=v,_=b.M[w],ep(E=new e_,2,_.Y),_.index&&ep(E,1,_.index),_.label&&ep(E,3,_.label),_.displayName&&ep(E,4,_.displayName),S=_=new K,null!=(A=eh(E,1))&&null!=A)if(X(S.g,8),T=S.g,0<=A)X(T,A);else{for(R=0;9>R;R++)T.push(127&A|128),A>>=7;T.push(1)}ee(S,2,eh(E,2)),null!=(T=eh(E,3))&&(T=C(T),X(S.g,26),X(S.g,T.length),J(S,S.g.end()),J(S,T)),null!=(T=eh(E,4))&&(T=C(T),X(S.g,34),X(S.g,T.length),J(S,S.g.end()),J(S,T)),ey(E,S),_=Q(_),k.call(y,x,_)}}p=p.data;break e;default:p={}}}switch(l=p,h=c.stream,c.type){case"video":i.pushTexture2d(Object.assign(Object.assign({},l),{stream:h,timestamp:n}));break;case"detections":(f=l).stream=h,f.timestamp=n,i.pushDetectionList(f);break;default:throw Error("Unknown input config type: '"+c.type+"'")}}return d.i.send(i),g(r,d.C,4);case 4:i.delete(),r.g=0}})})},s.onResults=function(e,t){this.listeners[t||"$"]=e},E("Solution",ej),E("OptionType",{BOOL:0,NUMBER:1,aa:2,0:"BOOL",1:"NUMBER",2:"STRING"}),(s=eW.prototype).close=function(){return this.g.close(),Promise.resolve()},s.onResults=function(e){this.g.onResults(e)},s.initialize=function(){return ex(this,function e(){var t=this;return k(e,function(e){return g(e,t.g.initialize(),0)})})},s.reset=function(){this.g.reset()},s.send=function(e){return ex(this,function t(){var r=this;return k(t,function(t){return g(t,r.g.send(e),0)})})},s.setOptions=function(e){this.g.setOptions(e)},E("SelfieSegmentation",eW),E("VERSION","0.1.1632777926")}).call(this)},25:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.cpuBlur=void 0,t.cpuBlur=function(e,t,r){for(var n=e.getContext("2d"),i=0,a=1/(2*Math.PI*25),o=r<3?1:2,s=-r;s<=r;s+=o)for(var u=-r;u<=r;u+=o)i+=a*Math.exp(-(u*u+s*s)/50);for(s=-r;s<=r;s+=o)for(u=-r;u<=r;u+=o)n.globalAlpha=a*Math.exp(-(u*u+s*s)/50)/i*r,n.drawImage(t,u,s);n.globalAlpha=1}},620:function(e,t,r){"use strict";let n;var i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.tracker=t.createTrackerAndLoad=void 0;let a=r(931),o=r(194),s=r(895);t.tracker=n;let u=()=>(t.tracker=n=(0,o.createTracker)(!0),function(){i(this,void 0,void 0,function*(){let e=yield a.BackgroundFilter.isSupported(),t=yield a.BackgroundFilter.isModelSupported("webgl_v2"),r=a.BackgroundFilter.parseUserAgent(navigator.userAgent);n.track({eventName:"vbLoadBackgroundFilterEvent_End",properties:{features:e,isModelSupported:t,deviceInfo:r}})})}(),n);t.createTrackerAndLoad=u,a.BackgroundFilter.setDefaultToken(s.VECTORLY_API_KEY),a.BackgroundFilter.setTrackerCreator(u),t.default=a.BackgroundFilter},895:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VECTORLY_API_KEY=void 0,t.VECTORLY_API_KEY="ec2ab8ed-a78a-4950-b3c9-e8c3681e2c9d"},114:function(e,t,r){"use strict";var n,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isVirtualBackgroundSupported=t.BlurStrength=t.VirtualBackground=t.BackgroundFilter=void 0;let o=a(r(409)),s=a(r(646));var u=r(620);Object.defineProperty(t,"BackgroundFilter",{enumerable:!0,get:function(){return a(u).default}});var c=r(50);Object.defineProperty(t,"VirtualBackground",{enumerable:!0,get:function(){return a(c).default}});let l=r(194);(n=t.BlurStrength||(t.BlurStrength={}))[n.Weak=2]="Weak",n[n.Balanced=5]="Balanced",n[n.Strong=9]="Strong",t.default=function(e){let t,r;t=(0,l.createTracker)(e.analytics),r=Object.assign({},e),t.track({eventName:"CreateVirtualBackground",properties:{options:r}});let n=e.reserved;return n&&n.mediapipe?new o.default(e):new s.default(e)},t.isVirtualBackgroundSupported=function(){return i(this,void 0,void 0,function*(){return s.default.isSupported()})}},409:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&a(t,e,r);return o(t,e),t},u=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loadBodyPixBlur=void 0;let l=c(r(50)),h=r(194);(n=i||(i={}))[n.default=0]="default",n[n.landscape=1]="landscape",t.loadBodyPixBlur=()=>u(void 0,void 0,void 0,function*(){return yield Promise.resolve().then(()=>s(r(25)))});let f=0,d=null;function p(e,t,r){e.globalCompositeOperation=r,e.drawImage(t,0,0)}class m extends l.default{start(e){return u(this,void 0,void 0,function*(){this.tracker.track({eventName:"VirtualBackgroun
1dStart",properties:{engine:"mediapipe"}});let n=function(e){let t=e.reserved.mediapipe;if(!(null==t?void 0:t.measurePerformance)){let e=e=>{};return{start:e,stop:e}}let r=(null==t?void 0:t.measurePerformancePrefix)||"effects_virtual_background",n=f;return f+=1,{start(e){performance.mark(`${r}:${e}:start:${n}`)},stop(e){let t=`${r}:${e}`,i=`${t}:start:${n}`;performance.measure(t,i),performance.clearMarks(i)}}}(this.options),a=this.options.frameRate||22,o=document.createElement("video");this.backgroundImage=document.createElement("img");let c=document.createElement("canvas"),l=document.createElement("canvas");if(!l.getContext("2d"))throw Error("Could not get canvas context");let m=function(){let e=document.createElement("canvas");e.getContext("2d");let t=e.captureStream(0);try{return"function"==typeof t.getVideoTracks()[0].requestFrame}finally{t.getTracks().forEach(e=>e.stop())}}(),g=l.captureStream(m?0:a).getVideoTracks()[0],v=0,b=this.options.reserved.mediapipe,{SelfieSegmentation:w}=yield u(void 0,void 0,void 0,function*(){return yield Promise.resolve().then(()=>s(r(396)))});this.segmentation=new w({locateFile:e=>`${(null==b?void 0:b.staticBasePath)||""}/${e}`}),this.segmentation.setOptions({modelSelection:i.landscape}),this.segmentation.onResults(e=>{n.stop("segmentation"),n.start("composition"),(({video:e,canvas:r,backgroundCanvas:n,blur:i,backgroundBlurAmount:a,backgroundImage:o,results:s})=>{let u=r.getContext("2d");if(!u)throw Error("Could not get canvas context"+a);let{videoWidth:c,videoHeight:l}=e;if(r.width===c&&r.height===l||(r.width=c,r.height=l,e.width=c,e.height=l,n.width=c,n.height=l),i)!function(e,r,n){let{width:i,height:a}=e,o=n.getContext("2d");o&&(o.clearRect(0,0,i,a),o.save(),(0,h.isSafari)()?d?d(n,e,r):((0,t.loadBodyPixBlur)().then(({cpuBlur:e})=>{d=e}),o.drawImage(e,0,0,i,a)):(o.filter=`blur(${r}px)`,o.drawImage(e,0,0,i,a)),o.restore())}(e,a,n);else if(o){let e=n.getContext("2d");e&&(e.clearRect(0,0,c,l),e.drawImage(o,0,0,c,l))}0===s.segmentationMask.width&&o?u.drawImage(o,0,0,c,l):(u.save(),u.clearRect(0,0,c,l),u.filter="blur(5px)",u.drawImage(s.segmentationMask,0,0,c,l),u.filter="none",p(u,s.image,"source-in"),p(u,n,"destination-atop"),u.restore())})({video:o,canvas:l,backgroundCanvas:c,blur:!!this.options.background.blurEnabled,backgroundBlurAmount:this.options.background.blurStrength||0,backgroundImage:this.backgroundImage,results:e}),n.stop("composition"),n.stop("frame"),m&&g.requestFrame(),(null==b?void 0:b.onFrame)&&(null==b||b.onFrame(performance.now()-v))});let y=[];y.push(new Promise(t=>{o.addEventListener("loadeddata",()=>t()),o.playsInline=!0,o.muted=!0,o.srcObject=new MediaStream([e]),o.play()}));let k=this.options.background.imagePath;k&&y.push(this.loadBackgroundImage(k)),yield Promise.all(y);let x=(0,h.limitSimultaneousExecution)(()=>u(this,void 0,void 0,function*(){var e;n.start("frame"),n.start("segmentation"),v=performance.now(),yield null==(e=this.segmentation)?void 0:e.send({image:o})})),_=0;return this.cancelTimer=(0,h.timer)(()=>{"ended"===e.readyState||"ended"===g.readyState?stop():o.currentTime!==_&&(_=o.currentTime,x())},1e3/a),this.video=o,this.resultTrack=g,this.inputTrack=e,this.saveAndBridgeTrackStopMethods(),g})}loadBackgroundImage(e){return u(this,void 0,void 0,function*(){return e&&this.backgroundImage?(this.backgroundImage.src=e,new Promise((e,t)=>{this.backgroundImage?(this.backgroundImage.addEventListener("load",()=>e()),this.backgroundImage.addEventListener("error",()=>t(Error("Unable to load image at "+this.options.background.imagePath)))):t(Error("HTML Image element is undefined"))})):Promise.resolve()})}changeBackground(e){var t;return u(this,void 0,void 0,function*(){e.imagePath?yield this.loadBackgroundImage(e.imagePath):(null==(t=this.backgroundImage)?void 0:t.src)&&(this.backgroundImage.src=null),this.updateBackgroun
1d(e)})}stop(e=!1){var t,r;try{super.stop(e)}finally{null==(t=this.cancelTimer)||t.call(this),this.video&&(this.video.srcObject=null),null==(r=this.segmentation)||r.close()}}}t.default=m},646:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let a=r(114),o=i(r(50)),s=r(895),u=()=>n(void 0,void 0,void 0,function*(){var e;return(null==(e=window.vectorly)?void 0:e.BackgroundFilter)?Promise.resolve(window.vectorly.BackgroundFilter):new Promise((e,t)=>{let r=document.createElement("script");r.defer=!0,r.src="https://cdn.vectorly.io/ai-filters/v1/1.6.10/vectorly.BackgroundFilter.js",r.onerror=()=>{t(Error("Unable to load vectorly sdk"))},r.onload=()=>
1{e(window.vectorly.BackgroundFilter)},document.body.appendChild(r)})}),c=e=>Math.max(Math.min(e||a.BlurStrength.Balanced,10),1);class l extends o.default{constructor(){super(...arguments),this.running=!1}logPerformance(){this.running&&setTimeout(()=>{this.filter&&this.tracker.track({eventName:"VirtualBackgroundPerformance",properties:Object.assign({engine:"vectorly"},this.filter.processor.metrics)}),this.logPerformance()},6e4)}getBackgroundUrl(e){return new URL(e,document.baseURI).href}start(e){var t,r,i,a;return n(this,void 0,void 0,function*(){this.tracker.track({eventName:"VirtualBackgroundStart",properties:{engine:"vectorly"}});let n=yield u(),o=this.options.background,l=o.blurEnabled?"blur":"";!o.blurEnabled&&o.imagePath&&(l=this.getBackgroundUrl(o.imagePath));let h=null!=(t=this.options.frameRate)?t:30,f={token:s.VECTORLY_API_KEY,model:(null==(i=null==(r=this.options.reserved)?void 0:r.vectorly)?void 0:i.model)||"webgl_v2",background:l,blurRadius:c(o.blurStrength),frameRate:h,segmentationFrameRate:Math.min(null!=(a=this.options.segmentationFrameRate)?a:10,h),analyticsEnabled:!1};return this.filter=new n(e,f),this.inputTrack=e,this.resultTrack=yield this.filter.getOutputTrack(),this.running=!0,this.logPerformance(),this.saveAndBridgeTrackStopMethods(),this.resultTrack})}changeBackground(e){return n(this,void 0,void 0,function*(){if(!this.filter||!e.blurEnabled&&!e.imagePath)return;let{blurEnabled:t,imagePath:r,blurStrength:n}=e,i=t?"blur":this.getBackgroundUrl(r);yield this.filter.changeBackground(i),t&&null!=n&&(yield this.filter.changeBlurRadius(c(n))),this.updateBackgroun
1d(e)})}changeInput(e){return n(this,void 0,void 0,function*(){if(!this.filter)throw Error("Virtual background not started");if(!e)throw Error("No input track to change");this.stopTracks(),yield this.filter.changeInput(e)})}static isSupported(){return n(this,void 0,void 0,function*(){let e=yield u(),t=yield e.isSupported();return"object"==typeof t&&t.hasOwnProperty("offscreen")?!1!==t.offscreen:!1!==t})}stopTracks(){var e;null==(e=this.filter)||e.stop()}stop(e=!1){var t;super.stop(e),this.running=!1,null==(t=this.filter)||t.disable().then(()=>{var e;null==(e=this.filter)||e.destroy(),this.filter=null})}}t.default=l},50:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});let i=r(114),a=r(194);t.default=class{constructor(e){this.options=e,this.tracker=(0,a.createTracker)(e.analytics)}start(e){return n(this,void 0,void 0,function*(){return e})}stop(e=!1){var t,r,n,i,a,o;this.tracker.track({eventName:"VirtualBackgroundStop",properties:{}}),null==(t=this.inputTrack)||t.removeEventListener("ended",()=>{this.stop(!0)}),null==(r=this.resultTrack)||r.removeEventListener("ended",stop),"live"==(null==(n=this.resultTrack)?void 0:n.readyState)&&(null==(i=this.resultTrackStop)||i.call(this.resultTrack)),e&&"live"==(null==(a=this.inputTrack)?void 0:a.readyState)&&(null==(o=this.inputTrackStop)||o.call(this.inputTrack)),this.inputTrack&&this.inputTrackStop&&(this.inputTrack.stop=this.inputTrackStop),this.resultTrack&&this.resultTrackStop&&(this.resultTrack.stop=this.resultTrackStop),this.inputTrack=null,this.inputTrackStop=null,this.resultTrack=null,this.resultTrackStop=null}changeBackground(e){return n(this,void 0,void 0,function*(){})}changeInput(e){return n(this,void 0,void 0,function*(){})}static isSupported(){return n(this,void 0,void 0,function*(){return(0,i.isVirtualBackgroundSupported)()})}
1updateBackground(e){Object.assign(this.options.background,e)}saveAndBridgeTrackStopMethods(){var e,t;null==(e=this.inputTrack)||e.addEventListener("ended",()=>{this.stop(!0)}),null==(t=this.resultTrack)||t.addEventListener("ended",stop),this.resultTrack&&(this.resultTrackStop=this.resultTrack.stop,this.resultTrack.stop=()=>this.stop()),this.inputTrack&&(this.inputTrackStop=this.inputTrack.stop,this.inputTrack.stop=()=>this.stop(!0))}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(114)}()}}]); 2//# sourceMappingURL=b78c167a.2ebf14a412d5b6b6.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.