easyproctor 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,26 @@
1
- "use strict";(()=>{var fy=Object.create;var Nc=Object.defineProperty;var my=Object.getOwnPropertyDescriptor;var gy=Object.getOwnPropertyNames;var yy=Object.getPrototypeOf,by=Object.prototype.hasOwnProperty;var wn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var H=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vy=(e,t)=>{for(var r in t)Nc(e,r,{get:t[r],enumerable:!0})},wy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gy(t))!by.call(e,o)&&o!==r&&Nc(e,o,{get:()=>t[o],enumerable:!(n=my(t,o))||n.enumerable});return e};var Lu=(e,t,r)=>(r=e!=null?fy(yy(e)):{},wy(t||!e||!e.__esModule?Nc(r,"default",{value:e,enumerable:!0}):r,e));var Vg=H((Xh,Jh)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Xh<"u"?t():(t(),e.FileSaver={})})(Xh,function(){"use strict";function e(a,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function t(a,c,l){var h=new XMLHttpRequest;h.open("GET",a),h.responseType="blob",h.onload=function(){s(h.response,c,l)},h.onerror=function(){console.error("could not download file")},h.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function n(a){try{a.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,i=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!i?function(a,c,l){var h=o.URL||o.webkitURL,d=document.createElement("a");c=c||a.name||"download",d.download=c,d.rel="noopener",typeof a=="string"?(d.href=a,d.origin===location.origin?n(d):r(d.href)?t(a,c,l):n(d,d.target="_blank")):(d.href=h.createObjectURL(a),setTimeout(function(){h.revokeObjectURL(d.href)},4e4),setTimeout(function(){n(d)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,l){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(e(a,l),c);else if(r(a))t(a,c,l);else{var h=document.createElement("a");h.href=a,h.target="_blank",setTimeout(function(){n(h)})}}:function(a,c,l,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof a=="string")return t(a,c,l);var d=a.type==="application/octet-stream",u=/constructor/i.test(o.HTMLElement)||o.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||d&&u||i)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var v=m.result;v=b?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=v:location=v,h=null},m.readAsDataURL(a)}else{var f=o.URL||o.webkitURL,y=f.createObjectURL(a);h?h.location=y:location.href=y,h=null,setTimeout(function(){f.revokeObjectURL(y)},4e4)}});o.saveAs=s.saveAs=s,typeof Jh<"u"&&(Jh.exports=s)})});var e2=H((G6,Z0)=>{Z0.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Lr=H(hn=>{var eu,_v=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];hn.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};hn.getSymbolTotalCodewords=function(t){return _v[t]};hn.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};hn.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');eu=t};hn.isKanjiModeEnabled=function(){return typeof eu<"u"};hn.toSJIS=function(t){return eu(t)}});var kc=H(_t=>{_t.L={bit:1};_t.M={bit:0};_t.Q={bit:3};_t.H={bit:2};function Sv(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return _t.L;case"m":case"medium":return _t.M;case"q":case"quartile":return _t.Q;case"h":case"high":return _t.H;default:throw new Error("Unknown EC Level: "+e)}}_t.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};_t.from=function(t,r){if(_t.isValid(t))return t;try{return Sv(t)}catch{return r}}});var n2=H((J6,r2)=>{function t2(){this.buffer=[],this.length=0}t2.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};r2.exports=t2});var i2=H((Y6,o2)=>{function Pi(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Pi.prototype.set=function(e,t,r,n){let o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)};Pi.prototype.get=function(e,t){return this.data[e*this.size+t]};Pi.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};Pi.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};o2.exports=Pi});var s2=H(Ec=>{var kv=Lr().getSymbolSize;Ec.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=kv(t),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,i=[n-7];for(let s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};Ec.getPositions=function(t){let r=[],n=Ec.getRowColCoords(t),o=n.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||r.push([n[i],n[s]]);return r}});var l2=H(c2=>{var Ev=Lr().getSymbolSize,a2=7;c2.getPositions=function(t){let r=Ev(t);return[[0,0],[r-a2,0],[0,r-a2]]}});var h2=H(J=>{J.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var dn={N1:3,N2:3,N3:40,N4:10};J.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};J.from=function(t){return J.isValid(t)?parseInt(t,10):void 0};J.getPenaltyN1=function(t){let r=t.size,n=0,o=0,i=0,s=null,a=null;for(let c=0;c<r;c++){o=i=0,s=a=null;for(let l=0;l<r;l++){let h=t.get(c,l);h===s?o++:(o>=5&&(n+=dn.N1+(o-5)),s=h,o=1),h=t.get(l,c),h===a?i++:(i>=5&&(n+=dn.N1+(i-5)),a=h,i=1)}o>=5&&(n+=dn.N1+(o-5)),i>=5&&(n+=dn.N1+(i-5))}return n};J.getPenaltyN2=function(t){let r=t.size,n=0;for(let o=0;o<r-1;o++)for(let i=0;i<r-1;i++){let s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);(s===4||s===0)&&n++}return n*dn.N2};J.getPenaltyN3=function(t){let r=t.size,n=0,o=0,i=0;for(let s=0;s<r;s++){o=i=0;for(let a=0;a<r;a++)o=o<<1&2047|t.get(s,a),a>=10&&(o===1488||o===93)&&n++,i=i<<1&2047|t.get(a,s),a>=10&&(i===1488||i===93)&&n++}return n*dn.N3};J.getPenaltyN4=function(t){let r=0,n=t.data.length;for(let i=0;i<n;i++)r+=t.data[i];return Math.abs(Math.ceil(r*100/n/5)-10)*dn.N4};function Cv(e,t,r){switch(e){case J.Patterns.PATTERN000:return(t+r)%2===0;case J.Patterns.PATTERN001:return t%2===0;case J.Patterns.PATTERN010:return r%3===0;case J.Patterns.PATTERN011:return(t+r)%3===0;case J.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case J.Patterns.PATTERN101:return t*r%2+t*r%3===0;case J.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case J.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}J.applyMask=function(t,r){let n=r.size;for(let o=0;o<n;o++)for(let i=0;i<n;i++)r.isReserved(i,o)||r.xor(i,o,Cv(t,i,o))};J.getBestMask=function(t,r){let n=Object.keys(J.Patterns).length,o=0,i=1/0;for(let s=0;s<n;s++){r(s),J.applyMask(s,t);let a=J.getPenaltyN1(t)+J.getPenaltyN2(t)+J.getPenaltyN3(t)+J.getPenaltyN4(t);J.applyMask(s,t),a<i&&(i=a,o=s)}return o}});var ru=H(tu=>{var Fr=kc(),Cc=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],xc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];tu.getBlocksCount=function(t,r){switch(r){case Fr.L:return Cc[(t-1)*4+0];case Fr.M:return Cc[(t-1)*4+1];case Fr.Q:return Cc[(t-1)*4+2];case Fr.H:return Cc[(t-1)*4+3];default:return}};tu.getTotalCodewordsCount=function(t,r){switch(r){case Fr.L:return xc[(t-1)*4+0];case Fr.M:return xc[(t-1)*4+1];case Fr.Q:return xc[(t-1)*4+2];case Fr.H:return xc[(t-1)*4+3];default:return}}});var d2=H(Tc=>{var Ri=new Uint8Array(512),Ac=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)Ri[r]=t,Ac[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)Ri[r]=Ri[r-255]})();Tc.log=function(t){if(t<1)throw new Error("log("+t+")");return Ac[t]};Tc.exp=function(t){return Ri[t]};Tc.mul=function(t,r){return t===0||r===0?0:Ri[Ac[t]+Ac[r]]}});var u2=H(Di=>{var nu=d2();Di.mul=function(t,r){let n=new Uint8Array(t.length+r.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=nu.mul(t[o],r[i]);return n};Di.mod=function(t,r){let n=new Uint8Array(t);for(;n.length-r.length>=0;){let o=n[0];for(let s=0;s<r.length;s++)n[s]^=nu.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};Di.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=Di.mul(r,new Uint8Array([1,nu.exp(n)]));return r}});var m2=H((oT,f2)=>{var p2=u2();function ou(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ou.prototype.initialize=function(t){this.degree=t,this.genPoly=p2.generateECPolynomial(this.degree)};ou.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(t.length+this.degree);r.set(t);let n=p2.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(n,o),i}return n};f2.exports=ou});var iu=H(g2=>{g2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var su=H(lr=>{var y2="[0-9]+",xv="[A-Z $%*+\\-./:]+",Oi="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Oi=Oi.replace(/u/g,"\\u");var Av="(?:(?![A-Z0-9 $%*+\\-./:]|"+Oi+`)(?:.|[\r
2
- ]))+`;lr.KANJI=new RegExp(Oi,"g");lr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");lr.BYTE=new RegExp(Av,"g");lr.NUMERIC=new RegExp(y2,"g");lr.ALPHANUMERIC=new RegExp(xv,"g");var Tv=new RegExp("^"+Oi+"$"),Iv=new RegExp("^"+y2+"$"),Pv=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");lr.testKanji=function(t){return Tv.test(t)};lr.testNumeric=function(t){return Iv.test(t)};lr.testAlphanumeric=function(t){return Pv.test(t)}});var Ur=H(we=>{var Rv=iu(),au=su();we.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};we.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};we.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};we.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};we.MIXED={bit:-1};we.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Rv.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};we.getBestModeForData=function(t){return au.testNumeric(t)?we.NUMERIC:au.testAlphanumeric(t)?we.ALPHANUMERIC:au.testKanji(t)?we.KANJI:we.BYTE};we.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};we.isValid=function(t){return t&&t.bit&&t.ccBits};function Dv(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return we.NUMERIC;case"alphanumeric":return we.ALPHANUMERIC;case"kanji":return we.KANJI;case"byte":return we.BYTE;default:throw new Error("Unknown mode: "+e)}}we.from=function(t,r){if(we.isValid(t))return t;try{return Dv(t)}catch{return r}}});var S2=H(un=>{var Ic=Lr(),Ov=ru(),b2=kc(),Nr=Ur(),cu=iu(),w2=7973,v2=Ic.getBCHDigit(w2);function Bv(e,t,r){for(let n=1;n<=40;n++)if(t<=un.getCapacity(n,r,e))return n}function _2(e,t){return Nr.getCharCountIndicator(e,t)+4}function Mv(e,t){let r=0;return e.forEach(function(n){let o=_2(n.mode,t);r+=o+n.getBitsLength()}),r}function Lv(e,t){for(let r=1;r<=40;r++)if(Mv(e,r)<=un.getCapacity(r,t,Nr.MIXED))return r}un.from=function(t,r){return cu.isValid(t)?parseInt(t,10):r};un.getCapacity=function(t,r,n){if(!cu.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Nr.BYTE);let o=Ic.getSymbolTotalCodewords(t),i=Ov.getTotalCodewordsCount(t,r),s=(o-i)*8;if(n===Nr.MIXED)return s;let a=s-_2(n,t);switch(n){case Nr.NUMERIC:return Math.floor(a/10*3);case Nr.ALPHANUMERIC:return Math.floor(a/11*2);case Nr.KANJI:return Math.floor(a/13);case Nr.BYTE:default:return Math.floor(a/8)}};un.getBestVersionForData=function(t,r){let n,o=b2.from(r,b2.M);if(Array.isArray(t)){if(t.length>1)return Lv(t,o);if(t.length===0)return 1;n=t[0]}else n=t;return Bv(n.mode,n.getLength(),o)};un.getEncodedBits=function(t){if(!cu.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;Ic.getBCHDigit(r)-v2>=0;)r^=w2<<Ic.getBCHDigit(r)-v2;return t<<12|r}});var x2=H(C2=>{var lu=Lr(),E2=1335,Fv=21522,k2=lu.getBCHDigit(E2);C2.getEncodedBits=function(t,r){let n=t.bit<<3|r,o=n<<10;for(;lu.getBCHDigit(o)-k2>=0;)o^=E2<<lu.getBCHDigit(o)-k2;return(n<<10|o)^Fv}});var T2=H((hT,A2)=>{var Uv=Ur();function wo(e){this.mode=Uv.NUMERIC,this.data=e.toString()}wo.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};wo.prototype.getLength=function(){return this.data.length};wo.prototype.getBitsLength=function(){return wo.getBitsLength(this.data.length)};wo.prototype.write=function(t){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),t.put(o,10);let i=this.data.length-r;i>0&&(n=this.data.substr(r),o=parseInt(n,10),t.put(o,i*3+1))};A2.exports=wo});var P2=H((dT,I2)=>{var Nv=Ur(),hu=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function _o(e){this.mode=Nv.ALPHANUMERIC,this.data=e}_o.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};_o.prototype.getLength=function(){return this.data.length};_o.prototype.getBitsLength=function(){return _o.getBitsLength(this.data.length)};_o.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=hu.indexOf(this.data[r])*45;n+=hu.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(hu.indexOf(this.data[r]),6)};I2.exports=_o});var D2=H((uT,R2)=>{var jv=Ur();function So(e){this.mode=jv.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}So.getBitsLength=function(t){return t*8};So.prototype.getLength=function(){return this.data.length};So.prototype.getBitsLength=function(){return So.getBitsLength(this.data.length)};So.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};R2.exports=So});var B2=H((pT,O2)=>{var Vv=Ur(),Hv=Lr();function ko(e){this.mode=Vv.KANJI,this.data=e}ko.getBitsLength=function(t){return t*13};ko.prototype.getLength=function(){return this.data.length};ko.prototype.getBitsLength=function(){return ko.getBitsLength(this.data.length)};ko.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=Hv.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
3
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};O2.exports=ko});var M2=H((fT,du)=>{"use strict";var Bi={single_source_shortest_paths:function(e,t,r){var n={},o={};o[t]=0;var i=Bi.PriorityQueue.make();i.push(t,0);for(var s,a,c,l,h,d,u,b,m;!i.empty();){s=i.pop(),a=s.value,l=s.cost,h=e[a]||{};for(c in h)h.hasOwnProperty(c)&&(d=h[c],u=l+d,b=o[c],m=typeof o[c]>"u",(m||b>u)&&(o[c]=u,i.push(c,u),n[c]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var f=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(f)}return n},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t,o;n;)r.push(n),o=e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var n=Bi.single_source_shortest_paths(e,t,r);return Bi.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=Bi.PriorityQueue,r={},n;e=e||{};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof du<"u"&&(du.exports=Bi)});var z2=H(Eo=>{var V=Ur(),U2=T2(),N2=P2(),j2=D2(),V2=B2(),Mi=su(),Pc=Lr(),zv=M2();function L2(e){return unescape(encodeURIComponent(e)).length}function Li(e,t,r){let n=[],o;for(;(o=e.exec(r))!==null;)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function H2(e){let t=Li(Mi.NUMERIC,V.NUMERIC,e),r=Li(Mi.ALPHANUMERIC,V.ALPHANUMERIC,e),n,o;return Pc.isKanjiModeEnabled()?(n=Li(Mi.BYTE,V.BYTE,e),o=Li(Mi.KANJI,V.KANJI,e)):(n=Li(Mi.BYTE_KANJI,V.BYTE,e),o=[]),t.concat(r,n,o).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function uu(e,t){switch(t){case V.NUMERIC:return U2.getBitsLength(e);case V.ALPHANUMERIC:return N2.getBitsLength(e);case V.KANJI:return V2.getBitsLength(e);case V.BYTE:return j2.getBitsLength(e)}}function Wv(e){return e.reduce(function(t,r){let n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)},[])}function $v(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case V.NUMERIC:t.push([n,{data:n.data,mode:V.ALPHANUMERIC,length:n.length},{data:n.data,mode:V.BYTE,length:n.length}]);break;case V.ALPHANUMERIC:t.push([n,{data:n.data,mode:V.BYTE,length:n.length}]);break;case V.KANJI:t.push([n,{data:n.data,mode:V.BYTE,length:L2(n.data)}]);break;case V.BYTE:t.push([{data:n.data,mode:V.BYTE,length:L2(n.data)}])}}return t}function qv(e,t){let r={},n={start:{}},o=["start"];for(let i=0;i<e.length;i++){let s=e[i],a=[];for(let c=0;c<s.length;c++){let l=s[c],h=""+i+c;a.push(h),r[h]={node:l,lastCount:0},n[h]={};for(let d=0;d<o.length;d++){let u=o[d];r[u]&&r[u].node.mode===l.mode?(n[u][h]=uu(r[u].lastCount+l.length,l.mode)-uu(r[u].lastCount,l.mode),r[u].lastCount+=l.length):(r[u]&&(r[u].lastCount=l.length),n[u][h]=uu(l.length,l.mode)+4+V.getCharCountIndicator(l.mode,t))}}o=a}for(let i=0;i<o.length;i++)n[o[i]].end=0;return{map:n,table:r}}function F2(e,t){let r,n=V.getBestModeForData(e);if(r=V.from(t,n),r!==V.BYTE&&r.bit<n.bit)throw new Error('"'+e+'" cannot be encoded with mode '+V.toString(r)+`.
4
- Suggested mode is: `+V.toString(n));switch(r===V.KANJI&&!Pc.isKanjiModeEnabled()&&(r=V.BYTE),r){case V.NUMERIC:return new U2(e);case V.ALPHANUMERIC:return new N2(e);case V.KANJI:return new V2(e);case V.BYTE:return new j2(e)}}Eo.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(F2(n,null)):n.data&&r.push(F2(n.data,n.mode)),r},[])};Eo.fromString=function(t,r){let n=H2(t,Pc.isKanjiModeEnabled()),o=$v(n),i=qv(o,r),s=zv.find_path(i.map,"start","end"),a=[];for(let c=1;c<s.length-1;c++)a.push(i.table[s[c]].node);return Eo.fromArray(Wv(a))};Eo.rawSplit=function(t){return Eo.fromArray(H2(t,Pc.isKanjiModeEnabled()))}});var $2=H(W2=>{var Dc=Lr(),pu=kc(),Gv=n2(),Kv=i2(),Xv=s2(),Jv=l2(),gu=h2(),yu=ru(),Yv=m2(),Rc=S2(),Qv=x2(),Zv=Ur(),fu=z2();function ew(e,t){let r=e.size,n=Jv.getPositions(t);for(let o=0;o<n.length;o++){let i=n[o][0],s=n[o][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(let c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?e.set(i+a,s+c,!0,!0):e.set(i+a,s+c,!1,!0))}}function tw(e){let t=e.size;for(let r=8;r<t-8;r++){let n=r%2===0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function rw(e,t){let r=Xv.getPositions(t);for(let n=0;n<r.length;n++){let o=r[n][0],i=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(o+s,i+a,!0,!0):e.set(o+s,i+a,!1,!0)}}function nw(e,t){let r=e.size,n=Rc.getEncodedBits(t),o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=(n>>a&1)===1,e.set(o,i,s,!0),e.set(i,o,s,!0)}function mu(e,t,r){let n=e.size,o=Qv.getEncodedBits(t,r),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(n-15+i,8,s,!0),i<8?e.set(8,n-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(n-8,8,1,!0)}function ow(e,t){let r=e.size,n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!e.isReserved(o,a-c)){let l=!1;s<t.length&&(l=(t[s]>>>i&1)===1),e.set(o,a-c,l),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function iw(e,t,r){let n=new Gv;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),Zv.getCharCountIndicator(c.mode,e)),c.write(n)});let o=Dc.getSymbolTotalCodewords(e),i=yu.getTotalCodewordsCount(e,t),s=(o-i)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let c=0;c<a;c++)n.put(c%2?17:236,8);return sw(n,e,t)}function sw(e,t,r){let n=Dc.getSymbolTotalCodewords(t),o=yu.getTotalCodewordsCount(t,r),i=n-o,s=yu.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),h=Math.floor(i/s),d=h+1,u=l-h,b=new Yv(u),m=0,f=new Array(s),y=new Array(s),v=0,_=new Uint8Array(e.buffer);for(let ue=0;ue<s;ue++){let se=ue<c?h:d;f[ue]=_.slice(m,m+se),y[ue]=b.encode(f[ue]),m+=se,v=Math.max(v,se)}let x=new Uint8Array(n),B=0,O,R;for(O=0;O<v;O++)for(R=0;R<s;R++)O<f[R].length&&(x[B++]=f[R][O]);for(O=0;O<u;O++)for(R=0;R<s;R++)x[B++]=y[R][O];return x}function aw(e,t,r,n){let o;if(Array.isArray(e))o=fu.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let h=fu.rawSplit(e);l=Rc.getBestVersionForData(h,r)}o=fu.fromString(e,l||40)}else throw new Error("Invalid data");let i=Rc.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=i;else if(t<i)throw new Error(`
1
+ "use strict";(()=>{var by=Object.create;var ll=Object.defineProperty;var _y=Object.getOwnPropertyDescriptor;var vy=Object.getOwnPropertyNames;var wy=Object.getPrototypeOf,Sy=Object.prototype.hasOwnProperty;var hr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ky=(e,t)=>{for(var r in t)ll(e,r,{get:t[r],enumerable:!0})},Ey=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vy(t))!Sy.call(e,i)&&i!==r&&ll(e,i,{get:()=>t[i],enumerable:!(n=_y(t,i))||n.enumerable});return e};var hl=(e,t,r)=>(r=e!=null?by(wy(e)):{},Ey(t||!e||!e.__esModule?ll(r,"default",{value:e,enumerable:!0}):r,e));var t0=ve((e0,vu)=>{(function(e){typeof e0=="object"&&typeof vu<"u"?vu.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=e()})(function(){return(function e(t,r,n){function i(a,c){if(!r[a]){if(!t[a]){var l=typeof hr=="function"&&hr;if(!c&&l)return l(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[a]={exports:{}};t[a][0].call(u.exports,function(m){var p=t[a][1][m];return i(p||m)},u,u.exports,e,t,r,n)}return r[a].exports}for(var o=typeof hr=="function"&&hr,s=0;s<n.length;s++)i(n[s]);return i})({1:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(s){for(var a,c,l,h,u,m,p,g=[],f=0,b=s.length,_=b,k=n.getTypeOf(s)!=="string";f<s.length;)_=b-f,l=k?(a=s[f++],c=f<b?s[f++]:0,f<b?s[f++]:0):(a=s.charCodeAt(f++),c=f<b?s.charCodeAt(f++):0,f<b?s.charCodeAt(f++):0),h=a>>2,u=(3&a)<<4|c>>4,m=1<_?(15&c)<<2|l>>6:64,p=2<_?63&l:64,g.push(o.charAt(h)+o.charAt(u)+o.charAt(m)+o.charAt(p));return g.join("")},r.decode=function(s){var a,c,l,h,u,m,p=0,g=0,f="data:";if(s.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===o.charAt(64)&&_--,s.charAt(s.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|_):new Array(0|_);p<s.length;)a=o.indexOf(s.charAt(p++))<<2|(h=o.indexOf(s.charAt(p++)))>>4,c=(15&h)<<4|(u=o.indexOf(s.charAt(p++)))>>2,l=(3&u)<<6|(m=o.indexOf(s.charAt(p++))),b[g++]=a,u!==64&&(b[g++]=c),m!==64&&(b[g++]=l);return b}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(c,l,h,u,m){this.compressedSize=c,this.uncompressedSize=l,this.crc32=h,this.compression=u,this.compressedContent=m}a.prototype={getContentWorker:function(){var c=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),l=this;return c.on("end",function(){if(this.streamInfo.data_length!==l.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(c,l,h){return c.pipe(new o).pipe(new s("uncompressedSize")).pipe(l.compressWorker(h)).pipe(new s("compressedSize")).withStreamInfo("compression",l)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=(function(){for(var o,s=[],a=0;a<256;a++){o=a;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;s[a]=o}return s})();t.exports=function(o,s){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?(function(a,c,l,h){var u=i,m=h+l;a^=-1;for(var p=h;p<m;p++)a=a>>>8^u[255&(a^c[p])];return-1^a})(0|s,o,o.length,0):(function(a,c,l,h){var u=i,m=h+l;a^=-1;for(var p=h;p<m;p++)a=a>>>8^u[255&(a^c.charCodeAt(p))];return-1^a})(0|s,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise<"u"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=n?"uint8array":"array";function c(l,h){s.call(this,"FlateWorker/"+l),this._pako=null,this._pakoAction=l,this._pakoOptions=h,this.meta={}}r.magic="\b\0",o.inherits(c,s),c.prototype.processChunk=function(l){this.meta=l.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(a,l.data),!1)},c.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var l=this;this._pako.onData=function(h){l.push({data:h,meta:l.meta})}},r.compressWorker=function(l){return new c("Deflate",l)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(u,m){var p,g="";for(p=0;p<m;p++)g+=String.fromCharCode(255&u),u>>>=8;return g}function i(u,m,p,g,f,b){var _,k,S=u.file,R=u.compression,x=b!==a.utf8encode,D=o.transformTo("string",b(S.name)),P=o.transformTo("string",a.utf8encode(S.name)),N=S.comment,Z=o.transformTo("string",b(N)),E=o.transformTo("string",a.utf8encode(N)),F=P.length!==S.name.length,y=E.length!==N.length,U="",se="",V="",he=S.dir,H=S.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};m&&!p||(oe.crc32=u.crc32,oe.compressedSize=u.compressedSize,oe.uncompressedSize=u.uncompressedSize);var O=0;m&&(O|=8),x||!F&&!y||(O|=2048);var I=0,Q=0;he&&(I|=16),f==="UNIX"?(Q=798,I|=(function(G,Be){var nt=G;return G||(nt=Be?16893:33204),(65535&nt)<<16})(S.unixPermissions,he)):(Q=20,I|=(function(G){return 63&(G||0)})(S.dosPermissions)),_=H.getUTCHours(),_<<=6,_|=H.getUTCMinutes(),_<<=5,_|=H.getUTCSeconds()/2,k=H.getUTCFullYear()-1980,k<<=4,k|=H.getUTCMonth()+1,k<<=5,k|=H.getUTCDate(),F&&(se=n(1,1)+n(c(D),4)+P,U+="up"+n(se.length,2)+se),y&&(V=n(1,1)+n(c(Z),4)+E,U+="uc"+n(V.length,2)+V);var q="";return q+=`
2
+ \0`,q+=n(O,2),q+=R.magic,q+=n(_,2),q+=n(k,2),q+=n(oe.crc32,4),q+=n(oe.compressedSize,4),q+=n(oe.uncompressedSize,4),q+=n(D.length,2),q+=n(U.length,2),{fileRecord:l.LOCAL_FILE_HEADER+q+D+U,dirRecord:l.CENTRAL_FILE_HEADER+n(Q,2)+q+n(Z.length,2)+"\0\0\0\0"+n(I,4)+n(g,4)+D+U+Z}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(u,m,p,g){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=p,this.encodeFileName=g,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(h,s),h.prototype.push=function(u){var m=u.meta.percent||0,p=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,s.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:p?(m+100*(p-g-1))/p:100}}))},h.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var m=this.streamFiles&&!u.file.dir;if(m){var p=i(u,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(u){this.accumulate=!1;var m=this.streamFiles&&!u.file.dir,p=i(u,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),m)this.push({data:(function(g){return l.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)})(u),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var u=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var p=this.bytesWritten-u,g=(function(f,b,_,k,S){var R=o.transformTo("string",S(k));return l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(f,2)+n(f,2)+n(b,4)+n(_,4)+n(R.length,2)+R})(this.dirRecords.length,p,u,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(u){this._sources.push(u);var m=this;return u.on("data",function(p){m.processChunk(p)}),u.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),u.on("error",function(p){m.error(p)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(u){var m=this._sources;if(!s.prototype.error.call(this,u))return!1;for(var p=0;p<m.length;p++)try{m[p].error(u)}catch{}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var u=this._sources,m=0;m<u.length;m++)u[m].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(o,s,a){var c=new i(s.streamFiles,a,s.platform,s.encodeFileName),l=0;try{o.forEach(function(h,u){l++;var m=(function(b,_){var k=b||_,S=n[k];if(!S)throw new Error(k+" is not a valid compression method !");return S})(u.options.compression,s.compression),p=u.options.compressionOptions||s.compressionOptions||{},g=u.dir,f=u.date;u._compressWorker(m,p).withStreamInfo("file",{name:h,dir:g,date:f,comment:u.comment||"",unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions}).pipe(c)}),c.entriesCount=l}catch(h){c.error(h)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new n;for(var o in this)typeof this[o]!="function"&&(i[o]=this[o]);return i}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(i,o){return new n().loadAsync(i,o)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./external"),o=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(h){return new i.Promise(function(u,m){var p=h.decompressed.getContentWorker().pipe(new a);p.on("error",function(g){m(g)}).on("end",function(){p.streamInfo.crc32!==h.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):u()}).resume()})}t.exports=function(h,u){var m=this;return u=n.extend(u||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),c.isNode&&c.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",h,!0,u.optimizedBinaryString,u.base64).then(function(p){var g=new s(u);return g.load(p),g}).then(function(p){var g=[i.Promise.resolve(p)],f=p.files;if(u.checkCRC32)for(var b=0;b<f.length;b++)g.push(l(f[b]));return i.Promise.all(g)}).then(function(p){for(var g=p.shift(),f=g.files,b=0;b<f.length;b++){var _=f[b],k=_.fileNameStr,S=n.resolve(_.fileNameStr);m.file(S,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:u.createFolders}),_.dir||(m.file(S).unsafeOriginalName=k)}return g.zipComment.length&&(m.comment=g.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function o(s,a){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(a)}n.inherits(o,i),o.prototype._bindStream=function(s){var a=this;(this._stream=s).pause(),s.on("data",function(c){a.push({data:c,meta:{percent:0}})}).on("error",function(c){a.isPaused?this.generatedError=c:a.error(c)}).on("end",function(){a.isPaused?a._upstreamEnded=!0:a.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var n=e("readable-stream").Readable;function i(o,s,a){n.call(this,s),this._helper=o;var c=this;o.on("data",function(l,h){c.push(l)||c._helper.pause(),a&&a(h)}).on("error",function(l){c.emit("error",l)}).on("end",function(){c.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,i);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,i)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var i=new Buffer(n);return i.fill(0),i},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(e,t,r){"use strict";function n(S,R,x){var D,P=o.getTypeOf(R),N=o.extend(x||{},c);N.date=N.date||new Date,N.compression!==null&&(N.compression=N.compression.toUpperCase()),typeof N.unixPermissions=="string"&&(N.unixPermissions=parseInt(N.unixPermissions,8)),N.unixPermissions&&16384&N.unixPermissions&&(N.dir=!0),N.dosPermissions&&16&N.dosPermissions&&(N.dir=!0),N.dir&&(S=f(S)),N.createFolders&&(D=g(S))&&b.call(this,D,!0);var Z=P==="string"&&N.binary===!1&&N.base64===!1;x&&x.binary!==void 0||(N.binary=!Z),(R instanceof l&&R.uncompressedSize===0||N.dir||!R||R.length===0)&&(N.base64=!1,N.binary=!0,R="",N.compression="STORE",P="string");var E=null;E=R instanceof l||R instanceof s?R:m.isNode&&m.isStream(R)?new p(S,R):o.prepareContent(S,R,N.binary,N.optimizedBinaryString,N.base64);var F=new h(S,E,N);this.files[S]=F}var i=e("./utf8"),o=e("./utils"),s=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),u=e("./generate"),m=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),g=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var R=S.lastIndexOf("/");return 0<R?S.substring(0,R):""},f=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},b=function(S,R){return R=R!==void 0?R:c.createFolders,S=f(S),this.files[S]||n.call(this,S,null,{dir:!0,createFolders:R}),this.files[S]};function _(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var R,x,D;for(R in this.files)D=this.files[R],(x=R.slice(this.root.length,R.length))&&R.slice(0,this.root.length)===this.root&&S(x,D)},filter:function(S){var R=[];return this.forEach(function(x,D){S(x,D)&&R.push(D)}),R},file:function(S,R,x){if(arguments.length!==1)return S=this.root+S,n.call(this,S,R,x),this;if(_(S)){var D=S;return this.filter(function(N,Z){return!Z.dir&&D.test(N)})}var P=this.files[this.root+S];return P&&!P.dir?P:null},folder:function(S){if(!S)return this;if(_(S))return this.filter(function(P,N){return N.dir&&S.test(P)});var R=this.root+S,x=b.call(this,R),D=this.clone();return D.root=x.name,D},remove:function(S){S=this.root+S;var R=this.files[S];if(R||(S.slice(-1)!=="/"&&(S+="/"),R=this.files[S]),R&&!R.dir)delete this.files[S];else for(var x=this.filter(function(P,N){return N.name.slice(0,S.length)===S}),D=0;D<x.length;D++)delete this.files[x[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var R,x={};try{if((x=o.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=x.type.toLowerCase(),x.compression=x.compression.toUpperCase(),x.type==="binarystring"&&(x.type="string"),!x.type)throw new Error("No output type specified.");o.checkSupport(x.type),x.platform!=="darwin"&&x.platform!=="freebsd"&&x.platform!=="linux"&&x.platform!=="sunos"||(x.platform="UNIX"),x.platform==="win32"&&(x.platform="DOS");var D=x.comment||this.comment||"";R=u.generateWorker(this,x,D)}catch(P){(R=new s("error")).error(P)}return new a(R,x.type||"string",x.mimeType)},generateAsync:function(S,R){return this.generateInternalStream(S).accumulate(R)},generateNodeStream:function(S,R){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(R)}};t.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o);for(var s=0;s<this.data.length;s++)o[s]=255&o[s]}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data[this.zero+o]},i.prototype.lastIndexOfSignature=function(o){for(var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===c&&this.data[h+3]===l)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(o){var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&c===h[2]&&l===h[3]},i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var s,a=0;for(this.checkOffset(o),s=this.index+o-1;s>=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=o,a},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},i.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},i.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(l){var h=n.getTypeOf(l);return n.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new a(l):i.uint8array?new c(n.transformTo("uint8array",l)):new o(n.transformTo("array",l)):new s(l)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(s){n.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(o,n),o.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}n.inherits(o,i),o.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(c){a.dataIsReady=!0,a.data=c,a.max=c&&c.length||0,a.type=n.getTypeOf(c),a.isPaused||a._tickAndRepeat()},function(c){a.error(c)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,o){return this._listeners[i].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,o){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,o)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var o=this;return i.on("data",function(s){o.processChunk(s)}),i.on("end",function(){o.end()}),i.on("error",function(s){o.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,o){return this.extraStreamInfo[i]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(m,p){return new c.Promise(function(g,f){var b=[],_=m._internalType,k=m._outputType,S=m._mimeType;m.on("data",function(R,x){b.push(R),p&&p(x)}).on("error",function(R){b=[],f(R)}).on("end",function(){try{var R=(function(x,D,P){switch(x){case"blob":return n.newBlob(n.transformTo("arraybuffer",D),P);case"base64":return s.encode(D);default:return n.transformTo(x,D)}})(k,(function(x,D){var P,N=0,Z=null,E=0;for(P=0;P<D.length;P++)E+=D[P].length;switch(x){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(Z=new Uint8Array(E),P=0;P<D.length;P++)Z.set(D[P],N),N+=D[P].length;return Z;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+x+"'")}})(_,b),S);g(R)}catch(x){f(x)}b=[]}).resume()})}function u(m,p,g){var f=p;switch(p){case"blob":case"arraybuffer":f="uint8array";break;case"base64":f="string"}try{this._internalType=f,this._outputType=p,this._mimeType=g,n.checkSupport(f),this._worker=m.pipe(new i(f)),m.lock()}catch(b){this._worker=new o("error"),this._worker.error(b)}}u.prototype={accumulate:function(m){return h(this,m)},on:function(m,p){var g=this;return m==="data"?this._worker.on(m,function(f){p.call(g,f.data,f.meta)}):this._worker.on(m,function(){n.delay(p,arguments,g)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:this._outputType!=="nodebuffer"},m)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;a[254]=a[254]=1;function l(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}r.utf8encode=function(u){return i.nodebuffer?o.newBufferFrom(u,"utf-8"):(function(m){var p,g,f,b,_,k=m.length,S=0;for(b=0;b<k;b++)(64512&(g=m.charCodeAt(b)))==55296&&b+1<k&&(64512&(f=m.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(f-56320),b++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=i.uint8array?new Uint8Array(S):new Array(S),b=_=0;_<S;b++)(64512&(g=m.charCodeAt(b)))==55296&&b+1<k&&(64512&(f=m.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(f-56320),b++),g<128?p[_++]=g:(g<2048?p[_++]=192|g>>>6:(g<65536?p[_++]=224|g>>>12:(p[_++]=240|g>>>18,p[_++]=128|g>>>12&63),p[_++]=128|g>>>6&63),p[_++]=128|63&g);return p})(u)},r.utf8decode=function(u){return i.nodebuffer?n.transformTo("nodebuffer",u).toString("utf-8"):(function(m){var p,g,f,b,_=m.length,k=new Array(2*_);for(p=g=0;p<_;)if((f=m[p++])<128)k[g++]=f;else if(4<(b=a[f]))k[g++]=65533,p+=b-1;else{for(f&=b===2?31:b===3?15:7;1<b&&p<_;)f=f<<6|63&m[p++],b--;1<b?k[g++]=65533:f<65536?k[g++]=f:(f-=65536,k[g++]=55296|f>>10&1023,k[g++]=56320|1023&f)}return k.length!==g&&(k.subarray?k=k.subarray(0,g):k.length=g),n.applyFromCharCode(k)})(u=n.transformTo(i.uint8array?"uint8array":"array",u))},n.inherits(l,s),l.prototype.processChunk=function(u){var m=n.transformTo(i.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=m;(m=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),m.set(p,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var g=(function(b,_){var k;for((_=_||b.length)>b.length&&(_=b.length),k=_-1;0<=k&&(192&b[k])==128;)k--;return k<0||k===0?_:k+a[b[k]]>_?k:_})(m),f=m;g!==m.length&&(i.uint8array?(f=m.subarray(0,g),this.leftOver=m.subarray(g,m.length)):(f=m.slice(0,g),this.leftOver=m.slice(g,m.length))),this.push({data:r.utf8decode(f),meta:u.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=l,n.inherits(h,s),h.prototype.processChunk=function(u){this.push({data:r.utf8encode(u.data),meta:u.meta})},r.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(p){return p}function c(p,g){for(var f=0;f<p.length;++f)g[f]=255&p.charCodeAt(f);return g}e("setimmediate"),r.newBlob=function(p,g){r.checkSupport("blob");try{return new Blob([p],{type:g})}catch{try{var f=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return f.append(p),f.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(p,g,f){var b=[],_=0,k=p.length;if(k<=f)return String.fromCharCode.apply(null,p);for(;_<k;)g==="array"||g==="nodebuffer"?b.push(String.fromCharCode.apply(null,p.slice(_,Math.min(_+f,k)))):b.push(String.fromCharCode.apply(null,p.subarray(_,Math.min(_+f,k)))),_+=f;return b.join("")},stringifyByChar:function(p){for(var g="",f=0;f<p.length;f++)g+=String.fromCharCode(p[f]);return g},applyCanBeUsed:{uint8array:(function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function h(p){var g=65536,f=r.getTypeOf(p),b=!0;if(f==="uint8array"?b=l.applyCanBeUsed.uint8array:f==="nodebuffer"&&(b=l.applyCanBeUsed.nodebuffer),b)for(;1<g;)try{return l.stringifyByChunk(p,f,g)}catch{g=Math.floor(g/2)}return l.stringifyByChar(p)}function u(p,g){for(var f=0;f<p.length;f++)g[f]=p[f];return g}r.applyFromCharCode=h;var m={};m.string={string:a,array:function(p){return c(p,new Array(p.length))},arraybuffer:function(p){return m.string.uint8array(p).buffer},uint8array:function(p){return c(p,new Uint8Array(p.length))},nodebuffer:function(p){return c(p,o.allocBuffer(p.length))}},m.array={string:h,array:a,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(p)}},m.arraybuffer={string:function(p){return h(new Uint8Array(p))},array:function(p){return u(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:a,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(new Uint8Array(p))}},m.uint8array={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:a,nodebuffer:function(p){return o.newBufferFrom(p)}},m.nodebuffer={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return m.nodebuffer.uint8array(p).buffer},uint8array:function(p){return u(p,new Uint8Array(p.length))},nodebuffer:a},r.transformTo=function(p,g){if(g=g||"",!p)return g;r.checkSupport(p);var f=r.getTypeOf(g);return m[f][p](g)},r.resolve=function(p){for(var g=p.split("/"),f=[],b=0;b<g.length;b++){var _=g[b];_==="."||_===""&&b!==0&&b!==g.length-1||(_===".."?f.pop():f.push(_))}return f.join("/")},r.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(p)?"nodebuffer":n.uint8array&&p instanceof Uint8Array?"uint8array":n.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(p){if(!n[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(p){var g,f,b="";for(f=0;f<(p||"").length;f++)b+="\\x"+((g=p.charCodeAt(f))<16?"0":"")+g.toString(16).toUpperCase();return b},r.delay=function(p,g,f){setImmediate(function(){p.apply(f||null,g||[])})},r.inherits=function(p,g){function f(){}f.prototype=g.prototype,p.prototype=new f},r.extend=function(){var p,g,f={};for(p=0;p<arguments.length;p++)for(g in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],g)&&f[g]===void 0&&(f[g]=arguments[p][g]);return f},r.prepareContent=function(p,g,f,b,_){return s.Promise.resolve(g).then(function(k){return n.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new s.Promise(function(S,R){var x=new FileReader;x.onload=function(D){S(D.target.result)},x.onerror=function(D){R(D.target.error)},x.readAsArrayBuffer(k)}):k}).then(function(k){var S=r.getTypeOf(k);return S?(S==="arraybuffer"?k=r.transformTo("uint8array",k):S==="string"&&(_?k=i.decode(k):f&&b!==!0&&(k=(function(R){return c(R,n.uint8array?new Uint8Array(R.length):new Array(R.length))})(k))),k):s.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./signature"),s=e("./zipEntry"),a=e("./support");function c(l){this.files=[],this.loadOptions=l}c.prototype={checkSignature:function(l){if(!this.reader.readAndCheckSignature(l)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(l)+")")}},isSignature:function(l,h){var u=this.reader.index;this.reader.setIndex(l);var m=this.reader.readString(4)===h;return this.reader.setIndex(u),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var l=this.reader.readData(this.zipCommentLength),h=a.uint8array?"uint8array":"array",u=i.transformTo(h,l);this.zipComment=this.loadOptions.decodeFileName(u)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var l,h,u,m=this.zip64EndOfCentralSize-44;0<m;)l=this.reader.readInt(2),h=this.reader.readInt(4),u=this.reader.readData(h),this.zip64ExtensibleData[l]={id:l,length:h,value:u}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var l,h;for(l=0;l<this.files.length;l++)h=this.files[l],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var l;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(l=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(l);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var l=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(l<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(l);var h=l;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(l=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(l),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var m=h-u;if(0<m)this.isSignature(h,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(l){this.reader=n(l)},load:function(l){this.prepareReader(l),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./compressedObject"),s=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(u,m){this.options=u,this.loadOptions=m}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(u){var m,p;if(u.skip(22),this.fileNameLength=u.readInt(2),p=u.readInt(2),this.fileName=u.readData(this.fileNameLength),u.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(g){for(var f in c)if(Object.prototype.hasOwnProperty.call(c,f)&&c[f].magic===g)return c[f];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,u.readData(this.compressedSize))},readCentralPart:function(u){this.versionMadeBy=u.readInt(2),u.skip(2),this.bitFlag=u.readInt(2),this.compressionMethod=u.readString(2),this.date=u.readDate(),this.crc32=u.readInt(4),this.compressedSize=u.readInt(4),this.uncompressedSize=u.readInt(4);var m=u.readInt(2);if(this.extraFieldsLength=u.readInt(2),this.fileCommentLength=u.readInt(2),this.diskNumberStart=u.readInt(2),this.internalFileAttributes=u.readInt(2),this.externalFileAttributes=u.readInt(4),this.localHeaderOffset=u.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");u.skip(m),this.readExtraFields(u),this.parseZIP64ExtraField(u),this.fileComment=u.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var u=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var m,p,g,f=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4<f;)m=u.readInt(2),p=u.readInt(2),g=u.readData(p),this.extraFields[m]={id:m,length:p,value:g};u.setIndex(f)},handleUTF8:function(){var u=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var p=i.transformTo(u,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var f=i.transformTo(u,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(f)}}},findExtraFieldUnicodePath:function(){var u=this.extraFields[28789];if(u){var m=n(u.value);return m.readInt(1)!==1||s(this.fileName)!==m.readInt(4)?null:a.utf8decode(m.readData(u.length-5))}return null},findExtraFieldUnicodeComment:function(){var u=this.extraFields[25461];if(u){var m=n(u.value);return m.readInt(1)!==1||s(this.fileComment)!==m.readInt(4)?null:a.utf8decode(m.readData(u.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function n(m,p,g){this.name=m,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=p,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var i=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),s=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");n.prototype={internalStream:function(m){var p=null,g="string";try{if(!m)throw new Error("No output type specified.");var f=(g=m.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),p=this._decompressWorker();var b=!this._dataBinary;b&&!f&&(p=p.pipe(new s.Utf8EncodeWorker)),!b&&f&&(p=p.pipe(new s.Utf8DecodeWorker))}catch(_){(p=new c("error")).error(_)}return new i(p,g,"")},async:function(m,p){return this.internalStream(m).accumulate(p)},nodeStream:function(m,p){return this.internalStream(m||"nodebuffer").toNodejsStream(p)},_compressWorker:function(m,p){if(this._data instanceof a&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(g,m,p)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new o(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)n.prototype[l[u]]=h;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(n){"use strict";var i,o,s=n.MutationObserver||n.WebKitMutationObserver;if(s){var a=0,c=new s(m),l=n.document.createTextNode("");c.observe(l,{characterData:!0}),i=function(){l.data=a=++a%2}}else if(n.setImmediate||n.MessageChannel===void 0)i="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var p=n.document.createElement("script");p.onreadystatechange=function(){m(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},n.document.documentElement.appendChild(p)}:function(){setTimeout(m,0)};else{var h=new n.MessageChannel;h.port1.onmessage=m,i=function(){h.port2.postMessage(0)}}var u=[];function m(){var p,g;o=!0;for(var f=u.length;f;){for(g=u,u=[],p=-1;++p<f;)g[p]();f=u.length}o=!1}t.exports=function(p){u.push(p)!==1||o||i()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,t,r){"use strict";var n=e("immediate");function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(f){if(typeof f!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,f!==i&&p(this,f)}function h(f,b,_){this.promise=f,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function u(f,b,_){n(function(){var k;try{k=b(_)}catch(S){return o.reject(f,S)}k===f?o.reject(f,new TypeError("Cannot resolve promise with itself")):o.resolve(f,k)})}function m(f){var b=f&&f.then;if(f&&(typeof f=="object"||typeof f=="function")&&typeof b=="function")return function(){b.apply(f,arguments)}}function p(f,b){var _=!1;function k(x){_||(_=!0,o.reject(f,x))}function S(x){_||(_=!0,o.resolve(f,x))}var R=g(function(){b(S,k)});R.status==="error"&&k(R.value)}function g(f,b){var _={};try{_.value=f(b),_.status="success"}catch(k){_.status="error",_.value=k}return _}(t.exports=l).prototype.finally=function(f){if(typeof f!="function")return this;var b=this.constructor;return this.then(function(_){return b.resolve(f()).then(function(){return _})},function(_){return b.resolve(f()).then(function(){throw _})})},l.prototype.catch=function(f){return this.then(null,f)},l.prototype.then=function(f,b){if(typeof f!="function"&&this.state===a||typeof b!="function"&&this.state===s)return this;var _=new this.constructor(i);return this.state!==c?u(_,this.state===a?f:b,this.outcome):this.queue.push(new h(_,f,b)),_},h.prototype.callFulfilled=function(f){o.resolve(this.promise,f)},h.prototype.otherCallFulfilled=function(f){u(this.promise,this.onFulfilled,f)},h.prototype.callRejected=function(f){o.reject(this.promise,f)},h.prototype.otherCallRejected=function(f){u(this.promise,this.onRejected,f)},o.resolve=function(f,b){var _=g(m,b);if(_.status==="error")return o.reject(f,_.value);var k=_.value;if(k)p(f,k);else{f.state=a,f.outcome=b;for(var S=-1,R=f.queue.length;++S<R;)f.queue[S].callFulfilled(b)}return f},o.reject=function(f,b){f.state=s,f.outcome=b;for(var _=-1,k=f.queue.length;++_<k;)f.queue[_].callRejected(b);return f},l.resolve=function(f){return f instanceof this?f:o.resolve(new this(i),f)},l.reject=function(f){var b=new this(i);return o.reject(b,f)},l.all=function(f){var b=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=f.length,k=!1;if(!_)return this.resolve([]);for(var S=new Array(_),R=0,x=-1,D=new this(i);++x<_;)P(f[x],x);return D;function P(N,Z){b.resolve(N).then(function(E){S[Z]=E,++R!==_||k||(k=!0,o.resolve(D,S))},function(E){k||(k=!0,o.reject(D,E))})}},l.race=function(f){var b=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=f.length,k=!1;if(!_)return this.resolve([]);for(var S=-1,R=new this(i);++S<_;)x=f[S],b.resolve(x).then(function(D){k||(k=!0,o.resolve(R,D))},function(D){k||(k=!0,o.reject(R,D))});var x;return R}},{immediate:36}],38:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var n=e("./zlib/deflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,u=0,m=8;function p(f){if(!(this instanceof p))return new p(f);this.options=i.assign({level:h,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},f||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var _=n.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(_!==l)throw new Error(s[_]);if(b.header&&n.deflateSetHeader(this.strm,b.header),b.dictionary){var k;if(k=typeof b.dictionary=="string"?o.string2buf(b.dictionary):c.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(_=n.deflateSetDictionary(this.strm,k))!==l)throw new Error(s[_]);this._dict_set=!0}}function g(f,b){var _=new p(b);if(_.push(f,!0),_.err)throw _.msg||s[_.err];return _.result}p.prototype.push=function(f,b){var _,k,S=this.strm,R=this.options.chunkSize;if(this.ended)return!1;k=b===~~b?b:b===!0?4:0,typeof f=="string"?S.input=o.string2buf(f):c.call(f)==="[object ArrayBuffer]"?S.input=new Uint8Array(f):S.input=f,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(R),S.next_out=0,S.avail_out=R),(_=n.deflate(S,k))!==1&&_!==l)return this.onEnd(_),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&_!==1);return k===4?(_=n.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===l):k!==2||(this.onEnd(l),!(S.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.prototype.onEnd=function(f){f===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},r.Deflate=p,r.deflate=g,r.deflateRaw=function(f,b){return(b=b||{}).raw=!0,g(f,b)},r.gzip=function(f,b){return(b=b||{}).gzip=!0,g(f,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function u(p){if(!(this instanceof u))return new u(p);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},p||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||p&&p.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var f=n.inflateInit2(this.strm,g.windowBits);if(f!==s.Z_OK)throw new Error(a[f]);this.header=new l,n.inflateGetHeader(this.strm,this.header)}function m(p,g){var f=new u(g);if(f.push(p,!0),f.err)throw f.msg||a[f.err];return f.result}u.prototype.push=function(p,g){var f,b,_,k,S,R,x=this.strm,D=this.options.chunkSize,P=this.options.dictionary,N=!1;if(this.ended)return!1;b=g===~~g?g:g===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof p=="string"?x.input=o.binstring2buf(p):h.call(p)==="[object ArrayBuffer]"?x.input=new Uint8Array(p):x.input=p,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new i.Buf8(D),x.next_out=0,x.avail_out=D),(f=n.inflate(x,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&P&&(R=typeof P=="string"?o.string2buf(P):h.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,f=n.inflateSetDictionary(this.strm,R)),f===s.Z_BUF_ERROR&&N===!0&&(f=s.Z_OK,N=!1),f!==s.Z_STREAM_END&&f!==s.Z_OK)return this.onEnd(f),!(this.ended=!0);x.next_out&&(x.avail_out!==0&&f!==s.Z_STREAM_END&&(x.avail_in!==0||b!==s.Z_FINISH&&b!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(x.output,x.next_out),k=x.next_out-_,S=o.buf2string(x.output,_),x.next_out=k,x.avail_out=D-k,k&&i.arraySet(x.output,x.output,_,k,0),this.onData(S)):this.onData(i.shrinkBuf(x.output,x.next_out)))),x.avail_in===0&&x.avail_out===0&&(N=!0)}while((0<x.avail_in||x.avail_out===0)&&f!==s.Z_STREAM_END);return f===s.Z_STREAM_END&&(b=s.Z_FINISH),b===s.Z_FINISH?(f=n.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===s.Z_OK):b!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(x.avail_out=0))},u.prototype.onData=function(p){this.chunks.push(p)},u.prototype.onEnd=function(p){p===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},r.Inflate=u,r.inflate=m,r.inflateRaw=function(p,g){return(g=g||{}).raw=!0,m(p,g)},r.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(s){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var c=a.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}}return s},r.shrinkBuf=function(s,a){return s.length===a?s:s.subarray?s.subarray(0,a):(s.length=a,s)};var i={arraySet:function(s,a,c,l,h){if(a.subarray&&s.subarray)s.set(a.subarray(c,c+l),h);else for(var u=0;u<l;u++)s[h+u]=a[c+u]},flattenChunks:function(s){var a,c,l,h,u,m;for(a=l=0,c=s.length;a<c;a++)l+=s[a].length;for(m=new Uint8Array(l),a=h=0,c=s.length;a<c;a++)u=s[a],m.set(u,h),h+=u.length;return m}},o={arraySet:function(s,a,c,l,h){for(var u=0;u<l;u++)s[h+u]=a[c+u]},flattenChunks:function(s){return[].concat.apply([],s)}};r.setTyped=function(s){s?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(n)},{}],42:[function(e,t,r){"use strict";var n=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(l,h){if(h<65537&&(l.subarray&&o||!l.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(l,h));for(var u="",m=0;m<h;m++)u+=String.fromCharCode(l[m]);return u}s[254]=s[254]=1,r.string2buf=function(l){var h,u,m,p,g,f=l.length,b=0;for(p=0;p<f;p++)(64512&(u=l.charCodeAt(p)))==55296&&p+1<f&&(64512&(m=l.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(m-56320),p++),b+=u<128?1:u<2048?2:u<65536?3:4;for(h=new n.Buf8(b),p=g=0;g<b;p++)(64512&(u=l.charCodeAt(p)))==55296&&p+1<f&&(64512&(m=l.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(m-56320),p++),u<128?h[g++]=u:(u<2048?h[g++]=192|u>>>6:(u<65536?h[g++]=224|u>>>12:(h[g++]=240|u>>>18,h[g++]=128|u>>>12&63),h[g++]=128|u>>>6&63),h[g++]=128|63&u);return h},r.buf2binstring=function(l){return c(l,l.length)},r.binstring2buf=function(l){for(var h=new n.Buf8(l.length),u=0,m=h.length;u<m;u++)h[u]=l.charCodeAt(u);return h},r.buf2string=function(l,h){var u,m,p,g,f=h||l.length,b=new Array(2*f);for(u=m=0;u<f;)if((p=l[u++])<128)b[m++]=p;else if(4<(g=s[p]))b[m++]=65533,u+=g-1;else{for(p&=g===2?31:g===3?15:7;1<g&&u<f;)p=p<<6|63&l[u++],g--;1<g?b[m++]=65533:p<65536?b[m++]=p:(p-=65536,b[m++]=55296|p>>10&1023,b[m++]=56320|1023&p)}return c(b,m)},r.utf8border=function(l,h){var u;for((h=h||l.length)>l.length&&(h=l.length),u=h-1;0<=u&&(192&l[u])==128;)u--;return u<0||u===0?h:u+s[l[u]]>h?u:h}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,o,s){for(var a=65535&n|0,c=n>>>16&65535|0,l=0;o!==0;){for(o-=l=2e3<o?2e3:o;c=c+(a=a+i[s++]|0)|0,--l;);a%=65521,c%=65521}return a|c<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var n=(function(){for(var i,o=[],s=0;s<256;s++){i=s;for(var a=0;a<8;a++)i=1&i?3988292384^i>>>1:i>>>1;o[s]=i}return o})();t.exports=function(i,o,s,a){var c=n,l=a+s;i^=-1;for(var h=a;h<l;h++)i=i>>>8^c[255&(i^o[h])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,u=0,m=-2,p=-1,g=4,f=2,b=8,_=9,k=286,S=30,R=19,x=2*k+1,D=15,P=3,N=258,Z=N+P+1,E=42,F=113,y=1,U=2,se=3,V=4;function he(d,M){return d.msg=c[M],M}function H(d){return(d<<1)-(4<d?9:0)}function oe(d){for(var M=d.length;0<=--M;)d[M]=0}function O(d){var M=d.state,B=M.pending;B>d.avail_out&&(B=d.avail_out),B!==0&&(i.arraySet(d.output,M.pending_buf,M.pending_out,B,d.next_out),d.next_out+=B,M.pending_out+=B,d.total_out+=B,d.avail_out-=B,M.pending-=B,M.pending===0&&(M.pending_out=0))}function I(d,M){o._tr_flush_block(d,0<=d.block_start?d.block_start:-1,d.strstart-d.block_start,M),d.block_start=d.strstart,O(d.strm)}function Q(d,M){d.pending_buf[d.pending++]=M}function q(d,M){d.pending_buf[d.pending++]=M>>>8&255,d.pending_buf[d.pending++]=255&M}function G(d,M){var B,w,v=d.max_chain_length,C=d.strstart,z=d.prev_length,j=d.nice_match,A=d.strstart>d.w_size-Z?d.strstart-(d.w_size-Z):0,W=d.window,K=d.w_mask,$=d.prev,re=d.strstart+N,ye=W[C+z-1],fe=W[C+z];d.prev_length>=d.good_match&&(v>>=2),j>d.lookahead&&(j=d.lookahead);do if(W[(B=M)+z]===fe&&W[B+z-1]===ye&&W[B]===W[C]&&W[++B]===W[C+1]){C+=2,B++;do;while(W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&W[++C]===W[++B]&&C<re);if(w=N-(re-C),C=re-N,z<w){if(d.match_start=M,j<=(z=w))break;ye=W[C+z-1],fe=W[C+z]}}while((M=$[M&K])>A&&--v!=0);return z<=d.lookahead?z:d.lookahead}function Be(d){var M,B,w,v,C,z,j,A,W,K,$=d.w_size;do{if(v=d.window_size-d.lookahead-d.strstart,d.strstart>=$+($-Z)){for(i.arraySet(d.window,d.window,$,$,0),d.match_start-=$,d.strstart-=$,d.block_start-=$,M=B=d.hash_size;w=d.head[--M],d.head[M]=$<=w?w-$:0,--B;);for(M=B=$;w=d.prev[--M],d.prev[M]=$<=w?w-$:0,--B;);v+=$}if(d.strm.avail_in===0)break;if(z=d.strm,j=d.window,A=d.strstart+d.lookahead,W=v,K=void 0,K=z.avail_in,W<K&&(K=W),B=K===0?0:(z.avail_in-=K,i.arraySet(j,z.input,z.next_in,K,A),z.state.wrap===1?z.adler=s(z.adler,j,K,A):z.state.wrap===2&&(z.adler=a(z.adler,j,K,A)),z.next_in+=K,z.total_in+=K,K),d.lookahead+=B,d.lookahead+d.insert>=P)for(C=d.strstart-d.insert,d.ins_h=d.window[C],d.ins_h=(d.ins_h<<d.hash_shift^d.window[C+1])&d.hash_mask;d.insert&&(d.ins_h=(d.ins_h<<d.hash_shift^d.window[C+P-1])&d.hash_mask,d.prev[C&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=C,C++,d.insert--,!(d.lookahead+d.insert<P)););}while(d.lookahead<Z&&d.strm.avail_in!==0)}function nt(d,M){for(var B,w;;){if(d.lookahead<Z){if(Be(d),d.lookahead<Z&&M===l)return y;if(d.lookahead===0)break}if(B=0,d.lookahead>=P&&(d.ins_h=(d.ins_h<<d.hash_shift^d.window[d.strstart+P-1])&d.hash_mask,B=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart),B!==0&&d.strstart-B<=d.w_size-Z&&(d.match_length=G(d,B)),d.match_length>=P)if(w=o._tr_tally(d,d.strstart-d.match_start,d.match_length-P),d.lookahead-=d.match_length,d.match_length<=d.max_lazy_match&&d.lookahead>=P){for(d.match_length--;d.strstart++,d.ins_h=(d.ins_h<<d.hash_shift^d.window[d.strstart+P-1])&d.hash_mask,B=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart,--d.match_length!=0;);d.strstart++}else d.strstart+=d.match_length,d.match_length=0,d.ins_h=d.window[d.strstart],d.ins_h=(d.ins_h<<d.hash_shift^d.window[d.strstart+1])&d.hash_mask;else w=o._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++;if(w&&(I(d,!1),d.strm.avail_out===0))return y}return d.insert=d.strstart<P-1?d.strstart:P-1,M===h?(I(d,!0),d.strm.avail_out===0?se:V):d.last_lit&&(I(d,!1),d.strm.avail_out===0)?y:U}function ue(d,M){for(var B,w,v;;){if(d.lookahead<Z){if(Be(d),d.lookahead<Z&&M===l)return y;if(d.lookahead===0)break}if(B=0,d.lookahead>=P&&(d.ins_h=(d.ins_h<<d.hash_shift^d.window[d.strstart+P-1])&d.hash_mask,B=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart),d.prev_length=d.match_length,d.prev_match=d.match_start,d.match_length=P-1,B!==0&&d.prev_length<d.max_lazy_match&&d.strstart-B<=d.w_size-Z&&(d.match_length=G(d,B),d.match_length<=5&&(d.strategy===1||d.match_length===P&&4096<d.strstart-d.match_start)&&(d.match_length=P-1)),d.prev_length>=P&&d.match_length<=d.prev_length){for(v=d.strstart+d.lookahead-P,w=o._tr_tally(d,d.strstart-1-d.prev_match,d.prev_length-P),d.lookahead-=d.prev_length-1,d.prev_length-=2;++d.strstart<=v&&(d.ins_h=(d.ins_h<<d.hash_shift^d.window[d.strstart+P-1])&d.hash_mask,B=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart),--d.prev_length!=0;);if(d.match_available=0,d.match_length=P-1,d.strstart++,w&&(I(d,!1),d.strm.avail_out===0))return y}else if(d.match_available){if((w=o._tr_tally(d,0,d.window[d.strstart-1]))&&I(d,!1),d.strstart++,d.lookahead--,d.strm.avail_out===0)return y}else d.match_available=1,d.strstart++,d.lookahead--}return d.match_available&&(w=o._tr_tally(d,0,d.window[d.strstart-1]),d.match_available=0),d.insert=d.strstart<P-1?d.strstart:P-1,M===h?(I(d,!0),d.strm.avail_out===0?se:V):d.last_lit&&(I(d,!1),d.strm.avail_out===0)?y:U}function de(d,M,B,w,v){this.good_length=d,this.max_lazy=M,this.nice_length=B,this.max_chain=w,this.func=v}function Le(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*x),this.dyn_dtree=new i.Buf16(2*(2*S+1)),this.bl_tree=new i.Buf16(2*(2*R+1)),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(D+1),this.heap=new i.Buf16(2*k+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*k+1),oe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function De(d){var M;return d&&d.state?(d.total_in=d.total_out=0,d.data_type=f,(M=d.state).pending=0,M.pending_out=0,M.wrap<0&&(M.wrap=-M.wrap),M.status=M.wrap?E:F,d.adler=M.wrap===2?0:1,M.last_flush=l,o._tr_init(M),u):he(d,m)}function ut(d){var M=De(d);return M===u&&(function(B){B.window_size=2*B.w_size,oe(B.head),B.max_lazy_match=n[B.level].max_lazy,B.good_match=n[B.level].good_length,B.nice_match=n[B.level].nice_length,B.max_chain_length=n[B.level].max_chain,B.strstart=0,B.block_start=0,B.lookahead=0,B.insert=0,B.match_length=B.prev_length=P-1,B.match_available=0,B.ins_h=0})(d.state),M}function Ot(d,M,B,w,v,C){if(!d)return m;var z=1;if(M===p&&(M=6),w<0?(z=0,w=-w):15<w&&(z=2,w-=16),v<1||_<v||B!==b||w<8||15<w||M<0||9<M||C<0||g<C)return he(d,m);w===8&&(w=9);var j=new Le;return(d.state=j).strm=d,j.wrap=z,j.gzhead=null,j.w_bits=w,j.w_size=1<<j.w_bits,j.w_mask=j.w_size-1,j.hash_bits=v+7,j.hash_size=1<<j.hash_bits,j.hash_mask=j.hash_size-1,j.hash_shift=~~((j.hash_bits+P-1)/P),j.window=new i.Buf8(2*j.w_size),j.head=new i.Buf16(j.hash_size),j.prev=new i.Buf16(j.w_size),j.lit_bufsize=1<<v+6,j.pending_buf_size=4*j.lit_bufsize,j.pending_buf=new i.Buf8(j.pending_buf_size),j.d_buf=1*j.lit_bufsize,j.l_buf=3*j.lit_bufsize,j.level=M,j.strategy=C,j.method=B,ut(d)}n=[new de(0,0,0,0,function(d,M){var B=65535;for(B>d.pending_buf_size-5&&(B=d.pending_buf_size-5);;){if(d.lookahead<=1){if(Be(d),d.lookahead===0&&M===l)return y;if(d.lookahead===0)break}d.strstart+=d.lookahead,d.lookahead=0;var w=d.block_start+B;if((d.strstart===0||d.strstart>=w)&&(d.lookahead=d.strstart-w,d.strstart=w,I(d,!1),d.strm.avail_out===0)||d.strstart-d.block_start>=d.w_size-Z&&(I(d,!1),d.strm.avail_out===0))return y}return d.insert=0,M===h?(I(d,!0),d.strm.avail_out===0?se:V):(d.strstart>d.block_start&&(I(d,!1),d.strm.avail_out),y)}),new de(4,4,8,4,nt),new de(4,5,16,8,nt),new de(4,6,32,32,nt),new de(4,4,16,16,ue),new de(8,16,32,32,ue),new de(8,16,128,128,ue),new de(8,32,128,256,ue),new de(32,128,258,1024,ue),new de(32,258,258,4096,ue)],r.deflateInit=function(d,M){return Ot(d,M,b,15,8,0)},r.deflateInit2=Ot,r.deflateReset=ut,r.deflateResetKeep=De,r.deflateSetHeader=function(d,M){return d&&d.state?d.state.wrap!==2?m:(d.state.gzhead=M,u):m},r.deflate=function(d,M){var B,w,v,C;if(!d||!d.state||5<M||M<0)return d?he(d,m):m;if(w=d.state,!d.output||!d.input&&d.avail_in!==0||w.status===666&&M!==h)return he(d,d.avail_out===0?-5:m);if(w.strm=d,B=w.last_flush,w.last_flush=M,w.status===E)if(w.wrap===2)d.adler=0,Q(w,31),Q(w,139),Q(w,8),w.gzhead?(Q(w,(w.gzhead.text?1:0)+(w.gzhead.hcrc?2:0)+(w.gzhead.extra?4:0)+(w.gzhead.name?8:0)+(w.gzhead.comment?16:0)),Q(w,255&w.gzhead.time),Q(w,w.gzhead.time>>8&255),Q(w,w.gzhead.time>>16&255),Q(w,w.gzhead.time>>24&255),Q(w,w.level===9?2:2<=w.strategy||w.level<2?4:0),Q(w,255&w.gzhead.os),w.gzhead.extra&&w.gzhead.extra.length&&(Q(w,255&w.gzhead.extra.length),Q(w,w.gzhead.extra.length>>8&255)),w.gzhead.hcrc&&(d.adler=a(d.adler,w.pending_buf,w.pending,0)),w.gzindex=0,w.status=69):(Q(w,0),Q(w,0),Q(w,0),Q(w,0),Q(w,0),Q(w,w.level===9?2:2<=w.strategy||w.level<2?4:0),Q(w,3),w.status=F);else{var z=b+(w.w_bits-8<<4)<<8;z|=(2<=w.strategy||w.level<2?0:w.level<6?1:w.level===6?2:3)<<6,w.strstart!==0&&(z|=32),z+=31-z%31,w.status=F,q(w,z),w.strstart!==0&&(q(w,d.adler>>>16),q(w,65535&d.adler)),d.adler=1}if(w.status===69)if(w.gzhead.extra){for(v=w.pending;w.gzindex<(65535&w.gzhead.extra.length)&&(w.pending!==w.pending_buf_size||(w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),O(d),v=w.pending,w.pending!==w.pending_buf_size));)Q(w,255&w.gzhead.extra[w.gzindex]),w.gzindex++;w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),w.gzindex===w.gzhead.extra.length&&(w.gzindex=0,w.status=73)}else w.status=73;if(w.status===73)if(w.gzhead.name){v=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),O(d),v=w.pending,w.pending===w.pending_buf_size)){C=1;break}C=w.gzindex<w.gzhead.name.length?255&w.gzhead.name.charCodeAt(w.gzindex++):0,Q(w,C)}while(C!==0);w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),C===0&&(w.gzindex=0,w.status=91)}else w.status=91;if(w.status===91)if(w.gzhead.comment){v=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),O(d),v=w.pending,w.pending===w.pending_buf_size)){C=1;break}C=w.gzindex<w.gzhead.comment.length?255&w.gzhead.comment.charCodeAt(w.gzindex++):0,Q(w,C)}while(C!==0);w.gzhead.hcrc&&w.pending>v&&(d.adler=a(d.adler,w.pending_buf,w.pending-v,v)),C===0&&(w.status=103)}else w.status=103;if(w.status===103&&(w.gzhead.hcrc?(w.pending+2>w.pending_buf_size&&O(d),w.pending+2<=w.pending_buf_size&&(Q(w,255&d.adler),Q(w,d.adler>>8&255),d.adler=0,w.status=F)):w.status=F),w.pending!==0){if(O(d),d.avail_out===0)return w.last_flush=-1,u}else if(d.avail_in===0&&H(M)<=H(B)&&M!==h)return he(d,-5);if(w.status===666&&d.avail_in!==0)return he(d,-5);if(d.avail_in!==0||w.lookahead!==0||M!==l&&w.status!==666){var j=w.strategy===2?(function(A,W){for(var K;;){if(A.lookahead===0&&(Be(A),A.lookahead===0)){if(W===l)return y;break}if(A.match_length=0,K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,K&&(I(A,!1),A.strm.avail_out===0))return y}return A.insert=0,W===h?(I(A,!0),A.strm.avail_out===0?se:V):A.last_lit&&(I(A,!1),A.strm.avail_out===0)?y:U})(w,M):w.strategy===3?(function(A,W){for(var K,$,re,ye,fe=A.window;;){if(A.lookahead<=N){if(Be(A),A.lookahead<=N&&W===l)return y;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=P&&0<A.strstart&&($=fe[re=A.strstart-1])===fe[++re]&&$===fe[++re]&&$===fe[++re]){ye=A.strstart+N;do;while($===fe[++re]&&$===fe[++re]&&$===fe[++re]&&$===fe[++re]&&$===fe[++re]&&$===fe[++re]&&$===fe[++re]&&$===fe[++re]&&re<ye);A.match_length=N-(ye-re),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=P?(K=o._tr_tally(A,1,A.match_length-P),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),K&&(I(A,!1),A.strm.avail_out===0))return y}return A.insert=0,W===h?(I(A,!0),A.strm.avail_out===0?se:V):A.last_lit&&(I(A,!1),A.strm.avail_out===0)?y:U})(w,M):n[w.level].func(w,M);if(j!==se&&j!==V||(w.status=666),j===y||j===se)return d.avail_out===0&&(w.last_flush=-1),u;if(j===U&&(M===1?o._tr_align(w):M!==5&&(o._tr_stored_block(w,0,0,!1),M===3&&(oe(w.head),w.lookahead===0&&(w.strstart=0,w.block_start=0,w.insert=0))),O(d),d.avail_out===0))return w.last_flush=-1,u}return M!==h?u:w.wrap<=0?1:(w.wrap===2?(Q(w,255&d.adler),Q(w,d.adler>>8&255),Q(w,d.adler>>16&255),Q(w,d.adler>>24&255),Q(w,255&d.total_in),Q(w,d.total_in>>8&255),Q(w,d.total_in>>16&255),Q(w,d.total_in>>24&255)):(q(w,d.adler>>>16),q(w,65535&d.adler)),O(d),0<w.wrap&&(w.wrap=-w.wrap),w.pending!==0?u:1)},r.deflateEnd=function(d){var M;return d&&d.state?(M=d.state.status)!==E&&M!==69&&M!==73&&M!==91&&M!==103&&M!==F&&M!==666?he(d,m):(d.state=null,M===F?he(d,-3):u):m},r.deflateSetDictionary=function(d,M){var B,w,v,C,z,j,A,W,K=M.length;if(!d||!d.state||(C=(B=d.state).wrap)===2||C===1&&B.status!==E||B.lookahead)return m;for(C===1&&(d.adler=s(d.adler,M,K,0)),B.wrap=0,K>=B.w_size&&(C===0&&(oe(B.head),B.strstart=0,B.block_start=0,B.insert=0),W=new i.Buf8(B.w_size),i.arraySet(W,M,K-B.w_size,B.w_size,0),M=W,K=B.w_size),z=d.avail_in,j=d.next_in,A=d.input,d.avail_in=K,d.next_in=0,d.input=M,Be(B);B.lookahead>=P;){for(w=B.strstart,v=B.lookahead-(P-1);B.ins_h=(B.ins_h<<B.hash_shift^B.window[w+P-1])&B.hash_mask,B.prev[w&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=w,w++,--v;);B.strstart=w,B.lookahead=P-1,Be(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=P-1,B.match_available=0,d.next_in=j,d.input=A,d.avail_in=z,B.wrap=C,u},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(n,i){var o,s,a,c,l,h,u,m,p,g,f,b,_,k,S,R,x,D,P,N,Z,E,F,y,U;o=n.state,s=n.next_in,y=n.input,a=s+(n.avail_in-5),c=n.next_out,U=n.output,l=c-(i-n.avail_out),h=c+(n.avail_out-257),u=o.dmax,m=o.wsize,p=o.whave,g=o.wnext,f=o.window,b=o.hold,_=o.bits,k=o.lencode,S=o.distcode,R=(1<<o.lenbits)-1,x=(1<<o.distbits)-1;e:do{_<15&&(b+=y[s++]<<_,_+=8,b+=y[s++]<<_,_+=8),D=k[b&R];t:for(;;){if(b>>>=P=D>>>24,_-=P,(P=D>>>16&255)===0)U[c++]=65535&D;else{if(!(16&P)){if((64&P)==0){D=k[(65535&D)+(b&(1<<P)-1)];continue t}if(32&P){o.mode=12;break e}n.msg="invalid literal/length code",o.mode=30;break e}N=65535&D,(P&=15)&&(_<P&&(b+=y[s++]<<_,_+=8),N+=b&(1<<P)-1,b>>>=P,_-=P),_<15&&(b+=y[s++]<<_,_+=8,b+=y[s++]<<_,_+=8),D=S[b&x];r:for(;;){if(b>>>=P=D>>>24,_-=P,!(16&(P=D>>>16&255))){if((64&P)==0){D=S[(65535&D)+(b&(1<<P)-1)];continue r}n.msg="invalid distance code",o.mode=30;break e}if(Z=65535&D,_<(P&=15)&&(b+=y[s++]<<_,(_+=8)<P&&(b+=y[s++]<<_,_+=8)),u<(Z+=b&(1<<P)-1)){n.msg="invalid distance too far back",o.mode=30;break e}if(b>>>=P,_-=P,(P=c-l)<Z){if(p<(P=Z-P)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break e}if(F=f,(E=0)===g){if(E+=m-P,P<N){for(N-=P;U[c++]=f[E++],--P;);E=c-Z,F=U}}else if(g<P){if(E+=m+g-P,(P-=g)<N){for(N-=P;U[c++]=f[E++],--P;);if(E=0,g<N){for(N-=P=g;U[c++]=f[E++],--P;);E=c-Z,F=U}}}else if(E+=g-P,P<N){for(N-=P;U[c++]=f[E++],--P;);E=c-Z,F=U}for(;2<N;)U[c++]=F[E++],U[c++]=F[E++],U[c++]=F[E++],N-=3;N&&(U[c++]=F[E++],1<N&&(U[c++]=F[E++]))}else{for(E=c-Z;U[c++]=U[E++],U[c++]=U[E++],U[c++]=U[E++],2<(N-=3););N&&(U[c++]=U[E++],1<N&&(U[c++]=U[E++]))}break}}break}}while(s<a&&c<h);s-=N=_>>3,b&=(1<<(_-=N<<3))-1,n.next_in=s,n.next_out=c,n.avail_in=s<a?a-s+5:5-(s-a),n.avail_out=c<h?h-c+257:257-(c-h),o.hold=b,o.bits=_}},{}],49:[function(e,t,r){"use strict";var n=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),s=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,u=-2,m=1,p=852,g=592;function f(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(E){var F;return E&&E.state?(F=E.state,E.total_in=E.total_out=F.total=0,E.msg="",F.wrap&&(E.adler=1&F.wrap),F.mode=m,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new n.Buf32(p),F.distcode=F.distdyn=new n.Buf32(g),F.sane=1,F.back=-1,h):u}function k(E){var F;return E&&E.state?((F=E.state).wsize=0,F.whave=0,F.wnext=0,_(E)):u}function S(E,F){var y,U;return E&&E.state?(U=E.state,F<0?(y=0,F=-F):(y=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?u:(U.window!==null&&U.wbits!==F&&(U.window=null),U.wrap=y,U.wbits=F,k(E))):u}function R(E,F){var y,U;return E?(U=new b,(E.state=U).window=null,(y=S(E,F))!==h&&(E.state=null),y):u}var x,D,P=!0;function N(E){if(P){var F;for(x=new n.Buf32(512),D=new n.Buf32(32),F=0;F<144;)E.lens[F++]=8;for(;F<256;)E.lens[F++]=9;for(;F<280;)E.lens[F++]=7;for(;F<288;)E.lens[F++]=8;for(a(c,E.lens,0,288,x,0,E.work,{bits:9}),F=0;F<32;)E.lens[F++]=5;a(l,E.lens,0,32,D,0,E.work,{bits:5}),P=!1}E.lencode=x,E.lenbits=9,E.distcode=D,E.distbits=5}function Z(E,F,y,U){var se,V=E.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new n.Buf8(V.wsize)),U>=V.wsize?(n.arraySet(V.window,F,y-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(U<(se=V.wsize-V.wnext)&&(se=U),n.arraySet(V.window,F,y-U,se,V.wnext),(U-=se)?(n.arraySet(V.window,F,y-U,U,0),V.wnext=U,V.whave=V.wsize):(V.wnext+=se,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=se))),0}r.inflateReset=k,r.inflateReset2=S,r.inflateResetKeep=_,r.inflateInit=function(E){return R(E,15)},r.inflateInit2=R,r.inflate=function(E,F){var y,U,se,V,he,H,oe,O,I,Q,q,G,Be,nt,ue,de,Le,De,ut,Ot,d,M,B,w,v=0,C=new n.Buf8(4),z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return u;(y=E.state).mode===12&&(y.mode=13),he=E.next_out,se=E.output,oe=E.avail_out,V=E.next_in,U=E.input,H=E.avail_in,O=y.hold,I=y.bits,Q=H,q=oe,M=h;e:for(;;)switch(y.mode){case m:if(y.wrap===0){y.mode=13;break}for(;I<16;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(2&y.wrap&&O===35615){C[y.check=0]=255&O,C[1]=O>>>8&255,y.check=o(y.check,C,2,0),I=O=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&O)<<8)+(O>>8))%31){E.msg="incorrect header check",y.mode=30;break}if((15&O)!=8){E.msg="unknown compression method",y.mode=30;break}if(I-=4,d=8+(15&(O>>>=4)),y.wbits===0)y.wbits=d;else if(d>y.wbits){E.msg="invalid window size",y.mode=30;break}y.dmax=1<<d,E.adler=y.check=1,y.mode=512&O?10:12,I=O=0;break;case 2:for(;I<16;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(y.flags=O,(255&y.flags)!=8){E.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){E.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=O>>8&1),512&y.flags&&(C[0]=255&O,C[1]=O>>>8&255,y.check=o(y.check,C,2,0)),I=O=0,y.mode=3;case 3:for(;I<32;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.head&&(y.head.time=O),512&y.flags&&(C[0]=255&O,C[1]=O>>>8&255,C[2]=O>>>16&255,C[3]=O>>>24&255,y.check=o(y.check,C,4,0)),I=O=0,y.mode=4;case 4:for(;I<16;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.head&&(y.head.xflags=255&O,y.head.os=O>>8),512&y.flags&&(C[0]=255&O,C[1]=O>>>8&255,y.check=o(y.check,C,2,0)),I=O=0,y.mode=5;case 5:if(1024&y.flags){for(;I<16;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.length=O,y.head&&(y.head.extra_len=O),512&y.flags&&(C[0]=255&O,C[1]=O>>>8&255,y.check=o(y.check,C,2,0)),I=O=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(H<(G=y.length)&&(G=H),G&&(y.head&&(d=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),n.arraySet(y.head.extra,U,V,G,d)),512&y.flags&&(y.check=o(y.check,U,G,V)),H-=G,V+=G,y.length-=G),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(H===0)break e;for(G=0;d=U[V+G++],y.head&&d&&y.length<65536&&(y.head.name+=String.fromCharCode(d)),d&&G<H;);if(512&y.flags&&(y.check=o(y.check,U,G,V)),H-=G,V+=G,d)break e}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if(H===0)break e;for(G=0;d=U[V+G++],y.head&&d&&y.length<65536&&(y.head.comment+=String.fromCharCode(d)),d&&G<H;);if(512&y.flags&&(y.check=o(y.check,U,G,V)),H-=G,V+=G,d)break e}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;I<16;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(O!==(65535&y.check)){E.msg="header crc mismatch",y.mode=30;break}I=O=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),E.adler=y.check=0,y.mode=12;break;case 10:for(;I<32;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}E.adler=y.check=f(O),I=O=0,y.mode=11;case 11:if(y.havedict===0)return E.next_out=he,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=O,y.bits=I,2;E.adler=y.check=1,y.mode=12;case 12:if(F===5||F===6)break e;case 13:if(y.last){O>>>=7&I,I-=7&I,y.mode=27;break}for(;I<3;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}switch(y.last=1&O,I-=1,3&(O>>>=1)){case 0:y.mode=14;break;case 1:if(N(y),y.mode=20,F!==6)break;O>>>=2,I-=2;break e;case 2:y.mode=17;break;case 3:E.msg="invalid block type",y.mode=30}O>>>=2,I-=2;break;case 14:for(O>>>=7&I,I-=7&I;I<32;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if((65535&O)!=(O>>>16^65535)){E.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&O,I=O=0,y.mode=15,F===6)break e;case 15:y.mode=16;case 16:if(G=y.length){if(H<G&&(G=H),oe<G&&(G=oe),G===0)break e;n.arraySet(se,U,V,G,he),H-=G,V+=G,oe-=G,he+=G,y.length-=G;break}y.mode=12;break;case 17:for(;I<14;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(y.nlen=257+(31&O),O>>>=5,I-=5,y.ndist=1+(31&O),O>>>=5,I-=5,y.ncode=4+(15&O),O>>>=4,I-=4,286<y.nlen||30<y.ndist){E.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;I<3;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.lens[z[y.have++]]=7&O,O>>>=3,I-=3}for(;y.have<19;)y.lens[z[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,B={bits:y.lenbits},M=a(0,y.lens,0,19,y.lencode,0,y.work,B),y.lenbits=B.bits,M){E.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;de=(v=y.lencode[O&(1<<y.lenbits)-1])>>>16&255,Le=65535&v,!((ue=v>>>24)<=I);){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(Le<16)O>>>=ue,I-=ue,y.lens[y.have++]=Le;else{if(Le===16){for(w=ue+2;I<w;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(O>>>=ue,I-=ue,y.have===0){E.msg="invalid bit length repeat",y.mode=30;break}d=y.lens[y.have-1],G=3+(3&O),O>>>=2,I-=2}else if(Le===17){for(w=ue+3;I<w;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}I-=ue,d=0,G=3+(7&(O>>>=ue)),O>>>=3,I-=3}else{for(w=ue+7;I<w;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}I-=ue,d=0,G=11+(127&(O>>>=ue)),O>>>=7,I-=7}if(y.have+G>y.nlen+y.ndist){E.msg="invalid bit length repeat",y.mode=30;break}for(;G--;)y.lens[y.have++]=d}}if(y.mode===30)break;if(y.lens[256]===0){E.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,B={bits:y.lenbits},M=a(c,y.lens,0,y.nlen,y.lencode,0,y.work,B),y.lenbits=B.bits,M){E.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,B={bits:y.distbits},M=a(l,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,B),y.distbits=B.bits,M){E.msg="invalid distances set",y.mode=30;break}if(y.mode=20,F===6)break e;case 20:y.mode=21;case 21:if(6<=H&&258<=oe){E.next_out=he,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=O,y.bits=I,s(E,q),he=E.next_out,se=E.output,oe=E.avail_out,V=E.next_in,U=E.input,H=E.avail_in,O=y.hold,I=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;de=(v=y.lencode[O&(1<<y.lenbits)-1])>>>16&255,Le=65535&v,!((ue=v>>>24)<=I);){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(de&&(240&de)==0){for(De=ue,ut=de,Ot=Le;de=(v=y.lencode[Ot+((O&(1<<De+ut)-1)>>De)])>>>16&255,Le=65535&v,!(De+(ue=v>>>24)<=I);){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}O>>>=De,I-=De,y.back+=De}if(O>>>=ue,I-=ue,y.back+=ue,y.length=Le,de===0){y.mode=26;break}if(32&de){y.back=-1,y.mode=12;break}if(64&de){E.msg="invalid literal/length code",y.mode=30;break}y.extra=15&de,y.mode=22;case 22:if(y.extra){for(w=y.extra;I<w;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.length+=O&(1<<y.extra)-1,O>>>=y.extra,I-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;de=(v=y.distcode[O&(1<<y.distbits)-1])>>>16&255,Le=65535&v,!((ue=v>>>24)<=I);){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if((240&de)==0){for(De=ue,ut=de,Ot=Le;de=(v=y.distcode[Ot+((O&(1<<De+ut)-1)>>De)])>>>16&255,Le=65535&v,!(De+(ue=v>>>24)<=I);){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}O>>>=De,I-=De,y.back+=De}if(O>>>=ue,I-=ue,y.back+=ue,64&de){E.msg="invalid distance code",y.mode=30;break}y.offset=Le,y.extra=15&de,y.mode=24;case 24:if(y.extra){for(w=y.extra;I<w;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}y.offset+=O&(1<<y.extra)-1,O>>>=y.extra,I-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){E.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(oe===0)break e;if(G=q-oe,y.offset>G){if((G=y.offset-G)>y.whave&&y.sane){E.msg="invalid distance too far back",y.mode=30;break}Be=G>y.wnext?(G-=y.wnext,y.wsize-G):y.wnext-G,G>y.length&&(G=y.length),nt=y.window}else nt=se,Be=he-y.offset,G=y.length;for(oe<G&&(G=oe),oe-=G,y.length-=G;se[he++]=nt[Be++],--G;);y.length===0&&(y.mode=21);break;case 26:if(oe===0)break e;se[he++]=y.length,oe--,y.mode=21;break;case 27:if(y.wrap){for(;I<32;){if(H===0)break e;H--,O|=U[V++]<<I,I+=8}if(q-=oe,E.total_out+=q,y.total+=q,q&&(E.adler=y.check=y.flags?o(y.check,se,q,he-q):i(y.check,se,q,he-q)),q=oe,(y.flags?O:f(O))!==y.check){E.msg="incorrect data check",y.mode=30;break}I=O=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;I<32;){if(H===0)break e;H--,O+=U[V++]<<I,I+=8}if(O!==(4294967295&y.total)){E.msg="incorrect length check",y.mode=30;break}I=O=0}y.mode=29;case 29:M=1;break e;case 30:M=-3;break e;case 31:return-4;case 32:default:return u}return E.next_out=he,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=O,y.bits=I,(y.wsize||q!==E.avail_out&&y.mode<30&&(y.mode<27||F!==4))&&Z(E,E.output,E.next_out,q-E.avail_out)?(y.mode=31,-4):(Q-=E.avail_in,q-=E.avail_out,E.total_in+=Q,E.total_out+=q,y.total+=q,y.wrap&&q&&(E.adler=y.check=y.flags?o(y.check,se,q,E.next_out-q):i(y.check,se,q,E.next_out-q)),E.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(Q==0&&q===0||F===4)&&M===h&&(M=-5),M)},r.inflateEnd=function(E){if(!E||!E.state)return u;var F=E.state;return F.window&&(F.window=null),E.state=null,h},r.inflateGetHeader=function(E,F){var y;return E&&E.state?(2&(y=E.state).wrap)==0?u:((y.head=F).done=!1,h):u},r.inflateSetDictionary=function(E,F){var y,U=F.length;return E&&E.state?(y=E.state).wrap!==0&&y.mode!==11?u:y.mode===11&&i(1,F,U,0)!==y.check?-3:Z(E,F,U,U)?(y.mode=31,-4):(y.havedict=1,h):u},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(c,l,h,u,m,p,g,f){var b,_,k,S,R,x,D,P,N,Z=f.bits,E=0,F=0,y=0,U=0,se=0,V=0,he=0,H=0,oe=0,O=0,I=null,Q=0,q=new n.Buf16(16),G=new n.Buf16(16),Be=null,nt=0;for(E=0;E<=15;E++)q[E]=0;for(F=0;F<u;F++)q[l[h+F]]++;for(se=Z,U=15;1<=U&&q[U]===0;U--);if(U<se&&(se=U),U===0)return m[p++]=20971520,m[p++]=20971520,f.bits=1,0;for(y=1;y<U&&q[y]===0;y++);for(se<y&&(se=y),E=H=1;E<=15;E++)if(H<<=1,(H-=q[E])<0)return-1;if(0<H&&(c===0||U!==1))return-1;for(G[1]=0,E=1;E<15;E++)G[E+1]=G[E]+q[E];for(F=0;F<u;F++)l[h+F]!==0&&(g[G[l[h+F]]++]=F);if(x=c===0?(I=Be=g,19):c===1?(I=i,Q-=257,Be=o,nt-=257,256):(I=s,Be=a,-1),E=y,R=p,he=F=O=0,k=-1,S=(oe=1<<(V=se))-1,c===1&&852<oe||c===2&&592<oe)return 1;for(;;){for(D=E-he,N=g[F]<x?(P=0,g[F]):g[F]>x?(P=Be[nt+g[F]],I[Q+g[F]]):(P=96,0),b=1<<E-he,y=_=1<<V;m[R+(O>>he)+(_-=b)]=D<<24|P<<16|N|0,_!==0;);for(b=1<<E-1;O&b;)b>>=1;if(b!==0?(O&=b-1,O+=b):O=0,F++,--q[E]==0){if(E===U)break;E=l[h+g[F]]}if(se<E&&(O&S)!==k){for(he===0&&(he=se),R+=y,H=1<<(V=E-he);V+he<U&&!((H-=q[V+he])<=0);)V++,H<<=1;if(oe+=1<<V,c===1&&852<oe||c===2&&592<oe)return 1;m[k=O&S]=se<<24|V<<16|R-p|0}}return O!==0&&(m[R+O]=E-he<<24|64<<16|0),f.bits=se,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var n=e("../utils/common"),i=0,o=1;function s(v){for(var C=v.length;0<=--C;)v[C]=0}var a=0,c=29,l=256,h=l+1+c,u=30,m=19,p=2*h+1,g=15,f=16,b=7,_=256,k=16,S=17,R=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(h+2));s(Z);var E=new Array(2*u);s(E);var F=new Array(512);s(F);var y=new Array(256);s(y);var U=new Array(c);s(U);var se,V,he,H=new Array(u);function oe(v,C,z,j,A){this.static_tree=v,this.extra_bits=C,this.extra_base=z,this.elems=j,this.max_length=A,this.has_stree=v&&v.length}function O(v,C){this.dyn_tree=v,this.max_code=0,this.stat_desc=C}function I(v){return v<256?F[v]:F[256+(v>>>7)]}function Q(v,C){v.pending_buf[v.pending++]=255&C,v.pending_buf[v.pending++]=C>>>8&255}function q(v,C,z){v.bi_valid>f-z?(v.bi_buf|=C<<v.bi_valid&65535,Q(v,v.bi_buf),v.bi_buf=C>>f-v.bi_valid,v.bi_valid+=z-f):(v.bi_buf|=C<<v.bi_valid&65535,v.bi_valid+=z)}function G(v,C,z){q(v,z[2*C],z[2*C+1])}function Be(v,C){for(var z=0;z|=1&v,v>>>=1,z<<=1,0<--C;);return z>>>1}function nt(v,C,z){var j,A,W=new Array(g+1),K=0;for(j=1;j<=g;j++)W[j]=K=K+z[j-1]<<1;for(A=0;A<=C;A++){var $=v[2*A+1];$!==0&&(v[2*A]=Be(W[$]++,$))}}function ue(v){var C;for(C=0;C<h;C++)v.dyn_ltree[2*C]=0;for(C=0;C<u;C++)v.dyn_dtree[2*C]=0;for(C=0;C<m;C++)v.bl_tree[2*C]=0;v.dyn_ltree[2*_]=1,v.opt_len=v.static_len=0,v.last_lit=v.matches=0}function de(v){8<v.bi_valid?Q(v,v.bi_buf):0<v.bi_valid&&(v.pending_buf[v.pending++]=v.bi_buf),v.bi_buf=0,v.bi_valid=0}function Le(v,C,z,j){var A=2*C,W=2*z;return v[A]<v[W]||v[A]===v[W]&&j[C]<=j[z]}function De(v,C,z){for(var j=v.heap[z],A=z<<1;A<=v.heap_len&&(A<v.heap_len&&Le(C,v.heap[A+1],v.heap[A],v.depth)&&A++,!Le(C,j,v.heap[A],v.depth));)v.heap[z]=v.heap[A],z=A,A<<=1;v.heap[z]=j}function ut(v,C,z){var j,A,W,K,$=0;if(v.last_lit!==0)for(;j=v.pending_buf[v.d_buf+2*$]<<8|v.pending_buf[v.d_buf+2*$+1],A=v.pending_buf[v.l_buf+$],$++,j===0?G(v,A,C):(G(v,(W=y[A])+l+1,C),(K=x[W])!==0&&q(v,A-=U[W],K),G(v,W=I(--j),z),(K=D[W])!==0&&q(v,j-=H[W],K)),$<v.last_lit;);G(v,_,C)}function Ot(v,C){var z,j,A,W=C.dyn_tree,K=C.stat_desc.static_tree,$=C.stat_desc.has_stree,re=C.stat_desc.elems,ye=-1;for(v.heap_len=0,v.heap_max=p,z=0;z<re;z++)W[2*z]!==0?(v.heap[++v.heap_len]=ye=z,v.depth[z]=0):W[2*z+1]=0;for(;v.heap_len<2;)W[2*(A=v.heap[++v.heap_len]=ye<2?++ye:0)]=1,v.depth[A]=0,v.opt_len--,$&&(v.static_len-=K[2*A+1]);for(C.max_code=ye,z=v.heap_len>>1;1<=z;z--)De(v,W,z);for(A=re;z=v.heap[1],v.heap[1]=v.heap[v.heap_len--],De(v,W,1),j=v.heap[1],v.heap[--v.heap_max]=z,v.heap[--v.heap_max]=j,W[2*A]=W[2*z]+W[2*j],v.depth[A]=(v.depth[z]>=v.depth[j]?v.depth[z]:v.depth[j])+1,W[2*z+1]=W[2*j+1]=A,v.heap[1]=A++,De(v,W,1),2<=v.heap_len;);v.heap[--v.heap_max]=v.heap[1],(function(fe,dt){var xr,Bt,tn,Ce,oi,zr,lr=dt.dyn_tree,rn=dt.max_code,al=dt.stat_desc.static_tree,lo=dt.stat_desc.has_stree,cl=dt.stat_desc.extra_bits,Ar=dt.stat_desc.extra_base,On=dt.stat_desc.max_length,Bn=0;for(Ce=0;Ce<=g;Ce++)fe.bl_count[Ce]=0;for(lr[2*fe.heap[fe.heap_max]+1]=0,xr=fe.heap_max+1;xr<p;xr++)On<(Ce=lr[2*lr[2*(Bt=fe.heap[xr])+1]+1]+1)&&(Ce=On,Bn++),lr[2*Bt+1]=Ce,rn<Bt||(fe.bl_count[Ce]++,oi=0,Ar<=Bt&&(oi=cl[Bt-Ar]),zr=lr[2*Bt],fe.opt_len+=zr*(Ce+oi),lo&&(fe.static_len+=zr*(al[2*Bt+1]+oi)));if(Bn!==0){do{for(Ce=On-1;fe.bl_count[Ce]===0;)Ce--;fe.bl_count[Ce]--,fe.bl_count[Ce+1]+=2,fe.bl_count[On]--,Bn-=2}while(0<Bn);for(Ce=On;Ce!==0;Ce--)for(Bt=fe.bl_count[Ce];Bt!==0;)rn<(tn=fe.heap[--xr])||(lr[2*tn+1]!==Ce&&(fe.opt_len+=(Ce-lr[2*tn+1])*lr[2*tn],lr[2*tn+1]=Ce),Bt--)}})(v,C),nt(W,ye,v.bl_count)}function d(v,C,z){var j,A,W=-1,K=C[1],$=0,re=7,ye=4;for(K===0&&(re=138,ye=3),C[2*(z+1)+1]=65535,j=0;j<=z;j++)A=K,K=C[2*(j+1)+1],++$<re&&A===K||($<ye?v.bl_tree[2*A]+=$:A!==0?(A!==W&&v.bl_tree[2*A]++,v.bl_tree[2*k]++):$<=10?v.bl_tree[2*S]++:v.bl_tree[2*R]++,W=A,ye=($=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4))}function M(v,C,z){var j,A,W=-1,K=C[1],$=0,re=7,ye=4;for(K===0&&(re=138,ye=3),j=0;j<=z;j++)if(A=K,K=C[2*(j+1)+1],!(++$<re&&A===K)){if($<ye)for(;G(v,A,v.bl_tree),--$!=0;);else A!==0?(A!==W&&(G(v,A,v.bl_tree),$--),G(v,k,v.bl_tree),q(v,$-3,2)):$<=10?(G(v,S,v.bl_tree),q(v,$-3,3)):(G(v,R,v.bl_tree),q(v,$-11,7));W=A,ye=($=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4)}}s(H);var B=!1;function w(v,C,z,j){q(v,(a<<1)+(j?1:0),3),(function(A,W,K,$){de(A),$&&(Q(A,K),Q(A,~K)),n.arraySet(A.pending_buf,A.window,W,K,A.pending),A.pending+=K})(v,C,z,!0)}r._tr_init=function(v){B||((function(){var C,z,j,A,W,K=new Array(g+1);for(A=j=0;A<c-1;A++)for(U[A]=j,C=0;C<1<<x[A];C++)y[j++]=A;for(y[j-1]=A,A=W=0;A<16;A++)for(H[A]=W,C=0;C<1<<D[A];C++)F[W++]=A;for(W>>=7;A<u;A++)for(H[A]=W<<7,C=0;C<1<<D[A]-7;C++)F[256+W++]=A;for(z=0;z<=g;z++)K[z]=0;for(C=0;C<=143;)Z[2*C+1]=8,C++,K[8]++;for(;C<=255;)Z[2*C+1]=9,C++,K[9]++;for(;C<=279;)Z[2*C+1]=7,C++,K[7]++;for(;C<=287;)Z[2*C+1]=8,C++,K[8]++;for(nt(Z,h+1,K),C=0;C<u;C++)E[2*C+1]=5,E[2*C]=Be(C,5);se=new oe(Z,x,l+1,h,g),V=new oe(E,D,0,u,g),he=new oe(new Array(0),P,0,m,b)})(),B=!0),v.l_desc=new O(v.dyn_ltree,se),v.d_desc=new O(v.dyn_dtree,V),v.bl_desc=new O(v.bl_tree,he),v.bi_buf=0,v.bi_valid=0,ue(v)},r._tr_stored_block=w,r._tr_flush_block=function(v,C,z,j){var A,W,K=0;0<v.level?(v.strm.data_type===2&&(v.strm.data_type=(function($){var re,ye=4093624447;for(re=0;re<=31;re++,ye>>>=1)if(1&ye&&$.dyn_ltree[2*re]!==0)return i;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return o;for(re=32;re<l;re++)if($.dyn_ltree[2*re]!==0)return o;return i})(v)),Ot(v,v.l_desc),Ot(v,v.d_desc),K=(function($){var re;for(d($,$.dyn_ltree,$.l_desc.max_code),d($,$.dyn_dtree,$.d_desc.max_code),Ot($,$.bl_desc),re=m-1;3<=re&&$.bl_tree[2*N[re]+1]===0;re--);return $.opt_len+=3*(re+1)+5+5+4,re})(v),A=v.opt_len+3+7>>>3,(W=v.static_len+3+7>>>3)<=A&&(A=W)):A=W=z+5,z+4<=A&&C!==-1?w(v,C,z,j):v.strategy===4||W===A?(q(v,2+(j?1:0),3),ut(v,Z,E)):(q(v,4+(j?1:0),3),(function($,re,ye,fe){var dt;for(q($,re-257,5),q($,ye-1,5),q($,fe-4,4),dt=0;dt<fe;dt++)q($,$.bl_tree[2*N[dt]+1],3);M($,$.dyn_ltree,re-1),M($,$.dyn_dtree,ye-1)})(v,v.l_desc.max_code+1,v.d_desc.max_code+1,K+1),ut(v,v.dyn_ltree,v.dyn_dtree)),ue(v),j&&de(v)},r._tr_tally=function(v,C,z){return v.pending_buf[v.d_buf+2*v.last_lit]=C>>>8&255,v.pending_buf[v.d_buf+2*v.last_lit+1]=255&C,v.pending_buf[v.l_buf+v.last_lit]=255&z,v.last_lit++,C===0?v.dyn_ltree[2*z]++:(v.matches++,C--,v.dyn_ltree[2*(y[z]+l+1)]++,v.dyn_dtree[2*I(C)]++),v.last_lit===v.lit_bufsize-1},r._tr_align=function(v){q(v,2,3),G(v,_,Z),(function(C){C.bi_valid===16?(Q(C,C.bi_buf),C.bi_buf=0,C.bi_valid=0):8<=C.bi_valid&&(C.pending_buf[C.pending++]=255&C.bi_buf,C.bi_buf>>=8,C.bi_valid-=8)})(v)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,o){"use strict";if(!i.setImmediate){var s,a,c,l,h=1,u={},m=!1,p=i.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(i);g=g&&g.setTimeout?g:i,s={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){b(k)})}:(function(){if(i.postMessage&&!i.importScripts){var k=!0,S=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=S,k}})()?(l="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(k){i.postMessage(l+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){b(k.data)},function(k){c.port2.postMessage(k)}):p&&"onreadystatechange"in p.createElement("script")?(a=p.documentElement,function(k){var S=p.createElement("script");S.onreadystatechange=function(){b(k),S.onreadystatechange=null,a.removeChild(S),S=null},a.appendChild(S)}):function(k){setTimeout(b,0,k)},g.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var S=new Array(arguments.length-1),R=0;R<S.length;R++)S[R]=arguments[R+1];var x={callback:k,args:S};return u[h]=x,s(h),h++},g.clearImmediate=f}function f(k){delete u[k]}function b(k){if(m)setTimeout(b,0,k);else{var S=u[k];if(S){m=!0;try{(function(R){var x=R.callback,D=R.args;switch(D.length){case 0:x();break;case 1:x(D[0]);break;case 2:x(D[0],D[1]);break;case 3:x(D[0],D[1],D[2]);break;default:x.apply(o,D)}})(S)}finally{f(k),m=!1}}}}function _(k){k.source===i&&typeof k.data=="string"&&k.data.indexOf(l)===0&&b(+k.data.slice(l.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var i0=ve((wu,Su)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof wu<"u"?t():(t(),e.FileSaver={})})(wu,function(){"use strict";function e(a,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function t(a,c,l){var h=new XMLHttpRequest;h.open("GET",a),h.responseType="blob",h.onload=function(){s(h.response,c,l)},h.onerror=function(){console.error("could not download file")},h.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function n(a){try{a.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var i=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,o=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||(typeof window!="object"||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(a,c,l){var h=i.URL||i.webkitURL,u=document.createElement("a");c=c||a.name||"download",u.download=c,u.rel="noopener",typeof a=="string"?(u.href=a,u.origin===location.origin?n(u):r(u.href)?t(a,c,l):n(u,u.target="_blank")):(u.href=h.createObjectURL(a),setTimeout(function(){h.revokeObjectURL(u.href)},4e4),setTimeout(function(){n(u)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,l){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(e(a,l),c);else if(r(a))t(a,c,l);else{var h=document.createElement("a");h.href=a,h.target="_blank",setTimeout(function(){n(h)})}}:function(a,c,l,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof a=="string")return t(a,c,l);var u=a.type==="application/octet-stream",m=/constructor/i.test(i.HTMLElement)||i.safari,p=/CriOS\/[\d]+/.test(navigator.userAgent);if((p||u&&m||o)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var _=g.result;_=p?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=_:location=_,h=null},g.readAsDataURL(a)}else{var f=i.URL||i.webkitURL,b=f.createObjectURL(a);h?h.location=b:location.href=b,h=null,setTimeout(function(){f.revokeObjectURL(b)},4e4)}});i.saveAs=s.saveAs=s,typeof Su<"u"&&(Su.exports=s)})});var y2=ve((QA,g2)=>{g2.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var In=ve(ti=>{var xd,x3=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];ti.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};ti.getSymbolTotalCodewords=function(t){return x3[t]};ti.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};ti.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');xd=t};ti.isKanjiModeEnabled=function(){return typeof xd<"u"};ti.toSJIS=function(t){return xd(t)}});var qc=ve(cr=>{cr.L={bit:1};cr.M={bit:0};cr.Q={bit:3};cr.H={bit:2};function A3(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return cr.L;case"m":case"medium":return cr.M;case"q":case"quartile":return cr.Q;case"h":case"high":return cr.H;default:throw new Error("Unknown EC Level: "+e)}}cr.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};cr.from=function(t,r){if(cr.isValid(t))return t;try{return A3(t)}catch{return r}}});var v2=ve((r8,_2)=>{function b2(){this.buffer=[],this.length=0}b2.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};_2.exports=b2});var S2=ve((n8,w2)=>{function cs(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}cs.prototype.set=function(e,t,r,n){let i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)};cs.prototype.get=function(e,t){return this.data[e*this.size+t]};cs.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};cs.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};w2.exports=cs});var k2=ve(Kc=>{var T3=In().getSymbolSize;Kc.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=T3(t),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,o=[n-7];for(let s=1;s<r-1;s++)o[s]=o[s-1]-i;return o.push(6),o.reverse()};Kc.getPositions=function(t){let r=[],n=Kc.getRowColCoords(t),i=n.length;for(let o=0;o<i;o++)for(let s=0;s<i;s++)o===0&&s===0||o===0&&s===i-1||o===i-1&&s===0||r.push([n[o],n[s]]);return r}});var x2=ve(C2=>{var I3=In().getSymbolSize,E2=7;C2.getPositions=function(t){let r=I3(t);return[[0,0],[r-E2,0],[0,r-E2]]}});var A2=ve(Pe=>{Pe.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ri={N1:3,N2:3,N3:40,N4:10};Pe.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};Pe.from=function(t){return Pe.isValid(t)?parseInt(t,10):void 0};Pe.getPenaltyN1=function(t){let r=t.size,n=0,i=0,o=0,s=null,a=null;for(let c=0;c<r;c++){i=o=0,s=a=null;for(let l=0;l<r;l++){let h=t.get(c,l);h===s?i++:(i>=5&&(n+=ri.N1+(i-5)),s=h,i=1),h=t.get(l,c),h===a?o++:(o>=5&&(n+=ri.N1+(o-5)),a=h,o=1)}i>=5&&(n+=ri.N1+(i-5)),o>=5&&(n+=ri.N1+(o-5))}return n};Pe.getPenaltyN2=function(t){let r=t.size,n=0;for(let i=0;i<r-1;i++)for(let o=0;o<r-1;o++){let s=t.get(i,o)+t.get(i,o+1)+t.get(i+1,o)+t.get(i+1,o+1);(s===4||s===0)&&n++}return n*ri.N2};Pe.getPenaltyN3=function(t){let r=t.size,n=0,i=0,o=0;for(let s=0;s<r;s++){i=o=0;for(let a=0;a<r;a++)i=i<<1&2047|t.get(s,a),a>=10&&(i===1488||i===93)&&n++,o=o<<1&2047|t.get(a,s),a>=10&&(o===1488||o===93)&&n++}return n*ri.N3};Pe.getPenaltyN4=function(t){let r=0,n=t.data.length;for(let o=0;o<n;o++)r+=t.data[o];return Math.abs(Math.ceil(r*100/n/5)-10)*ri.N4};function R3(e,t,r){switch(e){case Pe.Patterns.PATTERN000:return(t+r)%2===0;case Pe.Patterns.PATTERN001:return t%2===0;case Pe.Patterns.PATTERN010:return r%3===0;case Pe.Patterns.PATTERN011:return(t+r)%3===0;case Pe.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case Pe.Patterns.PATTERN101:return t*r%2+t*r%3===0;case Pe.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case Pe.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}Pe.applyMask=function(t,r){let n=r.size;for(let i=0;i<n;i++)for(let o=0;o<n;o++)r.isReserved(o,i)||r.xor(o,i,R3(t,o,i))};Pe.getBestMask=function(t,r){let n=Object.keys(Pe.Patterns).length,i=0,o=1/0;for(let s=0;s<n;s++){r(s),Pe.applyMask(s,t);let a=Pe.getPenaltyN1(t)+Pe.getPenaltyN2(t)+Pe.getPenaltyN3(t)+Pe.getPenaltyN4(t);Pe.applyMask(s,t),a<o&&(o=a,i=s)}return i}});var Td=ve(Ad=>{var Rn=qc(),Xc=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Jc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ad.getBlocksCount=function(t,r){switch(r){case Rn.L:return Xc[(t-1)*4+0];case Rn.M:return Xc[(t-1)*4+1];case Rn.Q:return Xc[(t-1)*4+2];case Rn.H:return Xc[(t-1)*4+3];default:return}};Ad.getTotalCodewordsCount=function(t,r){switch(r){case Rn.L:return Jc[(t-1)*4+0];case Rn.M:return Jc[(t-1)*4+1];case Rn.Q:return Jc[(t-1)*4+2];case Rn.H:return Jc[(t-1)*4+3];default:return}}});var T2=ve(Zc=>{var ls=new Uint8Array(512),Yc=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)ls[r]=t,Yc[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)ls[r]=ls[r-255]})();Zc.log=function(t){if(t<1)throw new Error("log("+t+")");return Yc[t]};Zc.exp=function(t){return ls[t]};Zc.mul=function(t,r){return t===0||r===0?0:ls[Yc[t]+Yc[r]]}});var I2=ve(hs=>{var Id=T2();hs.mul=function(t,r){let n=new Uint8Array(t.length+r.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<r.length;o++)n[i+o]^=Id.mul(t[i],r[o]);return n};hs.mod=function(t,r){let n=new Uint8Array(t);for(;n.length-r.length>=0;){let i=n[0];for(let s=0;s<r.length;s++)n[s]^=Id.mul(r[s],i);let o=0;for(;o<n.length&&n[o]===0;)o++;n=n.slice(o)}return n};hs.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=hs.mul(r,new Uint8Array([1,Id.exp(n)]));return r}});var D2=ve((h8,P2)=>{var R2=I2();function Rd(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}Rd.prototype.initialize=function(t){this.degree=t,this.genPoly=R2.generateECPolynomial(this.degree)};Rd.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(t.length+this.degree);r.set(t);let n=R2.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let o=new Uint8Array(this.degree);return o.set(n,i),o}return n};P2.exports=Rd});var Pd=ve(O2=>{O2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var Dd=ve(en=>{var B2="[0-9]+",P3="[A-Z $%*+\\-./:]+",us="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";us=us.replace(/u/g,"\\u");var D3="(?:(?![A-Z0-9 $%*+\\-./:]|"+us+`)(?:.|[\r
3
+ ]))+`;en.KANJI=new RegExp(us,"g");en.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");en.BYTE=new RegExp(D3,"g");en.NUMERIC=new RegExp(B2,"g");en.ALPHANUMERIC=new RegExp(P3,"g");var O3=new RegExp("^"+us+"$"),B3=new RegExp("^"+B2+"$"),L3=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");en.testKanji=function(t){return O3.test(t)};en.testNumeric=function(t){return B3.test(t)};en.testAlphanumeric=function(t){return L3.test(t)}});var Pn=ve(rt=>{var F3=Pd(),Od=Dd();rt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};rt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};rt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};rt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};rt.MIXED={bit:-1};rt.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!F3.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};rt.getBestModeForData=function(t){return Od.testNumeric(t)?rt.NUMERIC:Od.testAlphanumeric(t)?rt.ALPHANUMERIC:Od.testKanji(t)?rt.KANJI:rt.BYTE};rt.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};rt.isValid=function(t){return t&&t.bit&&t.ccBits};function M3(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return rt.NUMERIC;case"alphanumeric":return rt.ALPHANUMERIC;case"kanji":return rt.KANJI;case"byte":return rt.BYTE;default:throw new Error("Unknown mode: "+e)}}rt.from=function(t,r){if(rt.isValid(t))return t;try{return M3(t)}catch{return r}}});var N2=ve(ni=>{var Qc=In(),U3=Td(),L2=qc(),Dn=Pn(),Bd=Pd(),M2=7973,F2=Qc.getBCHDigit(M2);function N3(e,t,r){for(let n=1;n<=40;n++)if(t<=ni.getCapacity(n,r,e))return n}function U2(e,t){return Dn.getCharCountIndicator(e,t)+4}function z3(e,t){let r=0;return e.forEach(function(n){let i=U2(n.mode,t);r+=i+n.getBitsLength()}),r}function j3(e,t){for(let r=1;r<=40;r++)if(z3(e,r)<=ni.getCapacity(r,t,Dn.MIXED))return r}ni.from=function(t,r){return Bd.isValid(t)?parseInt(t,10):r};ni.getCapacity=function(t,r,n){if(!Bd.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Dn.BYTE);let i=Qc.getSymbolTotalCodewords(t),o=U3.getTotalCodewordsCount(t,r),s=(i-o)*8;if(n===Dn.MIXED)return s;let a=s-U2(n,t);switch(n){case Dn.NUMERIC:return Math.floor(a/10*3);case Dn.ALPHANUMERIC:return Math.floor(a/11*2);case Dn.KANJI:return Math.floor(a/13);case Dn.BYTE:default:return Math.floor(a/8)}};ni.getBestVersionForData=function(t,r){let n,i=L2.from(r,L2.M);if(Array.isArray(t)){if(t.length>1)return j3(t,i);if(t.length===0)return 1;n=t[0]}else n=t;return N3(n.mode,n.getLength(),i)};ni.getEncodedBits=function(t){if(!Bd.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;Qc.getBCHDigit(r)-F2>=0;)r^=M2<<Qc.getBCHDigit(r)-F2;return t<<12|r}});var H2=ve(V2=>{var Ld=In(),j2=1335,V3=21522,z2=Ld.getBCHDigit(j2);V2.getEncodedBits=function(t,r){let n=t.bit<<3|r,i=n<<10;for(;Ld.getBCHDigit(i)-z2>=0;)i^=j2<<Ld.getBCHDigit(i)-z2;return(n<<10|i)^V3}});var $2=ve((g8,W2)=>{var H3=Pn();function io(e){this.mode=H3.NUMERIC,this.data=e.toString()}io.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};io.prototype.getLength=function(){return this.data.length};io.prototype.getBitsLength=function(){return io.getBitsLength(this.data.length)};io.prototype.write=function(t){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),t.put(i,10);let o=this.data.length-r;o>0&&(n=this.data.substr(r),i=parseInt(n,10),t.put(i,o*3+1))};W2.exports=io});var q2=ve((y8,G2)=>{var W3=Pn(),Fd=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function oo(e){this.mode=W3.ALPHANUMERIC,this.data=e}oo.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};oo.prototype.getLength=function(){return this.data.length};oo.prototype.getBitsLength=function(){return oo.getBitsLength(this.data.length)};oo.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Fd.indexOf(this.data[r])*45;n+=Fd.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(Fd.indexOf(this.data[r]),6)};G2.exports=oo});var X2=ve((b8,K2)=>{var $3=Pn();function so(e){this.mode=$3.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}so.getBitsLength=function(t){return t*8};so.prototype.getLength=function(){return this.data.length};so.prototype.getBitsLength=function(){return so.getBitsLength(this.data.length)};so.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};K2.exports=so});var Y2=ve((_8,J2)=>{var G3=Pn(),q3=In();function ao(e){this.mode=G3.KANJI,this.data=e}ao.getBitsLength=function(t){return t*13};ao.prototype.getLength=function(){return this.data.length};ao.prototype.getBitsLength=function(){return ao.getBitsLength(this.data.length)};ao.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=q3.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
4
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};J2.exports=ao});var Z2=ve((v8,Md)=>{"use strict";var ds={single_source_shortest_paths:function(e,t,r){var n={},i={};i[t]=0;var o=ds.PriorityQueue.make();o.push(t,0);for(var s,a,c,l,h,u,m,p,g;!o.empty();){s=o.pop(),a=s.value,l=s.cost,h=e[a]||{};for(c in h)h.hasOwnProperty(c)&&(u=h[c],m=l+u,p=i[c],g=typeof i[c]>"u",(g||p>m)&&(i[c]=m,o.push(c,m),n[c]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var f=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(f)}return n},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t,i;n;)r.push(n),i=e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var n=ds.single_source_shortest_paths(e,t,r);return ds.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=ds.PriorityQueue,r={},n;e=e||{};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Md<"u"&&(Md.exports=ds)});var sy=ve(co=>{var Se=Pn(),ty=$2(),ry=q2(),ny=X2(),iy=Y2(),fs=Dd(),el=In(),K3=Z2();function Q2(e){return unescape(encodeURIComponent(e)).length}function ps(e,t,r){let n=[],i;for(;(i=e.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function oy(e){let t=ps(fs.NUMERIC,Se.NUMERIC,e),r=ps(fs.ALPHANUMERIC,Se.ALPHANUMERIC,e),n,i;return el.isKanjiModeEnabled()?(n=ps(fs.BYTE,Se.BYTE,e),i=ps(fs.KANJI,Se.KANJI,e)):(n=ps(fs.BYTE_KANJI,Se.BYTE,e),i=[]),t.concat(r,n,i).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function Ud(e,t){switch(t){case Se.NUMERIC:return ty.getBitsLength(e);case Se.ALPHANUMERIC:return ry.getBitsLength(e);case Se.KANJI:return iy.getBitsLength(e);case Se.BYTE:return ny.getBitsLength(e)}}function X3(e){return e.reduce(function(t,r){let n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)},[])}function J3(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case Se.NUMERIC:t.push([n,{data:n.data,mode:Se.ALPHANUMERIC,length:n.length},{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.ALPHANUMERIC:t.push([n,{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.KANJI:t.push([n,{data:n.data,mode:Se.BYTE,length:Q2(n.data)}]);break;case Se.BYTE:t.push([{data:n.data,mode:Se.BYTE,length:Q2(n.data)}])}}return t}function Y3(e,t){let r={},n={start:{}},i=["start"];for(let o=0;o<e.length;o++){let s=e[o],a=[];for(let c=0;c<s.length;c++){let l=s[c],h=""+o+c;a.push(h),r[h]={node:l,lastCount:0},n[h]={};for(let u=0;u<i.length;u++){let m=i[u];r[m]&&r[m].node.mode===l.mode?(n[m][h]=Ud(r[m].lastCount+l.length,l.mode)-Ud(r[m].lastCount,l.mode),r[m].lastCount+=l.length):(r[m]&&(r[m].lastCount=l.length),n[m][h]=Ud(l.length,l.mode)+4+Se.getCharCountIndicator(l.mode,t))}}i=a}for(let o=0;o<i.length;o++)n[i[o]].end=0;return{map:n,table:r}}function ey(e,t){let r,n=Se.getBestModeForData(e);if(r=Se.from(t,n),r!==Se.BYTE&&r.bit<n.bit)throw new Error('"'+e+'" cannot be encoded with mode '+Se.toString(r)+`.
5
+ Suggested mode is: `+Se.toString(n));switch(r===Se.KANJI&&!el.isKanjiModeEnabled()&&(r=Se.BYTE),r){case Se.NUMERIC:return new ty(e);case Se.ALPHANUMERIC:return new ry(e);case Se.KANJI:return new iy(e);case Se.BYTE:return new ny(e)}}co.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(ey(n,null)):n.data&&r.push(ey(n.data,n.mode)),r},[])};co.fromString=function(t,r){let n=oy(t,el.isKanjiModeEnabled()),i=J3(n),o=Y3(i,r),s=K3.find_path(o.map,"start","end"),a=[];for(let c=1;c<s.length-1;c++)a.push(o.table[s[c]].node);return co.fromArray(X3(a))};co.rawSplit=function(t){return co.fromArray(oy(t,el.isKanjiModeEnabled()))}});var cy=ve(ay=>{var rl=In(),Nd=qc(),Z3=v2(),Q3=S2(),ew=k2(),tw=x2(),Vd=A2(),Hd=Td(),rw=D2(),tl=N2(),nw=H2(),iw=Pn(),zd=sy();function ow(e,t){let r=e.size,n=tw.getPositions(t);for(let i=0;i<n.length;i++){let o=n[i][0],s=n[i][1];for(let a=-1;a<=7;a++)if(!(o+a<=-1||r<=o+a))for(let c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?e.set(o+a,s+c,!0,!0):e.set(o+a,s+c,!1,!0))}}function sw(e){let t=e.size;for(let r=8;r<t-8;r++){let n=r%2===0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function aw(e,t){let r=ew.getPositions(t);for(let n=0;n<r.length;n++){let i=r[n][0],o=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(i+s,o+a,!0,!0):e.set(i+s,o+a,!1,!0)}}function cw(e,t){let r=e.size,n=tl.getEncodedBits(t),i,o,s;for(let a=0;a<18;a++)i=Math.floor(a/3),o=a%3+r-8-3,s=(n>>a&1)===1,e.set(i,o,s,!0),e.set(o,i,s,!0)}function jd(e,t,r){let n=e.size,i=nw.getEncodedBits(t,r),o,s;for(o=0;o<15;o++)s=(i>>o&1)===1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}function lw(e,t){let r=e.size,n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!e.isReserved(i,a-c)){let l=!1;s<t.length&&(l=(t[s]>>>o&1)===1),e.set(i,a-c,l),o--,o===-1&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function hw(e,t,r){let n=new Z3;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),iw.getCharCountIndicator(c.mode,e)),c.write(n)});let i=rl.getSymbolTotalCodewords(e),o=Hd.getTotalCodewordsCount(e,t),s=(i-o)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let c=0;c<a;c++)n.put(c%2?17:236,8);return uw(n,e,t)}function uw(e,t,r){let n=rl.getSymbolTotalCodewords(t),i=Hd.getTotalCodewordsCount(t,r),o=n-i,s=Hd.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),h=Math.floor(o/s),u=h+1,m=l-h,p=new rw(m),g=0,f=new Array(s),b=new Array(s),_=0,k=new Uint8Array(e.buffer);for(let P=0;P<s;P++){let N=P<c?h:u;f[P]=k.slice(g,g+N),b[P]=p.encode(f[P]),g+=N,_=Math.max(_,N)}let S=new Uint8Array(n),R=0,x,D;for(x=0;x<_;x++)for(D=0;D<s;D++)x<f[D].length&&(S[R++]=f[D][x]);for(x=0;x<m;x++)for(D=0;D<s;D++)S[R++]=b[D][x];return S}function dw(e,t,r,n){let i;if(Array.isArray(e))i=zd.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let h=zd.rawSplit(e);l=tl.getBestVersionForData(h,r)}i=zd.fromString(e,l||40)}else throw new Error("Invalid data");let o=tl.getBestVersionForData(i,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=o;else if(t<o)throw new Error(`
5
6
  The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+i+`.
7
- `);let s=iw(t,r,o),a=Dc.getSymbolSize(t),c=new Kv(a);return ew(c,t),tw(c),rw(c,t),mu(c,r,0),t>=7&&nw(c,t),ow(c,s),isNaN(n)&&(n=gu.getBestMask(c,mu.bind(null,c,r))),gu.applyMask(n,c),mu(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}W2.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=pu.M,o,i;return typeof r<"u"&&(n=pu.from(r.errorCorrectionLevel,pu.M),o=Rc.from(r.version),i=gu.from(r.maskPattern),r.toSJISFunc&&Dc.setToSJISFunction(r.toSJISFunc)),aw(t,o,n,i)}});var bu=H(pn=>{function q2(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(n){return[n,n]}))),t.length===6&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+t.slice(0,6).join("")}}pn.getOptions=function(t){t||(t={}),t.color||(t.color={});let r=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:q2(t.color.dark||"#000000ff"),light:q2(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};pn.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};pn.getImageWidth=function(t,r){let n=pn.getScale(t,r);return Math.floor((t+r.margin*2)*n)};pn.qrToImageData=function(t,r,n){let o=r.modules.size,i=r.modules.data,s=pn.getScale(o,n),a=Math.floor((o+n.margin*2)*s),c=n.margin*s,l=[n.color.light,n.color.dark];for(let h=0;h<a;h++)for(let d=0;d<a;d++){let u=(h*a+d)*4,b=n.color.light;if(h>=c&&d>=c&&h<a-c&&d<a-c){let m=Math.floor((h-c)/s),f=Math.floor((d-c)/s);b=l[i[m*o+f]?1:0]}t[u++]=b.r,t[u++]=b.g,t[u++]=b.b,t[u]=b.a}}});var G2=H(Oc=>{var vu=bu();function cw(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}function lw(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Oc.render=function(t,r,n){let o=n,i=r;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),r||(i=lw()),o=vu.getOptions(o);let s=vu.getImageWidth(t.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return vu.qrToImageData(c.data,t,o),cw(a,i,s),a.putImageData(c,0,0),i};Oc.renderToDataURL=function(t,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=Oc.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var J2=H(X2=>{var hw=bu();function K2(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function wu(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function dw(e,t,r){let n="",o=0,i=!1,s=0;for(let a=0;a<e.length;a++){let c=Math.floor(a%t),l=Math.floor(a/t);!c&&!i&&(i=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=i?wu("M",c+r,.5+l+r):wu("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=wu("h",s),s=0)):o++}return n}X2.render=function(t,r,n){let o=hw.getOptions(r),i=t.modules.size,s=t.modules.data,a=i+o.margin*2,c=o.color.light.a?"<path "+K2(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+K2(o.color.dark,"stroke")+' d="'+dw(s,i,o.margin)+'"/>',h='viewBox="0 0 '+a+" "+a+'"',u='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+h+' shape-rendering="crispEdges">'+c+l+`</svg>
8
- `;return typeof n=="function"&&n(null,u),u}});var Q2=H(Fi=>{var uw=e2(),_u=$2(),Y2=G2(),pw=J2();function Su(e,t,r,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!uw())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,l){try{let h=_u.create(r,n);c(e(h,t,n))}catch(h){l(h)}})}try{let c=_u.create(r,n);o(null,e(c,t,n))}catch(c){o(c)}}Fi.create=_u.create;Fi.toCanvas=Su.bind(null,Y2.render);Fi.toDataURL=Su.bind(null,Y2.renderToDataURL);Fi.toString=Su.bind(null,function(e,t,r){return pw.render(e,r)})});async function Gi(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function Ki(){return new Promise((e,t)=>{let r=window.screen.isExtended;if(r)e(r);else if(navigator.userAgent.indexOf("Firefox")>-1)e(!1);else{let o=[];window.getScreenDetails().then(function(i){o=i,e(o.screens.length>=2)})}})}async function St(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>!e.some(i=>o.deviceId.includes(i)||o.label.includes(i)));return{cameras:r.filter(o=>o.kind=="videoinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId})),microphones:r.filter(o=>o.kind=="audioinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId}))}}var Gr=typeof self<"u"?self:{};function zr(){throw Error("Invalid UTF8")}function Fu(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Xi,jc,_y=typeof TextDecoder<"u",Sy,ky=typeof TextEncoder<"u";function Xp(e){if(ky)e=(Sy||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&o<e.length){let i=e.charCodeAt(++o);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}o--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var vl,cs;e:{for(Vc=["CLOSURE_FLAGS"],Ji=Gr,Yi=0;Yi<Vc.length;Yi++)if((Ji=Ji[Vc[Yi]])==null){cs=null;break e}cs=Ji}var Vc,Ji,Yi,Ho,Uu=cs&&cs[610401301];vl=Uu!=null&&Uu;var Nu=Gr.navigator;function Zc(e){return!!vl&&!!Ho&&Ho.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function at(e){var t;return(t=Gr.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function pr(){return!!vl&&!!Ho&&Ho.brands.length>0}function Hc(){return pr()?Zc("Chromium"):(at("Chrome")||at("CriOS"))&&!(!pr()&&at("Edge"))||at("Silk")}function wl(e){return wl[" "](e),e}Ho=Nu&&Nu.userAgentData||null,wl[" "]=function(){};var Ey=!pr()&&(at("Trident")||at("MSIE"));!at("Android")||Hc(),Hc(),at("Safari")&&(Hc()||!pr()&&at("Coast")||!pr()&&at("Opera")||!pr()&&at("Edge")||(pr()?Zc("Microsoft Edge"):at("Edg/"))||pr()&&Zc("Opera"));var Jp={},Lo=null;function Cy(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),o=0;return(function(i,s){function a(l){for(;c<i.length;){let h=i.charAt(c++),d=Lo[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}Yp();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),u=a(64);if(u===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),u!=64&&s(d<<6&192|u))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function Yp(){if(!Lo){Lo={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));Jp[r]=n;for(let o=0;o<n.length;o++){let i=n[o];Lo[i]===void 0&&(Lo[i]=o)}}}}var Qp=typeof Uint8Array<"u",Zp=!Ey&&typeof btoa=="function";function ju(e){if(!Zp){var t;t===void 0&&(t=0),Yp(),t=Jp[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],i=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|i>>4],i=t[(15&i)<<2|s>>6],s=t[63&s],r[l++]=a+o+i+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var Vu=/[-_.]/g,xy={"-":"+",_:"/",".":"="};function Ay(e){return xy[e]||""}function ef(e){if(!Zp)return Cy(e);Vu.test(e)&&(e=e.replace(Vu,Ay)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Go(e){return Qp&&e!=null&&e instanceof Uint8Array}var In={};function Kr(){return Ty||=new er(null,In)}function _l(e){tf(In);var t=e.g;return(t=t==null||Go(t)?t:typeof t=="string"?ef(t):null)==null?t:e.g=t}var er=class{h(){return new Uint8Array(_l(this)||0)}constructor(e,t){if(tf(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},Ty,Iy;function tf(e){if(e!==In)throw Error("illegal external caller")}function rf(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function el(e){return rf(e=Error(e),"warning"),e}var bs=typeof Symbol=="function"&&typeof Symbol()=="symbol",Py=new Set;function Ko(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&Py.add(e),e}var Ry=Ko("jas",void 0,!0,!0),Hu=Ko(void 0,"0di"),zc=Ko(void 0,"2ex"),Oo=Ko(void 0,"1oa",!0),Pn=Ko(void 0,Symbol(),!0),C=bs?Ry:"Ga",nf={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},of=Object.defineProperties;function vs(e,t){bs||C in e||of(e,nf),e[C]|=t}function ge(e,t){bs||C in e||of(e,nf),e[C]=t}function Nn(e){return vs(e,34),e}function Dy(e,t){ge(t,-30975&(0|e))}function tl(e,t){ge(t,-30941&(34|e))}function Sl(){return typeof BigInt=="function"}function Ve(e){return Array.prototype.slice.call(e)}var kl,Xo={},sf={};function zu(e){return!(!e||typeof e!="object"||e.Ia!==sf)}function El(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Cl(e,t){if(e!=null){if(typeof e=="string")e=e?new er(e,In):Kr();else if(e.constructor!==er)if(Go(e))e=e.length?new er(new Uint8Array(e),In):Kr();else{if(!t)throw Error();e=void 0}}return e}function ls(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[C]))}var Wu=[];function wr(e){if(2&e)throw Error()}ge(Wu,55),kl=Object.freeze(Wu);var hs=class e{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new e(this.g,this.h,this.m)}};function xl(e){return Pn?e[Pn]:void 0}var Oy=Object.freeze({});function ws(e){return e.Qa=!0,e}var By=ws((e=>typeof e=="number")),$u=ws((e=>typeof e=="string")),My=ws((e=>typeof e=="boolean")),_s=typeof Gr.BigInt=="function"&&typeof Gr.BigInt(0)=="bigint",rl=ws((e=>_s?e>=Fy&&e<=Ny:e[0]==="-"?qu(e,Ly):qu(e,Uy))),Ly=Number.MIN_SAFE_INTEGER.toString(),Fy=_s?BigInt(Number.MIN_SAFE_INTEGER):void 0,Uy=Number.MAX_SAFE_INTEGER.toString(),Ny=_s?BigInt(Number.MAX_SAFE_INTEGER):void 0;function qu(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],o=t[r];if(n>o)return!1;if(n<o)return!0}}var jy=typeof Uint8Array.prototype.slice=="function",af,$=0,ce=0;function Gu(e){let t=e>>>0;$=t,ce=(e-t)/4294967296>>>0}function Rn(e){if(e<0){Gu(-e);let[t,r]=Pl($,ce);$=t>>>0,ce=r>>>0}else Gu(e)}function Al(e){let t=af||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),ce=0,$=t.getUint32(0,!0)}function Tl(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:zo(e,t)}function Il(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Tl(e,t))=="number"?r?-e:e:r?"-"+e:e}function zo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Sl()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Ku(r)+Ku(e));return r}function Ku(e){return e=String(e),"0000000".slice(e.length)+e}function Ss(e){if(e.length<16)Rn(Number(e));else if(Sl())e=BigInt(e),$=Number(e&BigInt(4294967295))>>>0,ce=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");ce=$=0;let r=e.length;for(let n=t,o=(r-t)%6+t;o<=r;n=o,o+=6){let i=Number(e.slice(n,o));ce*=1e6,$=1e6*$+i,$>=4294967296&&(ce+=Math.trunc($/4294967296),ce>>>=0,$>>>=0)}if(t){let[n,o]=Pl($,ce);$=n,ce=o}}}function Pl(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var Rl=typeof BigInt=="function"?BigInt.asIntN:void 0,Vy=typeof BigInt=="function"?BigInt.asUintN:void 0,En=Number.isSafeInteger,ks=Number.isFinite,ds=Math.trunc;function _r(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function cf(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var Hy=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Es(e){switch(typeof e){case"bigint":return!0;case"number":return ks(e);case"string":return Hy.test(e);default:return!1}}function jn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return ks(e)?0|e:void 0}function lf(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return ks(e)?e>>>0:void 0}function Xu(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Dl(e){return e=ds(e),En(e)||(Rn(e),e=Il($,ce)),e}function Ol(e){var t=ds(Number(e));if(En(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(Ss(e),e=$,2147483648&(t=ce))if(Sl())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Pl(e,t);e="-"+zo(r,n)}else e=zo(e,t);return e}function us(e){return e==null?e:typeof e=="bigint"?(rl(e)?e=Number(e):(e=Rl(64,e),e=rl(e)?Number(e):String(e)),e):Es(e)?typeof e=="number"?Dl(e):Ol(e):void 0}function zy(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Vy(64,e));if(Es(e)){if(t==="string")return t=ds(Number(e)),En(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Xu(e)||(Ss(e),e=zo($,ce))),e;if(t==="number")return(e=ds(e))>=0&&En(e)?e:(function(r){if(r<0){Rn(r);var n=zo($,ce);return r=Number(n),En(r)?r:n}return Xu(n=String(r))?n:(Rn(r),Tl($,ce))})(e)}}function hf(e){if(typeof e!="string")throw Error();return e}function Vn(e){if(e!=null&&typeof e!="string")throw Error();return e}function Dn(e){return e==null||typeof e=="string"?e:void 0}function Bl(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===Xo)return e;if(!Array.isArray(e))return r?2&n?((e=t[Hu])||(Nn((e=new t).u),e=t[Hu]=e),t=e):t=new t:t=void 0,t;let o=r=0|e[C];return o===0&&(o|=32&n),o|=2&n,o!==r&&ge(e,o),new t(e)}function Wy(e,t,r){if(t)e:{if(!Es(t=e))throw el("int64");switch(typeof t){case"string":t=Ol(t);break e;case"bigint":if(e=t=Rl(64,t),$u(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(By(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=_s?BigInt(t):My(t)?t?"1":"0":$u(t)?t.trim()||"0":String(t);break e;default:t=Dl(t)}}else t=us(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&En(t=+r)?t:r}var $y={},qy=(function(){try{return wl(new class extends Map{constructor(){super()}}),!1}catch{return!0}})(),Uo=class{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}},Gy=qy?(Object.setPrototypeOf(Uo.prototype,Map.prototype),Object.defineProperties(Uo.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Uo):class extends Map{constructor(){super()}};function Ju(e){return e}function Wc(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var lt=class extends Gy{constructor(e,t,r=Ju,n=Ju){super();let o=0|e[C];o|=64,ge(e,o),this.L=o,this.S=t,this.R=r,this.Y=this.S?Ky:n;for(let i=0;i<e.length;i++){let s=e[i],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=n(s[1],!1,!0,void 0,void 0,o),super.set(a,c)}}na(e=Yu){if(this.size!==0)return this.X(e)}X(e=Yu){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){Wc(this),super.clear()}delete(e){return Wc(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new hs(e,Xy,this)}keys(){return this.Ha()}values(){var e=this.ma();return new hs(e,lt.prototype.get,this)}forEach(e,t){super.forEach(((r,n)=>{e.call(t,this.get(n),n,this)}))}set(e,t){return Wc(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.S,!1,this.L))}Na(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.S?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.L),super.set(t,e)}has(e){return super.has(this.R(e,!1,!1))}get(e){e=this.R(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.S;return r?((r=this.Y(t,!1,!0,r,this.ra,this.L))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function Ky(e,t,r,n,o,i){return e=Bl(e,n,r,i),o&&(e=xs(e)),e}function Yu(e){return e}function Xy(e){return[e,this.get(e)]}var Jy,df,Yy;function Qu(){return Jy||=new lt(Nn([]),void 0,void 0,void 0,$y)}function Ml(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=ls(e)?void 0:o&&2&(0|e[C])?e:Ll(e,t,r,n!==void 0,o);else if(El(e)){let i={};for(let s in e)i[s]=Ml(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Ll(e,t,r,n,o){let i=n||r?0|e[C]:0,s=n?!!(32&i):void 0;n=Ve(e);for(let a=0;a<n.length;a++)n[a]=Ml(n[a],t,r,s,o);return r&&((e=xl(e))&&(n[Pn]=Ve(e)),r(i,n)),n}function Qy(e){return Ml(e,uf,void 0,void 0,!1)}function uf(e){return e.W===Xo?e.toJSON():e instanceof lt?e.na(Qy):(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return rl(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ls(t))return}else{if(Go(t))return ju(t);if(t instanceof er){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=ju(r)}if(t instanceof lt)return t.na()}}return t})(e)}function pf(e){return Ll(e,uf,void 0,void 0,!1)}function mr(e,t,r){return e=ff(e,t[0],t[1],r?1:2),t!==df&&r&&vs(e,16384),e}function ff(e,t,r,n){if(e==null){var o=96;r?(e=[r],o|=512):e=[],t&&(o=-33521665&o|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(o=0|e[C]))throw Error("farr");if(64&o)return e;if(n===1||n===2||(o|=64),r&&(o|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let i=n-1;if(El(r[i])){if((t=i-(512&(o|=256)?0:-1))>=1024)throw Error("pvtlmt");o=-33521665&o|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&o?0:-1)))>1024)throw Error("spvt");o=-33521665&o|(1023&t)<<15}}}return ge(e,o),e}function nl(e,t,r=tl){if(e!=null){if(Qp&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[C];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(ge(e,-12293&(34|n)),e):Ll(e,nl,4&n?tl:r,!0,!0))}return e.W===Xo?e=2&(n=0|(r=e.u)[C])?e:new e.constructor(Cs(r,n,!0)):e instanceof lt&&!(2&e.L)&&(r=Nn(e.X(nl)),e=new lt(r,e.S,e.R,e.Y)),e}}function Cs(e,t,r){let n=r||2&t?tl:Dy,o=!!(32&t);return e=(function(i,s,a){let c=Ve(i);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(i=xl(i))&&(c[Pn]=Ve(i)),c})(e,t,(i=>nl(i,o,n))),vs(e,32|(r?2:0)),e}function xs(e){let t=e.u,r=0|t[C];return 2&r?new e.constructor(Cs(t,r,!1)):e}function On(e,t){return or(e=e.u,0|e[C],t)}function or(e,t,r,n){if(r===-1)return null;var o=r+(512&t?0:-1);let i=e.length-1;return o>=i&&256&t?e[i][r]:n&&256&t&&(t=e[i][r])!=null?(e[o]!=null&&zc!=null&&((o=(e=Iy??={})[zc]||0)>=4||(e[zc]=o+1,rf(e=Error(),"incident"),(function(s){Gr.setTimeout((()=>{throw s}),0)})(e))),t):o<=i?e[o]:void 0}function G(e,t,r){let n=e.u,o=0|n[C];return wr(o),ne(n,o,t,r),e}function ne(e,t,r,n){let o=512&t?0:-1,i=r+o;var s=e.length-1;return i>=s&&256&t?(e[s][r]=n,t):i<=s?(e[i]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+o]={[r]:n},ge(e,t|=256)):e[i]=n),t)}function rs(e,t){let r=0|(e=e.u)[C],n=or(e,r,t),o=_r(n);return o!=null&&o!==n&&ne(e,r,t,o),o}function mf(e){let t=0|(e=e.u)[C],r=or(e,t,1),n=Cl(r,!0);return n!=null&&n!==r&&ne(e,t,1,n),n}function Wr(){return Oy===void 0?2:4}function $r(e,t,r,n,o){let i=e.u,s=2&(e=0|i[C])?1:n;o=!!o;let a=0|(n=Fl(i,e,t))[C];if(!(4&a)){4&a&&(n=Ve(n),a=tr(a,e),e=ne(i,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=Ul(a,e),r=-4097&(20|a),a=r&=-8193,ge(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Zt(a)||(o=a,a|=2,a!==o&&ge(n,a),Object.freeze(n)):(s===2&&Zt(a)&&(n=Ve(n),a=tr(a,e),a=gr(a,e,o),ge(n,a),e=ne(i,e,t,n)),Zt(a)||(t=a,a=gr(a,e,o),a!==t&&ge(n,a))),n}function Fl(e,t,r,n){return e=or(e,t,r,n),Array.isArray(e)?e:kl}function Ul(e,t){return e===0&&(e=tr(e,t)),1|e}function Zt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function gf(e){e=Ve(e);for(let t=0;t<e.length;t++){let r=e[t]=Ve(e[t]);Array.isArray(r[1])&&(r[1]=Nn(r[1]))}return e}function ol(e,t,r,n){let o=0|(e=e.u)[C];wr(o),ne(e,o,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Hn(e,t,r,n,o){wr(t);var i=!(!(64&t)&&16384&t);let s=(o=Fl(e,t,r,o))!==kl;if(i||!s){let a=i=s?0|o[C]:0;(!s||2&a||Zt(a)||4&a&&!(32&a))&&(o=Ve(o),a=tr(a,t),t=ne(e,t,r,o)),a=-13&Ul(a,t),a=gr(n?-17&a:16|a,t,!0),a!==i&&ge(o,a)}return o}function $c(e,t){var r=im;return jl(Nl(e=e.u),e,0|e[C],r)===t?t:-1}function Nl(e){if(bs)return e[Oo]??(e[Oo]=new Map);if(Oo in e)return e[Oo];let t=new Map;return Object.defineProperty(e,Oo,{value:t}),t}function yf(e,t,r,n){let o=Nl(e),i=jl(o,e,t,r);return i!==n&&(i&&(t=ne(e,t,i)),o.set(r,n)),t}function jl(e,t,r,n){let o=e.get(n);if(o!=null)return o;o=0;for(let i=0;i<n.length;i++){let s=n[i];or(t,r,s)!=null&&(o!==0&&(r=ne(t,r,o)),o=s)}return e.set(n,o),o}function Vl(e,t,r,n){let o,i=0|e[C];if((n=or(e,i,r,n))!=null&&n.W===Xo)return(t=xs(n))!==n&&ne(e,i,r,t),t.u;if(Array.isArray(n)){let s=0|n[C];o=2&s?mr(Cs(n,s,!1),t,!0):64&s?n:mr(o,t,!0)}else o=mr(void 0,t,!0);return o!==n&&ne(e,i,r,o),o}function bf(e,t,r,n){let o=0|(e=e.u)[C];return(t=Bl(n=or(e,o,r,n),t,!1,o))!==n&&t!=null&&ne(e,o,r,t),t}function F(e,t,r,n=!1){if((t=bf(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[C]))){let o=xs(t);o!==t&&ne(e,n,r,t=o)}return t}function vf(e,t,r,n,o,i,s){e=e.u;var a=!!(2&t);let c=a?1:o;i=!!i,s&&=!a;var l=0|(o=Fl(e,t,n))[C];if(!(a=!!(4&l))){var h=o,d=t;let u=!!(2&(l=Ul(l,t)));u&&(d|=2);let b=!u,m=!0,f=0,y=0;for(;f<h.length;f++){let v=Bl(h[f],r,!1,d);if(v instanceof r){if(!u){let _=!!(2&(0|v.u[C]));b&&=!_,m&&=_}h[y++]=v}}y<f&&(h.length=y),l|=4,l=m?16|l:-17&l,ge(h,l=b?8|l:-9&l),u&&Object.freeze(h)}if(s&&!(8&l||!o.length&&(c===1||c===4&&32&l))){for(Zt(l)&&(o=Ve(o),l=tr(l,t),t=ne(e,t,n,o)),r=o,s=l,h=0;h<r.length;h++)(l=r[h])!==(d=xs(l))&&(r[h]=d);s|=8,ge(r,s=r.length?-17&s:16|s),l=s}return c===1||c===4&&32&l?Zt(l)||(t=l,(l|=!o.length||16&l&&(!a||32&l)?2:2048)!==t&&ge(o,l),Object.freeze(o)):(c===2&&Zt(l)&&(ge(o=Ve(o),l=gr(l=tr(l,t),t,i)),t=ne(e,t,n,o)),Zt(l)||(n=l,(l=gr(l,t,i))!==n&&ge(o,l))),o}function rr(e,t,r){let n=0|e.u[C];return vf(e,n,t,r,Wr(),!1,!(2&n))}function A(e,t,r,n){return n==null&&(n=void 0),G(e,r,n)}function No(e,t,r,n){n==null&&(n=void 0);e:{let o=0|(e=e.u)[C];if(wr(o),n==null){let i=Nl(e);if(jl(i,e,o,r)!==t)break e;i.set(r,0)}else o=yf(e,o,r,t);ne(e,o,t,n)}}function tr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function gr(e,t,r){return 32&t&&r||(e&=-33),e}function ps(e,t,r,n){let o=0|e.u[C];wr(o),e=vf(e,o,r,t,2,!0),n=n??new r,e.push(n),e[C]=2&(0|n.u[C])?-9&e[C]:-17&e[C]}function ct(e,t){return jn(On(e,t))}function ht(e,t){return Dn(On(e,t))}function pe(e,t){return rs(e,t)??0}function Wo(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);G(e,t,r)}function jt(e,t,r){if(r!=null){if(typeof r!="number"||!ks(r))throw el("int32");r|=0}G(e,t,r)}function k(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);G(e,t,r)}function fs(e,t,r){{let s=e.u,a=0|s[C];if(wr(a),r==null)ne(s,a,t);else{var n=e=0|r[C],o=Zt(e),i=o||Object.isFrozen(r);for(o||(e=0),i||(r=Ve(r),n=0,e=gr(e=tr(e,a),a,!0),i=!1),e|=21,o=0;o<r.length;o++){let c=r[o],l=hf(c);Object.is(c,l)||(i&&(r=Ve(r),n=0,e=gr(e=tr(e,a),a,!0),i=!1),r[o]=l)}e!==n&&(i&&(r=Ve(r),e=gr(e=tr(e,a),a,!0)),ge(r,e)),ne(s,a,t,r)}}}function As(e,t,r){wr(0|e.u[C]),$r(e,t,Dn,2,!0).push(hf(r))}function wf(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Hl(){return Error("Failed to read varint, encoding is invalid.")}function _f(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function zl(e){if(typeof e=="string")return{buffer:ef(e),N:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Uint8Array)return{buffer:e,N:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),N:!1};if(e.constructor===er)return{buffer:_l(e)||new Uint8Array(0),N:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),N:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Wl(e,t){let r,n=0,o=0,i=0,s=e.h,a=e.g;do r=s[a++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);for(i>32&&(o|=(127&r)>>4),i=3;i<32&&128&r;i+=7)r=s[a++],o|=(127&r)<<i;if(qr(e,a),r<128)return t(n>>>0,o>>>0);throw Hl()}function $l(e){let t=0,r=e.g,n=r+10,o=e.h;for(;r<n;){let i=o[r++];if(t|=i,(128&i)==0)return qr(e,r),!!(127&t)}throw Hl()}function yr(e){let t=e.h,r=e.g,n=t[r++],o=127&n;if(128&n&&(n=t[r++],o|=(127&n)<<7,128&n&&(n=t[r++],o|=(127&n)<<14,128&n&&(n=t[r++],o|=(127&n)<<21,128&n&&(n=t[r++],o|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Hl();return qr(e,r),o}function nr(e){return yr(e)>>>0}function il(e){var t=e.h;let r=e.g,n=t[r],o=t[r+1],i=t[r+2];return t=t[r+3],qr(e,e.g+4),(n<<0|o<<8|i<<16|t<<24)>>>0}function sl(e){var t=il(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Zy(e){return yr(e)}function qc(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=zl(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function qr(e,t){if(e.g=t,t>e.l)throw _f(e.l,t)}function Sf(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw _f(t,e.l-r);return e.g=n,r}function kf(e,t){if(t==0)return Kr();var r=Sf(e,t);return e.ba&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):jy?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Kr():new er(r,In)}lt.prototype.toJSON=void 0,lt.prototype.Ia=sf;var Zu=[];function Ef(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=nr(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw wf(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function ns(e){switch(e.h){case 0:e.h!=0?ns(e):$l(e.g);break;case 1:qr(e=e.g,e.g+8);break;case 2:if(e.h!=2)ns(e);else{var t=nr(e.g);qr(e=e.g,e.g+t)}break;case 5:qr(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Ef(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}ns(e)}break;default:throw wf(e.h,e.l)}}function Jo(e,t,r){let n=e.g.l,o=nr(e.g),i=e.g.g+o,s=i-n;if(s<=0&&(e.g.l=i,r(t,e,void 0,void 0,void 0),s=i-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=i,e.g.l=n,t}function ql(e){var t=nr(e.g),r=Sf(e=e.g,t);if(e=e.h,_y){var n,o=e;(n=jc)||(n=jc=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var i=n.decode(o)}catch(a){if(Xi===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Xi=!0}catch{Xi=!1}}throw!Xi&&(jc=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var s=e[i++];s<128?r.push(s):s<224?i>=t?zr():(a=e[i++],s<194||(192&a)!=128?(i--,zr()):r.push((31&s)<<6|63&a)):s<240?i>=t-1?zr():(a=e[i++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[i++]))!=128?(i--,zr()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?i>=t-2?zr():(a=e[i++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(o=e[i++]))!=128?(i--,zr()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):zr(),r.length>=8192&&(c=Fu(c,r),r.length=0)}i=Fu(c,r)}return i}function Cf(e){let t=nr(e.g);return kf(e.g,t)}function Ts(e,t,r){var n=nr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Qi=[];function eb(e){return e}var Cn;function kt(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var S=class{constructor(e,t){this.u=ff(e,t)}toJSON(){let e=!Cn;try{return e&&(Cn=pf),xf(this)}finally{e&&(Cn=void 0)}}l(){var e=Mb;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.u;return new this.constructor(Cs(e,0|e[C],!1))}N(){return!!(2&(0|this.u[C]))}};function xf(e){var t=e.u;{t=(e=Cn(t))!==t;let l=e.length;if(l){var r=e[l-1],n=El(r);n?l--:r=void 0;var o=e;if(n){e:{var i,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(i??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(ls(n)||zu(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((i??={})[h]=n));if(a||(i=s),i)for(let h in i){a=i;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((i=o[l-1])==null||ls(i)||zu(i)&&i.size===0);l--)var c=!0;(o!==e||s||c)&&(t?(c||s||a)&&(o.length=l):o=Array.prototype.slice.call(o,0,l),a&&o.push(a)),c=o}else c=e}return c}function ep(e){return e?/^\d+$/.test(e)?(Ss(e),new al($,ce)):null:tb||=new al(0,0)}S.prototype.W=Xo,S.prototype.toString=function(){try{return Cn=eb,xf(this).toString()}finally{Cn=void 0}};var al=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},tb;function tp(e){return e?/^-?\d+$/.test(e)?(Ss(e),new cl($,ce)):null:rb||=new cl(0,0)}var cl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},rb;function xn(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function zn(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Is(e,t){if(t>=0)zn(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function $o(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Bn(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ze(e,t,r){zn(e.g,8*t+r)}function Gl(e,t){return Ze(e,t,2),t=e.g.end(),Bn(e,t),t.push(e.h),t}function Kl(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function Ps(e,t,r){Ze(e,t,2),zn(e.g,r.length),Bn(e,e.g.end()),Bn(e,r)}function ms(e,t,r,n){r!=null&&(t=Gl(e,t),n(r,e),Kl(e,t))}function Et(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Xl=Et(),Af=Et(),Jl=Et(),Yl=Et(),Tf=Et(),If=Et(),Ql=Et(),Pf=Et(),Rf=Et(),Wn=class{constructor(e,t,r){this.g=e,this.h=t,e=Xl,this.l=!!e&&r===e||!1}};function Rs(e,t){return new Wn(e,t,Xl)}function Df(e,t,r,n,o){ms(e,r,Lf(t,n),o)}var nb=Rs((function(e,t,r,n,o){return e.h===2&&(Jo(e,Vl(t,n,r),o),!0)}),Df),ob=Rs((function(e,t,r,n,o){return e.h===2&&(Jo(e,Vl(t,n,r,!0),o),!0)}),Df),Ds=Symbol(),Zl=Symbol(),rp=Symbol(),np=Symbol(),Of,Bf;function Xr(e,t,r,n){var o=n[e];if(o)return o;(o={}).Pa=n,o.V=(function(d){switch(typeof d){case"boolean":return df||=[0,void 0,!0];case"number":return d>0?void 0:d===0?Yy||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var i=n[1];let s=1;i&&i.constructor===Object&&(o.ga=i,typeof(i=n[++s])=="function"&&(o.la=!0,Of??=i,Bf??=n[s+1],i=n[s+=2]));let a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=n[++s]}for(c=1;i!==void 0;){let d;typeof i=="number"&&(c+=i,i=n[++s]);var l=void 0;if(i instanceof Wn?d=i:(d=nb,s--),d?.l){i=n[++s],l=n;var h=s;typeof i=="function"&&(i=i(),l[h]=i),l=i}for(h=c+1,typeof(i=n[++s])=="number"&&i<0&&(h-=i,i=n[++s]);c<h;c++){let u=a[c];l?r(o,c,d,l,u):t(o,c,d,u)}}return n[e]=o}function Mf(e){return Array.isArray(e)?e[0]instanceof Wn?e:[ob,e]:[e,void 0]}function Lf(e,t){return e instanceof S?e.u:Array.isArray(e)?mr(e,t,!1):void 0}function eh(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function th(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=Xr(Zl,eh,th,n).V,s||=rh(n),o)}function rh(e){let t=e[rp];if(t!=null)return t;let r=Xr(Zl,eh,th,e);return t=r.la?(n,o)=>Of(n,o,r):(n,o)=>{let i=0|n[C];for(;Ef(o)&&o.h!=4;){var s=o.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=ib(c))!=null&&(a=r[s]=c)}a!=null&&a(o,n,s)||(s=(a=o).l,ns(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=kf(a.g,c)),s=n,a&&((c=s[Pn])?c.push(a):s[Pn]=[a]))}return 16384&i&&Nn(n),!0},e[rp]=t}function ib(e){let t=(e=Mf(e))[0].g;if(e=e[1]){let r=rh(e),n=Xr(Zl,eh,th,e).V;return(o,i,s)=>t(o,i,s,n,r)}return t}function Os(e,t,r){e[t]=r.h}function Bs(e,t,r,n){let o,i,s=r.h;e[t]=(a,c,l)=>s(a,c,l,i||=Xr(Ds,Os,Bs,n).V,o||=Ff(n))}function Ff(e){let t=e[np];if(!t){let r=Xr(Ds,Os,Bs,e);t=(n,o)=>Uf(n,o,r),e[np]=t}return t}function Uf(e,t,r){for(var n=0|e[C],o=512&n?0:-1,i=e.length,s=512&n?1:0,a=i+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,h=op(r,l);h&&h(t,c,l)}if(256&n){n=e[i-1];for(let c in n)o=+c,Number.isNaN(o)||(i=n[o])!=null&&(a=op(r,o))&&a(t,i,o)}if(e=xl(e))for(Bn(t,t.g.end()),r=0;r<e.length;r++)Bn(t,_l(e[r])||new Uint8Array(0))}function op(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=Mf(r))[0].h;if(r=r[1]){let o=Ff(r),i=Xr(Ds,Os,Bs,r).V;r=e.la?Bf(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function $n(e,t){if(Array.isArray(t)){var r=0|t[C];if(4&r)return t;for(var n=0,o=0;n<t.length;n++){let i=e(t[n]);i!=null&&(t[o++]=i)}return o<n&&(t.length=o),ge(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function Oe(e,t,r){return new Wn(e,t,r)}function qn(e,t,r){return new Wn(e,t,r)}function Be(e,t,r){ne(e,0|e[C],t,r)}var sb=Rs((function(e,t,r,n,o){return e.h===2&&(e=Jo(e,mr([void 0,void 0],n,!0),o),wr(n=0|t[C]),(o=or(t,n,r))instanceof lt?(2&o.L)!=0?((o=o.X()).push(e),ne(t,n,r,o)):o.Na(e):Array.isArray(o)?(2&(0|o[C])&&ne(t,n,r,o=gf(o)),o.push(e)):ne(t,n,r,[e]),!0)}),(function(e,t,r,n,o){if(t instanceof lt)t.forEach(((i,s)=>{ms(e,r,mr([s,i],n,!1),o)}));else if(Array.isArray(t))for(let i=0;i<t.length;i++){let s=t[i];Array.isArray(s)&&ms(e,r,mr(s,n,!1),o)}}));function Nf(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(Rl(64,n));if(Es(n)){if(o==="string")return Ol(n);if(o==="number")return Dl(n)}})(t),t!=null&&(typeof t=="string"&&tp(t),t!=null))switch(Ze(e,r,0),typeof t){case"number":e=e.g,Rn(t),xn(e,$,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new cl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),xn(e.g,r.h,r.g);break;default:r=tp(t),xn(e.g,r.h,r.g)}}function jf(e,t,r){(t=jn(t))!=null&&t!=null&&(Ze(e,r,0),Is(e.g,t))}function Vf(e,t,r){(t=cf(t))!=null&&(Ze(e,r,0),e.g.g.push(t?1:0))}function Hf(e,t,r){(t=Dn(t))!=null&&Ps(e,r,Xp(t))}function zf(e,t,r,n,o){ms(e,r,Lf(t,n),o)}function Wf(e,t,r){(t=t==null||typeof t=="string"||Go(t)||t instanceof er?t:void 0)!=null&&Ps(e,r,zl(t).buffer)}function $f(e,t,r){return(e.h===5||e.h===2)&&(t=Hn(t,0|t[C],r,!1,!1),e.h==2?Ts(e,sl,t):t.push(sl(e.g)),!0)}var Yt=Oe((function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=il(n);let o=il(n);n=2*(o>>31)+1;let i=o>>>20&2047;return e=4294967296*(1048575&o)+e,Be(t,r,i==2047?e?NaN:n*(1/0):i==0?5e-324*n*e:n*Math.pow(2,i-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=_r(t))!=null&&(Ze(e,r,1),e=e.g,(r=af||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),$=r.getUint32(0,!0),ce=r.getUint32(4,!0),$o(e,$),$o(e,ce))}),Et()),ye=Oe((function(e,t,r){return e.h===5&&(Be(t,r,sl(e.g)),!0)}),(function(e,t,r){(t=_r(t))!=null&&(Ze(e,r,5),e=e.g,Al(t),$o(e,$))}),Ql),ab=qn($f,(function(e,t,r){if((t=$n(_r,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ze(n,o,5),n=n.g,Al(i),$o(n,$))}}),Ql),nh=qn($f,(function(e,t,r){if((t=$n(_r,t))!=null&&t.length){Ze(e,r,2),zn(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Al(t[n]),$o(r,$)}}),Ql),br=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Wl(e.g,Il)),!0)}),Nf,If),Gc=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=Wl(e.g,Il))===0?void 0:e),!0)}),Nf,If),cb=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Wl(e.g,Tl)),!0)}),(function(e,t,r){if((t=zy(t))!=null&&(typeof t=="string"&&ep(t),t!=null))switch(Ze(e,r,0),typeof t){case"number":e=e.g,Rn(t),xn(e,$,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new al(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),xn(e.g,r.h,r.g);break;default:r=ep(t),xn(e.g,r.h,r.g)}}),Et()),le=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),jf,Yl),Ms=qn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Hn(t,0|t[C],r,!1,!1),e.h==2?Ts(e,yr,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=$n(jn,t))!=null&&t.length){r=Gl(e,r);for(let n=0;n<t.length;n++)Is(e.g,t[n]);Kl(e,r)}}),Yl),kn=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=yr(e.g))===0?void 0:e),!0)}),jf,Yl),Z=Oe((function(e,t,r){return e.h===0&&(Be(t,r,$l(e.g)),!0)}),Vf,Af),An=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=$l(e.g))===!1?void 0:e),!0)}),Vf,Af),Pe=qn((function(e,t,r){return e.h===2&&(e=ql(e),Hn(t,0|t[C],r,!1).push(e),!0)}),(function(e,t,r){if((t=$n(Dn,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&Ps(n,o,Xp(i))}}),Jl),fr=Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=ql(e))===""?void 0:e),!0)}),Hf,Jl),j=Oe((function(e,t,r){return e.h===2&&(Be(t,r,ql(e)),!0)}),Hf,Jl),Se=(function(e,t,r=Xl){return new Wn(e,t,r)})((function(e,t,r,n,o){return e.h===2&&(n=mr(void 0,n,!0),Hn(t,0|t[C],r,!0).push(n),Jo(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)zf(e,t[i],r,n,o)})),z=Rs((function(e,t,r,n,o,i){return e.h===2&&(yf(t,0|t[C],i,r),Jo(e,t=Vl(t,n,r),o),!0)}),zf),qf=Oe((function(e,t,r){return e.h===2&&(Be(t,r,Cf(e)),!0)}),Wf,Pf),lb=qn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Hn(t,0|t[C],r,!1,!1),e.h==2?Ts(e,nr,t):t.push(nr(e.g)),!0)}),(function(e,t,r){if((t=$n(lf,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ze(n,o,0),zn(n.g,i))}}),Tf),hb=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=nr(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=lf(t))!=null&&t!=null&&(Ze(e,r,0),zn(e.g,t))}),Tf),dt=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),(function(e,t,r){(t=jn(t))!=null&&(t=parseInt(t,10),Ze(e,r,0),Is(e.g,t))}),Rf),ll=class{constructor(t,r){this.h=t,this.g=r,this.l=F,this.m=A,this.defaultValue=void 0}};function Ct(e,t){return new ll(e,t)}function Sr(e,t){return(r,n)=>{if(Qi.length){let i=Qi.pop();i.o(n),qc(i.g,r,n),r=i}else r=new class{constructor(i,s){if(Zu.length){let a=Zu.pop();qc(a,i,s),i=a}else i=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,qc(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ba=!1}}(i,s);this.g=i,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({fa:i=!1}={}){this.fa=i}}(r,n);try{let i=new e,s=i.u;rh(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.h=-1,Qi.length<100&&Qi.push(r)}return o}}function Ls(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let s=this.g;return this.g=[],s}}}};Uf(this.u,t,Xr(Ds,Os,Bs,e)),Bn(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,o=n.length,i=0;for(let s=0;s<o;s++){let a=n[s];r.set(a,i),i+=a.length}return t.l=[r],r}}var ip=class extends S{constructor(e){super(e)}},sp=[0,fr,Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=Cf(e))===Kr()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof S){let n=t.Ra;return void(n&&(t=n(t),t!=null&&Ps(e,r,zl(t).buffer)))}if(Array.isArray(t))return}Wf(e,t,r)}),Pf)],Kc,ap=globalThis.trustedTypes;function cp(e){Kc===void 0&&(Kc=(function(){let r=null;if(!ap)return r;try{let n=o=>o;r=ap.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Kc;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function db(e,...t){if(t.length===0)return cp(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return cp(r)}var Gf=[0,le,dt,Z,-1,Ms,dt,-1],ub=class extends S{constructor(e){super(e)}},Kf=[0,Z,j,Z,dt,-1,qn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Hn(t,0|t[C],r,!1,!1),e.h==2?Ts(e,Zy,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=$n(jn,t))!=null&&t.length){r=Gl(e,r);for(let n=0;n<t.length;n++)Is(e.g,t[n]);Kl(e,r)}}),Rf),j,-1,[0,Z,-1],dt,Z,-1],Xf=[0,j,-2],lp=class extends S{constructor(e){super(e)}},Jf=[0],Yf=[0,le,Z,1,Z,-3],Qe=class extends S{constructor(e){super(e,2)}},be={};be[336783863]=[0,j,Z,-1,le,[0,[1,2,3,4,5,6,7,8],z,Jf,z,Kf,z,Xf,z,Yf,z,Gf,z,[0,j,-2],z,[0,j,dt],z,[0,dt,j]],[0,j],Z,[0,[1,3],[2,4],z,[0,Ms],-1,z,[0,Pe],-1,Se,[0,j,-1]],j];var hp=[0,Gc,-1,An,-3,Gc,Ms,fr,kn,Gc,-1,An,kn,An,-2,fr];function et(e,t){ol(e,2,Vn(t),"")}function K(e,t){As(e,3,t)}function L(e,t){As(e,4,t)}var De=class extends S{constructor(e){super(e,500)}o(e){return A(this,0,7,e)}},jo=[-1,{}],dp=[0,j,1,jo],up=[0,j,Pe,jo];function tt(e,t){ps(e,1,De,t)}function Y(e,t){As(e,10,t)}function N(e,t){As(e,15,t)}var ze=class extends S{constructor(e){super(e,500)}o(e){return A(this,0,1001,e)}},Qf=[-500,Se,[-500,fr,-1,Pe,-3,[-2,be,Z],Se,sp,kn,-1,dp,up,Se,[0,fr,An],fr,hp,kn,Pe,987,Pe],4,Se,[-500,j,-1,[-1,{}],998,j],Se,[-500,j,Pe,-1,[-2,{},Z],997,Pe,-1],kn,Se,[-500,j,Pe,jo,998,Pe],Pe,kn,dp,up,Se,[0,fr,-1,jo],Pe,-2,hp,fr,-1,An,[0,An,hb],978,jo,Se,sp];ze.prototype.g=Ls(Qf);var pb=Sr(ze,Qf),fb=class extends S{constructor(e){super(e)}},Zf=class extends S{constructor(e){super(e)}g(){return rr(this,fb,1)}},em=[0,Se,[0,le,ye,j,-1]],Fs=Sr(Zf,em),mb=class extends S{constructor(e){super(e)}},gb=class extends S{constructor(e){super(e)}},Xc=class extends S{constructor(e){super(e)}h(){return F(this,mb,2)}g(){return rr(this,gb,5)}},tm=Sr(class extends S{constructor(e){super(e)}},[0,Pe,Ms,nh,[0,dt,[0,le,-3],[0,ye,-3],[0,le,-1,[0,Se,[0,le,-2]]],Se,[0,ye,-1,j,ye]],j,-1,br,Se,[0,le,ye],Pe,br]),rm=class extends S{constructor(e){super(e)}},Tn=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),nm=class extends S{constructor(e){super(e)}},Yo=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),yb=class extends S{constructor(e){super(e)}},bb=[0,le,-1,nh,dt],om=class extends S{constructor(e){super(e)}};om.prototype.g=Ls([0,ye,-4,br]);var vb=class extends S{constructor(e){super(e)}},wb=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,1,le,j,em],br]),pp=class extends S{constructor(e){super(e)}},_b=class extends S{constructor(e){super(e)}oa(){let e=mf(this);return e??Kr()}},Sb=class extends S{constructor(e){super(e)}},im=[1,2],kb=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,im,z,[0,nh],z,[0,qf],le,j],br]),oh=class extends S{constructor(e){super(e)}},sm=[0,j,le,ye,Pe,-1],fp=class extends S{constructor(e){super(e)}},Eb=[0,Z,-1],mp=class extends S{constructor(e){super(e)}},os=[1,2,3,4,5],gs=class extends S{constructor(e){super(e)}g(){return mf(this)!=null}h(){return ht(this,2)!=null}},ee=class extends S{constructor(e){super(e)}g(){return cf(On(this,2))??!1}},am=[0,qf,j,[0,le,br,-1],[0,cb,br]],fe=[0,am,Z,[0,os,z,Yf,z,Kf,z,Gf,z,Jf,z,Xf],dt],Us=class extends S{constructor(e){super(e)}},ih=[0,fe,ye,-1,le],Cb=Ct(502141897,Us);be[502141897]=ih;var xb=Sr(class extends S{constructor(e){super(e)}},[0,[0,dt,-1,ab,lb],bb]),cm=class extends S{constructor(e){super(e)}},lm=class extends S{constructor(e){super(e)}},sh=[0,fe,ye,[0,fe],Z],hm=[0,fe,ih,sh,ye,[0,[0,am]]],Ab=Ct(508968150,lm);be[508968150]=hm,be[508968149]=sh;var dm=class extends S{constructor(e){super(e)}},Tb=Ct(513916220,dm);be[513916220]=[0,fe,hm,le];var _n=class extends S{constructor(e){super(e)}h(){return F(this,oh,2)}g(){G(this,2)}},um=[0,fe,sm];be[478825465]=um;var Ib=class extends S{constructor(e){super(e)}},pm=class extends S{constructor(e){super(e)}},ah=class extends S{constructor(e){super(e)}},ch=class extends S{constructor(e){super(e)}},fm=class extends S{constructor(e){super(e)}},gp=[0,fe,[0,fe],um,-1],mm=[0,fe,ye,le],lh=[0,fe,ye],gm=[0,fe,mm,lh,ye],Pb=Ct(479097054,fm);be[479097054]=[0,fe,gm,gp],be[463370452]=gp,be[464864288]=mm;var Rb=Ct(462713202,ch);be[462713202]=gm,be[474472470]=lh;var Db=class extends S{constructor(e){super(e)}},ym=class extends S{constructor(e){super(e)}},bm=class extends S{constructor(e){super(e)}},vm=class extends S{constructor(e){super(e)}},hh=[0,fe,ye,-1,le],hl=[0,fe,ye,Z];vm.prototype.g=Ls([0,fe,lh,[0,fe],ih,sh,hh,hl]);var wm=class extends S{constructor(e){super(e)}},Ob=Ct(456383383,wm);be[456383383]=[0,fe,sm];var _m=class extends S{constructor(e){super(e)}},Bb=Ct(476348187,_m);be[476348187]=[0,fe,Eb];var Sm=class extends S{constructor(e){super(e)}},yp=class extends S{constructor(e){super(e)}},km=[0,dt,-1],Mb=Ct(458105876,class extends S{constructor(e){super(e)}g(){var e=this.u;let t=0|e[C],r=2&t;return e=(function(n,o,i){var s=yp;let a=2&o,c=!1;if(i==null){if(a)return Qu();i=[]}else if(i.constructor===lt){if((2&i.L)==0||a)return i;i=i.X()}else Array.isArray(i)?c=!!(2&(0|i[C])):i=[];if(a){if(!i.length)return Qu();c||(c=!0,Nn(i))}else c&&(c=!1,i=gf(i));return c||(64&(0|i[C])?i[C]&=-33:32&o&&vs(i,32)),ne(n,o,2,s=new lt(i,s,Wy,void 0)),s})(e,t,or(e,t,2)),!r&&yp&&(e.ra=!0),e}});be[458105876]=[0,km,sb,[!0,br,[0,j,-1,Pe]]];var dh=class extends S{constructor(e){super(e)}},Em=Ct(458105758,dh);be[458105758]=[0,fe,j,km];var Cm=class extends S{constructor(e){super(e)}},Lb=Ct(443442058,Cm);be[443442058]=[0,fe,j,le,ye,Pe,-1,Z,ye],be[514774813]=hh;var xm=class extends S{constructor(e){super(e)}},Fb=Ct(516587230,xm);function dl(e,t){return t=t?t.clone():new oh,e.displayNamesLocale!==void 0?G(t,1,Vn(e.displayNamesLocale)):e.displayNamesLocale===void 0&&G(t,1),e.maxResults!==void 0?jt(t,2,e.maxResults):"maxResults"in e&&G(t,2),e.scoreThreshold!==void 0?k(t,3,e.scoreThreshold):"scoreThreshold"in e&&G(t,3),e.categoryAllowlist!==void 0?fs(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&G(t,4),e.categoryDenylist!==void 0?fs(t,5,e.categoryDenylist):"categoryDenylist"in e&&G(t,5),t}function uh(e,t=-1,r=""){return{categories:e.map((n=>({index:ct(n,1)??0??-1,score:pe(n,2)??0,categoryName:ht(n,3)??""??"",displayName:ht(n,4)??""??""}))),headIndex:t,headName:r}}function Am(e){var t=$r(e,3,_r,Wr()),r=$r(e,2,jn,Wr()),n=$r(e,1,Dn,Wr()),o=$r(e,9,Dn,Wr());let i={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)i.categories.push({score:t[s],index:r[s]??-1,categoryName:n[s]??"",displayName:o[s]??""});if((t=F(e,Xc,4)?.h())&&(i.boundingBox={originX:ct(t,1)??0,originY:ct(t,2)??0,width:ct(t,3)??0,height:ct(t,4)??0,angle:0}),F(e,Xc,4)?.g().length)for(let s of F(e,Xc,4).g())i.keypoints.push({x:rs(s,1)??0,y:rs(s,2)??0,score:rs(s,4)??0,label:ht(s,3)??""});return i}function Ns(e){let t=[];for(let r of rr(e,nm,1))t.push({x:pe(r,1)??0,y:pe(r,2)??0,z:pe(r,3)??0,visibility:pe(r,4)??0});return t}function Vo(e){let t=[];for(let r of rr(e,rm,1))t.push({x:pe(r,1)??0,y:pe(r,2)??0,z:pe(r,3)??0,visibility:pe(r,4)??0});return t}function bp(e){return Array.from(e,(t=>t>127?t-256:t))}function vp(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,o=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],o+=t[i]*t[i];if(n<=0||o<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*o)}var Zi;be[516587230]=[0,fe,hh,hl,ye],be[518928384]=hl;var Ub=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Tm(){if(Zi===void 0)try{await WebAssembly.instantiate(Ub),Zi=!0}catch{Zi=!1}return Zi}async function Bo(e,t=db``){let r=await Tm()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var ur=class{};function Im(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function wp(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(o=>{n(o)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function Pm(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function E(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function _p(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);let[n,o]=Pm(t);return!e.l||n===e.i.canvas.width&&o===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=o),[n,o]}function Sp(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let o=0;o<t.length;o++)n[o]=e.i.stringToNewUTF8(t[o]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let o of n)e.i._free(o);e.i._free(t)}function Lt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function dr(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(o,i,s)=>{i?(r(n,s),n=[]):n.push(o)}}ur.forVisionTasks=function(e){return Bo("vision",e)},ur.forTextTasks=function(e){return Bo("text",e)},ur.forGenAiExperimentalTasks=function(e){return Bo("genai_experimental",e)},ur.forGenAiTasks=function(e){return Bo("genai",e)},ur.forAudioTasks=function(e){return Bo("audio",e)},ur.isSimdSupported=function(){return Tm()};async function Nb(e,t,r,n){return e=await(async(o,i,s,a,c)=>{if(i&&await wp(i),!self.ModuleFactory||s&&(await wp(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new o(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:o=>o.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&o.endsWith(".data")?r.assetBinaryPath.toString():o}),await e.o(n),e}function Jc(e,t){let r=F(e.baseOptions,gs,1)||new gs;typeof t=="string"?(G(r,2,Vn(t)),G(r,1)):t instanceof Uint8Array&&(G(r,1,Cl(t,!1)),G(r,2)),A(e.baseOptions,0,1,r)}function kp(e){try{let t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map((r=>r.message)).join(", "))}finally{e.G=[]}}function w(e,t){e.B=Math.max(e.B,t)}function js(e,t){e.A=new De,et(e.A,"PassThroughCalculator"),K(e.A,"free_memory"),L(e.A,"free_memory_unused_out"),Y(t,"free_memory"),tt(t,e.A)}function Mn(e,t){K(e.A,t),L(e.A,t+"_unused_out")}function Vs(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var is=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(F(this.baseOptions,gs,1)?.g()||F(this.baseOptions,gs,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,o){let i=F(n.baseOptions,mp,3);if(!i){var s=i=new mp,a=new lp;No(s,4,os,a)}"delegate"in o&&(o.delegate==="GPU"?(o=i,s=new ub,No(o,2,os,s)):(o=i,s=new lp,No(o,4,os,s))),A(n.baseOptions,0,3,i)})(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Jc(this,"/model.dat"),this.m(),this.I()}));if(r.modelAssetBuffer instanceof Uint8Array)Jc(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let o=[];for(var i=0;;){let{done:s,value:a}=await n.read();if(s)break;o.push(a),i+=a.length}if(o.length===0)return new Uint8Array(0);if(o.length===1)return o[0];n=new Uint8Array(i),i=0;for(let s of o)n.set(s,i),i+=s.length;return n})(r.modelAssetBuffer).then((n=>{Jc(this,n),this.m(),this.I()}))}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da((t=>{e=pb(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.G.push(Error(n))})),this.g.La(),this.g.setGraph(e,t),this.A=void 0,kp(this)}finishProcessing(){this.g.finishProcessing(),kp(this)}close(){this.A=void 0,this.g.closeGraph()}};function Re(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}is.prototype.close=is.prototype.close,(function(e,t){e=e.split(".");var r,n=Gr;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",is);var ul=class{constructor(t,r,n,o){this.g=t,this.h=r,this.m=n,this.l=o}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Ep(e,t,r){let n=e.g;if(r=Re(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Cp(e,t){let r=e.g,n=Re(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let o=Re(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let i=Re(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.I),r.vertexAttribPointer(e.I,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new ul(r,n,o,i)}function ph(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Qo(e,t,r,n){return ph(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Cp(e,!0)),r=e.s):(e.v||(e.v=Cp(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function vr(e,t,r){return ph(e,t),e=Re(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),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,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Hs(e,t,r){ph(e,t),e.A||(e.A=Re(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function fh(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Gn=class{G(){return`
7
+ Minimum version required to store current data is: `+o+`.
8
+ `);let s=hw(t,r,i),a=rl.getSymbolSize(t),c=new Q3(a);return ow(c,t),sw(c),aw(c,t),jd(c,r,0),t>=7&&cw(c,t),lw(c,s),isNaN(n)&&(n=Vd.getBestMask(c,jd.bind(null,c,r))),Vd.applyMask(n,c),jd(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:i}}ay.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=Nd.M,i,o;return typeof r<"u"&&(n=Nd.from(r.errorCorrectionLevel,Nd.M),i=tl.from(r.version),o=Vd.from(r.maskPattern),r.toSJISFunc&&rl.setToSJISFunction(r.toSJISFunc)),dw(t,i,n,o)}});var Wd=ve(ii=>{function ly(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(n){return[n,n]}))),t.length===6&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+t.slice(0,6).join("")}}ii.getOptions=function(t){t||(t={}),t.color||(t.color={});let r=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:ly(t.color.dark||"#000000ff"),light:ly(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};ii.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};ii.getImageWidth=function(t,r){let n=ii.getScale(t,r);return Math.floor((t+r.margin*2)*n)};ii.qrToImageData=function(t,r,n){let i=r.modules.size,o=r.modules.data,s=ii.getScale(i,n),a=Math.floor((i+n.margin*2)*s),c=n.margin*s,l=[n.color.light,n.color.dark];for(let h=0;h<a;h++)for(let u=0;u<a;u++){let m=(h*a+u)*4,p=n.color.light;if(h>=c&&u>=c&&h<a-c&&u<a-c){let g=Math.floor((h-c)/s),f=Math.floor((u-c)/s);p=l[o[g*i+f]?1:0]}t[m++]=p.r,t[m++]=p.g,t[m++]=p.b,t[m]=p.a}}});var hy=ve(nl=>{var $d=Wd();function fw(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}function pw(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}nl.render=function(t,r,n){let i=n,o=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(o=pw()),i=$d.getOptions(i);let s=$d.getImageWidth(t.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return $d.qrToImageData(c.data,t,i),fw(a,o,s),a.putImageData(c,0,0),o};nl.renderToDataURL=function(t,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let o=nl.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}});var fy=ve(dy=>{var mw=Wd();function uy(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Gd(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function gw(e,t,r){let n="",i=0,o=!1,s=0;for(let a=0;a<e.length;a++){let c=Math.floor(a%t),l=Math.floor(a/t);!c&&!o&&(o=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=o?Gd("M",c+r,.5+l+r):Gd("m",i,0),i=0,o=!1),c+1<t&&e[a+1]||(n+=Gd("h",s),s=0)):i++}return n}dy.render=function(t,r,n){let i=mw.getOptions(r),o=t.modules.size,s=t.modules.data,a=o+i.margin*2,c=i.color.light.a?"<path "+uy(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+uy(i.color.dark,"stroke")+' d="'+gw(s,o,i.margin)+'"/>',h='viewBox="0 0 '+a+" "+a+'"',m='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+h+' shape-rendering="crispEdges">'+c+l+`</svg>
9
+ `;return typeof n=="function"&&n(null,m),m}});var my=ve(ms=>{var yw=y2(),qd=cy(),py=hy(),bw=fy();function Kd(e,t,r,n,i){let o=[].slice.call(arguments,1),s=o.length,a=typeof o[s-1]=="function";if(!a&&!yw())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(i=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,l){try{let h=qd.create(r,n);c(e(h,t,n))}catch(h){l(h)}})}try{let c=qd.create(r,n);i(null,e(c,t,n))}catch(c){i(c)}}ms.create=qd.create;ms.toCanvas=Kd.bind(null,py.render);ms.toDataURL=Kd.bind(null,py.renderToDataURL);ms.toString=Kd.bind(null,function(e,t,r){return bw.render(e,r)})});async function ys(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function bs(){return new Promise((e,t)=>{let r=window.screen.isExtended;if(r)e(r);else if(navigator.userAgent.indexOf("Firefox")>-1)e(!1);else{let i=[];window.getScreenDetails().then(function(o){i=o,e(i.screens.length>=2)})}})}async function ur(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(i=>!e.some(o=>i.deviceId.includes(o)||i.label.includes(o)));return{cameras:r.filter(i=>i.kind=="videoinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId})),microphones:r.filter(i=>i.kind=="audioinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId}))}}var Nn=typeof self<"u"?self:{};function Ln(){throw Error("Invalid UTF8")}function Yd(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var _s,ul,Cy=typeof TextDecoder<"u",xy,Ay=typeof TextEncoder<"u";function hp(e){if(Ay)e=(xy||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var Wl,Ds;e:{for(dl=["CLOSURE_FLAGS"],vs=Nn,ws=0;ws<dl.length;ws++)if((vs=vs[dl[ws]])==null){Ds=null;break e}Ds=vs}var dl,vs,ws,vo,Zd=Ds&&Ds[610401301];Wl=Zd!=null&&Zd;var Qd=Nn.navigator;function El(e){return!!Wl&&!!vo&&vo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function Kt(e){var t;return(t=Nn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function sn(){return!!Wl&&!!vo&&vo.brands.length>0}function fl(){return sn()?El("Chromium"):(Kt("Chrome")||Kt("CriOS"))&&!(!sn()&&Kt("Edge"))||Kt("Silk")}function $l(e){return $l[" "](e),e}vo=Qd&&Qd.userAgentData||null,$l[" "]=function(){};var Ty=!sn()&&(Kt("Trident")||Kt("MSIE"));!Kt("Android")||fl(),fl(),Kt("Safari")&&(fl()||!sn()&&Kt("Coast")||!sn()&&Kt("Opera")||!sn()&&Kt("Edge")||(sn()?El("Microsoft Edge"):Kt("Edg/"))||sn()&&El("Opera"));var up={},po=null;function Iy(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),u=po[h];if(u!=null)return u;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}dp();let c=0;for(;;){let l=a(-1),h=a(0),u=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|h>>4),u!=64&&(s(h<<4&240|u>>2),m!=64&&s(u<<6&192|m))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function dp(){if(!po){po={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));up[r]=n;for(let i=0;i<n.length;i++){let o=n[i];po[o]===void 0&&(po[o]=i)}}}}var fp=typeof Uint8Array<"u",pp=!Ty&&typeof btoa=="function";function ef(e){if(!pp){var t;t===void 0&&(t=0),dp(),t=up[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var tf=/[-_.]/g,Ry={"-":"+",_:"/",".":"="};function Py(e){return Ry[e]||""}function mp(e){if(!pp)return Iy(e);tf.test(e)&&(e=e.replace(tf,Py)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Co(e){return fp&&e!=null&&e instanceof Uint8Array}var pi={};function zn(){return Dy||=new $r(null,pi)}function Gl(e){gp(pi);var t=e.g;return(t=t==null||Co(t)?t:typeof t=="string"?mp(t):null)==null?t:e.g=t}var $r=class{h(){return new Uint8Array(Gl(this)||0)}constructor(e,t){if(gp(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},Dy,Oy;function gp(e){if(e!==pi)throw Error("illegal external caller")}function yp(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Cl(e){return yp(e=Error(e),"warning"),e}var Vs=typeof Symbol=="function"&&typeof Symbol()=="symbol",By=new Set;function xo(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&By.add(e),e}var Ly=xo("jas",void 0,!0,!0),rf=xo(void 0,"0di"),pl=xo(void 0,"2ex"),ho=xo(void 0,"1oa",!0),mi=xo(void 0,Symbol(),!0),te=Vs?Ly:"Ga",bp={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},_p=Object.defineProperties;function Hs(e,t){Vs||te in e||_p(e,bp),e[te]|=t}function Ze(e,t){Vs||te in e||_p(e,bp),e[te]=t}function Ei(e){return Hs(e,34),e}function Fy(e,t){Ze(t,-30975&(0|e))}function xl(e,t){Ze(t,-30941&(34|e))}function ql(){return typeof BigInt=="function"}function xt(e){return Array.prototype.slice.call(e)}var Kl,Ao={},vp={};function nf(e){return!(!e||typeof e!="object"||e.Ia!==vp)}function Xl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Jl(e,t){if(e!=null){if(typeof e=="string")e=e?new $r(e,pi):zn();else if(e.constructor!==$r)if(Co(e))e=e.length?new $r(new Uint8Array(e),pi):zn();else{if(!t)throw Error();e=void 0}}return e}function Os(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[te]))}var of=[];function fn(e){if(2&e)throw Error()}Ze(of,55),Kl=Object.freeze(of);var Bs=class e{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new e(this.g,this.h,this.m)}};function Yl(e){return mi?e[mi]:void 0}var My=Object.freeze({});function Ws(e){return e.Qa=!0,e}var Uy=Ws((e=>typeof e=="number")),sf=Ws((e=>typeof e=="string")),Ny=Ws((e=>typeof e=="boolean")),$s=typeof Nn.BigInt=="function"&&typeof Nn.BigInt(0)=="bigint",Al=Ws((e=>$s?e>=jy&&e<=Hy:e[0]==="-"?af(e,zy):af(e,Vy))),zy=Number.MIN_SAFE_INTEGER.toString(),jy=$s?BigInt(Number.MIN_SAFE_INTEGER):void 0,Vy=Number.MAX_SAFE_INTEGER.toString(),Hy=$s?BigInt(Number.MAX_SAFE_INTEGER):void 0;function af(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var Wy=typeof Uint8Array.prototype.slice=="function",wp,xe=0,$e=0;function cf(e){let t=e>>>0;xe=t,$e=(e-t)/4294967296>>>0}function gi(e){if(e<0){cf(-e);let[t,r]=th(xe,$e);xe=t>>>0,$e=r>>>0}else cf(e)}function Zl(e){let t=wp||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),$e=0,xe=t.getUint32(0,!0)}function Ql(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:wo(e,t)}function eh(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Ql(e,t))=="number"?r?-e:e:r?"-"+e:e}function wo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else ql()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+lf(r)+lf(e));return r}function lf(e){return e=String(e),"0000000".slice(e.length)+e}function Gs(e){if(e.length<16)gi(Number(e));else if(ql())e=BigInt(e),xe=Number(e&BigInt(4294967295))>>>0,$e=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");$e=xe=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));$e*=1e6,xe=1e6*xe+o,xe>=4294967296&&($e+=Math.trunc(xe/4294967296),$e>>>=0,xe>>>=0)}if(t){let[n,i]=th(xe,$e);xe=n,$e=i}}}function th(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var rh=typeof BigInt=="function"?BigInt.asIntN:void 0,$y=typeof BigInt=="function"?BigInt.asUintN:void 0,li=Number.isSafeInteger,qs=Number.isFinite,Ls=Math.trunc;function pn(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Sp(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var Gy=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ks(e){switch(typeof e){case"bigint":return!0;case"number":return qs(e);case"string":return Gy.test(e);default:return!1}}function Ci(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return qs(e)?0|e:void 0}function kp(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return qs(e)?e>>>0:void 0}function hf(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function nh(e){return e=Ls(e),li(e)||(gi(e),e=eh(xe,$e)),e}function ih(e){var t=Ls(Number(e));if(li(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(Gs(e),e=xe,2147483648&(t=$e))if(ql())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=th(e,t);e="-"+wo(r,n)}else e=wo(e,t);return e}function Fs(e){return e==null?e:typeof e=="bigint"?(Al(e)?e=Number(e):(e=rh(64,e),e=Al(e)?Number(e):String(e)),e):Ks(e)?typeof e=="number"?nh(e):ih(e):void 0}function qy(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String($y(64,e));if(Ks(e)){if(t==="string")return t=Ls(Number(e)),li(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),hf(e)||(Gs(e),e=wo(xe,$e))),e;if(t==="number")return(e=Ls(e))>=0&&li(e)?e:(function(r){if(r<0){gi(r);var n=wo(xe,$e);return r=Number(n),li(r)?r:n}return hf(n=String(r))?n:(gi(r),Ql(xe,$e))})(e)}}function Ep(e){if(typeof e!="string")throw Error();return e}function xi(e){if(e!=null&&typeof e!="string")throw Error();return e}function yi(e){return e==null||typeof e=="string"?e:void 0}function oh(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===Ao)return e;if(!Array.isArray(e))return r?2&n?((e=t[rf])||(Ei((e=new t).u),e=t[rf]=e),t=e):t=new t:t=void 0,t;let i=r=0|e[te];return i===0&&(i|=32&n),i|=2&n,i!==r&&Ze(e,i),new t(e)}function Ky(e,t,r){if(t)e:{if(!Ks(t=e))throw Cl("int64");switch(typeof t){case"string":t=ih(t);break e;case"bigint":if(e=t=rh(64,t),sf(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Uy(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=$s?BigInt(t):Ny(t)?t?"1":"0":sf(t)?t.trim()||"0":String(t);break e;default:t=nh(t)}}else t=Fs(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&li(t=+r)?t:r}var Xy={},Jy=(function(){try{return $l(new class extends Map{constructor(){super()}}),!1}catch{return!0}})(),go=class{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}},Yy=Jy?(Object.setPrototypeOf(go.prototype,Map.prototype),Object.defineProperties(go.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),go):class extends Map{constructor(){super()}};function uf(e){return e}function ml(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var Jt=class extends Yy{constructor(e,t,r=uf,n=uf){super();let i=0|e[te];i|=64,Ze(e,i),this.L=i,this.S=t,this.R=r,this.Y=this.S?Zy:n;for(let o=0;o<e.length;o++){let s=e[o],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=n(s[1],!1,!0,void 0,void 0,i),super.set(a,c)}}na(e=df){if(this.size!==0)return this.X(e)}X(e=df){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){ml(this),super.clear()}delete(e){return ml(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new Bs(e,Qy,this)}keys(){return this.Ha()}values(){var e=this.ma();return new Bs(e,Jt.prototype.get,this)}forEach(e,t){super.forEach(((r,n)=>{e.call(t,this.get(n),n,this)}))}set(e,t){return ml(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.S,!1,this.L))}Na(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.S?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.L),super.set(t,e)}has(e){return super.has(this.R(e,!1,!1))}get(e){e=this.R(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.S;return r?((r=this.Y(t,!1,!0,r,this.ra,this.L))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function Zy(e,t,r,n,i,o){return e=oh(e,n,r,o),i&&(e=Js(e)),e}function df(e){return e}function Qy(e){return[e,this.get(e)]}var eb,Cp,tb;function ff(){return eb||=new Jt(Ei([]),void 0,void 0,void 0,Xy)}function sh(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=Os(e)?void 0:i&&2&(0|e[te])?e:ah(e,t,r,n!==void 0,i);else if(Xl(e)){let o={};for(let s in e)o[s]=sh(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function ah(e,t,r,n,i){let o=n||r?0|e[te]:0,s=n?!!(32&o):void 0;n=xt(e);for(let a=0;a<n.length;a++)n[a]=sh(n[a],t,r,s,i);return r&&((e=Yl(e))&&(n[mi]=xt(e)),r(o,n)),n}function rb(e){return sh(e,xp,void 0,void 0,!1)}function xp(e){return e.W===Ao?e.toJSON():e instanceof Jt?e.na(rb):(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Al(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Os(t))return}else{if(Co(t))return ef(t);if(t instanceof $r){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=ef(r)}if(t instanceof Jt)return t.na()}}return t})(e)}function Ap(e){return ah(e,xp,void 0,void 0,!1)}function cn(e,t,r){return e=Tp(e,t[0],t[1],r?1:2),t!==Cp&&r&&Hs(e,16384),e}function Tp(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[te]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Xl(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return Ze(e,i),e}function Tl(e,t,r=xl){if(e!=null){if(fp&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[te];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(Ze(e,-12293&(34|n)),e):ah(e,Tl,4&n?xl:r,!0,!0))}return e.W===Ao?e=2&(n=0|(r=e.u)[te])?e:new e.constructor(Xs(r,n,!0)):e instanceof Jt&&!(2&e.L)&&(r=Ei(e.X(Tl)),e=new Jt(r,e.S,e.R,e.Y)),e}}function Xs(e,t,r){let n=r||2&t?xl:Fy,i=!!(32&t);return e=(function(o,s,a){let c=xt(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let u in h)s[u]=a(h[u])}return(o=Yl(o))&&(c[mi]=xt(o)),c})(e,t,(o=>Tl(o,i,n))),Hs(e,32|(r?2:0)),e}function Js(e){let t=e.u,r=0|t[te];return 2&r?new e.constructor(Xs(t,r,!1)):e}function bi(e,t){return Xr(e=e.u,0|e[te],t)}function Xr(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&pl!=null&&((i=(e=Oy??={})[pl]||0)>=4||(e[pl]=i+1,yp(e=Error(),"incident"),(function(s){Nn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function Te(e,t,r){let n=e.u,i=0|n[te];return fn(i),je(n,i,t,r),e}function je(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},Ze(e,t|=256)):e[o]=n),t)}function xs(e,t){let r=0|(e=e.u)[te],n=Xr(e,r,t),i=pn(n);return i!=null&&i!==n&&je(e,r,t,i),i}function Ip(e){let t=0|(e=e.u)[te],r=Xr(e,t,1),n=Jl(r,!0);return n!=null&&n!==r&&je(e,t,1,n),n}function Fn(){return My===void 0?2:4}function Mn(e,t,r,n,i){let o=e.u,s=2&(e=0|o[te])?1:n;i=!!i;let a=0|(n=ch(o,e,t))[te];if(!(4&a)){4&a&&(n=xt(n),a=Gr(a,e),e=je(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=lh(a,e),r=-4097&(20|a),a=r&=-8193,Ze(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Wr(a)||(i=a,a|=2,a!==i&&Ze(n,a),Object.freeze(n)):(s===2&&Wr(a)&&(n=xt(n),a=Gr(a,e),a=ln(a,e,i),Ze(n,a),e=je(o,e,t,n)),Wr(a)||(t=a,a=ln(a,e,i),a!==t&&Ze(n,a))),n}function ch(e,t,r,n){return e=Xr(e,t,r,n),Array.isArray(e)?e:Kl}function lh(e,t){return e===0&&(e=Gr(e,t)),1|e}function Wr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Rp(e){e=xt(e);for(let t=0;t<e.length;t++){let r=e[t]=xt(e[t]);Array.isArray(r[1])&&(r[1]=Ei(r[1]))}return e}function Il(e,t,r,n){let i=0|(e=e.u)[te];fn(i),je(e,i,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Ai(e,t,r,n,i){fn(t);var o=!(!(64&t)&&16384&t);let s=(i=ch(e,t,r,i))!==Kl;if(o||!s){let a=o=s?0|i[te]:0;(!s||2&a||Wr(a)||4&a&&!(32&a))&&(i=xt(i),a=Gr(a,t),t=je(e,t,r,i)),a=-13&lh(a,t),a=ln(n?-17&a:16|a,t,!0),a!==o&&Ze(i,a)}return i}function gl(e,t){var r=_m;return uh(hh(e=e.u),e,0|e[te],r)===t?t:-1}function hh(e){if(Vs)return e[ho]??(e[ho]=new Map);if(ho in e)return e[ho];let t=new Map;return Object.defineProperty(e,ho,{value:t}),t}function Pp(e,t,r,n){let i=hh(e),o=uh(i,e,t,r);return o!==n&&(o&&(t=je(e,t,o)),i.set(r,n)),t}function uh(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Xr(t,r,s)!=null&&(i!==0&&(r=je(t,r,i)),i=s)}return e.set(n,i),i}function dh(e,t,r,n){let i,o=0|e[te];if((n=Xr(e,o,r,n))!=null&&n.W===Ao)return(t=Js(n))!==n&&je(e,o,r,t),t.u;if(Array.isArray(n)){let s=0|n[te];i=2&s?cn(Xs(n,s,!1),t,!0):64&s?n:cn(i,t,!0)}else i=cn(void 0,t,!0);return i!==n&&je(e,o,r,i),i}function Dp(e,t,r,n){let i=0|(e=e.u)[te];return(t=oh(n=Xr(e,i,r,n),t,!1,i))!==n&&t!=null&&je(e,i,r,t),t}function be(e,t,r,n=!1){if((t=Dp(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[te]))){let i=Js(t);i!==t&&je(e,n,r,t=i)}return t}function Op(e,t,r,n,i,o,s){e=e.u;var a=!!(2&t);let c=a?1:i;o=!!o,s&&=!a;var l=0|(i=ch(e,t,n))[te];if(!(a=!!(4&l))){var h=i,u=t;let m=!!(2&(l=lh(l,t)));m&&(u|=2);let p=!m,g=!0,f=0,b=0;for(;f<h.length;f++){let _=oh(h[f],r,!1,u);if(_ instanceof r){if(!m){let k=!!(2&(0|_.u[te]));p&&=!k,g&&=k}h[b++]=_}}b<f&&(h.length=b),l|=4,l=g?16|l:-17&l,Ze(h,l=p?8|l:-9&l),m&&Object.freeze(h)}if(s&&!(8&l||!i.length&&(c===1||c===4&&32&l))){for(Wr(l)&&(i=xt(i),l=Gr(l,t),t=je(e,t,n,i)),r=i,s=l,h=0;h<r.length;h++)(l=r[h])!==(u=Js(l))&&(r[h]=u);s|=8,Ze(r,s=r.length?-17&s:16|s),l=s}return c===1||c===4&&32&l?Wr(l)||(t=l,(l|=!i.length||16&l&&(!a||32&l)?2:2048)!==t&&Ze(i,l),Object.freeze(i)):(c===2&&Wr(l)&&(Ze(i=xt(i),l=ln(l=Gr(l,t),t,o)),t=je(e,t,n,i)),Wr(l)||(n=l,(l=ln(l,t,o))!==n&&Ze(i,l))),i}function qr(e,t,r){let n=0|e.u[te];return Op(e,n,t,r,Fn(),!1,!(2&n))}function ne(e,t,r,n){return n==null&&(n=void 0),Te(e,r,n)}function yo(e,t,r,n){n==null&&(n=void 0);e:{let i=0|(e=e.u)[te];if(fn(i),n==null){let o=hh(e);if(uh(o,e,i,r)!==t)break e;o.set(r,0)}else i=Pp(e,i,r,t);je(e,i,t,n)}}function Gr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function ln(e,t,r){return 32&t&&r||(e&=-33),e}function Ms(e,t,r,n){let i=0|e.u[te];fn(i),e=Op(e,i,r,t,2,!0),n=n??new r,e.push(n),e[te]=2&(0|n.u[te])?-9&e[te]:-17&e[te]}function Xt(e,t){return Ci(bi(e,t))}function Yt(e,t){return yi(bi(e,t))}function Xe(e,t){return xs(e,t)??0}function So(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);Te(e,t,r)}function Dr(e,t,r){if(r!=null){if(typeof r!="number"||!qs(r))throw Cl("int32");r|=0}Te(e,t,r)}function Y(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Te(e,t,r)}function Us(e,t,r){{let s=e.u,a=0|s[te];if(fn(a),r==null)je(s,a,t);else{var n=e=0|r[te],i=Wr(e),o=i||Object.isFrozen(r);for(i||(e=0),o||(r=xt(r),n=0,e=ln(e=Gr(e,a),a,!0),o=!1),e|=21,i=0;i<r.length;i++){let c=r[i],l=Ep(c);Object.is(c,l)||(o&&(r=xt(r),n=0,e=ln(e=Gr(e,a),a,!0),o=!1),r[i]=l)}e!==n&&(o&&(r=xt(r),e=ln(e=Gr(e,a),a,!0)),Ze(r,e)),je(s,a,t,r)}}}function Ys(e,t,r){fn(0|e.u[te]),Mn(e,t,yi,2,!0).push(Ep(r))}function Bp(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function fh(){return Error("Failed to read varint, encoding is invalid.")}function Lp(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function ph(e){if(typeof e=="string")return{buffer:mp(e),N:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Uint8Array)return{buffer:e,N:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),N:!1};if(e.constructor===$r)return{buffer:Gl(e)||new Uint8Array(0),N:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),N:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function mh(e,t){let r,n=0,i=0,o=0,s=e.h,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(Un(e,a),r<128)return t(n>>>0,i>>>0);throw fh()}function gh(e){let t=0,r=e.g,n=r+10,i=e.h;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return Un(e,r),!!(127&t)}throw fh()}function hn(e){let t=e.h,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw fh();return Un(e,r),i}function Kr(e){return hn(e)>>>0}function Rl(e){var t=e.h;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],Un(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Pl(e){var t=Rl(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function nb(e){return hn(e)}function yl(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=ph(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function Un(e,t){if(e.g=t,t>e.l)throw Lp(e.l,t)}function Fp(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw Lp(t,e.l-r);return e.g=n,r}function Mp(e,t){if(t==0)return zn();var r=Fp(e,t);return e.ba&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):Wy?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?zn():new $r(r,pi)}Jt.prototype.toJSON=void 0,Jt.prototype.Ia=vp;var pf=[];function Up(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=Kr(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw Bp(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function As(e){switch(e.h){case 0:e.h!=0?As(e):gh(e.g);break;case 1:Un(e=e.g,e.g+8);break;case 2:if(e.h!=2)As(e);else{var t=Kr(e.g);Un(e=e.g,e.g+t)}break;case 5:Un(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Up(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}As(e)}break;default:throw Bp(e.h,e.l)}}function To(e,t,r){let n=e.g.l,i=Kr(e.g),o=e.g.g+i,s=o-n;if(s<=0&&(e.g.l=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=o,e.g.l=n,t}function yh(e){var t=Kr(e.g),r=Fp(e=e.g,t);if(e=e.h,Cy){var n,i=e;(n=ul)||(n=ul=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(_s===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),_s=!0}catch{_s=!1}}throw!_s&&(ul=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?Ln():(a=e[o++],s<194||(192&a)!=128?(o--,Ln()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?Ln():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,Ln()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?Ln():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,Ln()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Ln(),r.length>=8192&&(c=Yd(c,r),r.length=0)}o=Yd(c,r)}return o}function Np(e){let t=Kr(e.g);return Mp(e.g,t)}function Zs(e,t,r){var n=Kr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Ss=[];function ib(e){return e}var hi;function dr(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var J=class{constructor(e,t){this.u=Tp(e,t)}toJSON(){let e=!hi;try{return e&&(hi=Ap),zp(this)}finally{e&&(hi=void 0)}}l(){var e=Nb;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.u;return new this.constructor(Xs(e,0|e[te],!1))}N(){return!!(2&(0|this.u[te]))}};function zp(e){var t=e.u;{t=(e=hi(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Xl(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(Os(n)||nf(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||Os(o)||nf(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function mf(e){return e?/^\d+$/.test(e)?(Gs(e),new Dl(xe,$e)):null:ob||=new Dl(0,0)}J.prototype.W=Ao,J.prototype.toString=function(){try{return hi=ib,zp(this).toString()}finally{hi=void 0}};var Dl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},ob;function gf(e){return e?/^-?\d+$/.test(e)?(Gs(e),new Ol(xe,$e)):null:sb||=new Ol(0,0)}var Ol=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},sb;function ui(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function Ti(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Qs(e,t){if(t>=0)Ti(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ko(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function _i(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function zt(e,t,r){Ti(e.g,8*t+r)}function bh(e,t){return zt(e,t,2),t=e.g.end(),_i(e,t),t.push(e.h),t}function _h(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function ea(e,t,r){zt(e,t,2),Ti(e.g,r.length),_i(e,e.g.end()),_i(e,r)}function Ns(e,t,r,n){r!=null&&(t=bh(e,t),n(r,e),_h(e,t))}function fr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var vh=fr(),jp=fr(),wh=fr(),Sh=fr(),Vp=fr(),Hp=fr(),kh=fr(),Wp=fr(),$p=fr(),Ii=class{constructor(e,t,r){this.g=e,this.h=t,e=vh,this.l=!!e&&r===e||!1}};function ta(e,t){return new Ii(e,t,vh)}function Gp(e,t,r,n,i){Ns(e,r,Jp(t,n),i)}var ab=ta((function(e,t,r,n,i){return e.h===2&&(To(e,dh(t,n,r),i),!0)}),Gp),cb=ta((function(e,t,r,n,i){return e.h===2&&(To(e,dh(t,n,r,!0),i),!0)}),Gp),ra=Symbol(),Eh=Symbol(),yf=Symbol(),bf=Symbol(),qp,Kp;function jn(e,t,r,n){var i=n[e];if(i)return i;(i={}).Pa=n,i.V=(function(u){switch(typeof u){case"boolean":return Cp||=[0,void 0,!0];case"number":return u>0?void 0:u===0?tb||=[0,void 0]:[-u,void 0];case"string":return[0,u];case"object":return u}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.ga=o,typeof(o=n[++s])=="function"&&(i.la=!0,qp??=o,Kp??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let u;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof Ii?u=o:(u=ab,s--),u?.l){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let m=a[c];l?r(i,c,u,l,m):t(i,c,u,m)}}return n[e]=i}function Xp(e){return Array.isArray(e)?e[0]instanceof Ii?e:[cb,e]:[e,void 0]}function Jp(e,t){return e instanceof J?e.u:Array.isArray(e)?cn(e,t,!1):void 0}function Ch(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function xh(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=jn(Eh,Ch,xh,n).V,s||=Ah(n),i)}function Ah(e){let t=e[yf];if(t!=null)return t;let r=jn(Eh,Ch,xh,e);return t=r.la?(n,i)=>qp(n,i,r):(n,i)=>{let o=0|n[te];for(;Up(i)&&i.h!=4;){var s=i.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=lb(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).l,As(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=Mp(a.g,c)),s=n,a&&((c=s[mi])?c.push(a):s[mi]=[a]))}return 16384&o&&Ei(n),!0},e[yf]=t}function lb(e){let t=(e=Xp(e))[0].g;if(e=e[1]){let r=Ah(e),n=jn(Eh,Ch,xh,e).V;return(i,o,s)=>t(i,o,s,n,r)}return t}function na(e,t,r){e[t]=r.h}function ia(e,t,r,n){let i,o,s=r.h;e[t]=(a,c,l)=>s(a,c,l,o||=jn(ra,na,ia,n).V,i||=Yp(n))}function Yp(e){let t=e[bf];if(!t){let r=jn(ra,na,ia,e);t=(n,i)=>Zp(n,i,r),e[bf]=t}return t}function Zp(e,t,r){for(var n=0|e[te],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=_f(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=_f(r,i))&&a(t,o,i)}if(e=Yl(e))for(_i(t,t.g.end()),r=0;r<e.length;r++)_i(t,Gl(e[r])||new Uint8Array(0))}function _f(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=Xp(r))[0].h;if(r=r[1]){let i=Yp(r),o=jn(ra,na,ia,r).V;r=e.la?Kp(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Ri(e,t){if(Array.isArray(t)){var r=0|t[te];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),Ze(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function bt(e,t,r){return new Ii(e,t,r)}function Pi(e,t,r){return new Ii(e,t,r)}function _t(e,t,r){je(e,0|e[te],t,r)}var hb=ta((function(e,t,r,n,i){return e.h===2&&(e=To(e,cn([void 0,void 0],n,!0),i),fn(n=0|t[te]),(i=Xr(t,n,r))instanceof Jt?(2&i.L)!=0?((i=i.X()).push(e),je(t,n,r,i)):i.Na(e):Array.isArray(i)?(2&(0|i[te])&&je(t,n,r,i=Rp(i)),i.push(e)):je(t,n,r,[e]),!0)}),(function(e,t,r,n,i){if(t instanceof Jt)t.forEach(((o,s)=>{Ns(e,r,cn([s,o],n,!1),i)}));else if(Array.isArray(t))for(let o=0;o<t.length;o++){let s=t[o];Array.isArray(s)&&Ns(e,r,cn(s,n,!1),i)}}));function Qp(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(rh(64,n));if(Ks(n)){if(i==="string")return ih(n);if(i==="number")return nh(n)}})(t),t!=null&&(typeof t=="string"&&gf(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,gi(t),ui(e,xe,$e);break;case"bigint":r=BigInt.asUintN(64,t),r=new Ol(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ui(e.g,r.h,r.g);break;default:r=gf(t),ui(e.g,r.h,r.g)}}function em(e,t,r){(t=Ci(t))!=null&&t!=null&&(zt(e,r,0),Qs(e.g,t))}function tm(e,t,r){(t=Sp(t))!=null&&(zt(e,r,0),e.g.g.push(t?1:0))}function rm(e,t,r){(t=yi(t))!=null&&ea(e,r,hp(t))}function nm(e,t,r,n,i){Ns(e,r,Jp(t,n),i)}function im(e,t,r){(t=t==null||typeof t=="string"||Co(t)||t instanceof $r?t:void 0)!=null&&ea(e,r,ph(t).buffer)}function om(e,t,r){return(e.h===5||e.h===2)&&(t=Ai(t,0|t[te],r,!1,!1),e.h==2?Zs(e,Pl,t):t.push(Pl(e.g)),!0)}var Vr=bt((function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=Rl(n);let i=Rl(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,_t(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=pn(t))!=null&&(zt(e,r,1),e=e.g,(r=wp||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),xe=r.getUint32(0,!0),$e=r.getUint32(4,!0),ko(e,xe),ko(e,$e))}),fr()),Qe=bt((function(e,t,r){return e.h===5&&(_t(t,r,Pl(e.g)),!0)}),(function(e,t,r){(t=pn(t))!=null&&(zt(e,r,5),e=e.g,Zl(t),ko(e,xe))}),kh),ub=Pi(om,(function(e,t,r){if((t=Ri(pn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,5),n=n.g,Zl(o),ko(n,xe))}}),kh),Th=Pi(om,(function(e,t,r){if((t=Ri(pn,t))!=null&&t.length){zt(e,r,2),Ti(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Zl(t[n]),ko(r,xe)}}),kh),un=bt((function(e,t,r){return e.h===0&&(_t(t,r,mh(e.g,eh)),!0)}),Qp,Hp),bl=bt((function(e,t,r){return e.h===0&&(_t(t,r,(e=mh(e.g,eh))===0?void 0:e),!0)}),Qp,Hp),db=bt((function(e,t,r){return e.h===0&&(_t(t,r,mh(e.g,Ql)),!0)}),(function(e,t,r){if((t=qy(t))!=null&&(typeof t=="string"&&mf(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,gi(t),ui(e,xe,$e);break;case"bigint":r=BigInt.asUintN(64,t),r=new Dl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ui(e.g,r.h,r.g);break;default:r=mf(t),ui(e.g,r.h,r.g)}}),fr()),Ge=bt((function(e,t,r){return e.h===0&&(_t(t,r,hn(e.g)),!0)}),em,Sh),oa=Pi((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ai(t,0|t[te],r,!1,!1),e.h==2?Zs(e,hn,t):t.push(hn(e.g)),!0)}),(function(e,t,r){if((t=Ri(Ci,t))!=null&&t.length){r=bh(e,r);for(let n=0;n<t.length;n++)Qs(e.g,t[n]);_h(e,r)}}),Sh),ci=bt((function(e,t,r){return e.h===0&&(_t(t,r,(e=hn(e.g))===0?void 0:e),!0)}),em,Sh),Me=bt((function(e,t,r){return e.h===0&&(_t(t,r,gh(e.g)),!0)}),tm,jp),di=bt((function(e,t,r){return e.h===0&&(_t(t,r,(e=gh(e.g))===!1?void 0:e),!0)}),tm,jp),mt=Pi((function(e,t,r){return e.h===2&&(e=yh(e),Ai(t,0|t[te],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ri(yi,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&ea(n,i,hp(o))}}),wh),an=bt((function(e,t,r){return e.h===2&&(_t(t,r,(e=yh(e))===""?void 0:e),!0)}),rm,wh),we=bt((function(e,t,r){return e.h===2&&(_t(t,r,yh(e)),!0)}),rm,wh),ot=(function(e,t,r=vh){return new Ii(e,t,r)})((function(e,t,r,n,i){return e.h===2&&(n=cn(void 0,n,!0),Ai(t,0|t[te],r,!0).push(n),To(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)nm(e,t[o],r,n,i)})),ke=ta((function(e,t,r,n,i,o){return e.h===2&&(Pp(t,0|t[te],o,r),To(e,t=dh(t,n,r),i),!0)}),nm),sm=bt((function(e,t,r){return e.h===2&&(_t(t,r,Np(e)),!0)}),im,Wp),fb=Pi((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ai(t,0|t[te],r,!1,!1),e.h==2?Zs(e,Kr,t):t.push(Kr(e.g)),!0)}),(function(e,t,r){if((t=Ri(kp,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,0),Ti(n.g,o))}}),Vp),pb=bt((function(e,t,r){return e.h===0&&(_t(t,r,(e=Kr(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=kp(t))!=null&&t!=null&&(zt(e,r,0),Ti(e.g,t))}),Vp),Zt=bt((function(e,t,r){return e.h===0&&(_t(t,r,hn(e.g)),!0)}),(function(e,t,r){(t=Ci(t))!=null&&(t=parseInt(t,10),zt(e,r,0),Qs(e.g,t))}),$p),Bl=class{constructor(t,r){this.h=t,this.g=r,this.l=be,this.m=ne,this.defaultValue=void 0}};function pr(e,t){return new Bl(e,t)}function mn(e,t){return(r,n)=>{if(Ss.length){let o=Ss.pop();o.o(n),yl(o.g,r,n),r=o}else r=new class{constructor(o,s){if(pf.length){let a=pf.pop();yl(a,o,s),o=a}else o=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,yl(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ba=!1}}(o,s);this.g=o,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({fa:o=!1}={}){this.fa=o}}(r,n);try{let o=new e,s=o.u;Ah(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.h=-1,Ss.length<100&&Ss.push(r)}return i}}function sa(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let s=this.g;return this.g=[],s}}}};Zp(this.u,t,jn(ra,na,ia,e)),_i(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,i=n.length,o=0;for(let s=0;s<i;s++){let a=n[s];r.set(a,o),o+=a.length}return t.l=[r],r}}var vf=class extends J{constructor(e){super(e)}},wf=[0,an,bt((function(e,t,r){return e.h===2&&(_t(t,r,(e=Np(e))===zn()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof J){let n=t.Ra;return void(n&&(t=n(t),t!=null&&ea(e,r,ph(t).buffer)))}if(Array.isArray(t))return}im(e,t,r)}),Wp)],_l,Sf=globalThis.trustedTypes;function kf(e){_l===void 0&&(_l=(function(){let r=null;if(!Sf)return r;try{let n=i=>i;r=Sf.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=_l;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function mb(e,...t){if(t.length===0)return kf(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return kf(r)}var am=[0,Ge,Zt,Me,-1,oa,Zt,-1],gb=class extends J{constructor(e){super(e)}},cm=[0,Me,we,Me,Zt,-1,Pi((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ai(t,0|t[te],r,!1,!1),e.h==2?Zs(e,nb,t):t.push(hn(e.g)),!0)}),(function(e,t,r){if((t=Ri(Ci,t))!=null&&t.length){r=bh(e,r);for(let n=0;n<t.length;n++)Qs(e.g,t[n]);_h(e,r)}}),$p),we,-1,[0,Me,-1],Zt,Me,-1],lm=[0,we,-2],Ef=class extends J{constructor(e){super(e)}},hm=[0],um=[0,Ge,Me,1,Me,-3],Nt=class extends J{constructor(e){super(e,2)}},et={};et[336783863]=[0,we,Me,-1,Ge,[0,[1,2,3,4,5,6,7,8],ke,hm,ke,cm,ke,lm,ke,um,ke,am,ke,[0,we,-2],ke,[0,we,Zt],ke,[0,Zt,we]],[0,we],Me,[0,[1,3],[2,4],ke,[0,oa],-1,ke,[0,mt],-1,ot,[0,we,-1]],we];var Cf=[0,bl,-1,di,-3,bl,oa,an,ci,bl,-1,di,ci,di,-2,an];function jt(e,t){Il(e,2,xi(t),"")}function Ie(e,t){Ys(e,3,t)}function me(e,t){Ys(e,4,t)}var yt=class extends J{constructor(e){super(e,500)}o(e){return ne(this,0,7,e)}},bo=[-1,{}],xf=[0,we,1,bo],Af=[0,we,mt,bo];function Vt(e,t){Ms(e,1,yt,t)}function Oe(e,t){Ys(e,10,t)}function _e(e,t){Ys(e,15,t)}var Tt=class extends J{constructor(e){super(e,500)}o(e){return ne(this,0,1001,e)}},dm=[-500,ot,[-500,an,-1,mt,-3,[-2,et,Me],ot,wf,ci,-1,xf,Af,ot,[0,an,di],an,Cf,ci,mt,987,mt],4,ot,[-500,we,-1,[-1,{}],998,we],ot,[-500,we,mt,-1,[-2,{},Me],997,mt,-1],ci,ot,[-500,we,mt,bo,998,mt],mt,ci,xf,Af,ot,[0,an,-1,bo],mt,-2,Cf,an,-1,di,[0,di,pb],978,bo,ot,wf];Tt.prototype.g=sa(dm);var yb=mn(Tt,dm),bb=class extends J{constructor(e){super(e)}},fm=class extends J{constructor(e){super(e)}g(){return qr(this,bb,1)}},pm=[0,ot,[0,Ge,Qe,we,-1]],aa=mn(fm,pm),_b=class extends J{constructor(e){super(e)}},vb=class extends J{constructor(e){super(e)}},vl=class extends J{constructor(e){super(e)}h(){return be(this,_b,2)}g(){return qr(this,vb,5)}},mm=mn(class extends J{constructor(e){super(e)}},[0,mt,oa,Th,[0,Zt,[0,Ge,-3],[0,Qe,-3],[0,Ge,-1,[0,ot,[0,Ge,-2]]],ot,[0,Qe,-1,we,Qe]],we,-1,un,ot,[0,Ge,Qe],mt,un]),gm=class extends J{constructor(e){super(e)}},fi=mn(class extends J{constructor(e){super(e)}},[0,ot,[0,Qe,-4]]),ym=class extends J{constructor(e){super(e)}},Io=mn(class extends J{constructor(e){super(e)}},[0,ot,[0,Qe,-4]]),wb=class extends J{constructor(e){super(e)}},Sb=[0,Ge,-1,Th,Zt],bm=class extends J{constructor(e){super(e)}};bm.prototype.g=sa([0,Qe,-4,un]);var kb=class extends J{constructor(e){super(e)}},Eb=mn(class extends J{constructor(e){super(e)}},[0,ot,[0,1,Ge,we,pm],un]),Tf=class extends J{constructor(e){super(e)}},Cb=class extends J{constructor(e){super(e)}oa(){let e=Ip(this);return e??zn()}},xb=class extends J{constructor(e){super(e)}},_m=[1,2],Ab=mn(class extends J{constructor(e){super(e)}},[0,ot,[0,_m,ke,[0,Th],ke,[0,sm],Ge,we],un]),Ih=class extends J{constructor(e){super(e)}},vm=[0,we,Ge,Qe,mt,-1],If=class extends J{constructor(e){super(e)}},Tb=[0,Me,-1],Rf=class extends J{constructor(e){super(e)}},Ts=[1,2,3,4,5],zs=class extends J{constructor(e){super(e)}g(){return Ip(this)!=null}h(){return Yt(this,2)!=null}},Ue=class extends J{constructor(e){super(e)}g(){return Sp(bi(this,2))??!1}},wm=[0,sm,we,[0,Ge,un,-1],[0,db,un]],Je=[0,wm,Me,[0,Ts,ke,um,ke,cm,ke,am,ke,hm,ke,lm],Zt],ca=class extends J{constructor(e){super(e)}},Rh=[0,Je,Qe,-1,Ge],Ib=pr(502141897,ca);et[502141897]=Rh;var Rb=mn(class extends J{constructor(e){super(e)}},[0,[0,Zt,-1,ub,fb],Sb]),Sm=class extends J{constructor(e){super(e)}},km=class extends J{constructor(e){super(e)}},Ph=[0,Je,Qe,[0,Je],Me],Em=[0,Je,Rh,Ph,Qe,[0,[0,wm]]],Pb=pr(508968150,km);et[508968150]=Em,et[508968149]=Ph;var Cm=class extends J{constructor(e){super(e)}},Db=pr(513916220,Cm);et[513916220]=[0,Je,Em,Ge];var si=class extends J{constructor(e){super(e)}h(){return be(this,Ih,2)}g(){Te(this,2)}},xm=[0,Je,vm];et[478825465]=xm;var Ob=class extends J{constructor(e){super(e)}},Am=class extends J{constructor(e){super(e)}},Dh=class extends J{constructor(e){super(e)}},Oh=class extends J{constructor(e){super(e)}},Tm=class extends J{constructor(e){super(e)}},Pf=[0,Je,[0,Je],xm,-1],Im=[0,Je,Qe,Ge],Bh=[0,Je,Qe],Rm=[0,Je,Im,Bh,Qe],Bb=pr(479097054,Tm);et[479097054]=[0,Je,Rm,Pf],et[463370452]=Pf,et[464864288]=Im;var Lb=pr(462713202,Oh);et[462713202]=Rm,et[474472470]=Bh;var Fb=class extends J{constructor(e){super(e)}},Pm=class extends J{constructor(e){super(e)}},Dm=class extends J{constructor(e){super(e)}},Om=class extends J{constructor(e){super(e)}},Lh=[0,Je,Qe,-1,Ge],Ll=[0,Je,Qe,Me];Om.prototype.g=sa([0,Je,Bh,[0,Je],Rh,Ph,Lh,Ll]);var Bm=class extends J{constructor(e){super(e)}},Mb=pr(456383383,Bm);et[456383383]=[0,Je,vm];var Lm=class extends J{constructor(e){super(e)}},Ub=pr(476348187,Lm);et[476348187]=[0,Je,Tb];var Fm=class extends J{constructor(e){super(e)}},Df=class extends J{constructor(e){super(e)}},Mm=[0,Zt,-1],Nb=pr(458105876,class extends J{constructor(e){super(e)}g(){var e=this.u;let t=0|e[te],r=2&t;return e=(function(n,i,o){var s=Df;let a=2&i,c=!1;if(o==null){if(a)return ff();o=[]}else if(o.constructor===Jt){if((2&o.L)==0||a)return o;o=o.X()}else Array.isArray(o)?c=!!(2&(0|o[te])):o=[];if(a){if(!o.length)return ff();c||(c=!0,Ei(o))}else c&&(c=!1,o=Rp(o));return c||(64&(0|o[te])?o[te]&=-33:32&i&&Hs(o,32)),je(n,i,2,s=new Jt(o,s,Ky,void 0)),s})(e,t,Xr(e,t,2)),!r&&Df&&(e.ra=!0),e}});et[458105876]=[0,Mm,hb,[!0,un,[0,we,-1,mt]]];var Fh=class extends J{constructor(e){super(e)}},Um=pr(458105758,Fh);et[458105758]=[0,Je,we,Mm];var Nm=class extends J{constructor(e){super(e)}},zb=pr(443442058,Nm);et[443442058]=[0,Je,we,Ge,Qe,mt,-1,Me,Qe],et[514774813]=Lh;var zm=class extends J{constructor(e){super(e)}},jb=pr(516587230,zm);function Fl(e,t){return t=t?t.clone():new Ih,e.displayNamesLocale!==void 0?Te(t,1,xi(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Te(t,1),e.maxResults!==void 0?Dr(t,2,e.maxResults):"maxResults"in e&&Te(t,2),e.scoreThreshold!==void 0?Y(t,3,e.scoreThreshold):"scoreThreshold"in e&&Te(t,3),e.categoryAllowlist!==void 0?Us(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&Te(t,4),e.categoryDenylist!==void 0?Us(t,5,e.categoryDenylist):"categoryDenylist"in e&&Te(t,5),t}function Mh(e,t=-1,r=""){return{categories:e.map((n=>({index:Xt(n,1)??0??-1,score:Xe(n,2)??0,categoryName:Yt(n,3)??""??"",displayName:Yt(n,4)??""??""}))),headIndex:t,headName:r}}function jm(e){var t=Mn(e,3,pn,Fn()),r=Mn(e,2,Ci,Fn()),n=Mn(e,1,yi,Fn()),i=Mn(e,9,yi,Fn());let o={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)o.categories.push({score:t[s],index:r[s]??-1,categoryName:n[s]??"",displayName:i[s]??""});if((t=be(e,vl,4)?.h())&&(o.boundingBox={originX:Xt(t,1)??0,originY:Xt(t,2)??0,width:Xt(t,3)??0,height:Xt(t,4)??0,angle:0}),be(e,vl,4)?.g().length)for(let s of be(e,vl,4).g())o.keypoints.push({x:xs(s,1)??0,y:xs(s,2)??0,score:xs(s,4)??0,label:Yt(s,3)??""});return o}function la(e){let t=[];for(let r of qr(e,ym,1))t.push({x:Xe(r,1)??0,y:Xe(r,2)??0,z:Xe(r,3)??0,visibility:Xe(r,4)??0});return t}function _o(e){let t=[];for(let r of qr(e,gm,1))t.push({x:Xe(r,1)??0,y:Xe(r,2)??0,z:Xe(r,3)??0,visibility:Xe(r,4)??0});return t}function Of(e){return Array.from(e,(t=>t>127?t-256:t))}function Bf(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,i=0;for(let o=0;o<e.length;o++)r+=e[o]*t[o],n+=e[o]*e[o],i+=t[o]*t[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}var ks;et[516587230]=[0,Je,Lh,Ll,Qe],et[518928384]=Ll;var Vb=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Vm(){if(ks===void 0)try{await WebAssembly.instantiate(Vb),ks=!0}catch{ks=!1}return ks}async function uo(e,t=mb``){let r=await Vm()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var on=class{};function Hm(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Lf(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function Wm(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function ee(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Ff(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);let[n,i]=Wm(t);return!e.l||n===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=i),[n,i]}function Mf(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.i.stringToNewUTF8(t[i]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.i._free(i);e.i._free(t)}function Tr(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function nn(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}on.forVisionTasks=function(e){return uo("vision",e)},on.forTextTasks=function(e){return uo("text",e)},on.forGenAiExperimentalTasks=function(e){return uo("genai_experimental",e)},on.forGenAiTasks=function(e){return uo("genai",e)},on.forAudioTasks=function(e){return uo("audio",e)},on.isSimdSupported=function(){return Vm()};async function Hb(e,t,r,n){return e=await(async(i,o,s,a,c)=>{if(o&&await Lf(o),!self.ModuleFactory||s&&(await Lf(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((o=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new i(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:i=>i.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&i.endsWith(".data")?r.assetBinaryPath.toString():i}),await e.o(n),e}function wl(e,t){let r=be(e.baseOptions,zs,1)||new zs;typeof t=="string"?(Te(r,2,xi(t)),Te(r,1)):t instanceof Uint8Array&&(Te(r,1,Jl(t,!1)),Te(r,2)),ne(e.baseOptions,0,1,r)}function Uf(e){try{let t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map((r=>r.message)).join(", "))}finally{e.G=[]}}function X(e,t){e.B=Math.max(e.B,t)}function ha(e,t){e.A=new yt,jt(e.A,"PassThroughCalculator"),Ie(e.A,"free_memory"),me(e.A,"free_memory_unused_out"),Oe(t,"free_memory"),Vt(t,e.A)}function vi(e,t){Ie(e.A,t),me(e.A,t+"_unused_out")}function ua(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var Is=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(be(this.baseOptions,zs,1)?.g()||be(this.baseOptions,zs,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=be(n.baseOptions,Rf,3);if(!o){var s=o=new Rf,a=new Ef;yo(s,4,Ts,a)}"delegate"in i&&(i.delegate==="GPU"?(i=o,s=new gb,yo(i,2,Ts,s)):(i=o,s=new Ef,yo(i,4,Ts,s))),ne(n.baseOptions,0,3,o)})(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),wl(this,"/model.dat"),this.m(),this.I()}));if(r.modelAssetBuffer instanceof Uint8Array)wl(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{wl(this,n),this.m(),this.I()}))}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da((t=>{e=yb(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.G.push(Error(n))})),this.g.La(),this.g.setGraph(e,t),this.A=void 0,Uf(this)}finishProcessing(){this.g.finishProcessing(),Uf(this)}close(){this.A=void 0,this.g.closeGraph()}};function gt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Is.prototype.close=Is.prototype.close,(function(e,t){e=e.split(".");var r,n=Nn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",Is);var Ml=class{constructor(t,r,n,i){this.g=t,this.h=r,this.m=n,this.l=i}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Nf(e,t,r){let n=e.g;if(r=gt(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function zf(e,t){let r=e.g,n=gt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let i=gt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let o=gt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.I),r.vertexAttribPointer(e.I,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new Ml(r,n,i,o)}function Uh(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Ro(e,t,r,n){return Uh(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=zf(e,!0)),r=e.s):(e.v||(e.v=zf(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function dn(e,t,r){return Uh(e,t),e=gt(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),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,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function da(e,t,r){Uh(e,t),e.A||(e.A=gt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Nh(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Di=class{G(){return`
9
10
  precision mediump float;
10
11
  varying vec2 vTex;
11
12
  uniform sampler2D inputTexture;
12
13
  void main() {
13
14
  gl_FragColor = texture2D(inputTexture, vTex);
14
15
  }
15
- `}m(){let e=this.g;if(this.h=Re(e.createProgram(),"Failed to create WebGL program"),this.aa=Ep(this,`
16
+ `}m(){let e=this.g;if(this.h=gt(e.createProgram(),"Failed to create WebGL program"),this.aa=Nf(this,`
16
17
  attribute vec2 aVertex;
17
18
  attribute vec2 aTex;
18
19
  varying vec2 vTex;
19
20
  void main(void) {
20
21
  gl_Position = vec4(aVertex, 0.0, 1.0);
21
22
  vTex = aTex;
22
- }`,e.VERTEX_SHADER),this.Z=Ep(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.I=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.aa),e.deleteShader(this.Z)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}},jb=class extends Gn{G(){return`
23
+ }`,e.VERTEX_SHADER),this.Z=Nf(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.I=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.aa),e.deleteShader(this.Z)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}},Wb=class extends Di{G(){return`
23
24
  precision mediump float;
24
25
  uniform sampler2D backgroundTexture;
25
26
  uniform sampler2D maskTexture;
@@ -31,7 +32,7 @@ Minimum version required to store current data is: `+i+`.
31
32
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
32
33
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
33
34
  }
34
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=vr(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=vr(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.K=Re(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.T=Re(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.J=Re(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.K,1),e.uniform1i(this.T,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},Vb=class extends Gn{G(){return`
35
+ `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=dn(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=dn(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.K=gt(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.T=gt(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.J=gt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.K,1),e.uniform1i(this.T,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},$b=class extends Di{G(){return`
35
36
  precision mediump float;
36
37
  uniform sampler2D maskTexture;
37
38
  uniform sampler2D defaultTexture;
@@ -45,13 +46,13 @@ Minimum version required to store current data is: `+i+`.
45
46
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
46
47
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
47
48
  }
48
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=vr(this,e),e.activeTexture(e.TEXTURE2),this.B=vr(this,e)}m(){super.m();let e=this.g;this.J=Re(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=Re(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=Re(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Qt(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function pl(e){var t=Qt(e,1);if(!t){if(t=Qt(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);let n=Ln(e);var r=mh(e);if(Hs(r,n,Rm(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let o=0,i=0;o<t.length;++o,i+=4)t[o]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Rm(e){let t=Qt(e,2);if(!t){let r=Ln(e);t=Om(e);let n=pl(e),o=Dm(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,n),fl(e)}return t}function Ln(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Re(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Dm(e){if(e=Ln(e),!es)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))es=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");es=e.R16F}return es}function mh(e){return e.l||(e.l=new Gn),e.l}function Om(e){let t=Ln(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Qt(e,2);return r||(r=vr(mh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function fl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var es,_e=class{constructor(e,t,r,n,o,i,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=o,this.width=i,this.height=s,this.j&&--xp===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Qt(this,0)}ja(){return!!Qt(this,1)}P(){return!!Qt(this,2)}ia(){return(t=Qt(e=this,0))||(t=pl(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return pl(this)}M(){return Rm(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=Ln(this),o=mh(this);n.activeTexture(n.TEXTURE1),r=vr(o,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let i=Dm(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Hs(o,n,r),Qo(o,n,!1,(()=>{Om(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),fl(this)})),fh(o),fl(this)}}e.push(r)}return new _e(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ln(this).deleteTexture(Qt(this,2)),xp=-1}};_e.prototype.close=_e.prototype.close,_e.prototype.clone=_e.prototype.clone,_e.prototype.getAsWebGLTexture=_e.prototype.M,_e.prototype.getAsFloat32Array=_e.prototype.ha,_e.prototype.getAsUint8Array=_e.prototype.ia,_e.prototype.hasWebGLTexture=_e.prototype.P,_e.prototype.hasFloat32Array=_e.prototype.ja,_e.prototype.hasUint8Array=_e.prototype.Fa;var xp=250,Hb={color:"white",lineWidth:4,radius:6};function Yc(e){return{...Hb,fillColor:(e=e||{}).color,...e}}function Jt(e,t){return e instanceof Function?e(t):e}function Ap(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function Mo(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function qo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Tp(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Gn;let o=qo(e);r((e=new _e([n],t.m,!1,o.canvas,e.m,t.width,t.height)).M()),e.close()}}function Ip(e,t,r,n){let o=(function(a){return a.g||(a.g=new jb),a.g})(e),i=qo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Qo(o,i,!0,(()=>{(function(c,l,h,d){let u=c.g;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,c.B),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,h),c.H&&(function(b,m){if(b!==m)return!1;b=b.entries(),m=m.entries();for(let[y,v]of b){b=y;let _=v;var f=m.next();if(f.done)return!1;let[x,B]=f.value;if(f=B,b!==x||_[0]!==f[0]||_[1]!==f[1]||_[2]!==f[2]||_[3]!==f[3])return!1}return!!m.next().done})(c.H,d))u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j);else{c.H=d;let b=Array(1024).fill(0);d.forEach(((m,f)=>{if(m.length!==4)throw Error(`Color at index ${f} is not a four-channel value.`);b[4*f]=m[0],b[4*f+1]=m[1],b[4*f+2]=m[2],b[4*f+3]=m[3]})),u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,256,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array(b))}})(o,t,s,n),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4);let a=o.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)}))}function Pp(e,t,r,n){let o=qo(e),i=(function(c){return c.h||(c.h=new Vb),c.h})(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Qo(i,o,!0,(()=>{var c=i.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,i.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,i.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4),o.bindTexture(o.TEXTURE_2D,null),(c=i.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)}))}var Fe=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=Mo(this);t=Yc(t),r.save();var n=r.canvas,o=0;for(let i of e)r.fillStyle=Jt(t.fillColor,{index:o,from:i}),r.strokeStyle=Jt(t.color,{index:o,from:i}),r.lineWidth=Jt(t.lineWidth,{index:o,from:i}),(e=new Path2D).arc(i.x*n.width,i.y*n.height,Jt(t.radius,{index:o,from:i}),0,2*Math.PI),r.fill(e),r.stroke(e),++o;r.restore()}}xa(e,t,r){if(e&&t){var n=Mo(this);r=Yc(r),n.save();var o=n.canvas,i=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=Jt(r.color,{index:i,from:t,to:a}),n.lineWidth=Jt(r.lineWidth,{index:i,from:t,to:a}),n.moveTo(t.x*o.width,t.y*o.height),n.lineTo(a.x*o.width,a.y*o.height)),++i,n.stroke()}n.restore()}}ua(e,t){let r=Mo(this);t=Yc(t),r.save(),r.beginPath(),r.lineWidth=Jt(t.lineWidth,{}),r.strokeStyle=Jt(t.color,{}),r.fillStyle=Jt(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?(function(n,o,i,s){let a=qo(n);Tp(n,o,(c=>{Ip(n,c,i,s),(c=Mo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Ip(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,o,i,s){let a=qo(n);Tp(n,o,(c=>{Pp(n,c,i,s),(c=Mo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):Pp(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Nt(e,t){switch(t){case 0:return e.g.find((r=>r instanceof ImageData));case 1:return e.g.find((r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Bm(e){var t=Nt(e,0);if(!t){t=Fn(e);let r=zs(e),n=new Uint8Array(e.width*e.height*4);Hs(r,t,ss(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),fh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function ss(e){let t=Nt(e,2);if(!t){let r=Fn(e);t=as(e);let n=Nt(e,1)||Bm(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),Fo(e)}return t}function Fn(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Re(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function zs(e){return e.l||(e.l=new Gn),e.l}function as(e){let t=Fn(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Nt(e,2);return r||(r=vr(zs(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Fo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Rp(e){let t=Fn(e);return Qo(zs(e),t,!0,(()=>(function(r,n){let o=r.canvas;if(o.width===r.width&&o.height===r.height)return n();let i=o.width,s=o.height;return o.width=r.width,o.height=r.height,r=n(),o.width=i,o.height=s,r})(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}Fe.prototype.close=Fe.prototype.close,Fe.prototype.drawConfidenceMask=Fe.prototype.wa,Fe.prototype.drawCategoryMask=Fe.prototype.va,Fe.prototype.drawBoundingBox=Fe.prototype.ua,Fe.prototype.drawConnectors=Fe.prototype.xa,Fe.prototype.drawLandmarks=Fe.prototype.ya,Fe.lerp=function(e,t,r,n,o){return Ap(n*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),n,o)},Fe.clamp=Ap;var xe=class{constructor(e,t,r,n,o,i,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=o,this.width=i,this.height=s,(this.j||this.m)&&--Dp===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Nt(this,0)}ka(){return!!Nt(this,1)}P(){return!!Nt(this,2)}Ca(){return Bm(this)}Ba(){var e=Nt(this,1);return e||(ss(this),as(this),e=Rp(this),Fo(this),this.g.push(e),this.j=!0),e}M(){return ss(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Fn(this),o=zs(this);n.activeTexture(n.TEXTURE1),r=vr(o,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),Hs(o,n,r),Qo(o,n,!1,(()=>{as(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Fo(this)})),fh(o),Fo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);ss(this),as(this),r=Rp(this),Fo(this)}e.push(r)}return new xe(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Nt(this,1).close(),this.m&&Fn(this).deleteTexture(Nt(this,2)),Dp=-1}};xe.prototype.close=xe.prototype.close,xe.prototype.clone=xe.prototype.clone,xe.prototype.getAsWebGLTexture=xe.prototype.M,xe.prototype.getAsImageBitmap=xe.prototype.Ba,xe.prototype.getAsImageData=xe.prototype.Ca,xe.prototype.hasWebGLTexture=xe.prototype.P,xe.prototype.hasImageBitmap=xe.prototype.ka,xe.prototype.hasImageData=xe.prototype.Ea;var Dp=250;function xt(...e){return e.map((([t,r])=>({start:t,end:r})))}var zb=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Op=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Im()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,o){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),E(this,n||"input_audio",(i=>{E(this,o=o||"audio_header",(s=>{this.i._configureAudio(i,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Lt(this,"__graph_config__",(t=>{e(t)})),E(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,o){let i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),E(this,n,(s=>{this.i._addAudioToInputStream(this.g,t,r,s,o)}))}addGpuBufferToStream(e,t,r){E(this,t,(n=>{let[o,i]=_p(this,e,n);this.i._addBoundTextureToStream(n,o,i,r)}))}addBoolToStream(e,t,r){E(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){E(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){E(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){E(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){E(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){E(this,t,(n=>{E(this,e,(o=>{this.i._addStringToInputStream(o,n,r)}))}))}addStringRecordToStream(e,t,r){E(this,t,(n=>{Sp(this,Object.keys(e),(o=>{Sp(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(o,i,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){E(this,r,(o=>{E(this,t,(i=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,i,o,n),this.i._free(s)}))}))}addEmptyPacketToStream(e,t){E(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(o,i);this.i._addBoolVectorToInputStream(o,n,r)}))}addDoubleVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(o,i);this.i._addDoubleVectorToInputStream(o,n,r)}))}addFloatVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(o,i);this.i._addFloatVectorToInputStream(o,n,r)}))}addIntVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(o,i);this.i._addIntVectorToInputStream(o,n,r)}))}addUintVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateUintVector(e.length);if(!o)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(o,i);this.i._addUintVectorToInputStream(o,n,r)}))}addStringVectorToStream(e,t,r){E(this,t,(n=>{let o=this.i._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let i of e)E(this,i,(s=>{this.i._addStringVectorEntry(o,s)}));this.i._addStringVectorToInputStream(o,n,r)}))}addBoolToInputSidePacket(e,t){E(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){E(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){E(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){E(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){E(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){E(this,t,(r=>{E(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){E(this,r,(n=>{E(this,t,(o=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,o,n),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(n,o);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(n,o);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(n,o);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(n,o);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(n,o);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){E(this,t,(r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let o of e)E(this,o,(i=>{this.i._addStringVectorEntry(n,i)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Lt(this,e,t),E(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){dr(this,e,t),E(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Lt(this,e,t),E(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){dr(this,e,t),E(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Lt(this,e,((n,o)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,o)})),E(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Op{get ea(){return this.i}qa(e,t,r){E(this,t,(n=>{let[o,i]=_p(this,e,n);this.ea._addBoundTextureAsImageToStream(n,o,i,r)}))}U(e,t){Lt(this,e,t),E(this,e,(r=>{this.ea._attachImageListener(r)}))}ca(e,t){dr(this,e,t),E(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),Op,ut=class extends zb{};async function M(e,t,r){return(async function(n,o,i,s){return Nb(n,o,i,s)})(e,r.canvas??(Im()?void 0:document.createElement("canvas")),t,r)}function Mm(e,t,r,n){if(e.T){let i=new om;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var o=r.regionOfInterest;if(o.left>=o.right||o.top>=o.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(o.left<0||o.top<0||o.right>1||o.bottom>1)throw Error("Expected RectF values to be in [0,1].");k(i,1,(o.left+o.right)/2),k(i,2,(o.top+o.bottom)/2),k(i,4,o.right-o.left),k(i,3,o.bottom-o.top)}else k(i,1,.5),k(i,2,.5),k(i,4,1),k(i,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(k(i,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=Pm(t);r=pe(i,3)*a/s,o=pe(i,4)*s/a,k(i,4,r),k(i,3,o)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function pt(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Mm(e,t,r,e.B+1)}function Vt(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Mm(e,t,r,n)}function Un(e,t,r,n){var o=t.data;let i=t.width,s=i*(t=t.height);if((o instanceof Uint8Array||o instanceof Float32Array)&&o.length!==s)throw Error("Unsupported channel count: "+o.length/s);return e=new _e([o],r,!1,e.g.i.canvas,e.O,i,t),n?e.clone():e}var He=class extends is{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Gn}l(e,t=!0){if("runningMode"in e&&Wo(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};He.prototype.close=He.prototype.close;var Ne=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},A(e=this.h=new Us,0,1,t=new ee),k(this.h,2,.5),k(this.h,3,.3)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&k(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&k(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},pt(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect_in"),N(e,"detections");let t=new Qe;kt(t,Cb,this.h);let r=new De;et(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect_in"),L(r,"DETECTIONS:detections"),r.o(t),tt(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=tm(i),this.j.detections.push(Am(n));w(this,o)})),this.g.attachEmptyPacketListener("detections",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ne.prototype.detectForVideo=Ne.prototype.F,Ne.prototype.detect=Ne.prototype.D,Ne.prototype.setOptions=Ne.prototype.o,Ne.createFromModelPath=async function(e,t){return M(Ne,e,{baseOptions:{modelAssetPath:t}})},Ne.createFromModelBuffer=function(e,t){return M(Ne,e,{baseOptions:{modelAssetBuffer:t}})},Ne.createFromOptions=function(e,t){return M(Ne,e,t)};var gh=xt([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),yh=xt([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),bh=xt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Lm=xt([474,475],[475,476],[476,477],[477,474]),vh=xt([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),wh=xt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Fm=xt([469,470],[470,471],[471,472],[472,469]),_h=xt([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Um=[...gh,...yh,...bh,...vh,...wh,..._h],Nm=xt([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Bp(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var ae=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,A(e=this.h=new lm,0,1,t=new ee),this.v=new cm,A(this.h,0,3,this.v),this.s=new Us,A(this.h,0,2,this.s),jt(this.s,4,1),k(this.s,2,.5),k(this.v,2,.5),k(this.h,4,.5)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"numFaces"in e&&jt(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&k(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&k(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Bp(this),pt(this,e,t),this.j}F(e,t,r){return Bp(this),Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"face_landmarks");let t=new Qe;kt(t,Ab,this.h);let r=new De;et(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),tt(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,o)=>{for(let i of n)n=Yo(i),this.j.faceLandmarks.push(Ns(n));w(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{w(this,n)})),this.outputFaceBlendshapes&&(N(e,"blendshapes"),L(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,o)=>{if(this.outputFaceBlendshapes)for(let i of n)n=Fs(i),this.j.faceBlendshapes.push(uh(n.g()??[]));w(this,o)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{w(this,n)}))),this.outputFacialTransformationMatrixes&&(N(e,"face_geometry"),L(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,o)=>{if(this.outputFacialTransformationMatrixes)for(let i of n)(n=F(xb(i),yb,2))&&this.j.facialTransformationMatrixes.push({rows:ct(n,1)??0??0,columns:ct(n,2)??0??0,data:$r(n,3,_r,Wr()).slice()??[]});w(this,o)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{w(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ae.prototype.detectForVideo=ae.prototype.F,ae.prototype.detect=ae.prototype.D,ae.prototype.setOptions=ae.prototype.o,ae.createFromModelPath=function(e,t){return M(ae,e,{baseOptions:{modelAssetPath:t}})},ae.createFromModelBuffer=function(e,t){return M(ae,e,{baseOptions:{modelAssetBuffer:t}})},ae.createFromOptions=function(e,t){return M(ae,e,t)},ae.FACE_LANDMARKS_LIPS=gh,ae.FACE_LANDMARKS_LEFT_EYE=yh,ae.FACE_LANDMARKS_LEFT_EYEBROW=bh,ae.FACE_LANDMARKS_LEFT_IRIS=Lm,ae.FACE_LANDMARKS_RIGHT_EYE=vh,ae.FACE_LANDMARKS_RIGHT_EYEBROW=wh,ae.FACE_LANDMARKS_RIGHT_IRIS=Fm,ae.FACE_LANDMARKS_FACE_OVAL=_h,ae.FACE_LANDMARKS_CONTOURS=Um,ae.FACE_LANDMARKS_TESSELATION=Nm;var Ft=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!0),A(e=this.j=new dm,0,1,t=new ee)}get baseOptions(){return F(this.j,ee,1)}set baseOptions(e){A(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,pt(this,e,n??{}),!this.h)return this.s}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"stylized_image");let t=new Qe;kt(t,Tb,this.j);let r=new De;et(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),tt(e,r),this.g.U("stylized_image",((n,o)=>{var i=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)l[4*h]=s[3*h],l[4*h+1]=s[3*h+1],l[4*h+2]=s[3*h+2],l[4*h+3]=255;s=new ImageData(l,a,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new xe([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=i=i?a.clone():a,this.h&&this.h(i),w(this,o)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.prototype.stylize=Ft.prototype.Oa,Ft.prototype.setOptions=Ft.prototype.o,Ft.createFromModelPath=function(e,t){return M(Ft,e,{baseOptions:{modelAssetPath:t}})},Ft.createFromModelBuffer=function(e,t){return M(Ft,e,{baseOptions:{modelAssetBuffer:t}})},Ft.createFromOptions=function(e,t){return M(Ft,e,t)};var Sh=xt([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Mp(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Lp(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Fp(e,t=!0){let r=[];for(let o of e){var n=Fs(o);e=[];for(let i of n.g())n=t&&ct(i,1)!=null?ct(i,1)??0:-1,e.push({score:pe(i,2)??0,index:n,categoryName:ht(i,3)??""??"",displayName:ht(i,4)??""??""});r.push(e)}return r}var Ke=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],A(e=this.j=new fm,0,1,t=new ee),this.s=new ch,A(this.j,0,2,this.s),this.C=new ah,A(this.s,0,3,this.C),this.v=new pm,A(this.s,0,2,this.v),this.h=new Ib,A(this.j,0,3,this.h),k(this.v,2,.5),k(this.s,4,.5),k(this.C,2,.5)}get baseOptions(){return F(this.j,ee,1)}set baseOptions(e){A(this.j,0,1,e)}o(e){if(jt(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&k(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&k(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new _n,r=t,n=dl(e.cannedGesturesClassifierOptions,F(this.h,_n,3)?.h());A(r,0,2,n),A(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&F(this.h,_n,3)?.g();return e.customGesturesClassifierOptions?(A(r=t=new _n,0,2,n=dl(e.customGesturesClassifierOptions,F(this.h,_n,4)?.h())),A(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&F(this.h,_n,4)?.g(),this.l(e)}Ja(e,t){return Mp(this),pt(this,e,t),Lp(this)}Ka(e,t,r){return Mp(this),Vt(this,e,r,t),Lp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"hand_gestures"),N(e,"hand_landmarks"),N(e,"world_hand_landmarks"),N(e,"handedness");let t=new Qe;kt(t,Pb,this.j);let r=new De;et(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"HAND_GESTURES:hand_gestures"),L(r,"LANDMARKS:hand_landmarks"),L(r,"WORLD_LANDMARKS:world_hand_landmarks"),L(r,"HANDEDNESS:handedness"),r.o(t),tt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n){n=Yo(i);let s=[];for(let a of rr(n,nm,1))s.push({x:pe(a,1)??0,y:pe(a,2)??0,z:pe(a,3)??0,visibility:pe(a,4)??0});this.landmarks.push(s)}w(this,o)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{w(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,o)=>{for(let i of n){n=Tn(i);let s=[];for(let a of rr(n,rm,1))s.push({x:pe(a,1)??0,y:pe(a,2)??0,z:pe(a,3)??0,visibility:pe(a,4)??0});this.worldLandmarks.push(s)}w(this,o)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{w(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,o)=>{this.gestures.push(...Fp(n,!1)),w(this,o)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{w(this,n)})),this.g.attachProtoVectorListener("handedness",((n,o)=>{this.handedness.push(...Fp(n)),w(this,o)})),this.g.attachEmptyPacketListener("handedness",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Up(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ke.prototype.recognizeForVideo=Ke.prototype.Ka,Ke.prototype.recognize=Ke.prototype.Ja,Ke.prototype.setOptions=Ke.prototype.o,Ke.createFromModelPath=function(e,t){return M(Ke,e,{baseOptions:{modelAssetPath:t}})},Ke.createFromModelBuffer=function(e,t){return M(Ke,e,{baseOptions:{modelAssetBuffer:t}})},Ke.createFromOptions=function(e,t){return M(Ke,e,t)},Ke.HAND_CONNECTIONS=Sh;var Xe=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],A(e=this.h=new ch,0,1,t=new ee),this.s=new ah,A(this.h,0,3,this.s),this.j=new pm,A(this.h,0,2,this.j),jt(this.j,3,1),k(this.j,2,.5),k(this.s,2,.5),k(this.h,4,.5)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"numHands"in e&&jt(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&k(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&k(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],pt(this,e,t),Up(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Vt(this,e,r,t),Up(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"hand_landmarks"),N(e,"world_hand_landmarks"),N(e,"handedness");let t=new Qe;kt(t,Rb,this.h);let r=new De;et(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"LANDMARKS:hand_landmarks"),L(r,"WORLD_LANDMARKS:world_hand_landmarks"),L(r,"HANDEDNESS:handedness"),r.o(t),tt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n)n=Yo(i),this.landmarks.push(Ns(n));w(this,o)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{w(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,o)=>{for(let i of n)n=Tn(i),this.worldLandmarks.push(Vo(n));w(this,o)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{w(this,n)})),this.g.attachProtoVectorListener("handedness",((n,o)=>{var i=this.handedness,s=i.push;let a=[];for(let c of n){n=Fs(c);let l=[];for(let h of n.g())l.push({score:pe(h,2)??0,index:ct(h,1)??0??-1,categoryName:ht(h,3)??""??"",displayName:ht(h,4)??""??""});a.push(l)}s.call(i,...a),w(this,o)})),this.g.attachEmptyPacketListener("handedness",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Xe.prototype.detectForVideo=Xe.prototype.F,Xe.prototype.detect=Xe.prototype.D,Xe.prototype.setOptions=Xe.prototype.o,Xe.createFromModelPath=function(e,t){return M(Xe,e,{baseOptions:{modelAssetPath:t}})},Xe.createFromModelBuffer=function(e,t){return M(Xe,e,{baseOptions:{modelAssetBuffer:t}})},Xe.createFromOptions=function(e,t){return M(Xe,e,t)},Xe.HAND_CONNECTIONS=Sh;var jm=xt([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function Np(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function jp(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Vs(e)}}function ts(e,t){e=Yo(e),t.push(Ns(e))}var Q=class extends He{constructor(e,t){super(new ut(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,A(e=this.j=new vm,0,1,t=new ee),this.J=new ah,A(this.j,0,2,this.J),this.Z=new Db,A(this.j,0,3,this.Z),this.s=new Us,A(this.j,0,4,this.s),this.H=new cm,A(this.j,0,5,this.H),this.v=new ym,A(this.j,0,6,this.v),this.K=new bm,A(this.j,0,7,this.K),k(this.s,2,.5),k(this.s,3,.3),k(this.H,2,.5),k(this.v,2,.5),k(this.v,3,.3),k(this.K,2,.5),k(this.J,2,.5)}get baseOptions(){return F(this.j,ee,1)}set baseOptions(e){A(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&k(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&k(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&k(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&k(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&k(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&k(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&k(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,Np(this),pt(this,e,n),jp(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,Np(this),Vt(this,e,o,t),jp(this)}m(){var e=new ze;Y(e,"input_frames_image"),N(e,"pose_landmarks"),N(e,"pose_world_landmarks"),N(e,"face_landmarks"),N(e,"left_hand_landmarks"),N(e,"left_hand_world_landmarks"),N(e,"right_hand_landmarks"),N(e,"right_hand_world_landmarks");let t=new Qe,r=new ip;ol(r,1,Vn("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(o,i){if(i!=null)if(Array.isArray(i))G(o,2,pf(i));else{if(!(typeof i=="string"||i instanceof er||Go(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");ol(o,2,Cl(i,!1),Kr())}})(r,this.j.g());let n=new De;et(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),ps(n,8,ip,r),K(n,"IMAGE:input_frames_image"),L(n,"POSE_LANDMARKS:pose_landmarks"),L(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),L(n,"FACE_LANDMARKS:face_landmarks"),L(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),L(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),L(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),L(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),tt(e,n),js(this,e),this.g.attachProtoListener("pose_landmarks",((o,i)=>{ts(o,this.h.poseLandmarks),w(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(o=>{w(this,o)})),this.g.attachProtoListener("pose_world_landmarks",((o,i)=>{var s=this.h.poseWorldLandmarks;o=Tn(o),s.push(Vo(o)),w(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(o=>{w(this,o)})),this.outputPoseSegmentationMasks&&(L(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Mn(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((o,i)=>{this.h.poseSegmentationMasks=[Un(this,o,!0,!this.C)],w(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(o=>{this.h.poseSegmentationMasks=[],w(this,o)}))),this.g.attachProtoListener("face_landmarks",((o,i)=>{ts(o,this.h.faceLandmarks),w(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(o=>{w(this,o)})),this.outputFaceBlendshapes&&(N(e,"extra_blendshapes"),L(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((o,i)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(o=Fs(o),s.push(uh(o.g()??[]))),w(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(o=>{w(this,o)}))),this.g.attachProtoListener("left_hand_landmarks",((o,i)=>{ts(o,this.h.leftHandLandmarks),w(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(o=>{w(this,o)})),this.g.attachProtoListener("left_hand_world_landmarks",((o,i)=>{var s=this.h.leftHandWorldLandmarks;o=Tn(o),s.push(Vo(o)),w(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(o=>{w(this,o)})),this.g.attachProtoListener("right_hand_landmarks",((o,i)=>{ts(o,this.h.rightHandLandmarks),w(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(o=>{w(this,o)})),this.g.attachProtoListener("right_hand_world_landmarks",((o,i)=>{var s=this.h.rightHandWorldLandmarks;o=Tn(o),s.push(Vo(o)),w(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(o=>{w(this,o)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Q.prototype.detectForVideo=Q.prototype.F,Q.prototype.detect=Q.prototype.D,Q.prototype.setOptions=Q.prototype.o,Q.createFromModelPath=function(e,t){return M(Q,e,{baseOptions:{modelAssetPath:t}})},Q.createFromModelBuffer=function(e,t){return M(Q,e,{baseOptions:{modelAssetBuffer:t}})},Q.createFromOptions=function(e,t){return M(Q,e,t)},Q.HAND_CONNECTIONS=Sh,Q.POSE_CONNECTIONS=jm,Q.FACE_LANDMARKS_LIPS=gh,Q.FACE_LANDMARKS_LEFT_EYE=yh,Q.FACE_LANDMARKS_LEFT_EYEBROW=bh,Q.FACE_LANDMARKS_LEFT_IRIS=Lm,Q.FACE_LANDMARKS_RIGHT_EYE=vh,Q.FACE_LANDMARKS_RIGHT_EYEBROW=wh,Q.FACE_LANDMARKS_RIGHT_IRIS=Fm,Q.FACE_LANDMARKS_FACE_OVAL=_h,Q.FACE_LANDMARKS_CONTOURS=Um,Q.FACE_LANDMARKS_TESSELATION=Nm;var st=class extends He{constructor(e,t){super(new ut(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},A(e=this.h=new wm,0,1,t=new ee)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return A(this.h,0,2,dl(e,F(this.h,oh,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},pt(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"input_image"),Y(e,"norm_rect"),N(e,"classifications");let t=new Qe;kt(t,Ob,this.h);let r=new De;et(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),K(r,"IMAGE:input_image"),K(r,"NORM_RECT:norm_rect"),L(r,"CLASSIFICATIONS:classifications"),r.o(t),tt(e,r),this.g.attachProtoListener("classifications",((n,o)=>{this.j=(function(i){let s={classifications:rr(i,vb,1).map((a=>uh(F(a,Zf,4)?.g()??[],ct(a,2)??0,ht(a,3)??"")))};return us(On(i,2))!=null&&(s.timestampMs=us(On(i,2))??0),s})(wb(n)),w(this,o)})),this.g.attachEmptyPacketListener("classifications",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};st.prototype.classifyForVideo=st.prototype.ta,st.prototype.classify=st.prototype.sa,st.prototype.setOptions=st.prototype.o,st.createFromModelPath=function(e,t){return M(st,e,{baseOptions:{modelAssetPath:t}})},st.createFromModelBuffer=function(e,t){return M(st,e,{baseOptions:{modelAssetBuffer:t}})},st.createFromOptions=function(e,t){return M(st,e,t)};var Je=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!0),this.h=new _m,this.embeddings={embeddings:[]},A(e=this.h,0,1,t=new ee)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){var t=this.h,r=F(this.h,fp,2);return r=r?r.clone():new fp,e.l2Normalize!==void 0?Wo(r,1,e.l2Normalize):"l2Normalize"in e&&G(r,1),e.quantize!==void 0?Wo(r,2,e.quantize):"quantize"in e&&G(r,2),A(t,0,2,r),this.l(e)}za(e,t){return pt(this,e,t),this.embeddings}Aa(e,t,r){return Vt(this,e,r,t),this.embeddings}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"embeddings_out");let t=new Qe;kt(t,Bb,this.h);let r=new De;et(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"EMBEDDINGS:embeddings_out"),r.o(t),tt(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=kb(n),this.embeddings=(function(i){return{embeddings:rr(i,Sb,1).map((s=>{let a={headIndex:ct(s,3)??0??-1,headName:ht(s,4)??""??""};if(bf(s,pp,$c(s,1))!==void 0)s=$r(s=F(s,pp,$c(s,1)),1,_r,Wr()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=F(s,_b,$c(s,2))?.oa()?.h()??c}return a})),timestampMs:us(On(i,2))??0}})(n),w(this,o)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Je.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=vp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=vp(bp(e.quantizedEmbedding),bp(t.quantizedEmbedding))}return e},Je.prototype.embedForVideo=Je.prototype.Aa,Je.prototype.embed=Je.prototype.za,Je.prototype.setOptions=Je.prototype.o,Je.createFromModelPath=function(e,t){return M(Je,e,{baseOptions:{modelAssetPath:t}})},Je.createFromModelBuffer=function(e,t){return M(Je,e,{baseOptions:{modelAssetBuffer:t}})},Je.createFromOptions=function(e,t){return M(Je,e,t)};var ml=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function Vp(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Hp(e){try{let t=new ml(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Vs(e)}}ml.prototype.close=ml.prototype.close;var Ue=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new dh,this.v=new Sm,A(this.h,0,3,this.v),A(e=this.h,0,1,t=new ee)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Vn(e.displayNamesLocale)):"displayNamesLocale"in e&&G(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=rr(e.da(),De,1).filter((r=>(ht(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(F(t[0],Qe,7)?.l()?.g()??new Map).forEach(((r,n)=>{e.s[Number(n)]=ht(r,1)??""}))})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Vp(this),pt(this,e,n),Hp(this)}Ma(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Vp(this),Vt(this,e,o,t),Hp(this)}Da(){return this.s}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect");let t=new Qe;kt(t,Em,this.h);let r=new De;et(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),r.o(t),tt(e,r),js(this,e),this.outputConfidenceMasks&&(N(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Mn(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>Un(this,i,!0,!this.j))),w(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],w(this,n)}))),this.outputCategoryMask&&(N(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Mn(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=Un(this,n,!1,!this.j),w(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,w(this,n)}))),N(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,o)=>{this.qualityScores=n,w(this,o)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.getLabels=Ue.prototype.Da,Ue.prototype.segmentForVideo=Ue.prototype.Ma,Ue.prototype.segment=Ue.prototype.segment,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return M(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return M(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return M(Ue,e,t)};var gl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};gl.prototype.close=gl.prototype.close;var Wb=class extends S{constructor(e){super(e)}},Sn=[0,le,-2],ys=[0,Yt,-3,Z,Yt,-1],zp=[0,ys],Wp=[0,ys,le,-1],Qc=class extends S{constructor(e){super(e)}},$p=[0,Yt,-1,Z],$b=class extends S{constructor(e){super(e)}},qp=class extends S{constructor(e){super(e)}},yl=[1,2,3,4,5,6,7,8,9,10,14,15],Vm=class extends S{constructor(e){super(e)}};Vm.prototype.g=Ls([0,Se,[0,yl,z,ys,z,[0,ys,Sn],z,zp,z,[0,zp,Sn],z,$p,z,[0,Yt,-3,Z,dt],z,[0,Yt,-3,Z],z,[0,j,Yt,-2,Z,le,Z,-1,2,Yt,Sn],z,Wp,z,[0,Wp,Sn],Yt,Sn,j,z,[0,Yt,-3,Z,Sn,-1],z,[0,Se,$p]],j,[0,j,le,-1,Z]]);var Ut=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new dh,this.s=new Sm,A(this.h,0,3,this.s),A(e=this.h,0,1,t=new ee)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let o=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new Vm;let i=new qp;var s=new Wb;if(jt(s,1,255),A(i,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Qc;Wo(a,3,!0),k(a,1,t.keypoint.x),k(a,2,t.keypoint.y),No(i,5,yl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new $b,t.scribble))Wo(t=new Qc,3,!0),k(t,1,a.x),k(t,2,a.y),ps(s,1,Qc,t);No(i,15,yl,s)}ps(n,1,qp,i),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),pt(this,e,o);e:{try{let l=new gl(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{Vs(this)}c=void 0}return c}m(){var e=new ze;Y(e,"image_in"),Y(e,"roi_in"),Y(e,"norm_rect_in");let t=new Qe;kt(t,Em,this.h);let r=new De;et(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),K(r,"IMAGE:image_in"),K(r,"ROI:roi_in"),K(r,"NORM_RECT:norm_rect_in"),r.o(t),tt(e,r),js(this,e),this.outputConfidenceMasks&&(N(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Mn(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>Un(this,i,!0,!this.j))),w(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],w(this,n)}))),this.outputCategoryMask&&(N(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Mn(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=Un(this,n,!1,!this.j),w(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,w(this,n)}))),N(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,o)=>{this.qualityScores=n,w(this,o)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ut.prototype.segment=Ut.prototype.segment,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=function(e,t){return M(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return M(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return M(Ut,e,t)};var je=class extends He{constructor(e,t){super(new ut(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},A(e=this.h=new Cm,0,1,t=new ee)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Vn(e.displayNamesLocale)):"displayNamesLocale"in e&&G(this.h,2),e.maxResults!==void 0?jt(this.h,3,e.maxResults):"maxResults"in e&&G(this.h,3),e.scoreThreshold!==void 0?k(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&G(this.h,4),e.categoryAllowlist!==void 0?fs(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&G(this.h,5),e.categoryDenylist!==void 0?fs(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&G(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},pt(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"input_frame_gpu"),Y(e,"norm_rect"),N(e,"detections");let t=new Qe;kt(t,Lb,this.h);let r=new De;et(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),K(r,"IMAGE:input_frame_gpu"),K(r,"NORM_RECT:norm_rect"),L(r,"DETECTIONS:detections"),r.o(t),tt(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=tm(i),this.j.detections.push(Am(n));w(this,o)})),this.g.attachEmptyPacketListener("detections",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};je.prototype.detectForVideo=je.prototype.F,je.prototype.detect=je.prototype.D,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=async function(e,t){return M(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return M(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return M(je,e,t)};var bl=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function Gp(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Kp(e){try{let t=new bl(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Vs(e)}}bl.prototype.close=bl.prototype.close;var Ye=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,A(e=this.h=new xm,0,1,t=new ee),this.v=new bm,A(this.h,0,3,this.v),this.j=new ym,A(this.h,0,2,this.j),jt(this.j,4,1),k(this.j,2,.5),k(this.v,2,.5),k(this.h,4,.5)}get baseOptions(){return F(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"numPoses"in e&&jt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&k(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&k(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,Gp(this),pt(this,e,n),Kp(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,Gp(this),Vt(this,e,o,t),Kp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),N(e,"normalized_landmarks"),N(e,"world_landmarks"),N(e,"segmentation_masks");let t=new Qe;kt(t,Fb,this.h);let r=new De;et(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:normalized_landmarks"),L(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),tt(e,r),js(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,o)=>{this.landmarks=[];for(let i of n)n=Yo(i),this.landmarks.push(Ns(n));w(this,o)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],w(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,o)=>{this.worldLandmarks=[];for(let i of n)n=Tn(i),this.worldLandmarks.push(Vo(n));w(this,o)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],w(this,n)})),this.outputSegmentationMasks&&(L(r,"SEGMENTATION_MASK:segmentation_masks"),Mn(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,o)=>{this.segmentationMasks=n.map((i=>Un(this,i,!0,!this.s))),w(this,o)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],w(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ye.prototype.detectForVideo=Ye.prototype.F,Ye.prototype.detect=Ye.prototype.D,Ye.prototype.setOptions=Ye.prototype.o,Ye.createFromModelPath=function(e,t){return M(Ye,e,{baseOptions:{modelAssetPath:t}})},Ye.createFromModelBuffer=function(e,t){return M(Ye,e,{baseOptions:{modelAssetBuffer:t}})},Ye.createFromOptions=function(e,t){return M(Ye,e,t)},Ye.POSE_CONNECTIONS=jm;var Kn=class{constructor(t,r,n,o,i="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=i,this.classDiv=s,this.startTime=new Date(Date.now()),o&&(this.paramsConfig=o),n&&(this.options=n)}async initializeDetector(){let t=await ur.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Ne:je).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
49
+ `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=dn(this,e),e.activeTexture(e.TEXTURE2),this.B=dn(this,e)}m(){super.m();let e=this.g;this.J=gt(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=gt(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=gt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Hr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Ul(e){var t=Hr(e,1);if(!t){if(t=Hr(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);let n=wi(e);var r=zh(e);if(da(r,n,$m(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let i=0,o=0;i<t.length;++i,o+=4)t[i]=r[o]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function $m(e){let t=Hr(e,2);if(!t){let r=wi(e);t=qm(e);let n=Ul(e),i=Gm(e);r.texImage2D(r.TEXTURE_2D,0,i,e.width,e.height,0,r.RED,r.FLOAT,n),Nl(e)}return t}function wi(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=gt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Gm(e){if(e=wi(e),!Es)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Es=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Es=e.R16F}return Es}function zh(e){return e.l||(e.l=new Di),e.l}function qm(e){let t=wi(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Hr(e,2);return r||(r=dn(zh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Nl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Es,it=class{constructor(e,t,r,n,i,o,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=i,this.width=o,this.height=s,this.j&&--jf===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Hr(this,0)}ja(){return!!Hr(this,1)}P(){return!!Hr(this,2)}ia(){return(t=Hr(e=this,0))||(t=Ul(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return Ul(this)}M(){return $m(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=wi(this),i=zh(this);n.activeTexture(n.TEXTURE1),r=dn(i,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let o=Gm(this);n.texImage2D(n.TEXTURE_2D,0,o,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),da(i,n,r),Ro(i,n,!1,(()=>{qm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Nl(this)})),Nh(i),Nl(this)}}e.push(r)}return new it(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&wi(this).deleteTexture(Hr(this,2)),jf=-1}};it.prototype.close=it.prototype.close,it.prototype.clone=it.prototype.clone,it.prototype.getAsWebGLTexture=it.prototype.M,it.prototype.getAsFloat32Array=it.prototype.ha,it.prototype.getAsUint8Array=it.prototype.ia,it.prototype.hasWebGLTexture=it.prototype.P,it.prototype.hasFloat32Array=it.prototype.ja,it.prototype.hasUint8Array=it.prototype.Fa;var jf=250,Gb={color:"white",lineWidth:4,radius:6};function Sl(e){return{...Gb,fillColor:(e=e||{}).color,...e}}function jr(e,t){return e instanceof Function?e(t):e}function Vf(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function fo(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Eo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Hf(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Di;let i=Eo(e);r((e=new it([n],t.m,!1,i.canvas,e.m,t.width,t.height)).M()),e.close()}}function Wf(e,t,r,n){let i=(function(a){return a.g||(a.g=new Wb),a.g})(e),o=Eo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ro(i,o,!0,(()=>{(function(c,l,h,u){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,l),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.B),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,h),c.H&&(function(p,g){if(p!==g)return!1;p=p.entries(),g=g.entries();for(let[b,_]of p){p=b;let k=_;var f=g.next();if(f.done)return!1;let[S,R]=f.value;if(f=R,p!==S||k[0]!==f[0]||k[1]!==f[1]||k[2]!==f[2]||k[3]!==f[3])return!1}return!!g.next().done})(c.H,u))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.H=u;let p=Array(1024).fill(0);u.forEach(((g,f)=>{if(g.length!==4)throw Error(`Color at index ${f} is not a four-channel value.`);p[4*f]=g[0],p[4*f+1]=g[1],p[4*f+2]=g[2],p[4*f+3]=g[3]})),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(p))}})(i,t,s,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4);let a=i.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)}))}function $f(e,t,r,n){let i=Eo(e),o=(function(c){return c.h||(c.h=new $b),c.h})(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Ro(o,i,!0,(()=>{var c=o.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,o.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,o.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(c=o.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)}))}var St=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=fo(this);t=Sl(t),r.save();var n=r.canvas,i=0;for(let o of e)r.fillStyle=jr(t.fillColor,{index:i,from:o}),r.strokeStyle=jr(t.color,{index:i,from:o}),r.lineWidth=jr(t.lineWidth,{index:i,from:o}),(e=new Path2D).arc(o.x*n.width,o.y*n.height,jr(t.radius,{index:i,from:o}),0,2*Math.PI),r.fill(e),r.stroke(e),++i;r.restore()}}xa(e,t,r){if(e&&t){var n=fo(this);r=Sl(r),n.save();var i=n.canvas,o=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=jr(r.color,{index:o,from:t,to:a}),n.lineWidth=jr(r.lineWidth,{index:o,from:t,to:a}),n.moveTo(t.x*i.width,t.y*i.height),n.lineTo(a.x*i.width,a.y*i.height)),++o,n.stroke()}n.restore()}}ua(e,t){let r=fo(this);t=Sl(t),r.save(),r.beginPath(),r.lineWidth=jr(t.lineWidth,{}),r.strokeStyle=jr(t.color,{}),r.fillStyle=jr(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?(function(n,i,o,s){let a=Eo(n);Hf(n,i,(c=>{Wf(n,c,o,s),(c=fo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Wf(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,i,o,s){let a=Eo(n);Hf(n,i,(c=>{$f(n,c,o,s),(c=fo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):$f(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Pr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof ImageData));case 1:return e.g.find((r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Km(e){var t=Pr(e,0);if(!t){t=Si(e);let r=fa(e),n=new Uint8Array(e.width*e.height*4);da(r,t,Rs(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),Nh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Rs(e){let t=Pr(e,2);if(!t){let r=Si(e);t=Ps(e);let n=Pr(e,1)||Km(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),mo(e)}return t}function Si(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=gt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function fa(e){return e.l||(e.l=new Di),e.l}function Ps(e){let t=Si(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Pr(e,2);return r||(r=dn(fa(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function mo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Gf(e){let t=Si(e);return Ro(fa(e),t,!0,(()=>(function(r,n){let i=r.canvas;if(i.width===r.width&&i.height===r.height)return n();let o=i.width,s=i.height;return i.width=r.width,i.height=r.height,r=n(),i.width=o,i.height=s,r})(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}St.prototype.close=St.prototype.close,St.prototype.drawConfidenceMask=St.prototype.wa,St.prototype.drawCategoryMask=St.prototype.va,St.prototype.drawBoundingBox=St.prototype.ua,St.prototype.drawConnectors=St.prototype.xa,St.prototype.drawLandmarks=St.prototype.ya,St.lerp=function(e,t,r,n,i){return Vf(n*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t)),n,i)},St.clamp=Vf;var lt=class{constructor(e,t,r,n,i,o,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=i,this.width=o,this.height=s,(this.j||this.m)&&--qf===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Pr(this,0)}ka(){return!!Pr(this,1)}P(){return!!Pr(this,2)}Ca(){return Km(this)}Ba(){var e=Pr(this,1);return e||(Rs(this),Ps(this),e=Gf(this),mo(this),this.g.push(e),this.j=!0),e}M(){return Rs(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Si(this),i=fa(this);n.activeTexture(n.TEXTURE1),r=dn(i,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),da(i,n,r),Ro(i,n,!1,(()=>{Ps(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),mo(this)})),Nh(i),mo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Rs(this),Ps(this),r=Gf(this),mo(this)}e.push(r)}return new lt(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Pr(this,1).close(),this.m&&Si(this).deleteTexture(Pr(this,2)),qf=-1}};lt.prototype.close=lt.prototype.close,lt.prototype.clone=lt.prototype.clone,lt.prototype.getAsWebGLTexture=lt.prototype.M,lt.prototype.getAsImageBitmap=lt.prototype.Ba,lt.prototype.getAsImageData=lt.prototype.Ca,lt.prototype.hasWebGLTexture=lt.prototype.P,lt.prototype.hasImageBitmap=lt.prototype.ka,lt.prototype.hasImageData=lt.prototype.Ea;var qf=250;function mr(...e){return e.map((([t,r])=>({start:t,end:r})))}var qb=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Kf=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Hm()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ee(this,n||"input_audio",(o=>{ee(this,i=i||"audio_header",(s=>{this.i._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Tr(this,"__graph_config__",(t=>{e(t)})),ee(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(e,this.g/4),ee(this,n,(s=>{this.i._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){ee(this,t,(n=>{let[i,o]=Ff(this,e,n);this.i._addBoundTextureToStream(n,i,o,r)}))}addBoolToStream(e,t,r){ee(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){ee(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){ee(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){ee(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){ee(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){ee(this,t,(n=>{ee(this,e,(i=>{this.i._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){ee(this,t,(n=>{Mf(this,Object.keys(e),(i=>{Mf(this,Object.values(e),(o=>{this.i._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){ee(this,r,(i=>{ee(this,t,(o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,o,i,n),this.i._free(s)}))}))}addEmptyPacketToStream(e,t){ee(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(i,o);this.i._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){ee(this,t,(n=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ee(this,o,(s=>{this.i._addStringVectorEntry(i,s)}));this.i._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){ee(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){ee(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){ee(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){ee(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){ee(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){ee(this,t,(r=>{ee(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){ee(this,r,(n=>{ee(this,t,(i=>{let o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputSidePacket(o,e.length,i,n),this.i._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){ee(this,t,(r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ee(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Tr(this,e,t),ee(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){nn(this,e,t),ee(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Tr(this,e,t),ee(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){nn(this,e,t),ee(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Tr(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),ee(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Kf{get ea(){return this.i}qa(e,t,r){ee(this,t,(n=>{let[i,o]=Ff(this,e,n);this.ea._addBoundTextureAsImageToStream(n,i,o,r)}))}U(e,t){Tr(this,e,t),ee(this,e,(r=>{this.ea._attachImageListener(r)}))}ca(e,t){nn(this,e,t),ee(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),Kf,Qt=class extends qb{};async function pe(e,t,r){return(async function(n,i,o,s){return Hb(n,i,o,s)})(e,r.canvas??(Hm()?void 0:document.createElement("canvas")),t,r)}function Xm(e,t,r,n){if(e.T){let o=new bm;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var i=r.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Y(o,1,(i.left+i.right)/2),Y(o,2,(i.top+i.bottom)/2),Y(o,4,i.right-i.left),Y(o,3,i.bottom-i.top)}else Y(o,1,.5),Y(o,2,.5),Y(o,4,1),Y(o,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(Y(o,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=Wm(t);r=Xe(o,3)*a/s,i=Xe(o,4)*s/a,Y(o,4,r),Y(o,3,i)}}e.g.addProtoToStream(o.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function er(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Xm(e,t,r,e.B+1)}function Or(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Xm(e,t,r,n)}function ki(e,t,r,n){var i=t.data;let o=t.width,s=o*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==s)throw Error("Unsupported channel count: "+i.length/s);return e=new it([i],r,!1,e.g.i.canvas,e.O,o,t),n?e.clone():e}var At=class extends Is{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Di}l(e,t=!0){if("runningMode"in e&&So(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};At.prototype.close=At.prototype.close;var Et=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},ne(e=this.h=new ca,0,1,t=new Ue),Y(this.h,2,.5),Y(this.h,3,.3)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},er(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Or(this,e,r,t),this.j}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect_in"),_e(e,"detections");let t=new Nt;dr(t,Ib,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect_in"),me(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=mm(o),this.j.detections.push(jm(n));X(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Et.prototype.detectForVideo=Et.prototype.F,Et.prototype.detect=Et.prototype.D,Et.prototype.setOptions=Et.prototype.o,Et.createFromModelPath=async function(e,t){return pe(Et,e,{baseOptions:{modelAssetPath:t}})},Et.createFromModelBuffer=function(e,t){return pe(Et,e,{baseOptions:{modelAssetBuffer:t}})},Et.createFromOptions=function(e,t){return pe(Et,e,t)};var jh=mr([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Vh=mr([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Hh=mr([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Jm=mr([474,475],[475,476],[476,477],[477,474]),Wh=mr([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),$h=mr([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Ym=mr([469,470],[470,471],[471,472],[472,469]),Gh=mr([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Zm=[...jh,...Vh,...Hh,...Wh,...$h,...Gh],Qm=mr([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Xf(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var We=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,ne(e=this.h=new km,0,1,t=new Ue),this.v=new Sm,ne(this.h,0,3,this.v),this.s=new ca,ne(this.h,0,2,this.s),Dr(this.s,4,1),Y(this.s,2,.5),Y(this.v,2,.5),Y(this.h,4,.5)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numFaces"in e&&Dr(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Y(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Y(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Xf(this),er(this,e,t),this.j}F(e,t,r){return Xf(this),Or(this,e,r,t),this.j}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"face_landmarks");let t=new Nt;dr(t,Pb,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.j.faceLandmarks.push(la(n));X(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{X(this,n)})),this.outputFaceBlendshapes&&(_e(e,"blendshapes"),me(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,i)=>{if(this.outputFaceBlendshapes)for(let o of n)n=aa(o),this.j.faceBlendshapes.push(Mh(n.g()??[]));X(this,i)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{X(this,n)}))),this.outputFacialTransformationMatrixes&&(_e(e,"face_geometry"),me(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,i)=>{if(this.outputFacialTransformationMatrixes)for(let o of n)(n=be(Rb(o),wb,2))&&this.j.facialTransformationMatrixes.push({rows:Xt(n,1)??0??0,columns:Xt(n,2)??0??0,data:Mn(n,3,pn,Fn()).slice()??[]});X(this,i)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{X(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.detectForVideo=We.prototype.F,We.prototype.detect=We.prototype.D,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=function(e,t){return pe(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return pe(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return pe(We,e,t)},We.FACE_LANDMARKS_LIPS=jh,We.FACE_LANDMARKS_LEFT_EYE=Vh,We.FACE_LANDMARKS_LEFT_EYEBROW=Hh,We.FACE_LANDMARKS_LEFT_IRIS=Jm,We.FACE_LANDMARKS_RIGHT_EYE=Wh,We.FACE_LANDMARKS_RIGHT_EYEBROW=$h,We.FACE_LANDMARKS_RIGHT_IRIS=Ym,We.FACE_LANDMARKS_FACE_OVAL=Gh,We.FACE_LANDMARKS_CONTOURS=Zm,We.FACE_LANDMARKS_TESSELATION=Qm;var Ir=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!0),ne(e=this.j=new Cm,0,1,t=new Ue)}get baseOptions(){return be(this.j,Ue,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,er(this,e,n??{}),!this.h)return this.s}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"stylized_image");let t=new Nt;dr(t,Db,this.j);let r=new yt;jt(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Vt(e,r),this.g.U("stylized_image",((n,i)=>{var o=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)l[4*h]=s[3*h],l[4*h+1]=s[3*h+1],l[4*h+2]=s[3*h+2],l[4*h+3]=255;s=new ImageData(l,a,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new lt([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=o=o?a.clone():a,this.h&&this.h(o),X(this,i)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ir.prototype.stylize=Ir.prototype.Oa,Ir.prototype.setOptions=Ir.prototype.o,Ir.createFromModelPath=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetPath:t}})},Ir.createFromModelBuffer=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetBuffer:t}})},Ir.createFromOptions=function(e,t){return pe(Ir,e,t)};var qh=mr([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Jf(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Yf(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Zf(e,t=!0){let r=[];for(let i of e){var n=aa(i);e=[];for(let o of n.g())n=t&&Xt(o,1)!=null?Xt(o,1)??0:-1,e.push({score:Xe(o,2)??0,index:n,categoryName:Yt(o,3)??""??"",displayName:Yt(o,4)??""??""});r.push(e)}return r}var Lt=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.j=new Tm,0,1,t=new Ue),this.s=new Oh,ne(this.j,0,2,this.s),this.C=new Dh,ne(this.s,0,3,this.C),this.v=new Am,ne(this.s,0,2,this.v),this.h=new Ob,ne(this.j,0,3,this.h),Y(this.v,2,.5),Y(this.s,4,.5),Y(this.C,2,.5)}get baseOptions(){return be(this.j,Ue,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){if(Dr(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&Y(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Y(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Y(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new si,r=t,n=Fl(e.cannedGesturesClassifierOptions,be(this.h,si,3)?.h());ne(r,0,2,n),ne(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&be(this.h,si,3)?.g();return e.customGesturesClassifierOptions?(ne(r=t=new si,0,2,n=Fl(e.customGesturesClassifierOptions,be(this.h,si,4)?.h())),ne(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&be(this.h,si,4)?.g(),this.l(e)}Ja(e,t){return Jf(this),er(this,e,t),Yf(this)}Ka(e,t,r){return Jf(this),Or(this,e,r,t),Yf(this)}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"hand_gestures"),_e(e,"hand_landmarks"),_e(e,"world_hand_landmarks"),_e(e,"handedness");let t=new Nt;dr(t,Bb,this.j);let r=new yt;jt(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"HAND_GESTURES:hand_gestures"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n){n=Io(o);let s=[];for(let a of qr(n,ym,1))s.push({x:Xe(a,1)??0,y:Xe(a,2)??0,z:Xe(a,3)??0,visibility:Xe(a,4)??0});this.landmarks.push(s)}X(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n){n=fi(o);let s=[];for(let a of qr(n,gm,1))s.push({x:Xe(a,1)??0,y:Xe(a,2)??0,z:Xe(a,3)??0,visibility:Xe(a,4)??0});this.worldLandmarks.push(s)}X(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,i)=>{this.gestures.push(...Zf(n,!1)),X(this,i)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{X(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{this.handedness.push(...Zf(n)),X(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Qf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Lt.prototype.recognizeForVideo=Lt.prototype.Ka,Lt.prototype.recognize=Lt.prototype.Ja,Lt.prototype.setOptions=Lt.prototype.o,Lt.createFromModelPath=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetPath:t}})},Lt.createFromModelBuffer=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetBuffer:t}})},Lt.createFromOptions=function(e,t){return pe(Lt,e,t)},Lt.HAND_CONNECTIONS=qh;var Ft=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.h=new Oh,0,1,t=new Ue),this.s=new Dh,ne(this.h,0,3,this.s),this.j=new Am,ne(this.h,0,2,this.j),Dr(this.j,3,1),Y(this.j,2,.5),Y(this.s,2,.5),Y(this.h,4,.5)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numHands"in e&&Dr(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&Y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Y(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],er(this,e,t),Qf(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Or(this,e,r,t),Qf(this)}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"hand_landmarks"),_e(e,"world_hand_landmarks"),_e(e,"handedness");let t=new Nt;dr(t,Lb,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.landmarks.push(la(n));X(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n)n=fi(o),this.worldLandmarks.push(_o(n));X(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{var o=this.handedness,s=o.push;let a=[];for(let c of n){n=aa(c);let l=[];for(let h of n.g())l.push({score:Xe(h,2)??0,index:Xt(h,1)??0??-1,categoryName:Yt(h,3)??""??"",displayName:Yt(h,4)??""??""});a.push(l)}s.call(o,...a),X(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.prototype.detectForVideo=Ft.prototype.F,Ft.prototype.detect=Ft.prototype.D,Ft.prototype.setOptions=Ft.prototype.o,Ft.createFromModelPath=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetPath:t}})},Ft.createFromModelBuffer=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetBuffer:t}})},Ft.createFromOptions=function(e,t){return pe(Ft,e,t)},Ft.HAND_CONNECTIONS=qh;var eg=mr([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function ep(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function tp(e){try{if(!e.C)return e.h;e.C(e.h)}finally{ua(e)}}function Cs(e,t){e=Io(e),t.push(la(e))}var Fe=class extends At{constructor(e,t){super(new Qt(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,ne(e=this.j=new Om,0,1,t=new Ue),this.J=new Dh,ne(this.j,0,2,this.J),this.Z=new Fb,ne(this.j,0,3,this.Z),this.s=new ca,ne(this.j,0,4,this.s),this.H=new Sm,ne(this.j,0,5,this.H),this.v=new Pm,ne(this.j,0,6,this.v),this.K=new Dm,ne(this.j,0,7,this.K),Y(this.s,2,.5),Y(this.s,3,.3),Y(this.H,2,.5),Y(this.v,2,.5),Y(this.v,3,.3),Y(this.K,2,.5),Y(this.J,2,.5)}get baseOptions(){return be(this.j,Ue,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&Y(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&Y(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&Y(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&Y(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&Y(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&Y(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&Y(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,ep(this),er(this,e,n),tp(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,ep(this),Or(this,e,i,t),tp(this)}m(){var e=new Tt;Oe(e,"input_frames_image"),_e(e,"pose_landmarks"),_e(e,"pose_world_landmarks"),_e(e,"face_landmarks"),_e(e,"left_hand_landmarks"),_e(e,"left_hand_world_landmarks"),_e(e,"right_hand_landmarks"),_e(e,"right_hand_world_landmarks");let t=new Nt,r=new vf;Il(r,1,xi("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(i,o){if(o!=null)if(Array.isArray(o))Te(i,2,Ap(o));else{if(!(typeof o=="string"||o instanceof $r||Co(o)))throw Error("invalid value in Any.value field: "+o+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Il(i,2,Jl(o,!1),zn())}})(r,this.j.g());let n=new yt;jt(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Ms(n,8,vf,r),Ie(n,"IMAGE:input_frames_image"),me(n,"POSE_LANDMARKS:pose_landmarks"),me(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),me(n,"FACE_LANDMARKS:face_landmarks"),me(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),me(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),me(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),me(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Vt(e,n),ha(this,e),this.g.attachProtoListener("pose_landmarks",((i,o)=>{Cs(i,this.h.poseLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("pose_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("pose_world_landmarks",((i,o)=>{var s=this.h.poseWorldLandmarks;i=fi(i),s.push(_o(i)),X(this,o)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(i=>{X(this,i)})),this.outputPoseSegmentationMasks&&(me(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),vi(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((i,o)=>{this.h.poseSegmentationMasks=[ki(this,i,!0,!this.C)],X(this,o)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(i=>{this.h.poseSegmentationMasks=[],X(this,i)}))),this.g.attachProtoListener("face_landmarks",((i,o)=>{Cs(i,this.h.faceLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(i=>{X(this,i)})),this.outputFaceBlendshapes&&(_e(e,"extra_blendshapes"),me(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((i,o)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(i=aa(i),s.push(Mh(i.g()??[]))),X(this,o)})),this.g.attachEmptyPacketListener("extra_blendshapes",(i=>{X(this,i)}))),this.g.attachProtoListener("left_hand_landmarks",((i,o)=>{Cs(i,this.h.leftHandLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("left_hand_world_landmarks",((i,o)=>{var s=this.h.leftHandWorldLandmarks;i=fi(i),s.push(_o(i)),X(this,o)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("right_hand_landmarks",((i,o)=>{Cs(i,this.h.rightHandLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("right_hand_world_landmarks",((i,o)=>{var s=this.h.rightHandWorldLandmarks;i=fi(i),s.push(_o(i)),X(this,o)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(i=>{X(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.prototype.detectForVideo=Fe.prototype.F,Fe.prototype.detect=Fe.prototype.D,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return pe(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return pe(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return pe(Fe,e,t)},Fe.HAND_CONNECTIONS=qh,Fe.POSE_CONNECTIONS=eg,Fe.FACE_LANDMARKS_LIPS=jh,Fe.FACE_LANDMARKS_LEFT_EYE=Vh,Fe.FACE_LANDMARKS_LEFT_EYEBROW=Hh,Fe.FACE_LANDMARKS_LEFT_IRIS=Jm,Fe.FACE_LANDMARKS_RIGHT_EYE=Wh,Fe.FACE_LANDMARKS_RIGHT_EYEBROW=$h,Fe.FACE_LANDMARKS_RIGHT_IRIS=Ym,Fe.FACE_LANDMARKS_FACE_OVAL=Gh,Fe.FACE_LANDMARKS_CONTOURS=Zm,Fe.FACE_LANDMARKS_TESSELATION=Qm;var qt=class extends At{constructor(e,t){super(new Qt(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},ne(e=this.h=new Bm,0,1,t=new Ue)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return ne(this.h,0,2,Fl(e,be(this.h,Ih,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},er(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Or(this,e,r,t),this.j}m(){var e=new Tt;Oe(e,"input_image"),Oe(e,"norm_rect"),_e(e,"classifications");let t=new Nt;dr(t,Mb,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Ie(r,"IMAGE:input_image"),Ie(r,"NORM_RECT:norm_rect"),me(r,"CLASSIFICATIONS:classifications"),r.o(t),Vt(e,r),this.g.attachProtoListener("classifications",((n,i)=>{this.j=(function(o){let s={classifications:qr(o,kb,1).map((a=>Mh(be(a,fm,4)?.g()??[],Xt(a,2)??0,Yt(a,3)??"")))};return Fs(bi(o,2))!=null&&(s.timestampMs=Fs(bi(o,2))??0),s})(Eb(n)),X(this,i)})),this.g.attachEmptyPacketListener("classifications",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};qt.prototype.classifyForVideo=qt.prototype.ta,qt.prototype.classify=qt.prototype.sa,qt.prototype.setOptions=qt.prototype.o,qt.createFromModelPath=function(e,t){return pe(qt,e,{baseOptions:{modelAssetPath:t}})},qt.createFromModelBuffer=function(e,t){return pe(qt,e,{baseOptions:{modelAssetBuffer:t}})},qt.createFromOptions=function(e,t){return pe(qt,e,t)};var Mt=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!0),this.h=new Lm,this.embeddings={embeddings:[]},ne(e=this.h,0,1,t=new Ue)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){var t=this.h,r=be(this.h,If,2);return r=r?r.clone():new If,e.l2Normalize!==void 0?So(r,1,e.l2Normalize):"l2Normalize"in e&&Te(r,1),e.quantize!==void 0?So(r,2,e.quantize):"quantize"in e&&Te(r,2),ne(t,0,2,r),this.l(e)}za(e,t){return er(this,e,t),this.embeddings}Aa(e,t,r){return Or(this,e,r,t),this.embeddings}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"embeddings_out");let t=new Nt;dr(t,Ub,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"EMBEDDINGS:embeddings_out"),r.o(t),Vt(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=Ab(n),this.embeddings=(function(o){return{embeddings:qr(o,xb,1).map((s=>{let a={headIndex:Xt(s,3)??0??-1,headName:Yt(s,4)??""??""};if(Dp(s,Tf,gl(s,1))!==void 0)s=Mn(s=be(s,Tf,gl(s,1)),1,pn,Fn()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=be(s,Cb,gl(s,2))?.oa()?.h()??c}return a})),timestampMs:Fs(bi(o,2))??0}})(n),X(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mt.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Bf(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Bf(Of(e.quantizedEmbedding),Of(t.quantizedEmbedding))}return e},Mt.prototype.embedForVideo=Mt.prototype.Aa,Mt.prototype.embed=Mt.prototype.za,Mt.prototype.setOptions=Mt.prototype.o,Mt.createFromModelPath=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetPath:t}})},Mt.createFromModelBuffer=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetBuffer:t}})},Mt.createFromOptions=function(e,t){return pe(Mt,e,t)};var zl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function rp(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function np(e){try{let t=new zl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{ua(e)}}zl.prototype.close=zl.prototype.close;var kt=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fh,this.v=new Fm,ne(this.h,0,3,this.v),ne(e=this.h,0,1,t=new Ue)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Te(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&Te(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=qr(e.da(),yt,1).filter((r=>(Yt(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(be(t[0],Nt,7)?.l()?.g()??new Map).forEach(((r,n)=>{e.s[Number(n)]=Yt(r,1)??""}))})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,rp(this),er(this,e,n),np(this)}Ma(e,t,r,n){let i=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,rp(this),Or(this,e,i,t),np(this)}Da(){return this.s}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect");let t=new Nt;dr(t,Um,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),r.o(t),Vt(e,r),ha(this,e),this.outputConfidenceMasks&&(_e(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),vi(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),X(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],X(this,n)}))),this.outputCategoryMask&&(_e(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),vi(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),X(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,X(this,n)}))),_e(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,X(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};kt.prototype.getLabels=kt.prototype.Da,kt.prototype.segmentForVideo=kt.prototype.Ma,kt.prototype.segment=kt.prototype.segment,kt.prototype.setOptions=kt.prototype.o,kt.createFromModelPath=function(e,t){return pe(kt,e,{baseOptions:{modelAssetPath:t}})},kt.createFromModelBuffer=function(e,t){return pe(kt,e,{baseOptions:{modelAssetBuffer:t}})},kt.createFromOptions=function(e,t){return pe(kt,e,t)};var jl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};jl.prototype.close=jl.prototype.close;var Kb=class extends J{constructor(e){super(e)}},ai=[0,Ge,-2],js=[0,Vr,-3,Me,Vr,-1],ip=[0,js],op=[0,js,Ge,-1],kl=class extends J{constructor(e){super(e)}},sp=[0,Vr,-1,Me],Xb=class extends J{constructor(e){super(e)}},ap=class extends J{constructor(e){super(e)}},Vl=[1,2,3,4,5,6,7,8,9,10,14,15],tg=class extends J{constructor(e){super(e)}};tg.prototype.g=sa([0,ot,[0,Vl,ke,js,ke,[0,js,ai],ke,ip,ke,[0,ip,ai],ke,sp,ke,[0,Vr,-3,Me,Zt],ke,[0,Vr,-3,Me],ke,[0,we,Vr,-2,Me,Ge,Me,-1,2,Vr,ai],ke,op,ke,[0,op,ai],Vr,ai,we,ke,[0,Vr,-3,Me,ai,-1],ke,[0,ot,sp]],we,[0,we,Ge,-1,Me]]);var Rr=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fh,this.s=new Fm,ne(this.h,0,3,this.s),ne(e=this.h,0,1,t=new Ue)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let i=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new tg;let o=new ap;var s=new Kb;if(Dr(s,1,255),ne(o,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new kl;So(a,3,!0),Y(a,1,t.keypoint.x),Y(a,2,t.keypoint.y),yo(o,5,Vl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new Xb,t.scribble))So(t=new kl,3,!0),Y(t,1,a.x),Y(t,2,a.y),Ms(s,1,kl,t);yo(o,15,Vl,s)}Ms(n,1,ap,o),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),er(this,e,i);e:{try{let l=new jl(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{ua(this)}c=void 0}return c}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"roi_in"),Oe(e,"norm_rect_in");let t=new Nt;dr(t,Um,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"ROI:roi_in"),Ie(r,"NORM_RECT:norm_rect_in"),r.o(t),Vt(e,r),ha(this,e),this.outputConfidenceMasks&&(_e(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),vi(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),X(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],X(this,n)}))),this.outputCategoryMask&&(_e(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),vi(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),X(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,X(this,n)}))),_e(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,X(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Rr.prototype.segment=Rr.prototype.segment,Rr.prototype.setOptions=Rr.prototype.o,Rr.createFromModelPath=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetPath:t}})},Rr.createFromModelBuffer=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetBuffer:t}})},Rr.createFromOptions=function(e,t){return pe(Rr,e,t)};var Ct=class extends At{constructor(e,t){super(new Qt(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},ne(e=this.h=new Nm,0,1,t=new Ue)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Te(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&Te(this.h,2),e.maxResults!==void 0?Dr(this.h,3,e.maxResults):"maxResults"in e&&Te(this.h,3),e.scoreThreshold!==void 0?Y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Te(this.h,4),e.categoryAllowlist!==void 0?Us(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Te(this.h,5),e.categoryDenylist!==void 0?Us(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Te(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},er(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Or(this,e,r,t),this.j}m(){var e=new Tt;Oe(e,"input_frame_gpu"),Oe(e,"norm_rect"),_e(e,"detections");let t=new Nt;dr(t,zb,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),Ie(r,"IMAGE:input_frame_gpu"),Ie(r,"NORM_RECT:norm_rect"),me(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=mm(o),this.j.detections.push(jm(n));X(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ct.prototype.detectForVideo=Ct.prototype.F,Ct.prototype.detect=Ct.prototype.D,Ct.prototype.setOptions=Ct.prototype.o,Ct.createFromModelPath=async function(e,t){return pe(Ct,e,{baseOptions:{modelAssetPath:t}})},Ct.createFromModelBuffer=function(e,t){return pe(Ct,e,{baseOptions:{modelAssetBuffer:t}})},Ct.createFromOptions=function(e,t){return pe(Ct,e,t)};var Hl=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function cp(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function lp(e){try{let t=new Hl(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{ua(e)}}Hl.prototype.close=Hl.prototype.close;var Ut=class extends At{constructor(e,t){super(new Qt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,ne(e=this.h=new zm,0,1,t=new Ue),this.v=new Dm,ne(this.h,0,3,this.v),this.j=new Pm,ne(this.h,0,2,this.j),Dr(this.j,4,1),Y(this.j,2,.5),Y(this.v,2,.5),Y(this.h,4,.5)}get baseOptions(){return be(this.h,Ue,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numPoses"in e&&Dr(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Y(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,cp(this),er(this,e,n),lp(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,cp(this),Or(this,e,i,t),lp(this)}m(){var e=new Tt;Oe(e,"image_in"),Oe(e,"norm_rect"),_e(e,"normalized_landmarks"),_e(e,"world_landmarks"),_e(e,"segmentation_masks");let t=new Nt;dr(t,jb,this.h);let r=new yt;jt(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Ie(r,"IMAGE:image_in"),Ie(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:normalized_landmarks"),me(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Vt(e,r),ha(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,i)=>{this.landmarks=[];for(let o of n)n=Io(o),this.landmarks.push(la(n));X(this,i)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],X(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,i)=>{this.worldLandmarks=[];for(let o of n)n=fi(o),this.worldLandmarks.push(_o(n));X(this,i)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],X(this,n)})),this.outputSegmentationMasks&&(me(r,"SEGMENTATION_MASK:segmentation_masks"),vi(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,i)=>{this.segmentationMasks=n.map((o=>ki(this,o,!0,!this.s))),X(this,i)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],X(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ut.prototype.detectForVideo=Ut.prototype.F,Ut.prototype.detect=Ut.prototype.D,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return pe(Ut,e,t)},Ut.POSE_CONNECTIONS=eg;var Oi=class{constructor(t,r,n,i,o="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=o,this.classDiv=s,i&&(this.paramsConfig=i),n&&(this.options=n)}async initializeDetector(){let t=await on.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Et:Ct).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
49
50
  width: 20rem;
50
51
  border-radius: 10px;
51
52
  position: absolute;
52
53
  top: 0;
53
54
  display: none;
54
- `),this.video.muted=!0,document.body.appendChild(this.video),this.createdVideo=!0),t&&!this.video.srcObject&&(this.video.srcObject=t),this.video.play();let r=this;this.video?.addEventListener("loadeddata",()=>r.predictWebcam());let n=document.createElement("style");n.type="text/css",n.innerHTML=`
55
+ `),this.video.muted=!0,document.body.appendChild(this.video),this.createdVideo=!0),t&&!this.video.srcObject&&(this.video.srcObject=t),this.video.play(),this.startTime=new Date(Date.now());let r=this;this.video?.addEventListener("loadeddata",()=>r.predictWebcam());let n=document.createElement("style");n.type="text/css",n.innerHTML=`
55
56
  .key-point {
56
57
  position: absolute;
57
58
  z-index: 1;
@@ -62,25 +63,28 @@ Minimum version required to store current data is: `+i+`.
62
63
  border-radius: 50%;
63
64
  display: block;
64
65
  }
65
- `,document.getElementsByTagName("head")[0].appendChild(n)}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime()}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime()}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";default:return t}}};function Hm(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Xn=class extends Kn{constructor(r,n,o="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,o,i);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_ok","face_detection_on_stream")}displayVideoDetections(r){for(let n of this.children)this.liveView.removeChild(n);this.children.splice(0);for(let n of r.detections){let o=window.innerWidth,i=window.innerHeight,s=this.video.offsetWidth,a=this.video.offsetHeight,c=s/o,l=a/i,h=s-n.boundingBox.width*c-n.boundingBox.originX*c,d=n.boundingBox.originY*l,u=(n.boundingBox.width-10)*c,b=n.boundingBox.height*l,m=document.createElement("p");m.innerText="Confidence: "+Math.round(parseFloat(n.categories[0].score)*100)+"% .",m.style.right=h+"px",m.style.top=d-50+"px",m.style.width=u+"px";let f={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(m.style,{...f,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let y=document.createElement("div");y.setAttribute("class","highlighter"),y.style.right=h+"px",y.style.top=d+"px",y.style.width=u+"px",y.style.height=b-10+"px",Object.assign(y.style,{...f,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(m),this.children.push(y),this.children.push(m);for(let v of n.keypoints){let _=document.createElement("spam");_.className="key-point",_.style.top=`${v.y*this.video.offsetHeight-3}px`,_.style.right=`${this.video.offsetWidth-v.x*this.video.offsetWidth-3}px`,this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=r.detections[0].boundingBox,o=document.getElementById(this.classVideo),i=o.videoWidth,s=o.videoHeight,a=!1;i>s&&(n.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),a=!0,this.emmitedPositionAlert=!0):n.width/i>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0));let c=[n.originX,n.originY],l=[n.originX+n.width,n.originY+n.height];(c[0]<.1*n.width||c[1]<.2*n.height||l[0]>i-.1*n.width||l[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0);let h=c[0],d=i-l[0],u=c[1],b=s-l[1];h>2*d&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),u>4*b&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),d>2*h&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),b>3*u&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),a==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Zo(e,t){return function(){return e.apply(t,arguments)}}var{toString:qb}=Object.prototype,{getPrototypeOf:Eh}=Object,$s=(e=>t=>{let r=qb.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),At=e=>(e=e.toLowerCase(),t=>$s(t)===e),qs=e=>t=>typeof t===e,{isArray:Jn}=Array,ei=qs("undefined");function Gb(e){return e!==null&&!ei(e)&&e.constructor!==null&&!ei(e.constructor)&&rt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Wm=At("ArrayBuffer");function Kb(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Wm(e.buffer),t}var Xb=qs("string"),rt=qs("function"),$m=qs("number"),Gs=e=>e!==null&&typeof e=="object",Jb=e=>e===!0||e===!1,Ws=e=>{if($s(e)!=="object")return!1;let t=Eh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Yb=At("Date"),Qb=At("File"),Zb=At("Blob"),e3=At("FileList"),t3=e=>Gs(e)&&rt(e.pipe),r3=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||rt(e.append)&&((t=$s(e))==="formdata"||t==="object"&&rt(e.toString)&&e.toString()==="[object FormData]"))},n3=At("URLSearchParams"),[o3,i3,s3,a3]=["ReadableStream","Request","Response","Headers"].map(At),c3=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ti(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),Jn(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{let i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length,a;for(n=0;n<s;n++)a=i[n],t.call(null,e[a],a,e)}}function qm(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}var Jr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gm=e=>!ei(e)&&e!==Jr;function kh(){let{caseless:e}=Gm(this)&&this||{},t={},r=(n,o)=>{let i=e&&qm(t,o)||o;Ws(t[i])&&Ws(n)?t[i]=kh(t[i],n):Ws(n)?t[i]=kh({},n):Jn(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&ti(arguments[n],r);return t}var l3=(e,t,r,{allOwnKeys:n}={})=>(ti(t,(o,i)=>{r&&rt(o)?e[i]=Zo(o,r):e[i]=o},{allOwnKeys:n}),e),h3=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),d3=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},u3=(e,t,r,n)=>{let o,i,s,a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Eh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},p3=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},f3=e=>{if(!e)return null;if(Jn(e))return e;let t=e.length;if(!$m(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},m3=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Eh(Uint8Array)),g3=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),o;for(;(o=n.next())&&!o.done;){let i=o.value;t.call(e,i[0],i[1])}},y3=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},b3=At("HTMLFormElement"),v3=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),zm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),w3=At("RegExp"),Km=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};ti(r,(o,i)=>{let s;(s=t(o,i,e))!==!1&&(n[i]=s||o)}),Object.defineProperties(e,n)},_3=e=>{Km(e,(t,r)=>{if(rt(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(rt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},S3=(e,t)=>{let r={},n=o=>{o.forEach(i=>{r[i]=!0})};return Jn(e)?n(e):n(String(e).split(t)),r},k3=()=>{},E3=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function C3(e){return!!(e&&rt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var x3=e=>{let t=new Array(10),r=(n,o)=>{if(Gs(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let i=Jn(n)?[]:{};return ti(n,(s,a)=>{let c=r(s,o+1);!ei(c)&&(i[a]=c)}),t[o]=void 0,i}}return n};return r(e,0)},A3=At("AsyncFunction"),T3=e=>e&&(Gs(e)||rt(e))&&rt(e.then)&&rt(e.catch),Xm=((e,t)=>e?setImmediate:t?((r,n)=>(Jr.addEventListener("message",({source:o,data:i})=>{o===Jr&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),Jr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",rt(Jr.postMessage)),I3=typeof queueMicrotask<"u"?queueMicrotask.bind(Jr):typeof process<"u"&&process.nextTick||Xm,p={isArray:Jn,isArrayBuffer:Wm,isBuffer:Gb,isFormData:r3,isArrayBufferView:Kb,isString:Xb,isNumber:$m,isBoolean:Jb,isObject:Gs,isPlainObject:Ws,isReadableStream:o3,isRequest:i3,isResponse:s3,isHeaders:a3,isUndefined:ei,isDate:Yb,isFile:Qb,isBlob:Zb,isRegExp:w3,isFunction:rt,isStream:t3,isURLSearchParams:n3,isTypedArray:m3,isFileList:e3,forEach:ti,merge:kh,extend:l3,trim:c3,stripBOM:h3,inherits:d3,toFlatObject:u3,kindOf:$s,kindOfTest:At,endsWith:p3,toArray:f3,forEachEntry:g3,matchAll:y3,isHTMLForm:b3,hasOwnProperty:zm,hasOwnProp:zm,reduceDescriptors:Km,freezeMethods:_3,toObjectSet:S3,toCamelCase:v3,noop:k3,toFiniteNumber:E3,findKey:qm,global:Jr,isContextDefined:Gm,isSpecCompliantForm:C3,toJSONObject:x3,isAsyncFn:A3,isThenable:T3,setImmediate:Xm,asap:I3};function Yn(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(Yn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});var Jm=Yn.prototype,Ym={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ym[e]={value:e}});Object.defineProperties(Yn,Ym);Object.defineProperty(Jm,"isAxiosError",{value:!0});Yn.from=(e,t,r,n,o,i)=>{let s=Object.create(Jm);return p.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Yn.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};var P=Yn;var Ks=null;function Ch(e){return p.isPlainObject(e)||p.isArray(e)}function Zm(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function Qm(e,t,r){return e?e.concat(t).map(function(o,i){return o=Zm(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function P3(e){return p.isArray(e)&&!e.some(Ch)}var R3=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function D3(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new(Ks||FormData),r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,y){return!p.isUndefined(y[f])});let n=r.metaTokens,o=r.visitor||h,i=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(p.isDate(m))return m.toISOString();if(!c&&p.isBlob(m))throw new P("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(m)||p.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function h(m,f,y){let v=m;if(m&&!y&&typeof m=="object"){if(p.endsWith(f,"{}"))f=n?f:f.slice(0,-2),m=JSON.stringify(m);else if(p.isArray(m)&&P3(m)||(p.isFileList(m)||p.endsWith(f,"[]"))&&(v=p.toArray(m)))return f=Zm(f),v.forEach(function(x,B){!(p.isUndefined(x)||x===null)&&t.append(s===!0?Qm([f],B,i):s===null?f:f+"[]",l(x))}),!1}return Ch(m)?!0:(t.append(Qm(y,f,i),l(m)),!1)}let d=[],u=Object.assign(R3,{defaultVisitor:h,convertValue:l,isVisitable:Ch});function b(m,f){if(!p.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(m),p.forEach(m,function(v,_){(!(p.isUndefined(v)||v===null)&&o.call(t,v,p.isString(_)?_.trim():_,f,u))===!0&&b(v,f?f.concat(_):[_])}),d.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return b(e),t}var kr=D3;function eg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function tg(e,t){this._pairs=[],e&&kr(e,this,t)}var rg=tg.prototype;rg.append=function(t,r){this._pairs.push([t,r])};rg.toString=function(t){let r=t?function(n){return t.call(this,n,eg)}:eg;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Xs=tg;function O3(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ri(e,t,r){if(!t)return e;let n=r&&r.encode||O3;p.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize,i;if(o?i=o(t,r):i=p.isURLSearchParams(t)?t.toString():new Xs(t,r).toString(n),i){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var xh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(n){n!==null&&t(n)})}},Ah=xh;var Js={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ng=typeof URLSearchParams<"u"?URLSearchParams:Xs;var og=typeof FormData<"u"?FormData:null;var ig=typeof Blob<"u"?Blob:null;var sg={isBrowser:!0,classes:{URLSearchParams:ng,FormData:og,Blob:ig},protocols:["http","https","file","blob","url","data"]};var Ph={};vy(Ph,{hasBrowserEnv:()=>Ih,hasStandardBrowserEnv:()=>B3,hasStandardBrowserWebWorkerEnv:()=>M3,navigator:()=>Th,origin:()=>L3});var Ih=typeof window<"u"&&typeof document<"u",Th=typeof navigator=="object"&&navigator||void 0,B3=Ih&&(!Th||["ReactNative","NativeScript","NS"].indexOf(Th.product)<0),M3=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",L3=Ih&&window.location.href||"http://localhost";var oe={...Ph,...sg};function Rh(e,t){return kr(e,new oe.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return oe.isNode&&p.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function F3(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function U3(e){let t={},r=Object.keys(e),n,o=r.length,i;for(n=0;n<o;n++)i=r[n],t[i]=e[i];return t}function N3(e){function t(r,n,o,i){let s=r[i++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=i>=r.length;return s=!s&&p.isArray(o)?o.length:s,c?(p.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!a):((!o[s]||!p.isObject(o[s]))&&(o[s]=[]),t(r,n,o[s],i)&&p.isArray(o[s])&&(o[s]=U3(o[s])),!a)}if(p.isFormData(e)&&p.isFunction(e.entries)){let r={};return p.forEachEntry(e,(n,o)=>{t(F3(n),o,r,0)}),r}return null}var Ys=N3;function j3(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Dh={transitional:Js,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=p.isObject(t);if(i&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Ys(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Rh(t,this.formSerializer).toString();if((a=p.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return kr(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),j3(t)):t}],transformResponse:[function(t){let r=this.transitional||Dh.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(n&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?P.from(a,P.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oe.classes.FormData,Blob:oe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Dh.headers[e]={}});var Qn=Dh;var V3=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ag=e=>{let t={},r,n,o;return e&&e.split(`
66
- `).forEach(function(s){o=s.indexOf(":"),r=s.substring(0,o).trim().toLowerCase(),n=s.substring(o+1).trim(),!(!r||t[r]&&V3[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var cg=Symbol("internals");function ni(e){return e&&String(e).trim().toLowerCase()}function Qs(e){return e===!1||e==null?e:p.isArray(e)?e.map(Qs):String(e)}function H3(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var z3=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Oh(e,t,r,n,o){if(p.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!p.isString(t)){if(p.isString(n))return t.indexOf(n)!==-1;if(p.isRegExp(n))return n.test(t)}}function W3(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function $3(e,t){let r=p.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,i,s){return this[n].call(this,t,o,i,s)},configurable:!0})})}var Zn=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function i(a,c,l){let h=ni(c);if(!h)throw new Error("header name must be a non-empty string");let d=p.findKey(o,h);(!d||o[d]===void 0||l===!0||l===void 0&&o[d]!==!1)&&(o[d||c]=Qs(a))}let s=(a,c)=>p.forEach(a,(l,h)=>i(l,h,c));if(p.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(p.isString(t)&&(t=t.trim())&&!z3(t))s(ag(t),r);else if(p.isHeaders(t))for(let[a,c]of t.entries())i(c,a,n);else t!=null&&i(r,t,n);return this}get(t,r){if(t=ni(t),t){let n=p.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return H3(o);if(p.isFunction(r))return r.call(this,o,n);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ni(t),t){let n=p.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Oh(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function i(s){if(s=ni(s),s){let a=p.findKey(n,s);a&&(!r||Oh(n,n[a],a,r))&&(delete n[a],o=!0)}}return p.isArray(t)?t.forEach(i):i(t),o}clear(t){let r=Object.keys(this),n=r.length,o=!1;for(;n--;){let i=r[n];(!t||Oh(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){let r=this,n={};return p.forEach(this,(o,i)=>{let s=p.findKey(n,i);if(s){r[s]=Qs(o),delete r[i];return}let a=t?W3(i):String(i).trim();a!==i&&delete r[i],r[a]=Qs(o),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return p.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&p.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
67
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){let n=(this[cg]=this[cg]={accessors:{}}).accessors,o=this.prototype;function i(s){let a=ni(s);n[a]||($3(o,s),n[a]=!0)}return p.isArray(t)?t.forEach(i):i(t),this}};Zn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(Zn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});p.freezeMethods(Zn);var ke=Zn;function oi(e,t){let r=this||Qn,n=t||r,o=ke.from(n.headers),i=n.data;return p.forEach(e,function(a){i=a.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ii(e){return!!(e&&e.__CANCEL__)}function lg(e,t,r){P.call(this,e??"canceled",P.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(lg,P,{__CANCEL__:!0});var Ht=lg;function si(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new P("Request failed with status code "+r.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Bh(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function q3(e,t){e=e||10;let r=new Array(e),n=new Array(e),o=0,i=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),h=n[i];s||(s=l),r[o]=c,n[o]=l;let d=i,u=0;for(;d!==o;)u+=r[d++],d=d%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),l-s<t)return;let b=h&&l-h;return b?Math.round(u*1e3/b):void 0}}var hg=q3;function G3(e,t){let r=0,n=1e3/t,o,i,s=(l,h=Date.now())=>{r=h,o=null,i&&(clearTimeout(i),i=null),e.apply(null,l)};return[(...l)=>{let h=Date.now(),d=h-r;d>=n?s(l,h):(o=l,i||(i=setTimeout(()=>{i=null,s(o)},n-d)))},()=>o&&s(o)]}var dg=G3;var eo=(e,t,r=3)=>{let n=0,o=hg(50,250);return dg(i=>{let s=i.loaded,a=i.lengthComputable?i.total:void 0,c=s-n,l=o(c),h=s<=a;n=s;let d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},Mh=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Lh=e=>(...t)=>p.asap(()=>e(...t));var ug=oe.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,oe.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(oe.origin),oe.navigator&&/(msie|trident)/i.test(oe.navigator.userAgent)):()=>!0;var pg=oe.hasStandardBrowserEnv?{write(e,t,r,n,o,i){let s=[e+"="+encodeURIComponent(t)];p.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),p.isString(n)&&s.push("path="+n),p.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Fh(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Uh(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ai(e,t,r){let n=!Fh(t);return e&&(n||r==!1)?Uh(e,t):t}var fg=e=>e instanceof ke?{...e}:e;function Tt(e,t){t=t||{};let r={};function n(l,h,d,u){return p.isPlainObject(l)&&p.isPlainObject(h)?p.merge.call({caseless:u},l,h):p.isPlainObject(h)?p.merge({},h):p.isArray(h)?h.slice():h}function o(l,h,d,u){if(p.isUndefined(h)){if(!p.isUndefined(l))return n(void 0,l,d,u)}else return n(l,h,d,u)}function i(l,h){if(!p.isUndefined(h))return n(void 0,h)}function s(l,h){if(p.isUndefined(h)){if(!p.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function a(l,h,d){if(d in t)return n(l,h);if(d in e)return n(void 0,l)}let c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,h,d)=>o(fg(l),fg(h),d,!0)};return p.forEach(Object.keys(Object.assign({},e,t)),function(h){let d=c[h]||o,u=d(e[h],t[h],h);p.isUndefined(u)&&d!==a||(r[h]=u)}),r}var Zs=e=>{let t=Tt({},e),{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;t.headers=s=ke.from(s),t.url=ri(ai(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(p.isFormData(r)){if(oe.hasStandardBrowserEnv||oe.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...h]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...h].join("; "))}}if(oe.hasStandardBrowserEnv&&(n&&p.isFunction(n)&&(n=n(t)),n||n!==!1&&ug(t.url))){let l=o&&i&&pg.read(i);l&&s.set(o,l)}return t};var K3=typeof XMLHttpRequest<"u",mg=K3&&function(e){return new Promise(function(r,n){let o=Zs(e),i=o.data,s=ke.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,h,d,u,b,m;function f(){b&&b(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(h),o.signal&&o.signal.removeEventListener("abort",h)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function v(){if(!y)return;let x=ke.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};si(function(ue){r(ue),f()},function(ue){n(ue),f()},O),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(v)},y.onabort=function(){y&&(n(new P("Request aborted",P.ECONNABORTED,e,y)),y=null)},y.onerror=function(){n(new P("Network Error",P.ERR_NETWORK,e,y)),y=null},y.ontimeout=function(){let B=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",O=o.transitional||Js;o.timeoutErrorMessage&&(B=o.timeoutErrorMessage),n(new P(B,O.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,y)),y=null},i===void 0&&s.setContentType(null),"setRequestHeader"in y&&p.forEach(s.toJSON(),function(B,O){y.setRequestHeader(O,B)}),p.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),l&&([u,m]=eo(l,!0),y.addEventListener("progress",u)),c&&y.upload&&([d,b]=eo(c),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",b)),(o.cancelToken||o.signal)&&(h=x=>{y&&(n(!x||x.type?new Ht(null,e,y):x),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(h),o.signal&&(o.signal.aborted?h():o.signal.addEventListener("abort",h)));let _=Bh(o.url);if(_&&oe.protocols.indexOf(_)===-1){n(new P("Unsupported protocol "+_+":",P.ERR_BAD_REQUEST,e));return}y.send(i||null)})};var X3=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o,i=function(l){if(!o){o=!0,a();let h=l instanceof Error?l:this.reason;n.abort(h instanceof P?h:new Ht(h instanceof Error?h.message:h))}},s=t&&setTimeout(()=>{s=null,i(new P(`timeout ${t} of ms exceeded`,P.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i));let{signal:c}=n;return c.unsubscribe=()=>p.asap(a),c}},gg=X3;var J3=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},Y3=async function*(e,t){for await(let r of Q3(e))yield*J3(r,t)},Q3=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Nh=(e,t,r,n)=>{let o=Y3(e,t),i=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:h}=await o.next();if(l){a(),c.close();return}let d=h.byteLength;if(r){let u=i+=d;r(u)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var ta=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bg=ta&&typeof ReadableStream=="function",Z3=ta&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),vg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},e4=bg&&vg(()=>{let e=!1,t=new Request(oe.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),yg=64*1024,jh=bg&&vg(()=>p.isReadableStream(new Response("").body)),ea={stream:jh&&(e=>e.body)};ta&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ea[t]&&(ea[t]=p.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new P(`Response type '${t}' is not supported`,P.ERR_NOT_SUPPORT,n)})})})(new Response);var t4=async e=>{if(e==null)return 0;if(p.isBlob(e))return e.size;if(p.isSpecCompliantForm(e))return(await new Request(oe.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(p.isArrayBufferView(e)||p.isArrayBuffer(e))return e.byteLength;if(p.isURLSearchParams(e)&&(e=e+""),p.isString(e))return(await Z3(e)).byteLength},r4=async(e,t)=>{let r=p.toFiniteNumber(e.getContentLength());return r??t4(t)},wg=ta&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:d="same-origin",fetchOptions:u}=Zs(e);l=l?(l+"").toLowerCase():"text";let b=gg([o,i&&i.toAbortSignal()],s),m,f=b&&b.unsubscribe&&(()=>{b.unsubscribe()}),y;try{if(c&&e4&&r!=="get"&&r!=="head"&&(y=await r4(h,n))!==0){let O=new Request(t,{method:"POST",body:n,duplex:"half"}),R;if(p.isFormData(n)&&(R=O.headers.get("content-type"))&&h.setContentType(R),O.body){let[ue,se]=Mh(y,eo(Lh(c)));n=Nh(O.body,yg,ue,se)}}p.isString(d)||(d=d?"include":"omit");let v="credentials"in Request.prototype;m=new Request(t,{...u,signal:b,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:v?d:void 0});let _=await fetch(m),x=jh&&(l==="stream"||l==="response");if(jh&&(a||x&&f)){let O={};["status","statusText","headers"].forEach(jr=>{O[jr]=_[jr]});let R=p.toFiniteNumber(_.headers.get("content-length")),[ue,se]=a&&Mh(R,eo(Lh(a),!0))||[];_=new Response(Nh(_.body,yg,ue,()=>{se&&se(),f&&f()}),O)}l=l||"text";let B=await ea[p.findKey(ea,l)||"text"](_,e);return!x&&f&&f(),await new Promise((O,R)=>{si(O,R,{data:B,headers:ke.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:m})})}catch(v){throw f&&f(),v&&v.name==="TypeError"&&/fetch/i.test(v.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,e,m),{cause:v.cause||v}):P.from(v,v&&v.code,e,m)}});var Vh={http:Ks,xhr:mg,fetch:wg};p.forEach(Vh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var _g=e=>`- ${e}`,n4=e=>p.isFunction(e)||e===null||e===!1,ra={getAdapter:e=>{e=p.isArray(e)?e:[e];let{length:t}=e,r,n,o={};for(let i=0;i<t;i++){r=e[i];let s;if(n=r,!n4(r)&&(n=Vh[(s=String(r)).toLowerCase()],n===void 0))throw new P(`Unknown adapter '${s}'`);if(n)break;o[s||"#"+i]=n}if(!n){let i=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?i.length>1?`since :
68
- `+i.map(_g).join(`
69
- `):" "+_g(i[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:Vh};function Hh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ht(null,e)}function na(e){return Hh(e),e.headers=ke.from(e.headers),e.data=oi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ra.getAdapter(e.adapter||Qn.adapter)(e).then(function(n){return Hh(e),n.data=oi.call(e,e.transformResponse,n),n.headers=ke.from(n.headers),n},function(n){return ii(n)||(Hh(e),n&&n.response&&(n.response.data=oi.call(e,e.transformResponse,n.response),n.response.headers=ke.from(n.response.headers))),Promise.reject(n)})}var oa="1.8.4";var ia={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ia[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var Sg={};ia.transitional=function(t,r,n){function o(i,s){return"[Axios v"+oa+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return(i,s,a)=>{if(t===!1)throw new P(o(s," has been removed"+(r?" in "+r:"")),P.ERR_DEPRECATED);return r&&!Sg[s]&&(Sg[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,s,a):!0}};ia.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function o4(e,t,r){if(typeof e!="object")throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),o=n.length;for(;o-- >0;){let i=n[o],s=t[i];if(s){let a=e[i],c=a===void 0||s(a,i,e);if(c!==!0)throw new P("option "+i+" must be "+c,P.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new P("Unknown option "+i,P.ERR_BAD_OPTION)}}var ci={assertOptions:o4,validators:ia};var zt=ci.validators,to=class{constructor(t){this.defaults=t,this.interceptors={request:new Ah,response:new Ah}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
70
- `+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Tt(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&ci.assertOptions(n,{silentJSONParsing:zt.transitional(zt.boolean),forcedJSONParsing:zt.transitional(zt.boolean),clarifyTimeoutError:zt.transitional(zt.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:ci.assertOptions(o,{encode:zt.function,serialize:zt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ci.assertOptions(r,{baseUrl:zt.spelling("baseURL"),withXsrfToken:zt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=ke.concat(s,i);let a=[],c=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(c=c&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});let l=[];this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)});let h,d=0,u;if(!c){let m=[na.bind(this),void 0];for(m.unshift.apply(m,a),m.push.apply(m,l),u=m.length,h=Promise.resolve(r);d<u;)h=h.then(m[d++],m[d++]);return h}u=a.length;let b=r;for(d=0;d<u;){let m=a[d++],f=a[d++];try{b=m(b)}catch(y){f.call(this,y);break}}try{h=na.call(this,b)}catch(m){return Promise.reject(m)}for(d=0,u=l.length;d<u;)h=h.then(l[d++],l[d++]);return h}getUri(t){t=Tt(this.defaults,t);let r=ai(t.baseURL,t.url,t.allowAbsoluteUrls);return ri(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){to.prototype[t]=function(r,n){return this.request(Tt(n||{},{method:t,url:r,data:(n||{}).data}))}});p.forEach(["post","put","patch"],function(t){function r(n){return function(i,s,a){return this.request(Tt(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}to.prototype[t]=r(),to.prototype[t+"Form"]=r(!0)});var li=to;var zh=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});let n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i,s=new Promise(a=>{n.subscribe(a),i=a}).then(o);return s.cancel=function(){n.unsubscribe(i)},s},t(function(i,s,a){n.reason||(n.reason=new Ht(i,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new e(function(o){t=o}),cancel:t}}},kg=zh;function Wh(e){return function(r){return e.apply(null,r)}}function $h(e){return p.isObject(e)&&e.isAxiosError===!0}var qh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qh).forEach(([e,t])=>{qh[t]=e});var Eg=qh;function Cg(e){let t=new li(e),r=Zo(li.prototype.request,t);return p.extend(r,li.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Cg(Tt(e,o))},r}var ve=Cg(Qn);ve.Axios=li;ve.CanceledError=Ht;ve.CancelToken=kg;ve.isCancel=ii;ve.VERSION=oa;ve.toFormData=kr;ve.AxiosError=P;ve.Cancel=ve.CanceledError;ve.all=function(t){return Promise.all(t)};ve.spread=Wh;ve.isAxiosError=$h;ve.mergeConfig=Tt;ve.AxiosHeaders=ke;ve.formToJSON=e=>Ys(p.isHTMLForm(e)?new FormData(e):e);ve.getAdapter=ra.getAdapter;ve.HttpStatusCode=Eg;ve.default=ve;var Wt=ve;var{Axios:fC,AxiosError:mC,CanceledError:gC,isCancel:yC,CancelToken:bC,VERSION:vC,all:wC,Cancel:_C,isAxiosError:SC,spread:kC,toFormData:EC,AxiosHeaders:CC,HttpStatusCode:xC,formToJSON:AC,getAdapter:TC,mergeConfig:IC}=Wt;var i4="https://proctoring-api-dev.easyproctor.tech/api",s4="https://proctoring-api-hml.easyproctor.tech/api",xg="https://proctoring-api.easyproctor.tech/api",ft=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type),this.token=t.token}selectBaseUrl(t){return t==="dev"?i4:t==="homol"?s4:xg}getSocketUrl(){return this.baseUrl.replace("/api","/hub/sockethub")}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async externalCameraRegister(t){return await this.makeRequest({path:"/ExternalCamera/register",method:"POST",body:t,jwt:this.token})}async externalCameraCheckTransmission(t){return await this.makeRequest({path:`/ExternalCamera/send-action/${t}`,method:"POST",body:{command:"Check_Transmission"},jwt:this.token})}async externalCameraStartTransmission(t,r){return await this.makeRequest({path:`/ExternalCamera/start-transmission/${t}`,method:"POST",body:{proctoringId:r},jwt:this.token})}async externalCameraStartSession(){return await this.makeRequest({path:"/ExternalCamera/start-session",method:"POST",body:{},jwt:this.token})}async goToExternalCameraPositionStep(t){return await this.makeRequest({path:`/ExternalCamera/go-to-position-step/${t}`,method:"POST",body:{},jwt:this.token})}async externalCameraFinish(t){return await this.makeRequest({path:`/ExternalCamera/finish/${t}`,method:"POST",body:{},jwt:this.token})}async confirmStart(t,r,n,o){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r.proctoringType,latitude:n,longitude:o,captureScreen:r.captureScreen},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(n=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async getSignedUrlImage(t,r){return(await this.makeRequestAxios({path:"/upload/signed-url-batch",method:"POST",jwt:t,body:r})).data}async getSignedUrl(t,r,n){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${n}/${r.name}`,contentType:r.type}})).data}async saveAlerts(t,r){await this.makeRequest({path:"/proctoring/save-alerts",method:"POST",jwt:t.token,body:{proctoringId:r.id,alerts:r.alerts}})}async finishAndSendUrls(t){return await this.makeRequest({path:`/proctoring/finish/${t.examId}`,method:"POST",body:{endDate:new Date().toISOString(),videoCameraUrl:"",audioCameraUrl:"",videoScreenUrl:""},jwt:t.token})}async log(t,r){let n;return r?.success!==null&&r?.success!==void 0?n=r.success?"4":"1":n="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:n,eventName:t,message:r},jwt:this.token})}async signTerm(){return await this.makeRequest({path:"/User/sign-terms",method:"PATCH",body:{},jwt:this.token})}async signTermUrl(){return(await this.makeRequestAxios({path:"/User/sign-terms-url",method:"GET",jwt:this.token})).data}async startChallenge(t){return(await this.makeRequestAxios({path:"/Challenge/start",method:"POST",jwt:this.token,body:t})).data}async stopChallenge(t,r){return(await this.makeRequestAxios({path:`/Challenge/stop/${t}`,method:"POST",jwt:this.token,body:r})).data}async startRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/start-warning",method:"POST",jwt:this.token,body:t})).data}async stopRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/stop-warning",method:"POST",jwt:this.token,body:t})).data}async verifyFace(t,r){return(await this.makeRequestAxios({path:"/Realtime/verify-face",method:"POST",jwt:this.token,body:{proctoringId:t,base64:r}})).data}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:n,body:o,jwt:i}=t,s=await fetch(this.baseUrl+r,{method:n,body:o!=null?JSON.stringify(o):void 0,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}async makeRequestAxios(t){let{path:r,method:n,body:o,jwt:i}=t,s=await Wt.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${i}`,"Access-Control-Allow-Origin":"*"},data:o});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}async makeRequestPUT(t){let{url:r,method:n,body:o,jwt:i}=t,s=await fetch(r,{method:n,body:o!=null?JSON.stringify(o):void 0,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive","aeg-event-type":"Notification","Content-Type":"application/json","Cache-Control":"no-cache","x-ms-blob-type":"BlockBlob"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}};var sa=class{constructor(){this.baseUrl="https://localhost:5080"}async isAlive(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-alive",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async isPluggedIn(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-plugged-in",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async ConnectAndScan(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/connect-and-scan",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n}){let o=[];return t&&o.push(`deviceType=${t}`),r&&o.push(`rssiThreshold=${r}`),n&&o.push(`packageRateThreshold=${n}`),(await this.makeRequestAxios({path:`/api/usb-device-manager/devices?${o.join("&")}`,method:"GET",jwt:this.token}).catch(s=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async makeRequestAxios(t){let{path:r,method:n,body:o,jwt:i}=t,s=await Wt.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${i}`,"Access-Control-Allow-Origin":"*"},data:o});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var Yr=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var ro=class{constructor(t,r){this.backendService=new sa;this.scanInterval=5;this.options={};this.options=r,this.context=t,this.backend=new ft({type:t?.type||"prod",token:t.token}),this.currentIsPlugged=!0}setProctoringId(t){this.proctoringId=t}async isPluggedIn(t=!1){try{let r=await this.backendService.isPluggedIn();if(this.proctoringId&&t)if(r)this.currentIsPlugged||this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Dispositivo de varredura conectado.",status:"OK"});else{let n=new Yr;n.setProctoringId(this.proctoringId),n.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:33,type:5}),await this.backend.saveAlerts(this.context,n),this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Nenhum dispositivo de varredura conectado.",status:"ALERT"})}return this.currentIsPlugged=r,this.currentIsPlugged}catch(r){throw r}}async isAlive(){try{return await this.backendService.isAlive()}catch(t){throw t}}connectAndScan(){return this.backendService.ConnectAndScan()}async devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n}){let o=await this.backendService.Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n});if(o.length>0&&(this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam detected",description:"Dispositivo espi\xE3o detectado.",data:o}),this.proctoringId)){let i=new Yr;i.setProctoringId(this.proctoringId),i.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:32,type:5}),await this.backend.saveAlerts(this.context,i)}return o}async startCheckSpyCam(t,{deviceType:r,rssiThreshold:n,packageRateThreshold:o}){this.scanInterval=t,this.startTime=new Date(Date.now()),await this.isPluggedIn(!0),this.checkSpyCam=setInterval(async()=>{await this.isPluggedIn(!0)&&await this.devices({deviceType:r,rssiThreshold:n,packageRateThreshold:o})},this.scanInterval*6e4)}stopCheckSpyCam(){clearInterval(this.checkSpyCam)}};var mt={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1,useSpyScan:!1,useExternalCamera:!1,useChallenge:!1,screenRecorderOptions:{width:1280,height:720}};function aa(e){return e.width&&e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var Ag={width:1280,height:720,minWidth:640,minHeight:480};function Tg(){let e=navigator.userAgent,t;return e.match(/chrome|chromium|crios/i)?t="chrome":e.match(/firefox|fxios/i)?t="firefox":e.match(/safari/i)?t="safari":e.match(/opr\//i)?t="opera":e.match(/edg/i)?t="edge":t="No browser detection",t}function Er(){if("userAgentData"in navigator){let e=navigator.userAgentData,t=e.mobile||!1,r=e.platform||"";return t||/Android|iOS/i.test(r)}return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)}var ca,Ig=e=>(ca=e,ca),We={DEVICES_CHECKED:"devices_checked",START:"start",FINISH:"finish",ERROR:"error",UPLOAD:"upload",UPLOAD_FILE:"upload_file",DOWNLOAD_VIDEO:"download_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",CHANGE_DEVICE:"change_device",STOP_SHARING_SCREEN:"stop_sharing_screen",ERROR_RECORDER_RTC:"error_recorder_rtc",BROWSER_NOT_SUPPORTED:"browser_not_supported",SAVE_ON_SESSION:"save_on_session"},$e=(e,t)=>ca&&ca.log(e,t),U={registerDevicesChecked:(e,t,r)=>$e(We.DEVICES_CHECKED,{proctoringId:e,success:t,description:r}),registerStart:(e,t,r)=>$e(We.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>$e(We.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>$e(We.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>$e(We.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,o)=>$e(We.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:o}),registerUploadFile:(e,t,r)=>$e(We.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>$e(We.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>$e(We.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>$e(We.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>$e(We.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>$e(We.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>$e(We.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>$e(We.SAVE_ON_SESSION,{proctoringId:e,description:t})};var hi;function la(e){hi=e}function Qr(e,t,r=!1,n,o=!1){let i,s=!1,a,c,l;l=0;let h={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?h.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),o&&(h={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let d=new MediaRecorder(e,h);d.ondataavailable=v=>{l=l+v.data.size,v.data.size>0&&t.push(v.data),s?(o&&d.state=="inactive"&&(t=[new Blob(t,{type:"audio/webm"})]),i&&i()):((c&&v.data.size===c.data.size||v.data.size===0)&&(hi&&c&&v.data.size===c.data.size&&U.registerOnBufferSizeError(hi,`onBufferSizeError: Recorder size freezed: ${v.data.size} Mb`),hi&&v.data.size===0&&U.registerOnBufferSizeError(hi,"onBufferSizeError: Recorder size equal 0 Mb"),n&&n()),c=v)};function u(){return new Promise(v=>{i=v,d.start(),l=0,s=!1,r&&(a=setInterval(async()=>{await d.requestData()},3e4))})}function b(){return new Promise(v=>{d.state=="recording"?(i=v,d.stop(),s=!0,clearInterval(a),e.getTracks().forEach(_=>{_.stop()})):v()})}function m(){return new Promise(v=>{d.state=="recording"&&d.pause(),v()})}function f(){return new Promise(v=>{d.state=="paused"&&d.resume(),v()})}function y(){return l}return{startRecording:u,stopRecording:b,pauseRecording:m,resumeRecording:f,recorderOptions:h,getBufferSize:y}}var ir=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadImages(t,r,n){let{file:o,onProgress:i}=t;try{let s=l=>{let h=l.loadedBytes/o.size*100;i&&i(Math.round(h))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+60;d++){let u=`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`;(d+1)%n==0&&(u=`${this.proctoringId}/${this.proctoringId}_${d+1}_realtime.jpg`),l.push({objectName:u,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=60}let c=!1;return c=await Wt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(l=>l.status==200||l.status==201?(this.contImages++,!0):!1).catch(()=>!1).finally(()=>{}),{storage:"upload",url:a,uploaded:c}}catch{throw U.registerError(this.proctoringId,`Failed to upload to AWS
71
- File name: ${o.name}
72
- File type: ${o.type}
73
- File size: ${o.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,n){let{file:o,onProgress:i}=t;try{let s=l=>{let h=l.loadedBytes/o.size*100;i&&i(Math.round(h))},a;if(n){if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+20;d++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,o,this.proctoringId);let c=!1;return n?c=await Wt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await Wt.request({url:a,method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw U.registerError(this.proctoringId,`Failed to upload to AWS
74
- File name: ${o.name}
75
- File type: ${o.type}
76
- File size: ${o.size}`),new Error("Failed to upload to AWS")}}};var Pg="not_shared_first_screen",Rg="not_shared_screen",ha="multiple_monitors_detected",Dg="proctoring_already_started",da="proctoring_not_started";var Og="another_stream_active",Bg="stream_under_minimum_permitted",Mg="browser_not_supported",Lg="token_missing",Fg="credentials_missing";var Ug="spy_scan_api_not_found";var Ng="external_camera_not_started";var ua=class extends Kn{constructor(t,r,n="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,o)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,o=window.innerHeight,i=this.video.offsetWidth,s=this.video.offsetHeight,a=i/n,c=s/o,l=i-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,d=(r.boundingBox.width-10)*a,u=r.boundingBox.height*c,b=document.createElement("p");b.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",b.style.right=l-20+"px",b.style.top=h+"px",b.style.width=d+"px";let m={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(b.style,{...m,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let f=document.createElement("div");f.setAttribute("class","highlighter"),f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=d+"px",f.style.height=u-20+"px",Object.assign(f.style,{...m,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(f),this.liveView.appendChild(b),this.children.push(f),this.children.push(b)}}verify(t){let r=t.detections.filter(o=>o.categories.some(i=>i.categoryName==="person")).length,n=t.detections.filter(o=>o.categories.some(i=>i.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var Cr=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{let o=new AudioContext;this.analyser=o.createAnalyser();let i=o.createMediaStreamSource(this.stream);this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,i.connect(this.analyser);let s=()=>{let a=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(a);let l=a.reduce((h,d)=>h+d,0)/a.length;this.setVolume(l),t.setVolume&&t.setVolume(l),this.animationFrameId=requestAnimationFrame(s)};this.animationFrameId=requestAnimationFrame(s),r(!0)}catch(o){this.stop(),n(`Error: ${o}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId)}getVolume(){return this.volume}setVolume(t){this.volume=t}};var sr=class{constructor(t,r,n,o,i){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.currentRetries=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=o,this.backendToken=i,n&&(this.paramsConfig=n)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new ir(this.proctoringId,this.backend)),la(t)}async initializeDetectors(){Hm(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new ua({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Xn({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,this.canvas.width=this.videoOptions.width,this.canvas.height=this.videoOptions.height}async bufferError(t){console.log("buffer error Camera Recorder params "+this.paramsConfig.videoBehaviourParameters);let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(await this.recordingStop(),await this.startRecording({retry:!0}),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startRecording(t){(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&!t?.retry&&await this.initializeDetectors();let{cameraId:r,microphoneId:n,onBufferSizeErrorCallback:o}=this.options,i={audio:{deviceId:n},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(i)}catch(v){throw v.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":v}this.cameraStream=this.hardwareStream;let a=this.cameraStream.getVideoTracks()[0].getSettings(),{width:c=0,height:l=0}=a,{startRecording:h,stopRecording:d,pauseRecording:u,resumeRecording:b,recorderOptions:m,getBufferSize:f}=Qr(this.cameraStream,this.blobs,this.options.onBufferSizeError,v=>this.bufferError(v),!1);if(this.recordingStart=h,this.recordingStop=d,this.recordingPause=u,this.recordingResume=b,this.recorderOptions=m,this.getBufferSize=f,this.recordingStart(),screen.orientation?.type.includes("portrait")&&Er()&&this.videoOptions.width==l&&this.videoOptions.height==c&&([c,l]=[l,c]),this.videoOptions.minWidth>c||this.videoOptions.minHeight>l)throw Bg;if(this.videoOptions.width!==c||this.videoOptions.height!==l)throw U.registerAnotherStream(this.proctoringId,`Maybe have another stream active
66
+ `,document.getElementsByTagName("head")[0].appendChild(n)}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime()}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime()}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";default:return t}}};function rg(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Bi=class extends Oi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_ok","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,u=(a.width-10)*i,m=a.height*o,p=document.createElement("div");p.setAttribute("class","highlighter"),Object.assign(p.style,{right:`${l+20}px`,top:`${h}px`,width:`${u}px`,height:`${m-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let g=document.createElement("p"),f=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(g.innerText=`Confidence: ${f}%`,Object.assign(g.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${u}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(p),this.liveView.appendChild(g),this.children.push(p),this.children.push(g),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let k=b.x<2?b.x*n.videoWidth:b.x,S=b.y<2?b.y*n.videoHeight:b.y,x=(n.videoWidth-k)*i,D=S*o;Object.assign(_.style,{right:`${x+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=r.detections[0].boundingBox,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=!1;o>s&&(n.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),a=!0,this.emmitedPositionAlert=!0):n.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0));let c=[n.originX,n.originY],l=[n.originX+n.width,n.originY+n.height];(c[0]<.1*n.width||c[1]<.2*n.height||l[0]>o-.1*n.width||l[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0);let h=c[0],u=o-l[0],m=c[1],p=s-l[1];h>2*u&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),m>4*p&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),u>2*h&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),p>3*m&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,a=!0),a==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Po(e,t){return function(){return e.apply(t,arguments)}}var{toString:Jb}=Object.prototype,{getPrototypeOf:Xh}=Object,ma=(e=>t=>{let r=Jb.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),gr=e=>(e=e.toLowerCase(),t=>ma(t)===e),ga=e=>t=>typeof t===e,{isArray:Li}=Array,Do=ga("undefined");function Yb(e){return e!==null&&!Do(e)&&e.constructor!==null&&!Do(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var ig=gr("ArrayBuffer");function Zb(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ig(e.buffer),t}var Qb=ga("string"),Ht=ga("function"),og=ga("number"),ya=e=>e!==null&&typeof e=="object",e_=e=>e===!0||e===!1,pa=e=>{if(ma(e)!=="object")return!1;let t=Xh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},t_=gr("Date"),r_=gr("File"),n_=gr("Blob"),i_=gr("FileList"),o_=e=>ya(e)&&Ht(e.pipe),s_=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ma(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},a_=gr("URLSearchParams"),[c_,l_,h_,u_]=["ReadableStream","Request","Response","Headers"].map(gr),d_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Oo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Li(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function sg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ag=e=>!Do(e)&&e!==Vn;function Kh(){let{caseless:e}=ag(this)&&this||{},t={},r=(n,i)=>{let o=e&&sg(t,i)||i;pa(t[o])&&pa(n)?t[o]=Kh(t[o],n):pa(n)?t[o]=Kh({},n):Li(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Oo(arguments[n],r);return t}var f_=(e,t,r,{allOwnKeys:n}={})=>(Oo(t,(i,o)=>{r&&Ht(i)?e[o]=Po(i,r):e[o]=i},{allOwnKeys:n}),e),p_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),m_=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},g_=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Xh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},y_=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},b_=e=>{if(!e)return null;if(Li(e))return e;let t=e.length;if(!og(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},__=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xh(Uint8Array)),v_=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},w_=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},S_=gr("HTMLFormElement"),k_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),ng=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),E_=gr("RegExp"),cg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Oo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},C_=e=>{cg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},x_=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Li(e)?n(e):n(String(e).split(t)),r},A_=()=>{},T_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function I_(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var R_=e=>{let t=new Array(10),r=(n,i)=>{if(ya(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Li(n)?[]:{};return Oo(n,(s,a)=>{let c=r(s,i+1);!Do(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},P_=gr("AsyncFunction"),D_=e=>e&&(ya(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),lg=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),O_=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||lg,T={isArray:Li,isArrayBuffer:ig,isBuffer:Yb,isFormData:s_,isArrayBufferView:Zb,isString:Qb,isNumber:og,isBoolean:e_,isObject:ya,isPlainObject:pa,isReadableStream:c_,isRequest:l_,isResponse:h_,isHeaders:u_,isUndefined:Do,isDate:t_,isFile:r_,isBlob:n_,isRegExp:E_,isFunction:Ht,isStream:o_,isURLSearchParams:a_,isTypedArray:__,isFileList:i_,forEach:Oo,merge:Kh,extend:f_,trim:d_,stripBOM:p_,inherits:m_,toFlatObject:g_,kindOf:ma,kindOfTest:gr,endsWith:y_,toArray:b_,forEachEntry:v_,matchAll:w_,isHTMLForm:S_,hasOwnProperty:ng,hasOwnProp:ng,reduceDescriptors:cg,freezeMethods:C_,toObjectSet:x_,toCamelCase:k_,noop:A_,toFiniteNumber:T_,findKey:sg,global:Vn,isContextDefined:ag,isSpecCompliantForm:I_,toJSONObject:R_,isAsyncFn:P_,isThenable:D_,setImmediate:lg,asap:O_};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var hg=Fi.prototype,ug={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ug[e]={value:e}});Object.defineProperties(Fi,ug);Object.defineProperty(hg,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(hg);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var ce=Fi;var ba=null;function Jh(e){return T.isPlainObject(e)||T.isArray(e)}function fg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function dg(e,t,r){return e?e.concat(t).map(function(i,o){return i=fg(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function B_(e){return T.isArray(e)&&!e.some(Jh)}var L_=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function F_(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(ba||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!T.isUndefined(b[f])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new ce("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,f,b){let _=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(f,"{}"))f=n?f:f.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&B_(g)||(T.isFileList(g)||T.endsWith(f,"[]"))&&(_=T.toArray(g)))return f=fg(f),_.forEach(function(S,R){!(T.isUndefined(S)||S===null)&&t.append(s===!0?dg([f],R,o):s===null?f:f+"[]",l(S))}),!1}return Jh(g)?!0:(t.append(dg(b,f,o),l(g)),!1)}let u=[],m=Object.assign(L_,{defaultVisitor:h,convertValue:l,isVisitable:Jh});function p(g,f){if(!T.isUndefined(g)){if(u.indexOf(g)!==-1)throw Error("Circular reference detected in "+f.join("."));u.push(g),T.forEach(g,function(_,k){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(k)?k.trim():k,f,m))===!0&&p(_,f?f.concat(k):[k])}),u.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return p(e),t}var gn=F_;function pg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function mg(e,t){this._pairs=[],e&&gn(e,this,t)}var gg=mg.prototype;gg.append=function(t,r){this._pairs.push([t,r])};gg.toString=function(t){let r=t?function(n){return t.call(this,n,pg)}:pg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var _a=mg;function M_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Bo(e,t,r){if(!t)return e;let n=r&&r.encode||M_;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new _a(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var Yh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Zh=Yh;var va={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var yg=typeof URLSearchParams<"u"?URLSearchParams:_a;var bg=typeof FormData<"u"?FormData:null;var _g=typeof Blob<"u"?Blob:null;var vg={isBrowser:!0,classes:{URLSearchParams:yg,FormData:bg,Blob:_g},protocols:["http","https","file","blob","url","data"]};var tu={};ky(tu,{hasBrowserEnv:()=>eu,hasStandardBrowserEnv:()=>U_,hasStandardBrowserWebWorkerEnv:()=>N_,navigator:()=>Qh,origin:()=>z_});var eu=typeof window<"u"&&typeof document<"u",Qh=typeof navigator=="object"&&navigator||void 0,U_=eu&&(!Qh||["ReactNative","NativeScript","NS"].indexOf(Qh.product)<0),N_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",z_=eu&&window.location.href||"http://localhost";var Ve={...tu,...vg};function ru(e,t){return gn(e,new Ve.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return Ve.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function j_(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function V_(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function H_(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=V_(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t(j_(n),i,r,0)}),r}return null}var wa=H_;function W_(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var nu={transitional:va,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(wa(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return ru(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return gn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),W_(t)):t}],transformResponse:[function(t){let r=this.transitional||nu.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?ce.from(a,ce.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{nu.headers[e]={}});var Mi=nu;var $_=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),wg=e=>{let t={},r,n,i;return e&&e.split(`
67
+ `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&$_[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var Sg=Symbol("internals");function Lo(e){return e&&String(e).trim().toLowerCase()}function Sa(e){return e===!1||e==null?e:T.isArray(e)?e.map(Sa):String(e)}function G_(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var q_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function iu(e,t,r,n,i){if(T.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!T.isString(t)){if(T.isString(n))return t.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(t)}}function K_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function X_(e,t){let r=T.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}var Ui=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(a,c,l){let h=Lo(c);if(!h)throw new Error("header name must be a non-empty string");let u=T.findKey(i,h);(!u||i[u]===void 0||l===!0||l===void 0&&i[u]!==!1)&&(i[u||c]=Sa(a))}let s=(a,c)=>T.forEach(a,(l,h)=>o(l,h,c));if(T.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(T.isString(t)&&(t=t.trim())&&!q_(t))s(wg(t),r);else if(T.isHeaders(t))for(let[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=Lo(t),t){let n=T.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return G_(i);if(T.isFunction(r))return r.call(this,i,n);if(T.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Lo(t),t){let n=T.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||iu(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(s){if(s=Lo(s),s){let a=T.findKey(n,s);a&&(!r||iu(n,n[a],a,r))&&(delete n[a],i=!0)}}return T.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||iu(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return T.forEach(this,(i,o)=>{let s=T.findKey(n,o);if(s){r[s]=Sa(i),delete r[o];return}let a=t?K_(o):String(o).trim();a!==o&&delete r[o],r[a]=Sa(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&T.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
68
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[Sg]=this[Sg]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Lo(s);n[a]||(X_(i,s),n[a]=!0)}return T.isArray(t)?t.forEach(o):o(t),this}};Ui.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Ui.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});T.freezeMethods(Ui);var st=Ui;function Fo(e,t){let r=this||Mi,n=t||r,i=st.from(n.headers),o=n.data;return T.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Mo(e){return!!(e&&e.__CANCEL__)}function kg(e,t,r){ce.call(this,e??"canceled",ce.ERR_CANCELED,t,r),this.name="CanceledError"}T.inherits(kg,ce,{__CANCEL__:!0});var Br=kg;function Uo(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ce("Request failed with status code "+r.status,[ce.ERR_BAD_REQUEST,ce.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function ou(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function J_(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),h=n[o];s||(s=l),r[i]=c,n[i]=l;let u=o,m=0;for(;u!==i;)m+=r[u++],u=u%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;let p=h&&l-h;return p?Math.round(m*1e3/p):void 0}}var Eg=J_;function Y_(e,t){let r=0,n=1e3/t,i,o,s=(l,h=Date.now())=>{r=h,i=null,o&&(clearTimeout(o),o=null),e.apply(null,l)};return[(...l)=>{let h=Date.now(),u=h-r;u>=n?s(l,h):(i=l,o||(o=setTimeout(()=>{o=null,s(i)},n-u)))},()=>i&&s(i)]}var Cg=Y_;var Ni=(e,t,r=3)=>{let n=0,i=Eg(50,250);return Cg(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,l=i(c),h=s<=a;n=s;let u={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},r)},su=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},au=e=>(...t)=>T.asap(()=>e(...t));var xg=Ve.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Ve.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Ve.origin),Ve.navigator&&/(msie|trident)/i.test(Ve.navigator.userAgent)):()=>!0;var Ag=Ve.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];T.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),T.isString(n)&&s.push("path="+n),T.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cu(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lu(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function No(e,t,r){let n=!cu(t);return e&&(n||r==!1)?lu(e,t):t}var Tg=e=>e instanceof st?{...e}:e;function yr(e,t){t=t||{};let r={};function n(l,h,u,m){return T.isPlainObject(l)&&T.isPlainObject(h)?T.merge.call({caseless:m},l,h):T.isPlainObject(h)?T.merge({},h):T.isArray(h)?h.slice():h}function i(l,h,u,m){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l,u,m)}else return n(l,h,u,m)}function o(l,h){if(!T.isUndefined(h))return n(void 0,h)}function s(l,h){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function a(l,h,u){if(u in t)return n(l,h);if(u in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,h,u)=>i(Tg(l),Tg(h),u,!0)};return T.forEach(Object.keys(Object.assign({},e,t)),function(h){let u=c[h]||i,m=u(e[h],t[h],h);T.isUndefined(m)&&u!==a||(r[h]=m)}),r}var ka=e=>{let t=yr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=st.from(s),t.url=Bo(No(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(r)){if(Ve.hasStandardBrowserEnv||Ve.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...h]=c?c.split(";").map(u=>u.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...h].join("; "))}}if(Ve.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(t)),n||n!==!1&&xg(t.url))){let l=i&&o&&Ag.read(o);l&&s.set(i,l)}return t};var Z_=typeof XMLHttpRequest<"u",Ig=Z_&&function(e){return new Promise(function(r,n){let i=ka(e),o=i.data,s=st.from(i.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,h,u,m,p,g;function f(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function _(){if(!b)return;let S=st.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:S,config:e,request:b};Uo(function(P){r(P),f()},function(P){n(P),f()},x),b=null}"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(_)},b.onabort=function(){b&&(n(new ce("Request aborted",ce.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new ce("Network Error",ce.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",x=i.transitional||va;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new ce(R,x.clarifyTimeoutError?ce.ETIMEDOUT:ce.ECONNABORTED,e,b)),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&T.forEach(s.toJSON(),function(R,x){b.setRequestHeader(x,R)}),T.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),l&&([m,g]=Ni(l,!0),b.addEventListener("progress",m)),c&&b.upload&&([u,p]=Ni(c),b.upload.addEventListener("progress",u),b.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(h=S=>{b&&(n(!S||S.type?new Br(null,e,b):S),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));let k=ou(i.url);if(k&&Ve.protocols.indexOf(k)===-1){n(new ce("Unsupported protocol "+k+":",ce.ERR_BAD_REQUEST,e));return}b.send(o||null)})};var Q_=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,a();let h=l instanceof Error?l:this.reason;n.abort(h instanceof ce?h:new Br(h instanceof Error?h.message:h))}},s=t&&setTimeout(()=>{s=null,o(new ce(`timeout ${t} of ms exceeded`,ce.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>T.asap(a),c}},Rg=Q_;var ev=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},tv=async function*(e,t){for await(let r of rv(e))yield*ev(r,t)},rv=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},hu=(e,t,r,n)=>{let i=tv(e,t),o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:h}=await i.next();if(l){a(),c.close();return}let u=h.byteLength;if(r){let m=o+=u;r(m)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};var Ca=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Dg=Ca&&typeof ReadableStream=="function",nv=Ca&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Og=(e,...t)=>{try{return!!e(...t)}catch{return!1}},iv=Dg&&Og(()=>{let e=!1,t=new Request(Ve.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Pg=64*1024,uu=Dg&&Og(()=>T.isReadableStream(new Response("").body)),Ea={stream:uu&&(e=>e.body)};Ca&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ea[t]&&(Ea[t]=T.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new ce(`Response type '${t}' is not supported`,ce.ERR_NOT_SUPPORT,n)})})})(new Response);var ov=async e=>{if(e==null)return 0;if(T.isBlob(e))return e.size;if(T.isSpecCompliantForm(e))return(await new Request(Ve.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(T.isArrayBufferView(e)||T.isArrayBuffer(e))return e.byteLength;if(T.isURLSearchParams(e)&&(e=e+""),T.isString(e))return(await nv(e)).byteLength},sv=async(e,t)=>{let r=T.toFiniteNumber(e.getContentLength());return r??ov(t)},Bg=Ca&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:u="same-origin",fetchOptions:m}=ka(e);l=l?(l+"").toLowerCase():"text";let p=Rg([i,o&&o.toAbortSignal()],s),g,f=p&&p.unsubscribe&&(()=>{p.unsubscribe()}),b;try{if(c&&iv&&r!=="get"&&r!=="head"&&(b=await sv(h,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),D;if(T.isFormData(n)&&(D=x.headers.get("content-type"))&&h.setContentType(D),x.body){let[P,N]=su(b,Ni(au(c)));n=hu(x.body,Pg,P,N)}}T.isString(u)||(u=u?"include":"omit");let _="credentials"in Request.prototype;g=new Request(t,{...m,signal:p,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:_?u:void 0});let k=await fetch(g),S=uu&&(l==="stream"||l==="response");if(uu&&(a||S&&f)){let x={};["status","statusText","headers"].forEach(Z=>{x[Z]=k[Z]});let D=T.toFiniteNumber(k.headers.get("content-length")),[P,N]=a&&su(D,Ni(au(a),!0))||[];k=new Response(hu(k.body,Pg,P,()=>{N&&N(),f&&f()}),x)}l=l||"text";let R=await Ea[T.findKey(Ea,l)||"text"](k,e);return!S&&f&&f(),await new Promise((x,D)=>{Uo(x,D,{data:R,headers:st.from(k.headers),status:k.status,statusText:k.statusText,config:e,request:g})})}catch(_){throw f&&f(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new ce("Network Error",ce.ERR_NETWORK,e,g),{cause:_.cause||_}):ce.from(_,_&&_.code,e,g)}});var du={http:ba,xhr:Ig,fetch:Bg};T.forEach(du,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Lg=e=>`- ${e}`,av=e=>T.isFunction(e)||e===null||e===!1,xa={getAdapter:e=>{e=T.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!av(r)&&(n=du[(s=String(r)).toLowerCase()],n===void 0))throw new ce(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?o.length>1?`since :
69
+ `+o.map(Lg).join(`
70
+ `):" "+Lg(o[0]):"as no adapter specified";throw new ce("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:du};function fu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Br(null,e)}function Aa(e){return fu(e),e.headers=st.from(e.headers),e.data=Fo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xa.getAdapter(e.adapter||Mi.adapter)(e).then(function(n){return fu(e),n.data=Fo.call(e,e.transformResponse,n),n.headers=st.from(n.headers),n},function(n){return Mo(n)||(fu(e),n&&n.response&&(n.response.data=Fo.call(e,e.transformResponse,n.response),n.response.headers=st.from(n.response.headers))),Promise.reject(n)})}var Ta="1.8.4";var Ia={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ia[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var Fg={};Ia.transitional=function(t,r,n){function i(o,s){return"[Axios v"+Ta+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(t===!1)throw new ce(i(s," has been removed"+(r?" in "+r:"")),ce.ERR_DEPRECATED);return r&&!Fg[s]&&(Fg[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,a):!0}};Ia.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function cv(e,t,r){if(typeof e!="object")throw new ce("options must be an object",ce.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let o=n[i],s=t[o];if(s){let a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new ce("option "+o+" must be "+c,ce.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ce("Unknown option "+o,ce.ERR_BAD_OPTION)}}var zo={assertOptions:cv,validators:Ia};var Lr=zo.validators,zi=class{constructor(t){this.defaults=t,this.interceptors={request:new Zh,response:new Zh}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
71
+ `+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=yr(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&zo.assertOptions(n,{silentJSONParsing:Lr.transitional(Lr.boolean),forcedJSONParsing:Lr.transitional(Lr.boolean),clarifyTimeoutError:Lr.transitional(Lr.boolean)},!1),i!=null&&(T.isFunction(i)?r.paramsSerializer={serialize:i}:zo.assertOptions(i,{encode:Lr.function,serialize:Lr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),zo.assertOptions(r,{baseUrl:Lr.spelling("baseURL"),withXsrfToken:Lr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&T.merge(o.common,o[r.method]);o&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),r.headers=st.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(c=c&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});let l=[];this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)});let h,u=0,m;if(!c){let g=[Aa.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,l),m=g.length,h=Promise.resolve(r);u<m;)h=h.then(g[u++],g[u++]);return h}m=a.length;let p=r;for(u=0;u<m;){let g=a[u++],f=a[u++];try{p=g(p)}catch(b){f.call(this,b);break}}try{h=Aa.call(this,p)}catch(g){return Promise.reject(g)}for(u=0,m=l.length;u<m;)h=h.then(l[u++],l[u++]);return h}getUri(t){t=yr(this.defaults,t);let r=No(t.baseURL,t.url,t.allowAbsoluteUrls);return Bo(r,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){zi.prototype[t]=function(r,n){return this.request(yr(n||{},{method:t,url:r,data:(n||{}).data}))}});T.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(yr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}zi.prototype[t]=r(),zi.prototype[t+"Form"]=r(!0)});var jo=zi;var pu=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new Br(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new e(function(i){t=i}),cancel:t}}},Mg=pu;function mu(e){return function(r){return e.apply(null,r)}}function gu(e){return T.isObject(e)&&e.isAxiosError===!0}var yu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(yu).forEach(([e,t])=>{yu[t]=e});var Ug=yu;function Ng(e){let t=new jo(e),r=Po(jo.prototype.request,t);return T.extend(r,jo.prototype,t,{allOwnKeys:!0}),T.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return Ng(yr(e,i))},r}var tt=Ng(Mi);tt.Axios=jo;tt.CanceledError=Br;tt.CancelToken=Mg;tt.isCancel=Mo;tt.VERSION=Ta;tt.toFormData=gn;tt.AxiosError=ce;tt.Cancel=tt.CanceledError;tt.all=function(t){return Promise.all(t)};tt.spread=mu;tt.isAxiosError=gu;tt.mergeConfig=yr;tt.AxiosHeaders=st;tt.formToJSON=e=>wa(T.isHTMLForm(e)?new FormData(e):e);tt.getAdapter=xa.getAdapter;tt.HttpStatusCode=Ug;tt.default=tt;var br=tt;var{Axios:_5,AxiosError:v5,CanceledError:w5,isCancel:S5,CancelToken:k5,VERSION:E5,all:C5,Cancel:x5,isAxiosError:A5,spread:T5,toFormData:I5,AxiosHeaders:R5,HttpStatusCode:P5,formToJSON:D5,getAdapter:O5,mergeConfig:B5}=br;var lv="https://proctoring-api-dev.easyproctor.tech/api",hv="https://proctoring-api-hml.easyproctor.tech/api",zg="https://proctoring-api.easyproctor.tech/api",tr=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type),this.token=t.token}selectBaseUrl(t){return t==="dev"?lv:t==="homol"?hv:zg}getSocketUrl(){return this.baseUrl.replace("/api","/hub/sockethub")}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async externalCameraRegister(t){return await this.makeRequest({path:"/ExternalCamera/register",method:"POST",body:t,jwt:this.token})}async externalCameraCheckTransmission(t){return await this.makeRequest({path:`/ExternalCamera/send-action/${t}`,method:"POST",body:{command:"Check_Transmission"},jwt:this.token})}async externalCameraStartTransmission(t,r){return await this.makeRequest({path:`/ExternalCamera/start-transmission/${t}`,method:"POST",body:{proctoringId:r},jwt:this.token})}async externalCameraStartSession(){return await this.makeRequest({path:"/ExternalCamera/start-session",method:"POST",body:{},jwt:this.token})}async goToExternalCameraPositionStep(t){return await this.makeRequest({path:`/ExternalCamera/go-to-position-step/${t}`,method:"POST",body:{},jwt:this.token})}async externalCameraFinish(t){return await this.makeRequest({path:`/ExternalCamera/finish/${t}`,method:"POST",body:{},jwt:this.token})}async confirmStart(t,r,n,i){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r.proctoringType,latitude:n,longitude:i,captureScreen:r.captureScreen},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(n=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async getSignedUrlImage(t,r){return(await this.makeRequestAxios({path:"/upload/signed-url-batch",method:"POST",jwt:t,body:r})).data}async getSignedUrl(t,r,n){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${n}/${r.name}`,contentType:r.type}})).data}async saveAlerts(t,r){await this.makeRequest({path:"/proctoring/save-alerts",method:"POST",jwt:t.token,body:{proctoringId:r.id,alerts:r.alerts}})}async finishAndSendUrls(t){return await this.makeRequest({path:`/proctoring/finish/${t.examId}`,method:"POST",body:{endDate:new Date().toISOString(),videoCameraUrl:"",audioCameraUrl:"",videoScreenUrl:""},jwt:t.token})}async log(t,r){let n;return r?.success!==null&&r?.success!==void 0?n=r.success?"4":"1":n="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:n,eventName:t,message:r},jwt:this.token})}async signTerm(){return await this.makeRequest({path:"/User/sign-terms",method:"PATCH",body:{},jwt:this.token})}async signTermUrl(){return(await this.makeRequestAxios({path:"/User/sign-terms-url",method:"GET",jwt:this.token})).data}async startChallenge(t){return(await this.makeRequestAxios({path:"/Challenge/start",method:"POST",jwt:this.token,body:t})).data}async stopChallenge(t,r){return(await this.makeRequestAxios({path:`/Challenge/stop/${t}`,method:"POST",jwt:this.token,body:r})).data}async startRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/start-warning",method:"POST",jwt:this.token,body:t})).data}async stopRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/stop-warning",method:"POST",jwt:this.token,body:t})).data}async verifyFace(t,r){return(await this.makeRequestAxios({path:"/Realtime/verify-face",method:"POST",jwt:this.token,body:{proctoringId:t,base64:r}})).data}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:n,body:i,jwt:o}=t,s=await fetch(this.baseUrl+r,{method:n,body:i!=null?JSON.stringify(i):void 0,headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}async makeRequestAxios(t){let{path:r,method:n,body:i,jwt:o}=t,s=await br.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}async makeRequestPUT(t){let{url:r,method:n,body:i,jwt:o}=t,s=await fetch(r,{method:n,body:i!=null?JSON.stringify(i):void 0,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive","aeg-event-type":"Notification","Content-Type":"application/json","Cache-Control":"no-cache","x-ms-blob-type":"BlockBlob"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}};var Ra=class{constructor(){this.baseUrl="https://localhost:5080"}async isAlive(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-alive",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async isPluggedIn(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-plugged-in",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async ConnectAndScan(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/connect-and-scan",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n}){let i=[];return t&&i.push(`deviceType=${t}`),r&&i.push(`rssiThreshold=${r}`),n&&i.push(`packageRateThreshold=${n}`),(await this.makeRequestAxios({path:`/api/usb-device-manager/devices?${i.join("&")}`,method:"GET",jwt:this.token}).catch(s=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async makeRequestAxios(t){let{path:r,method:n,body:i,jwt:o}=t,s=await br.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var Hn=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var ji=class{constructor(t,r){this.backendService=new Ra;this.scanInterval=5;this.options={};this.options=r,this.context=t,this.backend=new tr({type:t?.type||"prod",token:t.token}),this.currentIsPlugged=!0}setProctoringId(t){this.proctoringId=t}async isPluggedIn(t=!1){try{let r=await this.backendService.isPluggedIn();if(this.proctoringId&&t)if(r)this.currentIsPlugged||this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Dispositivo de varredura conectado.",status:"OK"});else{let n=new Hn;n.setProctoringId(this.proctoringId),n.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:33,type:5}),await this.backend.saveAlerts(this.context,n),this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Nenhum dispositivo de varredura conectado.",status:"ALERT"})}return this.currentIsPlugged=r,this.currentIsPlugged}catch(r){throw r}}async isAlive(){try{return await this.backendService.isAlive()}catch(t){throw t}}connectAndScan(){return this.backendService.ConnectAndScan()}async devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n}){let i=await this.backendService.Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n});if(i.length>0&&(this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam detected",description:"Dispositivo espi\xE3o detectado.",data:i}),this.proctoringId)){let o=new Hn;o.setProctoringId(this.proctoringId),o.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:32,type:5}),await this.backend.saveAlerts(this.context,o)}return i}async startCheckSpyCam(t,{deviceType:r,rssiThreshold:n,packageRateThreshold:i}){this.scanInterval=t,this.startTime=new Date(Date.now()),await this.isPluggedIn(!0),this.checkSpyCam=setInterval(async()=>{await this.isPluggedIn(!0)&&await this.devices({deviceType:r,rssiThreshold:n,packageRateThreshold:i})},this.scanInterval*6e4)}stopCheckSpyCam(){clearInterval(this.checkSpyCam)}};var rr={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1,useSpyScan:!1,useExternalCamera:!1,useChallenge:!1,screenRecorderOptions:{width:1280,height:720}};function Pa(e){return e.width&&e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var jg={width:1280,height:720,minWidth:640,minHeight:480};function Vg(){let e=navigator.userAgent,t;return e.match(/chrome|chromium|crios/i)?t="chrome":e.match(/firefox|fxios/i)?t="firefox":e.match(/safari/i)?t="safari":e.match(/opr\//i)?t="opera":e.match(/edg/i)?t="edge":t="No browser detection",t}function yn(){if("userAgentData"in navigator){let e=navigator.userAgentData,t=e.mobile||!1,r=e.platform||"";return t||/Android|iOS/i.test(r)}return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)}var Da,Hg=e=>(Da=e,Da),It={DEVICES_CHECKED:"devices_checked",START:"start",FINISH:"finish",ERROR:"error",UPLOAD:"upload",UPLOAD_FILE:"upload_file",DOWNLOAD_VIDEO:"download_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",CHANGE_DEVICE:"change_device",STOP_SHARING_SCREEN:"stop_sharing_screen",ERROR_RECORDER_RTC:"error_recorder_rtc",BROWSER_NOT_SUPPORTED:"browser_not_supported",SAVE_ON_SESSION:"save_on_session"},Rt=(e,t)=>Da&&Da.log(e,t),ge={registerDevicesChecked:(e,t,r)=>Rt(It.DEVICES_CHECKED,{proctoringId:e,success:t,description:r}),registerStart:(e,t,r)=>Rt(It.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>Rt(It.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>Rt(It.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>Rt(It.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,i)=>Rt(It.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:i}),registerUploadFile:(e,t,r)=>Rt(It.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>Rt(It.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>Rt(It.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>Rt(It.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>Rt(It.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>Rt(It.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>Rt(It.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>Rt(It.SAVE_ON_SESSION,{proctoringId:e,description:t})};var Vo;function Oa(e){Vo=e}function Wn(e,t,r=!1,n,i=!1){let o,s=!1,a,c,l;l=0;let h={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?h.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),i&&(h={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let u=new MediaRecorder(e,h);u.ondataavailable=_=>{l=l+_.data.size,_.data.size>0&&t.push(_.data),s?(i&&u.state=="inactive"&&(t=[new Blob(t,{type:"audio/webm"})]),o&&o()):((c&&_.data.size===c.data.size||_.data.size===0)&&(Vo&&c&&_.data.size===c.data.size&&ge.registerOnBufferSizeError(Vo,`onBufferSizeError: Recorder size freezed: ${_.data.size} Mb`),Vo&&_.data.size===0&&ge.registerOnBufferSizeError(Vo,"onBufferSizeError: Recorder size equal 0 Mb"),n&&n()),c=_)};function m(){return new Promise(_=>{o=_,u.start(),l=0,s=!1,r&&(a=setInterval(async()=>{await u.requestData()},3e4))})}function p(){return new Promise(_=>{u.state=="recording"?(o=_,u.stop(),s=!0,clearInterval(a),e.getTracks().forEach(k=>{k.stop()})):_()})}function g(){return new Promise(_=>{u.state=="recording"&&u.pause(),_()})}function f(){return new Promise(_=>{u.state=="paused"&&u.resume(),_()})}function b(){return l}return{startRecording:m,stopRecording:p,pauseRecording:g,resumeRecording:f,recorderOptions:h,getBufferSize:b}}var Jr=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadPackage(t,r){let{file:n,onProgress:i}=t;try{let o=c=>{let l=c.loadedBytes/n.size*100;i&&i(Math.round(l))},s=await this.backend.getSignedUrl(r,n,this.proctoringId),a=await br.request({url:s,method:"PUT",headers:{"Content-Type":n.type,"x-ms-blob-type":"BlockBlob"},data:n,onUploadProgress:c=>{o({loadedBytes:c.loaded})}}).then(()=>!0).catch(()=>!1);return{storage:"upload",url:s,uploaded:a}}catch{throw ge.registerError(this.proctoringId,`Failed to upload to AWS
72
+ File name: ${n.name}
73
+ File type: ${n.type}
74
+ File size: ${n.size}`),new Error("Failed to upload to AWS")}}async uploadImages(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let h=l.loadedBytes/i.size*100;o&&o(Math.round(h))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let u=this.imageBatchNum;u<this.imageBatchNum+60;u++){let m=`${this.proctoringId}/${this.proctoringId}_${u+1}.jpg`;(u+1)%n==0&&(m=`${this.proctoringId}/${this.proctoringId}_${u+1}_realtime.jpg`),l.push({objectName:m,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(u=>{this.imageUrlPackage.push(u)}),this.imageBatchNum+=60}let c=!1;return c=await br.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(l=>l.status==200||l.status==201?(this.contImages++,!0):!1).catch(()=>!1).finally(()=>{}),{storage:"upload",url:a,uploaded:c}}catch{throw ge.registerError(this.proctoringId,`Failed to upload to AWS
75
+ File name: ${i.name}
76
+ File type: ${i.type}
77
+ File size: ${i.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let h=l.loadedBytes/i.size*100;o&&o(Math.round(h))},a;if(n){if(this.imageBatchNum===this.contImages){let l=[];for(let u=this.imageBatchNum;u<this.imageBatchNum+20;u++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${u+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(u=>{this.imageUrlPackage.push(u)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,i,this.proctoringId);let c=!1;return n?c=await br.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await br.request({url:a,method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw ge.registerError(this.proctoringId,`Failed to upload to AWS
78
+ File name: ${i.name}
79
+ File type: ${i.type}
80
+ File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var Wg="not_shared_first_screen",$g="not_shared_screen",Ba="multiple_monitors_detected",Gg="proctoring_already_started",La="proctoring_not_started";var qg="another_stream_active",Kg="stream_under_minimum_permitted",Xg="browser_not_supported",Jg="token_missing",Yg="credentials_missing";var Zg="spy_scan_api_not_found";var Qg="external_camera_not_started";var Fa=class extends Oi{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,u=(r.boundingBox.width-10)*a,m=r.boundingBox.height*c,p=document.createElement("p");p.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",p.style.right=l-20+"px",p.style.top=h+"px",p.style.width=u+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(p.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let f=document.createElement("div");f.setAttribute("class","highlighter"),f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=u+"px",f.style.height=m-20+"px",Object.assign(f.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(f),this.liveView.appendChild(p),this.children.push(f),this.children.push(p)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var bn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{let i=new AudioContext;this.analyser=i.createAnalyser();let o=i.createMediaStreamSource(this.stream);this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,o.connect(this.analyser);let s=()=>{let a=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(a);let l=a.reduce((h,u)=>h+u,0)/a.length;this.setVolume(l),t.setVolume&&t.setVolume(l),this.animationFrameId=requestAnimationFrame(s)};this.animationFrameId=requestAnimationFrame(s),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId)}getVolume(){return this.volume}setVolume(t){this.volume=t}};var n0=hl(t0()),Yr=class{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.currentRetries=0;this.packageCount=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Jr(this.proctoringId,this.backend)),Oa(t)}async initializeDetectors(){rg(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new Fa({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Bi({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,this.canvas.width=this.videoOptions.width,this.canvas.height=this.videoOptions.height}async bufferError(t){console.log("buffer error Camera Recorder params "+this.paramsConfig.videoBehaviourParameters);let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(await this.recordingStop(),await this.startRecording({retry:!0}),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startRecording(t){(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&!t?.retry&&await this.initializeDetectors();let{cameraId:r,microphoneId:n,onBufferSizeErrorCallback:i}=this.options,o={audio:{deviceId:n},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(o)}catch(_){throw _.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":_}this.cameraStream=this.hardwareStream;let a=this.cameraStream.getVideoTracks()[0].getSettings(),{width:c=0,height:l=0}=a,{startRecording:h,stopRecording:u,pauseRecording:m,resumeRecording:p,recorderOptions:g,getBufferSize:f}=Wn(this.cameraStream,this.blobs,this.options.onBufferSizeError,_=>this.bufferError(_),!1);if(this.recordingStart=h,this.recordingStop=u,this.recordingPause=m,this.recordingResume=p,this.recorderOptions=g,this.getBufferSize=f,this.recordingStart(),screen.orientation?.type.includes("portrait")&&yn()&&this.videoOptions.width==l&&this.videoOptions.height==c&&([c,l]=[l,c]),this.videoOptions.minWidth>c||this.videoOptions.minHeight>l)throw Kg;if(this.videoOptions.width!==c||this.videoOptions.height!==l)throw ge.registerAnotherStream(this.proctoringId,`Maybe have another stream active
77
81
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
78
- Setting: ${JSON.stringify(a,null,2)}`),Og;this.paramsConfig.imageBehaviourParameters?.useUploadImage&&this.options.proctoringType=="IMAGE"&&this.photoShotsCycle(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[]}async stopRecording(){this.isCanvasLoopActive=!1,this.recordingStop&&await this.recordingStop();try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}catch{console.error("Erro ao parar os streams de m\xEDdia.")}if(this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken){let t=this.filesToUpload.length,r=this.paramsConfig.imageBehaviourParameters.uploadInterval;for(let n=0;n<t;n++){if(n==t-1&&this.filesToUpload[0]){let o=this.filesToUpload[0].name.replace(".jpg","_realtime.jpg"),i=new File([this.filesToUpload[0]],o,{type:"image/jpeg"});this.filesToUpload[0]=i}this.filesToUpload[0]&&await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,r),this.filesToUpload.shift()}}this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}photoShotsCycle(){let t;this.configImageCapture(),this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.videoOptions.width,this.videoOptions.height);let r=this.canvas.toDataURL("image/jpeg");t=await this.getFile(r,`${this.proctoringId}_${this.imageCount+1}.jpg`,"image/jpeg"),t&&this.upload&&this.backendToken&&(this.upload.upload({file:t},this.backendToken,!0),this.imageCount++)},this.paramsConfig.imageBehaviourParameters.uploadInterval*1e3)}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}captureFrame(){let t;this.configImageCapture();let r=this.paramsConfig.imageBehaviourParameters.uploadInterval,n=!1;this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let o=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;n==!1&&r>0&&(n=!0,this.sendFrame());let i=`${this.proctoringId}_${this.imageCount+1}.jpg`;(this.imageCount+1)%r==0&&(i=`${this.proctoringId}_${this.imageCount+1}_realtime.jpg`),t=await this.getFile(o,i,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)},1e3)}sendFrame(){let t=this.paramsConfig.imageBehaviourParameters.uploadInterval,r=!1,n=0;this.sendFrameInterval=setInterval(async()=>{if(this.upload&&this.backendToken&&!r){n=0;let o=0,i=this.filesToUpload.length;for(;o<i&&(r=!0,this.filesToUpload.length!=0);)(await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,t)).uploaded==!0?(await this.filesToUpload.shift(),o++):console.log("erro no upload: "+this.filesToUpload[0].name);r=!1}else if(r&&(n++,n==3)){n=0;let o=this.videoOptions.width/2,i=this.videoOptions.height/2;o<320&&(o=320),i<180&&(i=180),this.canvas.width=o,this.canvas.height=i}},t*1e3)}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&U.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo)&&t.addRecording({device:`Audio
82
+ Setting: ${JSON.stringify(a,null,2)}`),qg;this.paramsConfig.imageBehaviourParameters?.useUploadImage&&this.options.proctoringType=="IMAGE"&&this.photoShotsCycle(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[],this.options.proctoringType=="REALTIME"&&(this.captureFrame(),this.sendFrameInterval=setInterval(()=>this.captureFrame(),1e3*this.paramsConfig.videoBehaviourParameters?.realtimeUploadInterval)),this.packageCount=0}async stopRecording(){this.isCanvasLoopActive=!1,this.recordingStop&&await this.recordingStop();try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}catch{console.error("Erro ao parar os streams de m\xEDdia.")}this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken&&await this.sendPackage(),this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}photoShotsCycle(){let t;this.configImageCapture(),this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.videoOptions.width,this.videoOptions.height);let r=this.canvas.toDataURL("image/jpeg");t=await this.getFile(r,`${this.proctoringId}_${this.imageCount+1}.jpg`,"image/jpeg"),t&&this.upload&&this.backendToken&&(this.upload.upload({file:t},this.backendToken,!0),this.imageCount++)},this.paramsConfig.imageBehaviourParameters.uploadInterval*1e3)}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}captureFrame(){let t;this.configImageCapture();let r=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize,n=!1;this.imageCount++,this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let i=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;n==!1&&r==this.imageCount&&(n=!0,this.imageCount=0,clearInterval(this.imageInterval),this.sendPackage());let o=`${this.proctoringId}_${this.imageCount+1}.jpg`;t=await this.getFile(i,o,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)},1e3)}async sendPackage(){let t=!1,r=0;if(this.upload&&this.backendToken&&!t&&this.filesToUpload.length>0){r=0,t=!0;let n=new n0.default,i=this.filesToUpload;for(let l of i)n.file(l.name,l);let o=await n.generateAsync({type:"blob"}),s="realtime_package_"+30*this.packageCount+".zip",a=new File([o],s,{type:"application/zip"});(await this.upload.uploadPackage({file:a},this.backendToken)).uploaded==!0?(await this.filesToUpload.splice(0,this.filesToUpload.length),this.packageCount++):console.log("erro no upload do pacote"),t=!1}else if(t&&(r++,r==3)){r=0;let n=this.videoOptions.width/2,i=this.videoOptions.height/2;n<320&&(n=320),i<180&&(i=180),this.canvas.width=n,this.canvas.height=i}}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&ge.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo)&&t.addRecording({device:`Audio
79
83
  Sample Rate: ${n.sampleRate}
80
84
  Sample Size: ${n.sampleSize}
81
85
 
82
86
  Video:
83
- ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,n){return new Promise((o,i)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});o(a)}).catch(s=>{i(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new Cr(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}createRotatedStream(t){this.internalClonedStream=t.clone();let r=document.createElement("video");r.srcObject=this.internalClonedStream,r.muted=!0,r.play();let n=document.createElement("canvas"),o=n.getContext("2d"),s=t.getVideoTracks()[0].getSettings(),a=s.width||640,c=s.height||480;n.width=c,n.height=a;let l=()=>{r.paused||r.ended||this.isCanvasLoopActive&&(o&&(o.clearRect(0,0,n.width,n.height),o.drawImage(r,0,0,n.width,n.height)),this.isCanvasLoopActive&&(this.animationFrameId=requestAnimationFrame(l)))};r.onplaying=()=>{this.isCanvasLoopActive=!0,l()};let h=n.captureStream(30);return t.getAudioTracks().forEach(d=>{h.addTrack(d)}),h}};var pa=class{constructor(t=mt,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...mt,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
87
+ ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,n){return new Promise((i,o)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});i(a)}).catch(s=>{o(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new bn(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}createRotatedStream(t){this.internalClonedStream=t.clone();let r=document.createElement("video");r.srcObject=this.internalClonedStream,r.muted=!0,r.play();let n=document.createElement("canvas"),i=n.getContext("2d"),s=t.getVideoTracks()[0].getSettings(),a=s.width||640,c=s.height||480;n.width=c,n.height=a;let l=()=>{r.paused||r.ended||this.isCanvasLoopActive&&(i&&(i.clearRect(0,0,n.width,n.height),i.drawImage(r,0,0,n.width,n.height)),this.isCanvasLoopActive&&(this.animationFrameId=requestAnimationFrame(l)))};r.onplaying=()=>{this.isCanvasLoopActive=!0,l()};let h=n.captureStream(30);return t.getAudioTracks().forEach(u=>{h.addTrack(u)}),h}};var Ma=class{constructor(t=rr,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...rr,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
84
88
  .alert-div {
85
89
  display: flex;
86
90
  align-items: center;
@@ -360,8 +364,8 @@ Setting: ${JSON.stringify(a,null,2)}`),Og;this.paramsConfig.imageBehaviourParame
360
364
  height: 50px !important;
361
365
  }
362
366
  }
363
- `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let o=document.createElement("div");o.setAttribute("class","modal-responsive");let i={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(o,i);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),o.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),h=document.createElement("select");h.setAttribute("id","cameraSelect");let d={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,d),l.innerText="C\xE2mera";let u={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,u),h.style.maxWidth="400px",h.style.minWidth="150px",h.style.width="100%",h.style.boxSizing="border-box",c.appendChild(l),c.appendChild(h),o.appendChild(c);let b=document.createElement("div");b.setAttribute("id","liveCheckDevices"),b.setAttribute("class","camera-container-responsive");let m=document.createElement("div");m.setAttribute("class","video-responsive");let f=document.createElement("video"),y=document.createElement("div");f.setAttribute("id","cameraStream"),f.muted=!0;let v={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(b,v);let _={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(f,_),this.applyStyles(m,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let x=document.createElement("div");x.setAttribute("class","alert-div"),x.setAttribute("id","alertDivResolution");let B=document.createElement("error");B.setAttribute("id","resolutionAlert"),B.innerText="Resolu\xE7\xE3o m\xEDnima",B.style.marginLeft="10px",B.style.marginRight="5px";let O=document.createElement("span"),R=document.createElement("div"),ue=document.createElement("div");O.setAttribute("id","checkmark_resolution"),R.setAttribute("id","checkmark_stem_resolution"),ue.setAttribute("id","checkmark_kick_resolution"),O.appendChild(R),O.appendChild(ue);let se=document.createElement("span"),jr=document.createElement("div"),Ni=document.createElement("div");se.setAttribute("class","info"),se.setAttribute("id","info_resolution"),jr.setAttribute("class","info_stem"),Ni.setAttribute("class","info_kick"),se.appendChild(jr),se.appendChild(Ni),x.appendChild(O),x.appendChild(B),x.appendChild(se);let Vr=document.createElement("div");Vr.setAttribute("class","alert-div"),Vr.setAttribute("id","alertDivFacePosition");let fn=document.createElement("error");fn.setAttribute("id","facePositionAlert"),fn.innerText="Posicionamento da face",fn.style.marginLeft="10px";let mn=document.createElement("span"),Co=document.createElement("div"),Eu=document.createElement("div");mn.setAttribute("id","checkmark_FacePosition"),Co.setAttribute("id","checkmark_stem_FacePosition"),Eu.setAttribute("id","checkmark_kick_FacePosition"),mn.appendChild(Co),mn.appendChild(Eu),Vr.appendChild(mn),Vr.appendChild(fn);let xo=document.createElement("div");xo.setAttribute("class","alert-div"),xo.setAttribute("id","alertDivAmbientVerify");let ji=document.createElement("error");ji.setAttribute("id","ambientVerifyAlert"),ji.innerText="Verifica\xE7\xE3o do ambiente",ji.style.marginLeft="10px";let Vi=document.createElement("span"),Cu=document.createElement("div"),xu=document.createElement("div");Vi.setAttribute("id","checkmark_AmbientVerify"),Cu.setAttribute("id","checkmark_stem_AmbientVerify"),xu.setAttribute("id","checkmark_kick_AmbientVerify"),Vi.appendChild(Cu),Vi.appendChild(xu),xo.appendChild(Vi),xo.appendChild(ji);let gn=document.createElement("div");gn.setAttribute("class","alert-div"),gn.setAttribute("id","alertDivSpyCam"),gn.style.display="none";let Hi=document.createElement("error");Hi.setAttribute("id","SpyCamAlert"),Hi.innerText="Verifica\xE7\xE3o de Spy Cam",Hi.style.marginLeft="10px";let zi=document.createElement("span"),Au=document.createElement("div"),Tu=document.createElement("div");zi.setAttribute("id","checkmark_SpyCam"),Au.setAttribute("id","checkmark_stem_SpyCam"),Tu.setAttribute("id","checkmark_kick_SpyCam"),zi.appendChild(Au),zi.appendChild(Tu),gn.appendChild(zi),gn.appendChild(Hi),y.style.transform="rotateY(180deg)",y.style.display="flex",y.style.flexDirection="column",y.style.flex="1",y.style.minWidth="0",y.appendChild(x),y.appendChild(Vr),y.appendChild(xo),y.appendChild(gn),b.appendChild(y),m.appendChild(f),m.style.flexShrink="0",b.appendChild(m);let Xt=document.createElement("div");Xt.setAttribute("class","facial-biometry__mask"),Xt.style.width="100%",Xt.style.height="100%",Xt.style.position="absolute",Xt.style.top="0px",Xt.style.left="0px",Xt.style.backgroundColor="#fff",Xt.style.opacity="0.6";let hr=document.createElement("div");hr.setAttribute("class","biometry__frame"),hr.style.width="100%",hr.style.height="100%",hr.style.position="absolute",hr.style.top="0px",hr.style.left="0px",hr.style.zIndex="10",m.appendChild(Xt),m.appendChild(hr),o.appendChild(b);let Ao=document.createElement("div");Ao.setAttribute("class","mic-header-responsive");let Fc=document.createElement("h3"),yn=document.createElement("select");yn.setAttribute("id","micSelect");let ty={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(Ao,ty),Fc.innerText="Microfone";let ry={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Fc,ry),yn.style.maxWidth="400px",yn.style.minWidth="150px",yn.style.width="100%",yn.style.boxSizing="border-box",Ao.appendChild(Fc),Ao.appendChild(yn),o.appendChild(Ao);let To=document.createElement("div");To.setAttribute("class","mic-container-responsive");let ny={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(To,ny);let Io=document.createElement("div");Io.setAttribute("class","mic-meter-responsive");let oy={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(Io,oy);let Wi=document.createElement("div");Wi.setAttribute("id","audioStream");let iy={display:"flex",marginBottom:"15px"};this.applyStyles(Wi,iy);let sy={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Bu=0;Bu<25;Bu++){let Mu=document.createElement("div");this.applyStyles(Mu,sy),Wi.appendChild(Mu)}let bn=document.createElement("div");bn.setAttribute("class","range-responsive");let Iu=document.createElement("p"),Pu=document.createElement("p"),Ru=document.createElement("p"),ay={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(bn,ay),Iu.innerText="0",Pu.innerText="50",Ru.innerText="100",bn.appendChild(Iu),bn.appendChild(Pu),bn.appendChild(Ru);let vn=document.createElement("div");vn.setAttribute("class","alert-div"),vn.setAttribute("id","alertDivMicrophone");let cy={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(vn,cy);let $i=document.createElement("error");$i.setAttribute("id","microphoneAlert"),$i.innerText="Teste de funcionamento",$i.style.marginLeft="10px";let qi=document.createElement("span"),Du=document.createElement("div"),Ou=document.createElement("div");qi.setAttribute("id","checkmark_microphone"),Du.setAttribute("id","checkmark_stem_microphone"),Ou.setAttribute("id","checkmark_kick_microphone"),qi.appendChild(Du),qi.appendChild(Ou),vn.appendChild(qi),vn.appendChild($i),Io.appendChild(Wi),Io.appendChild(bn);let Po=document.createElement("p");Po.setAttribute("class","pronounce-responsive"),Po.innerText='Pronuncie em voz alta: "Testando..."',Po.style.textAlign="start";let ly={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(Po,ly),To.appendChild(Io),To.appendChild(vn),o.appendChild(Po),o.appendChild(To);let Ro=document.createElement("div"),hy={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Ro,hy);let Do=document.createElement("button");Do.setAttribute("id","cancelBtn"),Do.setAttribute("class","button-responsive"),Do.innerText="Cancelar";let dy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Do,dy);let Uc=document.createElement("span");Uc.setAttribute("class","divider-responsive");let uy={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(Uc,uy);let Hr=document.createElement("button");Hr.innerText="Continuar",Hr.setAttribute("id","confirmBtn"),Hr.setAttribute("class","button-responsive");let py={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Hr,py),this.options.useSpyScan&&(Hr.style.cursor="not-allowed",Hr.setAttribute("disabled","true")),Ro.appendChild(Do),Ro.appendChild(Uc),Ro.appendChild(Hr),o.appendChild(Ro),r.appendChild(o),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),o=document.querySelector("#micSelect"),i=await St();n&&(n.value=t.cameraId||"default"),o&&(o.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};i.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),i.microphones.forEach(a=>{let c=s(a.label,a.id);o?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),o=document.getElementById("cameraSelect"),i=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:o?.value,microphoneId:i?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),o=document.getElementById("checkmark_FacePosition"),i=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),h=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),a&&a.setAttribute("title",""),o&&(o.setAttribute("class","checkmark"),i.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),h.setAttribute("class","checkmark_kick"))):(o&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),i.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),h.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","true"),o&&(o.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","false"),o&&(o.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),o=document.getElementById("alertDivSpyCam");o&&(o.style.display="flex");let i=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),i&&(i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):i&&(r&&(r.style.color="#FF0000"),i.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),o=document.getElementById("info_resolution"),i=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",o&&(o.style.display="none"),r.setAttribute("title",""),i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",o&&(o.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
364
- Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error"))}videoDeviceInterfaceUI(t){let r=document.querySelector("#cameraStream");r&&(r.srcObject=t,r.play().catch(n=>{console.warn("Erro ao iniciar preview de v\xEDdeo:",n)}))}audioDeviceInterfaceUIAllowedAmbient(t){let r=document.getElementById("ambientVerifyAlert"),n=document.getElementById("alertDivAmbientVerify"),o=document.getElementById("checkmark_AmbientVerify"),i=document.getElementById("checkmark_stem_AmbientVerify"),s=document.getElementById("checkmark_kick_AmbientVerify");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),o.setAttribute("class","checkmark"),i.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Ambiente apresentando muito ru\xEDdo!"),o.setAttribute("class","checkmark_error"),i.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIMicrophoneWorks(t){let r=document.getElementById("microphoneAlert"),n=document.getElementById("alertDivMicrophone"),o=document.getElementById("checkmark_microphone"),i=document.getElementById("checkmark_stem_microphone"),s=document.getElementById("checkmark_kick_microphone");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),o&&o.setAttribute("class","checkmark"),i&&i.setAttribute("class","checkmark_stem"),s&&s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Microfone n\xE3o est\xE1 funcionando corretamente!"),o&&o.setAttribute("class","checkmark_error"),i&&i.setAttribute("class","checkmark_stem_error"),s&&s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIErrorExec(){let t=document.getElementById("microphoneAlert"),r=document.getElementById("checkmark_microphone"),n=document.getElementById("checkmark_stem_microphone"),o=document.getElementById("checkmark_kick_microphone");t&&(t.style.color="#FF0000"),r&&r.setAttribute("class","checkmark_error"),n&&n.setAttribute("class","checkmark_stem_error"),o&&o.setAttribute("class","checkmark_kick_error")}audioDeviceInterfaceUIPills(t){let n=document.querySelector("#audioStream")?.querySelectorAll("div"),o=document.querySelector("#audioText"),i=t/4;n?.forEach((s,a)=>{a<Math.ceil(i)?s.style.backgroundColor="rgb(22, 163, 74)":s.style.backgroundColor="rgba(0, 0, 0, .3)"}),o&&(o.innerText=t.toFixed(0).toString())}async addStyleMask(){let t=`
367
+ `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let i=document.createElement("div");i.setAttribute("class","modal-responsive");let o={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(i,o);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),i.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),h=document.createElement("select");h.setAttribute("id","cameraSelect");let u={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,u),l.innerText="C\xE2mera";let m={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,m),h.style.maxWidth="400px",h.style.minWidth="150px",h.style.width="100%",h.style.boxSizing="border-box",c.appendChild(l),c.appendChild(h),i.appendChild(c);let p=document.createElement("div");p.setAttribute("id","liveCheckDevices"),p.setAttribute("class","camera-container-responsive");let g=document.createElement("div");g.setAttribute("class","video-responsive");let f=document.createElement("video"),b=document.createElement("div");f.setAttribute("id","cameraStream"),f.muted=!0;let _={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(p,_);let k={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(f,k),this.applyStyles(g,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let S=document.createElement("div");S.setAttribute("class","alert-div"),S.setAttribute("id","alertDivResolution");let R=document.createElement("error");R.setAttribute("id","resolutionAlert"),R.innerText="Resolu\xE7\xE3o m\xEDnima",R.style.marginLeft="10px",R.style.marginRight="5px";let x=document.createElement("span"),D=document.createElement("div"),P=document.createElement("div");x.setAttribute("id","checkmark_resolution"),D.setAttribute("id","checkmark_stem_resolution"),P.setAttribute("id","checkmark_kick_resolution"),x.appendChild(D),x.appendChild(P);let N=document.createElement("span"),Z=document.createElement("div"),E=document.createElement("div");N.setAttribute("class","info"),N.setAttribute("id","info_resolution"),Z.setAttribute("class","info_stem"),E.setAttribute("class","info_kick"),N.appendChild(Z),N.appendChild(E),S.appendChild(x),S.appendChild(R),S.appendChild(N);let F=document.createElement("div");F.setAttribute("class","alert-div"),F.setAttribute("id","alertDivFacePosition");let y=document.createElement("error");y.setAttribute("id","facePositionAlert"),y.innerText="Posicionamento da face",y.style.marginLeft="10px";let U=document.createElement("span"),se=document.createElement("div"),V=document.createElement("div");U.setAttribute("id","checkmark_FacePosition"),se.setAttribute("id","checkmark_stem_FacePosition"),V.setAttribute("id","checkmark_kick_FacePosition"),U.appendChild(se),U.appendChild(V),F.appendChild(U),F.appendChild(y);let he=document.createElement("div");he.setAttribute("class","alert-div"),he.setAttribute("id","alertDivAmbientVerify");let H=document.createElement("error");H.setAttribute("id","ambientVerifyAlert"),H.innerText="Verifica\xE7\xE3o do ambiente",H.style.marginLeft="10px";let oe=document.createElement("span"),O=document.createElement("div"),I=document.createElement("div");oe.setAttribute("id","checkmark_AmbientVerify"),O.setAttribute("id","checkmark_stem_AmbientVerify"),I.setAttribute("id","checkmark_kick_AmbientVerify"),oe.appendChild(O),oe.appendChild(I),he.appendChild(oe),he.appendChild(H);let Q=document.createElement("div");Q.setAttribute("class","alert-div"),Q.setAttribute("id","alertDivSpyCam"),Q.style.display="none";let q=document.createElement("error");q.setAttribute("id","SpyCamAlert"),q.innerText="Verifica\xE7\xE3o de Spy Cam",q.style.marginLeft="10px";let G=document.createElement("span"),Be=document.createElement("div"),nt=document.createElement("div");G.setAttribute("id","checkmark_SpyCam"),Be.setAttribute("id","checkmark_stem_SpyCam"),nt.setAttribute("id","checkmark_kick_SpyCam"),G.appendChild(Be),G.appendChild(nt),Q.appendChild(G),Q.appendChild(q),b.style.transform="rotateY(180deg)",b.style.display="flex",b.style.flexDirection="column",b.style.flex="1",b.style.minWidth="0",b.appendChild(S),b.appendChild(F),b.appendChild(he),b.appendChild(Q),p.appendChild(b),g.appendChild(f),g.style.flexShrink="0",p.appendChild(g);let ue=document.createElement("div");ue.setAttribute("class","facial-biometry__mask"),ue.style.width="100%",ue.style.height="100%",ue.style.position="absolute",ue.style.top="0px",ue.style.left="0px",ue.style.backgroundColor="#fff",ue.style.opacity="0.6";let de=document.createElement("div");de.setAttribute("class","biometry__frame"),de.style.width="100%",de.style.height="100%",de.style.position="absolute",de.style.top="0px",de.style.left="0px",de.style.zIndex="10",g.appendChild(ue),g.appendChild(de),i.appendChild(p);let Le=document.createElement("div");Le.setAttribute("class","mic-header-responsive");let De=document.createElement("h3"),ut=document.createElement("select");ut.setAttribute("id","micSelect");let Ot={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(Le,Ot),De.innerText="Microfone";let d={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(De,d),ut.style.maxWidth="400px",ut.style.minWidth="150px",ut.style.width="100%",ut.style.boxSizing="border-box",Le.appendChild(De),Le.appendChild(ut),i.appendChild(Le);let M=document.createElement("div");M.setAttribute("class","mic-container-responsive");let B={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(M,B);let w=document.createElement("div");w.setAttribute("class","mic-meter-responsive");let v={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(w,v);let C=document.createElement("div");C.setAttribute("id","audioStream");let z={display:"flex",marginBottom:"15px"};this.applyStyles(C,z);let j={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Bn=0;Bn<25;Bn++){let Jd=document.createElement("div");this.applyStyles(Jd,j),C.appendChild(Jd)}let A=document.createElement("div");A.setAttribute("class","range-responsive");let W=document.createElement("p"),K=document.createElement("p"),$=document.createElement("p"),re={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(A,re),W.innerText="0",K.innerText="50",$.innerText="100",A.appendChild(W),A.appendChild(K),A.appendChild($);let ye=document.createElement("div");ye.setAttribute("class","alert-div"),ye.setAttribute("id","alertDivMicrophone");let fe={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(ye,fe);let dt=document.createElement("error");dt.setAttribute("id","microphoneAlert"),dt.innerText="Teste de funcionamento",dt.style.marginLeft="10px";let xr=document.createElement("span"),Bt=document.createElement("div"),tn=document.createElement("div");xr.setAttribute("id","checkmark_microphone"),Bt.setAttribute("id","checkmark_stem_microphone"),tn.setAttribute("id","checkmark_kick_microphone"),xr.appendChild(Bt),xr.appendChild(tn),ye.appendChild(xr),ye.appendChild(dt),w.appendChild(C),w.appendChild(A);let Ce=document.createElement("p");Ce.setAttribute("class","pronounce-responsive"),Ce.innerText='Pronuncie em voz alta: "Testando..."',Ce.style.textAlign="start";let oi={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(Ce,oi),M.appendChild(w),M.appendChild(ye),i.appendChild(Ce),i.appendChild(M);let zr=document.createElement("div"),lr={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(zr,lr);let rn=document.createElement("button");rn.setAttribute("id","cancelBtn"),rn.setAttribute("class","button-responsive"),rn.innerText="Cancelar";let al={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(rn,al);let lo=document.createElement("span");lo.setAttribute("class","divider-responsive");let cl={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(lo,cl);let Ar=document.createElement("button");Ar.innerText="Continuar",Ar.setAttribute("id","confirmBtn"),Ar.setAttribute("class","button-responsive");let On={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Ar,On),this.options.useSpyScan&&(Ar.style.cursor="not-allowed",Ar.setAttribute("disabled","true")),zr.appendChild(rn),zr.appendChild(lo),zr.appendChild(Ar),i.appendChild(zr),r.appendChild(i),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),i=document.querySelector("#micSelect"),o=await ur();n&&(n.value=t.cameraId||"default"),i&&(i.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};o.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),o.microphones.forEach(a=>{let c=s(a.label,a.id);i?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),i=document.getElementById("cameraSelect"),o=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:i?.value,microphoneId:o?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),i=document.getElementById("checkmark_FacePosition"),o=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),h=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),a&&a.setAttribute("title",""),i&&(i.setAttribute("class","checkmark"),o.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),h.setAttribute("class","checkmark_kick"))):(i&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),i.setAttribute("class","checkmark_error"),o.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),h.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","true"),i&&(i.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","false"),i&&(i.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),i=document.getElementById("alertDivSpyCam");i&&(i.style.display="flex");let o=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),o&&(o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):o&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),i=document.getElementById("info_resolution"),o=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",i&&(i.style.display="none"),r.setAttribute("title",""),o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",i&&(i.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
368
+ Para iniciar um exame utilize uma outra c\xE2mera.`),o.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error"))}videoDeviceInterfaceUI(t){let r=document.querySelector("#cameraStream");r&&(r.srcObject=t,r.play().catch(n=>{console.warn("Erro ao iniciar preview de v\xEDdeo:",n)}))}audioDeviceInterfaceUIAllowedAmbient(t){let r=document.getElementById("ambientVerifyAlert"),n=document.getElementById("alertDivAmbientVerify"),i=document.getElementById("checkmark_AmbientVerify"),o=document.getElementById("checkmark_stem_AmbientVerify"),s=document.getElementById("checkmark_kick_AmbientVerify");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),i.setAttribute("class","checkmark"),o.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Ambiente apresentando muito ru\xEDdo!"),i.setAttribute("class","checkmark_error"),o.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIMicrophoneWorks(t){let r=document.getElementById("microphoneAlert"),n=document.getElementById("alertDivMicrophone"),i=document.getElementById("checkmark_microphone"),o=document.getElementById("checkmark_stem_microphone"),s=document.getElementById("checkmark_kick_microphone");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),i&&i.setAttribute("class","checkmark"),o&&o.setAttribute("class","checkmark_stem"),s&&s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Microfone n\xE3o est\xE1 funcionando corretamente!"),i&&i.setAttribute("class","checkmark_error"),o&&o.setAttribute("class","checkmark_stem_error"),s&&s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIErrorExec(){let t=document.getElementById("microphoneAlert"),r=document.getElementById("checkmark_microphone"),n=document.getElementById("checkmark_stem_microphone"),i=document.getElementById("checkmark_kick_microphone");t&&(t.style.color="#FF0000"),r&&r.setAttribute("class","checkmark_error"),n&&n.setAttribute("class","checkmark_stem_error"),i&&i.setAttribute("class","checkmark_kick_error")}audioDeviceInterfaceUIPills(t){let n=document.querySelector("#audioStream")?.querySelectorAll("div"),i=document.querySelector("#audioText"),o=t/4;n?.forEach((s,a)=>{a<Math.ceil(o)?s.style.backgroundColor="rgb(22, 163, 74)":s.style.backgroundColor="rgba(0, 0, 0, .3)"}),i&&(i.innerText=t.toFixed(0).toString())}async addStyleMask(){let t=`
365
369
  .facial-biometry__mask {
366
370
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
367
371
  mask-size: cover, auto 65%;
@@ -390,7 +394,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
390
394
  // -webkit-mask-position: center;
391
395
  // -webkit-mask-repeat: no-repeat;
392
396
  }
393
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[n,o]of Object.entries(r))t.style[n]=o}};var fa=class e{constructor(t){this.deviceCheckResult=null;this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.volumeMedia=0;this.volumeSum=0;this.volumeCounter=0;this.microphoneMinThreshold=5;this.allowedResolution=!0;this.allowedAmbient=!0;this.allowedPositionFace=!0;this.allowedMicrophone=!1;this.allowedSpyScan=null;this.noiseLimit=0;this.faceDetection=new Xn({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new ft({type:t?.type||"prod",token:t.token})}static{this.isModalOpen=!1}getDeviceCheckResult(){return this.deviceCheckResult}async runCheckDevicesFlow(t,r,n,o,i){if(e.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");this.options={...mt,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},e.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r);this.checkSpyScan();let a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>i(l);let c=new Promise((l,h)=>{n(()=>{this.closeCheckDevices(),l({result:!0,cameraId:t.cameraId||"default",microphoneId:t.microphoneId||"default",volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts}),e.isModalOpen=!1}),o(()=>{this.closeCheckDevices(),l({result:!1}),e.isModalOpen=!1})});return this.deviceCheckResult={...a,result:c},{...a,result:c}}catch(s){throw this.closeCheckDevices(),e.isModalOpen=!1,s}}onUpdateCallback(){typeof this.onUpdateCb=="function"&&this.onUpdateCb({allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts})}async checkDevices(t=mt,r=Ag){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0,this.DeviceCheckerUI=new pa(t,r);try{this.options={...mt,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let n=await this.backend.getParamsConfig(this.context);this.noiseLimit=n.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r),await this.checkSpyScan();let{cameraId:o,microphoneId:i,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{let c={result:s,cameraId:o,microphoneId:i,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts};this.deviceCheckResult=c,a(c)})}catch(n){return this.closeCheckDevices(),this.DeviceCheckerUI.closeModal(),Promise.reject(n)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings(),{width:r=0,height:n=0}=t;screen.orientation?.type.includes("portrait")&&Er()&&this.videoOptions.width==n&&this.videoOptions.height==r&&([r,n]=[n,r]),this.videoOptions.minWidth>r||this.videoOptions.minHeight>n?this.allowedResolution=!1:this.allowedResolution=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.isUnderResolutionUI(this.allowedResolution)}realtimeAlerts(t){this.faceDetectionAlerts=t,t.status==="OK"?(this.allowedPositionFace=!0,this.allowedAmbient=!0):(this.allowedPositionFace=!1,this.allowedAmbient=!1),this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.realtimeAlertsUI(t)}videoDeviceInterface(t){this.DeviceCheckerUI&&this.DeviceCheckerUI.videoDeviceInterfaceUI(t),this.isUnderResolution(),this.faceDetection.enableCam(t)}audioDeviceInterface(t){this.volumeMeter=new Cr(this.cameraRecorder.cameraStream),this.volumeMeter.start({setVolume:r=>{this.volumeCounter++,this.volumeSum+=r,!this.allowedMicrophone&&r>this.microphoneMinThreshold?(this.allowedMicrophone=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!0)):this.allowedMicrophone||this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIPills(r),r>this.noiseLimit?(this.allowedAmbient=!1,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!1)):(this.allowedAmbient=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!0))}}).catch(r=>{console.log(r),this.volumeMeter=void 0,this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec()})}async changeSelectedDevice({cameraId:t,microphoneId:r}){return this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new sr({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=mt,r){if(this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,n=>this.changeSelectedDevice(n)),this.videoOptions=aa(r),await Gi(),this.cameraRecorder=new sr({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let n=document.querySelector("#confirmBtn");!this.options.useSpyScan&&(n.disabled=!1)}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){e.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}async checkSpyScan(){if(this.spycam=new ro(this.context,{}),this.allowedSpyScan=null,this.options.useSpyScan){this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!0);try{await this.spycam.isPluggedIn()?await this.spycam.devices({deviceType:3}).then(r=>{r?.length>0?this.allowedSpyScan=!1:this.allowedSpyScan=!0}).finally(()=>{this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.allowedSpyScan!=null&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan)}):(this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan))}catch(t){this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan),console.log(t)}}}};var no=class{constructor(){}async takePicture(t,r,n={width:1080,height:720}){return this.resolution=n,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),n={audio:!1,video:{facingMode:"user",aspectRatio:1.777777778,width:{min:640,ideal:640,max:1920},height:{min:400,ideal:480},deviceId:t}};this.cameraRecorder=new sr({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startRecording(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),n=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),n.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((n,o)=>{let i=document.createElement("div");i.setAttribute("id","authPhoto"),i.style.backgroundColor="rgba(0,0,0,0.4)",i.style.zIndex="1000",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.height="100vh",i.style.width="100%",i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center";let s=document.createElement("div");s.style.backgroundColor="#fff",s.style.zIndex="1001",s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.height="100vh",s.style.width="100%",s.style.borderRadius="10px",s.style.display="flex",s.style.flexDirection="column",s.style.alignItems="center",s.style.boxSizing="border-box";let a=document.createElement("h3");a.innerText=t||"Biometria Facial",a.style.color="rgba(0, 0, 0, .7)",a.style.fontWeight="bold",a.style.fontSize="20px",a.style.marginTop="0px",a.style.marginBottom="15px",a.style.padding="20px 0px 0px",a.style.width="100%",a.style.textAlign="center",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.zIndex="1010",s.appendChild(a);let c=document.createElement("p");c.innerText=r||"Encaixe seu rosto no formato e clique no bot\xE3o abaixo",c.style.color="rgba(0, 0, 0, .7)",c.style.fontWeight="normal",c.style.fontSize="16px",c.style.marginBottom="15px",c.style.padding="0px 0px 20px",c.style.width="100%",c.style.textAlign="center",c.style.position="fixed",c.style.top="55px",c.style.left="0",c.style.zIndex="1011",s.appendChild(c);let l=document.createElement("div"),h=document.createElement("h3"),d=document.createElement("select");d.setAttribute("id","cameraSelect"),l.style.padding="0 20px",l.style.width="100%",l.style.display="flex",l.style.justifyContent="space-between",l.style.marginBottom="15px",h.innerText="C\xE2mera",h.style.color="rgba(0, 0, 0, .75)",h.style.fontWeight="bold",h.style.fontSize="16px",l.appendChild(h),l.appendChild(d);let u=document.createElement("div"),b=document.createElement("video");b.setAttribute("id","cameraStream"),b.muted=!0,u.style.position="fixed",u.style.top="0",u.style.left="0",u.style.height="100vh",u.style.width="100%",u.style.display="flex",u.style.justifyContent="center",b.style.backgroundColor="#000",b.style.borderRadius="10px",b.style.width="auto",b.style.height="auto",b.style.minHeight="100%",u.appendChild(b);let m=document.createElement("canvas");m.setAttribute("id","canvas"),m.style.display="none",m.style.width="100%",m.style.height="100%";let f=document.createElement("img");f.setAttribute("id","image"),f.style.objectFit="contain",f.style.display="none",f.style.borderRadius="8px",u.appendChild(m),u.appendChild(f);let y=document.createElement("div");y.setAttribute("class","facial-biometry__mask"),y.style.width="100%",y.style.height="100%",y.style.position="absolute",y.style.top="0px",y.style.left="0px",y.style.backgroundColor="#fff",y.style.opacity="0.8";let v=document.createElement("div");v.setAttribute("class","biometry__frame"),v.style.width="100%",v.style.height="100%",v.style.position="absolute",v.style.top="0px",v.style.left="0px",v.style.zIndex="10",u.appendChild(y),u.appendChild(v),s.appendChild(u),this.addStyleMask();let _=document.createElement("button"),x=document.createElement("div");_.setAttribute("id","confirmBtn"),x.style.position="fixed",x.style.bottom="0",x.style.left="0",x.style.width="100%",x.style.display="flex",x.style.alignItems="center",x.style.justifyContent="center",_.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",_.style.width="70px",_.style.height="70px",_.style.borderRadius="70px",_.style.border="none",_.style.backgroundColor="#16a34a",_.style.margin="20px";let B=document.createElement("button");B.setAttribute("id","closeModal"),B.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",B.style.width="70px",B.style.height="70px",B.style.borderRadius="70px",B.style.border="none",B.style.backgroundColor="#e74141",B.style.margin="20px",x.appendChild(B),x.appendChild(_),s.appendChild(x);let O=document.createElement("button");O.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",O.style.width="70px",O.style.height="70px",O.style.borderRadius="70px",O.style.border="none",O.style.backgroundColor="#e74141",O.style.margin="20px 20px";let R=document.createElement("button");R.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",R.style.width="70px",R.style.height="70px",R.style.borderRadius="70px",R.style.border="none",R.style.backgroundColor="#16a34a",R.style.margin="20px 20px",i.appendChild(s),document.body.appendChild(i),this.setSelectOption(),this.startCapture(),_.addEventListener("click",()=>{x.removeChild(_),x.removeChild(B),x.appendChild(O),x.appendChild(R),this.shot(),b.style.display="none",f.style.display="block"}),O.addEventListener("click",()=>{x.appendChild(B),x.appendChild(_),x.removeChild(O),x.removeChild(R),b.style.display="block",f.style.display="none"}),R.addEventListener("click",()=>{this.closeInterface(),n({base64:this.base64})}),B.addEventListener("click",()=>{this.closeInterface(),o(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await St();t&&(t.value="default");let n=(o,i)=>{let s=document.createElement("option");return s.setAttribute("value",i),s.innerHTML=o,s};r.cameras.forEach(o=>{let i=n(o.label,o.id);t?.appendChild(i)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopRecording(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
397
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}};var Ua=class e{constructor(t){this.deviceCheckResult=null;this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.volumeMedia=0;this.volumeSum=0;this.volumeCounter=0;this.microphoneMinThreshold=5;this.allowedResolution=!0;this.allowedAmbient=!0;this.allowedPositionFace=!0;this.allowedMicrophone=!1;this.allowedSpyScan=null;this.noiseLimit=0;this.faceDetection=new Bi({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new tr({type:t?.type||"prod",token:t.token})}static{this.isModalOpen=!1}getDeviceCheckResult(){return this.deviceCheckResult}async runCheckDevicesFlow(t,r,n,i,o){if(e.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");this.options={...rr,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},e.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r);this.checkSpyScan();let a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>o(l);let c=new Promise((l,h)=>{n(()=>{this.closeCheckDevices(),l({result:!0,cameraId:t.cameraId||"default",microphoneId:t.microphoneId||"default",volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts}),e.isModalOpen=!1}),i(()=>{this.closeCheckDevices(),l({result:!1}),e.isModalOpen=!1})});return this.deviceCheckResult={...a,result:c},{...a,result:c}}catch(s){throw this.closeCheckDevices(),e.isModalOpen=!1,s}}onUpdateCallback(){typeof this.onUpdateCb=="function"&&this.onUpdateCb({allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts})}async checkDevices(t=rr,r=jg){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0,this.DeviceCheckerUI=new Ma(t,r);try{this.options={...rr,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let n=await this.backend.getParamsConfig(this.context);this.noiseLimit=n.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r),await this.checkSpyScan();let{cameraId:i,microphoneId:o,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{let c={result:s,cameraId:i,microphoneId:o,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts};this.deviceCheckResult=c,a(c)})}catch(n){return this.closeCheckDevices(),this.DeviceCheckerUI.closeModal(),Promise.reject(n)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings(),{width:r=0,height:n=0}=t;screen.orientation?.type.includes("portrait")&&yn()&&this.videoOptions.width==n&&this.videoOptions.height==r&&([r,n]=[n,r]),this.videoOptions.minWidth>r||this.videoOptions.minHeight>n?this.allowedResolution=!1:this.allowedResolution=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.isUnderResolutionUI(this.allowedResolution)}realtimeAlerts(t){this.faceDetectionAlerts=t,t.status==="OK"?(this.allowedPositionFace=!0,this.allowedAmbient=!0):(this.allowedPositionFace=!1,this.allowedAmbient=!1),this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.realtimeAlertsUI(t)}videoDeviceInterface(t){this.DeviceCheckerUI&&this.DeviceCheckerUI.videoDeviceInterfaceUI(t),this.isUnderResolution(),this.faceDetection.enableCam(t)}audioDeviceInterface(t){this.volumeMeter=new bn(this.cameraRecorder.cameraStream),this.volumeMeter.start({setVolume:r=>{this.volumeCounter++,this.volumeSum+=r,!this.allowedMicrophone&&r>this.microphoneMinThreshold?(this.allowedMicrophone=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!0)):this.allowedMicrophone||this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIPills(r),r>this.noiseLimit?(this.allowedAmbient=!1,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!1)):(this.allowedAmbient=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!0))}}).catch(r=>{console.log(r),this.volumeMeter=void 0,this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec()})}async changeSelectedDevice({cameraId:t,microphoneId:r}){return this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new Yr({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=rr,r){if(this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,n=>this.changeSelectedDevice(n)),this.videoOptions=Pa(r),await ys(),this.cameraRecorder=new Yr({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let n=document.querySelector("#confirmBtn");!this.options.useSpyScan&&(n.disabled=!1)}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){e.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}async checkSpyScan(){if(this.spycam=new ji(this.context,{}),this.allowedSpyScan=null,this.options.useSpyScan){this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!0);try{await this.spycam.isPluggedIn()?await this.spycam.devices({deviceType:3}).then(r=>{r?.length>0?this.allowedSpyScan=!1:this.allowedSpyScan=!0}).finally(()=>{this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.allowedSpyScan!=null&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan)}):(this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan))}catch(t){this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan),console.log(t)}}}};var Vi=class{constructor(){}async takePicture(t,r,n={width:1080,height:720}){return this.resolution=n,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),n={audio:!1,video:{facingMode:"user",aspectRatio:1.777777778,width:{min:640,ideal:640,max:1920},height:{min:400,ideal:480},deviceId:t}};this.cameraRecorder=new Yr({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startRecording(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),n=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),n.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((n,i)=>{let o=document.createElement("div");o.setAttribute("id","authPhoto"),o.style.backgroundColor="rgba(0,0,0,0.4)",o.style.zIndex="1000",o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.height="100vh",o.style.width="100%",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center";let s=document.createElement("div");s.style.backgroundColor="#fff",s.style.zIndex="1001",s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.height="100vh",s.style.width="100%",s.style.borderRadius="10px",s.style.display="flex",s.style.flexDirection="column",s.style.alignItems="center",s.style.boxSizing="border-box";let a=document.createElement("h3");a.innerText=t||"Biometria Facial",a.style.color="rgba(0, 0, 0, .7)",a.style.fontWeight="bold",a.style.fontSize="20px",a.style.marginTop="0px",a.style.marginBottom="15px",a.style.padding="20px 0px 0px",a.style.width="100%",a.style.textAlign="center",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.zIndex="1010",s.appendChild(a);let c=document.createElement("p");c.innerText=r||"Encaixe seu rosto no formato e clique no bot\xE3o abaixo",c.style.color="rgba(0, 0, 0, .7)",c.style.fontWeight="normal",c.style.fontSize="16px",c.style.marginBottom="15px",c.style.padding="0px 0px 20px",c.style.width="100%",c.style.textAlign="center",c.style.position="fixed",c.style.top="55px",c.style.left="0",c.style.zIndex="1011",s.appendChild(c);let l=document.createElement("div"),h=document.createElement("h3"),u=document.createElement("select");u.setAttribute("id","cameraSelect"),l.style.padding="0 20px",l.style.width="100%",l.style.display="flex",l.style.justifyContent="space-between",l.style.marginBottom="15px",h.innerText="C\xE2mera",h.style.color="rgba(0, 0, 0, .75)",h.style.fontWeight="bold",h.style.fontSize="16px",l.appendChild(h),l.appendChild(u);let m=document.createElement("div"),p=document.createElement("video");p.setAttribute("id","cameraStream"),p.muted=!0,m.style.position="fixed",m.style.top="0",m.style.left="0",m.style.height="100vh",m.style.width="100%",m.style.display="flex",m.style.justifyContent="center",p.style.backgroundColor="#000",p.style.borderRadius="10px",p.style.width="auto",p.style.height="auto",p.style.minHeight="100%",m.appendChild(p);let g=document.createElement("canvas");g.setAttribute("id","canvas"),g.style.display="none",g.style.width="100%",g.style.height="100%";let f=document.createElement("img");f.setAttribute("id","image"),f.style.objectFit="contain",f.style.display="none",f.style.borderRadius="8px",m.appendChild(g),m.appendChild(f);let b=document.createElement("div");b.setAttribute("class","facial-biometry__mask"),b.style.width="100%",b.style.height="100%",b.style.position="absolute",b.style.top="0px",b.style.left="0px",b.style.backgroundColor="#fff",b.style.opacity="0.8";let _=document.createElement("div");_.setAttribute("class","biometry__frame"),_.style.width="100%",_.style.height="100%",_.style.position="absolute",_.style.top="0px",_.style.left="0px",_.style.zIndex="10",m.appendChild(b),m.appendChild(_),s.appendChild(m),this.addStyleMask();let k=document.createElement("button"),S=document.createElement("div");k.setAttribute("id","confirmBtn"),S.style.position="fixed",S.style.bottom="0",S.style.left="0",S.style.width="100%",S.style.display="flex",S.style.alignItems="center",S.style.justifyContent="center",k.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",k.style.width="70px",k.style.height="70px",k.style.borderRadius="70px",k.style.border="none",k.style.backgroundColor="#16a34a",k.style.margin="20px";let R=document.createElement("button");R.setAttribute("id","closeModal"),R.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",R.style.width="70px",R.style.height="70px",R.style.borderRadius="70px",R.style.border="none",R.style.backgroundColor="#e74141",R.style.margin="20px",S.appendChild(R),S.appendChild(k),s.appendChild(S);let x=document.createElement("button");x.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",x.style.width="70px",x.style.height="70px",x.style.borderRadius="70px",x.style.border="none",x.style.backgroundColor="#e74141",x.style.margin="20px 20px";let D=document.createElement("button");D.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",D.style.width="70px",D.style.height="70px",D.style.borderRadius="70px",D.style.border="none",D.style.backgroundColor="#16a34a",D.style.margin="20px 20px",o.appendChild(s),document.body.appendChild(o),this.setSelectOption(),this.startCapture(),k.addEventListener("click",()=>{S.removeChild(k),S.removeChild(R),S.appendChild(x),S.appendChild(D),this.shot(),p.style.display="none",f.style.display="block"}),x.addEventListener("click",()=>{S.appendChild(R),S.appendChild(k),S.removeChild(x),S.removeChild(D),p.style.display="block",f.style.display="none"}),D.addEventListener("click",()=>{this.closeInterface(),n({base64:this.base64})}),R.addEventListener("click",()=>{this.closeInterface(),i(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await ur();t&&(t.value="default");let n=(i,o)=>{let s=document.createElement("option");return s.setAttribute("value",o),s.innerHTML=i,s};r.cameras.forEach(i=>{let o=n(i.label,i.id);t?.appendChild(o)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopRecording(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
394
398
  .facial-biometry__mask {
395
399
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
396
400
  mask-size: cover, auto 65%;
@@ -419,16 +423,16 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
419
423
  // -webkit-mask-position: center;
420
424
  // -webkit-mask-repeat: no-repeat;
421
425
  }
422
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var ma=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,n)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),n(new Error("N\xE3o foi poss\xEDvel se conectar com a extens\xE3o"))),this.responseStart&&(clearInterval(t),r(this.responseStart)),this.tryes++},1e3)})}sendVerifyMsg(t,r){window.postMessage({type:"easyproctor",func:"verifyExtensionEasyproctor",url:t,token:r},"*")}verify(t){return t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="progress"&&this.options.onProgress&&this.options.onProgress(100),t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="start"&&(this.responseStart=!0),new Promise((r,n)=>{t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="version"&&(this.hasExtension=!0,r(this.hasExtension))})}addEventListener(){window.addEventListener("message",t=>this.verify(t))}};var ga=class{constructor(t,r,n,o){this.repositoryDevices=t,this.proctoringId=r,this.sessionOptions=n,this.allRecorders=o}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await St(),n=(b,m)=>b.label===m.label&&b.id===m.id,o=(b,m,f)=>b.filter(y=>!m.some(v=>f(y,v))),i=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:i?.cameras||[s],microphones:i?.microphones||[s]},c=r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out",l=[],h=[],d=!1;if(r.cameras.length!=a?.cameras.length){let b=c==="out"?o(a?.cameras,r.cameras,n):[],m=c==="in"?o(r.cameras,a?.cameras,n):[];l=c==="out"?b:m,l=l.filter(f=>f.id!="default"),console.log(b),console.log(this.sessionOptions.cameraId),c==="out"&&(d=b.some(f=>f.id===this.sessionOptions.cameraId))}if(r.microphones.length!=a?.microphones.length){let b=c==="out"?o(a?.microphones,r.microphones,n):[],m=c==="in"?o(r.microphones,a?.microphones,n):[];h=c==="out"?b:m,h=h.filter(f=>f.id!="default"&&f.id!="communications"),c==="out"&&!d&&(d=b.some(f=>f.id===this.sessionOptions.microphoneId))}let u={cameras:l||[],microphones:h||[],status:c,isActiveDevice:d};await this.repositoryDevices.save({...r,id:"devices",status:c}),t.status&&(u.cameras.length!=0||u.microphones.length!=0)&&(U.registerChangeDevice(this.proctoringId,u.status,JSON.stringify(u,null,2)),u.isActiveDevice&&this.allRecorders.alertRecorder.addAlert({alert:39,type:2}),t.status(u))}};var Hg=Lu(Vg()),oo=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:o}=t;try{U.registerDownloadFile(this.proctoringId,`File to download
426
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var Na=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,n)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),n(new Error("N\xE3o foi poss\xEDvel se conectar com a extens\xE3o"))),this.responseStart&&(clearInterval(t),r(this.responseStart)),this.tryes++},1e3)})}sendVerifyMsg(t,r){window.postMessage({type:"easyproctor",func:"verifyExtensionEasyproctor",url:t,token:r},"*")}verify(t){return t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="progress"&&this.options.onProgress&&this.options.onProgress(100),t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="start"&&(this.responseStart=!0),new Promise((r,n)=>{t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="version"&&(this.hasExtension=!0,r(this.hasExtension))})}addEventListener(){window.addEventListener("message",t=>this.verify(t))}};var za=class{constructor(t,r,n,i){this.repositoryDevices=t,this.proctoringId=r,this.sessionOptions=n,this.allRecorders=i}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await ur(),n=(p,g)=>p.label===g.label&&p.id===g.id,i=(p,g,f)=>p.filter(b=>!g.some(_=>f(b,_))),o=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:o?.cameras||[s],microphones:o?.microphones||[s]},c=r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out",l=[],h=[],u=!1;if(r.cameras.length!=a?.cameras.length){let p=c==="out"?i(a?.cameras,r.cameras,n):[],g=c==="in"?i(r.cameras,a?.cameras,n):[];l=c==="out"?p:g,l=l.filter(f=>f.id!="default"),console.log(p),console.log(this.sessionOptions.cameraId),c==="out"&&(u=p.some(f=>f.id===this.sessionOptions.cameraId))}if(r.microphones.length!=a?.microphones.length){let p=c==="out"?i(a?.microphones,r.microphones,n):[],g=c==="in"?i(r.microphones,a?.microphones,n):[];h=c==="out"?p:g,h=h.filter(f=>f.id!="default"&&f.id!="communications"),c==="out"&&!u&&(u=p.some(f=>f.id===this.sessionOptions.microphoneId))}let m={cameras:l||[],microphones:h||[],status:c,isActiveDevice:u};await this.repositoryDevices.save({...r,id:"devices",status:c}),t.status&&(m.cameras.length!=0||m.microphones.length!=0)&&(ge.registerChangeDevice(this.proctoringId,m.status,JSON.stringify(m,null,2)),m.isActiveDevice&&this.allRecorders.alertRecorder.addAlert({alert:39,type:2}),t.status(m))}};var o0=hl(i0()),Hi=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:i}=t;try{ge.registerDownloadFile(this.proctoringId,`File to download
423
427
  File name: ${n.name}
424
428
  File type: ${n.type}
425
- File size: ${n.size}}`),(0,Hg.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),o&&o(Math.round(100))}catch{throw n&&this.proctoringId&&U.registerError(this.proctoringId,`Failed on machine download
429
+ File size: ${n.size}}`),(0,o0.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),i&&i(Math.round(100))}catch{throw n&&this.proctoringId&&ge.registerError(this.proctoringId,`Failed on machine download
426
430
  File name: ${n.name}
427
431
  File type: ${n.type}
428
- File size: ${n.size}`),new Error("Error on machine download")}}};var ya=class{constructor(t,r){this.session=t;this.recorders=r}async startAll(){this.session.start();for(let t of this.recorders)await t.startRecording({retry:!1})}async pauseAll(){this.session.pause();for(let t of this.recorders)await t.pauseRecording()}async resumeAll(){this.session.resume();for(let t of this.recorders)await t.resumeRecording()}async stopAll(){for(let t of this.recorders)await t.stopRecording();this.session.stop()}async saveAllOnSession(){for(let t of this.recorders)await t.saveOnSession(this.session)}};var io=class{constructor(t,r,n){this.session=t;this.proctoringId=r;this.uploadServices=n}async upload(t,r){await this.uploadRecordings(t,r)}async uploadRecordings(t,r){await this.uploadAllFiles(t,r),this.session.hasSomethingToUpload||this.session.setUploaded()}async uploadAllFiles(t,r){for(let n=0;n<this.session.recordings.length;n++){let o=this.session.recordings[n];if(o.upload)continue;let i=a=>{let c=(n*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(o,t,i).catch(()=>{});s&&(o.upload||(o.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(o.upload.storage=s.storage),s.storage==="upload"?s.url&&(o.upload.azureUrl=s.url):s.url&&(o.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,n){for await(let o of this.uploadServices){let i=await o.upload({file:t.file,onProgress:s=>{n&&n(s)}},r);if(i){let s="";return t.file.name.search("camera")!==-1?s="Camera":t.file.name.search("screen")!==-1?s="Screen":t.file.name.search("audio")!==-1&&(s="Audio"),U.registerUploadFile(this.proctoringId,`Upload File
432
+ File size: ${n.size}`),new Error("Error on machine download")}}};var ja=class{constructor(t,r){this.session=t;this.recorders=r}async startAll(){this.session.start();for(let t of this.recorders)await t.startRecording({retry:!1})}async pauseAll(){this.session.pause();for(let t of this.recorders)await t.pauseRecording()}async resumeAll(){this.session.resume();for(let t of this.recorders)await t.resumeRecording()}async stopAll(){for(let t of this.recorders)await t.stopRecording();this.session.stop()}async saveAllOnSession(){for(let t of this.recorders)await t.saveOnSession(this.session)}};var Wi=class{constructor(t,r,n){this.session=t;this.proctoringId=r;this.uploadServices=n}async upload(t,r){await this.uploadRecordings(t,r)}async uploadRecordings(t,r){await this.uploadAllFiles(t,r),this.session.hasSomethingToUpload||this.session.setUploaded()}async uploadAllFiles(t,r){for(let n=0;n<this.session.recordings.length;n++){let i=this.session.recordings[n];if(i.upload)continue;let o=a=>{let c=(n*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(i,t,o).catch(()=>{});s&&(i.upload||(i.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(i.upload.storage=s.storage),s.storage==="upload"?s.url&&(i.upload.azureUrl=s.url):s.url&&(i.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,n){for await(let i of this.uploadServices){let o=await i.upload({file:t.file,onProgress:s=>{n&&n(s)}},r);if(o){let s="";return t.file.name.search("camera")!==-1?s="Camera":t.file.name.search("screen")!==-1?s="Screen":t.file.name.search("audio")!==-1&&(s="Audio"),ge.registerUploadFile(this.proctoringId,`Upload File
429
433
  Name: ${t.file.name}
430
434
  Type: ${t.file.type}
431
- Size: ${t.file.size}`,s),i}}throw new Error("Could not upload")}};var ba=class{constructor(t,r){this.alerts=[];this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async pauseRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async resumeRecording(){this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async stopRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}onLostFocus(){Date.now()-this.startTime?.getTime()>1e4&&(this.onLostFocusCallback(),this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:0,alert:25,type:3}))}onReturnFocus(){let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback(),t.end=Date.now()-this.startTime.getTime())}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var va=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:n,pauseRecording:o,resumeRecording:i}=Qr(this.audioStream,this.blobs,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=n,this.recordingPause=o,this.recordingResume=i,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,n){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&n&&`${r}_${n}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var rn=typeof self<"u"?self:{};function Zr(){throw Error("Invalid UTF8")}function zg(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var wa,Yh,l4=typeof TextDecoder<"u",h4,d4=typeof TextEncoder<"u";function x1(e){if(d4)e=(h4||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&o<e.length){let i=e.charCodeAt(++o);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}o--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var md,Aa;e:{for(Qh=["CLOSURE_FLAGS"],_a=rn,Sa=0;Sa<Qh.length;Sa++)if((_a=_a[Qh[Sa]])==null){Aa=null;break e}Aa=_a}var Qh,_a,Sa,bi,Wg=Aa&&Aa[610401301];md=Wg!=null&&Wg;var $g=rn.navigator;function ad(e){return!!md&&!!bi&&bi.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function vt(e){var t;return(t=rn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function Tr(){return!!md&&!!bi&&bi.brands.length>0}function Zh(){return Tr()?ad("Chromium"):(vt("Chrome")||vt("CriOS"))&&!(!Tr()&&vt("Edge"))||vt("Silk")}bi=$g&&$g.userAgentData||null;var u4=!Tr()&&(vt("Trident")||vt("MSIE"));!vt("Android")||Zh(),Zh(),vt("Safari")&&(Zh()||!Tr()&&vt("Coast")||!Tr()&&vt("Opera")||!Tr()&&vt("Edge")||(Tr()?ad("Microsoft Edge"):vt("Edg/"))||Tr()&&ad("Opera"));var A1={},pi=null;function p4(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),o=0;return(function(i,s){function a(l){for(;c<i.length;){let h=i.charAt(c++),d=pi[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}T1();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),u=a(64);if(u===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),u!=64&&s(d<<6&192|u))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function T1(){if(!pi){pi={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));A1[r]=n;for(let o=0;o<n.length;o++){let i=n[o];pi[i]===void 0&&(pi[i]=o)}}}}var I1=typeof Uint8Array<"u",P1=!u4&&typeof btoa=="function";function qg(e){if(!P1){var t;t===void 0&&(t=0),T1(),t=A1[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],i=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|i>>4],i=t[(15&i)<<2|s>>6],s=t[63&s],r[l++]=a+o+i+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var Gg=/[-_.]/g,f4={"-":"+",_:"/",".":"="};function m4(e){return f4[e]||""}function R1(e){if(!P1)return p4(e);Gg.test(e)&&(e=e.replace(Gg,m4)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Fa(e){return I1&&e!=null&&e instanceof Uint8Array}var uo={};function po(){return g4||=new Pr(null,uo)}function gd(e){D1(uo);var t=e.g;return(t=t==null||Fa(t)?t:typeof t=="string"?R1(t):null)==null?t:e.g=t}var Pr=class{i(){return new Uint8Array(gd(this)||0)}constructor(e,t){if(D1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},g4,y4;function D1(e){if(e!==uo)throw Error("illegal external caller")}function O1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Kg(){let e=Error("int32");return O1(e,"warning"),e}var Ua=typeof Symbol=="function"&&typeof Symbol()=="symbol",b4=new Set;function Na(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&b4.add(e),e}var v4=Na("jas",void 0,!0,!0),ed=Na(void 0,"2ex"),di=Na(void 0,"1oa",!0),fo=Na(void 0,Symbol(),!0),I=Ua?v4:"M",B1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},M1=Object.defineProperties;function yd(e,t){Ua||I in e||M1(e,B1),e[I]|=t}function Ee(e,t){Ua||I in e||M1(e,B1),e[I]=t}function w4(e,t){Ee(t,-30975&(0|e))}function cd(e,t){Ee(t,-30941&(34|e))}function bd(){return typeof BigInt=="function"}function wt(e){return Array.prototype.slice.call(e)}var vd,wi={},_4={};function Xg(e){return!(!e||typeof e!="object"||e.g!==_4)}function wd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function L1(e,t){if(e!=null){if(typeof e=="string")e=e?new Pr(e,uo):po();else if(e.constructor!==Pr)if(Fa(e))e=e.length?new Pr(new Uint8Array(e),uo):po();else{if(!t)throw Error();e=void 0}}return e}function Ta(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[I]))}var Jg=[];function sn(e){if(2&e)throw Error()}function _d(e){return fo?e[fo]:void 0}Ee(Jg,55),vd=Object.freeze(Jg);var F1=Object.freeze({}),Sd=typeof rn.BigInt=="function"&&typeof rn.BigInt(0)=="bigint",ld=e=>Sd?e>=k4&&e<=C4:e[0]==="-"?Yg(e,S4):Yg(e,E4),S4=Number.MIN_SAFE_INTEGER.toString(),k4=Sd?BigInt(Number.MIN_SAFE_INTEGER):void 0,E4=Number.MAX_SAFE_INTEGER.toString(),C4=Sd?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Yg(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],o=t[r];if(n>o)return!1;if(n<o)return!0}}var x4=typeof Uint8Array.prototype.slice=="function",U1,X=0,he=0;function Qg(e){let t=e>>>0;X=t,he=(e-t)/4294967296>>>0}function mo(e){if(e<0){Qg(-e);let[t,r]=Cd(X,he);X=t>>>0,he=r>>>0}else Qg(e)}function N1(e){let t=U1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),he=0,X=t.getUint32(0,!0)}function kd(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:vi(e,t)}function Ed(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=kd(e,t))=="number"?r?-e:e:r?"-"+e:e}function vi(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else bd()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Zg(r)+Zg(e));return r}function Zg(e){return e=String(e),"0000000".slice(e.length)+e}function ja(e){if(e.length<16)mo(Number(e));else if(bd())e=BigInt(e),X=Number(e&BigInt(4294967295))>>>0,he=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");he=X=0;let r=e.length;for(let n=t,o=(r-t)%6+t;o<=r;n=o,o+=6){let i=Number(e.slice(n,o));he*=1e6,X=1e6*X+i,X>=4294967296&&(he+=Math.trunc(X/4294967296),he>>>=0,X>>>=0)}if(t){let[n,o]=Cd(X,he);X=n,he=o}}}function Cd(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var j1=typeof BigInt=="function"?BigInt.asIntN:void 0,A4=typeof BigInt=="function"?BigInt.asUintN:void 0,fi=Number.isSafeInteger,Va=Number.isFinite,Ia=Math.trunc;function _i(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function e1(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}var T4=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function xd(e){switch(typeof e){case"bigint":return!0;case"number":return Va(e);case"string":return T4.test(e);default:return!1}}function nn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Va(e)?0|e:void 0}function t1(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function V1(e){return e=Ia(e),fi(e)||(mo(e),e=Ed(X,he)),e}function H1(e){var t=Ia(Number(e));if(fi(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(ja(e),e=X,2147483648&(t=he))if(bd())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Cd(e,t);e="-"+vi(r,n)}else e=vi(e,t);return e}function hd(e){return e==null?e:typeof e=="bigint"?(ld(e)?e=Number(e):(e=j1(64,e),e=ld(e)?Number(e):String(e)),e):xd(e)?typeof e=="number"?V1(e):H1(e):void 0}function I4(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(A4(64,e));if(xd(e)){if(t==="string")return t=Ia(Number(e)),fi(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t1(e)||(ja(e),e=vi(X,he))),e;if(t==="number")return(e=Ia(e))>=0&&fi(e)?e:(function(r){if(r<0){mo(r);var n=vi(X,he);return r=Number(n),fi(r)?r:n}return t1(n=String(r))?n:(mo(r),kd(X,he))})(e)}}function z1(e){if(typeof e!="string")throw Error();return e}function Pa(e){if(e!=null&&typeof e!="string")throw Error();return e}function Rr(e){return e==null||typeof e=="string"?e:void 0}function W1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===wi)return e;if(Array.isArray(e)){var n=0|e[I],o=n;return o===0&&(o|=32&r),(o|=2&r)!==n&&Ee(e,o),new t(e)}}function $1(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=Ta(e)?void 0:o&&2&(0|e[I])?e:Ad(e,t,r,n!==void 0,o);else if(wd(e)){let i={};for(let s in e)i[s]=$1(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Ad(e,t,r,n,o){let i=n||r?0|e[I]:0,s=n?!!(32&i):void 0;n=wt(e);for(let a=0;a<n.length;a++)n[a]=$1(n[a],t,r,s,o);return r&&((e=_d(e))&&(n[fo]=wt(e)),r(i,n)),n}function P4(e){return e.B===wi?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return ld(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Ta(t))return}else{if(Fa(t))return qg(t);if(t instanceof Pr){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=qg(r)}}}return t})(e)}function R4(e){return Ad(e,P4,void 0,void 0,!1)}var q1,D4;function mi(e,t,r){return e=G1(e,t[0],t[1],r?1:2),t!==q1&&r&&yd(e,16384),e}function G1(e,t,r,n){if(e==null){var o=96;r?(e=[r],o|=512):e=[],t&&(o=-33521665&o|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(o=0|e[I]))throw Error("farr");if(64&o)return e;if(n===1||n===2||(o|=64),r&&(o|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let i=n-1;if(wd(r[i])){if((t=i-(512&(o|=256)?0:-1))>=1024)throw Error("pvtlmt");o=-33521665&o|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&o?0:-1)))>1024)throw Error("spvt");o=-33521665&o|(1023&t)<<15}}}return Ee(e,o),e}function K1(e,t,r=cd){if(e!=null){if(I1&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[I];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(Ee(e,-12293&(34|n)),e):Ad(e,K1,4&n?cd:r,!0,!0))}return e.B===wi&&(e=2&(n=0|(r=e.l)[I])?e:new e.constructor(Ha(r,n,!0))),e}}function X1(e){let t=e.l;return new e.constructor(Ha(t,0|t[I],!1))}function Ha(e,t,r){let n=r||2&t?cd:w4,o=!!(32&t);return e=(function(i,s,a){let c=wt(i);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(i=_d(i))&&(c[fo]=wt(i)),c})(e,t,(i=>K1(i,o,n))),yd(e,32|(r?2:0)),e}function Td(e){let t=e.l,r=0|t[I];return 2&r?new e.constructor(Ha(t,r,!1)):e}function It(e,t){return an(e=e.l,0|e[I],t)}function an(e,t,r,n){if(r===-1)return null;var o=r+(512&t?0:-1);let i=e.length-1;return o>=i&&256&t?e[i][r]:n&&256&t&&(t=e[i][r])!=null?(e[o]!=null&&ed!=null&&((o=(e=y4??={})[ed]||0)>=4||(e[ed]=o+1,O1(e=Error(),"incident"),(function(s){rn.setTimeout((()=>{throw s}),0)})(e))),t):o<=i?e[o]:void 0}function Ie(e,t,r){let n=e.l,o=0|n[I];return sn(o),Ce(n,o,t,r),e}function Ce(e,t,r,n){let o=512&t?0:-1,i=r+o;var s=e.length-1;return i>=s&&256&t?(e[s][r]=n,t):i<=s?(e[i]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+o]={[r]:n},Ee(e,t|=256)):e[i]=n),t)}function J1(e){let t=0|(e=e.l)[I],r=an(e,t,1),n=L1(r,!0);return n!=null&&n!==r&&Ce(e,t,1,n),n}function Y1(e,t,r,n,o){let i=e.l,s=2&(e=0|i[I])?1:n;o=!!o;let a=0|(n=Id(i,e,t))[I];if(!(4&a)){4&a&&(n=wt(n),a=cr(a,e),e=Ce(i,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=Pd(a,e),r=-4097&(20|a),a=r&=-8193,Ee(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?ar(a)||(o=a,a|=2,a!==o&&Ee(n,a),Object.freeze(n)):(s===2&&ar(a)&&(n=wt(n),a=cr(a,e),a=Dr(a,e,o),Ee(n,a),e=Ce(i,e,t,n)),ar(a)||(t=a,a=Dr(a,e,o),a!==t&&Ee(n,a))),n}function Id(e,t,r,n){return e=an(e,t,r,n),Array.isArray(e)?e:vd}function Pd(e,t){return e===0&&(e=cr(e,t)),1|e}function ar(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function r1(e,t,r){let n=0|(e=e.l)[I];if(sn(n),r==null)Ce(e,n,t);else{var o=0|r[I],i=o,s=ar(o),a=s||Object.isFrozen(r);for(s||(o=0),a||(r=wt(r),i=0,o=Dr(o=cr(o,n),n,!0),a=!1),o|=21,s=0;s<r.length;s++){let c=r[s],l=z1(c);Object.is(c,l)||(a&&(r=wt(r),i=0,o=Dr(o=cr(o,n),n,!0),a=!1),r[s]=l)}o!==i&&(a&&(r=wt(r),o=Dr(o=cr(o,n),n,!0)),Ee(r,o)),Ce(e,n,t,r)}}function Q1(e,t){let r=0|(e=e.l)[I];sn(r),Ce(e,r,2,t===""?void 0:t)}function Si(e,t,r,n,o){sn(t);var i=!(!(64&t)&&16384&t);let s=(o=Id(e,t,r,o))!==vd;if(i||!s){let a=i=s?0|o[I]:0;(!s||2&a||ar(a)||4&a&&!(32&a))&&(o=wt(o),a=cr(a,t),t=Ce(e,t,r,o)),a=-13&Pd(a,t),a=Dr(n?-17&a:16|a,t,!0),a!==i&&Ee(o,a)}return o}function td(e,t){var r=H0;return Dd(Rd(e=e.l),e,0|e[I],r)===t?t:-1}function Rd(e){if(Ua)return e[di]??(e[di]=new Map);if(di in e)return e[di];let t=new Map;return Object.defineProperty(e,di,{value:t}),t}function Z1(e,t,r,n){let o=Rd(e),i=Dd(o,e,t,r);return i!==n&&(i&&(t=Ce(e,t,i)),o.set(r,n)),t}function Dd(e,t,r,n){let o=e.get(n);if(o!=null)return o;o=0;for(let i=0;i<n.length;i++){let s=n[i];an(t,r,s)!=null&&(o!==0&&(r=Ce(t,r,o)),o=s)}return e.set(n,o),o}function Od(e,t,r,n){let o,i=0|e[I];if((n=an(e,i,r,n))!=null&&n.B===wi)return(t=Td(n))!==n&&Ce(e,i,r,t),t.l;if(Array.isArray(n)){let s=0|n[I];o=2&s?mi(Ha(n,s,!1),t,!0):64&s?n:mi(o,t,!0)}else o=mi(void 0,t,!0);return o!==n&&Ce(e,i,r,o),o}function e0(e,t,r,n){let o=0|(e=e.l)[I];return(t=W1(n=an(e,o,r,n),t,o))!==n&&t!=null&&Ce(e,o,r,t),t}function Pt(e,t,r){if((t=e0(e,t,r,!1))==null)return t;let n=0|(e=e.l)[I];if(!(2&n)){let o=Td(t);o!==t&&Ce(e,n,r,t=o)}return t}function t0(e,t,r,n,o,i){e=e.l;var s=!!(2&t);let a=s?1:n;o=!!o,i&&=!s;var c=0|(n=Id(e,t,1))[I];if(!(s=!!(4&c))){var l=n,h=t;let d=!!(2&(c=Pd(c,t)));d&&(h|=2);let u=!d,b=!0,m=0,f=0;for(;m<l.length;m++){let y=W1(l[m],r,h);if(y instanceof r){if(!d){let v=!!(2&(0|y.l[I]));u&&=!v,b&&=v}l[f++]=y}}f<m&&(l.length=f),c|=4,c=b?16|c:-17&c,Ee(l,c=u?8|c:-9&c),d&&Object.freeze(l)}if(i&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(ar(c)&&(n=wt(n),c=cr(c,t),t=Ce(e,t,1,n)),r=n,i=c,l=0;l<r.length;l++)(c=r[l])!==(h=Td(c))&&(r[l]=h);i|=8,Ee(r,i=r.length?-17&i:16|i),c=i}return a===1||a===4&&32&c?ar(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&Ee(n,c),Object.freeze(n)):(a===2&&ar(c)&&(Ee(n=wt(n),c=Dr(c=cr(c,t),t,o)),t=Ce(e,t,1,n)),ar(c)||(e=c,(c=Dr(c,t,o))!==e&&Ee(n,c))),n}function Bd(e,t){let r=0|e.l[I];return t0(e,r,t,F1===void 0?2:4,!1,!(2&r))}function Rt(e,t,r,n){return n==null&&(n=void 0),Ie(e,r,n)}function rd(e,t,r){var n=U0;r==null&&(r=void 0);e:{let o=0|(e=e.l)[I];if(sn(o),r==null){let i=Rd(e);if(Dd(i,e,o,n)!==t)break e;i.set(n,0)}else o=Z1(e,o,n,t);Ce(e,o,t,r)}}function cr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function Dr(e,t,r){return 32&t&&r||(e&=-33),e}function r0(e,t){var r=Jd;let n=0|e.l[I];sn(n),e=t0(e,n,r,2,!0),t=t??new r,e.push(t),e[I]=2&(0|t.l[I])?-9&e[I]:-17&e[I]}function qe(e,t,r){sn(0|e.l[I]),Y1(e,t,Rr,2,!0).push(z1(r))}function n0(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Md(){return Error("Failed to read varint, encoding is invalid.")}function o0(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Ld(e){if(typeof e=="string")return{buffer:R1(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Pr)return{buffer:gd(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Fd(e,t){let r,n=0,o=0,i=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);for(i>32&&(o|=(127&r)>>4),i=3;i<32&&128&r;i+=7)r=s[a++],o|=(127&r)<<i;if(tn(e,a),r<128)return t(n>>>0,o>>>0);throw Md()}function Ud(e){let t=0,r=e.g,n=r+10,o=e.i;for(;r<n;){let i=o[r++];if(t|=i,(128&i)==0)return tn(e,r),!!(127&t)}throw Md()}function Ge(e){let t=e.i,r=e.g,n=t[r++],o=127&n;if(128&n&&(n=t[r++],o|=(127&n)<<7,128&n&&(n=t[r++],o|=(127&n)<<14,128&n&&(n=t[r++],o|=(127&n)<<21,128&n&&(n=t[r++],o|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Md();return tn(e,r),o}function dd(e){var t=e.i;let r=e.g,n=t[r],o=t[r+1],i=t[r+2];return t=t[r+3],tn(e,e.g+4),(n<<0|o<<8|i<<16|t<<24)>>>0}function ud(e){var t=dd(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function O4(e){return Ge(e)}function nd(e,t,{C:r=!1}={}){e.C=r,t&&(t=Ld(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function tn(e,t){if(e.g=t,t>e.j)throw o0(e.j,t)}function i0(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw o0(t,e.j-r);return e.g=n,r}function s0(e,t){if(t==0)return po();var r=i0(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):x4?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?po():new Pr(r,uo)}var n1=[];function a0(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Ge(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw n0(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Ca(e){switch(e.i){case 0:e.i!=0?Ca(e):Ud(e.g);break;case 1:tn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Ca(e);else{var t=Ge(e.g)>>>0;tn(e=e.g,e.g+t)}break;case 5:tn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!a0(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Ca(e)}break;default:throw n0(e.i,e.j)}}function za(e,t,r){let n=e.g.j,o=Ge(e.g)>>>0,i=e.g.g+o,s=i-n;if(s<=0&&(e.g.j=i,r(t,e,void 0,void 0,void 0),s=i-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=i,e.g.j=n}function Nd(e){var t=Ge(e.g)>>>0,r=i0(e=e.g,t);if(e=e.i,l4){var n,o=e;(n=Yh)||(n=Yh=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var i=n.decode(o)}catch(a){if(wa===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),wa=!0}catch{wa=!1}}throw!wa&&(Yh=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var s=e[i++];s<128?r.push(s):s<224?i>=t?Zr():(a=e[i++],s<194||(192&a)!=128?(i--,Zr()):r.push((31&s)<<6|63&a)):s<240?i>=t-1?Zr():(a=e[i++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Zr()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?i>=t-2?Zr():(a=e[i++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(o=e[i++]))!=128?(i--,Zr()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Zr(),r.length>=8192&&(c=zg(c,r),r.length=0)}i=zg(c,r)}return i}function c0(e){let t=Ge(e.g)>>>0;return s0(e.g,t)}function jd(e,t,r){var n=Ge(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var ka=[];function B4(e){return e}var co;function l0(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var te=class{constructor(e,t){this.l=G1(e,t)}toJSON(){let e=!co;try{return e&&(co=R4),h0(this)}finally{e&&(co=void 0)}}u(){return!!(2&(0|this.l[I]))}};function h0(e){var t=e.l;{t=(e=co(t))!==t;let l=e.length;if(l){var r=e[l-1],n=wd(r);n?l--:r=void 0;var o=e;if(n){e:{var i,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(i??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(Ta(n)||Xg(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((i??={})[h]=n));if(a||(i=s),i)for(let h in i){a=i;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((i=o[l-1])==null||Ta(i)||Xg(i)&&i.size===0);l--)var c=!0;(o!==e||s||c)&&(t?(c||s||a)&&(o.length=l):o=Array.prototype.slice.call(o,0,l),a&&o.push(a)),c=o}else c=e}return c}function o1(e){return e?/^\d+$/.test(e)?(ja(e),new pd(X,he)):null:M4||=new pd(0,0)}te.prototype.B=wi,te.prototype.toString=function(){try{return co=B4,h0(this).toString()}finally{co=void 0}};var pd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},M4;function i1(e){return e?/^-?\d+$/.test(e)?(ja(e),new fd(X,he)):null:L4||=new fd(0,0)}var fd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},L4;function lo(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ki(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Wa(e,t){if(t>=0)ki(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Ra(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function go(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Dt(e,t,r){ki(e.g,8*t+r)}function $a(e,t){return Dt(e,t,2),t=e.g.end(),go(e,t),t.push(e.i),t}function qa(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function Ga(e,t,r){Dt(e,t,2),ki(e.g,r.length),go(e,e.g.end()),go(e,r)}function Ot(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Vd=Ot(),d0=Ot(),Hd=Ot(),zd=Ot(),u0=Ot(),p0=Ot(),f0=Ot(),m0=Ot(),yo=class{constructor(e,t,r){this.g=e,this.i=t,e=Vd,this.j=!!e&&r===e||!1}};function Wd(e,t){return new yo(e,t,Vd)}function g0(e,t,r,n,o){(t=w0(t,n))!=null&&(r=$a(e,r),o(t,e),qa(e,r))}var F4=Wd((function(e,t,r,n,o){return e.i===2&&(za(e,Od(t,n,r),o),!0)}),g0),U4=Wd((function(e,t,r,n,o){return e.i===2&&(za(e,Od(t,n,r,!0),o),!0)}),g0),Ka=Symbol(),$d=Symbol(),s1=Symbol(),a1=Symbol(),y0,b0;function cn(e,t,r,n){var o=n[e];if(o)return o;(o={}).P=n,o.A=(function(d){switch(typeof d){case"boolean":return q1||=[0,void 0,!0];case"number":return d>0?void 0:d===0?D4||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var i=n[1];let s=1;i&&i.constructor===Object&&(o.H=i,typeof(i=n[++s])=="function"&&(o.I=!0,y0??=i,b0??=n[s+1],i=n[s+=2]));let a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=n[++s]}for(c=1;i!==void 0;){let d;typeof i=="number"&&(c+=i,i=n[++s]);var l=void 0;if(i instanceof yo?d=i:(d=F4,s--),d?.j){i=n[++s],l=n;var h=s;typeof i=="function"&&(i=i(),l[h]=i),l=i}for(h=c+1,typeof(i=n[++s])=="number"&&i<0&&(h-=i,i=n[++s]);c<h;c++){let u=a[c];l?r(o,c,d,l,u):t(o,c,d,u)}}return n[e]=o}function v0(e){return Array.isArray(e)?e[0]instanceof yo?e:[U4,e]:[e,void 0]}function w0(e,t){return e instanceof te?e.l:Array.isArray(e)?mi(e,t,!1):void 0}function qd(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function Gd(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=cn($d,qd,Gd,n).A,s||=Kd(n),o)}function Kd(e){let t=e[s1];if(t!=null)return t;let r=cn($d,qd,Gd,e);return t=r.I?(n,o)=>y0(n,o,r):(n,o)=>{let i=0|n[I];for(;a0(o)&&o.i!=4;){var s=o.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=N4(c))!=null&&(a=r[s]=c)}a!=null&&a(o,n,s)||(s=(a=o).j,Ca(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=s0(a.g,c)),s=n,a&&((c=s[fo])?c.push(a):s[fo]=[a]))}return 16384&i&&yd(n,34),!0},e[s1]=t}function N4(e){let t=(e=v0(e))[0].g;if(e=e[1]){let r=Kd(e),n=cn($d,qd,Gd,e).A;return(o,i,s)=>t(o,i,s,n,r)}return t}function Xa(e,t,r){e[t]=r.i}function Ja(e,t,r,n){let o,i,s=r.i;e[t]=(a,c,l)=>s(a,c,l,i||=cn(Ka,Xa,Ja,n).A,o||=_0(n))}function _0(e){let t=e[a1];if(!t){let r=cn(Ka,Xa,Ja,e);t=(n,o)=>S0(n,o,r),e[a1]=t}return t}function S0(e,t,r){for(var n=0|e[I],o=512&n?0:-1,i=e.length,s=512&n?1:0,a=i+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,h=c1(r,l);h&&h(t,c,l)}if(256&n){n=e[i-1];for(let c in n)o=+c,Number.isNaN(o)||(i=n[o])!=null&&(a=c1(r,o))&&a(t,i,o)}if(e=_d(e))for(go(t,t.g.end()),r=0;r<e.length;r++)go(t,gd(e[r])||new Uint8Array(0))}function c1(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=v0(r))[0].i;if(r=r[1]){let o=_0(r),i=cn(Ka,Xa,Ja,r).A;r=e.I?b0(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function Ya(e,t){if(Array.isArray(t)){var r=0|t[I];if(4&r)return t;for(var n=0,o=0;n<t.length;n++){let i=e(t[n]);i!=null&&(t[o++]=i)}return o<n&&(t.length=o),Ee(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function Me(e,t,r){return new yo(e,t,r)}function Qa(e,t,r){return new yo(e,t,r)}function Le(e,t,r){Ce(e,0|e[I],t,r)}function k0(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(j1(64,n));if(xd(n)){if(o==="string")return H1(n);if(o==="number")return V1(n)}})(t),t!=null&&(typeof t=="string"&&i1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,mo(t),lo(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new fd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),lo(e.g,r.i,r.g);break;default:r=i1(t),lo(e.g,r.i,r.g)}}function E0(e,t,r){(t=nn(t))!=null&&t!=null&&(Dt(e,r,0),Wa(e.g,t))}function C0(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Dt(e,r,0),e.g.g.push(t?1:0))}function x0(e,t,r){(t=Rr(t))!=null&&Ga(e,r,x1(t))}function A0(e,t,r,n,o){(t=w0(t,n))!=null&&(r=$a(e,r),o(t,e),qa(e,r))}function T0(e,t,r){(t=t==null||typeof t=="string"||Fa(t)||t instanceof Pr?t:void 0)!=null&&Ga(e,r,Ld(t).buffer)}var j4=Me((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=dd(n);let o=dd(n);n=2*(o>>31)+1;let i=o>>>20&2047;return e=4294967296*(1048575&o)+e,Le(t,r,i==2047?e?NaN:n*(1/0):i==0?5e-324*n*e:n*Math.pow(2,i-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=_i(t))!=null&&(Dt(e,r,1),e=e.g,(r=U1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),X=r.getUint32(0,!0),he=r.getUint32(4,!0),Ra(e,X),Ra(e,he))}),Ot()),I0=Me((function(e,t,r){return e.i===5&&(Le(t,r,ud(e.g)),!0)}),(function(e,t,r){(t=_i(t))!=null&&(Dt(e,r,5),e=e.g,N1(t),Ra(e,X))}),p0),V4=Qa((function(e,t,r){return(e.i===5||e.i===2)&&(t=Si(t,0|t[I],r,!1,!1),e.i==2?jd(e,ud,t):t.push(ud(e.g)),!0)}),(function(e,t,r){if((t=Ya(_i,t))!=null&&t.length){Dt(e,r,2),ki(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,N1(t[n]),Ra(r,X)}}),p0),Da=Me((function(e,t,r){return e.i===0&&(Le(t,r,Fd(e.g,Ed)),!0)}),k0,u0),od=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Fd(e.g,Ed))===0?void 0:e),!0)}),k0,u0),H4=Me((function(e,t,r){return e.i===0&&(Le(t,r,Fd(e.g,kd)),!0)}),(function(e,t,r){if((t=I4(t))!=null&&(typeof t=="string"&&o1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,mo(t),lo(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new pd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),lo(e.g,r.i,r.g);break;default:r=o1(t),lo(e.g,r.i,r.g)}}),Ot()),Or=Me((function(e,t,r){return e.i===0&&(Le(t,r,Ge(e.g)),!0)}),E0,zd),Xd=Qa((function(e,t,r){return(e.i===0||e.i===2)&&(t=Si(t,0|t[I],r,!1,!1),e.i==2?jd(e,Ge,t):t.push(Ge(e.g)),!0)}),(function(e,t,r){if((t=Ya(nn,t))!=null&&t.length){r=$a(e,r);for(let n=0;n<t.length;n++)Wa(e.g,t[n]);qa(e,r)}}),zd),so=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Ge(e.g))===0?void 0:e),!0)}),E0,zd),nt=Me((function(e,t,r){return e.i===0&&(Le(t,r,Ud(e.g)),!0)}),C0,d0),ho=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Ud(e.g))===!1?void 0:e),!0)}),C0,d0),yt=Qa((function(e,t,r){return e.i===2&&(e=Nd(e),Si(t,0|t[I],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ya(Rr,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&Ga(n,o,x1(i))}}),Hd),Ir=Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=Nd(e))===""?void 0:e),!0)}),x0,Hd),me=Me((function(e,t,r){return e.i===2&&(Le(t,r,Nd(e)),!0)}),x0,Hd),bt=(function(e,t,r=Vd){return new yo(e,t,r)})((function(e,t,r,n,o){return e.i===2&&(n=mi(void 0,n,!0),Si(t,0|t[I],r,!0).push(n),za(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)A0(e,t[i],r,n,o)})),Te=Wd((function(e,t,r,n,o,i){return e.i===2&&(Z1(t,0|t[I],i,r),za(e,t=Od(t,n,r),o),!0)}),A0),P0=Me((function(e,t,r){return e.i===2&&(Le(t,r,c0(e)),!0)}),T0,f0),z4=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Ge(e.g)>>>0)===0?void 0:e),!0)}),(function(e,t,r){t=(function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return Va(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(Dt(e,r,0),ki(e.g,t))}),Ot()),on=Me((function(e,t,r){return e.i===0&&(Le(t,r,Ge(e.g)),!0)}),(function(e,t,r){(t=nn(t))!=null&&(t=parseInt(t,10),Dt(e,r,0),Wa(e.g,t))}),m0),Oa=class{constructor(t,r){this.i=t,this.g=r,this.j=Rt,this.defaultValue=void 0}};function R0(e,t){return(r,n)=>{if(ka.length){let i=ka.pop();i.o(n),nd(i.g,r,n),r=i}else r=new class{constructor(i,s){if(n1.length){let a=n1.pop();nd(a,i,s),i=a}else i=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,nd(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(i,s);this.g=i,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:i=!1}={}){this.G=i}}(r,n);try{let i=new e,s=i.l;Kd(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.i=-1,ka.length<100&&ka.push(r)}return o}}var l1=[0,Ir,Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=c0(e))===po()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof te){let n=t.R;return void(n&&(t=n(t),t!=null&&Ga(e,r,Ld(t).buffer)))}if(Array.isArray(t))return}T0(e,t,r)}),f0)],id,h1=globalThis.trustedTypes;function d1(e){id===void 0&&(id=(function(){let r=null;if(!h1)return r;try{let n=o=>o;r=h1.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=id;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function W4(e,...t){if(t.length===0)return d1(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return d1(r)}var D0=[0,Or,on,nt,-1,Xd,on,-1],$4=class extends te{constructor(e){super(e)}},O0=[0,nt,me,nt,on,-1,Qa((function(e,t,r){return(e.i===0||e.i===2)&&(t=Si(t,0|t[I],r,!1,!1),e.i==2?jd(e,O4,t):t.push(Ge(e.g)),!0)}),(function(e,t,r){if((t=Ya(nn,t))!=null&&t.length){r=$a(e,r);for(let n=0;n<t.length;n++)Wa(e.g,t[n]);qa(e,r)}}),m0),me,-1,[0,nt,-1],on,nt,-1],B0=[0,me,-2],u1=class extends te{constructor(e){super(e)}},M0=[0],L0=[0,Or,nt,1,nt,-3],F0=class extends te{constructor(e){super(e,2)}},Za={};Za[336783863]=[0,me,nt,-1,Or,[0,[1,2,3,4,5,6,7,8],Te,M0,Te,O0,Te,B0,Te,L0,Te,D0,Te,[0,me,-2],Te,[0,me,on],Te,[0,on,me]],[0,me],nt,[0,[1,3],[2,4],Te,[0,Xd],-1,Te,[0,yt],-1,bt,[0,me,-1]],me];var p1,f1=[0,od,-1,ho,-3,od,Xd,Ir,so,od,-1,ho,so,ho,-2,Ir],Jd=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,7,e)}},gi=[-1,{}],m1=[0,me,1,gi],g1=[0,me,yt,gi],Yd=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,1001,e)}};Yd.prototype.g=(p1=[-500,bt,[-500,Ir,-1,yt,-3,[-2,Za,nt],bt,l1,so,-1,m1,g1,bt,[0,Ir,ho],Ir,f1,so,yt,987,yt],4,bt,[-500,me,-1,[-1,{}],998,me],bt,[-500,me,yt,-1,[-2,{},nt],997,yt,-1],so,bt,[-500,me,yt,gi,998,yt],yt,so,m1,g1,bt,[0,Ir,-1,gi],yt,-2,f1,Ir,-1,ho,[0,ho,z4],978,gi,bt,l1],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let i=this.g;return this.g=[],i}}}};S0(this.l,e,cn(Ka,Xa,Ja,p1)),go(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,o=0;for(let i=0;i<n;i++){let s=r[i];t.set(s,o),o+=s.length}return e.j=[t],t});var q4=class extends te{constructor(e){super(e)}},G4=class extends te{constructor(e){super(e)}g(){return Bd(this,q4)}},K4=[0,bt,[0,Or,I0,me,-1]],y1=class extends te{constructor(e){super(e)}},b1=class extends te{constructor(e){super(e)}},U0=[1,2,3,4,5],Ba=class extends te{constructor(e){super(e)}g(){return J1(this)!=null}i(){return Rr(It(this,2))!=null}},Ma=class extends te{constructor(e){super(e)}},N0=class extends te{constructor(e){super(e)}},j0=[0,[0,P0,me,[0,Or,Da,-1],[0,H4,Da]],nt,[0,U0,Te,L0,Te,O0,Te,D0,Te,M0,Te,B0],on],X4=new Oa(451755788,N0);Za[451755788]=[0,j0,[0,me,Or,I0,yt,-1],j4];var v1=class extends te{constructor(e){super(e)}},V0=class extends te{constructor(e){super(e)}},J4=new Oa(487277289,V0);Za[487277289]=[0,j0,[0,nt,-1]];var Y4=class extends te{constructor(e){super(e)}},Q4=R0(class extends te{constructor(e){super(e)}},[0,bt,[0,1,Or,me,K4],Da]),w1=class extends te{constructor(e){super(e)}},Z4=class extends te{constructor(e){super(e)}J(){let e=J1(this);return e??po()}},ev=class extends te{constructor(e){super(e)}},H0=[1,2],_1=R0(class extends te{constructor(e){super(e)}},[0,bt,[0,H0,Te,[0,V4],Te,[0,P0],Or,me],Da]);function tv(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function S1(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(o=>{n(o)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function T(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.h.stringToNewUTF8(t)),e.h._free(t)}function k1(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let o=0;o<t.length;o++)n[o]=e.h.stringToNewUTF8(t[o]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let o of n)e.h._free(o);e.h._free(t)}function xr(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function en(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(o,i,s)=>{i?(r(n,s),n=[]):n.push(o)}}var rv=(function(e){return class extends e{N(){this.h._registerModelResourcesGraphService()}}})(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:tv()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,o){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),T(this,n||"input_audio",(i=>{T(this,o=o||"audio_header",(s=>{this.h._configureAudio(i,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,o){let i=4*e.length;this.i!==i&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(i),this.i=i),this.h.HEAPF32.set(e,this.g/4),T(this,n,(s=>{this.h._addAudioToInputStream(this.g,t,r,s,o)}))}addGpuBufferToStream(e,t,r){T(this,t,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let o=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!o)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);let[i,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||i===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=s);let[a,c]=[i,s];this.h._addBoundTextureToStream(n,a,c,r)}))}addBoolToStream(e,t,r){T(this,t,(n=>{this.h._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){T(this,t,(n=>{this.h._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){T(this,t,(n=>{this.h._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){T(this,t,(n=>{this.h._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){T(this,t,(n=>{this.h._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){T(this,t,(n=>{T(this,e,(o=>{this.h._addStringToInputStream(o,n,r)}))}))}addStringRecordToStream(e,t,r){T(this,t,(n=>{k1(this,Object.keys(e),(o=>{k1(this,Object.values(e),(i=>{this.h._addFlatHashMapToInputStream(o,i,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){T(this,r,(o=>{T(this,t,(i=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,i,o,n),this.h._free(s)}))}))}addEmptyPacketToStream(e,t){T(this,e,(r=>{this.h._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(o,i);this.h._addBoolVectorToInputStream(o,n,r)}))}addDoubleVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(o,i);this.h._addDoubleVectorToInputStream(o,n,r)}))}addFloatVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(o,i);this.h._addFloatVectorToInputStream(o,n,r)}))}addIntVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(o,i);this.h._addIntVectorToInputStream(o,n,r)}))}addUintVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateUintVector(e.length);if(!o)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(o,i);this.h._addUintVectorToInputStream(o,n,r)}))}addStringVectorToStream(e,t,r){T(this,t,(n=>{let o=this.h._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let i of e)T(this,i,(s=>{this.h._addStringVectorEntry(o,s)}));this.h._addStringVectorToInputStream(o,n,r)}))}addBoolToInputSidePacket(e,t){T(this,t,(r=>{this.h._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){T(this,t,(r=>{this.h._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){T(this,t,(r=>{this.h._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){T(this,t,(r=>{this.h._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){T(this,t,(r=>{this.h._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){T(this,t,(r=>{T(this,e,(n=>{this.h._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){T(this,r,(n=>{T(this,t,(o=>{let i=this.h._malloc(e.length);this.h.HEAPU8.set(e,i),this.h._addProtoToInputSidePacket(i,e.length,o,n),this.h._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(n,o);this.h._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(n,o);this.h._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(n,o);this.h._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(n,o);this.h._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(n,o);this.h._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){T(this,t,(r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let o of e)T(this,o,(i=>{this.h._addStringVectorEntry(n,i)}));this.h._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){xr(this,e,t),T(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){en(this,e,t),T(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){xr(this,e,t),T(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){en(this,e,t),T(this,e,(n=>{this.h._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),xr(this,e,((n,o)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,o)})),T(this,e,(n=>{this.h._attachAudioListener(n,r||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),z0=class extends rv{};async function nv(e,t,r){return e=await(async(n,o,i,s)=>{if(o&&await S1(o),!self.ModuleFactory||i&&(await S1(i),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((o=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function W0(e,t,r){return nv(e,t,r)}function sd(e,t){let r=Pt(e.baseOptions,Ba,1)||new Ba;typeof t=="string"?(Ie(r,2,Pa(t)),Ie(r,1)):t instanceof Uint8Array&&(Ie(r,1,L1(t,!1)),Ie(r,2)),Rt(e.baseOptions,0,1,r)}function $0(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Pt(e.baseOptions,Ba,1)?.g()||Pt(e.baseOptions,Ba,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,o){let i=Pt(n.baseOptions,b1,3);if(!i){var s=i=new b1;rd(s,4,new u1)}"delegate"in o&&(o.delegate==="GPU"?rd(o=i,2,s=new $4):rd(o=i,4,s=new u1)),Rt(n.baseOptions,0,3,i)})(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),sd(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)sd(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let o=[];for(var i=0;;){let{done:s,value:a}=await n.read();if(s)break;o.push(a),i+=a.length}if(o.length===0)return new Uint8Array(0);if(o.length===1)return o[0];n=new Uint8Array(i),i=0;for(let s of o)n.set(s,i),i+=s.length;return n})(r.modelAssetBuffer).then((n=>{sd(e,n),e.v()}));return e.v(),Promise.resolve()}function E1(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map((r=>r.message)).join(", "))}finally{e.j=[]}}function ao(e,t){e.s=Math.max(e.s,t)}var xa=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.j.push(Error(n))})),this.g.N(),this.g.setGraph(e,t),E1(this)}finishProcessing(){this.g.finishProcessing(),E1(this)}close(){this.g.closeGraph()}};async function yi(e,t,r){return W0(e,t,r)}xa.prototype.close=xa.prototype.close,(function(e,t){e=e.split(".");var r,n=rn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",xa);var La=class extends xa{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function ov(e){let t={classifications:Bd(e,Y4).map((r=>(function(n,o=-1,i=""){return{categories:n.map((s=>{var a=nn(It(s,1))??0??-1;let c=s.l,l=0|c[I],h=an(c,l,2),d=_i(h);return d!=null&&d!==h&&Ce(c,l,2,d),{index:a,score:d??0??0,categoryName:Rr(It(s,3))??""??"",displayName:Rr(It(s,4))??""??""}})),headIndex:o,headName:i}})(Pt(r,G4,4)?.g()??[],nn(It(r,2))??0,Rr(It(r,3))??"")))};return hd(It(e,2))!=null&&(t.timestampMs=hd(It(e,2))??0),t}La.prototype.setDefaultSampleRate=La.prototype.O;var gt=class extends La{constructor(e,t){super(new z0(e,t)),this.m=[],Rt(e=this.i=new N0,0,1,t=new Ma)}get baseOptions(){return Pt(this.i,Ma,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,y1,2);if(r=r?X1(r):new y1,e.displayNamesLocale!==void 0?Ie(r,1,Pa(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Ie(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!Va(n))throw Kg();n|=0}Ie(r,2,n)}else"maxResults"in e&&Ie(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);Ie(r,3,n)}else"scoreThreshold"in e&&Ie(r,3);return e.categoryAllowlist!==void 0?r1(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&Ie(r,4),e.categoryDenylist!==void 0?r1(r,5,e.categoryDenylist):"categoryDenylist"in e&&Ie(r,5),Rt(t,0,2,r),$0(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}v(){var e=new Yd;qe(e,10,"audio_in"),qe(e,10,"sample_rate"),qe(e,15,"timestamped_classifications");let t=new F0;l0(t,X4,this.i);let r=new Jd;Q1(r,Pa("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),qe(r,3,"AUDIO:audio_in"),qe(r,3,"SAMPLE_RATE:sample_rate"),qe(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),r0(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,o)=>{(function(i,s){s.forEach((a=>{a=Q4(a),i.m.push(ov(a))}))})(this,n),ao(this,o)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{ao(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function C1(e){return{embeddings:Bd(e,ev).map((t=>{let r={headIndex:nn(It(t,3))??0??-1,headName:Rr(It(t,4))??""??""};if(e0(t,w1,td(t,1))!==void 0)r.floatEmbedding=Y1(Pt(t,w1,td(t,1)),1,_i,F1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=Pt(t,Z4,td(t,2))?.J()?.i()??n}return r})),timestampMs:hd(It(e,2))??0}}gt.prototype.classify=gt.prototype.K,gt.prototype.setOptions=gt.prototype.o,gt.createFromModelPath=function(e,t){return W0(gt,e,{baseOptions:{modelAssetPath:t}})},gt.createFromModelBuffer=function(e,t){return yi(gt,e,{baseOptions:{modelAssetBuffer:t}})},gt.createFromOptions=function(e,t){return yi(gt,e,t)};var $t=class extends La{constructor(e,t){super(new z0(e,t)),this.m=[],Rt(e=this.i=new V0,0,1,t=new Ma)}get baseOptions(){return Pt(this.i,Ma,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,v1,2);return r=r?X1(r):new v1,e.l2Normalize!==void 0?Ie(r,1,e1(e.l2Normalize)):"l2Normalize"in e&&Ie(r,1),e.quantize!==void 0?Ie(r,2,e1(e.quantize)):"quantize"in e&&Ie(r,2),Rt(t,0,2,r),$0(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}v(){var e=new Yd;qe(e,10,"audio_in"),qe(e,10,"sample_rate"),qe(e,15,"embeddings_out"),qe(e,15,"timestamped_embeddings_out");let t=new F0;l0(t,J4,this.i);let r=new Jd;Q1(r,Pa("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),qe(r,3,"AUDIO:audio_in"),qe(r,3,"SAMPLE_RATE:sample_rate"),qe(r,4,"EMBEDDINGS:embeddings_out"),qe(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),r0(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=_1(n),this.m.push(C1(n)),ao(this,o)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{ao(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,o)=>{for(let i of n)n=_1(i),this.m.push(C1(n));ao(this,o)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{ao(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Ea;$t.prototype.embed=$t.prototype.L,$t.prototype.setOptions=$t.prototype.o,$t.createFromModelPath=function(e,t){return yi($t,e,{baseOptions:{modelAssetPath:t}})},$t.createFromModelBuffer=function(e,t){return yi($t,e,{baseOptions:{modelAssetBuffer:t}})},$t.createFromOptions=function(e,t){return yi($t,e,t)};var iv=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function q0(){if(Ea===void 0)try{await WebAssembly.instantiate(iv),Ea=!0}catch{Ea=!1}return Ea}async function ui(e,t=W4``){let r=await q0()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Ar=class{};Ar.forVisionTasks=function(e){return ui("vision",e)},Ar.forTextTasks=function(e){return ui("text",e)},Ar.forGenAiExperimentalTasks=function(e){return ui("genai_experimental",e)},Ar.forGenAiTasks=function(e){return ui("genai",e)},Ar.forAudioTasks=function(e){return ui("audio",e)},Ar.isSimdSupported=function(){return q0()};var ec=class{constructor(t,r,n,o,i,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=o,this.onRealtimeAlertsCallback=i,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new ir(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new va(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new Cr(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(n=>{console.log(n),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t+t*.25),r>=t&&!this.recordingInProgress?(this.recordingInProgress=!0,this.audioRecorder.startRecording(),this.recordingStartTime=Date.now()-this.examStartTime):r<t&&this.recordingInProgress&&(Date.now()-this.recordingStartTime>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++)}async stopSoundRecord(){if(!this.audioRecorder||(this.audioRecorder.stopRecording&&await this.audioRecorder.stopRecording(),this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=new File(this.audioRecorder.blobs,`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.webm`,{type:"audio/webm"});this.uploadRecord(t),this.audioRecorder.blobs=[]}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let o=parseFloat(r.score)>.22;if(n&&o)return!0}return!1}async createAudioClassifier(){let t=await Ar.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await gt.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:16e3});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([sv],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let n=r.data,i=this.audioClassifier.classify(n)[0].classifications[0].categories;i.length>0&&(this.audioClassificationResult=[{name:i[0].categoryName,score:i[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},sv=`
435
+ Size: ${t.file.size}`,s),o}}throw new Error("Could not upload")}};var Va=class{constructor(t,r){this.alerts=[];this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async pauseRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async resumeRecording(){this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async stopRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}onLostFocus(){Date.now()-this.startTime?.getTime()>1e4&&(this.onLostFocusCallback({begin:Date.now()-this.startTime.getTime(),end:0,alert:25,type:3}),this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:0,alert:25,type:3}))}onReturnFocus(){let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback({begin:t.begin,end:Date.now()-this.startTime.getTime(),alert:25,type:3}),t.end=Date.now()-this.startTime.getTime())}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var Ha=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:n,pauseRecording:i,resumeRecording:o}=Wn(this.audioStream,this.blobs,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=n,this.recordingPause=i,this.recordingResume=o,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,n){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&n&&`${r}_${n}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var Kn=typeof self<"u"?self:{};function $n(){throw Error("Invalid UTF8")}function s0(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Wa,ku,fv=typeof TextDecoder<"u",pv,mv=typeof TextEncoder<"u";function H0(e){if(mv)e=(pv||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var ju,Ya;e:{for(Eu=["CLOSURE_FLAGS"],$a=Kn,Ga=0;Ga<Eu.length;Ga++)if(($a=$a[Eu[Ga]])==null){Ya=null;break e}Ya=$a}var Eu,$a,Ga,Jo,a0=Ya&&Ya[610401301];ju=a0!=null&&a0;var c0=Kn.navigator;function Ou(e){return!!ju&&!!Jo&&Jo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function sr(e){var t;return(t=Kn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function wn(){return!!ju&&!!Jo&&Jo.brands.length>0}function Cu(){return wn()?Ou("Chromium"):(sr("Chrome")||sr("CriOS"))&&!(!wn()&&sr("Edge"))||sr("Silk")}Jo=c0&&c0.userAgentData||null;var gv=!wn()&&(sr("Trident")||sr("MSIE"));!sr("Android")||Cu(),Cu(),sr("Safari")&&(Cu()||!wn()&&sr("Coast")||!wn()&&sr("Opera")||!wn()&&sr("Edge")||(wn()?Ou("Microsoft Edge"):sr("Edg/"))||wn()&&Ou("Opera"));var W0={},$o=null;function yv(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),u=$o[h];if(u!=null)return u;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}$0();let c=0;for(;;){let l=a(-1),h=a(0),u=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|h>>4),u!=64&&(s(h<<4&240|u>>2),m!=64&&s(u<<6&192|m))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function $0(){if(!$o){$o={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));W0[r]=n;for(let i=0;i<n.length;i++){let o=n[i];$o[o]===void 0&&($o[o]=i)}}}}var G0=typeof Uint8Array<"u",q0=!gv&&typeof btoa=="function";function l0(e){if(!q0){var t;t===void 0&&(t=0),$0(),t=W0[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var h0=/[-_.]/g,bv={"-":"+",_:"/",".":"="};function _v(e){return bv[e]||""}function K0(e){if(!q0)return yv(e);h0.test(e)&&(e=e.replace(h0,_v)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function ac(e){return G0&&e!=null&&e instanceof Uint8Array}var Ji={};function Yi(){return vv||=new kn(null,Ji)}function Vu(e){X0(Ji);var t=e.g;return(t=t==null||ac(t)?t:typeof t=="string"?K0(t):null)==null?t:e.g=t}var kn=class{i(){return new Uint8Array(Vu(this)||0)}constructor(e,t){if(X0(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},vv,wv;function X0(e){if(e!==Ji)throw Error("illegal external caller")}function J0(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function u0(){let e=Error("int32");return J0(e,"warning"),e}var cc=typeof Symbol=="function"&&typeof Symbol()=="symbol",Sv=new Set;function lc(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&Sv.add(e),e}var kv=lc("jas",void 0,!0,!0),xu=lc(void 0,"2ex"),Ho=lc(void 0,"1oa",!0),Zi=lc(void 0,Symbol(),!0),ae=cc?kv:"M",Y0={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},Z0=Object.defineProperties;function Hu(e,t){cc||ae in e||Z0(e,Y0),e[ae]|=t}function at(e,t){cc||ae in e||Z0(e,Y0),e[ae]=t}function Ev(e,t){at(t,-30975&(0|e))}function Bu(e,t){at(t,-30941&(34|e))}function Wu(){return typeof BigInt=="function"}function ar(e){return Array.prototype.slice.call(e)}var $u,Zo={},Cv={};function d0(e){return!(!e||typeof e!="object"||e.g!==Cv)}function Gu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Q0(e,t){if(e!=null){if(typeof e=="string")e=e?new kn(e,Ji):Yi();else if(e.constructor!==kn)if(ac(e))e=e.length?new kn(new Uint8Array(e),Ji):Yi();else{if(!t)throw Error();e=void 0}}return e}function Za(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[ae]))}var f0=[];function Yn(e){if(2&e)throw Error()}function qu(e){return Zi?e[Zi]:void 0}at(f0,55),$u=Object.freeze(f0);var e1=Object.freeze({}),Ku=typeof Kn.BigInt=="function"&&typeof Kn.BigInt(0)=="bigint",Lu=e=>Ku?e>=Av&&e<=Iv:e[0]==="-"?p0(e,xv):p0(e,Tv),xv=Number.MIN_SAFE_INTEGER.toString(),Av=Ku?BigInt(Number.MIN_SAFE_INTEGER):void 0,Tv=Number.MAX_SAFE_INTEGER.toString(),Iv=Ku?BigInt(Number.MAX_SAFE_INTEGER):void 0;function p0(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var Rv=typeof Uint8Array.prototype.slice=="function",t1,Re=0,qe=0;function m0(e){let t=e>>>0;Re=t,qe=(e-t)/4294967296>>>0}function Qi(e){if(e<0){m0(-e);let[t,r]=Yu(Re,qe);Re=t>>>0,qe=r>>>0}else m0(e)}function r1(e){let t=t1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),qe=0,Re=t.getUint32(0,!0)}function Xu(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Yo(e,t)}function Ju(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Xu(e,t))=="number"?r?-e:e:r?"-"+e:e}function Yo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Wu()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+g0(r)+g0(e));return r}function g0(e){return e=String(e),"0000000".slice(e.length)+e}function hc(e){if(e.length<16)Qi(Number(e));else if(Wu())e=BigInt(e),Re=Number(e&BigInt(4294967295))>>>0,qe=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");qe=Re=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));qe*=1e6,Re=1e6*Re+o,Re>=4294967296&&(qe+=Math.trunc(Re/4294967296),qe>>>=0,Re>>>=0)}if(t){let[n,i]=Yu(Re,qe);Re=n,qe=i}}}function Yu(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var n1=typeof BigInt=="function"?BigInt.asIntN:void 0,Pv=typeof BigInt=="function"?BigInt.asUintN:void 0,Go=Number.isSafeInteger,uc=Number.isFinite,Qa=Math.trunc;function Qo(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function y0(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}var Dv=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Zu(e){switch(typeof e){case"bigint":return!0;case"number":return uc(e);case"string":return Dv.test(e);default:return!1}}function Xn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return uc(e)?0|e:void 0}function b0(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function i1(e){return e=Qa(e),Go(e)||(Qi(e),e=Ju(Re,qe)),e}function o1(e){var t=Qa(Number(e));if(Go(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(hc(e),e=Re,2147483648&(t=qe))if(Wu())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Yu(e,t);e="-"+Yo(r,n)}else e=Yo(e,t);return e}function Fu(e){return e==null?e:typeof e=="bigint"?(Lu(e)?e=Number(e):(e=n1(64,e),e=Lu(e)?Number(e):String(e)),e):Zu(e)?typeof e=="number"?i1(e):o1(e):void 0}function Ov(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Pv(64,e));if(Zu(e)){if(t==="string")return t=Qa(Number(e)),Go(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),b0(e)||(hc(e),e=Yo(Re,qe))),e;if(t==="number")return(e=Qa(e))>=0&&Go(e)?e:(function(r){if(r<0){Qi(r);var n=Yo(Re,qe);return r=Number(n),Go(r)?r:n}return b0(n=String(r))?n:(Qi(r),Xu(Re,qe))})(e)}}function s1(e){if(typeof e!="string")throw Error();return e}function ec(e){if(e!=null&&typeof e!="string")throw Error();return e}function En(e){return e==null||typeof e=="string"?e:void 0}function a1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===Zo)return e;if(Array.isArray(e)){var n=0|e[ae],i=n;return i===0&&(i|=32&r),(i|=2&r)!==n&&at(e,i),new t(e)}}function c1(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=Za(e)?void 0:i&&2&(0|e[ae])?e:Qu(e,t,r,n!==void 0,i);else if(Gu(e)){let o={};for(let s in e)o[s]=c1(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function Qu(e,t,r,n,i){let o=n||r?0|e[ae]:0,s=n?!!(32&o):void 0;n=ar(e);for(let a=0;a<n.length;a++)n[a]=c1(n[a],t,r,s,i);return r&&((e=qu(e))&&(n[Zi]=ar(e)),r(o,n)),n}function Bv(e){return e.B===Zo?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Lu(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Za(t))return}else{if(ac(t))return l0(t);if(t instanceof kn){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=l0(r)}}}return t})(e)}function Lv(e){return Qu(e,Bv,void 0,void 0,!1)}var l1,Fv;function qo(e,t,r){return e=h1(e,t[0],t[1],r?1:2),t!==l1&&r&&Hu(e,16384),e}function h1(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[ae]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Gu(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return at(e,i),e}function u1(e,t,r=Bu){if(e!=null){if(G0&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[ae];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(at(e,-12293&(34|n)),e):Qu(e,u1,4&n?Bu:r,!0,!0))}return e.B===Zo&&(e=2&(n=0|(r=e.l)[ae])?e:new e.constructor(dc(r,n,!0))),e}}function d1(e){let t=e.l;return new e.constructor(dc(t,0|t[ae],!1))}function dc(e,t,r){let n=r||2&t?Bu:Ev,i=!!(32&t);return e=(function(o,s,a){let c=ar(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let u in h)s[u]=a(h[u])}return(o=qu(o))&&(c[Zi]=ar(o)),c})(e,t,(o=>u1(o,i,n))),Hu(e,32|(r?2:0)),e}function ed(e){let t=e.l,r=0|t[ae];return 2&r?new e.constructor(dc(t,r,!1)):e}function _r(e,t){return Zn(e=e.l,0|e[ae],t)}function Zn(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&xu!=null&&((i=(e=wv??={})[xu]||0)>=4||(e[xu]=i+1,J0(e=Error(),"incident"),(function(s){Kn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function pt(e,t,r){let n=e.l,i=0|n[ae];return Yn(i),ct(n,i,t,r),e}function ct(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},at(e,t|=256)):e[o]=n),t)}function f1(e){let t=0|(e=e.l)[ae],r=Zn(e,t,1),n=Q0(r,!0);return n!=null&&n!==r&&ct(e,t,1,n),n}function p1(e,t,r,n,i){let o=e.l,s=2&(e=0|o[ae])?1:n;i=!!i;let a=0|(n=td(o,e,t))[ae];if(!(4&a)){4&a&&(n=ar(n),a=Qr(a,e),e=ct(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=rd(a,e),r=-4097&(20|a),a=r&=-8193,at(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Zr(a)||(i=a,a|=2,a!==i&&at(n,a),Object.freeze(n)):(s===2&&Zr(a)&&(n=ar(n),a=Qr(a,e),a=Cn(a,e,i),at(n,a),e=ct(o,e,t,n)),Zr(a)||(t=a,a=Cn(a,e,i),a!==t&&at(n,a))),n}function td(e,t,r,n){return e=Zn(e,t,r,n),Array.isArray(e)?e:$u}function rd(e,t){return e===0&&(e=Qr(e,t)),1|e}function Zr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function _0(e,t,r){let n=0|(e=e.l)[ae];if(Yn(n),r==null)ct(e,n,t);else{var i=0|r[ae],o=i,s=Zr(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=ar(r),o=0,i=Cn(i=Qr(i,n),n,!0),a=!1),i|=21,s=0;s<r.length;s++){let c=r[s],l=s1(c);Object.is(c,l)||(a&&(r=ar(r),o=0,i=Cn(i=Qr(i,n),n,!0),a=!1),r[s]=l)}i!==o&&(a&&(r=ar(r),i=Cn(i=Qr(i,n),n,!0)),at(r,i)),ct(e,n,t,r)}}function m1(e,t){let r=0|(e=e.l)[ae];Yn(r),ct(e,r,2,t===""?void 0:t)}function es(e,t,r,n,i){Yn(t);var o=!(!(64&t)&&16384&t);let s=(i=td(e,t,r,i))!==$u;if(o||!s){let a=o=s?0|i[ae]:0;(!s||2&a||Zr(a)||4&a&&!(32&a))&&(i=ar(i),a=Qr(a,t),t=ct(e,t,r,i)),a=-13&rd(a,t),a=Cn(n?-17&a:16|a,t,!0),a!==o&&at(i,a)}return i}function Au(e,t){var r=o2;return id(nd(e=e.l),e,0|e[ae],r)===t?t:-1}function nd(e){if(cc)return e[Ho]??(e[Ho]=new Map);if(Ho in e)return e[Ho];let t=new Map;return Object.defineProperty(e,Ho,{value:t}),t}function g1(e,t,r,n){let i=nd(e),o=id(i,e,t,r);return o!==n&&(o&&(t=ct(e,t,o)),i.set(r,n)),t}function id(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Zn(t,r,s)!=null&&(i!==0&&(r=ct(t,r,i)),i=s)}return e.set(n,i),i}function od(e,t,r,n){let i,o=0|e[ae];if((n=Zn(e,o,r,n))!=null&&n.B===Zo)return(t=ed(n))!==n&&ct(e,o,r,t),t.l;if(Array.isArray(n)){let s=0|n[ae];i=2&s?qo(dc(n,s,!1),t,!0):64&s?n:qo(i,t,!0)}else i=qo(void 0,t,!0);return i!==n&&ct(e,o,r,i),i}function y1(e,t,r,n){let i=0|(e=e.l)[ae];return(t=a1(n=Zn(e,i,r,n),t,i))!==n&&t!=null&&ct(e,i,r,t),t}function vr(e,t,r){if((t=y1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[ae];if(!(2&n)){let i=ed(t);i!==t&&ct(e,n,r,t=i)}return t}function b1(e,t,r,n,i,o){e=e.l;var s=!!(2&t);let a=s?1:n;i=!!i,o&&=!s;var c=0|(n=td(e,t,1))[ae];if(!(s=!!(4&c))){var l=n,h=t;let u=!!(2&(c=rd(c,t)));u&&(h|=2);let m=!u,p=!0,g=0,f=0;for(;g<l.length;g++){let b=a1(l[g],r,h);if(b instanceof r){if(!u){let _=!!(2&(0|b.l[ae]));m&&=!_,p&&=_}l[f++]=b}}f<g&&(l.length=f),c|=4,c=p?16|c:-17&c,at(l,c=m?8|c:-9&c),u&&Object.freeze(l)}if(o&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(Zr(c)&&(n=ar(n),c=Qr(c,t),t=ct(e,t,1,n)),r=n,o=c,l=0;l<r.length;l++)(c=r[l])!==(h=ed(c))&&(r[l]=h);o|=8,at(r,o=r.length?-17&o:16|o),c=o}return a===1||a===4&&32&c?Zr(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&at(n,c),Object.freeze(n)):(a===2&&Zr(c)&&(at(n=ar(n),c=Cn(c=Qr(c,t),t,i)),t=ct(e,t,1,n)),Zr(c)||(e=c,(c=Cn(c,t,i))!==e&&at(n,c))),n}function sd(e,t){let r=0|e.l[ae];return b1(e,r,t,e1===void 0?2:4,!1,!(2&r))}function wr(e,t,r,n){return n==null&&(n=void 0),pt(e,r,n)}function Tu(e,t,r){var n=t2;r==null&&(r=void 0);e:{let i=0|(e=e.l)[ae];if(Yn(i),r==null){let o=nd(e);if(id(o,e,i,n)!==t)break e;o.set(n,0)}else i=g1(e,i,n,t);ct(e,i,t,r)}}function Qr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function Cn(e,t,r){return 32&t&&r||(e&=-33),e}function _1(e,t){var r=Sd;let n=0|e.l[ae];Yn(n),e=b1(e,n,r,2,!0),t=t??new r,e.push(t),e[ae]=2&(0|t.l[ae])?-9&e[ae]:-17&e[ae]}function Pt(e,t,r){Yn(0|e.l[ae]),p1(e,t,En,2,!0).push(s1(r))}function v1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function ad(){return Error("Failed to read varint, encoding is invalid.")}function w1(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function cd(e){if(typeof e=="string")return{buffer:K0(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===kn)return{buffer:Vu(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function ld(e,t){let r,n=0,i=0,o=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(qn(e,a),r<128)return t(n>>>0,i>>>0);throw ad()}function hd(e){let t=0,r=e.g,n=r+10,i=e.i;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return qn(e,r),!!(127&t)}throw ad()}function Dt(e){let t=e.i,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw ad();return qn(e,r),i}function Mu(e){var t=e.i;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],qn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Uu(e){var t=Mu(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Mv(e){return Dt(e)}function Iu(e,t,{C:r=!1}={}){e.C=r,t&&(t=cd(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function qn(e,t){if(e.g=t,t>e.j)throw w1(e.j,t)}function S1(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw w1(t,e.j-r);return e.g=n,r}function k1(e,t){if(t==0)return Yi();var r=S1(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):Rv?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Yi():new kn(r,Ji)}var v0=[];function E1(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Dt(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw v1(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Xa(e){switch(e.i){case 0:e.i!=0?Xa(e):hd(e.g);break;case 1:qn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Xa(e);else{var t=Dt(e.g)>>>0;qn(e=e.g,e.g+t)}break;case 5:qn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!E1(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Xa(e)}break;default:throw v1(e.i,e.j)}}function fc(e,t,r){let n=e.g.j,i=Dt(e.g)>>>0,o=e.g.g+i,s=o-n;if(s<=0&&(e.g.j=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=o,e.g.j=n}function ud(e){var t=Dt(e.g)>>>0,r=S1(e=e.g,t);if(e=e.i,fv){var n,i=e;(n=ku)||(n=ku=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(Wa===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Wa=!0}catch{Wa=!1}}throw!Wa&&(ku=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?$n():(a=e[o++],s<194||(192&a)!=128?(o--,$n()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?$n():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,$n()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?$n():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,$n()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):$n(),r.length>=8192&&(c=s0(c,r),r.length=0)}o=s0(c,r)}return o}function C1(e){let t=Dt(e.g)>>>0;return k1(e.g,t)}function dd(e,t,r){var n=Dt(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var qa=[];function Uv(e){return e}var qi;function x1(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var Ne=class{constructor(e,t){this.l=h1(e,t)}toJSON(){let e=!qi;try{return e&&(qi=Lv),A1(this)}finally{e&&(qi=void 0)}}u(){return!!(2&(0|this.l[ae]))}};function A1(e){var t=e.l;{t=(e=qi(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Gu(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(Za(n)||d0(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||Za(o)||d0(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function w0(e){return e?/^\d+$/.test(e)?(hc(e),new Nu(Re,qe)):null:Nv||=new Nu(0,0)}Ne.prototype.B=Zo,Ne.prototype.toString=function(){try{return qi=Uv,A1(this).toString()}finally{qi=void 0}};var Nu=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},Nv;function S0(e){return e?/^-?\d+$/.test(e)?(hc(e),new zu(Re,qe)):null:zv||=new zu(0,0)}var zu=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},zv;function Ki(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ts(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function pc(e,t){if(t>=0)ts(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function tc(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function eo(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Sr(e,t,r){ts(e.g,8*t+r)}function mc(e,t){return Sr(e,t,2),t=e.g.end(),eo(e,t),t.push(e.i),t}function gc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function yc(e,t,r){Sr(e,t,2),ts(e.g,r.length),eo(e,e.g.end()),eo(e,r)}function kr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var fd=kr(),T1=kr(),pd=kr(),md=kr(),I1=kr(),R1=kr(),P1=kr(),D1=kr(),to=class{constructor(e,t,r){this.g=e,this.i=t,e=fd,this.j=!!e&&r===e||!1}};function gd(e,t){return new to(e,t,fd)}function O1(e,t,r,n,i){(t=M1(t,n))!=null&&(r=mc(e,r),i(t,e),gc(e,r))}var jv=gd((function(e,t,r,n,i){return e.i===2&&(fc(e,od(t,n,r),i),!0)}),O1),Vv=gd((function(e,t,r,n,i){return e.i===2&&(fc(e,od(t,n,r,!0),i),!0)}),O1),bc=Symbol(),yd=Symbol(),k0=Symbol(),E0=Symbol(),B1,L1;function Qn(e,t,r,n){var i=n[e];if(i)return i;(i={}).P=n,i.A=(function(u){switch(typeof u){case"boolean":return l1||=[0,void 0,!0];case"number":return u>0?void 0:u===0?Fv||=[0,void 0]:[-u,void 0];case"string":return[0,u];case"object":return u}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.H=o,typeof(o=n[++s])=="function"&&(i.I=!0,B1??=o,L1??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let u;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof to?u=o:(u=jv,s--),u?.j){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let m=a[c];l?r(i,c,u,l,m):t(i,c,u,m)}}return n[e]=i}function F1(e){return Array.isArray(e)?e[0]instanceof to?e:[Vv,e]:[e,void 0]}function M1(e,t){return e instanceof Ne?e.l:Array.isArray(e)?qo(e,t,!1):void 0}function bd(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function _d(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=Qn(yd,bd,_d,n).A,s||=vd(n),i)}function vd(e){let t=e[k0];if(t!=null)return t;let r=Qn(yd,bd,_d,e);return t=r.I?(n,i)=>B1(n,i,r):(n,i)=>{let o=0|n[ae];for(;E1(i)&&i.i!=4;){var s=i.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=Hv(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).j,Xa(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=k1(a.g,c)),s=n,a&&((c=s[Zi])?c.push(a):s[Zi]=[a]))}return 16384&o&&Hu(n,34),!0},e[k0]=t}function Hv(e){let t=(e=F1(e))[0].g;if(e=e[1]){let r=vd(e),n=Qn(yd,bd,_d,e).A;return(i,o,s)=>t(i,o,s,n,r)}return t}function _c(e,t,r){e[t]=r.i}function vc(e,t,r,n){let i,o,s=r.i;e[t]=(a,c,l)=>s(a,c,l,o||=Qn(bc,_c,vc,n).A,i||=U1(n))}function U1(e){let t=e[E0];if(!t){let r=Qn(bc,_c,vc,e);t=(n,i)=>N1(n,i,r),e[E0]=t}return t}function N1(e,t,r){for(var n=0|e[ae],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=C0(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=C0(r,i))&&a(t,o,i)}if(e=qu(e))for(eo(t,t.g.end()),r=0;r<e.length;r++)eo(t,Vu(e[r])||new Uint8Array(0))}function C0(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=F1(r))[0].i;if(r=r[1]){let i=U1(r),o=Qn(bc,_c,vc,r).A;r=e.I?L1(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function wc(e,t){if(Array.isArray(t)){var r=0|t[ae];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),at(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function vt(e,t,r){return new to(e,t,r)}function Sc(e,t,r){return new to(e,t,r)}function wt(e,t,r){ct(e,0|e[ae],t,r)}function z1(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(n1(64,n));if(Zu(n)){if(i==="string")return o1(n);if(i==="number")return i1(n)}})(t),t!=null&&(typeof t=="string"&&S0(t),t!=null))switch(Sr(e,r,0),typeof t){case"number":e=e.g,Qi(t),Ki(e,Re,qe);break;case"bigint":r=BigInt.asUintN(64,t),r=new zu(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Ki(e.g,r.i,r.g);break;default:r=S0(t),Ki(e.g,r.i,r.g)}}function j1(e,t,r){(t=Xn(t))!=null&&t!=null&&(Sr(e,r,0),pc(e.g,t))}function V1(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Sr(e,r,0),e.g.g.push(t?1:0))}function H1(e,t,r){(t=En(t))!=null&&yc(e,r,H0(t))}function W1(e,t,r,n,i){(t=M1(t,n))!=null&&(r=mc(e,r),i(t,e),gc(e,r))}function $1(e,t,r){(t=t==null||typeof t=="string"||ac(t)||t instanceof kn?t:void 0)!=null&&yc(e,r,cd(t).buffer)}var Wv=vt((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=Mu(n);let i=Mu(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,wt(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=Qo(t))!=null&&(Sr(e,r,1),e=e.g,(r=t1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Re=r.getUint32(0,!0),qe=r.getUint32(4,!0),tc(e,Re),tc(e,qe))}),kr()),G1=vt((function(e,t,r){return e.i===5&&(wt(t,r,Uu(e.g)),!0)}),(function(e,t,r){(t=Qo(t))!=null&&(Sr(e,r,5),e=e.g,r1(t),tc(e,Re))}),R1),$v=Sc((function(e,t,r){return(e.i===5||e.i===2)&&(t=es(t,0|t[ae],r,!1,!1),e.i==2?dd(e,Uu,t):t.push(Uu(e.g)),!0)}),(function(e,t,r){if((t=wc(Qo,t))!=null&&t.length){Sr(e,r,2),ts(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,r1(t[n]),tc(r,Re)}}),R1),rc=vt((function(e,t,r){return e.i===0&&(wt(t,r,ld(e.g,Ju)),!0)}),z1,I1),Ru=vt((function(e,t,r){return e.i===0&&(wt(t,r,(e=ld(e.g,Ju))===0?void 0:e),!0)}),z1,I1),Gv=vt((function(e,t,r){return e.i===0&&(wt(t,r,ld(e.g,Xu)),!0)}),(function(e,t,r){if((t=Ov(t))!=null&&(typeof t=="string"&&w0(t),t!=null))switch(Sr(e,r,0),typeof t){case"number":e=e.g,Qi(t),Ki(e,Re,qe);break;case"bigint":r=BigInt.asUintN(64,t),r=new Nu(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Ki(e.g,r.i,r.g);break;default:r=w0(t),Ki(e.g,r.i,r.g)}}),kr()),xn=vt((function(e,t,r){return e.i===0&&(wt(t,r,Dt(e.g)),!0)}),j1,md),wd=Sc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[ae],r,!1,!1),e.i==2?dd(e,Dt,t):t.push(Dt(e.g)),!0)}),(function(e,t,r){if((t=wc(Xn,t))!=null&&t.length){r=mc(e,r);for(let n=0;n<t.length;n++)pc(e.g,t[n]);gc(e,r)}}),md),$i=vt((function(e,t,r){return e.i===0&&(wt(t,r,(e=Dt(e.g))===0?void 0:e),!0)}),j1,md),Wt=vt((function(e,t,r){return e.i===0&&(wt(t,r,hd(e.g)),!0)}),V1,T1),Xi=vt((function(e,t,r){return e.i===0&&(wt(t,r,(e=hd(e.g))===!1?void 0:e),!0)}),V1,T1),ir=Sc((function(e,t,r){return e.i===2&&(e=ud(e),es(t,0|t[ae],r,!1).push(e),!0)}),(function(e,t,r){if((t=wc(En,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&yc(n,i,H0(o))}}),pd),Sn=vt((function(e,t,r){return e.i===2&&(wt(t,r,(e=ud(e))===""?void 0:e),!0)}),H1,pd),Ye=vt((function(e,t,r){return e.i===2&&(wt(t,r,ud(e)),!0)}),H1,pd),or=(function(e,t,r=fd){return new to(e,t,r)})((function(e,t,r,n,i){return e.i===2&&(n=qo(void 0,n,!0),es(t,0|t[ae],r,!0).push(n),fc(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)W1(e,t[o],r,n,i)})),ft=gd((function(e,t,r,n,i,o){return e.i===2&&(g1(t,0|t[ae],o,r),fc(e,t=od(t,n,r),i),!0)}),W1),q1=vt((function(e,t,r){return e.i===2&&(wt(t,r,C1(e)),!0)}),$1,P1),qv=vt((function(e,t,r){return e.i===0&&(wt(t,r,(e=Dt(e.g)>>>0)===0?void 0:e),!0)}),(function(e,t,r){t=(function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return uc(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(Sr(e,r,0),ts(e.g,t))}),kr()),Jn=vt((function(e,t,r){return e.i===0&&(wt(t,r,Dt(e.g)),!0)}),(function(e,t,r){(t=Xn(t))!=null&&(t=parseInt(t,10),Sr(e,r,0),pc(e.g,t))}),D1),nc=class{constructor(t,r){this.i=t,this.g=r,this.j=wr,this.defaultValue=void 0}};function K1(e,t){return(r,n)=>{if(qa.length){let o=qa.pop();o.o(n),Iu(o.g,r,n),r=o}else r=new class{constructor(o,s){if(v0.length){let a=v0.pop();Iu(a,o,s),o=a}else o=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,Iu(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(o,s);this.g=o,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:o=!1}={}){this.G=o}}(r,n);try{let o=new e,s=o.l;vd(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.i=-1,qa.length<100&&qa.push(r)}return i}}var x0=[0,Sn,vt((function(e,t,r){return e.i===2&&(wt(t,r,(e=C1(e))===Yi()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof Ne){let n=t.R;return void(n&&(t=n(t),t!=null&&yc(e,r,cd(t).buffer)))}if(Array.isArray(t))return}$1(e,t,r)}),P1)],Pu,A0=globalThis.trustedTypes;function T0(e){Pu===void 0&&(Pu=(function(){let r=null;if(!A0)return r;try{let n=i=>i;r=A0.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Pu;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Kv(e,...t){if(t.length===0)return T0(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return T0(r)}var X1=[0,xn,Jn,Wt,-1,wd,Jn,-1],Xv=class extends Ne{constructor(e){super(e)}},J1=[0,Wt,Ye,Wt,Jn,-1,Sc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[ae],r,!1,!1),e.i==2?dd(e,Mv,t):t.push(Dt(e.g)),!0)}),(function(e,t,r){if((t=wc(Xn,t))!=null&&t.length){r=mc(e,r);for(let n=0;n<t.length;n++)pc(e.g,t[n]);gc(e,r)}}),D1),Ye,-1,[0,Wt,-1],Jn,Wt,-1],Y1=[0,Ye,-2],I0=class extends Ne{constructor(e){super(e)}},Z1=[0],Q1=[0,xn,Wt,1,Wt,-3],e2=class extends Ne{constructor(e){super(e,2)}},kc={};kc[336783863]=[0,Ye,Wt,-1,xn,[0,[1,2,3,4,5,6,7,8],ft,Z1,ft,J1,ft,Y1,ft,Q1,ft,X1,ft,[0,Ye,-2],ft,[0,Ye,Jn],ft,[0,Jn,Ye]],[0,Ye],Wt,[0,[1,3],[2,4],ft,[0,wd],-1,ft,[0,ir],-1,or,[0,Ye,-1]],Ye];var R0,P0=[0,Ru,-1,Xi,-3,Ru,wd,Sn,$i,Ru,-1,Xi,$i,Xi,-2,Sn],Sd=class extends Ne{constructor(e){super(e,500)}o(e){return wr(this,0,7,e)}},Ko=[-1,{}],D0=[0,Ye,1,Ko],O0=[0,Ye,ir,Ko],kd=class extends Ne{constructor(e){super(e,500)}o(e){return wr(this,0,1001,e)}};kd.prototype.g=(R0=[-500,or,[-500,Sn,-1,ir,-3,[-2,kc,Wt],or,x0,$i,-1,D0,O0,or,[0,Sn,Xi],Sn,P0,$i,ir,987,ir],4,or,[-500,Ye,-1,[-1,{}],998,Ye],or,[-500,Ye,ir,-1,[-2,{},Wt],997,ir,-1],$i,or,[-500,Ye,ir,Ko,998,ir],ir,$i,D0,O0,or,[0,Sn,-1,Ko],ir,-2,P0,Sn,-1,Xi,[0,Xi,qv],978,Ko,or,x0],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let o=this.g;return this.g=[],o}}}};N1(this.l,e,Qn(bc,_c,vc,R0)),eo(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,i=0;for(let o=0;o<n;o++){let s=r[o];t.set(s,i),i+=s.length}return e.j=[t],t});var Jv=class extends Ne{constructor(e){super(e)}},Yv=class extends Ne{constructor(e){super(e)}g(){return sd(this,Jv)}},Zv=[0,or,[0,xn,G1,Ye,-1]],B0=class extends Ne{constructor(e){super(e)}},L0=class extends Ne{constructor(e){super(e)}},t2=[1,2,3,4,5],ic=class extends Ne{constructor(e){super(e)}g(){return f1(this)!=null}i(){return En(_r(this,2))!=null}},oc=class extends Ne{constructor(e){super(e)}},r2=class extends Ne{constructor(e){super(e)}},n2=[0,[0,q1,Ye,[0,xn,rc,-1],[0,Gv,rc]],Wt,[0,t2,ft,Q1,ft,J1,ft,X1,ft,Z1,ft,Y1],Jn],Qv=new nc(451755788,r2);kc[451755788]=[0,n2,[0,Ye,xn,G1,ir,-1],Wv];var F0=class extends Ne{constructor(e){super(e)}},i2=class extends Ne{constructor(e){super(e)}},e3=new nc(487277289,i2);kc[487277289]=[0,n2,[0,Wt,-1]];var t3=class extends Ne{constructor(e){super(e)}},r3=K1(class extends Ne{constructor(e){super(e)}},[0,or,[0,1,xn,Ye,Zv],rc]),M0=class extends Ne{constructor(e){super(e)}},n3=class extends Ne{constructor(e){super(e)}J(){let e=f1(this);return e??Yi()}},i3=class extends Ne{constructor(e){super(e)}},o2=[1,2],U0=K1(class extends Ne{constructor(e){super(e)}},[0,or,[0,o2,ft,[0,$v],ft,[0,q1],xn,Ye],rc]);function o3(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function N0(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function ie(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.h.stringToNewUTF8(t)),e.h._free(t)}function z0(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.h.stringToNewUTF8(t[i]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.h._free(i);e.h._free(t)}function _n(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Gn(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}var s3=(function(e){return class extends e{N(){this.h._registerModelResourcesGraphService()}}})(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:o3()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ie(this,n||"input_audio",(o=>{ie(this,i=i||"audio_header",(s=>{this.h._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(e,this.g/4),ie(this,n,(s=>{this.h._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){ie(this,t,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let i=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let[o,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||o===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=s);let[a,c]=[o,s];this.h._addBoundTextureToStream(n,a,c,r)}))}addBoolToStream(e,t,r){ie(this,t,(n=>{this.h._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){ie(this,t,(n=>{this.h._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){ie(this,t,(n=>{this.h._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){ie(this,t,(n=>{this.h._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){ie(this,t,(n=>{this.h._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){ie(this,t,(n=>{ie(this,e,(i=>{this.h._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){ie(this,t,(n=>{z0(this,Object.keys(e),(i=>{z0(this,Object.values(e),(o=>{this.h._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){ie(this,r,(i=>{ie(this,t,(o=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,o,i,n),this.h._free(s)}))}))}addEmptyPacketToStream(e,t){ie(this,e,(r=>{this.h._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(i,o);this.h._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(i,o);this.h._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(i,o);this.h._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(i,o);this.h._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(i,o);this.h._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ie(this,o,(s=>{this.h._addStringVectorEntry(i,s)}));this.h._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){ie(this,t,(r=>{ie(this,e,(n=>{this.h._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){ie(this,r,(n=>{ie(this,t,(i=>{let o=this.h._malloc(e.length);this.h.HEAPU8.set(e,o),this.h._addProtoToInputSidePacket(o,e.length,i,n),this.h._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(n,i);this.h._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(n,i);this.h._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(n,i);this.h._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(n,i);this.h._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(n,i);this.h._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ie(this,i,(o=>{this.h._addStringVectorEntry(n,o)}));this.h._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){_n(this,e,t),ie(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){_n(this,e,t),ie(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){Gn(this,e,t),ie(this,e,(n=>{this.h._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),_n(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),ie(this,e,(n=>{this.h._attachAudioListener(n,r||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),s2=class extends s3{};async function a3(e,t,r){return e=await(async(n,i,o,s)=>{if(i&&await N0(i),!self.ModuleFactory||o&&(await N0(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((i=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function a2(e,t,r){return a3(e,t,r)}function Du(e,t){let r=vr(e.baseOptions,ic,1)||new ic;typeof t=="string"?(pt(r,2,ec(t)),pt(r,1)):t instanceof Uint8Array&&(pt(r,1,Q0(t,!1)),pt(r,2)),wr(e.baseOptions,0,1,r)}function c2(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(vr(e.baseOptions,ic,1)?.g()||vr(e.baseOptions,ic,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=vr(n.baseOptions,L0,3);if(!o){var s=o=new L0;Tu(s,4,new I0)}"delegate"in i&&(i.delegate==="GPU"?Tu(i=o,2,s=new Xv):Tu(i=o,4,s=new I0)),wr(n.baseOptions,0,3,o)})(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Du(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)Du(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{Du(e,n),e.v()}));return e.v(),Promise.resolve()}function j0(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map((r=>r.message)).join(", "))}finally{e.j=[]}}function Gi(e,t){e.s=Math.max(e.s,t)}var Ja=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.j.push(Error(n))})),this.g.N(),this.g.setGraph(e,t),j0(this)}finishProcessing(){this.g.finishProcessing(),j0(this)}close(){this.g.closeGraph()}};async function Xo(e,t,r){return a2(e,t,r)}Ja.prototype.close=Ja.prototype.close,(function(e,t){e=e.split(".");var r,n=Kn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",Ja);var sc=class extends Ja{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function c3(e){let t={classifications:sd(e,t3).map((r=>(function(n,i=-1,o=""){return{categories:n.map((s=>{var a=Xn(_r(s,1))??0??-1;let c=s.l,l=0|c[ae],h=Zn(c,l,2),u=Qo(h);return u!=null&&u!==h&&ct(c,l,2,u),{index:a,score:u??0??0,categoryName:En(_r(s,3))??""??"",displayName:En(_r(s,4))??""??""}})),headIndex:i,headName:o}})(vr(r,Yv,4)?.g()??[],Xn(_r(r,2))??0,En(_r(r,3))??"")))};return Fu(_r(e,2))!=null&&(t.timestampMs=Fu(_r(e,2))??0),t}sc.prototype.setDefaultSampleRate=sc.prototype.O;var nr=class extends sc{constructor(e,t){super(new s2(e,t)),this.m=[],wr(e=this.i=new r2,0,1,t=new oc)}get baseOptions(){return vr(this.i,oc,1)}set baseOptions(e){wr(this.i,0,1,e)}o(e){var t=this.i,r=vr(this.i,B0,2);if(r=r?d1(r):new B0,e.displayNamesLocale!==void 0?pt(r,1,ec(e.displayNamesLocale)):e.displayNamesLocale===void 0&&pt(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!uc(n))throw u0();n|=0}pt(r,2,n)}else"maxResults"in e&&pt(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);pt(r,3,n)}else"scoreThreshold"in e&&pt(r,3);return e.categoryAllowlist!==void 0?_0(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&pt(r,4),e.categoryDenylist!==void 0?_0(r,5,e.categoryDenylist):"categoryDenylist"in e&&pt(r,5),wr(t,0,2,r),c2(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}v(){var e=new kd;Pt(e,10,"audio_in"),Pt(e,10,"sample_rate"),Pt(e,15,"timestamped_classifications");let t=new e2;x1(t,Qv,this.i);let r=new Sd;m1(r,ec("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Pt(r,3,"AUDIO:audio_in"),Pt(r,3,"SAMPLE_RATE:sample_rate"),Pt(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),_1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,i)=>{(function(o,s){s.forEach((a=>{a=r3(a),o.m.push(c3(a))}))})(this,n),Gi(this,i)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{Gi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function V0(e){return{embeddings:sd(e,i3).map((t=>{let r={headIndex:Xn(_r(t,3))??0??-1,headName:En(_r(t,4))??""??""};if(y1(t,M0,Au(t,1))!==void 0)r.floatEmbedding=p1(vr(t,M0,Au(t,1)),1,Qo,e1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=vr(t,n3,Au(t,2))?.J()?.i()??n}return r})),timestampMs:Fu(_r(e,2))??0}}nr.prototype.classify=nr.prototype.K,nr.prototype.setOptions=nr.prototype.o,nr.createFromModelPath=function(e,t){return a2(nr,e,{baseOptions:{modelAssetPath:t}})},nr.createFromModelBuffer=function(e,t){return Xo(nr,e,{baseOptions:{modelAssetBuffer:t}})},nr.createFromOptions=function(e,t){return Xo(nr,e,t)};var Fr=class extends sc{constructor(e,t){super(new s2(e,t)),this.m=[],wr(e=this.i=new i2,0,1,t=new oc)}get baseOptions(){return vr(this.i,oc,1)}set baseOptions(e){wr(this.i,0,1,e)}o(e){var t=this.i,r=vr(this.i,F0,2);return r=r?d1(r):new F0,e.l2Normalize!==void 0?pt(r,1,y0(e.l2Normalize)):"l2Normalize"in e&&pt(r,1),e.quantize!==void 0?pt(r,2,y0(e.quantize)):"quantize"in e&&pt(r,2),wr(t,0,2,r),c2(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}v(){var e=new kd;Pt(e,10,"audio_in"),Pt(e,10,"sample_rate"),Pt(e,15,"embeddings_out"),Pt(e,15,"timestamped_embeddings_out");let t=new e2;x1(t,e3,this.i);let r=new Sd;m1(r,ec("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Pt(r,3,"AUDIO:audio_in"),Pt(r,3,"SAMPLE_RATE:sample_rate"),Pt(r,4,"EMBEDDINGS:embeddings_out"),Pt(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),_1(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=U0(n),this.m.push(V0(n)),Gi(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{Gi(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,i)=>{for(let o of n)n=U0(o),this.m.push(V0(n));Gi(this,i)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{Gi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Ka;Fr.prototype.embed=Fr.prototype.L,Fr.prototype.setOptions=Fr.prototype.o,Fr.createFromModelPath=function(e,t){return Xo(Fr,e,{baseOptions:{modelAssetPath:t}})},Fr.createFromModelBuffer=function(e,t){return Xo(Fr,e,{baseOptions:{modelAssetBuffer:t}})},Fr.createFromOptions=function(e,t){return Xo(Fr,e,t)};var l3=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function l2(){if(Ka===void 0)try{await WebAssembly.instantiate(l3),Ka=!0}catch{Ka=!1}return Ka}async function Wo(e,t=Kv``){let r=await l2()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var vn=class{};vn.forVisionTasks=function(e){return Wo("vision",e)},vn.forTextTasks=function(e){return Wo("text",e)},vn.forGenAiExperimentalTasks=function(e){return Wo("genai_experimental",e)},vn.forGenAiTasks=function(e){return Wo("genai",e)},vn.forAudioTasks=function(e){return Wo("audio",e)},vn.isSimdSupported=function(){return l2()};function h3(e,t){let r=e.reduce((a,c)=>a+c.length,0),n=new ArrayBuffer(44+r*2),i=new DataView(n),o=(a,c,l)=>{for(let h=0;h<l.length;h++)a.setUint8(c+h,l.charCodeAt(h))};o(i,0,"RIFF"),i.setUint32(4,36+r*2,!0),o(i,8,"WAVE"),o(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(i,36,"data"),i.setUint32(40,r*2,!0);let s=44;for(let a of e)for(let c=0;c<a.length;c++){let l=Math.max(-1,Math.min(1,a[c]));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([i],{type:"audio/wav"})}var Ec=class{constructor(t,r,n,i,o,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.preRollBuffer=[];this.recordingChunks=[];this.PRE_ROLL_SECONDS=2;this.SAMPLE_RATE=16e3;this.MAX_PRE_ROLL_CHUNKS=4;this.lastNoiseTime=0;this.SILENCE_THRESHOLD=3e3;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=i,this.onRealtimeAlertsCallback=o,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Jr(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new Ha(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new bn(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(i=>{console.log(i),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t*1.25);let n=r>=t;if(n&&(this.lastNoiseTime=Date.now()),n&&!this.recordingInProgress){this.recordingInProgress=!0,this.recordingChunks=[...this.preRollBuffer];let o=this.preRollBuffer.reduce((a,c)=>a+c.length,0)/this.SAMPLE_RATE*1e3,s=Date.now()-this.examStartTime;this.recordingStartTime=s-o,this.recordingStartTime<0&&(this.recordingStartTime=0)}else if(this.recordingInProgress){let i=Date.now()-this.lastNoiseTime,o=Date.now()-this.recordingStartTime;i>=this.SILENCE_THRESHOLD&&o>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++}}async stopSoundRecord(){if(!this.recordingInProgress&&this.recordingChunks.length===0||(this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=h3(this.recordingChunks,this.SAMPLE_RATE),r=new File([t],`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.wav`,{type:"audio/wav"});this.uploadRecord(r),this.recordingChunks=[],this.recordingInProgress=!1}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let i=parseFloat(r.score)>.22;if(n&&i)return!0}return!1}async createAudioClassifier(){let t=await vn.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await nr.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:this.SAMPLE_RATE});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([u3],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let n=r.data;this.preRollBuffer.push(n),this.preRollBuffer.length>this.MAX_PRE_ROLL_CHUNKS&&this.preRollBuffer.shift(),this.recordingInProgress&&this.recordingChunks.push(n);let o=this.audioClassifier.classify(n)[0].classifications[0].categories;o.length>0&&(this.audioClassificationResult=[{name:o[0].categoryName,score:o[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},u3=`
432
436
  class AudioProcessor extends AudioWorkletProcessor {
433
437
  bufferSize;
434
438
  inputBuffer;
@@ -465,7 +469,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
465
469
  }
466
470
 
467
471
  registerProcessor("audio-processor", AudioProcessor);
468
- `;var tc=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t,la(t)}async startRecording(){if(this.startTime=new Date(Date.now()),Er())return;let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:o}=this.options,i={video:{cursor:"always",width:this.options.screenRecorderOptions.width,height:this.options.screenRecorderOptions.height,displaySurface:"monitor"},audio:!1},s={video:{cursor:"always",width:1280,height:720,displaySurface:"monitor"},audio:!1},a;try{a=await navigator.mediaDevices.getDisplayMedia(i)}catch(f){if(f instanceof TypeError&&f.message.includes("min constraints are not supported"))console.warn("Navegador n\xE3o suporta restri\xE7\xF5es 'min/max/ideal'. Tentando com 720p fixo."),a=await navigator.mediaDevices.getDisplayMedia(s);else throw f}this.screenStream=a;let c=this.screenStream.getVideoTracks();if(c[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let f=c.find(y=>y.label=="");if(f&&t||f&&!r)throw ha}let h=c.find(f=>["screen:0:0","Primary Monitor"].includes(f.label))!=null,d=c.find(f=>["screen:0:0","Primary Monitor",""].includes(f.label)||["screen:"].some(y=>f.label.includes(y)))!=null,u=c.find(f=>["web-contents-media-stream","window"].some(y=>f.label.includes(y)))!=null;if(!h&&t)throw c.forEach(f=>{f.stop()}),Pg;if(!d||u)throw c.forEach(f=>{f.stop()}),Rg;let{startRecording:b,stopRecording:m}=Qr(this.screenStream,this.blobs,this.options.onBufferSizeError,o);this.recordingStart=b,this.recordingStop=m,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_screen_0.webm`,{type:"video/webm"}),origin:"Screen"})}};var Ei=class{constructor(t,r){this.dbName="EasyProctorDb";this.dbVersion=2;this.storeName="exams2";this.dbName=t,this.storeName=r}async save(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.delete(t),r)}async get(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async list(){let{transaction:t,store:r}=await this.connectToStore("readonly");return this.processRequest(r.getAll(),t)}async clear(){let{transaction:t,store:r}=await this.connectToStore("readwrite");return this.processRequest(r.clear(),t)}async processRequest(t,r){return new Promise((n,o)=>{t.onerror=i=>{o(t.error?.message)},t.onsuccess=i=>{r.commit(),n(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let o=(await this.connect()).result.transaction(this.storeName,t),i=o.objectStore(this.storeName);return{transaction:o,store:i}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let n=window.indexedDB.open(this.dbName,this.dbVersion);n.onerror=o=>{r("Can't connect to IndexedDB")},n.onupgradeneeded=o=>{let i=n.result;i.onerror=s=>{},i.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=o=>{this.connection=n,t(n)}})}};function G0(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function Ci(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var rc=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new no}async login(){let t=await this.capturePhoto.takePicture("Login com biometria facial","Encaixe seu rosto no formato e clique no bot\xE3o abaixo",{width:1280,height:720});return this.loading(),new Promise((r,n)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(o=>{this.token=o.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(o=>{console.log(o),document.querySelector("#authLoader")?.remove(),n(o)})})}loading(){let t=document.createElement("div");t.setAttribute("id","authLoader"),t.style.backgroundColor="rgba(0,0,0,0.4)",t.style.zIndex="1000",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.height="100vh",t.style.width="100%",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center";let r=document.createElement("div");r.setAttribute("class","loader"),t.appendChild(r),document.body.appendChild(t);let n=`
472
+ `;var Cc=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t,Oa(t)}async startRecording(){if(this.startTime=new Date(Date.now()),yn())return;let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:i}=this.options,o={video:{cursor:"always",width:this.options.screenRecorderOptions.width,height:this.options.screenRecorderOptions.height,displaySurface:"monitor"},audio:!1},s={video:{cursor:"always",width:1280,height:720,displaySurface:"monitor"},audio:!1},a;try{a=await navigator.mediaDevices.getDisplayMedia(o)}catch(f){if(f instanceof TypeError&&f.message.includes("min constraints are not supported"))console.warn("Navegador n\xE3o suporta restri\xE7\xF5es 'min/max/ideal'. Tentando com 720p fixo."),a=await navigator.mediaDevices.getDisplayMedia(s);else throw f}this.screenStream=a;let c=this.screenStream.getVideoTracks();if(c[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let f=c.find(b=>b.label=="");if(f&&t||f&&!r)throw Ba}let h=c.find(f=>["screen:0:0","Primary Monitor"].includes(f.label))!=null,u=c.find(f=>["screen:0:0","Primary Monitor",""].includes(f.label)||["screen:"].some(b=>f.label.includes(b)))!=null,m=c.find(f=>["web-contents-media-stream","window"].some(b=>f.label.includes(b)))!=null;if(!h&&t)throw c.forEach(f=>{f.stop()}),Wg;if(!u||m)throw c.forEach(f=>{f.stop()}),$g;let{startRecording:p,stopRecording:g}=Wn(this.screenStream,this.blobs,this.options.onBufferSizeError,i);this.recordingStart=p,this.recordingStop=g,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_screen_0.webm`,{type:"video/webm"}),origin:"Screen"})}};var rs=class{constructor(t,r){this.dbName="EasyProctorDb";this.dbVersion=2;this.storeName="exams2";this.dbName=t,this.storeName=r}async save(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.delete(t),r)}async get(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async list(){let{transaction:t,store:r}=await this.connectToStore("readonly");return this.processRequest(r.getAll(),t)}async clear(){let{transaction:t,store:r}=await this.connectToStore("readwrite");return this.processRequest(r.clear(),t)}async processRequest(t,r){return new Promise((n,i)=>{t.onerror=o=>{i(t.error?.message)},t.onsuccess=o=>{r.commit(),n(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let i=(await this.connect()).result.transaction(this.storeName,t),o=i.objectStore(this.storeName);return{transaction:i,store:o}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let n=window.indexedDB.open(this.dbName,this.dbVersion);n.onerror=i=>{r("Can't connect to IndexedDB")},n.onupgradeneeded=i=>{let o=n.result;o.onerror=s=>{},o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=i=>{this.connection=n,t(n)}})}};function h2(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function ns(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var xc=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new Vi}async login(){let t=await this.capturePhoto.takePicture("Login com biometria facial","Encaixe seu rosto no formato e clique no bot\xE3o abaixo",{width:1280,height:720});return this.loading(),new Promise((r,n)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(i=>{this.token=i.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(i=>{console.log(i),document.querySelector("#authLoader")?.remove(),n(i)})})}loading(){let t=document.createElement("div");t.setAttribute("id","authLoader"),t.style.backgroundColor="rgba(0,0,0,0.4)",t.style.zIndex="1000",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.height="100vh",t.style.width="100%",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center";let r=document.createElement("div");r.setAttribute("class","loader"),t.appendChild(r),document.body.appendChild(t);let n=`
469
473
  .loader {
470
474
  border: 6px solid #f3f3f3;
471
475
  border-radius: 50%;
@@ -486,27 +490,42 @@ registerProcessor("audio-processor", AudioProcessor);
486
490
  0% { transform: rotate(0deg); }
487
491
  100% { transform: rotate(360deg); }
488
492
  }
489
- `,o=document.createElement("style");o.innerHTML=n,document.head.appendChild(o)}};var ot=class extends Error{constructor(t,r){let n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}},Br=class extends Error{constructor(t="A timeout occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},Ae=class extends Error{constructor(t="An abort occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},nc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}},oc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}},ic=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},xi=class extends Error{constructor(t){let r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},sc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}};var bo=class{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}},qt=class{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}};var g;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(g||(g={}));var Gt=class{constructor(){}log(t,r){}};Gt.instance=new Gt;var K0="9.0.6";var W=class{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}},q=class e{static get isBrowser(){return!e.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!e.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!e.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function Mr(e,t){let r="";return Bt(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${av(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function av(e){let t=new Uint8Array(e),r="";return t.forEach(n=>{let o=n<16?"0":"";r+=`0x${o}${n.toString(16)} `}),r.substr(0,r.length-1)}function Bt(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function cc(e,t,r,n,o,i){let s={},[a,c]=Kt();s[a]=c,e.log(g.Trace,`(${t} transport) sending data. ${Mr(o,i.logMessageContent)}.`);let l=Bt(o)?"arraybuffer":"text",h=await r.post(n,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(g.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}function X0(e){return e===void 0?new ln(g.Information):e===null?Gt.instance:e.log!==void 0?e:new ln(e)}var ac=class{constructor(t,r){this._subject=t,this._observer=r}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}},ln=class{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){let n=`[${new Date().toISOString()}] ${g[t]}: ${r}`;switch(t){case g.Critical:case g.Error:this.out.error(n);break;case g.Warning:this.out.warn(n);break;case g.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function Kt(){let e="X-SignalR-User-Agent";return q.isNode&&(e="User-Agent"),[e,cv(K0,lv(),dv(),hv())]}function cv(e,t,r,n){let o="Microsoft SignalR/",i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,t&&t!==""?o+=`${t}; `:o+="Unknown OS; ",o+=`${r}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function lv(){if(q.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function hv(){if(q.isNode)return process.versions.node}function dv(){return q.isNode?"NodeJS":"Browser"}function lc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function J0(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var hc=class extends qt{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||q.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:wn;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(J0());if(typeof AbortController>"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:wn;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new Ae;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");let r=new this._abortControllerType,n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new Ae});let o=null;if(t.timeout){let c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(g.Warning,"Timeout from HTTP request."),n=new Br},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},Bt(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let i;try{i=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(g.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!i.ok){let c=await Y0(i,"text");throw new ot(c||i.statusText,i.status)}let a=await Y0(i,t.responseType);return new bo(i.status,i.statusText,a)}getCookieString(t){let r="";return q.isNode&&this._jar&&this._jar.getCookies(t,(n,o)=>r=o.join("; ")),r}};function Y0(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}var dc=class extends qt{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ae):t.method?t.url?new Promise((r,n)=>{let o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(Bt(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let i=t.headers;i&&Object.keys(i).forEach(s=>{o.setRequestHeader(s,i[s])}),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new Ae)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new bo(o.status,o.statusText,o.response||o.responseText)):n(new ot(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(g.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new ot(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(g.Warning,"Timeout from HTTP request."),n(new Br)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var uc=class extends qt{constructor(t){if(super(),typeof fetch<"u"||q.isNode)this._httpClient=new hc(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new dc(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ae):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}};var it=class e{static write(t){return`${t}${e.RecordSeparator}`}static parse(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");let r=t.split(e.RecordSeparator);return r.pop(),r}};it.RecordSeparatorCode=30;it.RecordSeparator=String.fromCharCode(it.RecordSeparatorCode);var pc=class{writeHandshakeRequest(t){return it.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(Bt(t)){let a=new Uint8Array(t),c=a.indexOf(it.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{let a=t,c=a.indexOf(it.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}let o=it.parse(r),i=JSON.parse(o[0]);if(i.type)throw new Error("Expected a handshake response from the server.");return[n,i]}};var D;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})(D||(D={}));var fc=class{constructor(){this.observers=[]}next(t){for(let r of this.observers)r.next(t)}error(t){for(let r of this.observers)r.error&&r.error(t)}complete(){for(let t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new ac(this,t)}};var mc=class{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){let r=this._protocol.writeMessage(t),n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let o=()=>{},i=()=>{};Bt(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((s,a)=>{o=s,i=a})),this._messages.push(new Qd(r,this._totalMessageCount,o,i))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){let o=this._messages[n];if(o._id<=t.sequenceId)r=n,Bt(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==D.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;let r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){let t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:D.Sequence,sequenceId:t}));let r=this._messages;for(let n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(let r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case D.Invocation:case D.StreamItem:case D.Completion:case D.StreamInvocation:case D.CancelInvocation:return!0;case D.Close:case D.Sequence:case D.Ping:case D.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:D.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}},Qd=class{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}};var uv=30*1e3,pv=15*1e3,fv=1e5,re;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(re||(re={}));var gc=class e{static create(t,r,n,o,i,s,a){return new e(t,r,n,o,i,s,a)}constructor(t,r,n,o,i,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(g.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},W.isRequired(t,"connection"),W.isRequired(r,"logger"),W.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=i??uv,this.keepAliveIntervalInMilliseconds=s??pv,this._statefulReconnectBufferSize=a??fv,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new pc,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=re.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:D.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==re.Disconnected&&this._connectionState!==re.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==re.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=re.Connecting,this._logger.log(g.Debug,"Starting HubConnection.");try{await this._startInternal(),q.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=re.Connected,this._connectionStarted=!0,this._logger.log(g.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=re.Disconnected,this._logger.log(g.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);let n={protocol:this._protocol.name,version:r};if(this._logger.log(g.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(g.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new mc(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(g.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){let t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===re.Disconnected)return this._logger.log(g.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===re.Disconnecting)return this._logger.log(g.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let r=this._connectionState;return this._connectionState=re.Disconnecting,this._logger.log(g.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(g.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===re.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Ae("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){let[n,o]=this._replaceStreamingParams(r),i=this._createStreamInvocation(t,r,o),s,a=new fc;return a.cancelCallback=()=>{let c=this._createCancelInvocation(i.invocationId);return delete this._callbacks[i.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[i.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===D.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(i).catch(c=>{a.error(c),delete this._callbacks[i.invocationId]}),this._launchStreams(n,s),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){let[n,o]=this._replaceStreamingParams(r),i=this._sendWithProtocol(this._createInvocation(t,r,!0,o));return this._launchStreams(n,i),i}invoke(t,...r){let[n,o]=this._replaceStreamingParams(r),i=this._createInvocation(t,r,!1,o);return new Promise((a,c)=>{this._callbacks[i.invocationId]=(h,d)=>{if(d){c(d);return}else h&&(h.type===D.Completion?h.error?c(new Error(h.error)):a(h.result):c(new Error(`Unexpected message type: ${h.type}`)))};let l=this._sendWithProtocol(i).catch(h=>{c(h),delete this._callbacks[i.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();let n=this._methods[t];if(n)if(r){let o=n.indexOf(r);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let r=this._protocol.parseMessages(t,this._logger);for(let n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case D.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(g.Error,`Invoke client method threw error: ${lc(o)}`)});break;case D.StreamItem:case D.Completion:{let o=this._callbacks[n.invocationId];if(o){n.type===D.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(i){this._logger.log(g.Error,`Stream callback threw error: ${lc(i)}`)}}break}case D.Ping:break;case D.Close:{this._logger.log(g.Information,"Close message received from server.");let o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case D.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case D.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(g.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){let i="Error parsing handshake response: "+o;this._logger.log(g.Error,i);let s=new Error(i);throw this._handshakeRejecter(s),s}if(r.error){let o="Server returned handshake error: "+r.error;this._logger.log(g.Error,o);let i=new Error(o);throw this._handshakeRejecter(i),i}else this._logger.log(g.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===re.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){let r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(g.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(g.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}let o=n.slice(),i=!!t.invocationId,s,a,c;for(let l of o)try{let h=s;s=await l.apply(this,t.arguments),i&&s&&h&&(this._logger.log(g.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(h){a=h,this._logger.log(g.Error,`A callback for the method '${r}' threw error '${h}'.`)}c?await this._sendWithProtocol(c):i?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(t.invocationId,null,s):(this._logger.log(g.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(g.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(g.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new Ae("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===re.Disconnecting?this._completeClose(t):this._connectionState===re.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===re.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=re.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),q.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(g.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){let r=Date.now(),n=0,o=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),i=this._getNextRetryDelay(n++,0,o);if(i===null){this._logger.log(g.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=re.Reconnecting,t?this._logger.log(g.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(g.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(g.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==re.Reconnecting){this._logger.log(g.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(g.Information,`Reconnect attempt number ${n} will start in ${i} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,i)}),this._reconnectDelayHandle=void 0,this._connectionState!==re.Reconnecting){this._logger.log(g.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=re.Connected,this._logger.log(g.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(g.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(g.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==re.Reconnecting){this._logger.log(g.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===re.Disconnecting&&this._completeClose();return}o=s instanceof Error?s:new Error(s.toString()),i=this._getNextRetryDelay(n++,Date.now()-r,o)}}this._logger.log(g.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(o){return this._logger.log(g.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){let r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{let o=r[n];try{o(null,t)}catch(i){this._logger.log(g.Error,`Stream 'error' callback called with '${t}' threw error: ${lc(i)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,o){if(n)return o.length!==0?{target:t,arguments:r,streamIds:o,type:D.Invocation}:{target:t,arguments:r,type:D.Invocation};{let i=this._invocationId;return this._invocationId++,o.length!==0?{target:t,arguments:r,invocationId:i.toString(),streamIds:o,type:D.Invocation}:{target:t,arguments:r,invocationId:i.toString(),type:D.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(let n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let i;o instanceof Error?i=o.message:o&&o.toString?i=o.toString():i="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,i)))},next:o=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(t){let r=[],n=[];for(let o=0;o<t.length;o++){let i=t[o];if(this._isObservable(i)){let s=this._invocationId;this._invocationId++,r[s]=i,n.push(s.toString()),t.splice(o,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){let o=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:n,type:D.StreamInvocation}:{target:t,arguments:r,invocationId:o.toString(),type:D.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:D.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:D.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:D.Completion}:{invocationId:t,result:n,type:D.Completion}}_createCloseMessage(){return{type:D.Close}}};var mv=[0,2e3,1e4,3e4,null],Ai=class{constructor(t){this._retryDelays=t!==void 0?[...t,null]:mv}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}};var Mt=class{};Mt.Authorization="Authorization";Mt.Cookie="Cookie";var yc=class extends qt{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);let n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Mt.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Mt.Authorization]&&delete t.headers[Mt.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}};var ie;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(ie||(ie={}));var de;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(de||(de={}));var bc=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var Ti=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new bc,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(W.isRequired(t,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,de,"transferFormat"),this._url=t,this._logger.log(g.Trace,"(LongPolling transport) Connecting."),r===de.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,o]=Kt(),i={[n]:o,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:i,timeout:1e5,withCredentials:this._options.withCredentials};r===de.Binary&&(s.responseType="arraybuffer");let a=`${t}&_=${Date.now()}`;this._logger.log(g.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(g.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new ot(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(t,r){try{for(;this._running;)try{let n=`${t}&_=${Date.now()}`;this._logger.log(g.Trace,`(LongPolling transport) polling: ${n}.`);let o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(g.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(g.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new ot(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(g.Trace,`(LongPolling transport) data received. ${Mr(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(g.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Br?this._logger.log(g.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(g.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(g.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?cc(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(g.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(g.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[r,n]=Kt();t[r]=n;let o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},i;try{await this._httpClient.delete(this._url,o)}catch(s){i=s}i?i instanceof ot&&(i.statusCode===404?this._logger.log(g.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(g.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(g.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(g.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(g.Trace,t),this.onclose(this._closeError)}}};var vc=class{constructor(t,r,n,o){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,r){return W.isRequired(t,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,de,"transferFormat"),this._logger.log(g.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let i=!1;if(r!==de.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(q.isBrowser||q.isWebWorker)s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(t),c={};c.Cookie=a;let[l,h]=Kt();c[l]=h,s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(g.Trace,`(SSE transport) data received. ${Mr(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{i?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(g.Information,`SSE connected to ${this._url}`),this._eventSource=s,i=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?cc(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}};var wc=class{constructor(t,r,n,o,i,s){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=o,this._webSocketConstructor=i,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=s}async connect(t,r){W.isRequired(t,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,de,"transferFormat"),this._logger.log(g.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((o,i)=>{t=t.replace(/^http/,"ws");let s,a=this._httpClient.getCookieString(t),c=!1;if(q.isNode||q.isReactNative){let l={},[h,d]=Kt();l[h]=d,n&&(l[Mt.Authorization]=`Bearer ${n}`),a&&(l[Mt.Cookie]=a),s=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(t)),r===de.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(g.Information,`WebSocket connected to ${t}.`),this._webSocket=s,c=!0,o()},s.onerror=l=>{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="There was an error with the transport",this._logger.log(g.Information,`(WebSockets transport) ${h}.`)},s.onmessage=l=>{if(this._logger.log(g.Trace,`(WebSockets transport) data received. ${Mr(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(h){this._close(h);return}},s.onclose=l=>{if(c)this._close(l);else{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",i(new Error(h))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(g.Trace,`(WebSockets transport) sending data. ${Mr(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(g.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}};var Q0=100,_c=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,W.isRequired(t,"url"),this._logger=X0(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,o=null;if(q.isNode&&typeof wn<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:wn;n=i("ws"),o=i("eventsource")}!q.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:q.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!q.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:q.isNode&&!r.EventSource&&typeof o<"u"&&(r.EventSource=o),this._httpClient=new yc(r.httpClient||new uc(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||de.Binary,W.isIn(t,de,"transferFormat"),this._logger.log(g.Debug,`Starting connection with transfer format '${de[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){let r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(g.Error,r),await this._stopPromise,Promise.reject(new Ae(r))}else if(this._connectionState!=="Connected"){let r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(g.Error,r),Promise.reject(new Ae(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Zd(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(g.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(g.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(g.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(g.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===ie.WebSockets)this.transport=this._constructTransport(ie.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Ae("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){let i=n.accessToken;this._accessTokenFactory=()=>i,this._httpClient._accessToken=i,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Q0);if(o===Q0&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Ti&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(g.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(g.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){let r={},[n,o]=Kt();r[n]=o;let i=this._resolveNegotiateUrl(t);this._logger.log(g.Debug,`Sending negotiation request: ${i}.`);try{let s=await this._httpClient.post(i,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));let a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new xi("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof ot&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(g.Error,a),Promise.reject(new xi(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,o){let i=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(g.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(i,o),this.connectionId=n.connectionId;return}let s=[],a=n.availableTransports||[],c=n;for(let l of a){let h=this._resolveTransportOrError(l,r,o,c?.useStatefulReconnect===!0);if(h instanceof Error)s.push(`${l.transport} failed:`),s.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(t)}catch(d){return Promise.reject(d)}i=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(i,o),this.connectionId=c.connectionId;return}catch(d){if(this._logger.log(g.Error,`Failed to start the transport '${l.transport}': ${d}`),c=void 0,s.push(new ic(`${l.transport} failed: ${d}`,ie[l.transport])),this._connectionState!=="Connecting"){let u="Failed to select transport before stop() was called.";return this._logger.log(g.Debug,u),Promise.reject(new Ae(u))}}}}return s.length>0?Promise.reject(new sc(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case ie.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new wc(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case ie.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new vc(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case ie.LongPolling:return new Ti(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,o){let i=ie[t.transport];if(i==null)return this._logger.log(g.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(gv(r,i))if(t.transferFormats.map(a=>de[a]).indexOf(n)>=0){if(i===ie.WebSockets&&!this._options.WebSocket||i===ie.ServerSentEvents&&!this._options.EventSource)return this._logger.log(g.Debug,`Skipping transport '${ie[i]}' because it is not supported in your environment.'`),new nc(`'${ie[i]}' is not supported in your environment.`,i);this._logger.log(g.Debug,`Selecting transport '${ie[i]}'.`);try{return this.features.reconnect=i===ie.WebSockets?o:void 0,this._constructTransport(i)}catch(a){return a}}else return this._logger.log(g.Debug,`Skipping transport '${ie[i]}' because it does not support the requested transfer format '${de[n]}'.`),new Error(`'${ie[i]}' does not support ${de[n]}.`);else return this._logger.log(g.Debug,`Skipping transport '${ie[i]}' because it was disabled by the client.`),new oc(`'${ie[i]}' is disabled by the client.`,i)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(g.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(g.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(g.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(g.Error,`Connection disconnected with error '${t}'.`):this._logger.log(g.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(g.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(g.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!q.isBrowser)throw new Error(`Cannot resolve '${t}'.`);let r=window.document.createElement("a");return r.href=t,this._logger.log(g.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){let r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";let n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}};function gv(e,t){return!e||(t&e)!==0}var Zd=class e{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new vo,this._transportResult=new vo,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new vo),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new vo;let t=this._transportResult;this._transportResult=void 0;let r=typeof this._buffer[0]=="string"?this._buffer.join(""):e._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){let r=t.map(i=>i.byteLength).reduce((i,s)=>i+s),n=new Uint8Array(r),o=0;for(let i of t)n.set(new Uint8Array(i),o),o+=i.byteLength;return n.buffer}},vo=class{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}};var yv="json",Sc=class{constructor(){this.name=yv,this.version=2,this.transferFormat=de.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Gt.instance);let n=it.parse(t),o=[];for(let i of n){let s=JSON.parse(i);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case D.Invocation:this._isInvocationMessage(s);break;case D.StreamItem:this._isStreamItemMessage(s);break;case D.Completion:this._isCompletionMessage(s);break;case D.Ping:break;case D.Close:break;case D.Ack:this._isAckMessage(s);break;case D.Sequence:this._isSequenceMessage(s);break;default:r.log(g.Information,"Unknown message type '"+s.type+"' ignored.");continue}o.push(s)}return o}writeMessage(t){return it.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}};var bv={trace:g.Trace,debug:g.Debug,info:g.Information,information:g.Information,warn:g.Warning,warning:g.Warning,error:g.Error,critical:g.Critical,none:g.None};function vv(e){let t=bv[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}var Ii=class{configureLogging(t){if(W.isRequired(t,"logging"),wv(t))this.logger=t;else if(typeof t=="string"){let r=vv(t);this.logger=new ln(r)}else this.logger=new ln(t);return this}withUrl(t,r){return W.isRequired(t,"url"),W.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return W.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Ai(t):this.reconnectPolicy=t:this.reconnectPolicy=new Ai,this}withServerTimeout(t){return W.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return W.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){let t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let r=new _c(this.url,t);return gc.create(r,this.logger||Gt.instance,this.protocol||new Sc,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function wv(e){return e.log!==void 0}var Z2=Lu(Q2());var Ui=class{},ey=(s=>(s[s.WAITING=-1]="WAITING",s[s.STARTED=0]="STARTED",s[s.QR_CODE=1]="QR_CODE",s[s.POSITION=2]="POSITION",s[s.FINISHED=3]="FINISHED",s[s.ERROR=9]="ERROR",s))(ey||{}),Bc=class e{constructor(t,r){this.proctoringId="";this.capturePhotoUrl="";this.qrCodeBase64Image="";this.transmissionOk=!1;this.waitingPositionValidation=!1;this.externalSessionId=null;this.currentStep=0;this.connection=null;this.context=t,this.onRealtimeAlertsCallback=r,console.log("context -> ",t),this.backend=new ft({type:t?.type||"prod",token:t.token}),this.currentStep=-1}static{this.isModalOpen=!1}getExternalCameraSessionId(){return""+this.externalSessionId}async checkTransmission(){try{this.transmissionOk=!1;let t=await this.backend.externalCameraCheckTransmission(""+this.externalSessionId);console.log(t);let r=0;for(;!this.transmissionOk&&r<=5;)await new Promise(n=>setTimeout(n,2e3)),r=r+1;if(!this.transmissionOk)throw new Error("Timed out na checagem da transmiss\xE3o!")}catch(t){throw console.error("Erro ao checar a transmiss\xE3o:",t),new Error("N\xE3o foi poss\xEDvel checar a transmiss\xE3o."+t)}}async startTransmission(t){try{this.proctoringId=t;let r=await this.backend.externalCameraStartTransmission(""+this.externalSessionId,t);console.log(r)}catch(r){throw console.error("Erro ao iniciar transmiss\xE3o:",r),new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.")}}async goToPositionGuide(){try{let t=await this.backend.goToExternalCameraPositionStep(""+this.externalSessionId);console.log(t)}catch(t){throw console.error("Erro ao enviar comando de Position:",t),new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.")}}async reset(){if(this.connection){let t=new Ui;t.command="Reset",console.log("Enviando comando 'Reset' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,t)}}async takePicture(t,r){if(this.connection){this.waitingPositionValidation=t,this.onTakePictureCallback=r;let n=new Ui;n.command="Capture",console.log("Enviando comando 'Capture' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,n)}else throw new Error("N\xE3o existe conex\xE3o de camera externa ativa.")}async startSession(t){try{this.onQrCodeReadedCallback=t,this.connection&&await this.disconnectWebSocket(),await this.initializeWebSocketConnection(),await this.reset();let r=await this.backend.externalCameraStartSession();this.externalSessionId=r.externalSessionId,console.log(this.externalSessionId),this.currentStep=0;let n={externalSessionId:this.externalSessionId,token:this.context.token,ambient:this.context.type},o=JSON.stringify(n);return this.qrCodeBase64Image=await Z2.default.toDataURL(o),console.log(this.qrCodeBase64Image),this.qrCodeBase64Image}catch(r){return this.disconnectWebSocket(),Promise.reject(r)}}async checkExternalCamera(){if(this.currentStep=0,e.isModalOpen)return Promise.reject("O modal de verifica\xE7\xE3o j\xE1 est\xE1 aberto.");e.isModalOpen=!0;try{return await this.startSession(()=>{}),await this.buildInterface()}catch(t){return console.error("Erro ao iniciar verifica\xE7\xE3o:",t),this.closeCheckExternalCamera(),Promise.reject(t)}}buildInterface(){return new Promise((t,r)=>{this.resolvePromise=t;let n=document.createElement("div");n.setAttribute("id","externalCameraCheck"),this.applyStyles(n,{backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"});let o=document.createElement("div");this.applyStyles(o,{backgroundColor:"#fff",zIndex:"1001",width:"500px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"});let i=document.createElement("h3");i.innerText="Conectar dispositivo m\xF3vel",this.applyStyles(i,{color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"});let s=document.createElement("div");s.id="external-camera-content",this.applyStyles(s,{width:"100%",padding:"20px 40px",boxSizing:"border-box",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"});let a=document.createElement("div");this.applyStyles(a,{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"});let c=document.createElement("button");c.innerText="Cancelar",this.applyStyles(c,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 0 10px",cursor:"pointer"}),c.addEventListener("click",()=>{let h=new Ui;h.command="Cancel",console.log("Enviando comando 'Cancel' para o aplicativo..."),this.connection?.invoke("SendAction",this.externalSessionId,h),this.closeCheckExternalCamera(),t({result:!1})});let l=document.createElement("button");l.innerText="Continuar",l.id="external-camera-continue",this.applyStyles(l,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),a.appendChild(c),a.appendChild(l),o.appendChild(i),o.appendChild(s),o.appendChild(a),n.appendChild(o),document.body.appendChild(n),this.renderCurrentStep()})}renderCurrentStep(){let t=document.getElementById("external-camera-content");if(t)switch(t.innerHTML="",this.currentStep){case 0:this.renderQRCodeStep(t);break;case 1:this.renderPhotoStep(t);break;case 2:this.renderImageStep(t);break;default:break}}renderQRCodeStep(t){let r=document.createElement("canvas");r.id="qr-code-canvas";let n=document.createElement("p");n.innerText="Aponte a c\xE2mera do seu celular para o QR Code para iniciar a verifica\xE7\xE3o do ambiente.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"});let o=r.getContext("2d"),i=new Image;i.onload=()=>{let c=250/i.width,l=i.height*c;r.width=250,r.height=l,o&&o.drawImage(i,0,0,250,l)},i.src=this.qrCodeBase64Image,t.appendChild(r),t.appendChild(n);let s=document.getElementById("external-camera-continue");s.disabled=!0,this.applyStyles(s,{color:"#ccc",cursor:"not-allowed"})}renderPhotoStep(t){let r=document.createElement("p");r.id="photo-message",r.innerText="Clique no bot\xE3o abaixo para realizar a captura da foto do ambiente.",this.applyStyles(r,{textAlign:"center",color:"#555",marginBottom:"20px",fontSize:"14px",display:"-webkit-box",overflow:"hidden",textOverflow:"ellipsis"}),r.style.webkitLineClamp="3",r.style.webkitBoxOrient="vertical",t.appendChild(r);let n=document.createElement("div");n.id="photo-error-banner",n.innerText="Foto fora do padr\xE3o esperado.",this.applyStyles(n,{backgroundColor:"#FEE2E2",color:"#DC2626",padding:"12px 15px",borderRadius:"8px",textAlign:"center",fontSize:"12px",fontWeight:"400",marginBottom:"15px",display:"none"}),t.appendChild(n);let o=document.createElement("div");this.applyStyles(o,{backgroundColor:"#fff",borderRadius:"8px",padding:"20px",display:"flex",gap:"20px",alignItems:"flex-start",border:"1px solid #e5e5e5",marginBottom:"20px"});let i=document.createElement("div");if(i.id="photo-icon-container",this.applyStyles(i,{backgroundColor:"#f5f5f5",borderRadius:"8px",width:"120px",height:"160px",minWidth:"120px",minHeight:"160px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",overflow:"hidden"}),this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let f=document.createElement("img");f.id="img-photo";let y=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;f.src=y,this.applyStyles(f,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),i.appendChild(f)}else{let f=document.createElement("div");f.innerHTML=`
493
+ `,i=document.createElement("style");i.innerHTML=n,document.head.appendChild(i)}};var $t=class extends Error{constructor(t,r){let n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}},An=class extends Error{constructor(t="A timeout occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},ht=class extends Error{constructor(t="An abort occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},Ac=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}},Tc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}},Ic=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},is=class extends Error{constructor(t){let r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},Rc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}};var ro=class{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}},Mr=class{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}};var L;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(L||(L={}));var Ur=class{constructor(){}log(t,r){}};Ur.instance=new Ur;var u2="9.0.6";var Ee=class{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}},Ae=class e{static get isBrowser(){return!e.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!e.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!e.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function Tn(e,t){let r="";return Er(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${d3(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function d3(e){let t=new Uint8Array(e),r="";return t.forEach(n=>{let i=n<16?"0":"";r+=`0x${i}${n.toString(16)} `}),r.substr(0,r.length-1)}function Er(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Dc(e,t,r,n,i,o){let s={},[a,c]=Nr();s[a]=c,e.log(L.Trace,`(${t} transport) sending data. ${Tn(i,o.logMessageContent)}.`);let l=Er(i)?"arraybuffer":"text",h=await r.post(n,{content:i,headers:{...s,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});e.log(L.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}function d2(e){return e===void 0?new ei(L.Information):e===null?Ur.instance:e.log!==void 0?e:new ei(e)}var Pc=class{constructor(t,r){this._subject=t,this._observer=r}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}},ei=class{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){let n=`[${new Date().toISOString()}] ${L[t]}: ${r}`;switch(t){case L.Critical:case L.Error:this.out.error(n);break;case L.Warning:this.out.warn(n);break;case L.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function Nr(){let e="X-SignalR-User-Agent";return Ae.isNode&&(e="User-Agent"),[e,f3(u2,p3(),g3(),m3())]}function f3(e,t,r,n){let i="Microsoft SignalR/",o=e.split(".");return i+=`${o[0]}.${o[1]}`,i+=` (${e}; `,t&&t!==""?i+=`${t}; `:i+="Unknown OS; ",i+=`${r}`,n?i+=`; ${n}`:i+="; Unknown Runtime Version",i+=")",i}function p3(){if(Ae.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function m3(){if(Ae.isNode)return process.versions.node}function g3(){return Ae.isNode?"NodeJS":"Browser"}function Oc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function f2(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var Bc=class extends Mr{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Ae.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:hr;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(f2());if(typeof AbortController>"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:hr;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new ht;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");let r=new this._abortControllerType,n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new ht});let i=null;if(t.timeout){let c=t.timeout;i=setTimeout(()=>{r.abort(),this._logger.log(L.Warning,"Timeout from HTTP request."),n=new An},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},Er(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(L.Warning,`Error from HTTP request. ${c}.`),c)}finally{i&&clearTimeout(i),t.abortSignal&&(t.abortSignal.onabort=null)}if(!o.ok){let c=await p2(o,"text");throw new $t(c||o.statusText,o.status)}let a=await p2(o,t.responseType);return new ro(o.status,o.statusText,a)}getCookieString(t){let r="";return Ae.isNode&&this._jar&&this._jar.getCookies(t,(n,i)=>r=i.join("; ")),r}};function p2(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}var Lc=class extends Mr{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new ht):t.method?t.url?new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method,t.url,!0),i.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,i.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(Er(t.content)?i.setRequestHeader("Content-Type","application/octet-stream"):i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let o=t.headers;o&&Object.keys(o).forEach(s=>{i.setRequestHeader(s,o[s])}),t.responseType&&(i.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{i.abort(),n(new ht)}),t.timeout&&(i.timeout=t.timeout),i.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),i.status>=200&&i.status<300?r(new ro(i.status,i.statusText,i.response||i.responseText)):n(new $t(i.response||i.responseText||i.statusText,i.status))},i.onerror=()=>{this._logger.log(L.Warning,`Error from HTTP request. ${i.status}: ${i.statusText}.`),n(new $t(i.statusText,i.status))},i.ontimeout=()=>{this._logger.log(L.Warning,"Timeout from HTTP request."),n(new An)},i.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Fc=class extends Mr{constructor(t){if(super(),typeof fetch<"u"||Ae.isNode)this._httpClient=new Bc(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new Lc(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new ht):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}};var Gt=class e{static write(t){return`${t}${e.RecordSeparator}`}static parse(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");let r=t.split(e.RecordSeparator);return r.pop(),r}};Gt.RecordSeparatorCode=30;Gt.RecordSeparator=String.fromCharCode(Gt.RecordSeparatorCode);var Mc=class{writeHandshakeRequest(t){return Gt.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(Er(t)){let a=new Uint8Array(t),c=a.indexOf(Gt.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{let a=t,c=a.indexOf(Gt.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}let i=Gt.parse(r),o=JSON.parse(i[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}};var le;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})(le||(le={}));var Uc=class{constructor(){this.observers=[]}next(t){for(let r of this.observers)r.next(t)}error(t){for(let r of this.observers)r.error&&r.error(t)}complete(){for(let t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Pc(this,t)}};var Nc=class{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){let r=this._protocol.writeMessage(t),n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let i=()=>{},o=()=>{};Er(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((s,a)=>{i=s,o=a})),this._messages.push(new Ed(r,this._totalMessageCount,i,o))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){let i=this._messages[n];if(i._id<=t.sequenceId)r=n,Er(i._message)?this._bufferedByteCount-=i._message.byteLength:this._bufferedByteCount-=i._message.length,i._resolver();else if(this._bufferedByteCount<this._bufferSize)i._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==le.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;let r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){let t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:le.Sequence,sequenceId:t}));let r=this._messages;for(let n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(let r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case le.Invocation:case le.StreamItem:case le.Completion:case le.StreamInvocation:case le.CancelInvocation:return!0;case le.Close:case le.Sequence:case le.Ping:case le.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:le.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}},Ed=class{constructor(t,r,n,i){this._message=t,this._id=r,this._resolver=n,this._rejector=i}};var y3=30*1e3,b3=15*1e3,_3=1e5,ze;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(ze||(ze={}));var zc=class e{static create(t,r,n,i,o,s,a){return new e(t,r,n,i,o,s,a)}constructor(t,r,n,i,o,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(L.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Ee.isRequired(t,"connection"),Ee.isRequired(r,"logger"),Ee.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??y3,this.keepAliveIntervalInMilliseconds=s??b3,this._statefulReconnectBufferSize=a??_3,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=i,this._handshakeProtocol=new Mc,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=ze.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:le.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==ze.Disconnected&&this._connectionState!==ze.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==ze.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=ze.Connecting,this._logger.log(L.Debug,"Starting HubConnection.");try{await this._startInternal(),Ae.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=ze.Connected,this._connectionStarted=!0,this._logger.log(L.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=ze.Disconnected,this._logger.log(L.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);let n={protocol:this._protocol.name,version:r};if(this._logger.log(L.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(L.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Nc(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(L.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){let t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===ze.Disconnected)return this._logger.log(L.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===ze.Disconnecting)return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let r=this._connectionState;return this._connectionState=ze.Disconnecting,this._logger.log(L.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(L.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===ze.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new ht("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createStreamInvocation(t,r,i),s,a=new Uc;return a.cancelCallback=()=>{let c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===le.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,s),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._sendWithProtocol(this._createInvocation(t,r,!0,i));return this._launchStreams(n,o),o}invoke(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createInvocation(t,r,!1,i);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(h,u)=>{if(u){c(u);return}else h&&(h.type===le.Completion?h.error?c(new Error(h.error)):a(h.result):c(new Error(`Unexpected message type: ${h.type}`)))};let l=this._sendWithProtocol(o).catch(h=>{c(h),delete this._callbacks[o.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();let n=this._methods[t];if(n)if(r){let i=n.indexOf(r);i!==-1&&(n.splice(i,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let r=this._protocol.parseMessages(t,this._logger);for(let n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case le.Invocation:this._invokeClientMethod(n).catch(i=>{this._logger.log(L.Error,`Invoke client method threw error: ${Oc(i)}`)});break;case le.StreamItem:case le.Completion:{let i=this._callbacks[n.invocationId];if(i){n.type===le.Completion&&delete this._callbacks[n.invocationId];try{i(n)}catch(o){this._logger.log(L.Error,`Stream callback threw error: ${Oc(o)}`)}}break}case le.Ping:break;case le.Close:{this._logger.log(L.Information,"Close message received from server.");let i=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}case le.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case le.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(L.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(i){let o="Error parsing handshake response: "+i;this._logger.log(L.Error,o);let s=new Error(o);throw this._handshakeRejecter(s),s}if(r.error){let i="Server returned handshake error: "+r.error;this._logger.log(L.Error,i);let o=new Error(i);throw this._handshakeRejecter(o),o}else this._logger.log(L.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===ze.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){let r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(L.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(L.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}let i=n.slice(),o=!!t.invocationId,s,a,c;for(let l of i)try{let h=s;s=await l.apply(this,t.arguments),o&&s&&h&&(this._logger.log(L.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(h){a=h,this._logger.log(L.Error,`A callback for the method '${r}' threw error '${h}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(t.invocationId,null,s):(this._logger.log(L.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(L.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(L.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new ht("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===ze.Disconnecting?this._completeClose(t):this._connectionState===ze.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===ze.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=ze.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Ae.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(L.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){let r=Date.now(),n=0,i=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,i);if(o===null){this._logger.log(L.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=ze.Reconnecting,t?this._logger.log(L.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(L.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(L.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==ze.Reconnecting){this._logger.log(L.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(L.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==ze.Reconnecting){this._logger.log(L.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=ze.Connected,this._logger.log(L.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(L.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(L.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==ze.Reconnecting){this._logger.log(L.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===ze.Disconnecting&&this._completeClose();return}i=s instanceof Error?s:new Error(s.toString()),o=this._getNextRetryDelay(n++,Date.now()-r,i)}}this._logger.log(L.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(i){return this._logger.log(L.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${i}'.`),null}}_cancelCallbacksWithError(t){let r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{let i=r[n];try{i(null,t)}catch(o){this._logger.log(L.Error,`Stream 'error' callback called with '${t}' threw error: ${Oc(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,i){if(n)return i.length!==0?{target:t,arguments:r,streamIds:i,type:le.Invocation}:{target:t,arguments:r,type:le.Invocation};{let o=this._invocationId;return this._invocationId++,i.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:i,type:le.Invocation}:{target:t,arguments:r,invocationId:o.toString(),type:le.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(let n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:i=>{let o;i instanceof Error?o=i.message:i&&i.toString?o=i.toString():o="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:i=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,i)))}})}}_replaceStreamingParams(t){let r=[],n=[];for(let i=0;i<t.length;i++){let o=t[i];if(this._isObservable(o)){let s=this._invocationId;this._invocationId++,r[s]=o,n.push(s.toString()),t.splice(i,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){let i=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:i.toString(),streamIds:n,type:le.StreamInvocation}:{target:t,arguments:r,invocationId:i.toString(),type:le.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:le.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:le.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:le.Completion}:{invocationId:t,result:n,type:le.Completion}}_createCloseMessage(){return{type:le.Close}}};var v3=[0,2e3,1e4,3e4,null],os=class{constructor(t){this._retryDelays=t!==void 0?[...t,null]:v3}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}};var Cr=class{};Cr.Authorization="Authorization";Cr.Cookie="Cookie";var jc=class extends Mr{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);let n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Cr.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Cr.Authorization]&&delete t.headers[Cr.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}};var He;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(He||(He={}));var Ke;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(Ke||(Ke={}));var Vc=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var ss=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new Vc,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Ee.isRequired(t,"url"),Ee.isRequired(r,"transferFormat"),Ee.isIn(r,Ke,"transferFormat"),this._url=t,this._logger.log(L.Trace,"(LongPolling transport) Connecting."),r===Ke.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,i]=Nr(),o={[n]:i,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};r===Ke.Binary&&(s.responseType="arraybuffer");let a=`${t}&_=${Date.now()}`;this._logger.log(L.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(L.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new $t(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(t,r){try{for(;this._running;)try{let n=`${t}&_=${Date.now()}`;this._logger.log(L.Trace,`(LongPolling transport) polling: ${n}.`);let i=await this._httpClient.get(n,r);i.statusCode===204?(this._logger.log(L.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):i.statusCode!==200?(this._logger.log(L.Error,`(LongPolling transport) Unexpected response code: ${i.statusCode}.`),this._closeError=new $t(i.statusText||"",i.statusCode),this._running=!1):i.content?(this._logger.log(L.Trace,`(LongPolling transport) data received. ${Tn(i.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(i.content)):this._logger.log(L.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof An?this._logger.log(L.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(L.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(L.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Dc(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(L.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(L.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[r,n]=Nr();t[r]=n;let i={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},o;try{await this._httpClient.delete(this._url,i)}catch(s){o=s}o?o instanceof $t&&(o.statusCode===404?this._logger.log(L.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(L.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(L.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(L.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(L.Trace,t),this.onclose(this._closeError)}}};var Hc=class{constructor(t,r,n,i){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=i,this.onreceive=null,this.onclose=null}async connect(t,r){return Ee.isRequired(t,"url"),Ee.isRequired(r,"transferFormat"),Ee.isIn(r,Ke,"transferFormat"),this._logger.log(L.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,i)=>{let o=!1;if(r!==Ke.Text){i(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(Ae.isBrowser||Ae.isWebWorker)s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(t),c={};c.Cookie=a;let[l,h]=Nr();c[l]=h,s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(L.Trace,`(SSE transport) data received. ${Tn(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{o?this._close():i(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(L.Information,`SSE connected to ${this._url}`),this._eventSource=s,o=!0,n()}}catch(a){i(a);return}})}async send(t){return this._eventSource?Dc(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}};var Wc=class{constructor(t,r,n,i,o,s){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=i,this._webSocketConstructor=o,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=s}async connect(t,r){Ee.isRequired(t,"url"),Ee.isRequired(r,"transferFormat"),Ee.isIn(r,Ke,"transferFormat"),this._logger.log(L.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((i,o)=>{t=t.replace(/^http/,"ws");let s,a=this._httpClient.getCookieString(t),c=!1;if(Ae.isNode||Ae.isReactNative){let l={},[h,u]=Nr();l[h]=u,n&&(l[Cr.Authorization]=`Bearer ${n}`),a&&(l[Cr.Cookie]=a),s=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(t)),r===Ke.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(L.Information,`WebSocket connected to ${t}.`),this._webSocket=s,c=!0,i()},s.onerror=l=>{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="There was an error with the transport",this._logger.log(L.Information,`(WebSockets transport) ${h}.`)},s.onmessage=l=>{if(this._logger.log(L.Trace,`(WebSockets transport) data received. ${Tn(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(h){this._close(h);return}},s.onclose=l=>{if(c)this._close(l);else{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(h))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(L.Trace,`(WebSockets transport) sending data. ${Tn(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(L.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}};var m2=100,$c=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Ee.isRequired(t,"url"),this._logger=d2(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,i=null;if(Ae.isNode&&typeof hr<"u"){let o=typeof __webpack_require__=="function"?__non_webpack_require__:hr;n=o("ws"),i=o("eventsource")}!Ae.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Ae.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Ae.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Ae.isNode&&!r.EventSource&&typeof i<"u"&&(r.EventSource=i),this._httpClient=new jc(r.httpClient||new Fc(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||Ke.Binary,Ee.isIn(t,Ke,"transferFormat"),this._logger.log(L.Debug,`Starting connection with transfer format '${Ke[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){let r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(L.Error,r),await this._stopPromise,Promise.reject(new ht(r))}else if(this._connectionState!=="Connected"){let r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(L.Error,r),Promise.reject(new ht(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Cd(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(L.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(L.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===He.WebSockets)this.transport=this._constructTransport(He.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,i=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ht("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){let o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}i++}while(n.url&&i<m2);if(i===m2&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof ss&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(L.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(L.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){let r={},[n,i]=Nr();r[n]=i;let o=this._resolveNegotiateUrl(t);this._logger.log(L.Debug,`Sending negotiation request: ${o}.`);try{let s=await this._httpClient.post(o,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));let a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new is("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof $t&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(L.Error,a),Promise.reject(new is(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,i){let o=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(L.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(o,i),this.connectionId=n.connectionId;return}let s=[],a=n.availableTransports||[],c=n;for(let l of a){let h=this._resolveTransportOrError(l,r,i,c?.useStatefulReconnect===!0);if(h instanceof Error)s.push(`${l.transport} failed:`),s.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(t)}catch(u){return Promise.reject(u)}o=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(o,i),this.connectionId=c.connectionId;return}catch(u){if(this._logger.log(L.Error,`Failed to start the transport '${l.transport}': ${u}`),c=void 0,s.push(new Ic(`${l.transport} failed: ${u}`,He[l.transport])),this._connectionState!=="Connecting"){let m="Failed to select transport before stop() was called.";return this._logger.log(L.Debug,m),Promise.reject(new ht(m))}}}}return s.length>0?Promise.reject(new Rc(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case He.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Wc(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case He.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Hc(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case He.LongPolling:return new ss(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let i=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{i=!0}else{this._stopConnection(n);return}i&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,i){let o=He[t.transport];if(o==null)return this._logger.log(L.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(w3(r,o))if(t.transferFormats.map(a=>Ke[a]).indexOf(n)>=0){if(o===He.WebSockets&&!this._options.WebSocket||o===He.ServerSentEvents&&!this._options.EventSource)return this._logger.log(L.Debug,`Skipping transport '${He[o]}' because it is not supported in your environment.'`),new Ac(`'${He[o]}' is not supported in your environment.`,o);this._logger.log(L.Debug,`Selecting transport '${He[o]}'.`);try{return this.features.reconnect=o===He.WebSockets?i:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(L.Debug,`Skipping transport '${He[o]}' because it does not support the requested transfer format '${Ke[n]}'.`),new Error(`'${He[o]}' does not support ${Ke[n]}.`);else return this._logger.log(L.Debug,`Skipping transport '${He[o]}' because it was disabled by the client.`),new Tc(`'${He[o]}' is disabled by the client.`,o)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(L.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(L.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(L.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(L.Error,`Connection disconnected with error '${t}'.`):this._logger.log(L.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(L.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(L.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Ae.isBrowser)throw new Error(`Cannot resolve '${t}'.`);let r=window.document.createElement("a");return r.href=t,this._logger.log(L.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){let r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";let n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}};function w3(e,t){return!e||(t&e)!==0}var Cd=class e{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new no,this._transportResult=new no,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new no),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new no;let t=this._transportResult;this._transportResult=void 0;let r=typeof this._buffer[0]=="string"?this._buffer.join(""):e._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){let r=t.map(o=>o.byteLength).reduce((o,s)=>o+s),n=new Uint8Array(r),i=0;for(let o of t)n.set(new Uint8Array(o),i),i+=o.byteLength;return n.buffer}},no=class{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}};var S3="json",Gc=class{constructor(){this.name=S3,this.version=2,this.transferFormat=Ke.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Ur.instance);let n=Gt.parse(t),i=[];for(let o of n){let s=JSON.parse(o);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case le.Invocation:this._isInvocationMessage(s);break;case le.StreamItem:this._isStreamItemMessage(s);break;case le.Completion:this._isCompletionMessage(s);break;case le.Ping:break;case le.Close:break;case le.Ack:this._isAckMessage(s);break;case le.Sequence:this._isSequenceMessage(s);break;default:r.log(L.Information,"Unknown message type '"+s.type+"' ignored.");continue}i.push(s)}return i}writeMessage(t){return Gt.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}};var k3={trace:L.Trace,debug:L.Debug,info:L.Information,information:L.Information,warn:L.Warning,warning:L.Warning,error:L.Error,critical:L.Critical,none:L.None};function E3(e){let t=k3[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}var as=class{configureLogging(t){if(Ee.isRequired(t,"logging"),C3(t))this.logger=t;else if(typeof t=="string"){let r=E3(t);this.logger=new ei(r)}else this.logger=new ei(t);return this}withUrl(t,r){return Ee.isRequired(t,"url"),Ee.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Ee.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new os(t):this.reconnectPolicy=t:this.reconnectPolicy=new os,this}withServerTimeout(t){return Ee.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Ee.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){let t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let r=new $c(this.url,t);return zc.create(r,this.logger||Ur.instance,this.protocol||new Gc,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function C3(e){return e.log!==void 0}var gy=hl(my());var gs=class{},yy=(s=>(s[s.WAITING=-1]="WAITING",s[s.STARTED=0]="STARTED",s[s.QR_CODE=1]="QR_CODE",s[s.POSITION=2]="POSITION",s[s.FINISHED=3]="FINISHED",s[s.ERROR=9]="ERROR",s))(yy||{}),il=class e{constructor(t,r){this.proctoringId="";this.capturePhotoUrl="";this.qrCodeBase64Image="";this.transmissionOk=!1;this.waitingPositionValidation=!1;this.externalSessionId=null;this.currentStep=0;this.connection=null;this.context=t,this.onRealtimeAlertsCallback=r,console.log("context -> ",t),this.backend=new tr({type:t?.type||"prod",token:t.token}),this.currentStep=-1}static{this.isModalOpen=!1}getExternalCameraSessionId(){return""+this.externalSessionId}async checkTransmission(){try{this.transmissionOk=!1;let t=await this.backend.externalCameraCheckTransmission(""+this.externalSessionId);console.log(t);let r=0;for(;!this.transmissionOk&&r<=5;)await new Promise(n=>setTimeout(n,2e3)),r=r+1;if(!this.transmissionOk)throw new Error("Timed out na checagem da transmiss\xE3o!")}catch(t){throw console.error("Erro ao checar a transmiss\xE3o:",t),new Error("N\xE3o foi poss\xEDvel checar a transmiss\xE3o."+t)}}async startTransmission(t){try{this.proctoringId=t;let r=await this.backend.externalCameraStartTransmission(""+this.externalSessionId,t);console.log(r)}catch(r){throw console.error("Erro ao iniciar transmiss\xE3o:",r),new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.")}}async goToPositionGuide(){try{let t=await this.backend.goToExternalCameraPositionStep(""+this.externalSessionId);console.log(t)}catch(t){throw console.error("Erro ao enviar comando de Position:",t),new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.")}}async reset(){if(this.connection){let t=new gs;t.command="Reset",console.log("Enviando comando 'Reset' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,t)}}async takePicture(t,r){if(this.connection){this.waitingPositionValidation=t,this.onTakePictureCallback=r;let n=new gs;n.command="Capture",console.log("Enviando comando 'Capture' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,n)}else throw new Error("N\xE3o existe conex\xE3o de camera externa ativa.")}async startSession(t){try{this.onQrCodeReadedCallback=t,this.connection&&await this.disconnectWebSocket(),await this.initializeWebSocketConnection(),await this.reset();let r=await this.backend.externalCameraStartSession();this.externalSessionId=r.externalSessionId,console.log(this.externalSessionId),this.currentStep=0;let n={externalSessionId:this.externalSessionId,token:this.context.token,ambient:this.context.type},i=JSON.stringify(n);return this.qrCodeBase64Image=await gy.default.toDataURL(i),console.log(this.qrCodeBase64Image),this.qrCodeBase64Image}catch(r){return this.disconnectWebSocket(),Promise.reject(r)}}async checkExternalCamera(){if(this.currentStep=0,e.isModalOpen)return Promise.reject("O modal de verifica\xE7\xE3o j\xE1 est\xE1 aberto.");e.isModalOpen=!0;try{return await this.startSession(()=>{}),await this.buildInterface()}catch(t){return console.error("Erro ao iniciar verifica\xE7\xE3o:",t),this.closeCheckExternalCamera(),Promise.reject(t)}}buildInterface(){return new Promise((t,r)=>{this.resolvePromise=t;let n=document.createElement("div");n.setAttribute("id","externalCameraCheck"),this.applyStyles(n,{backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"});let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",zIndex:"1001",width:"500px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"});let o=document.createElement("h3");o.innerText="Conectar dispositivo m\xF3vel",this.applyStyles(o,{color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"});let s=document.createElement("div");s.id="external-camera-content",this.applyStyles(s,{width:"100%",padding:"20px 40px",boxSizing:"border-box",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"});let a=document.createElement("div");this.applyStyles(a,{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"});let c=document.createElement("button");c.innerText="Cancelar",this.applyStyles(c,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 0 10px",cursor:"pointer"}),c.addEventListener("click",()=>{let h=new gs;h.command="Cancel",console.log("Enviando comando 'Cancel' para o aplicativo..."),this.connection?.invoke("SendAction",this.externalSessionId,h),this.closeCheckExternalCamera(),t({result:!1})});let l=document.createElement("button");l.innerText="Continuar",l.id="external-camera-continue",this.applyStyles(l,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),a.appendChild(c),a.appendChild(l),i.appendChild(o),i.appendChild(s),i.appendChild(a),n.appendChild(i),document.body.appendChild(n),this.renderCurrentStep()})}renderCurrentStep(){let t=document.getElementById("external-camera-content");if(t)switch(t.innerHTML="",this.currentStep){case 0:this.renderQRCodeStep(t);break;case 1:this.renderPhotoStep(t);break;case 2:this.renderImageStep(t);break;default:break}}renderQRCodeStep(t){let r=document.createElement("canvas");r.id="qr-code-canvas";let n=document.createElement("p");n.innerText="Aponte a c\xE2mera do seu celular para o QR Code para iniciar a verifica\xE7\xE3o do ambiente.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"});let i=r.getContext("2d"),o=new Image;o.onload=()=>{let c=250/o.width,l=o.height*c;r.width=250,r.height=l,i&&i.drawImage(o,0,0,250,l)},o.src=this.qrCodeBase64Image,t.appendChild(r),t.appendChild(n);let s=document.getElementById("external-camera-continue");s.disabled=!0,this.applyStyles(s,{color:"#ccc",cursor:"not-allowed"})}renderPhotoStep(t){let r=document.createElement("p");r.id="photo-message",r.innerText="Clique no bot\xE3o abaixo para realizar a captura da foto do ambiente.",this.applyStyles(r,{textAlign:"center",color:"#555",marginBottom:"20px",fontSize:"14px",display:"-webkit-box",overflow:"hidden",textOverflow:"ellipsis"}),r.style.webkitLineClamp="3",r.style.webkitBoxOrient="vertical",t.appendChild(r);let n=document.createElement("div");n.id="photo-error-banner",n.innerText="Foto fora do padr\xE3o esperado.",this.applyStyles(n,{backgroundColor:"#FEE2E2",color:"#DC2626",padding:"12px 15px",borderRadius:"8px",textAlign:"center",fontSize:"12px",fontWeight:"400",marginBottom:"15px",display:"none"}),t.appendChild(n);let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",borderRadius:"8px",padding:"20px",display:"flex",gap:"20px",alignItems:"flex-start",border:"1px solid #e5e5e5",marginBottom:"20px"});let o=document.createElement("div");if(o.id="photo-icon-container",this.applyStyles(o,{backgroundColor:"#f5f5f5",borderRadius:"8px",width:"120px",height:"160px",minWidth:"120px",minHeight:"160px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",overflow:"hidden"}),this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let f=document.createElement("img");f.id="img-photo";let b=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;f.src=b,this.applyStyles(f,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(f)}else{let f=document.createElement("div");f.innerHTML=`
490
494
  <svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
491
495
  <path d="M23 19C23 19.5304 22.7893 20.0391 22.4142 20.4142C22.0391 20.7893 21.5304 21 21 21H3C2.46957 21 1.96086 20.7893 1.58579 20.4142C1.21071 20.0391 1 19.5304 1 19V8C1 7.46957 1.21071 6.96086 1.58579 6.58579C1.96086 6.21071 2.46957 6 3 6H7L9 4H15L17 6H21C21.5304 6 22.0391 6.21071 22.4142 6.58579C22.7893 6.96086 23 7.46957 23 8V19Z" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
492
496
  <path d="M12 17C14.2091 17 16 15.2091 16 13C16 10.7909 14.2091 9 12 9C9.79086 9 8 10.7909 8 13C8 15.2091 9.79086 17 12 17Z" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
493
497
  </svg>
494
- `,i.appendChild(f)}o.appendChild(i);let s=document.createElement("div");this.applyStyles(s,{flex:"1",display:"flex",flexDirection:"column",gap:"15px"});let a=document.createElement("h4");a.innerText="Capture uma foto n\xEDtida",this.applyStyles(a,{margin:"0",fontSize:"16px",fontWeight:"bold",color:"#333"}),s.appendChild(a);let c=document.createElement("div");this.applyStyles(c,{display:"flex",flexDirection:"column",gap:"10px"}),["Boa ilumina\xE7\xE3o e sem reflexos","Mostre a mesa, cadeira e ambiente","Evite pessoas ao fundo"].forEach(f=>{let y=document.createElement("div");this.applyStyles(y,{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#555"});let v=document.createElement("span");v.innerHTML=`
498
+ `,o.appendChild(f)}i.appendChild(o);let s=document.createElement("div");this.applyStyles(s,{flex:"1",display:"flex",flexDirection:"column",gap:"15px"});let a=document.createElement("h4");a.innerText="Capture uma foto n\xEDtida",this.applyStyles(a,{margin:"0",fontSize:"16px",fontWeight:"bold",color:"#333"}),s.appendChild(a);let c=document.createElement("div");this.applyStyles(c,{display:"flex",flexDirection:"column",gap:"10px"}),["Boa ilumina\xE7\xE3o e sem reflexos","Mostre a mesa, cadeira e ambiente","Evite pessoas ao fundo"].forEach(f=>{let b=document.createElement("div");this.applyStyles(b,{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#555"});let _=document.createElement("span");_.innerHTML=`
495
499
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
496
500
  <circle cx="10" cy="10" r="9" stroke="#16A34A" stroke-width="2" fill="none"/>
497
501
  <path d="M6 10L9 13L14 7" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
498
502
  </svg>
499
- `,this.applyStyles(v,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let _=document.createElement("span");_.innerText=f,y.appendChild(v),y.appendChild(_),c.appendChild(y)}),s.appendChild(c);let h=document.createElement("button");h.innerText="Capturar foto",h.id="position-capture-button",this.applyStyles(h,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),h.onclick=()=>{if(this.connection){let f=document.getElementById("photo-message");f&&(f.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),h.disabled=!0,this.applyStyles(h,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(h),o.appendChild(s),t.appendChild(o);let d=document.createElement("div");this.applyStyles(d,{marginTop:"10px",fontSize:"13px",color:"#666"});let u=document.createElement("span");u.innerText="Dica: ",u.style.fontWeight="bold";let b=document.createElement("span");b.innerText="mantenha o celular est\xE1vel durante todo o processo.",d.appendChild(u),d.appendChild(b),t.appendChild(d);let m=document.getElementById("external-camera-continue");m.disabled=!0,this.applyStyles(m,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let o=document.getElementById("external-camera-continue");o.disabled=!1,o.innerText="Concluir",this.applyStyles(o,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),o.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new Ii().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:ie.WebSockets,withCredentials:!1}).withAutomaticReconnect().configureLogging(g.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(console.log("sessionId: ",r),console.log("Message: ",n),r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let i=ey[n];console.log("Mensagem -> ",i),this.handleWebSocketMessage(i)}catch(o){console.error("Erro ao processar mensagem do WebSocket:",o)}}),this.connection.on("ReceiveAction",(r,n)=>{if(console.log("sessionId: ",r),console.log("Message: ",n),r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(o){console.error("Erro ao processar mensagem do WebSocket:",o)}});try{await this.connection.start(),console.log("Conectado ao Hub SignalR com sucesso!")}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),o=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),o&&(o.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let i=document.getElementById("photo-icon-container");if(i&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(i.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),i.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop(),console.log("Desconectado do SignalR.")}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){e.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}};var Mc=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onFocusCallback=()=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=t=>{};this.onBufferSizeErrorCallback=t=>{};this.backend=new ft({type:t.type||"prod",token:t.token}),this.repository=new Ei("EasyProctorDb","exams2"),this.repositoryDevices=new Ei("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new rc(this.context.credentials.cpf,this.backend)),this.appChecker=new Bc(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{U.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:34,type:3}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusCallback(t){this.onLostFocusCallback=()=>t()}setOnFocusCallback(t){this.onFocusCallback=()=>t()}async onChangeDevices(t={}){new ga(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return 1;case"multiple_faces_detected":return 2;case"multiple_persons_detected":return 28;case"no_person_detected":return 29;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return 0;case"person_detection_on_stream":return 1;default:return null}}async onRealtimeAlerts(t={}){this.onRealtimeAlertsCallback=async r=>{t.data&&t.data(r),this.sessionOptions.proctoringType==="REALTIME"&&(r.type==="face_detection_on_stream"||r.type==="person_detection_on_stream")&&(r.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,alert:this.convertRealtimeCategoryToAlertCategory(r.category)}):r.status==="OK"&&await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(r.type),alertImageBase64:await this.allRecorders.cameraRecorder.getCurrentImageBase64()}))}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}createRecorders(t=mt){this.onChangeDevices();let r=new sr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new tc({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,o=new ba({onFocusCallback:()=>this.onFocusCallback(),onLostFocusCallback:()=>this.onLostFocusCallback()},t),i=new ec(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,n,o].filter(Boolean);return s.push(i),this.recorder=new ya(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:o,noiseRecorder:i}}async login(){if(!this.context.credentials?.cpf)throw Fg;this.context.token=await this.auth.login()}async start(t=mt,r={}){try{if(this.context.token===void 0)throw Lg;this.extension=new ma,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),o=await St();await this.repositoryDevices.save({...o,id:"devices"}),this.sessionOptions={...mt,...t},this.videoOptions=aa(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw Ug}if(this.state!="Stop")throw Dg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Yr,this.allRecorders=this.createRecorders(this.sessionOptions);let i=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=i.id,U.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(o)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw Ng}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId),await this.recorder.startAll(),t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let a in navigator)s[a]=navigator[a];return U.registerStart(this.proctoringId,!0,`Version: ${Ci()}
500
- Navigator: ${JSON.stringify(s)}`),i.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(i.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording",setTimeout(async()=>{this.sessionOptions.proctoringType==="REALTIME"&&await this.backend.verifyFace(this.proctoringId,await this.allRecorders.cameraRecorder.getCurrentImageBase64())},1e3),i}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&U.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
501
- Version: ${Ci()}
503
+ `,this.applyStyles(_,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let k=document.createElement("span");k.innerText=f,b.appendChild(_),b.appendChild(k),c.appendChild(b)}),s.appendChild(c);let h=document.createElement("button");h.innerText="Capturar foto",h.id="position-capture-button",this.applyStyles(h,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),h.onclick=()=>{if(this.connection){let f=document.getElementById("photo-message");f&&(f.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),h.disabled=!0,this.applyStyles(h,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(h),i.appendChild(s),t.appendChild(i);let u=document.createElement("div");this.applyStyles(u,{marginTop:"10px",fontSize:"13px",color:"#666"});let m=document.createElement("span");m.innerText="Dica: ",m.style.fontWeight="bold";let p=document.createElement("span");p.innerText="mantenha o celular est\xE1vel durante todo o processo.",u.appendChild(m),u.appendChild(p),t.appendChild(u);let g=document.getElementById("external-camera-continue");g.disabled=!0,this.applyStyles(g,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let i=document.getElementById("external-camera-continue");i.disabled=!1,i.innerText="Concluir",this.applyStyles(i,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),i.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new as().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:He.WebSockets,withCredentials:!1}).withAutomaticReconnect().configureLogging(L.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(console.log("sessionId: ",r),console.log("Message: ",n),r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let o=yy[n];console.log("Mensagem -> ",o),this.handleWebSocketMessage(o)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}}),this.connection.on("ReceiveAction",(r,n)=>{if(console.log("sessionId: ",r),console.log("Message: ",n),r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}});try{await this.connection.start(),console.log("Conectado ao Hub SignalR com sucesso!")}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),i=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),i&&(i.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let o=document.getElementById("photo-icon-container");if(o&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(o.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop(),console.log("Desconectado do SignalR.")}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){e.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}};var ol=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1,realtimePackageSize:20,realtimeUploadInterval:30}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onLostFocusAlertRecorderCallback=t=>{};this.onFocusCallback=()=>{};this.onFocusAlertRecorderCallback=t=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=t=>{};this.onBufferSizeErrorCallback=t=>{};this.backend=new tr({type:t.type||"prod",token:t.token}),this.repository=new rs("EasyProctorDb","exams2"),this.repositoryDevices=new rs("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new xc(this.context.credentials.cpf,this.backend)),this.appChecker=new il(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{ge.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:34,type:3}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusAlertRecorderCallback(){this.onLostFocusAlertRecorderCallback=async t=>{this.onLostFocusCallback&&this.onLostFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"lost_focus",category:"lost_focus",description:"Perda de foco no exame",begin:t.begin,end:t.end,alert:25,status:"ALERT"})}}setOnFocusAlertRecorderCallback(){this.onFocusAlertRecorderCallback=async t=>{this.onFocusCallback&&this.onFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"focus",category:"focus",description:"Retorno de foco no exame",begin:t.begin,end:t.end,alert:25,status:"OK"})}}async setOnLostFocusCallback(t){this.onLostFocusCallback=async()=>await t(),this.setOnLostFocusAlertRecorderCallback()}async setOnFocusCallback(t){this.onFocusCallback=async()=>await t(),this.setOnFocusAlertRecorderCallback()}async onChangeDevices(t={}){new za(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return 1;case"multiple_faces_detected":return 2;case"multiple_persons_detected":return 28;case"no_person_detected":return 29;case"lost_focus":return 25;case"focus":return 25;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return 0;case"person_detection_on_stream":return 1;case"lost_focus":return 2;case"focus":return 2;default:return null}}async onRealtimeAlerts(t={}){this.setOnLostFocusAlertRecorderCallback(),this.setOnFocusAlertRecorderCallback(),this.onRealtimeAlertsCallback=async r=>{t.data&&t.data(r),this.sessionOptions.proctoringType==="REALTIME"&&(r.type==="face_detection_on_stream"||r.type==="person_detection_on_stream"||r.type==="lost_focus"||r.type==="focus")&&(r.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,alert:this.convertRealtimeCategoryToAlertCategory(r.category)}):r.status==="OK"&&await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(r.type),alertImageBase64:await this.allRecorders.cameraRecorder.getCurrentImageBase64()}))}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}createRecorders(t=rr){this.onChangeDevices();let r=new Yr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new Cc({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,i=new Va({onFocusCallback:a=>this.onFocusAlertRecorderCallback(a),onLostFocusCallback:a=>this.onLostFocusAlertRecorderCallback(a)},t),o=new Ec(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,n,i].filter(Boolean);return s.push(o),this.recorder=new ja(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:i,noiseRecorder:o}}async login(){if(!this.context.credentials?.cpf)throw Yg;this.context.token=await this.auth.login()}async start(t=rr,r={}){try{if(this.context.token===void 0)throw Jg;this.extension=new Na,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),i=await ur();await this.repositoryDevices.save({...i,id:"devices"}),this.sessionOptions={...rr,...t},this.videoOptions=Pa(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw Zg}if(this.state!="Stop")throw Gg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Hn,this.allRecorders=this.createRecorders(this.sessionOptions);let o=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=o.id,ge.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(i)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw Qg}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId),await this.recorder.startAll(),t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let a in navigator)s[a]=navigator[a];return ge.registerStart(this.proctoringId,!0,`Version: ${ns()}
504
+ Navigator: ${JSON.stringify(s)}`),o.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(o.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording",setTimeout(async()=>{this.sessionOptions.proctoringType==="REALTIME"&&await this.backend.verifyFace(this.proctoringId,await this.allRecorders.cameraRecorder.getCurrentImageBase64())},1e3),o}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&ge.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
505
+ Version: ${ns()}
502
506
  Navigator: ${navigator}
503
- Error: ${n}`),this.state="Stop",n}}async cancel(){(this.state==="Recording"||this.state==="Starting")&&(await this.recorder.stopAll(),this.spyCam&&await this.spyCam.stopCheckSpyCam()),this.state="Stop"}async finish(t={}){try{if(this.extension.options=t,this.state!=="Recording")throw da;await this.recorder.stopAll(),this.spyCam&&this.spyCam.stopCheckSpyCam(),this.appChecker&&await this.appChecker.disconnectWebSocket(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession);let r,n;Ci()!=="1.0.0.0"?(r=new io(this.proctoringSession,this.proctoringId,[new oo(this.proctoringId)]),n="Download",this.serviceType="Download"):(r=new io(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new oo(this.proctoringId)]),n="Upload",this.serviceType="Upload");let o=!1;if(this.extension.hasExtension&&await this.extension.start().then(i=>{o=i}).catch(i=>{o=!1}),(!o||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async i=>{U.registerUpload(this.proctoringSession.id,!1,`upload error: ${i}
507
+ Error: ${n}`),this.state="Stop",n}}async cancel(){(this.state==="Recording"||this.state==="Starting")&&(await this.recorder.stopAll(),this.spyCam&&await this.spyCam.stopCheckSpyCam()),this.state="Stop"}async finish(t={}){try{if(this.extension.options=t,this.state!=="Recording")throw La;await this.recorder.stopAll(),this.spyCam&&this.spyCam.stopCheckSpyCam(),this.appChecker&&await this.appChecker.disconnectWebSocket(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession);let r,n;ns()!=="1.0.0.0"?(r=new Wi(this.proctoringSession,this.proctoringId,[new Hi(this.proctoringId)]),n="Download",this.serviceType="Download"):(r=new Wi(this.proctoringSession,this.proctoringId,[new Jr(this.proctoringId,this.backend),new Hi(this.proctoringId)]),n="Upload",this.serviceType="Upload");let i=!1;if(this.extension.hasExtension&&await this.extension.start().then(o=>{i=o}).catch(o=>{i=!1}),(!i||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async o=>{ge.registerUpload(this.proctoringSession.id,!1,`upload error: ${o}
504
508
 
505
- Upload Services: ${n}`,this.serviceType),Ci()!=="1.0.0.0"&&(r=new io(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new oo(this.proctoringId)]),n="Upload",this.serviceType="Upload",n="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{U.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
509
+ Upload Services: ${n}`,this.serviceType),ns()!=="1.0.0.0"&&(r=new Wi(this.proctoringSession,this.proctoringId,[new Jr(this.proctoringId,this.backend),new Hi(this.proctoringId)]),n="Upload",this.serviceType="Upload",n="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{ge.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
506
510
 
507
511
  Upload Services: ${n}
508
- Upload backup for Safe Browser`,this.serviceType)}))}),U.registerUpload(this.proctoringSession.id,!0,`upload success
512
+ Upload backup for Safe Browser`,this.serviceType)}))}),ge.registerUpload(this.proctoringSession.id,!0,`upload success
513
+
514
+ Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(o=>{ge.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+o)}),await this.backend.finishAndSendUrls(this.context).then(o=>{ge.registerFinish(this.proctoringSession.id,!0,""),console.log("finishResponse: ",o),t.onResultAvailable&&t.onResultAvailable(o?.score??100,o?.scoreThreshold??70,o?.approved??!0,o?.justification??"")}).catch(o=>{ge.registerFinish(this.proctoringSession.id,!1,"finish error: "+o)}),this.appChecker){let o=this.appChecker.getExternalCameraSessionId();o!="null"&&await this.backend.externalCameraFinish(o)}this.state="Stop"}catch(r){throw await this.cancel(),ge.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
515
+ Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await bs())throw ge.registerError(this.proctoringId,"Multiplas telas detectadas!"),Ba}async verifyBrowser(){let t=await Vg();if(t!=="chrome"&&t!=="firefox"&&!yn())throw ge.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
516
+ Tentativa utilizando o browser ${t}`),Xg}async initConfig(t){try{let r=await this.backend.getParamsConfig(this.context);this.paramsConfig={...this.paramsConfig,...r,audioBehaviourParameters:{...this.paramsConfig.audioBehaviourParameters,...r.audioBehaviourParameters},imageBehaviourParameters:{...this.paramsConfig.imageBehaviourParameters,...r.imageBehaviourParameters},videoBehaviourParameters:{...this.paramsConfig.videoBehaviourParameters,...r.videoBehaviourParameters}},t&&(this.geolocation=await h2().then(n=>n).catch(n=>{throw n.message})),Hg(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new ji(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)}))}catch(r){throw this.proctoringId&&ge.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{ge.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel requisitar a data do servidor!")});return t?new Date(t.toString()):new Date}async pause(){if(this.state!=="Recording")throw ge.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),La;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw La;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state="Recording",{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}};var sl=class e{static{this.isModalOpen=!1}constructor(t){this.backend=new tr({type:t?.type||"prod",token:t.token})}async signInTerms(){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0;try{let t=await this.openModal();return new Promise(r=>{r(t)})}catch(t){return this.closeModal(),Promise.reject(t)}}openModal(){return new Promise((t,r)=>{let n=document.createElement("div");n.setAttribute("id","signTermModal");let i={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(n,i);let o=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,s);let a=document.createElement("h3");a.innerText="Termo de consentimento para coleta e uso de dados";let c={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(a,c),o.appendChild(a);let l=document.createElement("iframe"),h="https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";this.backend.signTermUrl().then(N=>{if(!N)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",N)}).catch(()=>{l.setAttribute("src",h)});let u={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,u),o.appendChild(l);let m=document.createElement("div"),p=document.createElement("input");p.setAttribute("type","checkbox"),p.setAttribute("id","termsCheckbox");let g=document.createElement("label");g.setAttribute("for","termsCheckbox"),g.innerText="Li e aceito os termos e condi\xE7\xF5es";let f={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(m,f),m.appendChild(p),m.appendChild(g),o.appendChild(m);let b=document.createElement("div"),_={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(b,_);let k=document.createElement("button");k.innerText="Cancelar";let S={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(k,S),k.addEventListener("click",()=>{this.closeModal(),t(!1)});let R=document.createElement("span"),x={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(R,x);let D=document.createElement("button");D.innerText="Continuar",D.setAttribute("id","confirmBtn");let P={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px",disabled:!0,cursor:"not-allowed"};this.applyStyles(D,P),D.disabled=!0,D.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),p.addEventListener("change",N=>{D.disabled=!N.target.checked,N.target.checked?(D.style.color="#007bff",D.style.cursor="pointer"):(D.style.color="rgba(0, 0, 0, .7)",D.style.cursor="not-allowed")}),b.appendChild(k),b.appendChild(R),b.appendChild(D),o.appendChild(b),n.appendChild(o),document.body.appendChild(n)})}async closeModal(){e.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}};function Xd(e,t="prod"){e.showConsole||(console.log=()=>{},console.warn=()=>{},console.error=()=>{});let r={type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole},n=new ol(r),i=new Ua(r),o=new sl(r),s=new Vi,a=n.login.bind(n),c=n.start.bind(n),l=async U=>{let se=i.getDeviceCheckResult();return se&&n.setDeviceCheckData(se),c(U)},h=n.finish.bind(n),u=n.pause.bind(n),m=n.resume.bind(n),p=n.setOnFocusCallback.bind(n),g=n.setOnLostFocusCallback.bind(n),f=n.onChangeDevices.bind(n),b=n.setOnBufferSizeErrorCallback.bind(n),_=n.setOnStopSharingScreenCallback.bind(n),k=n.onRealtimeAlerts.bind(n),S=o.signInTerms.bind(o),R=i.checkDevices.bind(i),x=n.appChecker.checkExternalCamera.bind(n.appChecker),D=n.appChecker.startSession.bind(n.appChecker),P=n.appChecker.takePicture.bind(n.appChecker),N=n.appChecker.goToPositionGuide.bind(n.appChecker),Z=n.appChecker.startTransmission.bind(n.appChecker),E=i.runCheckDevicesFlow.bind(i),F=i.changeSelectedDevice.bind(i),y=s.takePicture.bind(s);return{login:a,start:l,finish:h,onFocus:p,onLostFocus:g,onChangeDevices:f,onBufferSizeError:b,onRealtimeAlerts:k,checkDevices:R,runCheckDevicesFlow:E,changeSelectedDevice:F,capturePhoto:y,enumarateDevices:ur,checkPermissions:ys,checkIfhasMultipleMonitors:bs,onStopSharingScreen:_,signInTerms:S,checkExternalCamera:x,startExternalCameraSession:D,takeExternalCameraPicture:P,goToExternalCameraPositionStep:N,startExternalCameraTransmission:Z}}typeof window<"u"&&(window.useProctoring=Xd);})();
517
+ /*! Bundled license information:
509
518
 
510
- Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(i=>{U.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+i)}),await this.backend.finishAndSendUrls(this.context).then(i=>{U.registerFinish(this.proctoringSession.id,!0,""),console.log("finishResponse: ",i),t.onFinish&&t.onFinish(i?.score??100,i?.scoreThreshold??70,i?.approved??!0,i?.justification??"")}).catch(i=>{U.registerFinish(this.proctoringSession.id,!1,"finish error: "+i)}),this.appChecker){let i=this.appChecker.getExternalCameraSessionId();i!="null"&&await this.backend.externalCameraFinish(i)}this.state="Stop"}catch(r){throw await this.cancel(),U.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
511
- Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Ki())throw U.registerError(this.proctoringId,"Multiplas telas detectadas!"),ha}async verifyBrowser(){let t=await Tg();if(t!=="chrome"&&t!=="firefox"&&!Er())throw U.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
512
- Tentativa utilizando o browser ${t}`),Mg}async initConfig(t){try{let r=await this.backend.getParamsConfig(this.context);this.paramsConfig={...this.paramsConfig,...r,audioBehaviourParameters:{...this.paramsConfig.audioBehaviourParameters,...r.audioBehaviourParameters},imageBehaviourParameters:{...this.paramsConfig.imageBehaviourParameters,...r.imageBehaviourParameters},videoBehaviourParameters:{...this.paramsConfig.videoBehaviourParameters,...r.videoBehaviourParameters}},t&&(this.geolocation=await G0().then(n=>n).catch(n=>{throw n.message})),Ig(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new ro(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)}))}catch(r){throw this.proctoringId&&U.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{U.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel requisitar a data do servidor!")});return t?new Date(t.toString()):new Date}async pause(){if(this.state!=="Recording")throw U.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),da;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw da;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state="Recording",{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}};var Lc=class e{static{this.isModalOpen=!1}constructor(t){this.backend=new ft({type:t?.type||"prod",token:t.token})}async signInTerms(){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0;try{let t=await this.openModal();return new Promise(r=>{r(t)})}catch(t){return this.closeModal(),Promise.reject(t)}}openModal(){return new Promise((t,r)=>{let n=document.createElement("div");n.setAttribute("id","signTermModal");let o={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(n,o);let i=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(i,s);let a=document.createElement("h3");a.innerText="Termo de consentimento para coleta e uso de dados";let c={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(a,c),i.appendChild(a);let l=document.createElement("iframe"),h="https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";this.backend.signTermUrl().then(se=>{if(!se)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",se)}).catch(()=>{l.setAttribute("src",h)});let d={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,d),i.appendChild(l);let u=document.createElement("div"),b=document.createElement("input");b.setAttribute("type","checkbox"),b.setAttribute("id","termsCheckbox");let m=document.createElement("label");m.setAttribute("for","termsCheckbox"),m.innerText="Li e aceito os termos e condi\xE7\xF5es";let f={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(u,f),u.appendChild(b),u.appendChild(m),i.appendChild(u);let y=document.createElement("div"),v={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(y,v);let _=document.createElement("button");_.innerText="Cancelar";let x={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(_,x),_.addEventListener("click",()=>{this.closeModal(),t(!1)});let B=document.createElement("span"),O={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(B,O);let R=document.createElement("button");R.innerText="Continuar",R.setAttribute("id","confirmBtn");let ue={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px",disabled:!0,cursor:"not-allowed"};this.applyStyles(R,ue),R.disabled=!0,R.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),b.addEventListener("change",se=>{R.disabled=!se.target.checked,se.target.checked?(R.style.color="#007bff",R.style.cursor="pointer"):(R.style.color="rgba(0, 0, 0, .7)",R.style.cursor="not-allowed")}),y.appendChild(_),y.appendChild(B),y.appendChild(R),i.appendChild(y),n.appendChild(i),document.body.appendChild(n)})}async closeModal(){e.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[n,o]of Object.entries(r))t.style[n]=o}};function ku(e,t="prod"){e.showConsole||(console.log=()=>{},console.warn=()=>{},console.error=()=>{});let r={type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole},n=new Mc(r),o=new fa(r),i=new Lc(r),s=new no,a=n.login.bind(n),c=n.start.bind(n),l=async mn=>{let Co=o.getDeviceCheckResult();return Co&&n.setDeviceCheckData(Co),c(mn)},h=n.finish.bind(n),d=n.pause.bind(n),u=n.resume.bind(n),b=n.setOnFocusCallback.bind(n),m=n.setOnLostFocusCallback.bind(n),f=n.onChangeDevices.bind(n),y=n.setOnBufferSizeErrorCallback.bind(n),v=n.setOnStopSharingScreenCallback.bind(n),_=n.onRealtimeAlerts.bind(n),x=i.signInTerms.bind(i),B=o.checkDevices.bind(o),O=n.appChecker.checkExternalCamera.bind(n.appChecker),R=n.appChecker.startSession.bind(n.appChecker),ue=n.appChecker.takePicture.bind(n.appChecker),se=n.appChecker.goToPositionGuide.bind(n.appChecker),jr=n.appChecker.startTransmission.bind(n.appChecker),Ni=o.runCheckDevicesFlow.bind(o),Vr=o.changeSelectedDevice.bind(o),fn=s.takePicture.bind(s);return{login:a,start:l,finish:h,onFocus:b,onLostFocus:m,onChangeDevices:f,onBufferSizeError:y,onRealtimeAlerts:_,checkDevices:B,runCheckDevicesFlow:Ni,changeSelectedDevice:Vr,capturePhoto:fn,enumarateDevices:St,checkPermissions:Gi,checkIfhasMultipleMonitors:Ki,onStopSharingScreen:v,signInTerms:x,checkExternalCamera:O,startExternalCameraSession:R,takeExternalCameraPicture:ue,goToExternalCameraPositionStep:se,startExternalCameraTransmission:jr}}typeof window<"u"&&(window.useProctoring=ku);})();
519
+ jszip/dist/jszip.min.js:
520
+ (*!
521
+
522
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
523
+ <http://stuartk.com/jszip>
524
+
525
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
526
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
527
+
528
+ JSZip uses the library pako released under the MIT license :
529
+ https://github.com/nodeca/pako/blob/main/LICENSE
530
+ *)
531
+ */