easyproctor 2.3.4 → 2.4.0

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,25 @@
1
- "use strict";(()=>{var uy=Object.create;var Lc=Object.defineProperty;var dy=Object.getOwnPropertyDescriptor;var py=Object.getOwnPropertyNames;var fy=Object.getPrototypeOf,my=Object.prototype.hasOwnProperty;var mn=(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),gy=(e,t)=>{for(var r in t)Lc(e,r,{get:t[r],enumerable:!0})},yy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of py(t))!my.call(e,o)&&o!==r&&Lc(e,o,{get:()=>t[o],enumerable:!(n=dy(t,o))||n.enumerable});return e};var Od=(e,t,r)=>(r=e!=null?uy(fy(e)):{},yy(t||!e||!e.__esModule?Lc(r,"default",{value:e,enumerable:!0}):r,e));var Ug=H(($h,Wh)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof $h<"u"?t():(t(),e.FileSaver={})})($h,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,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",p=/constructor/i.test(o.HTMLElement)||o.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||u&&p||i)&&typeof FileReader<"u"){var f=new FileReader;f.onloadend=function(){var w=f.result;w=y?w:w.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=w:location=w,h=null},f.readAsDataURL(a)}else{var g=o.URL||o.webkitURL,b=g.createObjectURL(a);h?h.location=b:location.href=b,h=null,setTimeout(function(){g.revokeObjectURL(b)},4e4)}});o.saveAs=s.saveAs=s,typeof Wh<"u"&&(Wh.exports=s)})});var Y0=H((Hx,J0)=>{J0.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Mr=H(cn=>{var Xu,vw=[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];cn.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};cn.getSymbolTotalCodewords=function(t){return vw[t]};cn.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};cn.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Xu=t};cn.isKanjiModeEnabled=function(){return typeof Xu<"u"};cn.toSJIS=function(t){return Xu(t)}});var vc=H(_t=>{_t.L={bit:1};_t.M={bit:0};_t.Q={bit:3};_t.H={bit:2};function _w(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 _w(t)}catch{return r}}});var e2=H((Wx,Z0)=>{function Q0(){this.buffer=[],this.length=0}Q0.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++}};Z0.exports=Q0});var r2=H((qx,t2)=>{function _i(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)}_i.prototype.set=function(e,t,r,n){let o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)};_i.prototype.get=function(e,t){return this.data[e*this.size+t]};_i.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};_i.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};t2.exports=_i});var n2=H(_c=>{var Sw=Mr().getSymbolSize;_c.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=Sw(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()};_c.getPositions=function(t){let r=[],n=_c.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 s2=H(i2=>{var kw=Mr().getSymbolSize,o2=7;i2.getPositions=function(t){let r=kw(t);return[[0,0],[r-o2,0],[0,r-o2]]}});var a2=H(J=>{J.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ln={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+=ln.N1+(o-5)),s=h,o=1),h=t.get(l,c),h===a?i++:(i>=5&&(n+=ln.N1+(i-5)),a=h,i=1)}o>=5&&(n+=ln.N1+(o-5)),i>=5&&(n+=ln.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*ln.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*ln.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)*ln.N4};function Ew(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,Ew(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 Yu=H(Ju=>{var Lr=vc(),Sc=[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],kc=[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];Ju.getBlocksCount=function(t,r){switch(r){case Lr.L:return Sc[(t-1)*4+0];case Lr.M:return Sc[(t-1)*4+1];case Lr.Q:return Sc[(t-1)*4+2];case Lr.H:return Sc[(t-1)*4+3];default:return}};Ju.getTotalCodewordsCount=function(t,r){switch(r){case Lr.L:return kc[(t-1)*4+0];case Lr.M:return kc[(t-1)*4+1];case Lr.Q:return kc[(t-1)*4+2];case Lr.H:return kc[(t-1)*4+3];default:return}}});var c2=H(Cc=>{var Si=new Uint8Array(512),Ec=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)Si[r]=t,Ec[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)Si[r]=Si[r-255]})();Cc.log=function(t){if(t<1)throw new Error("log("+t+")");return Ec[t]};Cc.exp=function(t){return Si[t]};Cc.mul=function(t,r){return t===0||r===0?0:Si[Ec[t]+Ec[r]]}});var l2=H(ki=>{var Qu=c2();ki.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]^=Qu.mul(t[o],r[i]);return n};ki.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]^=Qu.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};ki.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=ki.mul(r,new Uint8Array([1,Qu.exp(n)]));return r}});var d2=H((Zx,u2)=>{var h2=l2();function Zu(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}Zu.prototype.initialize=function(t){this.degree=t,this.genPoly=h2.generateECPolynomial(this.degree)};Zu.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=h2.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};u2.exports=Zu});var ed=H(p2=>{p2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var td=H(lr=>{var f2="[0-9]+",Cw="[A-Z $%*+\\-./:]+",Ei="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ei=Ei.replace(/u/g,"\\u");var Aw="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ei+`)(?:.|[\r
2
- ]))+`;lr.KANJI=new RegExp(Ei,"g");lr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");lr.BYTE=new RegExp(Aw,"g");lr.NUMERIC=new RegExp(f2,"g");lr.ALPHANUMERIC=new RegExp(Cw,"g");var xw=new RegExp("^"+Ei+"$"),Tw=new RegExp("^"+f2+"$"),Iw=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");lr.testKanji=function(t){return xw.test(t)};lr.testNumeric=function(t){return Tw.test(t)};lr.testAlphanumeric=function(t){return Iw.test(t)}});var Ur=H(ve=>{var Pw=ed(),rd=td();ve.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ve.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ve.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ve.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ve.MIXED={bit:-1};ve.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Pw.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};ve.getBestModeForData=function(t){return rd.testNumeric(t)?ve.NUMERIC:rd.testAlphanumeric(t)?ve.ALPHANUMERIC:rd.testKanji(t)?ve.KANJI:ve.BYTE};ve.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};ve.isValid=function(t){return t&&t.bit&&t.ccBits};function Rw(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return ve.NUMERIC;case"alphanumeric":return ve.ALPHANUMERIC;case"kanji":return ve.KANJI;case"byte":return ve.BYTE;default:throw new Error("Unknown mode: "+e)}}ve.from=function(t,r){if(ve.isValid(t))return t;try{return Rw(t)}catch{return r}}});var w2=H(hn=>{var Ac=Mr(),Dw=Yu(),m2=vc(),Fr=Ur(),nd=ed(),y2=7973,g2=Ac.getBCHDigit(y2);function Ow(e,t,r){for(let n=1;n<=40;n++)if(t<=hn.getCapacity(n,r,e))return n}function b2(e,t){return Fr.getCharCountIndicator(e,t)+4}function Bw(e,t){let r=0;return e.forEach(function(n){let o=b2(n.mode,t);r+=o+n.getBitsLength()}),r}function Mw(e,t){for(let r=1;r<=40;r++)if(Bw(e,r)<=hn.getCapacity(r,t,Fr.MIXED))return r}hn.from=function(t,r){return nd.isValid(t)?parseInt(t,10):r};hn.getCapacity=function(t,r,n){if(!nd.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Fr.BYTE);let o=Ac.getSymbolTotalCodewords(t),i=Dw.getTotalCodewordsCount(t,r),s=(o-i)*8;if(n===Fr.MIXED)return s;let a=s-b2(n,t);switch(n){case Fr.NUMERIC:return Math.floor(a/10*3);case Fr.ALPHANUMERIC:return Math.floor(a/11*2);case Fr.KANJI:return Math.floor(a/13);case Fr.BYTE:default:return Math.floor(a/8)}};hn.getBestVersionForData=function(t,r){let n,o=m2.from(r,m2.M);if(Array.isArray(t)){if(t.length>1)return Mw(t,o);if(t.length===0)return 1;n=t[0]}else n=t;return Ow(n.mode,n.getLength(),o)};hn.getEncodedBits=function(t){if(!nd.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;Ac.getBCHDigit(r)-g2>=0;)r^=y2<<Ac.getBCHDigit(r)-g2;return t<<12|r}});var k2=H(S2=>{var od=Mr(),_2=1335,Lw=21522,v2=od.getBCHDigit(_2);S2.getEncodedBits=function(t,r){let n=t.bit<<3|r,o=n<<10;for(;od.getBCHDigit(o)-v2>=0;)o^=_2<<od.getBCHDigit(o)-v2;return(n<<10|o)^Lw}});var C2=H((iT,E2)=>{var Uw=Ur();function mo(e){this.mode=Uw.NUMERIC,this.data=e.toString()}mo.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};mo.prototype.getLength=function(){return this.data.length};mo.prototype.getBitsLength=function(){return mo.getBitsLength(this.data.length)};mo.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))};E2.exports=mo});var x2=H((sT,A2)=>{var Fw=Ur(),id=["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 go(e){this.mode=Fw.ALPHANUMERIC,this.data=e}go.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};go.prototype.getLength=function(){return this.data.length};go.prototype.getBitsLength=function(){return go.getBitsLength(this.data.length)};go.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=id.indexOf(this.data[r])*45;n+=id.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(id.indexOf(this.data[r]),6)};A2.exports=go});var I2=H((aT,T2)=>{var Nw=Ur();function yo(e){this.mode=Nw.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}yo.getBitsLength=function(t){return t*8};yo.prototype.getLength=function(){return this.data.length};yo.prototype.getBitsLength=function(){return yo.getBitsLength(this.data.length)};yo.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};T2.exports=yo});var R2=H((cT,P2)=>{var jw=Ur(),Vw=Mr();function bo(e){this.mode=jw.KANJI,this.data=e}bo.getBitsLength=function(t){return t*13};bo.prototype.getLength=function(){return this.data.length};bo.prototype.getBitsLength=function(){return bo.getBitsLength(this.data.length)};bo.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=Vw.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)}};P2.exports=bo});var D2=H((lT,sd)=>{"use strict";var Ci={single_source_shortest_paths:function(e,t,r){var n={},o={};o[t]=0;var i=Ci.PriorityQueue.make();i.push(t,0);for(var s,a,c,l,h,u,p,y,f;!i.empty();){s=i.pop(),a=s.value,l=s.cost,h=e[a]||{};for(c in h)h.hasOwnProperty(c)&&(u=h[c],p=l+u,y=o[c],f=typeof o[c]>"u",(f||y>p)&&(o[c]=p,i.push(c,p),n[c]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var g=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(g)}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=Ci.single_source_shortest_paths(e,t,r);return Ci.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=Ci.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 sd<"u"&&(sd.exports=Ci)});var j2=H(wo=>{var V=Ur(),M2=C2(),L2=x2(),U2=I2(),F2=R2(),Ai=td(),xc=Mr(),Hw=D2();function O2(e){return unescape(encodeURIComponent(e)).length}function xi(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 N2(e){let t=xi(Ai.NUMERIC,V.NUMERIC,e),r=xi(Ai.ALPHANUMERIC,V.ALPHANUMERIC,e),n,o;return xc.isKanjiModeEnabled()?(n=xi(Ai.BYTE,V.BYTE,e),o=xi(Ai.KANJI,V.KANJI,e)):(n=xi(Ai.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 ad(e,t){switch(t){case V.NUMERIC:return M2.getBitsLength(e);case V.ALPHANUMERIC:return L2.getBitsLength(e);case V.KANJI:return F2.getBitsLength(e);case V.BYTE:return U2.getBitsLength(e)}}function zw(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 $w(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:O2(n.data)}]);break;case V.BYTE:t.push([{data:n.data,mode:V.BYTE,length:O2(n.data)}])}}return t}function Ww(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 u=0;u<o.length;u++){let p=o[u];r[p]&&r[p].node.mode===l.mode?(n[p][h]=ad(r[p].lastCount+l.length,l.mode)-ad(r[p].lastCount,l.mode),r[p].lastCount+=l.length):(r[p]&&(r[p].lastCount=l.length),n[p][h]=ad(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 B2(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&&!xc.isKanjiModeEnabled()&&(r=V.BYTE),r){case V.NUMERIC:return new M2(e);case V.ALPHANUMERIC:return new L2(e);case V.KANJI:return new F2(e);case V.BYTE:return new U2(e)}}wo.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(B2(n,null)):n.data&&r.push(B2(n.data,n.mode)),r},[])};wo.fromString=function(t,r){let n=N2(t,xc.isKanjiModeEnabled()),o=$w(n),i=Ww(o,r),s=Hw.find_path(i.map,"start","end"),a=[];for(let c=1;c<s.length-1;c++)a.push(i.table[s[c]].node);return wo.fromArray(zw(a))};wo.rawSplit=function(t){return wo.fromArray(N2(t,xc.isKanjiModeEnabled()))}});var H2=H(V2=>{var Ic=Mr(),cd=vc(),qw=e2(),Gw=r2(),Kw=n2(),Xw=s2(),ud=a2(),dd=Yu(),Jw=d2(),Tc=w2(),Yw=k2(),Qw=Ur(),ld=j2();function Zw(e,t){let r=e.size,n=Xw.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 ev(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 tv(e,t){let r=Kw.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 rv(e,t){let r=e.size,n=Tc.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 hd(e,t,r){let n=e.size,o=Yw.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 nv(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 ov(e,t,r){let n=new qw;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),Qw.getCharCountIndicator(c.mode,e)),c.write(n)});let o=Ic.getSymbolTotalCodewords(e),i=dd.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 iv(n,e,t)}function iv(e,t,r){let n=Ic.getSymbolTotalCodewords(t),o=dd.getTotalCodewordsCount(t,r),i=n-o,s=dd.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),h=Math.floor(i/s),u=h+1,p=l-h,y=new Jw(p),f=0,g=new Array(s),b=new Array(s),w=0,_=new Uint8Array(e.buffer);for(let de=0;de<s;de++){let se=de<c?h:u;g[de]=_.slice(f,f+se),b[de]=y.encode(g[de]),f+=se,w=Math.max(w,se)}let A=new Uint8Array(n),B=0,O,R;for(O=0;O<w;O++)for(R=0;R<s;R++)O<g[R].length&&(A[B++]=g[R][O]);for(O=0;O<p;O++)for(R=0;R<s;R++)A[B++]=b[R][O];return A}function sv(e,t,r,n){let o;if(Array.isArray(e))o=ld.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let h=ld.rawSplit(e);l=Tc.getBestVersionForData(h,r)}o=ld.fromString(e,l||40)}else throw new Error("Invalid data");let i=Tc.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 uy=Object.create;var Fc=Object.defineProperty;var py=Object.getOwnPropertyDescriptor;var fy=Object.getOwnPropertyNames;var my=Object.getPrototypeOf,gy=Object.prototype.hasOwnProperty;var bn=(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),yy=(e,t)=>{for(var r in t)Fc(e,r,{get:t[r],enumerable:!0})},by=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fy(t))!gy.call(e,o)&&o!==r&&Fc(e,o,{get:()=>t[o],enumerable:!(n=py(t,o))||n.enumerable});return e};var Bu=(e,t,r)=>(r=e!=null?uy(my(e)):{},by(t||!e||!e.__esModule?Fc(r,"default",{value:e,enumerable:!0}):r,e));var Ng=H((qh,Gh)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof qh<"u"?t():(t(),e.FileSaver={})})(qh,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",p=/constructor/i.test(o.HTMLElement)||o.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||d&&p||i)&&typeof FileReader<"u"){var f=new FileReader;f.onloadend=function(){var v=f.result;v=b?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=v:location=v,h=null},f.readAsDataURL(a)}else{var g=o.URL||o.webkitURL,y=g.createObjectURL(a);h?h.location=y:location.href=y,h=null,setTimeout(function(){g.revokeObjectURL(y)},4e4)}});o.saveAs=s.saveAs=s,typeof Gh<"u"&&(Gh.exports=s)})});var Q0=H(($A,Y0)=>{Y0.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Mr=H(hn=>{var Yd,_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.');Yd=t};hn.isKanjiModeEnabled=function(){return typeof Yd<"u"};hn.toSJIS=function(t){return Yd(t)}});var Sc=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 t2=H((KA,e2)=>{function Z0(){this.buffer=[],this.length=0}Z0.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++}};e2.exports=Z0});var n2=H((XA,r2)=>{function Ti(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)}Ti.prototype.set=function(e,t,r,n){let o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)};Ti.prototype.get=function(e,t){return this.data[e*this.size+t]};Ti.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};Ti.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};r2.exports=Ti});var o2=H(kc=>{var kv=Mr().getSymbolSize;kc.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()};kc.getPositions=function(t){let r=[],n=kc.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 a2=H(s2=>{var Ev=Mr().getSymbolSize,i2=7;s2.getPositions=function(t){let r=Ev(t);return[[0,0],[r-i2,0],[0,r-i2]]}});var c2=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 Zd=H(Qd=>{var Lr=Sc(),Ec=[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],Cc=[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];Qd.getBlocksCount=function(t,r){switch(r){case Lr.L:return Ec[(t-1)*4+0];case Lr.M:return Ec[(t-1)*4+1];case Lr.Q:return Ec[(t-1)*4+2];case Lr.H:return Ec[(t-1)*4+3];default:return}};Qd.getTotalCodewordsCount=function(t,r){switch(r){case Lr.L:return Cc[(t-1)*4+0];case Lr.M:return Cc[(t-1)*4+1];case Lr.Q:return Cc[(t-1)*4+2];case Lr.H:return Cc[(t-1)*4+3];default:return}}});var l2=H(Ac=>{var Ii=new Uint8Array(512),xc=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)Ii[r]=t,xc[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)Ii[r]=Ii[r-255]})();Ac.log=function(t){if(t<1)throw new Error("log("+t+")");return xc[t]};Ac.exp=function(t){return Ii[t]};Ac.mul=function(t,r){return t===0||r===0?0:Ii[xc[t]+xc[r]]}});var h2=H(Pi=>{var eu=l2();Pi.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]^=eu.mul(t[o],r[i]);return n};Pi.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]^=eu.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};Pi.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=Pi.mul(r,new Uint8Array([1,eu.exp(n)]));return r}});var p2=H((rT,u2)=>{var d2=h2();function tu(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}tu.prototype.initialize=function(t){this.degree=t,this.genPoly=d2.generateECPolynomial(this.degree)};tu.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=d2.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};u2.exports=tu});var ru=H(f2=>{f2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var nu=H(lr=>{var m2="[0-9]+",xv="[A-Z $%*+\\-./:]+",Ri="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ri=Ri.replace(/u/g,"\\u");var Av="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ri+`)(?:.|[\r
2
+ ]))+`;lr.KANJI=new RegExp(Ri,"g");lr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");lr.BYTE=new RegExp(Av,"g");lr.NUMERIC=new RegExp(m2,"g");lr.ALPHANUMERIC=new RegExp(xv,"g");var Tv=new RegExp("^"+Ri+"$"),Iv=new RegExp("^"+m2+"$"),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=ru(),ou=nu();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 ou.testNumeric(t)?we.NUMERIC:ou.testAlphanumeric(t)?we.ALPHANUMERIC:ou.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 w2=H(un=>{var Tc=Mr(),Ov=Zd(),g2=Sc(),Fr=Ur(),iu=ru(),b2=7973,y2=Tc.getBCHDigit(b2);function Bv(e,t,r){for(let n=1;n<=40;n++)if(t<=un.getCapacity(n,r,e))return n}function v2(e,t){return Fr.getCharCountIndicator(e,t)+4}function Mv(e,t){let r=0;return e.forEach(function(n){let o=v2(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,Fr.MIXED))return r}un.from=function(t,r){return iu.isValid(t)?parseInt(t,10):r};un.getCapacity=function(t,r,n){if(!iu.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Fr.BYTE);let o=Tc.getSymbolTotalCodewords(t),i=Ov.getTotalCodewordsCount(t,r),s=(o-i)*8;if(n===Fr.MIXED)return s;let a=s-v2(n,t);switch(n){case Fr.NUMERIC:return Math.floor(a/10*3);case Fr.ALPHANUMERIC:return Math.floor(a/11*2);case Fr.KANJI:return Math.floor(a/13);case Fr.BYTE:default:return Math.floor(a/8)}};un.getBestVersionForData=function(t,r){let n,o=g2.from(r,g2.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(!iu.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;Tc.getBCHDigit(r)-y2>=0;)r^=b2<<Tc.getBCHDigit(r)-y2;return t<<12|r}});var E2=H(k2=>{var su=Mr(),S2=1335,Uv=21522,_2=su.getBCHDigit(S2);k2.getEncodedBits=function(t,r){let n=t.bit<<3|r,o=n<<10;for(;su.getBCHDigit(o)-_2>=0;)o^=S2<<su.getBCHDigit(o)-_2;return(n<<10|o)^Uv}});var x2=H((cT,C2)=>{var Fv=Ur();function bo(e){this.mode=Fv.NUMERIC,this.data=e.toString()}bo.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};bo.prototype.getLength=function(){return this.data.length};bo.prototype.getBitsLength=function(){return bo.getBitsLength(this.data.length)};bo.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))};C2.exports=bo});var T2=H((lT,A2)=>{var Nv=Ur(),au=["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 vo(e){this.mode=Nv.ALPHANUMERIC,this.data=e}vo.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};vo.prototype.getLength=function(){return this.data.length};vo.prototype.getBitsLength=function(){return vo.getBitsLength(this.data.length)};vo.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=au.indexOf(this.data[r])*45;n+=au.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(au.indexOf(this.data[r]),6)};A2.exports=vo});var P2=H((hT,I2)=>{var jv=Ur();function wo(e){this.mode=jv.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}wo.getBitsLength=function(t){return t*8};wo.prototype.getLength=function(){return this.data.length};wo.prototype.getBitsLength=function(){return wo.getBitsLength(this.data.length)};wo.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};I2.exports=wo});var D2=H((dT,R2)=>{var Vv=Ur(),Hv=Mr();function _o(e){this.mode=Vv.KANJI,this.data=e}_o.getBitsLength=function(t){return t*13};_o.prototype.getLength=function(){return this.data.length};_o.prototype.getBitsLength=function(){return _o.getBitsLength(this.data.length)};_o.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)}};R2.exports=_o});var O2=H((uT,cu)=>{"use strict";var Di={single_source_shortest_paths:function(e,t,r){var n={},o={};o[t]=0;var i=Di.PriorityQueue.make();i.push(t,0);for(var s,a,c,l,h,d,p,b,f;!i.empty();){s=i.pop(),a=s.value,l=s.cost,h=e[a]||{};for(c in h)h.hasOwnProperty(c)&&(d=h[c],p=l+d,b=o[c],f=typeof o[c]>"u",(f||b>p)&&(o[c]=p,i.push(c,p),n[c]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var g=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(g)}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=Di.single_source_shortest_paths(e,t,r);return Di.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=Di.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 cu<"u"&&(cu.exports=Di)});var V2=H(So=>{var V=Ur(),L2=x2(),U2=T2(),F2=P2(),N2=D2(),Oi=nu(),Ic=Mr(),zv=O2();function B2(e){return unescape(encodeURIComponent(e)).length}function Bi(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 j2(e){let t=Bi(Oi.NUMERIC,V.NUMERIC,e),r=Bi(Oi.ALPHANUMERIC,V.ALPHANUMERIC,e),n,o;return Ic.isKanjiModeEnabled()?(n=Bi(Oi.BYTE,V.BYTE,e),o=Bi(Oi.KANJI,V.KANJI,e)):(n=Bi(Oi.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 lu(e,t){switch(t){case V.NUMERIC:return L2.getBitsLength(e);case V.ALPHANUMERIC:return U2.getBitsLength(e);case V.KANJI:return N2.getBitsLength(e);case V.BYTE:return F2.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:B2(n.data)}]);break;case V.BYTE:t.push([{data:n.data,mode:V.BYTE,length:B2(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 p=o[d];r[p]&&r[p].node.mode===l.mode?(n[p][h]=lu(r[p].lastCount+l.length,l.mode)-lu(r[p].lastCount,l.mode),r[p].lastCount+=l.length):(r[p]&&(r[p].lastCount=l.length),n[p][h]=lu(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 M2(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&&!Ic.isKanjiModeEnabled()&&(r=V.BYTE),r){case V.NUMERIC:return new L2(e);case V.ALPHANUMERIC:return new U2(e);case V.KANJI:return new N2(e);case V.BYTE:return new F2(e)}}So.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(M2(n,null)):n.data&&r.push(M2(n.data,n.mode)),r},[])};So.fromString=function(t,r){let n=j2(t,Ic.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 So.fromArray(Wv(a))};So.rawSplit=function(t){return So.fromArray(j2(t,Ic.isKanjiModeEnabled()))}});var z2=H(H2=>{var Rc=Mr(),hu=Sc(),Gv=t2(),Kv=n2(),Xv=o2(),Jv=a2(),pu=c2(),fu=Zd(),Yv=p2(),Pc=w2(),Qv=E2(),Zv=Ur(),du=V2();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=Pc.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 uu(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=Rc.getSymbolTotalCodewords(e),i=fu.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=Rc.getSymbolTotalCodewords(t),o=fu.getTotalCodewordsCount(t,r),i=n-o,s=fu.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),h=Math.floor(i/s),d=h+1,p=l-h,b=new Yv(p),f=0,g=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;g[ue]=_.slice(f,f+se),y[ue]=b.encode(g[ue]),f+=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<g[R].length&&(x[B++]=g[R][O]);for(O=0;O<p;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=du.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let h=du.rawSplit(e);l=Pc.getBestVersionForData(h,r)}o=du.fromString(e,l||40)}else throw new Error("Invalid data");let i=Pc.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(`
5
5
  The chosen QR Code version cannot contain this amount of data.
6
6
  Minimum version required to store current data is: `+i+`.
7
- `);let s=ov(t,r,o),a=Ic.getSymbolSize(t),c=new Gw(a);return Zw(c,t),ev(c),tv(c,t),hd(c,r,0),t>=7&&rv(c,t),nv(c,s),isNaN(n)&&(n=ud.getBestMask(c,hd.bind(null,c,r))),ud.applyMask(n,c),hd(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}V2.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=cd.M,o,i;return typeof r<"u"&&(n=cd.from(r.errorCorrectionLevel,cd.M),o=Tc.from(r.version),i=ud.from(r.maskPattern),r.toSJISFunc&&Ic.setToSJISFunction(r.toSJISFunc)),sv(t,o,n,i)}});var pd=H(un=>{function z2(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("")}}un.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:z2(t.color.dark||"#000000ff"),light:z2(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};un.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};un.getImageWidth=function(t,r){let n=un.getScale(t,r);return Math.floor((t+r.margin*2)*n)};un.qrToImageData=function(t,r,n){let o=r.modules.size,i=r.modules.data,s=un.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 u=0;u<a;u++){let p=(h*a+u)*4,y=n.color.light;if(h>=c&&u>=c&&h<a-c&&u<a-c){let f=Math.floor((h-c)/s),g=Math.floor((u-c)/s);y=l[i[f*o+g]?1:0]}t[p++]=y.r,t[p++]=y.g,t[p++]=y.b,t[p]=y.a}}});var $2=H(Pc=>{var fd=pd();function av(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 cv(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Pc.render=function(t,r,n){let o=n,i=r;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),r||(i=cv()),o=fd.getOptions(o);let s=fd.getImageWidth(t.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return fd.qrToImageData(c.data,t,o),av(a,i,s),a.putImageData(c,0,0),i};Pc.renderToDataURL=function(t,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=Pc.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var G2=H(q2=>{var lv=pd();function W2(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function md(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function hv(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?md("M",c+r,.5+l+r):md("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=md("h",s),s=0)):o++}return n}q2.render=function(t,r,n){let o=lv.getOptions(r),i=t.modules.size,s=t.modules.data,a=i+o.margin*2,c=o.color.light.a?"<path "+W2(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+W2(o.color.dark,"stroke")+' d="'+hv(s,i,o.margin)+'"/>',h='viewBox="0 0 '+a+" "+a+'"',p='<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,p),p}});var X2=H(Ti=>{var uv=Y0(),gd=H2(),K2=$2(),dv=G2();function yd(e,t,r,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!uv())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=gd.create(r,n);c(e(h,t,n))}catch(h){l(h)}})}try{let c=gd.create(r,n);o(null,e(c,t,n))}catch(c){o(c)}}Ti.create=gd.create;Ti.toCanvas=yd.bind(null,K2.render);Ti.toDataURL=yd.bind(null,K2.renderToDataURL);Ti.toString=yd.bind(null,function(e,t,r){return dv.render(e,r)})});async function $i(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function Wi(){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 Wr=typeof self<"u"?self:{};function Vr(){throw Error("Invalid UTF8")}function Bd(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var qi,Uc,by=typeof TextDecoder<"u",wy,vy=typeof TextEncoder<"u";function qp(e){if(vy)e=(wy||=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 gl,is;e:{for(Fc=["CLOSURE_FLAGS"],Gi=Wr,Ki=0;Ki<Fc.length;Ki++)if((Gi=Gi[Fc[Ki]])==null){is=null;break e}is=Gi}var Fc,Gi,Ki,Oo,Md=is&&is[610401301];gl=Md!=null&&Md;var Ld=Wr.navigator;function Jc(e){return!!gl&&!!Oo&&Oo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function at(e){var t;return(t=Wr.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function pr(){return!!gl&&!!Oo&&Oo.brands.length>0}function Nc(){return pr()?Jc("Chromium"):(at("Chrome")||at("CriOS"))&&!(!pr()&&at("Edge"))||at("Silk")}function yl(e){return yl[" "](e),e}Oo=Ld&&Ld.userAgentData||null,yl[" "]=function(){};var _y=!pr()&&(at("Trident")||at("MSIE"));!at("Android")||Nc(),Nc(),at("Safari")&&(Nc()||!pr()&&at("Coast")||!pr()&&at("Opera")||!pr()&&at("Edge")||(pr()?Jc("Microsoft Edge"):at("Edg/"))||pr()&&Jc("Opera"));var Gp={},xo=null;function Sy(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++),u=xo[h];if(u!=null)return u;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}Kp();let c=0;for(;;){let l=a(-1),h=a(0),u=a(64),p=a(64);if(p===64&&l===-1)break;s(l<<2|h>>4),u!=64&&(s(h<<4&240|u>>2),p!=64&&s(u<<6&192|p))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function Kp(){if(!xo){xo={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));Gp[r]=n;for(let o=0;o<n.length;o++){let i=n[o];xo[i]===void 0&&(xo[i]=o)}}}}var Xp=typeof Uint8Array<"u",Jp=!_y&&typeof btoa=="function";function Ud(e){if(!Jp){var t;t===void 0&&(t=0),Kp(),t=Gp[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 Fd=/[-_.]/g,ky={"-":"+",_:"/",".":"="};function Ey(e){return ky[e]||""}function Yp(e){if(!Jp)return Sy(e);Fd.test(e)&&(e=e.replace(Fd,Ey)),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 Fo(e){return Xp&&e!=null&&e instanceof Uint8Array}var En={};function qr(){return Cy||=new er(null,En)}function bl(e){Qp(En);var t=e.g;return(t=t==null||Fo(t)?t:typeof t=="string"?Yp(t):null)==null?t:e.g=t}var er=class{h(){return new Uint8Array(bl(this)||0)}constructor(e,t){if(Qp(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},Cy,Ay;function Qp(e){if(e!==En)throw Error("illegal external caller")}function Zp(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Yc(e){return Zp(e=Error(e),"warning"),e}var ms=typeof Symbol=="function"&&typeof Symbol()=="symbol",xy=new Set;function No(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&&xy.add(e),e}var Ty=No("jas",void 0,!0,!0),Nd=No(void 0,"0di"),jc=No(void 0,"2ex"),Eo=No(void 0,"1oa",!0),Cn=No(void 0,Symbol(),!0),C=ms?Ty:"Ga",ef={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},tf=Object.defineProperties;function gs(e,t){ms||C in e||tf(e,ef),e[C]|=t}function ge(e,t){ms||C in e||tf(e,ef),e[C]=t}function Bn(e){return gs(e,34),e}function Iy(e,t){ge(t,-30975&(0|e))}function Qc(e,t){ge(t,-30941&(34|e))}function wl(){return typeof BigInt=="function"}function Ve(e){return Array.prototype.slice.call(e)}var vl,jo={},rf={};function jd(e){return!(!e||typeof e!="object"||e.Ia!==rf)}function _l(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Sl(e,t){if(e!=null){if(typeof e=="string")e=e?new er(e,En):qr();else if(e.constructor!==er)if(Fo(e))e=e.length?new er(new Uint8Array(e),En):qr();else{if(!t)throw Error();e=void 0}}return e}function ss(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[C]))}var Vd=[];function vr(e){if(2&e)throw Error()}ge(Vd,55),vl=Object.freeze(Vd);var as=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 kl(e){return Cn?e[Cn]:void 0}var Py=Object.freeze({});function ys(e){return e.Qa=!0,e}var Ry=ys((e=>typeof e=="number")),Hd=ys((e=>typeof e=="string")),Dy=ys((e=>typeof e=="boolean")),bs=typeof Wr.BigInt=="function"&&typeof Wr.BigInt(0)=="bigint",Zc=ys((e=>bs?e>=By&&e<=Ly:e[0]==="-"?zd(e,Oy):zd(e,My))),Oy=Number.MIN_SAFE_INTEGER.toString(),By=bs?BigInt(Number.MIN_SAFE_INTEGER):void 0,My=Number.MAX_SAFE_INTEGER.toString(),Ly=bs?BigInt(Number.MAX_SAFE_INTEGER):void 0;function zd(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 Uy=typeof Uint8Array.prototype.slice=="function",nf,W=0,ce=0;function $d(e){let t=e>>>0;W=t,ce=(e-t)/4294967296>>>0}function An(e){if(e<0){$d(-e);let[t,r]=xl(W,ce);W=t>>>0,ce=r>>>0}else $d(e)}function El(e){let t=nf||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),ce=0,W=t.getUint32(0,!0)}function Cl(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Bo(e,t)}function Al(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Cl(e,t))=="number"?r?-e:e:r?"-"+e:e}function Bo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else wl()?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+Wd(r)+Wd(e));return r}function Wd(e){return e=String(e),"0000000".slice(e.length)+e}function ws(e){if(e.length<16)An(Number(e));else if(wl())e=BigInt(e),W=Number(e&BigInt(4294967295))>>>0,ce=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");ce=W=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,W=1e6*W+i,W>=4294967296&&(ce+=Math.trunc(W/4294967296),ce>>>=0,W>>>=0)}if(t){let[n,o]=xl(W,ce);W=n,ce=o}}}function xl(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var Tl=typeof BigInt=="function"?BigInt.asIntN:void 0,Fy=typeof BigInt=="function"?BigInt.asUintN:void 0,wn=Number.isSafeInteger,vs=Number.isFinite,cs=Math.trunc;function _r(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function of(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var Ny=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function _s(e){switch(typeof e){case"bigint":return!0;case"number":return vs(e);case"string":return Ny.test(e);default:return!1}}function Mn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return vs(e)?0|e:void 0}function sf(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return vs(e)?e>>>0:void 0}function qd(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Il(e){return e=cs(e),wn(e)||(An(e),e=Al(W,ce)),e}function Pl(e){var t=cs(Number(e));if(wn(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(ws(e),e=W,2147483648&(t=ce))if(wl())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=xl(e,t);e="-"+Bo(r,n)}else e=Bo(e,t);return e}function ls(e){return e==null?e:typeof e=="bigint"?(Zc(e)?e=Number(e):(e=Tl(64,e),e=Zc(e)?Number(e):String(e)),e):_s(e)?typeof e=="number"?Il(e):Pl(e):void 0}function jy(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Fy(64,e));if(_s(e)){if(t==="string")return t=cs(Number(e)),wn(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),qd(e)||(ws(e),e=Bo(W,ce))),e;if(t==="number")return(e=cs(e))>=0&&wn(e)?e:(function(r){if(r<0){An(r);var n=Bo(W,ce);return r=Number(n),wn(r)?r:n}return qd(n=String(r))?n:(An(r),Cl(W,ce))})(e)}}function af(e){if(typeof e!="string")throw Error();return e}function Ln(e){if(e!=null&&typeof e!="string")throw Error();return e}function xn(e){return e==null||typeof e=="string"?e:void 0}function Rl(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===jo)return e;if(!Array.isArray(e))return r?2&n?((e=t[Nd])||(Bn((e=new t).u),e=t[Nd]=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 Vy(e,t,r){if(t)e:{if(!_s(t=e))throw Yc("int64");switch(typeof t){case"string":t=Pl(t);break e;case"bigint":if(e=t=Tl(64,t),Hd(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Ry(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=bs?BigInt(t):Dy(t)?t?"1":"0":Hd(t)?t.trim()||"0":String(t);break e;default:t=Il(t)}}else t=ls(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&wn(t=+r)?t:r}var Hy={},zy=(function(){try{return yl(new class extends Map{constructor(){super()}}),!1}catch{return!0}})(),Io=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()}},$y=zy?(Object.setPrototypeOf(Io.prototype,Map.prototype),Object.defineProperties(Io.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Io):class extends Map{constructor(){super()}};function Gd(e){return e}function Vc(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var lt=class extends $y{constructor(e,t,r=Gd,n=Gd){super();let o=0|e[C];o|=64,ge(e,o),this.L=o,this.S=t,this.R=r,this.Y=this.S?Wy: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=Kd){if(this.size!==0)return this.X(e)}X(e=Kd){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(){Vc(this),super.clear()}delete(e){return Vc(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new as(e,qy,this)}keys(){return this.Ha()}values(){var e=this.ma();return new as(e,lt.prototype.get,this)}forEach(e,t){super.forEach(((r,n)=>{e.call(t,this.get(n),n,this)}))}set(e,t){return Vc(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 Wy(e,t,r,n,o,i){return e=Rl(e,n,r,i),o&&(e=ks(e)),e}function Kd(e){return e}function qy(e){return[e,this.get(e)]}var Gy,cf,Ky;function Xd(){return Gy||=new lt(Bn([]),void 0,void 0,void 0,Hy)}function Dl(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=ss(e)?void 0:o&&2&(0|e[C])?e:Ol(e,t,r,n!==void 0,o);else if(_l(e)){let i={};for(let s in e)i[s]=Dl(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Ol(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]=Dl(n[a],t,r,s,o);return r&&((e=kl(e))&&(n[Cn]=Ve(e)),r(i,n)),n}function Xy(e){return Dl(e,lf,void 0,void 0,!1)}function lf(e){return e.W===jo?e.toJSON():e instanceof lt?e.na(Xy):(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Zc(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ss(t))return}else{if(Fo(t))return Ud(t);if(t instanceof er){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=Ud(r)}if(t instanceof lt)return t.na()}}return t})(e)}function hf(e){return Ol(e,lf,void 0,void 0,!1)}function mr(e,t,r){return e=uf(e,t[0],t[1],r?1:2),t!==cf&&r&&gs(e,16384),e}function uf(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(_l(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 el(e,t,r=Qc){if(e!=null){if(Xp&&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):Ol(e,el,4&n?Qc:r,!0,!0))}return e.W===jo?e=2&(n=0|(r=e.u)[C])?e:new e.constructor(Ss(r,n,!0)):e instanceof lt&&!(2&e.L)&&(r=Bn(e.X(el)),e=new lt(r,e.S,e.R,e.Y)),e}}function Ss(e,t,r){let n=r||2&t?Qc:Iy,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 u in h)s[u]=a(h[u])}return(i=kl(i))&&(c[Cn]=Ve(i)),c})(e,t,(i=>el(i,o,n))),gs(e,32|(r?2:0)),e}function ks(e){let t=e.u,r=0|t[C];return 2&r?new e.constructor(Ss(t,r,!1)):e}function Tn(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&&jc!=null&&((o=(e=Ay??={})[jc]||0)>=4||(e[jc]=o+1,Zp(e=Error(),"incident"),(function(s){Wr.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 vr(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 Zi(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 df(e){let t=0|(e=e.u)[C],r=or(e,t,1),n=Sl(r,!0);return n!=null&&n!==r&&ne(e,t,1,n),n}function Hr(){return Py===void 0?2:4}function zr(e,t,r,n,o){let i=e.u,s=2&(e=0|i[C])?1:n;o=!!o;let a=0|(n=Bl(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=Ml(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 Bl(e,t,r,n){return e=or(e,t,r,n),Array.isArray(e)?e:vl}function Ml(e,t){return e===0&&(e=tr(e,t)),1|e}function Zt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function pf(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]=Bn(r[1]))}return e}function tl(e,t,r,n){let o=0|(e=e.u)[C];vr(o),ne(e,o,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Un(e,t,r,n,o){vr(t);var i=!(!(64&t)&&16384&t);let s=(o=Bl(e,t,r,o))!==vl;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&Ml(a,t),a=gr(n?-17&a:16|a,t,!0),a!==i&&ge(o,a)}return o}function Hc(e,t){var r=rm;return Ul(Ll(e=e.u),e,0|e[C],r)===t?t:-1}function Ll(e){if(ms)return e[Eo]??(e[Eo]=new Map);if(Eo in e)return e[Eo];let t=new Map;return Object.defineProperty(e,Eo,{value:t}),t}function ff(e,t,r,n){let o=Ll(e),i=Ul(o,e,t,r);return i!==n&&(i&&(t=ne(e,t,i)),o.set(r,n)),t}function Ul(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 Fl(e,t,r,n){let o,i=0|e[C];if((n=or(e,i,r,n))!=null&&n.W===jo)return(t=ks(n))!==n&&ne(e,i,r,t),t.u;if(Array.isArray(n)){let s=0|n[C];o=2&s?mr(Ss(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 mf(e,t,r,n){let o=0|(e=e.u)[C];return(t=Rl(n=or(e,o,r,n),t,!1,o))!==n&&t!=null&&ne(e,o,r,t),t}function U(e,t,r,n=!1){if((t=mf(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[C]))){let o=ks(t);o!==t&&ne(e,n,r,t=o)}return t}function gf(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=Bl(e,t,n))[C];if(!(a=!!(4&l))){var h=o,u=t;let p=!!(2&(l=Ml(l,t)));p&&(u|=2);let y=!p,f=!0,g=0,b=0;for(;g<h.length;g++){let w=Rl(h[g],r,!1,u);if(w instanceof r){if(!p){let _=!!(2&(0|w.u[C]));y&&=!_,f&&=_}h[b++]=w}}b<g&&(h.length=b),l|=4,l=f?16|l:-17&l,ge(h,l=y?8|l:-9&l),p&&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])!==(u=ks(l))&&(r[h]=u);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 gf(e,n,t,r,Hr(),!1,!(2&n))}function x(e,t,r,n){return n==null&&(n=void 0),G(e,r,n)}function Po(e,t,r,n){n==null&&(n=void 0);e:{let o=0|(e=e.u)[C];if(vr(o),n==null){let i=Ll(e);if(Ul(i,e,o,r)!==t)break e;i.set(r,0)}else o=ff(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 hs(e,t,r,n){let o=0|e.u[C];vr(o),e=gf(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 Mn(Tn(e,t))}function ht(e,t){return xn(Tn(e,t))}function pe(e,t){return Zi(e,t)??0}function Mo(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"||!vs(r))throw Yc("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 us(e,t,r){{let s=e.u,a=0|s[C];if(vr(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=af(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 Es(e,t,r){vr(0|e.u[C]),zr(e,t,xn,2,!0).push(af(r))}function yf(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Nl(){return Error("Failed to read varint, encoding is invalid.")}function bf(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function jl(e){if(typeof e=="string")return{buffer:Yp(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:bl(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 Vl(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($r(e,a),r<128)return t(n>>>0,o>>>0);throw Nl()}function Hl(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 $r(e,r),!!(127&t)}throw Nl()}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 Nl();return $r(e,r),o}function nr(e){return yr(e)>>>0}function rl(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],$r(e,e.g+4),(n<<0|o<<8|i<<16|t<<24)>>>0}function nl(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 Jy(e){return yr(e)}function zc(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=jl(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function $r(e,t){if(e.g=t,t>e.l)throw bf(e.l,t)}function wf(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 bf(t,e.l-r);return e.g=n,r}function vf(e,t){if(t==0)return qr();var r=wf(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):Uy?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?qr():new er(r,En)}lt.prototype.toJSON=void 0,lt.prototype.Ia=rf;var Jd=[];function _f(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 yf(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 es(e){switch(e.h){case 0:e.h!=0?es(e):Hl(e.g);break;case 1:$r(e=e.g,e.g+8);break;case 2:if(e.h!=2)es(e);else{var t=nr(e.g);$r(e=e.g,e.g+t)}break;case 5:$r(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!_f(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}es(e)}break;default:throw yf(e.h,e.l)}}function Vo(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 zl(e){var t=nr(e.g),r=wf(e=e.g,t);if(e=e.h,by){var n,o=e;(n=Uc)||(n=Uc=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(qi===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),qi=!0}catch{qi=!1}}throw!qi&&(Uc=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?Vr():(a=e[i++],s<194||(192&a)!=128?(i--,Vr()):r.push((31&s)<<6|63&a)):s<240?i>=t-1?Vr():(a=e[i++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Vr()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?i>=t-2?Vr():(a=e[i++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(o=e[i++]))!=128?(i--,Vr()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Vr(),r.length>=8192&&(c=Bd(c,r),r.length=0)}i=Bd(c,r)}return i}function Sf(e){let t=nr(e.g);return vf(e.g,t)}function Cs(e,t,r){var n=nr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Xi=[];function Yy(e){return e}var vn;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=uf(e,t)}toJSON(){let e=!vn;try{return e&&(vn=hf),kf(this)}finally{e&&(vn=void 0)}}l(){var e=D3;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(Ss(e,0|e[C],!1))}N(){return!!(2&(0|this.u[C]))}};function kf(e){var t=e.u;{t=(e=vn(t))!==t;let l=e.length;if(l){var r=e[l-1],n=_l(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)&&(ss(n)||jd(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||ss(i)||jd(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 Yd(e){return e?/^\d+$/.test(e)?(ws(e),new ol(W,ce)):null:Qy||=new ol(0,0)}S.prototype.W=jo,S.prototype.toString=function(){try{return vn=Yy,kf(this).toString()}finally{vn=void 0}};var ol=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Qy;function Qd(e){return e?/^-?\d+$/.test(e)?(ws(e),new il(W,ce)):null:Zy||=new il(0,0)}var il=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Zy;function _n(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 Fn(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function As(e,t){if(t>=0)Fn(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Lo(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 In(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ye(e,t,r){Fn(e.g,8*t+r)}function $l(e,t){return Ye(e,t,2),t=e.g.end(),In(e,t),t.push(e.h),t}function Wl(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 xs(e,t,r){Ye(e,t,2),Fn(e.g,r.length),In(e,e.g.end()),In(e,r)}function ds(e,t,r,n){r!=null&&(t=$l(e,t),n(r,e),Wl(e,t))}function Et(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ql=Et(),Ef=Et(),Gl=Et(),Kl=Et(),Cf=Et(),Af=Et(),Xl=Et(),xf=Et(),Tf=Et(),Nn=class{constructor(e,t,r){this.g=e,this.h=t,e=ql,this.l=!!e&&r===e||!1}};function Ts(e,t){return new Nn(e,t,ql)}function If(e,t,r,n,o){ds(e,r,Of(t,n),o)}var e3=Ts((function(e,t,r,n,o){return e.h===2&&(Vo(e,Fl(t,n,r),o),!0)}),If),t3=Ts((function(e,t,r,n,o){return e.h===2&&(Vo(e,Fl(t,n,r,!0),o),!0)}),If),Is=Symbol(),Jl=Symbol(),Zd=Symbol(),ep=Symbol(),Pf,Rf;function Gr(e,t,r,n){var o=n[e];if(o)return o;(o={}).Pa=n,o.V=(function(u){switch(typeof u){case"boolean":return cf||=[0,void 0,!0];case"number":return u>0?void 0:u===0?Ky||=[0,void 0]:[-u,void 0];case"string":return[0,u];case"object":return u}})(n[0]);var i=n[1];let s=1;i&&i.constructor===Object&&(o.ga=i,typeof(i=n[++s])=="function"&&(o.la=!0,Pf??=i,Rf??=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 u;typeof i=="number"&&(c+=i,i=n[++s]);var l=void 0;if(i instanceof Nn?u=i:(u=e3,s--),u?.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 p=a[c];l?r(o,c,u,l,p):t(o,c,u,p)}}return n[e]=o}function Df(e){return Array.isArray(e)?e[0]instanceof Nn?e:[t3,e]:[e,void 0]}function Of(e,t){return e instanceof S?e.u:Array.isArray(e)?mr(e,t,!1):void 0}function Yl(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function Ql(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=Gr(Jl,Yl,Ql,n).V,s||=Zl(n),o)}function Zl(e){let t=e[Zd];if(t!=null)return t;let r=Gr(Jl,Yl,Ql,e);return t=r.la?(n,o)=>Pf(n,o,r):(n,o)=>{let i=0|n[C];for(;_f(o)&&o.h!=4;){var s=o.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=r3(c))!=null&&(a=r[s]=c)}a!=null&&a(o,n,s)||(s=(a=o).l,es(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=vf(a.g,c)),s=n,a&&((c=s[Cn])?c.push(a):s[Cn]=[a]))}return 16384&i&&Bn(n),!0},e[Zd]=t}function r3(e){let t=(e=Df(e))[0].g;if(e=e[1]){let r=Zl(e),n=Gr(Jl,Yl,Ql,e).V;return(o,i,s)=>t(o,i,s,n,r)}return t}function Ps(e,t,r){e[t]=r.h}function Rs(e,t,r,n){let o,i,s=r.h;e[t]=(a,c,l)=>s(a,c,l,i||=Gr(Is,Ps,Rs,n).V,o||=Bf(n))}function Bf(e){let t=e[ep];if(!t){let r=Gr(Is,Ps,Rs,e);t=(n,o)=>Mf(n,o,r),e[ep]=t}return t}function Mf(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=tp(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=tp(r,o))&&a(t,i,o)}if(e=kl(e))for(In(t,t.g.end()),r=0;r<e.length;r++)In(t,bl(e[r])||new Uint8Array(0))}function tp(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=Df(r))[0].h;if(r=r[1]){let o=Bf(r),i=Gr(Is,Ps,Rs,r).V;r=e.la?Rf(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function jn(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 Nn(e,t,r)}function Vn(e,t,r){return new Nn(e,t,r)}function Be(e,t,r){ne(e,0|e[C],t,r)}var n3=Ts((function(e,t,r,n,o){return e.h===2&&(e=Vo(e,mr([void 0,void 0],n,!0),o),vr(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=pf(o)),o.push(e)):ne(t,n,r,[e]),!0)}),(function(e,t,r,n,o){if(t instanceof lt)t.forEach(((i,s)=>{ds(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)&&ds(e,r,mr(s,n,!1),o)}}));function Lf(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(Tl(64,n));if(_s(n)){if(o==="string")return Pl(n);if(o==="number")return Il(n)}})(t),t!=null&&(typeof t=="string"&&Qd(t),t!=null))switch(Ye(e,r,0),typeof t){case"number":e=e.g,An(t),_n(e,W,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new il(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),_n(e.g,r.h,r.g);break;default:r=Qd(t),_n(e.g,r.h,r.g)}}function Uf(e,t,r){(t=Mn(t))!=null&&t!=null&&(Ye(e,r,0),As(e.g,t))}function Ff(e,t,r){(t=of(t))!=null&&(Ye(e,r,0),e.g.g.push(t?1:0))}function Nf(e,t,r){(t=xn(t))!=null&&xs(e,r,qp(t))}function jf(e,t,r,n,o){ds(e,r,Of(t,n),o)}function Vf(e,t,r){(t=t==null||typeof t=="string"||Fo(t)||t instanceof er?t:void 0)!=null&&xs(e,r,jl(t).buffer)}function Hf(e,t,r){return(e.h===5||e.h===2)&&(t=Un(t,0|t[C],r,!1,!1),e.h==2?Cs(e,nl,t):t.push(nl(e.g)),!0)}var Yt=Oe((function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=rl(n);let o=rl(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&&(Ye(e,r,1),e=e.g,(r=nf||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),W=r.getUint32(0,!0),ce=r.getUint32(4,!0),Lo(e,W),Lo(e,ce))}),Et()),ye=Oe((function(e,t,r){return e.h===5&&(Be(t,r,nl(e.g)),!0)}),(function(e,t,r){(t=_r(t))!=null&&(Ye(e,r,5),e=e.g,El(t),Lo(e,W))}),Xl),o3=Vn(Hf,(function(e,t,r){if((t=jn(_r,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ye(n,o,5),n=n.g,El(i),Lo(n,W))}}),Xl),eh=Vn(Hf,(function(e,t,r){if((t=jn(_r,t))!=null&&t.length){Ye(e,r,2),Fn(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,El(t[n]),Lo(r,W)}}),Xl),br=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Vl(e.g,Al)),!0)}),Lf,Af),$c=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=Vl(e.g,Al))===0?void 0:e),!0)}),Lf,Af),i3=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Vl(e.g,Cl)),!0)}),(function(e,t,r){if((t=jy(t))!=null&&(typeof t=="string"&&Yd(t),t!=null))switch(Ye(e,r,0),typeof t){case"number":e=e.g,An(t),_n(e,W,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new ol(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),_n(e.g,r.h,r.g);break;default:r=Yd(t),_n(e.g,r.h,r.g)}}),Et()),le=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),Uf,Kl),Ds=Vn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Un(t,0|t[C],r,!1,!1),e.h==2?Cs(e,yr,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=jn(Mn,t))!=null&&t.length){r=$l(e,r);for(let n=0;n<t.length;n++)As(e.g,t[n]);Wl(e,r)}}),Kl),bn=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=yr(e.g))===0?void 0:e),!0)}),Uf,Kl),Z=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Hl(e.g)),!0)}),Ff,Ef),Sn=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=Hl(e.g))===!1?void 0:e),!0)}),Ff,Ef),Pe=Vn((function(e,t,r){return e.h===2&&(e=zl(e),Un(t,0|t[C],r,!1).push(e),!0)}),(function(e,t,r){if((t=jn(xn,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&xs(n,o,qp(i))}}),Gl),fr=Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=zl(e))===""?void 0:e),!0)}),Nf,Gl),j=Oe((function(e,t,r){return e.h===2&&(Be(t,r,zl(e)),!0)}),Nf,Gl),Se=(function(e,t,r=ql){return new Nn(e,t,r)})((function(e,t,r,n,o){return e.h===2&&(n=mr(void 0,n,!0),Un(t,0|t[C],r,!0).push(n),Vo(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)jf(e,t[i],r,n,o)})),z=Ts((function(e,t,r,n,o,i){return e.h===2&&(ff(t,0|t[C],i,r),Vo(e,t=Fl(t,n,r),o),!0)}),jf),zf=Oe((function(e,t,r){return e.h===2&&(Be(t,r,Sf(e)),!0)}),Vf,xf),s3=Vn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Un(t,0|t[C],r,!1,!1),e.h==2?Cs(e,nr,t):t.push(nr(e.g)),!0)}),(function(e,t,r){if((t=jn(sf,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ye(n,o,0),Fn(n.g,i))}}),Cf),a3=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=sf(t))!=null&&t!=null&&(Ye(e,r,0),Fn(e.g,t))}),Cf),ut=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),(function(e,t,r){(t=Mn(t))!=null&&(t=parseInt(t,10),Ye(e,r,0),As(e.g,t))}),Tf),sl=class{constructor(t,r){this.h=t,this.g=r,this.l=U,this.m=x,this.defaultValue=void 0}};function Ct(e,t){return new sl(e,t)}function Sr(e,t){return(r,n)=>{if(Xi.length){let i=Xi.pop();i.o(n),zc(i.g,r,n),r=i}else r=new class{constructor(i,s){if(Jd.length){let a=Jd.pop();zc(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,zc(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;Zl(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.h=-1,Xi.length<100&&Xi.push(r)}return o}}function Os(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}}}};Mf(this.u,t,Gr(Is,Ps,Rs,e)),In(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 rp=class extends S{constructor(e){super(e)}},np=[0,fr,Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=Sf(e))===qr()?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&&xs(e,r,jl(t).buffer)))}if(Array.isArray(t))return}Vf(e,t,r)}),xf)],Wc,op=globalThis.trustedTypes;function ip(e){Wc===void 0&&(Wc=(function(){let r=null;if(!op)return r;try{let n=o=>o;r=op.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Wc;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function c3(e,...t){if(t.length===0)return ip(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return ip(r)}var $f=[0,le,ut,Z,-1,Ds,ut,-1],l3=class extends S{constructor(e){super(e)}},Wf=[0,Z,j,Z,ut,-1,Vn((function(e,t,r){return(e.h===0||e.h===2)&&(t=Un(t,0|t[C],r,!1,!1),e.h==2?Cs(e,Jy,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=jn(Mn,t))!=null&&t.length){r=$l(e,r);for(let n=0;n<t.length;n++)As(e.g,t[n]);Wl(e,r)}}),Tf),j,-1,[0,Z,-1],ut,Z,-1],qf=[0,j,-2],sp=class extends S{constructor(e){super(e)}},Gf=[0],Kf=[0,le,Z,1,Z,-3],Je=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,Gf,z,Wf,z,qf,z,Kf,z,$f,z,[0,j,-2],z,[0,j,ut],z,[0,ut,j]],[0,j],Z,[0,[1,3],[2,4],z,[0,Ds],-1,z,[0,Pe],-1,Se,[0,j,-1]],j];var ap=[0,$c,-1,Sn,-3,$c,Ds,fr,bn,$c,-1,Sn,bn,Sn,-2,fr];function Qe(e,t){tl(e,2,Ln(t),"")}function K(e,t){Es(e,3,t)}function L(e,t){Es(e,4,t)}var De=class extends S{constructor(e){super(e,500)}o(e){return x(this,0,7,e)}},Ro=[-1,{}],cp=[0,j,1,Ro],lp=[0,j,Pe,Ro];function Ze(e,t){hs(e,1,De,t)}function Y(e,t){Es(e,10,t)}function F(e,t){Es(e,15,t)}var ze=class extends S{constructor(e){super(e,500)}o(e){return x(this,0,1001,e)}},Xf=[-500,Se,[-500,fr,-1,Pe,-3,[-2,be,Z],Se,np,bn,-1,cp,lp,Se,[0,fr,Sn],fr,ap,bn,Pe,987,Pe],4,Se,[-500,j,-1,[-1,{}],998,j],Se,[-500,j,Pe,-1,[-2,{},Z],997,Pe,-1],bn,Se,[-500,j,Pe,Ro,998,Pe],Pe,bn,cp,lp,Se,[0,fr,-1,Ro],Pe,-2,ap,fr,-1,Sn,[0,Sn,a3],978,Ro,Se,np];ze.prototype.g=Os(Xf);var h3=Sr(ze,Xf),u3=class extends S{constructor(e){super(e)}},Jf=class extends S{constructor(e){super(e)}g(){return rr(this,u3,1)}},Yf=[0,Se,[0,le,ye,j,-1]],Bs=Sr(Jf,Yf),d3=class extends S{constructor(e){super(e)}},p3=class extends S{constructor(e){super(e)}},qc=class extends S{constructor(e){super(e)}h(){return U(this,d3,2)}g(){return rr(this,p3,5)}},Qf=Sr(class extends S{constructor(e){super(e)}},[0,Pe,Ds,eh,[0,ut,[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]),Zf=class extends S{constructor(e){super(e)}},kn=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),em=class extends S{constructor(e){super(e)}},Ho=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),f3=class extends S{constructor(e){super(e)}},m3=[0,le,-1,eh,ut],tm=class extends S{constructor(e){super(e)}};tm.prototype.g=Os([0,ye,-4,br]);var g3=class extends S{constructor(e){super(e)}},y3=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,1,le,j,Yf],br]),hp=class extends S{constructor(e){super(e)}},b3=class extends S{constructor(e){super(e)}oa(){let e=df(this);return e??qr()}},w3=class extends S{constructor(e){super(e)}},rm=[1,2],v3=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,rm,z,[0,eh],z,[0,zf],le,j],br]),th=class extends S{constructor(e){super(e)}},nm=[0,j,le,ye,Pe,-1],up=class extends S{constructor(e){super(e)}},_3=[0,Z,-1],dp=class extends S{constructor(e){super(e)}},ts=[1,2,3,4,5],ps=class extends S{constructor(e){super(e)}g(){return df(this)!=null}h(){return ht(this,2)!=null}},ee=class extends S{constructor(e){super(e)}g(){return of(Tn(this,2))??!1}},om=[0,zf,j,[0,le,br,-1],[0,i3,br]],fe=[0,om,Z,[0,ts,z,Kf,z,Wf,z,$f,z,Gf,z,qf],ut],Ms=class extends S{constructor(e){super(e)}},rh=[0,fe,ye,-1,le],S3=Ct(502141897,Ms);be[502141897]=rh;var k3=Sr(class extends S{constructor(e){super(e)}},[0,[0,ut,-1,o3,s3],m3]),im=class extends S{constructor(e){super(e)}},sm=class extends S{constructor(e){super(e)}},nh=[0,fe,ye,[0,fe],Z],am=[0,fe,rh,nh,ye,[0,[0,om]]],E3=Ct(508968150,sm);be[508968150]=am,be[508968149]=nh;var cm=class extends S{constructor(e){super(e)}},C3=Ct(513916220,cm);be[513916220]=[0,fe,am,le];var gn=class extends S{constructor(e){super(e)}h(){return U(this,th,2)}g(){G(this,2)}},lm=[0,fe,nm];be[478825465]=lm;var A3=class extends S{constructor(e){super(e)}},hm=class extends S{constructor(e){super(e)}},oh=class extends S{constructor(e){super(e)}},ih=class extends S{constructor(e){super(e)}},um=class extends S{constructor(e){super(e)}},pp=[0,fe,[0,fe],lm,-1],dm=[0,fe,ye,le],sh=[0,fe,ye],pm=[0,fe,dm,sh,ye],x3=Ct(479097054,um);be[479097054]=[0,fe,pm,pp],be[463370452]=pp,be[464864288]=dm;var T3=Ct(462713202,ih);be[462713202]=pm,be[474472470]=sh;var I3=class extends S{constructor(e){super(e)}},fm=class extends S{constructor(e){super(e)}},mm=class extends S{constructor(e){super(e)}},gm=class extends S{constructor(e){super(e)}},ah=[0,fe,ye,-1,le],al=[0,fe,ye,Z];gm.prototype.g=Os([0,fe,sh,[0,fe],rh,nh,ah,al]);var ym=class extends S{constructor(e){super(e)}},P3=Ct(456383383,ym);be[456383383]=[0,fe,nm];var bm=class extends S{constructor(e){super(e)}},R3=Ct(476348187,bm);be[476348187]=[0,fe,_3];var wm=class extends S{constructor(e){super(e)}},fp=class extends S{constructor(e){super(e)}},vm=[0,ut,-1],D3=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=fp;let a=2&o,c=!1;if(i==null){if(a)return Xd();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 Xd();c||(c=!0,Bn(i))}else c&&(c=!1,i=pf(i));return c||(64&(0|i[C])?i[C]&=-33:32&o&&gs(i,32)),ne(n,o,2,s=new lt(i,s,Vy,void 0)),s})(e,t,or(e,t,2)),!r&&fp&&(e.ra=!0),e}});be[458105876]=[0,vm,n3,[!0,br,[0,j,-1,Pe]]];var ch=class extends S{constructor(e){super(e)}},_m=Ct(458105758,ch);be[458105758]=[0,fe,j,vm];var Sm=class extends S{constructor(e){super(e)}},O3=Ct(443442058,Sm);be[443442058]=[0,fe,j,le,ye,Pe,-1,Z,ye],be[514774813]=ah;var km=class extends S{constructor(e){super(e)}},B3=Ct(516587230,km);function cl(e,t){return t=t?t.clone():new th,e.displayNamesLocale!==void 0?G(t,1,Ln(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?us(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&G(t,4),e.categoryDenylist!==void 0?us(t,5,e.categoryDenylist):"categoryDenylist"in e&&G(t,5),t}function lh(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 Em(e){var t=zr(e,3,_r,Hr()),r=zr(e,2,Mn,Hr()),n=zr(e,1,xn,Hr()),o=zr(e,9,xn,Hr());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=U(e,qc,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}),U(e,qc,4)?.g().length)for(let s of U(e,qc,4).g())i.keypoints.push({x:Zi(s,1)??0,y:Zi(s,2)??0,score:Zi(s,4)??0,label:ht(s,3)??""});return i}function Ls(e){let t=[];for(let r of rr(e,em,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 Do(e){let t=[];for(let r of rr(e,Zf,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 mp(e){return Array.from(e,(t=>t>127?t-256:t))}function gp(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 Ji;be[516587230]=[0,fe,ah,al,ye],be[518928384]=al;var M3=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 Cm(){if(Ji===void 0)try{await WebAssembly.instantiate(M3),Ji=!0}catch{Ji=!1}return Ji}async function Co(e,t=c3``){let r=await Cm()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var dr=class{};function Am(){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 yp(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 xm(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 bp(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]=xm(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 wp(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 ur(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)}}dr.forVisionTasks=function(e){return Co("vision",e)},dr.forTextTasks=function(e){return Co("text",e)},dr.forGenAiExperimentalTasks=function(e){return Co("genai_experimental",e)},dr.forGenAiTasks=function(e){return Co("genai",e)},dr.forAudioTasks=function(e){return Co("audio",e)},dr.isSimdSupported=function(){return Cm()};async function L3(e,t,r,n){return e=await(async(o,i,s,a,c)=>{if(i&&await yp(i),!self.ModuleFactory||s&&(await yp(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 Gc(e,t){let r=U(e.baseOptions,ps,1)||new ps;typeof t=="string"?(G(r,2,Ln(t)),G(r,1)):t instanceof Uint8Array&&(G(r,1,Sl(t,!1)),G(r,2)),x(e.baseOptions,0,1,r)}function vp(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 v(e,t){e.B=Math.max(e.B,t)}function Us(e,t){e.A=new De,Qe(e.A,"PassThroughCalculator"),K(e.A,"free_memory"),L(e.A,"free_memory_unused_out"),Y(t,"free_memory"),Ze(t,e.A)}function Pn(e,t){K(e.A,t),L(e.A,t+"_unused_out")}function Fs(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var rs=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(!(U(this.baseOptions,ps,1)?.g()||U(this.baseOptions,ps,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=U(n.baseOptions,dp,3);if(!i){var s=i=new dp,a=new sp;Po(s,4,ts,a)}"delegate"in o&&(o.delegate==="GPU"?(o=i,s=new l3,Po(o,2,ts,s)):(o=i,s=new sp,Po(o,4,ts,s))),x(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),Gc(this,"/model.dat"),this.m(),this.I()}));if(r.modelAssetBuffer instanceof Uint8Array)Gc(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=>{Gc(this,n),this.m(),this.I()}))}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da((t=>{e=h3(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,vp(this)}finishProcessing(){this.g.finishProcessing(),vp(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}rs.prototype.close=rs.prototype.close,(function(e,t){e=e.split(".");var r,n=Wr;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",rs);var ll=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 _p(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 Sp(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 ll(r,n,o,i)}function hh(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function zo(e,t,r,n){return hh(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Sp(e,!0)),r=e.s):(e.v||(e.v=Sp(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function wr(e,t,r){return hh(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 Ns(e,t,r){hh(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 uh(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Hn=class{G(){return`
7
+ `);let s=iw(t,r,o),a=Rc.getSymbolSize(t),c=new Kv(a);return ew(c,t),tw(c),rw(c,t),uu(c,r,0),t>=7&&nw(c,t),ow(c,s),isNaN(n)&&(n=pu.getBestMask(c,uu.bind(null,c,r))),pu.applyMask(n,c),uu(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}H2.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=hu.M,o,i;return typeof r<"u"&&(n=hu.from(r.errorCorrectionLevel,hu.M),o=Pc.from(r.version),i=pu.from(r.maskPattern),r.toSJISFunc&&Rc.setToSJISFunction(r.toSJISFunc)),aw(t,o,n,i)}});var mu=H(pn=>{function W2(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:W2(t.color.dark||"#000000ff"),light:W2(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 p=(h*a+d)*4,b=n.color.light;if(h>=c&&d>=c&&h<a-c&&d<a-c){let f=Math.floor((h-c)/s),g=Math.floor((d-c)/s);b=l[i[f*o+g]?1:0]}t[p++]=b.r,t[p++]=b.g,t[p++]=b.b,t[p]=b.a}}});var $2=H(Dc=>{var gu=mu();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")}}Dc.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=gu.getOptions(o);let s=gu.getImageWidth(t.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return gu.qrToImageData(c.data,t,o),cw(a,i,s),a.putImageData(c,0,0),i};Dc.renderToDataURL=function(t,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=Dc.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var K2=H(G2=>{var hw=mu();function q2(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function yu(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?yu("M",c+r,.5+l+r):yu("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=yu("h",s),s=0)):o++}return n}G2.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 "+q2(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+q2(o.color.dark,"stroke")+' d="'+dw(s,i,o.margin)+'"/>',h='viewBox="0 0 '+a+" "+a+'"',p='<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,p),p}});var J2=H(Mi=>{var uw=Q0(),bu=z2(),X2=$2(),pw=K2();function vu(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=bu.create(r,n);c(e(h,t,n))}catch(h){l(h)}})}try{let c=bu.create(r,n);o(null,e(c,t,n))}catch(c){o(c)}}Mi.create=bu.create;Mi.toCanvas=vu.bind(null,X2.render);Mi.toDataURL=vu.bind(null,X2.renderToDataURL);Mi.toString=vu.bind(null,function(e,t,r){return pw.render(e,r)})});async function qi(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function Gi(){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 qr=typeof self<"u"?self:{};function Hr(){throw Error("Invalid UTF8")}function Mu(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Ki,Nc,vy=typeof TextDecoder<"u",wy,_y=typeof TextEncoder<"u";function Gp(e){if(_y)e=(wy||=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 bl,as;e:{for(jc=["CLOSURE_FLAGS"],Xi=qr,Ji=0;Ji<jc.length;Ji++)if((Xi=Xi[jc[Ji]])==null){as=null;break e}as=Xi}var jc,Xi,Ji,jo,Lu=as&&as[610401301];bl=Lu!=null&&Lu;var Uu=qr.navigator;function Qc(e){return!!bl&&!!jo&&jo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function at(e){var t;return(t=qr.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function pr(){return!!bl&&!!jo&&jo.brands.length>0}function Vc(){return pr()?Qc("Chromium"):(at("Chrome")||at("CriOS"))&&!(!pr()&&at("Edge"))||at("Silk")}function vl(e){return vl[" "](e),e}jo=Uu&&Uu.userAgentData||null,vl[" "]=function(){};var Sy=!pr()&&(at("Trident")||at("MSIE"));!at("Android")||Vc(),Vc(),at("Safari")&&(Vc()||!pr()&&at("Coast")||!pr()&&at("Opera")||!pr()&&at("Edge")||(pr()?Qc("Microsoft Edge"):at("Edg/"))||pr()&&Qc("Opera"));var Kp={},Bo=null;function ky(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=Bo[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}Xp();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),p=a(64);if(p===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),p!=64&&s(d<<6&192|p))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function Xp(){if(!Bo){Bo={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));Kp[r]=n;for(let o=0;o<n.length;o++){let i=n[o];Bo[i]===void 0&&(Bo[i]=o)}}}}var Jp=typeof Uint8Array<"u",Yp=!Sy&&typeof btoa=="function";function Fu(e){if(!Yp){var t;t===void 0&&(t=0),Xp(),t=Kp[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 Nu=/[-_.]/g,Ey={"-":"+",_:"/",".":"="};function Cy(e){return Ey[e]||""}function Qp(e){if(!Yp)return ky(e);Nu.test(e)&&(e=e.replace(Nu,Cy)),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 $o(e){return Jp&&e!=null&&e instanceof Uint8Array}var An={};function Gr(){return xy||=new er(null,An)}function wl(e){Zp(An);var t=e.g;return(t=t==null||$o(t)?t:typeof t=="string"?Qp(t):null)==null?t:e.g=t}var er=class{h(){return new Uint8Array(wl(this)||0)}constructor(e,t){if(Zp(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},xy,Ay;function Zp(e){if(e!==An)throw Error("illegal external caller")}function ef(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Zc(e){return ef(e=Error(e),"warning"),e}var ys=typeof Symbol=="function"&&typeof Symbol()=="symbol",Ty=new Set;function qo(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&&Ty.add(e),e}var Iy=qo("jas",void 0,!0,!0),ju=qo(void 0,"0di"),Hc=qo(void 0,"2ex"),Ro=qo(void 0,"1oa",!0),Tn=qo(void 0,Symbol(),!0),C=ys?Iy:"Ga",tf={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},rf=Object.defineProperties;function bs(e,t){ys||C in e||rf(e,tf),e[C]|=t}function ge(e,t){ys||C in e||rf(e,tf),e[C]=t}function Un(e){return bs(e,34),e}function Py(e,t){ge(t,-30975&(0|e))}function el(e,t){ge(t,-30941&(34|e))}function _l(){return typeof BigInt=="function"}function Ve(e){return Array.prototype.slice.call(e)}var Sl,Go={},nf={};function Vu(e){return!(!e||typeof e!="object"||e.Ia!==nf)}function kl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function El(e,t){if(e!=null){if(typeof e=="string")e=e?new er(e,An):Gr();else if(e.constructor!==er)if($o(e))e=e.length?new er(new Uint8Array(e),An):Gr();else{if(!t)throw Error();e=void 0}}return e}function cs(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[C]))}var Hu=[];function wr(e){if(2&e)throw Error()}ge(Hu,55),Sl=Object.freeze(Hu);var ls=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 Cl(e){return Tn?e[Tn]:void 0}var Ry=Object.freeze({});function vs(e){return e.Qa=!0,e}var Dy=vs((e=>typeof e=="number")),zu=vs((e=>typeof e=="string")),Oy=vs((e=>typeof e=="boolean")),ws=typeof qr.BigInt=="function"&&typeof qr.BigInt(0)=="bigint",tl=vs((e=>ws?e>=My&&e<=Uy:e[0]==="-"?Wu(e,By):Wu(e,Ly))),By=Number.MIN_SAFE_INTEGER.toString(),My=ws?BigInt(Number.MIN_SAFE_INTEGER):void 0,Ly=Number.MAX_SAFE_INTEGER.toString(),Uy=ws?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Wu(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 Fy=typeof Uint8Array.prototype.slice=="function",of,$=0,ce=0;function $u(e){let t=e>>>0;$=t,ce=(e-t)/4294967296>>>0}function In(e){if(e<0){$u(-e);let[t,r]=Il($,ce);$=t>>>0,ce=r>>>0}else $u(e)}function xl(e){let t=of||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),ce=0,$=t.getUint32(0,!0)}function Al(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Vo(e,t)}function Tl(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Al(e,t))=="number"?r?-e:e:r?"-"+e:e}function Vo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else _l()?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+qu(r)+qu(e));return r}function qu(e){return e=String(e),"0000000".slice(e.length)+e}function _s(e){if(e.length<16)In(Number(e));else if(_l())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]=Il($,ce);$=n,ce=o}}}function Il(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var Pl=typeof BigInt=="function"?BigInt.asIntN:void 0,Ny=typeof BigInt=="function"?BigInt.asUintN:void 0,Sn=Number.isSafeInteger,Ss=Number.isFinite,hs=Math.trunc;function _r(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function sf(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var jy=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ks(e){switch(typeof e){case"bigint":return!0;case"number":return Ss(e);case"string":return jy.test(e);default:return!1}}function Fn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Ss(e)?0|e:void 0}function af(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Ss(e)?e>>>0:void 0}function Gu(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Rl(e){return e=hs(e),Sn(e)||(In(e),e=Tl($,ce)),e}function Dl(e){var t=hs(Number(e));if(Sn(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(_s(e),e=$,2147483648&(t=ce))if(_l())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Il(e,t);e="-"+Vo(r,n)}else e=Vo(e,t);return e}function ds(e){return e==null?e:typeof e=="bigint"?(tl(e)?e=Number(e):(e=Pl(64,e),e=tl(e)?Number(e):String(e)),e):ks(e)?typeof e=="number"?Rl(e):Dl(e):void 0}function Vy(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Ny(64,e));if(ks(e)){if(t==="string")return t=hs(Number(e)),Sn(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Gu(e)||(_s(e),e=Vo($,ce))),e;if(t==="number")return(e=hs(e))>=0&&Sn(e)?e:(function(r){if(r<0){In(r);var n=Vo($,ce);return r=Number(n),Sn(r)?r:n}return Gu(n=String(r))?n:(In(r),Al($,ce))})(e)}}function cf(e){if(typeof e!="string")throw Error();return e}function Nn(e){if(e!=null&&typeof e!="string")throw Error();return e}function Pn(e){return e==null||typeof e=="string"?e:void 0}function Ol(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===Go)return e;if(!Array.isArray(e))return r?2&n?((e=t[ju])||(Un((e=new t).u),e=t[ju]=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 Hy(e,t,r){if(t)e:{if(!ks(t=e))throw Zc("int64");switch(typeof t){case"string":t=Dl(t);break e;case"bigint":if(e=t=Pl(64,t),zu(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Dy(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=ws?BigInt(t):Oy(t)?t?"1":"0":zu(t)?t.trim()||"0":String(t);break e;default:t=Rl(t)}}else t=ds(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&Sn(t=+r)?t:r}var zy={},Wy=(function(){try{return vl(new class extends Map{constructor(){super()}}),!1}catch{return!0}})(),Lo=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()}},$y=Wy?(Object.setPrototypeOf(Lo.prototype,Map.prototype),Object.defineProperties(Lo.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Lo):class extends Map{constructor(){super()}};function Ku(e){return e}function zc(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var lt=class extends $y{constructor(e,t,r=Ku,n=Ku){super();let o=0|e[C];o|=64,ge(e,o),this.L=o,this.S=t,this.R=r,this.Y=this.S?qy: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=Xu){if(this.size!==0)return this.X(e)}X(e=Xu){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(){zc(this),super.clear()}delete(e){return zc(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new ls(e,Gy,this)}keys(){return this.Ha()}values(){var e=this.ma();return new ls(e,lt.prototype.get,this)}forEach(e,t){super.forEach(((r,n)=>{e.call(t,this.get(n),n,this)}))}set(e,t){return zc(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 qy(e,t,r,n,o,i){return e=Ol(e,n,r,i),o&&(e=Cs(e)),e}function Xu(e){return e}function Gy(e){return[e,this.get(e)]}var Ky,lf,Xy;function Ju(){return Ky||=new lt(Un([]),void 0,void 0,void 0,zy)}function Bl(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=cs(e)?void 0:o&&2&(0|e[C])?e:Ml(e,t,r,n!==void 0,o);else if(kl(e)){let i={};for(let s in e)i[s]=Bl(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Ml(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]=Bl(n[a],t,r,s,o);return r&&((e=Cl(e))&&(n[Tn]=Ve(e)),r(i,n)),n}function Jy(e){return Bl(e,hf,void 0,void 0,!1)}function hf(e){return e.W===Go?e.toJSON():e instanceof lt?e.na(Jy):(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return tl(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(cs(t))return}else{if($o(t))return Fu(t);if(t instanceof er){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=Fu(r)}if(t instanceof lt)return t.na()}}return t})(e)}function df(e){return Ml(e,hf,void 0,void 0,!1)}function mr(e,t,r){return e=uf(e,t[0],t[1],r?1:2),t!==lf&&r&&bs(e,16384),e}function uf(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(kl(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 rl(e,t,r=el){if(e!=null){if(Jp&&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):Ml(e,rl,4&n?el:r,!0,!0))}return e.W===Go?e=2&(n=0|(r=e.u)[C])?e:new e.constructor(Es(r,n,!0)):e instanceof lt&&!(2&e.L)&&(r=Un(e.X(rl)),e=new lt(r,e.S,e.R,e.Y)),e}}function Es(e,t,r){let n=r||2&t?el:Py,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=Cl(i))&&(c[Tn]=Ve(i)),c})(e,t,(i=>rl(i,o,n))),bs(e,32|(r?2:0)),e}function Cs(e){let t=e.u,r=0|t[C];return 2&r?new e.constructor(Es(t,r,!1)):e}function Rn(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&&Hc!=null&&((o=(e=Ay??={})[Hc]||0)>=4||(e[Hc]=o+1,ef(e=Error(),"incident"),(function(s){qr.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 ts(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 pf(e){let t=0|(e=e.u)[C],r=or(e,t,1),n=El(r,!0);return n!=null&&n!==r&&ne(e,t,1,n),n}function zr(){return Ry===void 0?2:4}function Wr(e,t,r,n,o){let i=e.u,s=2&(e=0|i[C])?1:n;o=!!o;let a=0|(n=Ll(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 Ll(e,t,r,n){return e=or(e,t,r,n),Array.isArray(e)?e:Sl}function Ul(e,t){return e===0&&(e=tr(e,t)),1|e}function Zt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function ff(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]=Un(r[1]))}return e}function nl(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 jn(e,t,r,n,o){wr(t);var i=!(!(64&t)&&16384&t);let s=(o=Ll(e,t,r,o))!==Sl;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 Wc(e,t){var r=nm;return Nl(Fl(e=e.u),e,0|e[C],r)===t?t:-1}function Fl(e){if(ys)return e[Ro]??(e[Ro]=new Map);if(Ro in e)return e[Ro];let t=new Map;return Object.defineProperty(e,Ro,{value:t}),t}function mf(e,t,r,n){let o=Fl(e),i=Nl(o,e,t,r);return i!==n&&(i&&(t=ne(e,t,i)),o.set(r,n)),t}function Nl(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 jl(e,t,r,n){let o,i=0|e[C];if((n=or(e,i,r,n))!=null&&n.W===Go)return(t=Cs(n))!==n&&ne(e,i,r,t),t.u;if(Array.isArray(n)){let s=0|n[C];o=2&s?mr(Es(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 gf(e,t,r,n){let o=0|(e=e.u)[C];return(t=Ol(n=or(e,o,r,n),t,!1,o))!==n&&t!=null&&ne(e,o,r,t),t}function U(e,t,r,n=!1){if((t=gf(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[C]))){let o=Cs(t);o!==t&&ne(e,n,r,t=o)}return t}function yf(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=Ll(e,t,n))[C];if(!(a=!!(4&l))){var h=o,d=t;let p=!!(2&(l=Ul(l,t)));p&&(d|=2);let b=!p,f=!0,g=0,y=0;for(;g<h.length;g++){let v=Ol(h[g],r,!1,d);if(v instanceof r){if(!p){let _=!!(2&(0|v.u[C]));b&&=!_,f&&=_}h[y++]=v}}y<g&&(h.length=y),l|=4,l=f?16|l:-17&l,ge(h,l=b?8|l:-9&l),p&&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=Cs(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 yf(e,n,t,r,zr(),!1,!(2&n))}function A(e,t,r,n){return n==null&&(n=void 0),G(e,r,n)}function Uo(e,t,r,n){n==null&&(n=void 0);e:{let o=0|(e=e.u)[C];if(wr(o),n==null){let i=Fl(e);if(Nl(i,e,o,r)!==t)break e;i.set(r,0)}else o=mf(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 us(e,t,r,n){let o=0|e.u[C];wr(o),e=yf(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 Fn(Rn(e,t))}function ht(e,t){return Pn(Rn(e,t))}function pe(e,t){return ts(e,t)??0}function Ho(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"||!Ss(r))throw Zc("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 ps(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=cf(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 xs(e,t,r){wr(0|e.u[C]),Wr(e,t,Pn,2,!0).push(cf(r))}function bf(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Vl(){return Error("Failed to read varint, encoding is invalid.")}function vf(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Hl(e){if(typeof e=="string")return{buffer:Qp(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:wl(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 zl(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($r(e,a),r<128)return t(n>>>0,o>>>0);throw Vl()}function Wl(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 $r(e,r),!!(127&t)}throw Vl()}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 Vl();return $r(e,r),o}function nr(e){return yr(e)>>>0}function ol(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],$r(e,e.g+4),(n<<0|o<<8|i<<16|t<<24)>>>0}function il(e){var t=ol(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 Yy(e){return yr(e)}function $c(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=Hl(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function $r(e,t){if(e.g=t,t>e.l)throw vf(e.l,t)}function wf(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 vf(t,e.l-r);return e.g=n,r}function _f(e,t){if(t==0)return Gr();var r=wf(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):Fy?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Gr():new er(r,An)}lt.prototype.toJSON=void 0,lt.prototype.Ia=nf;var Yu=[];function Sf(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 bf(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 rs(e){switch(e.h){case 0:e.h!=0?rs(e):Wl(e.g);break;case 1:$r(e=e.g,e.g+8);break;case 2:if(e.h!=2)rs(e);else{var t=nr(e.g);$r(e=e.g,e.g+t)}break;case 5:$r(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Sf(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}rs(e)}break;default:throw bf(e.h,e.l)}}function Ko(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 $l(e){var t=nr(e.g),r=wf(e=e.g,t);if(e=e.h,vy){var n,o=e;(n=Nc)||(n=Nc=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(Ki===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Ki=!0}catch{Ki=!1}}throw!Ki&&(Nc=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?Hr():(a=e[i++],s<194||(192&a)!=128?(i--,Hr()):r.push((31&s)<<6|63&a)):s<240?i>=t-1?Hr():(a=e[i++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Hr()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?i>=t-2?Hr():(a=e[i++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(o=e[i++]))!=128?(i--,Hr()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Hr(),r.length>=8192&&(c=Mu(c,r),r.length=0)}i=Mu(c,r)}return i}function kf(e){let t=nr(e.g);return _f(e.g,t)}function As(e,t,r){var n=nr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Yi=[];function Qy(e){return e}var kn;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=uf(e,t)}toJSON(){let e=!kn;try{return e&&(kn=df),Ef(this)}finally{e&&(kn=void 0)}}l(){var e=O3;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(Es(e,0|e[C],!1))}N(){return!!(2&(0|this.u[C]))}};function Ef(e){var t=e.u;{t=(e=kn(t))!==t;let l=e.length;if(l){var r=e[l-1],n=kl(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)&&(cs(n)||Vu(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||cs(i)||Vu(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 Qu(e){return e?/^\d+$/.test(e)?(_s(e),new sl($,ce)):null:Zy||=new sl(0,0)}S.prototype.W=Go,S.prototype.toString=function(){try{return kn=Qy,Ef(this).toString()}finally{kn=void 0}};var sl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Zy;function Zu(e){return e?/^-?\d+$/.test(e)?(_s(e),new al($,ce)):null:e3||=new al(0,0)}var al=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},e3;function En(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 Vn(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Ts(e,t){if(t>=0)Vn(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function zo(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 Dn(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ye(e,t,r){Vn(e.g,8*t+r)}function ql(e,t){return Ye(e,t,2),t=e.g.end(),Dn(e,t),t.push(e.h),t}function Gl(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 Is(e,t,r){Ye(e,t,2),Vn(e.g,r.length),Dn(e,e.g.end()),Dn(e,r)}function fs(e,t,r,n){r!=null&&(t=ql(e,t),n(r,e),Gl(e,t))}function Et(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Kl=Et(),Cf=Et(),Xl=Et(),Jl=Et(),xf=Et(),Af=Et(),Yl=Et(),Tf=Et(),If=Et(),Hn=class{constructor(e,t,r){this.g=e,this.h=t,e=Kl,this.l=!!e&&r===e||!1}};function Ps(e,t){return new Hn(e,t,Kl)}function Pf(e,t,r,n,o){fs(e,r,Bf(t,n),o)}var t3=Ps((function(e,t,r,n,o){return e.h===2&&(Ko(e,jl(t,n,r),o),!0)}),Pf),r3=Ps((function(e,t,r,n,o){return e.h===2&&(Ko(e,jl(t,n,r,!0),o),!0)}),Pf),Rs=Symbol(),Ql=Symbol(),ep=Symbol(),tp=Symbol(),Rf,Df;function Kr(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 lf||=[0,void 0,!0];case"number":return d>0?void 0:d===0?Xy||=[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,Rf??=i,Df??=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 Hn?d=i:(d=t3,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 p=a[c];l?r(o,c,d,l,p):t(o,c,d,p)}}return n[e]=o}function Of(e){return Array.isArray(e)?e[0]instanceof Hn?e:[r3,e]:[e,void 0]}function Bf(e,t){return e instanceof S?e.u:Array.isArray(e)?mr(e,t,!1):void 0}function Zl(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function eh(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=Kr(Ql,Zl,eh,n).V,s||=th(n),o)}function th(e){let t=e[ep];if(t!=null)return t;let r=Kr(Ql,Zl,eh,e);return t=r.la?(n,o)=>Rf(n,o,r):(n,o)=>{let i=0|n[C];for(;Sf(o)&&o.h!=4;){var s=o.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=n3(c))!=null&&(a=r[s]=c)}a!=null&&a(o,n,s)||(s=(a=o).l,rs(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=_f(a.g,c)),s=n,a&&((c=s[Tn])?c.push(a):s[Tn]=[a]))}return 16384&i&&Un(n),!0},e[ep]=t}function n3(e){let t=(e=Of(e))[0].g;if(e=e[1]){let r=th(e),n=Kr(Ql,Zl,eh,e).V;return(o,i,s)=>t(o,i,s,n,r)}return t}function Ds(e,t,r){e[t]=r.h}function Os(e,t,r,n){let o,i,s=r.h;e[t]=(a,c,l)=>s(a,c,l,i||=Kr(Rs,Ds,Os,n).V,o||=Mf(n))}function Mf(e){let t=e[tp];if(!t){let r=Kr(Rs,Ds,Os,e);t=(n,o)=>Lf(n,o,r),e[tp]=t}return t}function Lf(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=rp(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=rp(r,o))&&a(t,i,o)}if(e=Cl(e))for(Dn(t,t.g.end()),r=0;r<e.length;r++)Dn(t,wl(e[r])||new Uint8Array(0))}function rp(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=Of(r))[0].h;if(r=r[1]){let o=Mf(r),i=Kr(Rs,Ds,Os,r).V;r=e.la?Df(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function zn(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 Hn(e,t,r)}function Wn(e,t,r){return new Hn(e,t,r)}function Be(e,t,r){ne(e,0|e[C],t,r)}var o3=Ps((function(e,t,r,n,o){return e.h===2&&(e=Ko(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=ff(o)),o.push(e)):ne(t,n,r,[e]),!0)}),(function(e,t,r,n,o){if(t instanceof lt)t.forEach(((i,s)=>{fs(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)&&fs(e,r,mr(s,n,!1),o)}}));function Uf(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(Pl(64,n));if(ks(n)){if(o==="string")return Dl(n);if(o==="number")return Rl(n)}})(t),t!=null&&(typeof t=="string"&&Zu(t),t!=null))switch(Ye(e,r,0),typeof t){case"number":e=e.g,In(t),En(e,$,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new al(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),En(e.g,r.h,r.g);break;default:r=Zu(t),En(e.g,r.h,r.g)}}function Ff(e,t,r){(t=Fn(t))!=null&&t!=null&&(Ye(e,r,0),Ts(e.g,t))}function Nf(e,t,r){(t=sf(t))!=null&&(Ye(e,r,0),e.g.g.push(t?1:0))}function jf(e,t,r){(t=Pn(t))!=null&&Is(e,r,Gp(t))}function Vf(e,t,r,n,o){fs(e,r,Bf(t,n),o)}function Hf(e,t,r){(t=t==null||typeof t=="string"||$o(t)||t instanceof er?t:void 0)!=null&&Is(e,r,Hl(t).buffer)}function zf(e,t,r){return(e.h===5||e.h===2)&&(t=jn(t,0|t[C],r,!1,!1),e.h==2?As(e,il,t):t.push(il(e.g)),!0)}var Yt=Oe((function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=ol(n);let o=ol(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&&(Ye(e,r,1),e=e.g,(r=of||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),$=r.getUint32(0,!0),ce=r.getUint32(4,!0),zo(e,$),zo(e,ce))}),Et()),ye=Oe((function(e,t,r){return e.h===5&&(Be(t,r,il(e.g)),!0)}),(function(e,t,r){(t=_r(t))!=null&&(Ye(e,r,5),e=e.g,xl(t),zo(e,$))}),Yl),i3=Wn(zf,(function(e,t,r){if((t=zn(_r,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ye(n,o,5),n=n.g,xl(i),zo(n,$))}}),Yl),rh=Wn(zf,(function(e,t,r){if((t=zn(_r,t))!=null&&t.length){Ye(e,r,2),Vn(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,xl(t[n]),zo(r,$)}}),Yl),br=Oe((function(e,t,r){return e.h===0&&(Be(t,r,zl(e.g,Tl)),!0)}),Uf,Af),qc=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=zl(e.g,Tl))===0?void 0:e),!0)}),Uf,Af),s3=Oe((function(e,t,r){return e.h===0&&(Be(t,r,zl(e.g,Al)),!0)}),(function(e,t,r){if((t=Vy(t))!=null&&(typeof t=="string"&&Qu(t),t!=null))switch(Ye(e,r,0),typeof t){case"number":e=e.g,In(t),En(e,$,ce);break;case"bigint":r=BigInt.asUintN(64,t),r=new sl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),En(e.g,r.h,r.g);break;default:r=Qu(t),En(e.g,r.h,r.g)}}),Et()),le=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),Ff,Jl),Bs=Wn((function(e,t,r){return(e.h===0||e.h===2)&&(t=jn(t,0|t[C],r,!1,!1),e.h==2?As(e,yr,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=zn(Fn,t))!=null&&t.length){r=ql(e,r);for(let n=0;n<t.length;n++)Ts(e.g,t[n]);Gl(e,r)}}),Jl),_n=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=yr(e.g))===0?void 0:e),!0)}),Ff,Jl),Z=Oe((function(e,t,r){return e.h===0&&(Be(t,r,Wl(e.g)),!0)}),Nf,Cf),Cn=Oe((function(e,t,r){return e.h===0&&(Be(t,r,(e=Wl(e.g))===!1?void 0:e),!0)}),Nf,Cf),Pe=Wn((function(e,t,r){return e.h===2&&(e=$l(e),jn(t,0|t[C],r,!1).push(e),!0)}),(function(e,t,r){if((t=zn(Pn,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&Is(n,o,Gp(i))}}),Xl),fr=Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=$l(e))===""?void 0:e),!0)}),jf,Xl),j=Oe((function(e,t,r){return e.h===2&&(Be(t,r,$l(e)),!0)}),jf,Xl),Se=(function(e,t,r=Kl){return new Hn(e,t,r)})((function(e,t,r,n,o){return e.h===2&&(n=mr(void 0,n,!0),jn(t,0|t[C],r,!0).push(n),Ko(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)Vf(e,t[i],r,n,o)})),z=Ps((function(e,t,r,n,o,i){return e.h===2&&(mf(t,0|t[C],i,r),Ko(e,t=jl(t,n,r),o),!0)}),Vf),Wf=Oe((function(e,t,r){return e.h===2&&(Be(t,r,kf(e)),!0)}),Hf,Tf),a3=Wn((function(e,t,r){return(e.h===0||e.h===2)&&(t=jn(t,0|t[C],r,!1,!1),e.h==2?As(e,nr,t):t.push(nr(e.g)),!0)}),(function(e,t,r){if((t=zn(af,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&(Ye(n,o,0),Vn(n.g,i))}}),xf),c3=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=af(t))!=null&&t!=null&&(Ye(e,r,0),Vn(e.g,t))}),xf),dt=Oe((function(e,t,r){return e.h===0&&(Be(t,r,yr(e.g)),!0)}),(function(e,t,r){(t=Fn(t))!=null&&(t=parseInt(t,10),Ye(e,r,0),Ts(e.g,t))}),If),cl=class{constructor(t,r){this.h=t,this.g=r,this.l=U,this.m=A,this.defaultValue=void 0}};function Ct(e,t){return new cl(e,t)}function Sr(e,t){return(r,n)=>{if(Yi.length){let i=Yi.pop();i.o(n),$c(i.g,r,n),r=i}else r=new class{constructor(i,s){if(Yu.length){let a=Yu.pop();$c(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,$c(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;th(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.h=-1,Yi.length<100&&Yi.push(r)}return o}}function Ms(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}}}};Lf(this.u,t,Kr(Rs,Ds,Os,e)),Dn(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 np=class extends S{constructor(e){super(e)}},op=[0,fr,Oe((function(e,t,r){return e.h===2&&(Be(t,r,(e=kf(e))===Gr()?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&&Is(e,r,Hl(t).buffer)))}if(Array.isArray(t))return}Hf(e,t,r)}),Tf)],Gc,ip=globalThis.trustedTypes;function sp(e){Gc===void 0&&(Gc=(function(){let r=null;if(!ip)return r;try{let n=o=>o;r=ip.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Gc;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function l3(e,...t){if(t.length===0)return sp(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return sp(r)}var $f=[0,le,dt,Z,-1,Bs,dt,-1],h3=class extends S{constructor(e){super(e)}},qf=[0,Z,j,Z,dt,-1,Wn((function(e,t,r){return(e.h===0||e.h===2)&&(t=jn(t,0|t[C],r,!1,!1),e.h==2?As(e,Yy,t):t.push(yr(e.g)),!0)}),(function(e,t,r){if((t=zn(Fn,t))!=null&&t.length){r=ql(e,r);for(let n=0;n<t.length;n++)Ts(e.g,t[n]);Gl(e,r)}}),If),j,-1,[0,Z,-1],dt,Z,-1],Gf=[0,j,-2],ap=class extends S{constructor(e){super(e)}},Kf=[0],Xf=[0,le,Z,1,Z,-3],Je=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,Kf,z,qf,z,Gf,z,Xf,z,$f,z,[0,j,-2],z,[0,j,dt],z,[0,dt,j]],[0,j],Z,[0,[1,3],[2,4],z,[0,Bs],-1,z,[0,Pe],-1,Se,[0,j,-1]],j];var cp=[0,qc,-1,Cn,-3,qc,Bs,fr,_n,qc,-1,Cn,_n,Cn,-2,fr];function Qe(e,t){nl(e,2,Nn(t),"")}function K(e,t){xs(e,3,t)}function L(e,t){xs(e,4,t)}var De=class extends S{constructor(e){super(e,500)}o(e){return A(this,0,7,e)}},Fo=[-1,{}],lp=[0,j,1,Fo],hp=[0,j,Pe,Fo];function Ze(e,t){us(e,1,De,t)}function Y(e,t){xs(e,10,t)}function F(e,t){xs(e,15,t)}var ze=class extends S{constructor(e){super(e,500)}o(e){return A(this,0,1001,e)}},Jf=[-500,Se,[-500,fr,-1,Pe,-3,[-2,be,Z],Se,op,_n,-1,lp,hp,Se,[0,fr,Cn],fr,cp,_n,Pe,987,Pe],4,Se,[-500,j,-1,[-1,{}],998,j],Se,[-500,j,Pe,-1,[-2,{},Z],997,Pe,-1],_n,Se,[-500,j,Pe,Fo,998,Pe],Pe,_n,lp,hp,Se,[0,fr,-1,Fo],Pe,-2,cp,fr,-1,Cn,[0,Cn,c3],978,Fo,Se,op];ze.prototype.g=Ms(Jf);var d3=Sr(ze,Jf),u3=class extends S{constructor(e){super(e)}},Yf=class extends S{constructor(e){super(e)}g(){return rr(this,u3,1)}},Qf=[0,Se,[0,le,ye,j,-1]],Ls=Sr(Yf,Qf),p3=class extends S{constructor(e){super(e)}},f3=class extends S{constructor(e){super(e)}},Kc=class extends S{constructor(e){super(e)}h(){return U(this,p3,2)}g(){return rr(this,f3,5)}},Zf=Sr(class extends S{constructor(e){super(e)}},[0,Pe,Bs,rh,[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]),em=class extends S{constructor(e){super(e)}},xn=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),tm=class extends S{constructor(e){super(e)}},Xo=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,ye,-4]]),m3=class extends S{constructor(e){super(e)}},g3=[0,le,-1,rh,dt],rm=class extends S{constructor(e){super(e)}};rm.prototype.g=Ms([0,ye,-4,br]);var y3=class extends S{constructor(e){super(e)}},b3=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,1,le,j,Qf],br]),dp=class extends S{constructor(e){super(e)}},v3=class extends S{constructor(e){super(e)}oa(){let e=pf(this);return e??Gr()}},w3=class extends S{constructor(e){super(e)}},nm=[1,2],_3=Sr(class extends S{constructor(e){super(e)}},[0,Se,[0,nm,z,[0,rh],z,[0,Wf],le,j],br]),nh=class extends S{constructor(e){super(e)}},om=[0,j,le,ye,Pe,-1],up=class extends S{constructor(e){super(e)}},S3=[0,Z,-1],pp=class extends S{constructor(e){super(e)}},ns=[1,2,3,4,5],ms=class extends S{constructor(e){super(e)}g(){return pf(this)!=null}h(){return ht(this,2)!=null}},ee=class extends S{constructor(e){super(e)}g(){return sf(Rn(this,2))??!1}},im=[0,Wf,j,[0,le,br,-1],[0,s3,br]],fe=[0,im,Z,[0,ns,z,Xf,z,qf,z,$f,z,Kf,z,Gf],dt],Us=class extends S{constructor(e){super(e)}},oh=[0,fe,ye,-1,le],k3=Ct(502141897,Us);be[502141897]=oh;var E3=Sr(class extends S{constructor(e){super(e)}},[0,[0,dt,-1,i3,a3],g3]),sm=class extends S{constructor(e){super(e)}},am=class extends S{constructor(e){super(e)}},ih=[0,fe,ye,[0,fe],Z],cm=[0,fe,oh,ih,ye,[0,[0,im]]],C3=Ct(508968150,am);be[508968150]=cm,be[508968149]=ih;var lm=class extends S{constructor(e){super(e)}},x3=Ct(513916220,lm);be[513916220]=[0,fe,cm,le];var vn=class extends S{constructor(e){super(e)}h(){return U(this,nh,2)}g(){G(this,2)}},hm=[0,fe,om];be[478825465]=hm;var A3=class extends S{constructor(e){super(e)}},dm=class extends S{constructor(e){super(e)}},sh=class extends S{constructor(e){super(e)}},ah=class extends S{constructor(e){super(e)}},um=class extends S{constructor(e){super(e)}},fp=[0,fe,[0,fe],hm,-1],pm=[0,fe,ye,le],ch=[0,fe,ye],fm=[0,fe,pm,ch,ye],T3=Ct(479097054,um);be[479097054]=[0,fe,fm,fp],be[463370452]=fp,be[464864288]=pm;var I3=Ct(462713202,ah);be[462713202]=fm,be[474472470]=ch;var P3=class extends S{constructor(e){super(e)}},mm=class extends S{constructor(e){super(e)}},gm=class extends S{constructor(e){super(e)}},ym=class extends S{constructor(e){super(e)}},lh=[0,fe,ye,-1,le],ll=[0,fe,ye,Z];ym.prototype.g=Ms([0,fe,ch,[0,fe],oh,ih,lh,ll]);var bm=class extends S{constructor(e){super(e)}},R3=Ct(456383383,bm);be[456383383]=[0,fe,om];var vm=class extends S{constructor(e){super(e)}},D3=Ct(476348187,vm);be[476348187]=[0,fe,S3];var wm=class extends S{constructor(e){super(e)}},mp=class extends S{constructor(e){super(e)}},_m=[0,dt,-1],O3=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=mp;let a=2&o,c=!1;if(i==null){if(a)return Ju();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 Ju();c||(c=!0,Un(i))}else c&&(c=!1,i=ff(i));return c||(64&(0|i[C])?i[C]&=-33:32&o&&bs(i,32)),ne(n,o,2,s=new lt(i,s,Hy,void 0)),s})(e,t,or(e,t,2)),!r&&mp&&(e.ra=!0),e}});be[458105876]=[0,_m,o3,[!0,br,[0,j,-1,Pe]]];var hh=class extends S{constructor(e){super(e)}},Sm=Ct(458105758,hh);be[458105758]=[0,fe,j,_m];var km=class extends S{constructor(e){super(e)}},B3=Ct(443442058,km);be[443442058]=[0,fe,j,le,ye,Pe,-1,Z,ye],be[514774813]=lh;var Em=class extends S{constructor(e){super(e)}},M3=Ct(516587230,Em);function hl(e,t){return t=t?t.clone():new nh,e.displayNamesLocale!==void 0?G(t,1,Nn(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?ps(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&G(t,4),e.categoryDenylist!==void 0?ps(t,5,e.categoryDenylist):"categoryDenylist"in e&&G(t,5),t}function dh(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 Cm(e){var t=Wr(e,3,_r,zr()),r=Wr(e,2,Fn,zr()),n=Wr(e,1,Pn,zr()),o=Wr(e,9,Pn,zr());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=U(e,Kc,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}),U(e,Kc,4)?.g().length)for(let s of U(e,Kc,4).g())i.keypoints.push({x:ts(s,1)??0,y:ts(s,2)??0,score:ts(s,4)??0,label:ht(s,3)??""});return i}function Fs(e){let t=[];for(let r of rr(e,tm,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 No(e){let t=[];for(let r of rr(e,em,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 gp(e){return Array.from(e,(t=>t>127?t-256:t))}function yp(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 Qi;be[516587230]=[0,fe,lh,ll,ye],be[518928384]=ll;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 xm(){if(Qi===void 0)try{await WebAssembly.instantiate(L3),Qi=!0}catch{Qi=!1}return Qi}async function Do(e,t=l3``){let r=await xm()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var ur=class{};function Am(){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 bp(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 Tm(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 vp(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]=Tm(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 wp(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 Do("vision",e)},ur.forTextTasks=function(e){return Do("text",e)},ur.forGenAiExperimentalTasks=function(e){return Do("genai_experimental",e)},ur.forGenAiTasks=function(e){return Do("genai",e)},ur.forAudioTasks=function(e){return Do("audio",e)},ur.isSimdSupported=function(){return xm()};async function U3(e,t,r,n){return e=await(async(o,i,s,a,c)=>{if(i&&await bp(i),!self.ModuleFactory||s&&(await bp(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 Xc(e,t){let r=U(e.baseOptions,ms,1)||new ms;typeof t=="string"?(G(r,2,Nn(t)),G(r,1)):t instanceof Uint8Array&&(G(r,1,El(t,!1)),G(r,2)),A(e.baseOptions,0,1,r)}function _p(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 Ns(e,t){e.A=new De,Qe(e.A,"PassThroughCalculator"),K(e.A,"free_memory"),L(e.A,"free_memory_unused_out"),Y(t,"free_memory"),Ze(t,e.A)}function On(e,t){K(e.A,t),L(e.A,t+"_unused_out")}function js(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var os=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(!(U(this.baseOptions,ms,1)?.g()||U(this.baseOptions,ms,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=U(n.baseOptions,pp,3);if(!i){var s=i=new pp,a=new ap;Uo(s,4,ns,a)}"delegate"in o&&(o.delegate==="GPU"?(o=i,s=new h3,Uo(o,2,ns,s)):(o=i,s=new ap,Uo(o,4,ns,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),Xc(this,"/model.dat"),this.m(),this.I()}));if(r.modelAssetBuffer instanceof Uint8Array)Xc(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=>{Xc(this,n),this.m(),this.I()}))}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da((t=>{e=d3(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,_p(this)}finishProcessing(){this.g.finishProcessing(),_p(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}os.prototype.close=os.prototype.close,(function(e,t){e=e.split(".");var r,n=qr;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",os);var dl=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 Sp(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 kp(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 dl(r,n,o,i)}function uh(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Jo(e,t,r,n){return uh(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=kp(e,!0)),r=e.s):(e.v||(e.v=kp(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 uh(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 Vs(e,t,r){uh(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 ph(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var $n=class{G(){return`
9
9
  precision mediump float;
10
10
  varying vec2 vTex;
11
11
  uniform sampler2D inputTexture;
12
12
  void main() {
13
13
  gl_FragColor = texture2D(inputTexture, vTex);
14
14
  }
15
- `}m(){let e=this.g;if(this.h=Re(e.createProgram(),"Failed to create WebGL program"),this.aa=_p(this,`
15
+ `}m(){let e=this.g;if(this.h=Re(e.createProgram(),"Failed to create WebGL program"),this.aa=Sp(this,`
16
16
  attribute vec2 aVertex;
17
17
  attribute vec2 aTex;
18
18
  varying vec2 vTex;
19
19
  void main(void) {
20
20
  gl_Position = vec4(aVertex, 0.0, 1.0);
21
21
  vTex = aTex;
22
- }`,e.VERTEX_SHADER),this.Z=_p(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()}},U3=class extends Hn{G(){return`
22
+ }`,e.VERTEX_SHADER),this.Z=Sp(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()}},F3=class extends $n{G(){return`
23
23
  precision mediump float;
24
24
  uniform sampler2D backgroundTexture;
25
25
  uniform sampler2D maskTexture;
@@ -31,7 +31,7 @@ Minimum version required to store current data is: `+i+`.
31
31
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
32
32
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
33
33
  }
34
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=wr(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=wr(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()}},F3=class extends Hn{G(){return`
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()}},N3=class extends $n{G(){return`
35
35
  precision mediump float;
36
36
  uniform sampler2D maskTexture;
37
37
  uniform sampler2D defaultTexture;
@@ -45,7 +45,7 @@ Minimum version required to store current data is: `+i+`.
45
45
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
46
46
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
47
47
  }
48
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=wr(this,e),e.activeTexture(e.TEXTURE2),this.B=wr(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 hl(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=Rn(e);var r=dh(e);if(Ns(r,n,Tm(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 Tm(e){let t=Qt(e,2);if(!t){let r=Rn(e);t=Pm(e);let n=hl(e),o=Im(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,n),ul(e)}return t}function Rn(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 Im(e){if(e=Rn(e),!Yi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Yi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Yi=e.R16F}return Yi}function dh(e){return e.l||(e.l=new Hn),e.l}function Pm(e){let t=Rn(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Qt(e,2);return r||(r=wr(dh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function ul(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Yi,_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&&--kp===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=hl(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return hl(this)}M(){return Tm(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=Rn(this),o=dh(this);n.activeTexture(n.TEXTURE1),r=wr(o,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let i=Im(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ns(o,n,r),zo(o,n,!1,(()=>{Pm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),ul(this)})),uh(o),ul(this)}}e.push(r)}return new _e(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Rn(this).deleteTexture(Qt(this,2)),kp=-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 kp=250,N3={color:"white",lineWidth:4,radius:6};function Kc(e){return{...N3,fillColor:(e=e||{}).color,...e}}function Jt(e,t){return e instanceof Function?e(t):e}function Ep(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function Ao(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Uo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Cp(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Hn;let o=Uo(e);r((e=new _e([n],t.m,!1,o.canvas,e.m,t.width,t.height)).M()),e.close()}}function Ap(e,t,r,n){let o=(function(a){return a.g||(a.g=new U3),a.g})(e),i=Uo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;zo(o,i,!0,(()=>{(function(c,l,h,u){let p=c.g;if(p.activeTexture(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,l),p.activeTexture(p.TEXTURE1),p.bindTexture(p.TEXTURE_2D,c.B),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,h),c.H&&(function(y,f){if(y!==f)return!1;y=y.entries(),f=f.entries();for(let[b,w]of y){y=b;let _=w;var g=f.next();if(g.done)return!1;let[A,B]=g.value;if(g=B,y!==A||_[0]!==g[0]||_[1]!==g[1]||_[2]!==g[2]||_[3]!==g[3])return!1}return!!f.next().done})(c.H,u))p.activeTexture(p.TEXTURE2),p.bindTexture(p.TEXTURE_2D,c.j);else{c.H=u;let y=Array(1024).fill(0);u.forEach(((f,g)=>{if(f.length!==4)throw Error(`Color at index ${g} is not a four-channel value.`);y[4*g]=f[0],y[4*g+1]=f[1],y[4*g+2]=f[2],y[4*g+3]=f[3]})),p.activeTexture(p.TEXTURE2),p.bindTexture(p.TEXTURE_2D,c.j),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,256,1,0,p.RGBA,p.UNSIGNED_BYTE,new Uint8Array(y))}})(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 xp(e,t,r,n){let o=Uo(e),i=(function(c){return c.h||(c.h=new F3),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;zo(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 Ue=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=Ao(this);t=Kc(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=Ao(this);r=Kc(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=Ao(this);t=Kc(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=Uo(n);Cp(n,o,(c=>{Ap(n,c,i,s),(c=Ao(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Ap(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,o,i,s){let a=Uo(n);Cp(n,o,(c=>{xp(n,c,i,s),(c=Ao(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):xp(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 Rm(e){var t=Nt(e,0);if(!t){t=Dn(e);let r=js(e),n=new Uint8Array(e.width*e.height*4);Ns(r,t,ns(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),uh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function ns(e){let t=Nt(e,2);if(!t){let r=Dn(e);t=os(e);let n=Nt(e,1)||Rm(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),To(e)}return t}function Dn(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 js(e){return e.l||(e.l=new Hn),e.l}function os(e){let t=Dn(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Nt(e,2);return r||(r=wr(js(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function To(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Tp(e){let t=Dn(e);return zo(js(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()}))))}Ue.prototype.close=Ue.prototype.close,Ue.prototype.drawConfidenceMask=Ue.prototype.wa,Ue.prototype.drawCategoryMask=Ue.prototype.va,Ue.prototype.drawBoundingBox=Ue.prototype.ua,Ue.prototype.drawConnectors=Ue.prototype.xa,Ue.prototype.drawLandmarks=Ue.prototype.ya,Ue.lerp=function(e,t,r,n,o){return Ep(n*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),n,o)},Ue.clamp=Ep;var Ae=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)&&--Ip===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 Rm(this)}Ba(){var e=Nt(this,1);return e||(ns(this),os(this),e=Tp(this),To(this),this.g.push(e),this.j=!0),e}M(){return ns(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=Dn(this),o=js(this);n.activeTexture(n.TEXTURE1),r=wr(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),Ns(o,n,r),zo(o,n,!1,(()=>{os(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),To(this)})),uh(o),To(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);ns(this),os(this),r=Tp(this),To(this)}e.push(r)}return new Ae(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Nt(this,1).close(),this.m&&Dn(this).deleteTexture(Nt(this,2)),Ip=-1}};Ae.prototype.close=Ae.prototype.close,Ae.prototype.clone=Ae.prototype.clone,Ae.prototype.getAsWebGLTexture=Ae.prototype.M,Ae.prototype.getAsImageBitmap=Ae.prototype.Ba,Ae.prototype.getAsImageData=Ae.prototype.Ca,Ae.prototype.hasWebGLTexture=Ae.prototype.P,Ae.prototype.hasImageBitmap=Ae.prototype.ka,Ae.prototype.hasImageData=Ae.prototype.Ea;var Ip=250;function At(...e){return e.map((([t,r])=>({start:t,end:r})))}var j3=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Pp=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:Am()?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]=bp(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=>{wp(this,Object.keys(e),(o=>{wp(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){ur(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){ur(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){ur(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){ur(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){ur(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){ur(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){ur(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 Pp{get ea(){return this.i}qa(e,t,r){E(this,t,(n=>{let[o,i]=bp(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){ur(this,e,t),E(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),Pp,dt=class extends j3{};async function M(e,t,r){return(async function(n,o,i,s){return L3(n,o,i,s)})(e,r.canvas??(Am()?void 0:document.createElement("canvas")),t,r)}function Dm(e,t,r,n){if(e.T){let i=new tm;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]=xm(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'.");Dm(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'.");Dm(e,t,r,n)}function On(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 rs{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Hn}l(e,t=!0){if("runningMode"in e&&Mo(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 dt(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},x(e=this.h=new Ms,0,1,t=new ee),k(this.h,2,.5),k(this.h,3,.3)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(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"),F(e,"detections");let t=new Je;kt(t,S3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=Qf(i),this.j.detections.push(Em(n));v(this,o)})),this.g.attachEmptyPacketListener("detections",(n=>{v(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 ph=At([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]),fh=At([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]),mh=At([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Om=At([474,475],[475,476],[476,477],[477,474]),gh=At([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]),yh=At([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Bm=At([469,470],[470,471],[471,472],[472,469]),bh=At([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]),Mm=[...ph,...fh,...mh,...gh,...yh,...bh],Lm=At([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 Rp(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var ae=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,x(e=this.h=new sm,0,1,t=new ee),this.v=new im,x(this.h,0,3,this.v),this.s=new Ms,x(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 U(this.h,ee,1)}set baseOptions(e){x(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 Rp(this),pt(this,e,t),this.j}F(e,t,r){return Rp(this),Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"face_landmarks");let t=new Je;kt(t,E3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,o)=>{for(let i of n)n=Ho(i),this.j.faceLandmarks.push(Ls(n));v(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{v(this,n)})),this.outputFaceBlendshapes&&(F(e,"blendshapes"),L(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,o)=>{if(this.outputFaceBlendshapes)for(let i of n)n=Bs(i),this.j.faceBlendshapes.push(lh(n.g()??[]));v(this,o)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{v(this,n)}))),this.outputFacialTransformationMatrixes&&(F(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=U(k3(i),f3,2))&&this.j.facialTransformationMatrixes.push({rows:ct(n,1)??0??0,columns:ct(n,2)??0??0,data:zr(n,3,_r,Hr()).slice()??[]});v(this,o)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{v(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=ph,ae.FACE_LANDMARKS_LEFT_EYE=fh,ae.FACE_LANDMARKS_LEFT_EYEBROW=mh,ae.FACE_LANDMARKS_LEFT_IRIS=Om,ae.FACE_LANDMARKS_RIGHT_EYE=gh,ae.FACE_LANDMARKS_RIGHT_EYEBROW=yh,ae.FACE_LANDMARKS_RIGHT_IRIS=Bm,ae.FACE_LANDMARKS_FACE_OVAL=bh,ae.FACE_LANDMARKS_CONTOURS=Mm,ae.FACE_LANDMARKS_TESSELATION=Lm;var Ut=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!0),x(e=this.j=new cm,0,1,t=new ee)}get baseOptions(){return U(this.j,ee,1)}set baseOptions(e){x(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"),F(e,"stylized_image");let t=new Je;kt(t,C3,this.j);let r=new De;Qe(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),Ze(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 Ae([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=i=i?a.clone():a,this.h&&this.h(i),v(this,o)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ut.prototype.stylize=Ut.prototype.Oa,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 wh=At([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 Dp(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Op(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 Bp(e,t=!0){let r=[];for(let o of e){var n=Bs(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 qe=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],x(e=this.j=new um,0,1,t=new ee),this.s=new ih,x(this.j,0,2,this.s),this.C=new oh,x(this.s,0,3,this.C),this.v=new hm,x(this.s,0,2,this.v),this.h=new A3,x(this.j,0,3,this.h),k(this.v,2,.5),k(this.s,4,.5),k(this.C,2,.5)}get baseOptions(){return U(this.j,ee,1)}set baseOptions(e){x(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 gn,r=t,n=cl(e.cannedGesturesClassifierOptions,U(this.h,gn,3)?.h());x(r,0,2,n),x(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&U(this.h,gn,3)?.g();return e.customGesturesClassifierOptions?(x(r=t=new gn,0,2,n=cl(e.customGesturesClassifierOptions,U(this.h,gn,4)?.h())),x(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&U(this.h,gn,4)?.g(),this.l(e)}Ja(e,t){return Dp(this),pt(this,e,t),Op(this)}Ka(e,t,r){return Dp(this),Vt(this,e,r,t),Op(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"hand_gestures"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Je;kt(t,x3,this.j);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n){n=Ho(i);let s=[];for(let a of rr(n,em,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)}v(this,o)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{v(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,o)=>{for(let i of n){n=kn(i);let s=[];for(let a of rr(n,Zf,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)}v(this,o)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{v(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,o)=>{this.gestures.push(...Bp(n,!1)),v(this,o)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{v(this,n)})),this.g.attachProtoVectorListener("handedness",((n,o)=>{this.handedness.push(...Bp(n)),v(this,o)})),this.g.attachEmptyPacketListener("handedness",(n=>{v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Mp(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}qe.prototype.recognizeForVideo=qe.prototype.Ka,qe.prototype.recognize=qe.prototype.Ja,qe.prototype.setOptions=qe.prototype.o,qe.createFromModelPath=function(e,t){return M(qe,e,{baseOptions:{modelAssetPath:t}})},qe.createFromModelBuffer=function(e,t){return M(qe,e,{baseOptions:{modelAssetBuffer:t}})},qe.createFromOptions=function(e,t){return M(qe,e,t)},qe.HAND_CONNECTIONS=wh;var Ge=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],x(e=this.h=new ih,0,1,t=new ee),this.s=new oh,x(this.h,0,3,this.s),this.j=new hm,x(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 U(this.h,ee,1)}set baseOptions(e){x(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),Mp(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Vt(this,e,r,t),Mp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Je;kt(t,T3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n)n=Ho(i),this.landmarks.push(Ls(n));v(this,o)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{v(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,o)=>{for(let i of n)n=kn(i),this.worldLandmarks.push(Do(n));v(this,o)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{v(this,n)})),this.g.attachProtoVectorListener("handedness",((n,o)=>{var i=this.handedness,s=i.push;let a=[];for(let c of n){n=Bs(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),v(this,o)})),this.g.attachEmptyPacketListener("handedness",(n=>{v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return M(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return M(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return M(Ge,e,t)},Ge.HAND_CONNECTIONS=wh;var Um=At([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 Lp(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Up(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Fs(e)}}function Qi(e,t){e=Ho(e),t.push(Ls(e))}var Q=class extends He{constructor(e,t){super(new dt(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,x(e=this.j=new gm,0,1,t=new ee),this.J=new oh,x(this.j,0,2,this.J),this.Z=new I3,x(this.j,0,3,this.Z),this.s=new Ms,x(this.j,0,4,this.s),this.H=new im,x(this.j,0,5,this.H),this.v=new fm,x(this.j,0,6,this.v),this.K=new mm,x(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 U(this.j,ee,1)}set baseOptions(e){x(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,Lp(this),pt(this,e,n),Up(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,Lp(this),Vt(this,e,o,t),Up(this)}m(){var e=new ze;Y(e,"input_frames_image"),F(e,"pose_landmarks"),F(e,"pose_world_landmarks"),F(e,"face_landmarks"),F(e,"left_hand_landmarks"),F(e,"left_hand_world_landmarks"),F(e,"right_hand_landmarks"),F(e,"right_hand_world_landmarks");let t=new Je,r=new rp;tl(r,1,Ln("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(o,i){if(i!=null)if(Array.isArray(i))G(o,2,hf(i));else{if(!(typeof i=="string"||i instanceof er||Fo(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");tl(o,2,Sl(i,!1),qr())}})(r,this.j.g());let n=new De;Qe(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),hs(n,8,rp,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),Ze(e,n),Us(this,e),this.g.attachProtoListener("pose_landmarks",((o,i)=>{Qi(o,this.h.poseLandmarks),v(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(o=>{v(this,o)})),this.g.attachProtoListener("pose_world_landmarks",((o,i)=>{var s=this.h.poseWorldLandmarks;o=kn(o),s.push(Do(o)),v(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(o=>{v(this,o)})),this.outputPoseSegmentationMasks&&(L(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Pn(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((o,i)=>{this.h.poseSegmentationMasks=[On(this,o,!0,!this.C)],v(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(o=>{this.h.poseSegmentationMasks=[],v(this,o)}))),this.g.attachProtoListener("face_landmarks",((o,i)=>{Qi(o,this.h.faceLandmarks),v(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(o=>{v(this,o)})),this.outputFaceBlendshapes&&(F(e,"extra_blendshapes"),L(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((o,i)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(o=Bs(o),s.push(lh(o.g()??[]))),v(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(o=>{v(this,o)}))),this.g.attachProtoListener("left_hand_landmarks",((o,i)=>{Qi(o,this.h.leftHandLandmarks),v(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(o=>{v(this,o)})),this.g.attachProtoListener("left_hand_world_landmarks",((o,i)=>{var s=this.h.leftHandWorldLandmarks;o=kn(o),s.push(Do(o)),v(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(o=>{v(this,o)})),this.g.attachProtoListener("right_hand_landmarks",((o,i)=>{Qi(o,this.h.rightHandLandmarks),v(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(o=>{v(this,o)})),this.g.attachProtoListener("right_hand_world_landmarks",((o,i)=>{var s=this.h.rightHandWorldLandmarks;o=kn(o),s.push(Do(o)),v(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(o=>{v(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=wh,Q.POSE_CONNECTIONS=Um,Q.FACE_LANDMARKS_LIPS=ph,Q.FACE_LANDMARKS_LEFT_EYE=fh,Q.FACE_LANDMARKS_LEFT_EYEBROW=mh,Q.FACE_LANDMARKS_LEFT_IRIS=Om,Q.FACE_LANDMARKS_RIGHT_EYE=gh,Q.FACE_LANDMARKS_RIGHT_EYEBROW=yh,Q.FACE_LANDMARKS_RIGHT_IRIS=Bm,Q.FACE_LANDMARKS_FACE_OVAL=bh,Q.FACE_LANDMARKS_CONTOURS=Mm,Q.FACE_LANDMARKS_TESSELATION=Lm;var st=class extends He{constructor(e,t){super(new dt(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},x(e=this.h=new ym,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return x(this.h,0,2,cl(e,U(this.h,th,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"),F(e,"classifications");let t=new Je;kt(t,P3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoListener("classifications",((n,o)=>{this.j=(function(i){let s={classifications:rr(i,g3,1).map((a=>lh(U(a,Jf,4)?.g()??[],ct(a,2)??0,ht(a,3)??"")))};return ls(Tn(i,2))!=null&&(s.timestampMs=ls(Tn(i,2))??0),s})(y3(n)),v(this,o)})),this.g.attachEmptyPacketListener("classifications",(n=>{v(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 Ke=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!0),this.h=new bm,this.embeddings={embeddings:[]},x(e=this.h,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){var t=this.h,r=U(this.h,up,2);return r=r?r.clone():new up,e.l2Normalize!==void 0?Mo(r,1,e.l2Normalize):"l2Normalize"in e&&G(r,1),e.quantize!==void 0?Mo(r,2,e.quantize):"quantize"in e&&G(r,2),x(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"),F(e,"embeddings_out");let t=new Je;kt(t,R3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=v3(n),this.embeddings=(function(i){return{embeddings:rr(i,w3,1).map((s=>{let a={headIndex:ct(s,3)??0??-1,headName:ht(s,4)??""??""};if(mf(s,hp,Hc(s,1))!==void 0)s=zr(s=U(s,hp,Hc(s,1)),1,_r,Hr()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=U(s,b3,Hc(s,2))?.oa()?.h()??c}return a})),timestampMs:ls(Tn(i,2))??0}})(n),v(this,o)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ke.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=gp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=gp(mp(e.quantizedEmbedding),mp(t.quantizedEmbedding))}return e},Ke.prototype.embedForVideo=Ke.prototype.Aa,Ke.prototype.embed=Ke.prototype.za,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)};var dl=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 Fp(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Np(e){try{let t=new dl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Fs(e)}}dl.prototype.close=dl.prototype.close;var Fe=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ch,this.v=new wm,x(this.h,0,3,this.v),x(e=this.h,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Ln(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&&(U(t[0],Je,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,Fp(this),pt(this,e,n),Np(this)}Ma(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Fp(this),Vt(this,e,o,t),Np(this)}Da(){return this.s}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect");let t=new Je;kt(t,_m,this.h);let r=new De;Qe(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),r.o(t),Ze(e,r),Us(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Pn(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>On(this,i,!0,!this.j))),v(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],v(this,n)}))),this.outputCategoryMask&&(F(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Pn(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=On(this,n,!1,!this.j),v(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,v(this,n)}))),F(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,o)=>{this.qualityScores=n,v(this,o)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.prototype.getLabels=Fe.prototype.Da,Fe.prototype.segmentForVideo=Fe.prototype.Ma,Fe.prototype.segment=Fe.prototype.segment,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return M(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return M(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return M(Fe,e,t)};var pl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};pl.prototype.close=pl.prototype.close;var V3=class extends S{constructor(e){super(e)}},yn=[0,le,-2],fs=[0,Yt,-3,Z,Yt,-1],jp=[0,fs],Vp=[0,fs,le,-1],Xc=class extends S{constructor(e){super(e)}},Hp=[0,Yt,-1,Z],H3=class extends S{constructor(e){super(e)}},zp=class extends S{constructor(e){super(e)}},fl=[1,2,3,4,5,6,7,8,9,10,14,15],Fm=class extends S{constructor(e){super(e)}};Fm.prototype.g=Os([0,Se,[0,fl,z,fs,z,[0,fs,yn],z,jp,z,[0,jp,yn],z,Hp,z,[0,Yt,-3,Z,ut],z,[0,Yt,-3,Z],z,[0,j,Yt,-2,Z,le,Z,-1,2,Yt,yn],z,Vp,z,[0,Vp,yn],Yt,yn,j,z,[0,Yt,-3,Z,yn,-1],z,[0,Se,Hp]],j,[0,j,le,-1,Z]]);var Ft=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ch,this.s=new wm,x(this.h,0,3,this.s),x(e=this.h,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(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 Fm;let i=new zp;var s=new V3;if(jt(s,1,255),x(i,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Xc;Mo(a,3,!0),k(a,1,t.keypoint.x),k(a,2,t.keypoint.y),Po(i,5,fl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new H3,t.scribble))Mo(t=new Xc,3,!0),k(t,1,a.x),k(t,2,a.y),hs(s,1,Xc,t);Po(i,15,fl,s)}hs(n,1,zp,i),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),pt(this,e,o);e:{try{let l=new pl(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{Fs(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 Je;kt(t,_m,this.h);let r=new De;Qe(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),Ze(e,r),Us(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Pn(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>On(this,i,!0,!this.j))),v(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],v(this,n)}))),this.outputCategoryMask&&(F(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Pn(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=On(this,n,!1,!this.j),v(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,v(this,n)}))),F(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,o)=>{this.qualityScores=n,v(this,o)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,v(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.prototype.segment=Ft.prototype.segment,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 je=class extends He{constructor(e,t){super(new dt(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},x(e=this.h=new Sm,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Ln(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?us(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&G(this.h,5),e.categoryDenylist!==void 0?us(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"),F(e,"detections");let t=new Je;kt(t,O3,this.h);let r=new De;Qe(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),K(r,"IMAGE:input_frame_gpu"),K(r,"NORM_RECT:norm_rect"),L(r,"DETECTIONS:detections"),r.o(t),Ze(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=Qf(i),this.j.detections.push(Em(n));v(this,o)})),this.g.attachEmptyPacketListener("detections",(n=>{v(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 ml=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function $p(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Wp(e){try{let t=new ml(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Fs(e)}}ml.prototype.close=ml.prototype.close;var Xe=class extends He{constructor(e,t){super(new dt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,x(e=this.h=new km,0,1,t=new ee),this.v=new mm,x(this.h,0,3,this.v),this.j=new fm,x(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 U(this.h,ee,1)}set baseOptions(e){x(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,$p(this),pt(this,e,n),Wp(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,$p(this),Vt(this,e,o,t),Wp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"normalized_landmarks"),F(e,"world_landmarks"),F(e,"segmentation_masks");let t=new Je;kt(t,B3,this.h);let r=new De;Qe(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),Ze(e,r),Us(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,o)=>{this.landmarks=[];for(let i of n)n=Ho(i),this.landmarks.push(Ls(n));v(this,o)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],v(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,o)=>{this.worldLandmarks=[];for(let i of n)n=kn(i),this.worldLandmarks.push(Do(n));v(this,o)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],v(this,n)})),this.outputSegmentationMasks&&(L(r,"SEGMENTATION_MASK:segmentation_masks"),Pn(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,o)=>{this.segmentationMasks=n.map((i=>On(this,i,!0,!this.s))),v(this,o)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],v(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.POSE_CONNECTIONS=Um;var zn=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,o&&(this.paramsConfig=o),n&&(this.options=n)}async initializeDetector(){let t=await dr.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",`
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 ul(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=Bn(e);var r=fh(e);if(Vs(r,n,Im(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 Im(e){let t=Qt(e,2);if(!t){let r=Bn(e);t=Rm(e);let n=ul(e),o=Pm(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,n),pl(e)}return t}function Bn(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 Pm(e){if(e=Bn(e),!Zi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Zi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Zi=e.R16F}return Zi}function fh(e){return e.l||(e.l=new $n),e.l}function Rm(e){let t=Bn(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Qt(e,2);return r||(r=vr(fh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function pl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Zi,_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&&--Ep===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=ul(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return ul(this)}M(){return Im(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=Bn(this),o=fh(this);n.activeTexture(n.TEXTURE1),r=vr(o,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let i=Pm(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Vs(o,n,r),Jo(o,n,!1,(()=>{Rm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),pl(this)})),ph(o),pl(this)}}e.push(r)}return new _e(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Bn(this).deleteTexture(Qt(this,2)),Ep=-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 Ep=250,j3={color:"white",lineWidth:4,radius:6};function Jc(e){return{...j3,fillColor:(e=e||{}).color,...e}}function Jt(e,t){return e instanceof Function?e(t):e}function Cp(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function Oo(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Wo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function xp(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new $n;let o=Wo(e);r((e=new _e([n],t.m,!1,o.canvas,e.m,t.width,t.height)).M()),e.close()}}function Ap(e,t,r,n){let o=(function(a){return a.g||(a.g=new F3),a.g})(e),i=Wo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Jo(o,i,!0,(()=>{(function(c,l,h,d){let p=c.g;if(p.activeTexture(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,l),p.activeTexture(p.TEXTURE1),p.bindTexture(p.TEXTURE_2D,c.B),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,h),c.H&&(function(b,f){if(b!==f)return!1;b=b.entries(),f=f.entries();for(let[y,v]of b){b=y;let _=v;var g=f.next();if(g.done)return!1;let[x,B]=g.value;if(g=B,b!==x||_[0]!==g[0]||_[1]!==g[1]||_[2]!==g[2]||_[3]!==g[3])return!1}return!!f.next().done})(c.H,d))p.activeTexture(p.TEXTURE2),p.bindTexture(p.TEXTURE_2D,c.j);else{c.H=d;let b=Array(1024).fill(0);d.forEach(((f,g)=>{if(f.length!==4)throw Error(`Color at index ${g} is not a four-channel value.`);b[4*g]=f[0],b[4*g+1]=f[1],b[4*g+2]=f[2],b[4*g+3]=f[3]})),p.activeTexture(p.TEXTURE2),p.bindTexture(p.TEXTURE_2D,c.j),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,256,1,0,p.RGBA,p.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 Tp(e,t,r,n){let o=Wo(e),i=(function(c){return c.h||(c.h=new N3),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;Jo(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 Ue=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=Oo(this);t=Jc(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=Oo(this);r=Jc(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=Oo(this);t=Jc(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=Wo(n);xp(n,o,(c=>{Ap(n,c,i,s),(c=Oo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Ap(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,o,i,s){let a=Wo(n);xp(n,o,(c=>{Tp(n,c,i,s),(c=Oo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):Tp(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 Dm(e){var t=Nt(e,0);if(!t){t=Mn(e);let r=Hs(e),n=new Uint8Array(e.width*e.height*4);Vs(r,t,is(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),ph(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function is(e){let t=Nt(e,2);if(!t){let r=Mn(e);t=ss(e);let n=Nt(e,1)||Dm(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),Mo(e)}return t}function Mn(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 Hs(e){return e.l||(e.l=new $n),e.l}function ss(e){let t=Mn(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Nt(e,2);return r||(r=vr(Hs(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 Ip(e){let t=Mn(e);return Jo(Hs(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()}))))}Ue.prototype.close=Ue.prototype.close,Ue.prototype.drawConfidenceMask=Ue.prototype.wa,Ue.prototype.drawCategoryMask=Ue.prototype.va,Ue.prototype.drawBoundingBox=Ue.prototype.ua,Ue.prototype.drawConnectors=Ue.prototype.xa,Ue.prototype.drawLandmarks=Ue.prototype.ya,Ue.lerp=function(e,t,r,n,o){return Cp(n*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),n,o)},Ue.clamp=Cp;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)&&--Pp===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 Dm(this)}Ba(){var e=Nt(this,1);return e||(is(this),ss(this),e=Ip(this),Mo(this),this.g.push(e),this.j=!0),e}M(){return is(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=Mn(this),o=Hs(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),Vs(o,n,r),Jo(o,n,!1,(()=>{ss(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Mo(this)})),ph(o),Mo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);is(this),ss(this),r=Ip(this),Mo(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&&Mn(this).deleteTexture(Nt(this,2)),Pp=-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 Pp=250;function xt(...e){return e.map((([t,r])=>({start:t,end:r})))}var V3=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Rp=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:Am()?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]=vp(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=>{wp(this,Object.keys(e),(o=>{wp(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 Rp{get ea(){return this.i}qa(e,t,r){E(this,t,(n=>{let[o,i]=vp(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)}))}})),Rp,ut=class extends V3{};async function M(e,t,r){return(async function(n,o,i,s){return U3(n,o,i,s)})(e,r.canvas??(Am()?void 0:document.createElement("canvas")),t,r)}function Om(e,t,r,n){if(e.T){let i=new rm;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]=Tm(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'.");Om(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'.");Om(e,t,r,n)}function Ln(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 os{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new $n}l(e,t=!0){if("runningMode"in e&&Ho(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 U(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"),F(e,"detections");let t=new Je;kt(t,k3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=Zf(i),this.j.detections.push(Cm(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 mh=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]),gh=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]),yh=xt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Bm=xt([474,475],[475,476],[476,477],[477,474]),bh=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]),vh=xt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Mm=xt([469,470],[470,471],[471,472],[472,469]),wh=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]),Lm=[...mh,...gh,...yh,...bh,...vh,...wh],Um=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 Dp(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 am,0,1,t=new ee),this.v=new sm,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 U(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 Dp(this),pt(this,e,t),this.j}F(e,t,r){return Dp(this),Vt(this,e,r,t),this.j}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"face_landmarks");let t=new Je;kt(t,C3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,o)=>{for(let i of n)n=Xo(i),this.j.faceLandmarks.push(Fs(n));w(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{w(this,n)})),this.outputFaceBlendshapes&&(F(e,"blendshapes"),L(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,o)=>{if(this.outputFaceBlendshapes)for(let i of n)n=Ls(i),this.j.faceBlendshapes.push(dh(n.g()??[]));w(this,o)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{w(this,n)}))),this.outputFacialTransformationMatrixes&&(F(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=U(E3(i),m3,2))&&this.j.facialTransformationMatrixes.push({rows:ct(n,1)??0??0,columns:ct(n,2)??0??0,data:Wr(n,3,_r,zr()).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=mh,ae.FACE_LANDMARKS_LEFT_EYE=gh,ae.FACE_LANDMARKS_LEFT_EYEBROW=yh,ae.FACE_LANDMARKS_LEFT_IRIS=Bm,ae.FACE_LANDMARKS_RIGHT_EYE=bh,ae.FACE_LANDMARKS_RIGHT_EYEBROW=vh,ae.FACE_LANDMARKS_RIGHT_IRIS=Mm,ae.FACE_LANDMARKS_FACE_OVAL=wh,ae.FACE_LANDMARKS_CONTOURS=Lm,ae.FACE_LANDMARKS_TESSELATION=Um;var Ut=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!0),A(e=this.j=new lm,0,1,t=new ee)}get baseOptions(){return U(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"),F(e,"stylized_image");let t=new Je;kt(t,x3,this.j);let r=new De;Qe(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),Ze(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)}};Ut.prototype.stylize=Ut.prototype.Oa,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 _h=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 Op(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Bp(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 Mp(e,t=!0){let r=[];for(let o of e){var n=Ls(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 qe=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 um,0,1,t=new ee),this.s=new ah,A(this.j,0,2,this.s),this.C=new sh,A(this.s,0,3,this.C),this.v=new dm,A(this.s,0,2,this.v),this.h=new A3,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 U(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 vn,r=t,n=hl(e.cannedGesturesClassifierOptions,U(this.h,vn,3)?.h());A(r,0,2,n),A(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&U(this.h,vn,3)?.g();return e.customGesturesClassifierOptions?(A(r=t=new vn,0,2,n=hl(e.customGesturesClassifierOptions,U(this.h,vn,4)?.h())),A(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&U(this.h,vn,4)?.g(),this.l(e)}Ja(e,t){return Op(this),pt(this,e,t),Bp(this)}Ka(e,t,r){return Op(this),Vt(this,e,r,t),Bp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"hand_gestures"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Je;kt(t,T3,this.j);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n){n=Xo(i);let s=[];for(let a of rr(n,tm,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=xn(i);let s=[];for(let a of rr(n,em,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(...Mp(n,!1)),w(this,o)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{w(this,n)})),this.g.attachProtoVectorListener("handedness",((n,o)=>{this.handedness.push(...Mp(n)),w(this,o)})),this.g.attachEmptyPacketListener("handedness",(n=>{w(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Lp(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}qe.prototype.recognizeForVideo=qe.prototype.Ka,qe.prototype.recognize=qe.prototype.Ja,qe.prototype.setOptions=qe.prototype.o,qe.createFromModelPath=function(e,t){return M(qe,e,{baseOptions:{modelAssetPath:t}})},qe.createFromModelBuffer=function(e,t){return M(qe,e,{baseOptions:{modelAssetBuffer:t}})},qe.createFromOptions=function(e,t){return M(qe,e,t)},qe.HAND_CONNECTIONS=_h;var Ge=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 ah,0,1,t=new ee),this.s=new sh,A(this.h,0,3,this.s),this.j=new dm,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 U(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),Lp(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Vt(this,e,r,t),Lp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Je;kt(t,I3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,o)=>{for(let i of n)n=Xo(i),this.landmarks.push(Fs(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=xn(i),this.worldLandmarks.push(No(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=Ls(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)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return M(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return M(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return M(Ge,e,t)},Ge.HAND_CONNECTIONS=_h;var Fm=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 Up(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Fp(e){try{if(!e.C)return e.h;e.C(e.h)}finally{js(e)}}function es(e,t){e=Xo(e),t.push(Fs(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 ym,0,1,t=new ee),this.J=new sh,A(this.j,0,2,this.J),this.Z=new P3,A(this.j,0,3,this.Z),this.s=new Us,A(this.j,0,4,this.s),this.H=new sm,A(this.j,0,5,this.H),this.v=new mm,A(this.j,0,6,this.v),this.K=new gm,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 U(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,Up(this),pt(this,e,n),Fp(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,Up(this),Vt(this,e,o,t),Fp(this)}m(){var e=new ze;Y(e,"input_frames_image"),F(e,"pose_landmarks"),F(e,"pose_world_landmarks"),F(e,"face_landmarks"),F(e,"left_hand_landmarks"),F(e,"left_hand_world_landmarks"),F(e,"right_hand_landmarks"),F(e,"right_hand_world_landmarks");let t=new Je,r=new np;nl(r,1,Nn("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(o,i){if(i!=null)if(Array.isArray(i))G(o,2,df(i));else{if(!(typeof i=="string"||i instanceof er||$o(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");nl(o,2,El(i,!1),Gr())}})(r,this.j.g());let n=new De;Qe(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),us(n,8,np,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),Ze(e,n),Ns(this,e),this.g.attachProtoListener("pose_landmarks",((o,i)=>{es(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=xn(o),s.push(No(o)),w(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(o=>{w(this,o)})),this.outputPoseSegmentationMasks&&(L(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),On(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((o,i)=>{this.h.poseSegmentationMasks=[Ln(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)=>{es(o,this.h.faceLandmarks),w(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(o=>{w(this,o)})),this.outputFaceBlendshapes&&(F(e,"extra_blendshapes"),L(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((o,i)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(o=Ls(o),s.push(dh(o.g()??[]))),w(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(o=>{w(this,o)}))),this.g.attachProtoListener("left_hand_landmarks",((o,i)=>{es(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=xn(o),s.push(No(o)),w(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(o=>{w(this,o)})),this.g.attachProtoListener("right_hand_landmarks",((o,i)=>{es(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=xn(o),s.push(No(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=_h,Q.POSE_CONNECTIONS=Fm,Q.FACE_LANDMARKS_LIPS=mh,Q.FACE_LANDMARKS_LEFT_EYE=gh,Q.FACE_LANDMARKS_LEFT_EYEBROW=yh,Q.FACE_LANDMARKS_LEFT_IRIS=Bm,Q.FACE_LANDMARKS_RIGHT_EYE=bh,Q.FACE_LANDMARKS_RIGHT_EYEBROW=vh,Q.FACE_LANDMARKS_RIGHT_IRIS=Mm,Q.FACE_LANDMARKS_FACE_OVAL=wh,Q.FACE_LANDMARKS_CONTOURS=Lm,Q.FACE_LANDMARKS_TESSELATION=Um;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 bm,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return A(this.h,0,2,hl(e,U(this.h,nh,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"),F(e,"classifications");let t=new Je;kt(t,R3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoListener("classifications",((n,o)=>{this.j=(function(i){let s={classifications:rr(i,y3,1).map((a=>dh(U(a,Yf,4)?.g()??[],ct(a,2)??0,ht(a,3)??"")))};return ds(Rn(i,2))!=null&&(s.timestampMs=ds(Rn(i,2))??0),s})(b3(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 Ke=class extends He{constructor(e,t){super(new ut(e,t),"image_in","norm_rect",!0),this.h=new vm,this.embeddings={embeddings:[]},A(e=this.h,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){var t=this.h,r=U(this.h,up,2);return r=r?r.clone():new up,e.l2Normalize!==void 0?Ho(r,1,e.l2Normalize):"l2Normalize"in e&&G(r,1),e.quantize!==void 0?Ho(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"),F(e,"embeddings_out");let t=new Je;kt(t,D3,this.h);let r=new De;Qe(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),Ze(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=_3(n),this.embeddings=(function(i){return{embeddings:rr(i,w3,1).map((s=>{let a={headIndex:ct(s,3)??0??-1,headName:ht(s,4)??""??""};if(gf(s,dp,Wc(s,1))!==void 0)s=Wr(s=U(s,dp,Wc(s,1)),1,_r,zr()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=U(s,v3,Wc(s,2))?.oa()?.h()??c}return a})),timestampMs:ds(Rn(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)}};Ke.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=yp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=yp(gp(e.quantizedEmbedding),gp(t.quantizedEmbedding))}return e},Ke.prototype.embedForVideo=Ke.prototype.Aa,Ke.prototype.embed=Ke.prototype.za,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)};var fl=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 Np(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function jp(e){try{let t=new fl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{js(e)}}fl.prototype.close=fl.prototype.close;var Fe=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 hh,this.v=new wm,A(this.h,0,3,this.v),A(e=this.h,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Nn(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&&(U(t[0],Je,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,Np(this),pt(this,e,n),jp(this)}Ma(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Np(this),Vt(this,e,o,t),jp(this)}Da(){return this.s}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect");let t=new Je;kt(t,Sm,this.h);let r=new De;Qe(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),r.o(t),Ze(e,r),Ns(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),On(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>Ln(this,i,!0,!this.j))),w(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],w(this,n)}))),this.outputCategoryMask&&(F(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),On(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=Ln(this,n,!1,!this.j),w(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,w(this,n)}))),F(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)}};Fe.prototype.getLabels=Fe.prototype.Da,Fe.prototype.segmentForVideo=Fe.prototype.Ma,Fe.prototype.segment=Fe.prototype.segment,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return M(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return M(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return M(Fe,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()}};ml.prototype.close=ml.prototype.close;var H3=class extends S{constructor(e){super(e)}},wn=[0,le,-2],gs=[0,Yt,-3,Z,Yt,-1],Vp=[0,gs],Hp=[0,gs,le,-1],Yc=class extends S{constructor(e){super(e)}},zp=[0,Yt,-1,Z],z3=class extends S{constructor(e){super(e)}},Wp=class extends S{constructor(e){super(e)}},gl=[1,2,3,4,5,6,7,8,9,10,14,15],Nm=class extends S{constructor(e){super(e)}};Nm.prototype.g=Ms([0,Se,[0,gl,z,gs,z,[0,gs,wn],z,Vp,z,[0,Vp,wn],z,zp,z,[0,Yt,-3,Z,dt],z,[0,Yt,-3,Z],z,[0,j,Yt,-2,Z,le,Z,-1,2,Yt,wn],z,Hp,z,[0,Hp,wn],Yt,wn,j,z,[0,Yt,-3,Z,wn,-1],z,[0,Se,zp]],j,[0,j,le,-1,Z]]);var Ft=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 hh,this.s=new wm,A(this.h,0,3,this.s),A(e=this.h,0,1,t=new ee)}get baseOptions(){return U(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 Nm;let i=new Wp;var s=new H3;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 Yc;Ho(a,3,!0),k(a,1,t.keypoint.x),k(a,2,t.keypoint.y),Uo(i,5,gl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new z3,t.scribble))Ho(t=new Yc,3,!0),k(t,1,a.x),k(t,2,a.y),us(s,1,Yc,t);Uo(i,15,gl,s)}us(n,1,Wp,i),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),pt(this,e,o);e:{try{let l=new ml(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{js(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 Je;kt(t,Sm,this.h);let r=new De;Qe(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),Ze(e,r),Ns(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),On(this,"confidence_masks"),this.g.ca("confidence_masks",((n,o)=>{this.confidenceMasks=n.map((i=>Ln(this,i,!0,!this.j))),w(this,o)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],w(this,n)}))),this.outputCategoryMask&&(F(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),On(this,"category_mask"),this.g.U("category_mask",((n,o)=>{this.categoryMask=Ln(this,n,!1,!this.j),w(this,o)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,w(this,n)}))),F(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)}};Ft.prototype.segment=Ft.prototype.segment,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 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 km,0,1,t=new ee)}get baseOptions(){return U(this.h,ee,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Nn(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?ps(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&G(this.h,5),e.categoryDenylist!==void 0?ps(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"),F(e,"detections");let t=new Je;kt(t,B3,this.h);let r=new De;Qe(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),K(r,"IMAGE:input_frame_gpu"),K(r,"NORM_RECT:norm_rect"),L(r,"DETECTIONS:detections"),r.o(t),Ze(e,r),this.g.attachProtoVectorListener("detections",((n,o)=>{for(let i of n)n=Zf(i),this.j.detections.push(Cm(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 yl=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function $p(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function qp(e){try{let t=new yl(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{js(e)}}yl.prototype.close=yl.prototype.close;var Xe=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 Em,0,1,t=new ee),this.v=new gm,A(this.h,0,3,this.v),this.j=new mm,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 U(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,$p(this),pt(this,e,n),qp(this)}F(e,t,r,n){let o=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,$p(this),Vt(this,e,o,t),qp(this)}m(){var e=new ze;Y(e,"image_in"),Y(e,"norm_rect"),F(e,"normalized_landmarks"),F(e,"world_landmarks"),F(e,"segmentation_masks");let t=new Je;kt(t,M3,this.h);let r=new De;Qe(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),Ze(e,r),Ns(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,o)=>{this.landmarks=[];for(let i of n)n=Xo(i),this.landmarks.push(Fs(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=xn(i),this.worldLandmarks.push(No(n));w(this,o)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],w(this,n)})),this.outputSegmentationMasks&&(L(r,"SEGMENTATION_MASK:segmentation_masks"),On(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,o)=>{this.segmentationMasks=n.map((i=>Ln(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)}};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.POSE_CONNECTIONS=Fm;var qn=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,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
49
  width: 20rem;
50
50
  border-radius: 10px;
51
51
  position: absolute;
@@ -62,25 +62,25 @@ Minimum version required to store current data is: `+i+`.
62
62
  border-radius: 50%;
63
63
  display: block;
64
64
  }
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}),this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r}),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";default:return t}}};function Nm(){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 $n=class extends zn{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}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,u=n.boundingBox.originY*l,p=(n.boundingBox.width-10)*c,y=n.boundingBox.height*l,f=document.createElement("p");f.innerText="Confidence: "+Math.round(parseFloat(n.categories[0].score)*100)+"% .",f.style.right=h+"px",f.style.top=u-50+"px",f.style.width=p+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(f.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let b=document.createElement("div");b.setAttribute("class","highlighter"),b.style.right=h+"px",b.style.top=u+"px",b.style.width=p+"px",b.style.height=y-10+"px",Object.assign(b.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(b),this.liveView.appendChild(f),this.children.push(b),this.children.push(f);for(let w of n.keypoints){let _=document.createElement("spam");_.className="key-point",_.style.top=`${w.y*this.video.offsetHeight-3}px`,_.style.right=`${this.video.offsetWidth-w.x*this.video.offsetWidth-3}px`,this.liveView.appendChild(_),this.children.push(_)}}}verify(r){this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent&&(this.numFacesSent=r.detections.length,r.detections.length===0?this.handleAlert("no_face_detected","face_detection_on_stream"):r.detections.length>1?this.handleAlert("multiple_faces_detected","face_detection_on_stream"):this.handleOk("face_ok","face_detection_on_stream"));let n=r.detections[0]?.keypoints[3].y-r.detections[0]?.keypoints[0].y;r.detections[0]?.keypoints[4].x<.2||r.detections[0]?.keypoints[5].x>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):r.detections[0]?.keypoints[0].y<.2||r.detections[0]?.keypoints[0].y>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):r.detections[0]?.keypoints[3].y<.4||r.detections[0]?.keypoints[3].y>.9?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):n>.35?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function $o(e,t){return function(){return e.apply(t,arguments)}}var{toString:z3}=Object.prototype,{getPrototypeOf:_h}=Object,Hs=(e=>t=>{let r=z3.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),xt=e=>(e=e.toLowerCase(),t=>Hs(t)===e),zs=e=>t=>typeof t===e,{isArray:Wn}=Array,Wo=zs("undefined");function $3(e){return e!==null&&!Wo(e)&&e.constructor!==null&&!Wo(e.constructor)&&et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Vm=xt("ArrayBuffer");function W3(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Vm(e.buffer),t}var q3=zs("string"),et=zs("function"),Hm=zs("number"),$s=e=>e!==null&&typeof e=="object",G3=e=>e===!0||e===!1,Vs=e=>{if(Hs(e)!=="object")return!1;let t=_h(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},K3=xt("Date"),X3=xt("File"),J3=xt("Blob"),Y3=xt("FileList"),Q3=e=>$s(e)&&et(e.pipe),Z3=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||et(e.append)&&((t=Hs(e))==="formdata"||t==="object"&&et(e.toString)&&e.toString()==="[object FormData]"))},eb=xt("URLSearchParams"),[tb,rb,nb,ob]=["ReadableStream","Request","Response","Headers"].map(xt),ib=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),Wn(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 zm(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 Kr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$m=e=>!Wo(e)&&e!==Kr;function vh(){let{caseless:e}=$m(this)&&this||{},t={},r=(n,o)=>{let i=e&&zm(t,o)||o;Vs(t[i])&&Vs(n)?t[i]=vh(t[i],n):Vs(n)?t[i]=vh({},n):Wn(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&qo(arguments[n],r);return t}var sb=(e,t,r,{allOwnKeys:n}={})=>(qo(t,(o,i)=>{r&&et(o)?e[i]=$o(o,r):e[i]=o},{allOwnKeys:n}),e),ab=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cb=(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)},lb=(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&&_h(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},hb=(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},ub=e=>{if(!e)return null;if(Wn(e))return e;let t=e.length;if(!Hm(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},db=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_h(Uint8Array)),pb=(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])}},fb=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},mb=xt("HTMLFormElement"),gb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),jm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),yb=xt("RegExp"),Wm=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};qo(r,(o,i)=>{let s;(s=t(o,i,e))!==!1&&(n[i]=s||o)}),Object.defineProperties(e,n)},bb=e=>{Wm(e,(t,r)=>{if(et(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(et(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+"'")})}})},wb=(e,t)=>{let r={},n=o=>{o.forEach(i=>{r[i]=!0})};return Wn(e)?n(e):n(String(e).split(t)),r},vb=()=>{},_b=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Sb(e){return!!(e&&et(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var kb=e=>{let t=new Array(10),r=(n,o)=>{if($s(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let i=Wn(n)?[]:{};return qo(n,(s,a)=>{let c=r(s,o+1);!Wo(c)&&(i[a]=c)}),t[o]=void 0,i}}return n};return r(e,0)},Eb=xt("AsyncFunction"),Cb=e=>e&&($s(e)||et(e))&&et(e.then)&&et(e.catch),qm=((e,t)=>e?setImmediate:t?((r,n)=>(Kr.addEventListener("message",({source:o,data:i})=>{o===Kr&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),Kr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",et(Kr.postMessage)),Ab=typeof queueMicrotask<"u"?queueMicrotask.bind(Kr):typeof process<"u"&&process.nextTick||qm,d={isArray:Wn,isArrayBuffer:Vm,isBuffer:$3,isFormData:Z3,isArrayBufferView:W3,isString:q3,isNumber:Hm,isBoolean:G3,isObject:$s,isPlainObject:Vs,isReadableStream:tb,isRequest:rb,isResponse:nb,isHeaders:ob,isUndefined:Wo,isDate:K3,isFile:X3,isBlob:J3,isRegExp:yb,isFunction:et,isStream:Q3,isURLSearchParams:eb,isTypedArray:db,isFileList:Y3,forEach:qo,merge:vh,extend:sb,trim:ib,stripBOM:ab,inherits:cb,toFlatObject:lb,kindOf:Hs,kindOfTest:xt,endsWith:hb,toArray:ub,forEachEntry:pb,matchAll:fb,isHTMLForm:mb,hasOwnProperty:jm,hasOwnProp:jm,reduceDescriptors:Wm,freezeMethods:bb,toObjectSet:wb,toCamelCase:gb,noop:vb,toFiniteNumber:_b,findKey:zm,global:Kr,isContextDefined:$m,isSpecCompliantForm:Sb,toJSONObject:kb,isAsyncFn:Eb,isThenable:Cb,setImmediate:qm,asap:Ab};function qn(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)}d.inherits(qn,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:d.toJSONObject(this.config),code:this.code,status:this.status}}});var Gm=qn.prototype,Km={};["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=>{Km[e]={value:e}});Object.defineProperties(qn,Km);Object.defineProperty(Gm,"isAxiosError",{value:!0});qn.from=(e,t,r,n,o,i)=>{let s=Object.create(Gm);return d.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),qn.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};var P=qn;var Ws=null;function Sh(e){return d.isPlainObject(e)||d.isArray(e)}function Jm(e){return d.endsWith(e,"[]")?e.slice(0,-2):e}function Xm(e,t,r){return e?e.concat(t).map(function(o,i){return o=Jm(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function xb(e){return d.isArray(e)&&!e.some(Sh)}var Tb=d.toFlatObject(d,{},null,function(t){return/^is[A-Z]/.test(t)});function Ib(e,t,r){if(!d.isObject(e))throw new TypeError("target must be an object");t=t||new(Ws||FormData),r=d.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!d.isUndefined(b[g])});let n=r.metaTokens,o=r.visitor||h,i=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(t);if(!d.isFunction(o))throw new TypeError("visitor must be a function");function l(f){if(f===null)return"";if(d.isDate(f))return f.toISOString();if(!c&&d.isBlob(f))throw new P("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(f)||d.isTypedArray(f)?c&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function h(f,g,b){let w=f;if(f&&!b&&typeof f=="object"){if(d.endsWith(g,"{}"))g=n?g:g.slice(0,-2),f=JSON.stringify(f);else if(d.isArray(f)&&xb(f)||(d.isFileList(f)||d.endsWith(g,"[]"))&&(w=d.toArray(f)))return g=Jm(g),w.forEach(function(A,B){!(d.isUndefined(A)||A===null)&&t.append(s===!0?Xm([g],B,i):s===null?g:g+"[]",l(A))}),!1}return Sh(f)?!0:(t.append(Xm(b,g,i),l(f)),!1)}let u=[],p=Object.assign(Tb,{defaultVisitor:h,convertValue:l,isVisitable:Sh});function y(f,g){if(!d.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+g.join("."));u.push(f),d.forEach(f,function(w,_){(!(d.isUndefined(w)||w===null)&&o.call(t,w,d.isString(_)?_.trim():_,g,p))===!0&&y(w,g?g.concat(_):[_])}),u.pop()}}if(!d.isObject(e))throw new TypeError("data must be an object");return y(e),t}var kr=Ib;function Ym(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Qm(e,t){this._pairs=[],e&&kr(e,this,t)}var Zm=Qm.prototype;Zm.append=function(t,r){this._pairs.push([t,r])};Zm.toString=function(t){let r=t?function(n){return t.call(this,n,Ym)}:Ym;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var qs=Qm;function Pb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Go(e,t,r){if(!t)return e;let n=r&&r.encode||Pb;d.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize,i;if(o?i=o(t,r):i=d.isURLSearchParams(t)?t.toString():new qs(t,r).toString(n),i){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var kh=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){d.forEach(this.handlers,function(n){n!==null&&t(n)})}},Eh=kh;var Gs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var eg=typeof URLSearchParams<"u"?URLSearchParams:qs;var tg=typeof FormData<"u"?FormData:null;var rg=typeof Blob<"u"?Blob:null;var ng={isBrowser:!0,classes:{URLSearchParams:eg,FormData:tg,Blob:rg},protocols:["http","https","file","blob","url","data"]};var xh={};gy(xh,{hasBrowserEnv:()=>Ah,hasStandardBrowserEnv:()=>Rb,hasStandardBrowserWebWorkerEnv:()=>Db,navigator:()=>Ch,origin:()=>Ob});var Ah=typeof window<"u"&&typeof document<"u",Ch=typeof navigator=="object"&&navigator||void 0,Rb=Ah&&(!Ch||["ReactNative","NativeScript","NS"].indexOf(Ch.product)<0),Db=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ob=Ah&&window.location.href||"http://localhost";var oe={...xh,...ng};function Th(e,t){return kr(e,new oe.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return oe.isNode&&d.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Bb(e){return d.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Mb(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 Lb(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&&d.isArray(o)?o.length:s,c?(d.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!a):((!o[s]||!d.isObject(o[s]))&&(o[s]=[]),t(r,n,o[s],i)&&d.isArray(o[s])&&(o[s]=Mb(o[s])),!a)}if(d.isFormData(e)&&d.isFunction(e.entries)){let r={};return d.forEachEntry(e,(n,o)=>{t(Bb(n),o,r,0)}),r}return null}var Ks=Lb;function Ub(e,t,r){if(d.isString(e))try{return(t||JSON.parse)(e),d.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Ih={transitional:Gs,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=d.isObject(t);if(i&&d.isHTMLForm(t)&&(t=new FormData(t)),d.isFormData(t))return o?JSON.stringify(Ks(t)):t;if(d.isArrayBuffer(t)||d.isBuffer(t)||d.isStream(t)||d.isFile(t)||d.isBlob(t)||d.isReadableStream(t))return t;if(d.isArrayBufferView(t))return t.buffer;if(d.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 Th(t,this.formSerializer).toString();if((a=d.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),Ub(t)):t}],transformResponse:[function(t){let r=this.transitional||Ih.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(d.isResponse(t)||d.isReadableStream(t))return t;if(t&&d.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}}};d.forEach(["delete","get","head","post","put","patch"],e=>{Ih.headers[e]={}});var Gn=Ih;var Fb=d.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"]),og=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]&&Fb[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var ig=Symbol("internals");function Ko(e){return e&&String(e).trim().toLowerCase()}function Xs(e){return e===!1||e==null?e:d.isArray(e)?e.map(Xs):String(e)}function Nb(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 jb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ph(e,t,r,n,o){if(d.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!d.isString(t)){if(d.isString(n))return t.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(t)}}function Vb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Hb(e,t){let r=d.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 Kn=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function i(a,c,l){let h=Ko(c);if(!h)throw new Error("header name must be a non-empty string");let u=d.findKey(o,h);(!u||o[u]===void 0||l===!0||l===void 0&&o[u]!==!1)&&(o[u||c]=Xs(a))}let s=(a,c)=>d.forEach(a,(l,h)=>i(l,h,c));if(d.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(d.isString(t)&&(t=t.trim())&&!jb(t))s(og(t),r);else if(d.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=Ko(t),t){let n=d.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return Nb(o);if(d.isFunction(r))return r.call(this,o,n);if(d.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Ko(t),t){let n=d.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ph(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function i(s){if(s=Ko(s),s){let a=d.findKey(n,s);a&&(!r||Ph(n,n[a],a,r))&&(delete n[a],o=!0)}}return d.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||Ph(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){let r=this,n={};return d.forEach(this,(o,i)=>{let s=d.findKey(n,i);if(s){r[s]=Xs(o),delete r[i];return}let a=t?Vb(i):String(i).trim();a!==i&&delete r[i],r[a]=Xs(o),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return d.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&d.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[ig]=this[ig]={accessors:{}}).accessors,o=this.prototype;function i(s){let a=Ko(s);n[a]||(Hb(o,s),n[a]=!0)}return d.isArray(t)?t.forEach(i):i(t),this}};Kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(Kn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});d.freezeMethods(Kn);var ke=Kn;function Xo(e,t){let r=this||Gn,n=t||r,o=ke.from(n.headers),i=n.data;return d.forEach(e,function(a){i=a.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Jo(e){return!!(e&&e.__CANCEL__)}function sg(e,t,r){P.call(this,e??"canceled",P.ERR_CANCELED,t,r),this.name="CanceledError"}d.inherits(sg,P,{__CANCEL__:!0});var Ht=sg;function Yo(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 Rh(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zb(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 u=i,p=0;for(;u!==o;)p+=r[u++],u=u%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),l-s<t)return;let y=h&&l-h;return y?Math.round(p*1e3/y):void 0}}var ag=zb;function $b(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(),u=h-r;u>=n?s(l,h):(o=l,i||(i=setTimeout(()=>{i=null,s(o)},n-u)))},()=>o&&s(o)]}var cg=$b;var Xn=(e,t,r=3)=>{let n=0,o=ag(50,250);return cg(i=>{let s=i.loaded,a=i.lengthComputable?i.total:void 0,c=s-n,l=o(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:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},r)},Dh=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Oh=e=>(...t)=>d.asap(()=>e(...t));var lg=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 hg=oe.hasStandardBrowserEnv?{write(e,t,r,n,o,i){let s=[e+"="+encodeURIComponent(t)];d.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),d.isString(n)&&s.push("path="+n),d.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 Bh(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Mh(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Qo(e,t,r){let n=!Bh(t);return e&&(n||r==!1)?Mh(e,t):t}var ug=e=>e instanceof ke?{...e}:e;function Tt(e,t){t=t||{};let r={};function n(l,h,u,p){return d.isPlainObject(l)&&d.isPlainObject(h)?d.merge.call({caseless:p},l,h):d.isPlainObject(h)?d.merge({},h):d.isArray(h)?h.slice():h}function o(l,h,u,p){if(d.isUndefined(h)){if(!d.isUndefined(l))return n(void 0,l,u,p)}else return n(l,h,u,p)}function i(l,h){if(!d.isUndefined(h))return n(void 0,h)}function s(l,h){if(d.isUndefined(h)){if(!d.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: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,u)=>o(ug(l),ug(h),u,!0)};return d.forEach(Object.keys(Object.assign({},e,t)),function(h){let u=c[h]||o,p=u(e[h],t[h],h);d.isUndefined(p)&&u!==a||(r[h]=p)}),r}var Js=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=Go(Qo(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(d.isFormData(r)){if(oe.hasStandardBrowserEnv||oe.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(oe.hasStandardBrowserEnv&&(n&&d.isFunction(n)&&(n=n(t)),n||n!==!1&&lg(t.url))){let l=o&&i&&hg.read(i);l&&s.set(o,l)}return t};var Wb=typeof XMLHttpRequest<"u",dg=Wb&&function(e){return new Promise(function(r,n){let o=Js(e),i=o.data,s=ke.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,h,u,p,y,f;function g(){y&&y(),f&&f(),o.cancelToken&&o.cancelToken.unsubscribe(h),o.signal&&o.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function w(){if(!b)return;let A=ke.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:A,config:e,request:b};Yo(function(de){r(de),g()},function(de){n(de),g()},O),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(n(new P("Request aborted",P.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new P("Network Error",P.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let B=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",O=o.transitional||Gs;o.timeoutErrorMessage&&(B=o.timeoutErrorMessage),n(new P(B,O.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,b)),b=null},i===void 0&&s.setContentType(null),"setRequestHeader"in b&&d.forEach(s.toJSON(),function(B,O){b.setRequestHeader(O,B)}),d.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),a&&a!=="json"&&(b.responseType=o.responseType),l&&([p,f]=Xn(l,!0),b.addEventListener("progress",p)),c&&b.upload&&([u,y]=Xn(c),b.upload.addEventListener("progress",u),b.upload.addEventListener("loadend",y)),(o.cancelToken||o.signal)&&(h=A=>{b&&(n(!A||A.type?new Ht(null,e,b):A),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(h),o.signal&&(o.signal.aborted?h():o.signal.addEventListener("abort",h)));let _=Rh(o.url);if(_&&oe.protocols.indexOf(_)===-1){n(new P("Unsupported protocol "+_+":",P.ERR_BAD_REQUEST,e));return}b.send(i||null)})};var qb=(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=()=>d.asap(a),c}},pg=qb;var Gb=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},Kb=async function*(e,t){for await(let r of Xb(e))yield*Gb(r,t)},Xb=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()}},Lh=(e,t,r,n)=>{let o=Kb(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 u=h.byteLength;if(r){let p=i+=u;r(p)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var Qs=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",mg=Qs&&typeof ReadableStream=="function",Jb=Qs&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),gg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Yb=mg&&gg(()=>{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}),fg=64*1024,Uh=mg&&gg(()=>d.isReadableStream(new Response("").body)),Ys={stream:Uh&&(e=>e.body)};Qs&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ys[t]&&(Ys[t]=d.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 Qb=async e=>{if(e==null)return 0;if(d.isBlob(e))return e.size;if(d.isSpecCompliantForm(e))return(await new Request(oe.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(d.isArrayBufferView(e)||d.isArrayBuffer(e))return e.byteLength;if(d.isURLSearchParams(e)&&(e=e+""),d.isString(e))return(await Jb(e)).byteLength},Zb=async(e,t)=>{let r=d.toFiniteNumber(e.getContentLength());return r??Qb(t)},yg=Qs&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:u="same-origin",fetchOptions:p}=Js(e);l=l?(l+"").toLowerCase():"text";let y=pg([o,i&&i.toAbortSignal()],s),f,g=y&&y.unsubscribe&&(()=>{y.unsubscribe()}),b;try{if(c&&Yb&&r!=="get"&&r!=="head"&&(b=await Zb(h,n))!==0){let O=new Request(t,{method:"POST",body:n,duplex:"half"}),R;if(d.isFormData(n)&&(R=O.headers.get("content-type"))&&h.setContentType(R),O.body){let[de,se]=Dh(b,Xn(Oh(c)));n=Lh(O.body,fg,de,se)}}d.isString(u)||(u=u?"include":"omit");let w="credentials"in Request.prototype;f=new Request(t,{...p,signal:y,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:w?u:void 0});let _=await fetch(f),A=Uh&&(l==="stream"||l==="response");if(Uh&&(a||A&&g)){let O={};["status","statusText","headers"].forEach(Nr=>{O[Nr]=_[Nr]});let R=d.toFiniteNumber(_.headers.get("content-length")),[de,se]=a&&Dh(R,Xn(Oh(a),!0))||[];_=new Response(Lh(_.body,fg,de,()=>{se&&se(),g&&g()}),O)}l=l||"text";let B=await Ys[d.findKey(Ys,l)||"text"](_,e);return!A&&g&&g(),await new Promise((O,R)=>{Yo(O,R,{data:B,headers:ke.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:f})})}catch(w){throw g&&g(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,e,f),{cause:w.cause||w}):P.from(w,w&&w.code,e,f)}});var Fh={http:Ws,xhr:dg,fetch:yg};d.forEach(Fh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var bg=e=>`- ${e}`,e4=e=>d.isFunction(e)||e===null||e===!1,Zs={getAdapter:e=>{e=d.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,!e4(r)&&(n=Fh[(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(bg).join(`
69
- `):" "+bg(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:Fh};function Nh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ht(null,e)}function ea(e){return Nh(e),e.headers=ke.from(e.headers),e.data=Xo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zs.getAdapter(e.adapter||Gn.adapter)(e).then(function(n){return Nh(e),n.data=Xo.call(e,e.transformResponse,n),n.headers=ke.from(n.headers),n},function(n){return Jo(n)||(Nh(e),n&&n.response&&(n.response.data=Xo.call(e,e.transformResponse,n.response),n.response.headers=ke.from(n.response.headers))),Promise.reject(n)})}var ta="1.8.4";var ra={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ra[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var wg={};ra.transitional=function(t,r,n){function o(i,s){return"[Axios v"+ta+"] 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&&!wg[s]&&(wg[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}};ra.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function t4(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 Zo={assertOptions:t4,validators:ra};var zt=Zo.validators,Jn=class{constructor(t){this.defaults=t,this.interceptors={request:new Eh,response:new Eh}}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&&Zo.assertOptions(n,{silentJSONParsing:zt.transitional(zt.boolean),forcedJSONParsing:zt.transitional(zt.boolean),clarifyTimeoutError:zt.transitional(zt.boolean)},!1),o!=null&&(d.isFunction(o)?r.paramsSerializer={serialize:o}:Zo.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),Zo.assertOptions(r,{baseUrl:zt.spelling("baseURL"),withXsrfToken:zt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=i&&d.merge(i.common,i[r.method]);i&&d.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),r.headers=ke.concat(s,i);let a=[],c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});let l=[];this.interceptors.response.forEach(function(g){l.push(g.fulfilled,g.rejected)});let h,u=0,p;if(!c){let f=[ea.bind(this),void 0];for(f.unshift.apply(f,a),f.push.apply(f,l),p=f.length,h=Promise.resolve(r);u<p;)h=h.then(f[u++],f[u++]);return h}p=a.length;let y=r;for(u=0;u<p;){let f=a[u++],g=a[u++];try{y=f(y)}catch(b){g.call(this,b);break}}try{h=ea.call(this,y)}catch(f){return Promise.reject(f)}for(u=0,p=l.length;u<p;)h=h.then(l[u++],l[u++]);return h}getUri(t){t=Tt(this.defaults,t);let r=Qo(t.baseURL,t.url,t.allowAbsoluteUrls);return Go(r,t.params,t.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(t){Jn.prototype[t]=function(r,n){return this.request(Tt(n||{},{method:t,url:r,data:(n||{}).data}))}});d.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}))}}Jn.prototype[t]=r(),Jn.prototype[t+"Form"]=r(!0)});var ei=Jn;var jh=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}}},vg=jh;function Vh(e){return function(r){return e.apply(null,r)}}function Hh(e){return d.isObject(e)&&e.isAxiosError===!0}var zh={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(zh).forEach(([e,t])=>{zh[t]=e});var _g=zh;function Sg(e){let t=new ei(e),r=$o(ei.prototype.request,t);return d.extend(r,ei.prototype,t,{allOwnKeys:!0}),d.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Sg(Tt(e,o))},r}var we=Sg(Gn);we.Axios=ei;we.CanceledError=Ht;we.CancelToken=vg;we.isCancel=Jo;we.VERSION=ta;we.toFormData=kr;we.AxiosError=P;we.Cancel=we.CanceledError;we.all=function(t){return Promise.all(t)};we.spread=Vh;we.isAxiosError=Hh;we.mergeConfig=Tt;we.AxiosHeaders=ke;we.formToJSON=e=>Ks(d.isHTMLForm(e)?new FormData(e):e);we.getAdapter=Zs.getAdapter;we.HttpStatusCode=_g;we.default=we;var $t=we;var{Axios:pC,AxiosError:fC,CanceledError:mC,isCancel:gC,CancelToken:yC,VERSION:bC,all:wC,Cancel:vC,isAxiosError:_C,spread:SC,toFormData:kC,AxiosHeaders:EC,HttpStatusCode:CC,formToJSON:AC,getAdapter:xC,mergeConfig:TC}=$t;var r4="https://proctoring-api-dev.easyproctor.tech/api",n4="https://proctoring-api-hml.easyproctor.tech/api",kg="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"?r4:t==="homol"?n4:kg}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 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,latitude:n,longitude:o},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,r){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 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 $t.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 na=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 $t.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 Xr=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 Yn=class{constructor(t,r){this.backendService=new na;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 Xr;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 Xr;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};function oa(e){return e.width&&e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var Eg={width:1280,height:720,minWidth:640,minHeight:480};var ia,Cg=e=>(ia=e,ia),tt={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)=>ia&&ia.log(e,t),N={registerStart:(e,t,r)=>rt(tt.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>rt(tt.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>rt(tt.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>rt(tt.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,o)=>rt(tt.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:o}),registerUploadFile:(e,t,r)=>rt(tt.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>rt(tt.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>rt(tt.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>rt(tt.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>rt(tt.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>rt(tt.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>rt(tt.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>rt(tt.SAVE_ON_SESSION,{proctoringId:e,description:t})};var ti;function sa(e){ti=e}function Jr(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 u=new MediaRecorder(e,h);u.ondataavailable=w=>{l=l+w.data.size,w.data.size>0&&t.push(w.data),s?(o&&u.state=="inactive"&&(t=[new Blob(t,{type:"audio/webm"})]),i&&i()):((c&&w.data.size===c.data.size||w.data.size===0)&&(ti&&c&&w.data.size===c.data.size&&N.registerOnBufferSizeError(ti,`onBufferSizeError: Recorder size freezed: ${w.data.size} Mb`),ti&&w.data.size===0&&N.registerOnBufferSizeError(ti,"onBufferSizeError: Recorder size equal 0 Mb"),n&&n()),c=w)};function p(){return new Promise(w=>{i=w,u.start(),l=0,s=!1,r&&(a=setInterval(async()=>{await u.requestData()},3e4))})}function y(){return new Promise(w=>{u.state=="recording"?(i=w,u.stop(),s=!0,clearInterval(a),e.getTracks().forEach(_=>{_.stop()})):w()})}function f(){return new Promise(w=>{u.state=="recording"&&u.pause(),w()})}function g(){return new Promise(w=>{u.state=="paused"&&u.resume(),w()})}function b(){return l}return{startRecording:p,stopRecording:y,pauseRecording:f,resumeRecording:g,recorderOptions:h,getBufferSize:b}}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 u=this.imageBatchNum;u<this.imageBatchNum+60;u++){let p=`${this.proctoringId}/${this.proctoringId}_${u+1}.jpg`;(u+1)%n==0&&(p=`${this.proctoringId}/${this.proctoringId}_${u+1}_realtime.jpg`),l.push({objectName:p,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(u=>{this.imageUrlPackage.push(u)}),this.imageBatchNum+=60}let c=!1;return c=await $t.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 N.registerError(this.proctoringId,`Failed to upload to AWS
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}),this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r}),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";default:return t}}};function jm(){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 Gn=class extends qn{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}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,p=(n.boundingBox.width-10)*c,b=n.boundingBox.height*l,f=document.createElement("p");f.innerText="Confidence: "+Math.round(parseFloat(n.categories[0].score)*100)+"% .",f.style.right=h+"px",f.style.top=d-50+"px",f.style.width=p+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(f.style,{...g,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=p+"px",y.style.height=b-10+"px",Object.assign(y.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(f),this.children.push(y),this.children.push(f);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){this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent&&(this.numFacesSent=r.detections.length,r.detections.length===0?this.handleAlert("no_face_detected","face_detection_on_stream"):r.detections.length>1?this.handleAlert("multiple_faces_detected","face_detection_on_stream"):this.handleOk("face_ok","face_detection_on_stream"));let n=r.detections[0]?.keypoints[3].y-r.detections[0]?.keypoints[0].y;r.detections[0]?.keypoints[4].x<.2||r.detections[0]?.keypoints[5].x>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):r.detections[0]?.keypoints[0].y<.2||r.detections[0]?.keypoints[0].y>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):r.detections[0]?.keypoints[3].y<.4||r.detections[0]?.keypoints[3].y>.9?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):n>.35?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Yo(e,t){return function(){return e.apply(t,arguments)}}var{toString:W3}=Object.prototype,{getPrototypeOf:kh}=Object,Ws=(e=>t=>{let r=W3.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),At=e=>(e=e.toLowerCase(),t=>Ws(t)===e),$s=e=>t=>typeof t===e,{isArray:Kn}=Array,Qo=$s("undefined");function $3(e){return e!==null&&!Qo(e)&&e.constructor!==null&&!Qo(e.constructor)&&et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Hm=At("ArrayBuffer");function q3(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Hm(e.buffer),t}var G3=$s("string"),et=$s("function"),zm=$s("number"),qs=e=>e!==null&&typeof e=="object",K3=e=>e===!0||e===!1,zs=e=>{if(Ws(e)!=="object")return!1;let t=kh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},X3=At("Date"),J3=At("File"),Y3=At("Blob"),Q3=At("FileList"),Z3=e=>qs(e)&&et(e.pipe),eb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||et(e.append)&&((t=Ws(e))==="formdata"||t==="object"&&et(e.toString)&&e.toString()==="[object FormData]"))},tb=At("URLSearchParams"),[rb,nb,ob,ib]=["ReadableStream","Request","Response","Headers"].map(At),sb=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Zo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),Kn(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 Wm(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 Xr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$m=e=>!Qo(e)&&e!==Xr;function Sh(){let{caseless:e}=$m(this)&&this||{},t={},r=(n,o)=>{let i=e&&Wm(t,o)||o;zs(t[i])&&zs(n)?t[i]=Sh(t[i],n):zs(n)?t[i]=Sh({},n):Kn(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&Zo(arguments[n],r);return t}var ab=(e,t,r,{allOwnKeys:n}={})=>(Zo(t,(o,i)=>{r&&et(o)?e[i]=Yo(o,r):e[i]=o},{allOwnKeys:n}),e),cb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),lb=(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)},hb=(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&&kh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},db=(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},ub=e=>{if(!e)return null;if(Kn(e))return e;let t=e.length;if(!zm(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},pb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&kh(Uint8Array)),fb=(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])}},mb=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},gb=At("HTMLFormElement"),yb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),Vm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bb=At("RegExp"),qm=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Zo(r,(o,i)=>{let s;(s=t(o,i,e))!==!1&&(n[i]=s||o)}),Object.defineProperties(e,n)},vb=e=>{qm(e,(t,r)=>{if(et(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(et(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+"'")})}})},wb=(e,t)=>{let r={},n=o=>{o.forEach(i=>{r[i]=!0})};return Kn(e)?n(e):n(String(e).split(t)),r},_b=()=>{},Sb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function kb(e){return!!(e&&et(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Eb=e=>{let t=new Array(10),r=(n,o)=>{if(qs(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let i=Kn(n)?[]:{};return Zo(n,(s,a)=>{let c=r(s,o+1);!Qo(c)&&(i[a]=c)}),t[o]=void 0,i}}return n};return r(e,0)},Cb=At("AsyncFunction"),xb=e=>e&&(qs(e)||et(e))&&et(e.then)&&et(e.catch),Gm=((e,t)=>e?setImmediate:t?((r,n)=>(Xr.addEventListener("message",({source:o,data:i})=>{o===Xr&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),Xr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",et(Xr.postMessage)),Ab=typeof queueMicrotask<"u"?queueMicrotask.bind(Xr):typeof process<"u"&&process.nextTick||Gm,u={isArray:Kn,isArrayBuffer:Hm,isBuffer:$3,isFormData:eb,isArrayBufferView:q3,isString:G3,isNumber:zm,isBoolean:K3,isObject:qs,isPlainObject:zs,isReadableStream:rb,isRequest:nb,isResponse:ob,isHeaders:ib,isUndefined:Qo,isDate:X3,isFile:J3,isBlob:Y3,isRegExp:bb,isFunction:et,isStream:Z3,isURLSearchParams:tb,isTypedArray:pb,isFileList:Q3,forEach:Zo,merge:Sh,extend:ab,trim:sb,stripBOM:cb,inherits:lb,toFlatObject:hb,kindOf:Ws,kindOfTest:At,endsWith:db,toArray:ub,forEachEntry:fb,matchAll:mb,isHTMLForm:gb,hasOwnProperty:Vm,hasOwnProp:Vm,reduceDescriptors:qm,freezeMethods:vb,toObjectSet:wb,toCamelCase:yb,noop:_b,toFiniteNumber:Sb,findKey:Wm,global:Xr,isContextDefined:$m,isSpecCompliantForm:kb,toJSONObject:Eb,isAsyncFn:Cb,isThenable:xb,setImmediate:Gm,asap:Ab};function Xn(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)}u.inherits(Xn,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:u.toJSONObject(this.config),code:this.code,status:this.status}}});var Km=Xn.prototype,Xm={};["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=>{Xm[e]={value:e}});Object.defineProperties(Xn,Xm);Object.defineProperty(Km,"isAxiosError",{value:!0});Xn.from=(e,t,r,n,o,i)=>{let s=Object.create(Km);return u.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Xn.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};var P=Xn;var Gs=null;function Eh(e){return u.isPlainObject(e)||u.isArray(e)}function Ym(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function Jm(e,t,r){return e?e.concat(t).map(function(o,i){return o=Ym(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function Tb(e){return u.isArray(e)&&!e.some(Eh)}var Ib=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Pb(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new(Gs||FormData),r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!u.isUndefined(y[g])});let n=r.metaTokens,o=r.visitor||h,i=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(o))throw new TypeError("visitor must be a function");function l(f){if(f===null)return"";if(u.isDate(f))return f.toISOString();if(!c&&u.isBlob(f))throw new P("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(f)||u.isTypedArray(f)?c&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function h(f,g,y){let v=f;if(f&&!y&&typeof f=="object"){if(u.endsWith(g,"{}"))g=n?g:g.slice(0,-2),f=JSON.stringify(f);else if(u.isArray(f)&&Tb(f)||(u.isFileList(f)||u.endsWith(g,"[]"))&&(v=u.toArray(f)))return g=Ym(g),v.forEach(function(x,B){!(u.isUndefined(x)||x===null)&&t.append(s===!0?Jm([g],B,i):s===null?g:g+"[]",l(x))}),!1}return Eh(f)?!0:(t.append(Jm(y,g,i),l(f)),!1)}let d=[],p=Object.assign(Ib,{defaultVisitor:h,convertValue:l,isVisitable:Eh});function b(f,g){if(!u.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(f),u.forEach(f,function(v,_){(!(u.isUndefined(v)||v===null)&&o.call(t,v,u.isString(_)?_.trim():_,g,p))===!0&&b(v,g?g.concat(_):[_])}),d.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return b(e),t}var kr=Pb;function Qm(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Zm(e,t){this._pairs=[],e&&kr(e,this,t)}var eg=Zm.prototype;eg.append=function(t,r){this._pairs.push([t,r])};eg.toString=function(t){let r=t?function(n){return t.call(this,n,Qm)}:Qm;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Ks=Zm;function Rb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ei(e,t,r){if(!t)return e;let n=r&&r.encode||Rb;u.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize,i;if(o?i=o(t,r):i=u.isURLSearchParams(t)?t.toString():new Ks(t,r).toString(n),i){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var Ch=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){u.forEach(this.handlers,function(n){n!==null&&t(n)})}},xh=Ch;var Xs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var tg=typeof URLSearchParams<"u"?URLSearchParams:Ks;var rg=typeof FormData<"u"?FormData:null;var ng=typeof Blob<"u"?Blob:null;var og={isBrowser:!0,classes:{URLSearchParams:tg,FormData:rg,Blob:ng},protocols:["http","https","file","blob","url","data"]};var Ih={};yy(Ih,{hasBrowserEnv:()=>Th,hasStandardBrowserEnv:()=>Db,hasStandardBrowserWebWorkerEnv:()=>Ob,navigator:()=>Ah,origin:()=>Bb});var Th=typeof window<"u"&&typeof document<"u",Ah=typeof navigator=="object"&&navigator||void 0,Db=Th&&(!Ah||["ReactNative","NativeScript","NS"].indexOf(Ah.product)<0),Ob=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Bb=Th&&window.location.href||"http://localhost";var oe={...Ih,...og};function Ph(e,t){return kr(e,new oe.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return oe.isNode&&u.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Mb(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lb(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 Ub(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&&u.isArray(o)?o.length:s,c?(u.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!a):((!o[s]||!u.isObject(o[s]))&&(o[s]=[]),t(r,n,o[s],i)&&u.isArray(o[s])&&(o[s]=Lb(o[s])),!a)}if(u.isFormData(e)&&u.isFunction(e.entries)){let r={};return u.forEachEntry(e,(n,o)=>{t(Mb(n),o,r,0)}),r}return null}var Js=Ub;function Fb(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Rh={transitional:Xs,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return o?JSON.stringify(Js(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.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 Ph(t,this.formSerializer).toString();if((a=u.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),Fb(t)):t}],transformResponse:[function(t){let r=this.transitional||Rh.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.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}}};u.forEach(["delete","get","head","post","put","patch"],e=>{Rh.headers[e]={}});var Jn=Rh;var Nb=u.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"]),ig=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]&&Nb[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 ti(e){return e&&String(e).trim().toLowerCase()}function Ys(e){return e===!1||e==null?e:u.isArray(e)?e.map(Ys):String(e)}function jb(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 Vb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Dh(e,t,r,n,o){if(u.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!u.isString(t)){if(u.isString(n))return t.indexOf(n)!==-1;if(u.isRegExp(n))return n.test(t)}}function Hb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function zb(e,t){let r=u.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 Yn=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function i(a,c,l){let h=ti(c);if(!h)throw new Error("header name must be a non-empty string");let d=u.findKey(o,h);(!d||o[d]===void 0||l===!0||l===void 0&&o[d]!==!1)&&(o[d||c]=Ys(a))}let s=(a,c)=>u.forEach(a,(l,h)=>i(l,h,c));if(u.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(u.isString(t)&&(t=t.trim())&&!Vb(t))s(ig(t),r);else if(u.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=ti(t),t){let n=u.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return jb(o);if(u.isFunction(r))return r.call(this,o,n);if(u.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ti(t),t){let n=u.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Dh(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function i(s){if(s=ti(s),s){let a=u.findKey(n,s);a&&(!r||Dh(n,n[a],a,r))&&(delete n[a],o=!0)}}return u.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||Dh(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){let r=this,n={};return u.forEach(this,(o,i)=>{let s=u.findKey(n,i);if(s){r[s]=Ys(o),delete r[i];return}let a=t?Hb(i):String(i).trim();a!==i&&delete r[i],r[a]=Ys(o),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return u.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&u.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[sg]=this[sg]={accessors:{}}).accessors,o=this.prototype;function i(s){let a=ti(s);n[a]||(zb(o,s),n[a]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};Yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(Yn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});u.freezeMethods(Yn);var ke=Yn;function ri(e,t){let r=this||Jn,n=t||r,o=ke.from(n.headers),i=n.data;return u.forEach(e,function(a){i=a.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ni(e){return!!(e&&e.__CANCEL__)}function ag(e,t,r){P.call(this,e??"canceled",P.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(ag,P,{__CANCEL__:!0});var Ht=ag;function oi(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 Oh(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Wb(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,p=0;for(;d!==o;)p+=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(p*1e3/b):void 0}}var cg=Wb;function $b(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 lg=$b;var Qn=(e,t,r=3)=>{let n=0,o=cg(50,250);return lg(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)},Bh=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Mh=e=>(...t)=>u.asap(()=>e(...t));var hg=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 dg=oe.hasStandardBrowserEnv?{write(e,t,r,n,o,i){let s=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),u.isString(n)&&s.push("path="+n),u.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 Lh(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Uh(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ii(e,t,r){let n=!Lh(t);return e&&(n||r==!1)?Uh(e,t):t}var ug=e=>e instanceof ke?{...e}:e;function Tt(e,t){t=t||{};let r={};function n(l,h,d,p){return u.isPlainObject(l)&&u.isPlainObject(h)?u.merge.call({caseless:p},l,h):u.isPlainObject(h)?u.merge({},h):u.isArray(h)?h.slice():h}function o(l,h,d,p){if(u.isUndefined(h)){if(!u.isUndefined(l))return n(void 0,l,d,p)}else return n(l,h,d,p)}function i(l,h){if(!u.isUndefined(h))return n(void 0,h)}function s(l,h){if(u.isUndefined(h)){if(!u.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(ug(l),ug(h),d,!0)};return u.forEach(Object.keys(Object.assign({},e,t)),function(h){let d=c[h]||o,p=d(e[h],t[h],h);u.isUndefined(p)&&d!==a||(r[h]=p)}),r}var Qs=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=ei(ii(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(u.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&&u.isFunction(n)&&(n=n(t)),n||n!==!1&&hg(t.url))){let l=o&&i&&dg.read(i);l&&s.set(o,l)}return t};var qb=typeof XMLHttpRequest<"u",pg=qb&&function(e){return new Promise(function(r,n){let o=Qs(e),i=o.data,s=ke.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,h,d,p,b,f;function g(){b&&b(),f&&f(),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};oi(function(ue){r(ue),g()},function(ue){n(ue),g()},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||Xs;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&&u.forEach(s.toJSON(),function(B,O){y.setRequestHeader(O,B)}),u.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),l&&([p,f]=Qn(l,!0),y.addEventListener("progress",p)),c&&y.upload&&([d,b]=Qn(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 _=Oh(o.url);if(_&&oe.protocols.indexOf(_)===-1){n(new P("Unsupported protocol "+_+":",P.ERR_BAD_REQUEST,e));return}y.send(i||null)})};var Gb=(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=()=>u.asap(a),c}},fg=Gb;var Kb=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},Xb=async function*(e,t){for await(let r of Jb(e))yield*Kb(r,t)},Jb=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()}},Fh=(e,t,r,n)=>{let o=Xb(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 p=i+=d;r(p)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var ea=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",gg=ea&&typeof ReadableStream=="function",Yb=ea&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),yg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Qb=gg&&yg(()=>{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}),mg=64*1024,Nh=gg&&yg(()=>u.isReadableStream(new Response("").body)),Zs={stream:Nh&&(e=>e.body)};ea&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Zs[t]&&(Zs[t]=u.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 Zb=async e=>{if(e==null)return 0;if(u.isBlob(e))return e.size;if(u.isSpecCompliantForm(e))return(await new Request(oe.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(u.isArrayBufferView(e)||u.isArrayBuffer(e))return e.byteLength;if(u.isURLSearchParams(e)&&(e=e+""),u.isString(e))return(await Yb(e)).byteLength},e4=async(e,t)=>{let r=u.toFiniteNumber(e.getContentLength());return r??Zb(t)},bg=ea&&(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:p}=Qs(e);l=l?(l+"").toLowerCase():"text";let b=fg([o,i&&i.toAbortSignal()],s),f,g=b&&b.unsubscribe&&(()=>{b.unsubscribe()}),y;try{if(c&&Qb&&r!=="get"&&r!=="head"&&(y=await e4(h,n))!==0){let O=new Request(t,{method:"POST",body:n,duplex:"half"}),R;if(u.isFormData(n)&&(R=O.headers.get("content-type"))&&h.setContentType(R),O.body){let[ue,se]=Bh(y,Qn(Mh(c)));n=Fh(O.body,mg,ue,se)}}u.isString(d)||(d=d?"include":"omit");let v="credentials"in Request.prototype;f=new Request(t,{...p,signal:b,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:v?d:void 0});let _=await fetch(f),x=Nh&&(l==="stream"||l==="response");if(Nh&&(a||x&&g)){let O={};["status","statusText","headers"].forEach(Nr=>{O[Nr]=_[Nr]});let R=u.toFiniteNumber(_.headers.get("content-length")),[ue,se]=a&&Bh(R,Qn(Mh(a),!0))||[];_=new Response(Fh(_.body,mg,ue,()=>{se&&se(),g&&g()}),O)}l=l||"text";let B=await Zs[u.findKey(Zs,l)||"text"](_,e);return!x&&g&&g(),await new Promise((O,R)=>{oi(O,R,{data:B,headers:ke.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:f})})}catch(v){throw g&&g(),v&&v.name==="TypeError"&&/fetch/i.test(v.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,e,f),{cause:v.cause||v}):P.from(v,v&&v.code,e,f)}});var jh={http:Gs,xhr:pg,fetch:bg};u.forEach(jh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var vg=e=>`- ${e}`,t4=e=>u.isFunction(e)||e===null||e===!1,ta={getAdapter:e=>{e=u.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,!t4(r)&&(n=jh[(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(vg).join(`
69
+ `):" "+vg(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:jh};function Vh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ht(null,e)}function ra(e){return Vh(e),e.headers=ke.from(e.headers),e.data=ri.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ta.getAdapter(e.adapter||Jn.adapter)(e).then(function(n){return Vh(e),n.data=ri.call(e,e.transformResponse,n),n.headers=ke.from(n.headers),n},function(n){return ni(n)||(Vh(e),n&&n.response&&(n.response.data=ri.call(e,e.transformResponse,n.response),n.response.headers=ke.from(n.response.headers))),Promise.reject(n)})}var na="1.8.4";var oa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{oa[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var wg={};oa.transitional=function(t,r,n){function o(i,s){return"[Axios v"+na+"] 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&&!wg[s]&&(wg[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}};oa.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function r4(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 si={assertOptions:r4,validators:oa};var zt=si.validators,Zn=class{constructor(t){this.defaults=t,this.interceptors={request:new xh,response:new xh}}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&&si.assertOptions(n,{silentJSONParsing:zt.transitional(zt.boolean),forcedJSONParsing:zt.transitional(zt.boolean),clarifyTimeoutError:zt.transitional(zt.boolean)},!1),o!=null&&(u.isFunction(o)?r.paramsSerializer={serialize:o}:si.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),si.assertOptions(r,{baseUrl:zt.spelling("baseURL"),withXsrfToken:zt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=i&&u.merge(i.common,i[r.method]);i&&u.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),r.headers=ke.concat(s,i);let a=[],c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});let l=[];this.interceptors.response.forEach(function(g){l.push(g.fulfilled,g.rejected)});let h,d=0,p;if(!c){let f=[ra.bind(this),void 0];for(f.unshift.apply(f,a),f.push.apply(f,l),p=f.length,h=Promise.resolve(r);d<p;)h=h.then(f[d++],f[d++]);return h}p=a.length;let b=r;for(d=0;d<p;){let f=a[d++],g=a[d++];try{b=f(b)}catch(y){g.call(this,y);break}}try{h=ra.call(this,b)}catch(f){return Promise.reject(f)}for(d=0,p=l.length;d<p;)h=h.then(l[d++],l[d++]);return h}getUri(t){t=Tt(this.defaults,t);let r=ii(t.baseURL,t.url,t.allowAbsoluteUrls);return ei(r,t.params,t.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(t){Zn.prototype[t]=function(r,n){return this.request(Tt(n||{},{method:t,url:r,data:(n||{}).data}))}});u.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}))}}Zn.prototype[t]=r(),Zn.prototype[t+"Form"]=r(!0)});var ai=Zn;var Hh=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}}},_g=Hh;function zh(e){return function(r){return e.apply(null,r)}}function Wh(e){return u.isObject(e)&&e.isAxiosError===!0}var $h={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($h).forEach(([e,t])=>{$h[t]=e});var Sg=$h;function kg(e){let t=new ai(e),r=Yo(ai.prototype.request,t);return u.extend(r,ai.prototype,t,{allOwnKeys:!0}),u.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return kg(Tt(e,o))},r}var ve=kg(Jn);ve.Axios=ai;ve.CanceledError=Ht;ve.CancelToken=_g;ve.isCancel=ni;ve.VERSION=na;ve.toFormData=kr;ve.AxiosError=P;ve.Cancel=ve.CanceledError;ve.all=function(t){return Promise.all(t)};ve.spread=zh;ve.isAxiosError=Wh;ve.mergeConfig=Tt;ve.AxiosHeaders=ke;ve.formToJSON=e=>Js(u.isHTMLForm(e)?new FormData(e):e);ve.getAdapter=ta.getAdapter;ve.HttpStatusCode=Sg;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 n4="https://proctoring-api-dev.easyproctor.tech/api",o4="https://proctoring-api-hml.easyproctor.tech/api",Eg="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"?n4:t==="homol"?o4:Eg}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 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,latitude:n,longitude:o},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,r){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 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 ia=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 Jr=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 eo=class{constructor(t,r){this.backendService=new ia;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 Jr;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 Jr;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};function sa(e){return e.width&&e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var Cg={width:1280,height:720,minWidth:640,minHeight:480};function xg(){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 Yr(){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 aa,Ag=e=>(aa=e,aa),tt={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)=>aa&&aa.log(e,t),N={registerStart:(e,t,r)=>rt(tt.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>rt(tt.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>rt(tt.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>rt(tt.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,o)=>rt(tt.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:o}),registerUploadFile:(e,t,r)=>rt(tt.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>rt(tt.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>rt(tt.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>rt(tt.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>rt(tt.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>rt(tt.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>rt(tt.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>rt(tt.SAVE_ON_SESSION,{proctoringId:e,description:t})};var ci;function ca(e){ci=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)&&(ci&&c&&v.data.size===c.data.size&&N.registerOnBufferSizeError(ci,`onBufferSizeError: Recorder size freezed: ${v.data.size} Mb`),ci&&v.data.size===0&&N.registerOnBufferSizeError(ci,"onBufferSizeError: Recorder size equal 0 Mb"),n&&n()),c=v)};function p(){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 f(){return new Promise(v=>{d.state=="recording"&&d.pause(),v()})}function g(){return new Promise(v=>{d.state=="paused"&&d.resume(),v()})}function y(){return l}return{startRecording:p,stopRecording:b,pauseRecording:f,resumeRecording:g,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 p=`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`;(d+1)%n==0&&(p=`${this.proctoringId}/${this.proctoringId}_${d+1}_realtime.jpg`),l.push({objectName:p,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 N.registerError(this.proctoringId,`Failed to upload to AWS
71
71
  File name: ${o.name}
72
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 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,o,this.proctoringId);let c=!1;return n?c=await $t.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 $t.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 N.registerError(this.proctoringId,`Failed to upload to AWS
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 N.registerError(this.proctoringId,`Failed to upload to AWS
74
74
  File name: ${o.name}
75
75
  File type: ${o.type}
76
- File size: ${o.size}`),new Error("Failed to upload to AWS")}}};var Ag="not_shared_first_screen",xg="not_shared_screen",aa="multiple_monitors_detected",Tg="proctoring_already_started",ca="proctoring_not_started";var Ig="another_stream_active",Pg="stream_under_minimum_permitted",Rg="browser_not_supported",Dg="token_missing",Og="credentials_missing";var Bg="spy_scan_api_not_found";var Mg="external_camera_not_started";var la=class extends zn{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)}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,u=(r.boundingBox.width-10)*a,p=r.boundingBox.height*c,y=document.createElement("p");y.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",y.style.right=l-20+"px",y.style.top=h+"px",y.style.width=u+"px";let f={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(y.style,{...f,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let g=document.createElement("div");g.setAttribute("class","highlighter"),g.style.right=l-20+"px",g.style.top=h+"px",g.style.width=u+"px",g.style.height=p-20+"px",Object.assign(g.style,{...f,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(g),this.liveView.appendChild(y),this.children.push(g),this.children.push(y)}}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 Er=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,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(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.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)),sa(t)}async initializeDetectors(){Nm(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new la({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new $n({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.cameraStream=await navigator.mediaDevices.getUserMedia(i)}catch(f){throw f.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":f}let{startRecording:s,stopRecording:a,pauseRecording:c,resumeRecording:l,recorderOptions:h,getBufferSize:u}=Jr(this.cameraStream,this.blobs,this.options.onBufferSizeError,f=>this.bufferError(f),!1);this.recordingStart=s,this.recordingStop=a,this.recordingPause=c,this.recordingResume=l,this.recorderOptions=h,this.getBufferSize=u,this.recordingStart();let y=this.cameraStream.getVideoTracks()[0].getSettings();if(this.videoOptions.minWidth>y.width||this.videoOptions.minHeight>y.height)throw Pg;if(this.videoOptions.width!==y.width||this.videoOptions.height!==y.height)throw N.registerAnotherStream(this.proctoringId,`Maybe have another stream active
76
+ File size: ${o.size}`),new Error("Failed to upload to AWS")}}};var Tg="not_shared_first_screen",Ig="not_shared_screen",la="multiple_monitors_detected",Pg="proctoring_already_started",ha="proctoring_not_started";var Rg="another_stream_active",Dg="stream_under_minimum_permitted",Og="browser_not_supported",Bg="token_missing",Mg="credentials_missing";var Lg="spy_scan_api_not_found";var Ug="external_camera_not_started";var da=class extends qn{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)}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,p=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 f={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(b.style,{...f,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let g=document.createElement("div");g.setAttribute("class","highlighter"),g.style.right=l-20+"px",g.style.top=h+"px",g.style.width=d+"px",g.style.height=p-20+"px",Object.assign(g.style,{...f,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(g),this.liveView.appendChild(b),this.children.push(g),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 Er=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.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)),ca(t)}async initializeDetectors(){jm(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new da({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Gn({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.cameraStream=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}let{startRecording:s,stopRecording:a,pauseRecording:c,resumeRecording:l,recorderOptions:h,getBufferSize:d}=Qr(this.cameraStream,this.blobs,this.options.onBufferSizeError,v=>this.bufferError(v),!1);this.recordingStart=s,this.recordingStop=a,this.recordingPause=c,this.recordingResume=l,this.recorderOptions=h,this.getBufferSize=d,this.recordingStart();let b=this.cameraStream.getVideoTracks()[0].getSettings(),{width:f=0,height:g=0}=b,y=screen.orientation?.type.includes("portrait");if(y&&Yr()&&this.videoOptions.width==g&&this.videoOptions.height==f&&([f,g]=[g,f]),console.log("isPortrait -> ",y),console.log("this.isMobileDevice() -> ",Yr()),console.log("width -> ",f),console.log("height -> ",g),console.log("minWidth -> ",this.videoOptions.minWidth),console.log("minHeight -> ",this.videoOptions.minHeight),console.log("this.videoOptions.width -> ",this.videoOptions.width),console.log("this.videoOptions.height -> ",this.videoOptions.height),console.log("settings.width -> ",b.width),console.log("settings.height -> ",b.height),this.videoOptions.minWidth>f||this.videoOptions.minHeight>g)throw Dg;if(this.videoOptions.width!==f||this.videoOptions.height!==g)throw N.registerAnotherStream(this.proctoringId,`Maybe have another stream active
77
77
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
78
- Setting: ${JSON.stringify(y,null,2)}`),Ig;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()}async stopRecording(){if(this.recordingStop&&await this.recordingStop(),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)}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&&N.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
78
+ Setting: ${JSON.stringify(b,null,2)}`),Rg;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()}async stopRecording(){if(this.recordingStop&&await this.recordingStop(),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)}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&&N.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
79
  Sample Rate: ${n.sampleRate}
80
80
  Sample Size: ${n.sampleSize}
81
81
 
82
82
  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 Er(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++}};var ha=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=`
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 Er(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++}};var ua=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=`
84
84
  .alert-div {
85
85
  display: flex;
86
86
  align-items: center;
@@ -91,11 +91,17 @@ Setting: ${JSON.stringify(y,null,2)}`),Ig;this.paramsConfig.imageBehaviourParame
91
91
  display: inline-block;
92
92
  width: 22px;
93
93
  height: 22px;
94
+ min-width: 22px;
95
+ max-width: 22px;
96
+ min-height: 22px;
97
+ max-height: 22px;
98
+ flex-shrink: 0;
94
99
  -ms-transform: rotate(45deg); /* IE 9 */
95
100
  -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
96
101
  transform: rotate(45deg);
97
102
  border: 1px solid #16A34A;
98
103
  border-radius: 22px;
104
+ box-sizing: border-box;
99
105
  }
100
106
 
101
107
  .checkmark_stem {
@@ -120,11 +126,17 @@ Setting: ${JSON.stringify(y,null,2)}`),Ig;this.paramsConfig.imageBehaviourParame
120
126
  display: inline-block;
121
127
  width: 22px;
122
128
  height: 22px;
129
+ min-width: 22px;
130
+ max-width: 22px;
131
+ min-height: 22px;
132
+ max-height: 22px;
133
+ flex-shrink: 0;
123
134
  -ms-transform: rotate(45deg); /* IE 9 */
124
135
  -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
125
136
  transform: rotate(45deg);
126
137
  border: 1px solid #FF0000;
127
138
  border-radius: 22px;
139
+ box-sizing: border-box;
128
140
  }
129
141
 
130
142
  .checkmark_stem_error {
@@ -175,7 +187,180 @@ Setting: ${JSON.stringify(y,null,2)}`),Ig;this.paramsConfig.imageBehaviourParame
175
187
  left: 5px;
176
188
  top: 2px;
177
189
  }
178
- `,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%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(r,n);let o=document.createElement("div"),i={backgroundColor:"#fff",zIndex:"1001",width:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,i);let s=document.createElement("h3");s.innerText="Para iniciar configure a c\xE2mera e o microfone";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"),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 p={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,p),h.style.maxWidth="400px",c.appendChild(l),c.appendChild(h),o.appendChild(c);let y=document.createElement("div");y.setAttribute("id","liveCheckDevices");let f=document.createElement("div"),g=document.createElement("video"),b=document.createElement("div");g.setAttribute("id","cameraStream"),g.muted=!0;let w={width:"calc(100% - 40px)",display:"flex",justifyContent:"space-between",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",transform:"rotateY(180deg)"};this.applyStyles(y,w);let _={width:"20rem",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(g,_),this.applyStyles(f,{position:"relative"});let A=document.createElement("div");A.setAttribute("class","alert-div"),A.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"),de=document.createElement("div");O.setAttribute("id","checkmark_resolution"),R.setAttribute("id","checkmark_stem_resolution"),de.setAttribute("id","checkmark_kick_resolution"),O.appendChild(R),O.appendChild(de);let se=document.createElement("span"),Nr=document.createElement("div"),Ii=document.createElement("div");se.setAttribute("class","info"),se.setAttribute("id","info_resolution"),Nr.setAttribute("class","info_stem"),Ii.setAttribute("class","info_kick"),se.appendChild(Nr),se.appendChild(Ii),A.appendChild(O),A.appendChild(B),A.appendChild(se);let jr=document.createElement("div");jr.setAttribute("class","alert-div"),jr.setAttribute("id","alertDivFacePosition");let Pi=document.createElement("error");Pi.setAttribute("id","facePositionAlert"),Pi.innerText="Posicionamento da face",Pi.style.marginLeft="10px";let Ri=document.createElement("span"),wd=document.createElement("div"),vd=document.createElement("div");Ri.setAttribute("id","checkmark_FacePosition"),wd.setAttribute("id","checkmark_stem_FacePosition"),vd.setAttribute("id","checkmark_kick_FacePosition"),Ri.appendChild(wd),Ri.appendChild(vd),jr.appendChild(Ri),jr.appendChild(Pi);let _o=document.createElement("div");_o.setAttribute("class","alert-div"),_o.setAttribute("id","alertDivAmbientVerify");let Di=document.createElement("error");Di.setAttribute("id","ambientVerifyAlert"),Di.innerText="Verifica\xE7\xE3o do ambiente",Di.style.marginLeft="10px";let Oi=document.createElement("span"),_d=document.createElement("div"),Sd=document.createElement("div");Oi.setAttribute("id","checkmark_AmbientVerify"),_d.setAttribute("id","checkmark_stem_AmbientVerify"),Sd.setAttribute("id","checkmark_kick_AmbientVerify"),Oi.appendChild(_d),Oi.appendChild(Sd),_o.appendChild(Oi),_o.appendChild(Di);let dn=document.createElement("div");dn.setAttribute("class","alert-div"),dn.setAttribute("id","alertDivSpyCam"),dn.style.display="none";let Bi=document.createElement("error");Bi.setAttribute("id","SpyCamAlert"),Bi.innerText="Verifica\xE7\xE3o de Spy Cam",Bi.style.marginLeft="10px";let Mi=document.createElement("span"),kd=document.createElement("div"),Ed=document.createElement("div");Mi.setAttribute("id","checkmark_SpyCam"),kd.setAttribute("id","checkmark_stem_SpyCam"),Ed.setAttribute("id","checkmark_kick_SpyCam"),Mi.appendChild(kd),Mi.appendChild(Ed),dn.appendChild(Mi),dn.appendChild(Bi),b.style.transform="rotateY(180deg)",b.appendChild(A),b.appendChild(jr),b.appendChild(_o),b.appendChild(dn),y.appendChild(b),f.appendChild(g),y.appendChild(f);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",f.appendChild(Xt),f.appendChild(hr),o.appendChild(y);let Li=document.createElement("div"),Bc=document.createElement("h3"),Mc=document.createElement("select");Mc.setAttribute("id","micSelect");let Q2={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(Li,Q2),Bc.innerText="Microfone";let Z2={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Bc,Z2),Mc.style.maxWidth="400px",Li.appendChild(Bc),Li.appendChild(Mc),o.appendChild(Li);let Ui=document.createElement("div"),ey={width:"100%",padding:"0px 40px",display:"flex"};this.applyStyles(Ui,ey);let Fi=document.createElement("div"),ty={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(Fi,ty);let Ni=document.createElement("div");Ni.setAttribute("id","audioStream");let ry={display:"flex",marginBottom:"15px"};this.applyStyles(Ni,ry);let ny={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Rd=0;Rd<25;Rd++){let Dd=document.createElement("div");this.applyStyles(Dd,ny),Ni.appendChild(Dd)}let So=document.createElement("div"),Cd=document.createElement("p"),Ad=document.createElement("p"),xd=document.createElement("p"),oy={width:"250px",display:"flex",justifyContent:"space-between"};this.applyStyles(So,oy),Cd.innerText="0",Ad.innerText="50",xd.innerText="100",So.appendChild(Cd),So.appendChild(Ad),So.appendChild(xd);let pn=document.createElement("div");pn.setAttribute("class","alert-div"),pn.setAttribute("id","alertDivMicrophone");let iy={alignItems:"start",justifyContent:"end",width:"inherit"};this.applyStyles(pn,iy);let ji=document.createElement("error");ji.setAttribute("id","microphoneAlert"),ji.innerText="Teste de funcionamento",ji.style.marginLeft="10px";let Vi=document.createElement("span"),Td=document.createElement("div"),Id=document.createElement("div");Vi.setAttribute("id","checkmark_microphone"),Td.setAttribute("id","checkmark_stem_microphone"),Id.setAttribute("id","checkmark_kick_microphone"),Vi.appendChild(Td),Vi.appendChild(Id),pn.appendChild(Vi),pn.appendChild(ji),Fi.appendChild(Ni),Fi.appendChild(So);let Hi=document.createElement("p");Hi.innerText='Pronuncie em voz alta: "um, dois, tr\xEAs, quatro".',Hi.style.textAlign="start";let sy={width:"100%",marginLeft:"40px",marginBottom:"15px"};this.applyStyles(Hi,sy),Ui.appendChild(Fi),Ui.appendChild(pn),o.appendChild(Hi),o.appendChild(Ui);let ko=document.createElement("div"),ay={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(ko,ay);let zi=document.createElement("button");zi.setAttribute("id","cancelBtn"),zi.innerText="Cancelar";let cy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(zi,cy);let Pd=document.createElement("span"),ly={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(Pd,ly);let fn=document.createElement("button");fn.innerText="Continuar",fn.setAttribute("id","confirmBtn");let hy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(fn,hy),this.options.useSpyScan&&(fn.style.cursor="not-allowed",fn.setAttribute("disabled","true")),ko.appendChild(zi),ko.appendChild(Pd),ko.appendChild(fn),o.appendChild(ko),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.description==="Nenhuma face encontrada"||t.description==="Face na posi\xE7\xE3o errada")&&(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}).
190
+
191
+ /* Responsive styles */
192
+ #checkDevices .modal-responsive {
193
+ box-sizing: border-box !important;
194
+ }
195
+
196
+ #checkDevices .modal-responsive * {
197
+ box-sizing: border-box;
198
+ }
199
+
200
+ /* Desktop screens - maintain gap between checks and camera */
201
+ @media (min-width: 769px) {
202
+ #checkDevices .modal-responsive .camera-container-responsive {
203
+ gap: 20px !important;
204
+ }
205
+ }
206
+
207
+ @media (max-width: 768px) {
208
+ #checkDevices .modal-responsive {
209
+ width: 95% !important;
210
+ max-width: 95% !important;
211
+ margin: 10px !important;
212
+ }
213
+
214
+ #checkDevices .modal-responsive h3 {
215
+ font-size: 18px !important;
216
+ padding: 15px 0px !important;
217
+ }
218
+
219
+ #checkDevices .modal-responsive .camera-header-responsive,
220
+ #checkDevices .modal-responsive .mic-header-responsive {
221
+ flex-direction: column !important;
222
+ gap: 10px !important;
223
+ align-items: flex-start !important;
224
+ }
225
+
226
+ #checkDevices .modal-responsive .camera-header-responsive select,
227
+ #checkDevices .modal-responsive .mic-header-responsive select {
228
+ max-width: 100% !important;
229
+ width: 100% !important;
230
+ }
231
+
232
+ #checkDevices .modal-responsive .camera-container-responsive {
233
+ flex-direction: row !important;
234
+ align-items: flex-start !important;
235
+ gap: 15px !important;
236
+ padding-left: 10px !important;
237
+ padding-right: 10px !important;
238
+ }
239
+
240
+ #checkDevices .modal-responsive .video-responsive {
241
+ width: auto !important;
242
+ max-width: 320px !important;
243
+ flex-shrink: 0 !important;
244
+ max-height: 240px !important;
245
+ }
246
+
247
+ #checkDevices .modal-responsive .video-responsive video {
248
+ width: 100% !important;
249
+ max-width: 320px !important;
250
+ max-height: 200px !important;
251
+ height: auto !important;
252
+ object-fit: contain !important;
253
+ }
254
+
255
+ #checkDevices .modal-responsive .mic-container-responsive {
256
+ flex-direction: column !important;
257
+ padding: 0px 20px !important;
258
+ }
259
+
260
+ #checkDevices .modal-responsive .mic-meter-responsive {
261
+ width: 100% !important;
262
+ }
263
+
264
+ #checkDevices .modal-responsive .range-responsive {
265
+ width: 100% !important;
266
+ }
267
+
268
+ #checkDevices .modal-responsive .pronounce-responsive {
269
+ margin-left: 10px !important;
270
+ margin-right: 10px !important;
271
+ width: calc(100% - 20px) !important;
272
+ }
273
+
274
+ #checkDevices .modal-responsive .button-responsive {
275
+ height: 60px !important;
276
+ font-size: 14px !important;
277
+ }
278
+
279
+ #checkDevices .modal-responsive .divider-responsive {
280
+ height: 60px !important;
281
+ }
282
+ }
283
+
284
+ @media (max-width: 480px) {
285
+ #checkDevices .modal-responsive {
286
+ width: 98% !important;
287
+ max-width: 98% !important;
288
+ border-radius: 8px !important;
289
+ margin: 5px !important;
290
+ }
291
+
292
+ #checkDevices .modal-responsive .camera-header-responsive,
293
+ #checkDevices .modal-responsive .mic-header-responsive {
294
+ gap: 0px !important;
295
+ }
296
+
297
+ #checkDevices .modal-responsive .camera-header-responsive h3,
298
+ #checkDevices .modal-responsive .mic-header-responsive h3 {
299
+ margin: 0 !important;
300
+ margin-top: 0 !important;
301
+ margin-bottom: 0 !important;
302
+ margin-left: 0 !important;
303
+ margin-right: 0 !important;
304
+ padding: 0 !important;
305
+ padding-top: 0 !important;
306
+ padding-bottom: 0 !important;
307
+ }
308
+
309
+ #checkDevices .modal-responsive .camera-header-responsive select,
310
+ #checkDevices .modal-responsive .mic-header-responsive select {
311
+ margin: 0 !important;
312
+ margin-top: 0 !important;
313
+ margin-bottom: 0 !important;
314
+ margin-left: 0 !important;
315
+ margin-right: 0 !important;
316
+ padding-top: 0 !important;
317
+ }
318
+
319
+ #checkDevices .modal-responsive .camera-container-responsive {
320
+ flex-direction: row !important;
321
+ gap: 10px !important;
322
+ padding-left: 5px !important;
323
+ padding-right: 5px !important;
324
+ }
325
+
326
+ #checkDevices .modal-responsive .video-responsive {
327
+ max-width: 200px !important;
328
+ max-height: 150px !important;
329
+ }
330
+
331
+ #checkDevices .modal-responsive .video-responsive video {
332
+ max-width: 200px !important;
333
+ max-height: 150px !important;
334
+ }
335
+
336
+ #checkDevices .modal-responsive .pronounce-responsive {
337
+ margin-left: 5px !important;
338
+ margin-right: 5px !important;
339
+ width: calc(100% - 10px) !important;
340
+ padding: 0 5px !important;
341
+ }
342
+
343
+ #checkDevices .modal-responsive h3 {
344
+ font-size: 16px !important;
345
+ padding: 12px 0px !important;
346
+ margin-bottom: 10px !important;
347
+ }
348
+
349
+ #checkDevices .modal-responsive .camera-header-responsive h3,
350
+ #checkDevices .modal-responsive .mic-header-responsive h3 {
351
+ font-size: 14px !important;
352
+ }
353
+
354
+ #checkDevices .modal-responsive .button-responsive {
355
+ height: 50px !important;
356
+ font-size: 13px !important;
357
+ }
358
+
359
+ #checkDevices .modal-responsive .divider-responsive {
360
+ height: 50px !important;
361
+ }
362
+ }
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 p={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,p),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 f=document.createElement("div");f.setAttribute("class","video-responsive");let g=document.createElement("video"),y=document.createElement("div");g.setAttribute("id","cameraStream"),g.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(g,_),this.applyStyles(f,{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"),Nr=document.createElement("div"),Li=document.createElement("div");se.setAttribute("class","info"),se.setAttribute("id","info_resolution"),Nr.setAttribute("class","info_stem"),Li.setAttribute("class","info_kick"),se.appendChild(Nr),se.appendChild(Li),x.appendChild(O),x.appendChild(B),x.appendChild(se);let jr=document.createElement("div");jr.setAttribute("class","alert-div"),jr.setAttribute("id","alertDivFacePosition");let Ui=document.createElement("error");Ui.setAttribute("id","facePositionAlert"),Ui.innerText="Posicionamento da face",Ui.style.marginLeft="10px";let Fi=document.createElement("span"),_u=document.createElement("div"),Su=document.createElement("div");Fi.setAttribute("id","checkmark_FacePosition"),_u.setAttribute("id","checkmark_stem_FacePosition"),Su.setAttribute("id","checkmark_kick_FacePosition"),Fi.appendChild(_u),Fi.appendChild(Su),jr.appendChild(Fi),jr.appendChild(Ui);let Eo=document.createElement("div");Eo.setAttribute("class","alert-div"),Eo.setAttribute("id","alertDivAmbientVerify");let Ni=document.createElement("error");Ni.setAttribute("id","ambientVerifyAlert"),Ni.innerText="Verifica\xE7\xE3o do ambiente",Ni.style.marginLeft="10px";let ji=document.createElement("span"),ku=document.createElement("div"),Eu=document.createElement("div");ji.setAttribute("id","checkmark_AmbientVerify"),ku.setAttribute("id","checkmark_stem_AmbientVerify"),Eu.setAttribute("id","checkmark_kick_AmbientVerify"),ji.appendChild(ku),ji.appendChild(Eu),Eo.appendChild(ji),Eo.appendChild(Ni);let fn=document.createElement("div");fn.setAttribute("class","alert-div"),fn.setAttribute("id","alertDivSpyCam"),fn.style.display="none";let Vi=document.createElement("error");Vi.setAttribute("id","SpyCamAlert"),Vi.innerText="Verifica\xE7\xE3o de Spy Cam",Vi.style.marginLeft="10px";let Hi=document.createElement("span"),Cu=document.createElement("div"),xu=document.createElement("div");Hi.setAttribute("id","checkmark_SpyCam"),Cu.setAttribute("id","checkmark_stem_SpyCam"),xu.setAttribute("id","checkmark_kick_SpyCam"),Hi.appendChild(Cu),Hi.appendChild(xu),fn.appendChild(Hi),fn.appendChild(Vi),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(jr),y.appendChild(Eo),y.appendChild(fn),b.appendChild(y),f.appendChild(g),f.style.flexShrink="0",b.appendChild(f);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",f.appendChild(Xt),f.appendChild(hr),o.appendChild(b);let Co=document.createElement("div");Co.setAttribute("class","mic-header-responsive");let Lc=document.createElement("h3"),mn=document.createElement("select");mn.setAttribute("id","micSelect");let Z2={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(Co,Z2),Lc.innerText="Microfone";let ey={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Lc,ey),mn.style.maxWidth="400px",mn.style.minWidth="150px",mn.style.width="100%",mn.style.boxSizing="border-box",Co.appendChild(Lc),Co.appendChild(mn),o.appendChild(Co);let xo=document.createElement("div");xo.setAttribute("class","mic-container-responsive");let ty={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(xo,ty);let Ao=document.createElement("div");Ao.setAttribute("class","mic-meter-responsive");let ry={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(Ao,ry);let zi=document.createElement("div");zi.setAttribute("id","audioStream");let ny={display:"flex",marginBottom:"15px"};this.applyStyles(zi,ny);let oy={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Du=0;Du<25;Du++){let Ou=document.createElement("div");this.applyStyles(Ou,oy),zi.appendChild(Ou)}let gn=document.createElement("div");gn.setAttribute("class","range-responsive");let Au=document.createElement("p"),Tu=document.createElement("p"),Iu=document.createElement("p"),iy={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(gn,iy),Au.innerText="0",Tu.innerText="50",Iu.innerText="100",gn.appendChild(Au),gn.appendChild(Tu),gn.appendChild(Iu);let yn=document.createElement("div");yn.setAttribute("class","alert-div"),yn.setAttribute("id","alertDivMicrophone");let sy={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(yn,sy);let Wi=document.createElement("error");Wi.setAttribute("id","microphoneAlert"),Wi.innerText="Teste de funcionamento",Wi.style.marginLeft="10px";let $i=document.createElement("span"),Pu=document.createElement("div"),Ru=document.createElement("div");$i.setAttribute("id","checkmark_microphone"),Pu.setAttribute("id","checkmark_stem_microphone"),Ru.setAttribute("id","checkmark_kick_microphone"),$i.appendChild(Pu),$i.appendChild(Ru),yn.appendChild($i),yn.appendChild(Wi),Ao.appendChild(zi),Ao.appendChild(gn);let To=document.createElement("p");To.setAttribute("class","pronounce-responsive"),To.innerText='Pronuncie em voz alta: "Testando..."',To.style.textAlign="start";let ay={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(To,ay),xo.appendChild(Ao),xo.appendChild(yn),o.appendChild(To),o.appendChild(xo);let Io=document.createElement("div"),cy={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Io,cy);let Po=document.createElement("button");Po.setAttribute("id","cancelBtn"),Po.setAttribute("class","button-responsive"),Po.innerText="Cancelar";let ly={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Po,ly);let Uc=document.createElement("span");Uc.setAttribute("class","divider-responsive");let hy={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(Uc,hy);let Vr=document.createElement("button");Vr.innerText="Continuar",Vr.setAttribute("id","confirmBtn"),Vr.setAttribute("class","button-responsive");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(Vr,dy),this.options.useSpyScan&&(Vr.style.cursor="not-allowed",Vr.setAttribute("disabled","true")),Io.appendChild(Po),Io.appendChild(Uc),Io.appendChild(Vr),o.appendChild(Io),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.description==="Nenhuma face encontrada"||t.description==="Face na posi\xE7\xE3o errada")&&(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}).
179
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())}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=`
180
365
  .facial-biometry__mask {
181
366
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
@@ -205,7 +390,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
205
390
  // -webkit-mask-position: center;
206
391
  // -webkit-mask-repeat: no-repeat;
207
392
  }
208
- `,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 ua=class e{constructor(t){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 $n({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}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{...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=Eg){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0,this.DeviceCheckerUI=new ha(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=>{a({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})})}catch(n){return this.closeCheckDevices(),this.DeviceCheckerUI.closeModal(),Promise.reject(n)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings();this.videoOptions.minWidth>t.width||this.videoOptions.minHeight>t.height?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 Er(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=oa(r),await $i(),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 Yn(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 Qn=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"),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 p=document.createElement("div"),y=document.createElement("video");y.setAttribute("id","cameraStream"),y.muted=!0,p.style.position="fixed",p.style.top="0",p.style.left="0",p.style.height="100vh",p.style.width="100%",p.style.display="flex",p.style.justifyContent="center",y.style.backgroundColor="#000",y.style.borderRadius="10px",y.style.width="auto",y.style.height="auto",y.style.minHeight="100%",p.appendChild(y);let f=document.createElement("canvas");f.setAttribute("id","canvas"),f.style.display="none",f.style.width="100%",f.style.height="100%";let g=document.createElement("img");g.setAttribute("id","image"),g.style.objectFit="contain",g.style.display="none",g.style.borderRadius="8px",p.appendChild(f),p.appendChild(g);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 w=document.createElement("div");w.setAttribute("class","biometry__frame"),w.style.width="100%",w.style.height="100%",w.style.position="absolute",w.style.top="0px",w.style.left="0px",w.style.zIndex="10",p.appendChild(b),p.appendChild(w),s.appendChild(p),this.addStyleMask();let _=document.createElement("button"),A=document.createElement("div");_.setAttribute("id","confirmBtn"),A.style.position="fixed",A.style.bottom="0",A.style.left="0",A.style.width="100%",A.style.display="flex",A.style.alignItems="center",A.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",A.appendChild(B),A.appendChild(_),s.appendChild(A);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",()=>{A.removeChild(_),A.removeChild(B),A.appendChild(O),A.appendChild(R),this.shot(),y.style.display="none",g.style.display="block"}),O.addEventListener("click",()=>{A.appendChild(B),A.appendChild(_),A.removeChild(O),A.removeChild(R),y.style.display="block",g.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=`
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 pa=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 Gn({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=Cg){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0,this.DeviceCheckerUI=new ua(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")&&Yr()&&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 Er(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=sa(r),await qi(),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 eo(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 to=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 p=document.createElement("div"),b=document.createElement("video");b.setAttribute("id","cameraStream"),b.muted=!0,p.style.position="fixed",p.style.top="0",p.style.left="0",p.style.height="100vh",p.style.width="100%",p.style.display="flex",p.style.justifyContent="center",b.style.backgroundColor="#000",b.style.borderRadius="10px",b.style.width="auto",b.style.height="auto",b.style.minHeight="100%",p.appendChild(b);let f=document.createElement("canvas");f.setAttribute("id","canvas"),f.style.display="none",f.style.width="100%",f.style.height="100%";let g=document.createElement("img");g.setAttribute("id","image"),g.style.objectFit="contain",g.style.display="none",g.style.borderRadius="8px",p.appendChild(f),p.appendChild(g);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",p.appendChild(y),p.appendChild(v),s.appendChild(p),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",g.style.display="block"}),O.addEventListener("click",()=>{x.appendChild(B),x.appendChild(_),x.removeChild(O),x.removeChild(R),b.style.display="block",g.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=`
209
394
  .facial-biometry__mask {
210
395
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
211
396
  mask-size: cover, auto 65%;
@@ -234,16 +419,16 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
234
419
  // -webkit-mask-position: center;
235
420
  // -webkit-mask-repeat: no-repeat;
236
421
  }
237
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var da=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 pa=class{constructor(t,r){this.repositoryDevices=t,this.proctoringId=r}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await St(),n=(u,p)=>u.label===p.label&&u.id===p.id,o=(u,p,y)=>u.filter(f=>!p.some(g=>y(f,g))),i=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:i?.cameras||[s],microphones:i?.microphones||[s]},c,l;r.cameras.length!=a?.cameras.length&&(c=r.cameras.length>a?.cameras.length?o(r.cameras,a?.cameras,n):o(a?.cameras,r.cameras,n),c=c.filter(u=>u.id!="default")),r.microphones.length!=a?.microphones.length&&(l=r.microphones.length>a?.microphones.length?o(r.microphones,a?.microphones,n):o(a?.microphones,r.microphones,n),l=l.filter(u=>u.id!="default"&&u.id!="communications"));let h={cameras:c||[],microphones:l||[],status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"};await this.repositoryDevices.save({...r,id:"devices",status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"}),t.status&&(h.cameras.length!=0||h.microphones.length!=0)&&(N.registerChangeDevice(this.proctoringId,h.status,JSON.stringify(h,null,2)),t.status(h))}};var Fg=Od(Ug()),Zn=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:o}=t;try{N.registerDownloadFile(this.proctoringId,`File to download
422
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var fa=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 ma=class{constructor(t,r){this.repositoryDevices=t,this.proctoringId=r}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await St(),n=(d,p)=>d.label===p.label&&d.id===p.id,o=(d,p,b)=>d.filter(f=>!p.some(g=>b(f,g))),i=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:i?.cameras||[s],microphones:i?.microphones||[s]},c,l;r.cameras.length!=a?.cameras.length&&(c=r.cameras.length>a?.cameras.length?o(r.cameras,a?.cameras,n):o(a?.cameras,r.cameras,n),c=c.filter(d=>d.id!="default")),r.microphones.length!=a?.microphones.length&&(l=r.microphones.length>a?.microphones.length?o(r.microphones,a?.microphones,n):o(a?.microphones,r.microphones,n),l=l.filter(d=>d.id!="default"&&d.id!="communications"));let h={cameras:c||[],microphones:l||[],status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"};await this.repositoryDevices.save({...r,id:"devices",status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"}),t.status&&(h.cameras.length!=0||h.microphones.length!=0)&&(N.registerChangeDevice(this.proctoringId,h.status,JSON.stringify(h,null,2)),t.status(h))}};var jg=Bu(Ng()),ro=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:o}=t;try{N.registerDownloadFile(this.proctoringId,`File to download
238
423
  File name: ${n.name}
239
424
  File type: ${n.type}
240
- File size: ${n.size}}`),(0,Fg.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),o&&o(Math.round(100))}catch{throw n&&this.proctoringId&&N.registerError(this.proctoringId,`Failed on machine download
425
+ File size: ${n.size}}`),(0,jg.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),o&&o(Math.round(100))}catch{throw n&&this.proctoringId&&N.registerError(this.proctoringId,`Failed on machine download
241
426
  File name: ${n.name}
242
427
  File type: ${n.type}
243
- File size: ${n.size}`),new Error("Error on machine download")}}};var fa=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 eo=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"),N.registerUploadFile(this.proctoringId,`Upload File
428
+ File size: ${n.size}`),new Error("Error on machine download")}}};var ga=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 no=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"),N.registerUploadFile(this.proctoringId,`Upload File
244
429
  Name: ${t.file.name}
245
430
  Type: ${t.file.type}
246
- Size: ${t.file.size}`,s),i}}throw new Error("Could not upload")}};var ma=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())}};var ga=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}=Jr(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 en=typeof self<"u"?self:{};function Yr(){throw Error("Invalid UTF8")}function Ng(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var ya,qh,c4=typeof TextDecoder<"u",l4,h4=typeof TextEncoder<"u";function S1(e){if(h4)e=(l4||=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 hu,Ea;e:{for(Gh=["CLOSURE_FLAGS"],ba=en,wa=0;wa<Gh.length;wa++)if((ba=ba[Gh[wa]])==null){Ea=null;break e}Ea=ba}var Gh,ba,wa,li,jg=Ea&&Ea[610401301];hu=jg!=null&&jg;var Vg=en.navigator;function ru(e){return!!hu&&!!li&&li.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function wt(e){var t;return(t=en.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function xr(){return!!hu&&!!li&&li.brands.length>0}function Kh(){return xr()?ru("Chromium"):(wt("Chrome")||wt("CriOS"))&&!(!xr()&&wt("Edge"))||wt("Silk")}li=Vg&&Vg.userAgentData||null;var u4=!xr()&&(wt("Trident")||wt("MSIE"));!wt("Android")||Kh(),Kh(),wt("Safari")&&(Kh()||!xr()&&wt("Coast")||!xr()&&wt("Opera")||!xr()&&wt("Edge")||(xr()?ru("Microsoft Edge"):wt("Edg/"))||xr()&&ru("Opera"));var k1={},oi=null;function d4(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++),u=oi[h];if(u!=null)return u;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}E1();let c=0;for(;;){let l=a(-1),h=a(0),u=a(64),p=a(64);if(p===64&&l===-1)break;s(l<<2|h>>4),u!=64&&(s(h<<4&240|u>>2),p!=64&&s(u<<6&192|p))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function E1(){if(!oi){oi={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));k1[r]=n;for(let o=0;o<n.length;o++){let i=n[o];oi[i]===void 0&&(oi[i]=o)}}}}var C1=typeof Uint8Array<"u",A1=!u4&&typeof btoa=="function";function Hg(e){if(!A1){var t;t===void 0&&(t=0),E1(),t=k1[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 zg=/[-_.]/g,p4={"-":"+",_:"/",".":"="};function f4(e){return p4[e]||""}function x1(e){if(!A1)return d4(e);zg.test(e)&&(e=e.replace(zg,f4)),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 Ba(e){return C1&&e!=null&&e instanceof Uint8Array}var so={};function ao(){return m4||=new Ir(null,so)}function uu(e){T1(so);var t=e.g;return(t=t==null||Ba(t)?t:typeof t=="string"?x1(t):null)==null?t:e.g=t}var Ir=class{i(){return new Uint8Array(uu(this)||0)}constructor(e,t){if(T1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},m4,g4;function T1(e){if(e!==so)throw Error("illegal external caller")}function I1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function $g(){let e=Error("int32");return I1(e,"warning"),e}var Ma=typeof Symbol=="function"&&typeof Symbol()=="symbol",y4=new Set;function La(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&&y4.add(e),e}var b4=La("jas",void 0,!0,!0),Xh=La(void 0,"2ex"),ri=La(void 0,"1oa",!0),co=La(void 0,Symbol(),!0),I=Ma?b4:"M",P1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},R1=Object.defineProperties;function du(e,t){Ma||I in e||R1(e,P1),e[I]|=t}function Ee(e,t){Ma||I in e||R1(e,P1),e[I]=t}function w4(e,t){Ee(t,-30975&(0|e))}function nu(e,t){Ee(t,-30941&(34|e))}function pu(){return typeof BigInt=="function"}function vt(e){return Array.prototype.slice.call(e)}var fu,ui={},v4={};function Wg(e){return!(!e||typeof e!="object"||e.g!==v4)}function mu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function D1(e,t){if(e!=null){if(typeof e=="string")e=e?new Ir(e,so):ao();else if(e.constructor!==Ir)if(Ba(e))e=e.length?new Ir(new Uint8Array(e),so):ao();else{if(!t)throw Error();e=void 0}}return e}function Ca(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[I]))}var qg=[];function nn(e){if(2&e)throw Error()}function gu(e){return co?e[co]:void 0}Ee(qg,55),fu=Object.freeze(qg);var O1=Object.freeze({}),yu=typeof en.BigInt=="function"&&typeof en.BigInt(0)=="bigint",ou=e=>yu?e>=S4&&e<=E4:e[0]==="-"?Gg(e,_4):Gg(e,k4),_4=Number.MIN_SAFE_INTEGER.toString(),S4=yu?BigInt(Number.MIN_SAFE_INTEGER):void 0,k4=Number.MAX_SAFE_INTEGER.toString(),E4=yu?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Gg(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 C4=typeof Uint8Array.prototype.slice=="function",B1,X=0,he=0;function Kg(e){let t=e>>>0;X=t,he=(e-t)/4294967296>>>0}function lo(e){if(e<0){Kg(-e);let[t,r]=vu(X,he);X=t>>>0,he=r>>>0}else Kg(e)}function M1(e){let t=B1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),he=0,X=t.getUint32(0,!0)}function bu(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:hi(e,t)}function wu(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=bu(e,t))=="number"?r?-e:e:r?"-"+e:e}function hi(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else pu()?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+Xg(r)+Xg(e));return r}function Xg(e){return e=String(e),"0000000".slice(e.length)+e}function Ua(e){if(e.length<16)lo(Number(e));else if(pu())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]=vu(X,he);X=n,he=o}}}function vu(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var L1=typeof BigInt=="function"?BigInt.asIntN:void 0,A4=typeof BigInt=="function"?BigInt.asUintN:void 0,ii=Number.isSafeInteger,Fa=Number.isFinite,Aa=Math.trunc;function di(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Jg(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 x4=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function _u(e){switch(typeof e){case"bigint":return!0;case"number":return Fa(e);case"string":return x4.test(e);default:return!1}}function tn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Fa(e)?0|e:void 0}function Yg(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function U1(e){return e=Aa(e),ii(e)||(lo(e),e=wu(X,he)),e}function F1(e){var t=Aa(Number(e));if(ii(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(Ua(e),e=X,2147483648&(t=he))if(pu())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=vu(e,t);e="-"+hi(r,n)}else e=hi(e,t);return e}function iu(e){return e==null?e:typeof e=="bigint"?(ou(e)?e=Number(e):(e=L1(64,e),e=ou(e)?Number(e):String(e)),e):_u(e)?typeof e=="number"?U1(e):F1(e):void 0}function T4(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(A4(64,e));if(_u(e)){if(t==="string")return t=Aa(Number(e)),ii(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Yg(e)||(Ua(e),e=hi(X,he))),e;if(t==="number")return(e=Aa(e))>=0&&ii(e)?e:(function(r){if(r<0){lo(r);var n=hi(X,he);return r=Number(n),ii(r)?r:n}return Yg(n=String(r))?n:(lo(r),bu(X,he))})(e)}}function N1(e){if(typeof e!="string")throw Error();return e}function xa(e){if(e!=null&&typeof e!="string")throw Error();return e}function Pr(e){return e==null||typeof e=="string"?e:void 0}function j1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===ui)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 V1(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=Ca(e)?void 0:o&&2&(0|e[I])?e:Su(e,t,r,n!==void 0,o);else if(mu(e)){let i={};for(let s in e)i[s]=V1(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Su(e,t,r,n,o){let i=n||r?0|e[I]:0,s=n?!!(32&i):void 0;n=vt(e);for(let a=0;a<n.length;a++)n[a]=V1(n[a],t,r,s,o);return r&&((e=gu(e))&&(n[co]=vt(e)),r(i,n)),n}function I4(e){return e.B===ui?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return ou(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Ca(t))return}else{if(Ba(t))return Hg(t);if(t instanceof Ir){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=Hg(r)}}}return t})(e)}function P4(e){return Su(e,I4,void 0,void 0,!1)}var H1,R4;function si(e,t,r){return e=z1(e,t[0],t[1],r?1:2),t!==H1&&r&&du(e,16384),e}function z1(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(mu(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 $1(e,t,r=nu){if(e!=null){if(C1&&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):Su(e,$1,4&n?nu:r,!0,!0))}return e.B===ui&&(e=2&(n=0|(r=e.l)[I])?e:new e.constructor(Na(r,n,!0))),e}}function W1(e){let t=e.l;return new e.constructor(Na(t,0|t[I],!1))}function Na(e,t,r){let n=r||2&t?nu:w4,o=!!(32&t);return e=(function(i,s,a){let c=vt(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 u in h)s[u]=a(h[u])}return(i=gu(i))&&(c[co]=vt(i)),c})(e,t,(i=>$1(i,o,n))),du(e,32|(r?2:0)),e}function ku(e){let t=e.l,r=0|t[I];return 2&r?new e.constructor(Na(t,r,!1)):e}function It(e,t){return on(e=e.l,0|e[I],t)}function on(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&&Xh!=null&&((o=(e=g4??={})[Xh]||0)>=4||(e[Xh]=o+1,I1(e=Error(),"incident"),(function(s){en.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 nn(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 q1(e){let t=0|(e=e.l)[I],r=on(e,t,1),n=D1(r,!0);return n!=null&&n!==r&&Ce(e,t,1,n),n}function G1(e,t,r,n,o){let i=e.l,s=2&(e=0|i[I])?1:n;o=!!o;let a=0|(n=Eu(i,e,t))[I];if(!(4&a)){4&a&&(n=vt(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=Cu(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=vt(n),a=cr(a,e),a=Rr(a,e,o),Ee(n,a),e=Ce(i,e,t,n)),ar(a)||(t=a,a=Rr(a,e,o),a!==t&&Ee(n,a))),n}function Eu(e,t,r,n){return e=on(e,t,r,n),Array.isArray(e)?e:fu}function Cu(e,t){return e===0&&(e=cr(e,t)),1|e}function ar(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Qg(e,t,r){let n=0|(e=e.l)[I];if(nn(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=vt(r),i=0,o=Rr(o=cr(o,n),n,!0),a=!1),o|=21,s=0;s<r.length;s++){let c=r[s],l=N1(c);Object.is(c,l)||(a&&(r=vt(r),i=0,o=Rr(o=cr(o,n),n,!0),a=!1),r[s]=l)}o!==i&&(a&&(r=vt(r),o=Rr(o=cr(o,n),n,!0)),Ee(r,o)),Ce(e,n,t,r)}}function K1(e,t){let r=0|(e=e.l)[I];nn(r),Ce(e,r,2,t===""?void 0:t)}function pi(e,t,r,n,o){nn(t);var i=!(!(64&t)&&16384&t);let s=(o=Eu(e,t,r,o))!==fu;if(i||!s){let a=i=s?0|o[I]:0;(!s||2&a||ar(a)||4&a&&!(32&a))&&(o=vt(o),a=cr(a,t),t=Ce(e,t,r,o)),a=-13&Cu(a,t),a=Rr(n?-17&a:16|a,t,!0),a!==i&&Ee(o,a)}return o}function Jh(e,t){var r=F0;return xu(Au(e=e.l),e,0|e[I],r)===t?t:-1}function Au(e){if(Ma)return e[ri]??(e[ri]=new Map);if(ri in e)return e[ri];let t=new Map;return Object.defineProperty(e,ri,{value:t}),t}function X1(e,t,r,n){let o=Au(e),i=xu(o,e,t,r);return i!==n&&(i&&(t=Ce(e,t,i)),o.set(r,n)),t}function xu(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];on(t,r,s)!=null&&(o!==0&&(r=Ce(t,r,o)),o=s)}return e.set(n,o),o}function Tu(e,t,r,n){let o,i=0|e[I];if((n=on(e,i,r,n))!=null&&n.B===ui)return(t=ku(n))!==n&&Ce(e,i,r,t),t.l;if(Array.isArray(n)){let s=0|n[I];o=2&s?si(Na(n,s,!1),t,!0):64&s?n:si(o,t,!0)}else o=si(void 0,t,!0);return o!==n&&Ce(e,i,r,o),o}function J1(e,t,r,n){let o=0|(e=e.l)[I];return(t=j1(n=on(e,o,r,n),t,o))!==n&&t!=null&&Ce(e,o,r,t),t}function Pt(e,t,r){if((t=J1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[I];if(!(2&n)){let o=ku(t);o!==t&&Ce(e,n,r,t=o)}return t}function Y1(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=Eu(e,t,1))[I];if(!(s=!!(4&c))){var l=n,h=t;let u=!!(2&(c=Cu(c,t)));u&&(h|=2);let p=!u,y=!0,f=0,g=0;for(;f<l.length;f++){let b=j1(l[f],r,h);if(b instanceof r){if(!u){let w=!!(2&(0|b.l[I]));p&&=!w,y&&=w}l[g++]=b}}g<f&&(l.length=g),c|=4,c=y?16|c:-17&c,Ee(l,c=p?8|c:-9&c),u&&Object.freeze(l)}if(i&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(ar(c)&&(n=vt(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=ku(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=vt(n),c=Rr(c=cr(c,t),t,o)),t=Ce(e,t,1,n)),ar(c)||(e=c,(c=Rr(c,t,o))!==e&&Ee(n,c))),n}function Iu(e,t){let r=0|e.l[I];return Y1(e,r,t,O1===void 0?2:4,!1,!(2&r))}function Rt(e,t,r,n){return n==null&&(n=void 0),Ie(e,r,n)}function Yh(e,t,r){var n=B0;r==null&&(r=void 0);e:{let o=0|(e=e.l)[I];if(nn(o),r==null){let i=Au(e);if(xu(i,e,o,n)!==t)break e;i.set(n,0)}else o=X1(e,o,n,t);Ce(e,o,t,r)}}function cr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function Rr(e,t,r){return 32&t&&r||(e&=-33),e}function Q1(e,t){var r=Wu;let n=0|e.l[I];nn(n),e=Y1(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 $e(e,t,r){nn(0|e.l[I]),G1(e,t,Pr,2,!0).push(N1(r))}function Z1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Pu(){return Error("Failed to read varint, encoding is invalid.")}function e0(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Ru(e){if(typeof e=="string")return{buffer:x1(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===Ir)return{buffer:uu(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 Du(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(Zr(e,a),r<128)return t(n>>>0,o>>>0);throw Pu()}function Ou(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 Zr(e,r),!!(127&t)}throw Pu()}function We(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 Pu();return Zr(e,r),o}function su(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],Zr(e,e.g+4),(n<<0|o<<8|i<<16|t<<24)>>>0}function au(e){var t=su(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 D4(e){return We(e)}function Qh(e,t,{C:r=!1}={}){e.C=r,t&&(t=Ru(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function Zr(e,t){if(e.g=t,t>e.j)throw e0(e.j,t)}function t0(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 e0(t,e.j-r);return e.g=n,r}function r0(e,t){if(t==0)return ao();var r=t0(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):C4?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?ao():new Ir(r,so)}var Zg=[];function n0(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=We(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw Z1(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 Sa(e){switch(e.i){case 0:e.i!=0?Sa(e):Ou(e.g);break;case 1:Zr(e=e.g,e.g+8);break;case 2:if(e.i!=2)Sa(e);else{var t=We(e.g)>>>0;Zr(e=e.g,e.g+t)}break;case 5:Zr(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!n0(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Sa(e)}break;default:throw Z1(e.i,e.j)}}function ja(e,t,r){let n=e.g.j,o=We(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 Bu(e){var t=We(e.g)>>>0,r=t0(e=e.g,t);if(e=e.i,c4){var n,o=e;(n=qh)||(n=qh=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(ya===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),ya=!0}catch{ya=!1}}throw!ya&&(qh=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?Yr():(a=e[i++],s<194||(192&a)!=128?(i--,Yr()):r.push((31&s)<<6|63&a)):s<240?i>=t-1?Yr():(a=e[i++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Yr()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?i>=t-2?Yr():(a=e[i++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(o=e[i++]))!=128?(i--,Yr()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Yr(),r.length>=8192&&(c=Ng(c,r),r.length=0)}i=Ng(c,r)}return i}function o0(e){let t=We(e.g)>>>0;return r0(e.g,t)}function Mu(e,t,r){var n=We(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var va=[];function O4(e){return e}var no;function i0(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=z1(e,t)}toJSON(){let e=!no;try{return e&&(no=P4),s0(this)}finally{e&&(no=void 0)}}u(){return!!(2&(0|this.l[I]))}};function s0(e){var t=e.l;{t=(e=no(t))!==t;let l=e.length;if(l){var r=e[l-1],n=mu(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)&&(Ca(n)||Wg(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||Ca(i)||Wg(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 e1(e){return e?/^\d+$/.test(e)?(Ua(e),new cu(X,he)):null:B4||=new cu(0,0)}te.prototype.B=ui,te.prototype.toString=function(){try{return no=O4,s0(this).toString()}finally{no=void 0}};var cu=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},B4;function t1(e){return e?/^-?\d+$/.test(e)?(Ua(e),new lu(X,he)):null:M4||=new lu(0,0)}var lu=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},M4;function oo(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 fi(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Va(e,t){if(t>=0)fi(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Ta(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 ho(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Dt(e,t,r){fi(e.g,8*t+r)}function Ha(e,t){return Dt(e,t,2),t=e.g.end(),ho(e,t),t.push(e.i),t}function za(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 $a(e,t,r){Dt(e,t,2),fi(e.g,r.length),ho(e,e.g.end()),ho(e,r)}function Ot(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Lu=Ot(),a0=Ot(),Uu=Ot(),Fu=Ot(),c0=Ot(),l0=Ot(),h0=Ot(),u0=Ot(),uo=class{constructor(e,t,r){this.g=e,this.i=t,e=Lu,this.j=!!e&&r===e||!1}};function Nu(e,t){return new uo(e,t,Lu)}function d0(e,t,r,n,o){(t=g0(t,n))!=null&&(r=Ha(e,r),o(t,e),za(e,r))}var L4=Nu((function(e,t,r,n,o){return e.i===2&&(ja(e,Tu(t,n,r),o),!0)}),d0),U4=Nu((function(e,t,r,n,o){return e.i===2&&(ja(e,Tu(t,n,r,!0),o),!0)}),d0),Wa=Symbol(),ju=Symbol(),r1=Symbol(),n1=Symbol(),p0,f0;function sn(e,t,r,n){var o=n[e];if(o)return o;(o={}).P=n,o.A=(function(u){switch(typeof u){case"boolean":return H1||=[0,void 0,!0];case"number":return u>0?void 0:u===0?R4||=[0,void 0]:[-u,void 0];case"string":return[0,u];case"object":return u}})(n[0]);var i=n[1];let s=1;i&&i.constructor===Object&&(o.H=i,typeof(i=n[++s])=="function"&&(o.I=!0,p0??=i,f0??=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 u;typeof i=="number"&&(c+=i,i=n[++s]);var l=void 0;if(i instanceof uo?u=i:(u=L4,s--),u?.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 p=a[c];l?r(o,c,u,l,p):t(o,c,u,p)}}return n[e]=o}function m0(e){return Array.isArray(e)?e[0]instanceof uo?e:[U4,e]:[e,void 0]}function g0(e,t){return e instanceof te?e.l:Array.isArray(e)?si(e,t,!1):void 0}function Vu(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function Hu(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=sn(ju,Vu,Hu,n).A,s||=zu(n),o)}function zu(e){let t=e[r1];if(t!=null)return t;let r=sn(ju,Vu,Hu,e);return t=r.I?(n,o)=>p0(n,o,r):(n,o)=>{let i=0|n[I];for(;n0(o)&&o.i!=4;){var s=o.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=F4(c))!=null&&(a=r[s]=c)}a!=null&&a(o,n,s)||(s=(a=o).j,Sa(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=r0(a.g,c)),s=n,a&&((c=s[co])?c.push(a):s[co]=[a]))}return 16384&i&&du(n,34),!0},e[r1]=t}function F4(e){let t=(e=m0(e))[0].g;if(e=e[1]){let r=zu(e),n=sn(ju,Vu,Hu,e).A;return(o,i,s)=>t(o,i,s,n,r)}return t}function qa(e,t,r){e[t]=r.i}function Ga(e,t,r,n){let o,i,s=r.i;e[t]=(a,c,l)=>s(a,c,l,i||=sn(Wa,qa,Ga,n).A,o||=y0(n))}function y0(e){let t=e[n1];if(!t){let r=sn(Wa,qa,Ga,e);t=(n,o)=>b0(n,o,r),e[n1]=t}return t}function b0(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=o1(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=o1(r,o))&&a(t,i,o)}if(e=gu(e))for(ho(t,t.g.end()),r=0;r<e.length;r++)ho(t,uu(e[r])||new Uint8Array(0))}function o1(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=m0(r))[0].i;if(r=r[1]){let o=y0(r),i=sn(Wa,qa,Ga,r).A;r=e.I?f0(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function Ka(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 uo(e,t,r)}function Xa(e,t,r){return new uo(e,t,r)}function Le(e,t,r){Ce(e,0|e[I],t,r)}function w0(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(L1(64,n));if(_u(n)){if(o==="string")return F1(n);if(o==="number")return U1(n)}})(t),t!=null&&(typeof t=="string"&&t1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,lo(t),oo(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new lu(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),oo(e.g,r.i,r.g);break;default:r=t1(t),oo(e.g,r.i,r.g)}}function v0(e,t,r){(t=tn(t))!=null&&t!=null&&(Dt(e,r,0),Va(e.g,t))}function _0(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 S0(e,t,r){(t=Pr(t))!=null&&$a(e,r,S1(t))}function k0(e,t,r,n,o){(t=g0(t,n))!=null&&(r=Ha(e,r),o(t,e),za(e,r))}function E0(e,t,r){(t=t==null||typeof t=="string"||Ba(t)||t instanceof Ir?t:void 0)!=null&&$a(e,r,Ru(t).buffer)}var N4=Me((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=su(n);let o=su(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=di(t))!=null&&(Dt(e,r,1),e=e.g,(r=B1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),X=r.getUint32(0,!0),he=r.getUint32(4,!0),Ta(e,X),Ta(e,he))}),Ot()),C0=Me((function(e,t,r){return e.i===5&&(Le(t,r,au(e.g)),!0)}),(function(e,t,r){(t=di(t))!=null&&(Dt(e,r,5),e=e.g,M1(t),Ta(e,X))}),l0),j4=Xa((function(e,t,r){return(e.i===5||e.i===2)&&(t=pi(t,0|t[I],r,!1,!1),e.i==2?Mu(e,au,t):t.push(au(e.g)),!0)}),(function(e,t,r){if((t=Ka(di,t))!=null&&t.length){Dt(e,r,2),fi(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,M1(t[n]),Ta(r,X)}}),l0),Ia=Me((function(e,t,r){return e.i===0&&(Le(t,r,Du(e.g,wu)),!0)}),w0,c0),Zh=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Du(e.g,wu))===0?void 0:e),!0)}),w0,c0),V4=Me((function(e,t,r){return e.i===0&&(Le(t,r,Du(e.g,bu)),!0)}),(function(e,t,r){if((t=T4(t))!=null&&(typeof t=="string"&&e1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,lo(t),oo(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new cu(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),oo(e.g,r.i,r.g);break;default:r=e1(t),oo(e.g,r.i,r.g)}}),Ot()),Dr=Me((function(e,t,r){return e.i===0&&(Le(t,r,We(e.g)),!0)}),v0,Fu),$u=Xa((function(e,t,r){return(e.i===0||e.i===2)&&(t=pi(t,0|t[I],r,!1,!1),e.i==2?Mu(e,We,t):t.push(We(e.g)),!0)}),(function(e,t,r){if((t=Ka(tn,t))!=null&&t.length){r=Ha(e,r);for(let n=0;n<t.length;n++)Va(e.g,t[n]);za(e,r)}}),Fu),to=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=We(e.g))===0?void 0:e),!0)}),v0,Fu),nt=Me((function(e,t,r){return e.i===0&&(Le(t,r,Ou(e.g)),!0)}),_0,a0),io=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Ou(e.g))===!1?void 0:e),!0)}),_0,a0),yt=Xa((function(e,t,r){return e.i===2&&(e=Bu(e),pi(t,0|t[I],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ka(Pr,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&$a(n,o,S1(i))}}),Uu),Tr=Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=Bu(e))===""?void 0:e),!0)}),S0,Uu),me=Me((function(e,t,r){return e.i===2&&(Le(t,r,Bu(e)),!0)}),S0,Uu),bt=(function(e,t,r=Lu){return new uo(e,t,r)})((function(e,t,r,n,o){return e.i===2&&(n=si(void 0,n,!0),pi(t,0|t[I],r,!0).push(n),ja(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)k0(e,t[i],r,n,o)})),Te=Nu((function(e,t,r,n,o,i){return e.i===2&&(X1(t,0|t[I],i,r),ja(e,t=Tu(t,n,r),o),!0)}),k0),A0=Me((function(e,t,r){return e.i===2&&(Le(t,r,o0(e)),!0)}),E0,h0),H4=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=We(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 Fa(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(Dt(e,r,0),fi(e.g,t))}),Ot()),rn=Me((function(e,t,r){return e.i===0&&(Le(t,r,We(e.g)),!0)}),(function(e,t,r){(t=tn(t))!=null&&(t=parseInt(t,10),Dt(e,r,0),Va(e.g,t))}),u0),Pa=class{constructor(t,r){this.i=t,this.g=r,this.j=Rt,this.defaultValue=void 0}};function x0(e,t){return(r,n)=>{if(va.length){let i=va.pop();i.o(n),Qh(i.g,r,n),r=i}else r=new class{constructor(i,s){if(Zg.length){let a=Zg.pop();Qh(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,Qh(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;zu(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.i=-1,va.length<100&&va.push(r)}return o}}var i1=[0,Tr,Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=o0(e))===ao()?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&&$a(e,r,Ru(t).buffer)))}if(Array.isArray(t))return}E0(e,t,r)}),h0)],eu,s1=globalThis.trustedTypes;function a1(e){eu===void 0&&(eu=(function(){let r=null;if(!s1)return r;try{let n=o=>o;r=s1.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=eu;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function z4(e,...t){if(t.length===0)return a1(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return a1(r)}var T0=[0,Dr,rn,nt,-1,$u,rn,-1],$4=class extends te{constructor(e){super(e)}},I0=[0,nt,me,nt,rn,-1,Xa((function(e,t,r){return(e.i===0||e.i===2)&&(t=pi(t,0|t[I],r,!1,!1),e.i==2?Mu(e,D4,t):t.push(We(e.g)),!0)}),(function(e,t,r){if((t=Ka(tn,t))!=null&&t.length){r=Ha(e,r);for(let n=0;n<t.length;n++)Va(e.g,t[n]);za(e,r)}}),u0),me,-1,[0,nt,-1],rn,nt,-1],P0=[0,me,-2],c1=class extends te{constructor(e){super(e)}},R0=[0],D0=[0,Dr,nt,1,nt,-3],O0=class extends te{constructor(e){super(e,2)}},Ja={};Ja[336783863]=[0,me,nt,-1,Dr,[0,[1,2,3,4,5,6,7,8],Te,R0,Te,I0,Te,P0,Te,D0,Te,T0,Te,[0,me,-2],Te,[0,me,rn],Te,[0,rn,me]],[0,me],nt,[0,[1,3],[2,4],Te,[0,$u],-1,Te,[0,yt],-1,bt,[0,me,-1]],me];var l1,h1=[0,Zh,-1,io,-3,Zh,$u,Tr,to,Zh,-1,io,to,io,-2,Tr],Wu=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,7,e)}},ai=[-1,{}],u1=[0,me,1,ai],d1=[0,me,yt,ai],qu=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,1001,e)}};qu.prototype.g=(l1=[-500,bt,[-500,Tr,-1,yt,-3,[-2,Ja,nt],bt,i1,to,-1,u1,d1,bt,[0,Tr,io],Tr,h1,to,yt,987,yt],4,bt,[-500,me,-1,[-1,{}],998,me],bt,[-500,me,yt,-1,[-2,{},nt],997,yt,-1],to,bt,[-500,me,yt,ai,998,yt],yt,to,u1,d1,bt,[0,Tr,-1,ai],yt,-2,h1,Tr,-1,io,[0,io,H4],978,ai,bt,i1],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}}}};b0(this.l,e,sn(Wa,qa,Ga,l1)),ho(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 W4=class extends te{constructor(e){super(e)}},q4=class extends te{constructor(e){super(e)}g(){return Iu(this,W4)}},G4=[0,bt,[0,Dr,C0,me,-1]],p1=class extends te{constructor(e){super(e)}},f1=class extends te{constructor(e){super(e)}},B0=[1,2,3,4,5],Ra=class extends te{constructor(e){super(e)}g(){return q1(this)!=null}i(){return Pr(It(this,2))!=null}},Da=class extends te{constructor(e){super(e)}},M0=class extends te{constructor(e){super(e)}},L0=[0,[0,A0,me,[0,Dr,Ia,-1],[0,V4,Ia]],nt,[0,B0,Te,D0,Te,I0,Te,T0,Te,R0,Te,P0],rn],K4=new Pa(451755788,M0);Ja[451755788]=[0,L0,[0,me,Dr,C0,yt,-1],N4];var m1=class extends te{constructor(e){super(e)}},U0=class extends te{constructor(e){super(e)}},X4=new Pa(487277289,U0);Ja[487277289]=[0,L0,[0,nt,-1]];var J4=class extends te{constructor(e){super(e)}},Y4=x0(class extends te{constructor(e){super(e)}},[0,bt,[0,1,Dr,me,G4],Ia]),g1=class extends te{constructor(e){super(e)}},Q4=class extends te{constructor(e){super(e)}J(){let e=q1(this);return e??ao()}},Z4=class extends te{constructor(e){super(e)}},F0=[1,2],y1=x0(class extends te{constructor(e){super(e)}},[0,bt,[0,F0,Te,[0,j4],Te,[0,A0],Dr,me],Ia]);function ew(){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 b1(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 w1(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 Cr(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Qr(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 tw=(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:ew()?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=>{w1(this,Object.keys(e),(o=>{w1(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){Cr(this,e,t),T(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){Cr(this,e,t),T(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){Cr(this,e,t),T(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Cr(this,e,t),T(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Cr(this,e,t),T(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){Cr(this,e,t),T(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){Qr(this,e,t),T(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Cr(this,e,t),T(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){Qr(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?'),Cr(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}}),N0=class extends tw{};async function rw(e,t,r){return e=await(async(n,o,i,s)=>{if(o&&await b1(o),!self.ModuleFactory||i&&(await b1(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 j0(e,t,r){return rw(e,t,r)}function tu(e,t){let r=Pt(e.baseOptions,Ra,1)||new Ra;typeof t=="string"?(Ie(r,2,xa(t)),Ie(r,1)):t instanceof Uint8Array&&(Ie(r,1,D1(t,!1)),Ie(r,2)),Rt(e.baseOptions,0,1,r)}function V0(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,Ra,1)?.g()||Pt(e.baseOptions,Ra,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,f1,3);if(!i){var s=i=new f1;Yh(s,4,new c1)}"delegate"in o&&(o.delegate==="GPU"?Yh(o=i,2,s=new $4):Yh(o=i,4,s=new c1)),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),tu(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)tu(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=>{tu(e,n),e.v()}));return e.v(),Promise.resolve()}function v1(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 ro(e,t){e.s=Math.max(e.s,t)}var ka=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),v1(this)}finishProcessing(){this.g.finishProcessing(),v1(this)}close(){this.g.closeGraph()}};async function ci(e,t,r){return j0(e,t,r)}ka.prototype.close=ka.prototype.close,(function(e,t){e=e.split(".");var r,n=en;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",ka);var Oa=class extends ka{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function nw(e){let t={classifications:Iu(e,J4).map((r=>(function(n,o=-1,i=""){return{categories:n.map((s=>{var a=tn(It(s,1))??0??-1;let c=s.l,l=0|c[I],h=on(c,l,2),u=di(h);return u!=null&&u!==h&&Ce(c,l,2,u),{index:a,score:u??0??0,categoryName:Pr(It(s,3))??""??"",displayName:Pr(It(s,4))??""??""}})),headIndex:o,headName:i}})(Pt(r,q4,4)?.g()??[],tn(It(r,2))??0,Pr(It(r,3))??"")))};return iu(It(e,2))!=null&&(t.timestampMs=iu(It(e,2))??0),t}Oa.prototype.setDefaultSampleRate=Oa.prototype.O;var gt=class extends Oa{constructor(e,t){super(new N0(e,t)),this.m=[],Rt(e=this.i=new M0,0,1,t=new Da)}get baseOptions(){return Pt(this.i,Da,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,p1,2);if(r=r?W1(r):new p1,e.displayNamesLocale!==void 0?Ie(r,1,xa(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Ie(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!Fa(n))throw $g();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?Qg(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&Ie(r,4),e.categoryDenylist!==void 0?Qg(r,5,e.categoryDenylist):"categoryDenylist"in e&&Ie(r,5),Rt(t,0,2,r),V0(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 qu;$e(e,10,"audio_in"),$e(e,10,"sample_rate"),$e(e,15,"timestamped_classifications");let t=new O0;i0(t,K4,this.i);let r=new Wu;K1(r,xa("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),$e(r,3,"AUDIO:audio_in"),$e(r,3,"SAMPLE_RATE:sample_rate"),$e(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),Q1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,o)=>{(function(i,s){s.forEach((a=>{a=Y4(a),i.m.push(nw(a))}))})(this,n),ro(this,o)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{ro(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function _1(e){return{embeddings:Iu(e,Z4).map((t=>{let r={headIndex:tn(It(t,3))??0??-1,headName:Pr(It(t,4))??""??""};if(J1(t,g1,Jh(t,1))!==void 0)r.floatEmbedding=G1(Pt(t,g1,Jh(t,1)),1,di,O1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=Pt(t,Q4,Jh(t,2))?.J()?.i()??n}return r})),timestampMs:iu(It(e,2))??0}}gt.prototype.classify=gt.prototype.K,gt.prototype.setOptions=gt.prototype.o,gt.createFromModelPath=function(e,t){return j0(gt,e,{baseOptions:{modelAssetPath:t}})},gt.createFromModelBuffer=function(e,t){return ci(gt,e,{baseOptions:{modelAssetBuffer:t}})},gt.createFromOptions=function(e,t){return ci(gt,e,t)};var Wt=class extends Oa{constructor(e,t){super(new N0(e,t)),this.m=[],Rt(e=this.i=new U0,0,1,t=new Da)}get baseOptions(){return Pt(this.i,Da,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,m1,2);return r=r?W1(r):new m1,e.l2Normalize!==void 0?Ie(r,1,Jg(e.l2Normalize)):"l2Normalize"in e&&Ie(r,1),e.quantize!==void 0?Ie(r,2,Jg(e.quantize)):"quantize"in e&&Ie(r,2),Rt(t,0,2,r),V0(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 qu;$e(e,10,"audio_in"),$e(e,10,"sample_rate"),$e(e,15,"embeddings_out"),$e(e,15,"timestamped_embeddings_out");let t=new O0;i0(t,X4,this.i);let r=new Wu;K1(r,xa("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),$e(r,3,"AUDIO:audio_in"),$e(r,3,"SAMPLE_RATE:sample_rate"),$e(r,4,"EMBEDDINGS:embeddings_out"),$e(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),Q1(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=y1(n),this.m.push(_1(n)),ro(this,o)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{ro(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,o)=>{for(let i of n)n=y1(i),this.m.push(_1(n));ro(this,o)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{ro(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},_a;Wt.prototype.embed=Wt.prototype.L,Wt.prototype.setOptions=Wt.prototype.o,Wt.createFromModelPath=function(e,t){return ci(Wt,e,{baseOptions:{modelAssetPath:t}})},Wt.createFromModelBuffer=function(e,t){return ci(Wt,e,{baseOptions:{modelAssetBuffer:t}})},Wt.createFromOptions=function(e,t){return ci(Wt,e,t)};var ow=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 H0(){if(_a===void 0)try{await WebAssembly.instantiate(ow),_a=!0}catch{_a=!1}return _a}async function ni(e,t=z4``){let r=await H0()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Ar=class{};Ar.forVisionTasks=function(e){return ni("vision",e)},Ar.forTextTasks=function(e){return ni("text",e)},Ar.forGenAiExperimentalTasks=function(e){return ni("genai_experimental",e)},Ar.forGenAiTasks=function(e){return ni("genai",e)},Ar.forAudioTasks=function(e){return ni("audio",e)},Ar.isSimdSupported=function(){return H0()};var Ya=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 ga(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 Er(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([iw],{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)}},iw=`
431
+ Size: ${t.file.size}`,s),i}}throw new Error("Could not upload")}};var ya=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())}};var ba=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 Vg(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var va,Kh,l4=typeof TextDecoder<"u",h4,d4=typeof TextEncoder<"u";function E1(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 ud,xa;e:{for(Xh=["CLOSURE_FLAGS"],wa=rn,_a=0;_a<Xh.length;_a++)if((wa=wa[Xh[_a]])==null){xa=null;break e}xa=wa}var Xh,wa,_a,gi,Hg=xa&&xa[610401301];ud=Hg!=null&&Hg;var zg=rn.navigator;function od(e){return!!ud&&!!gi&&gi.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 Ar(){return!!ud&&!!gi&&gi.brands.length>0}function Jh(){return Ar()?od("Chromium"):(vt("Chrome")||vt("CriOS"))&&!(!Ar()&&vt("Edge"))||vt("Silk")}gi=zg&&zg.userAgentData||null;var u4=!Ar()&&(vt("Trident")||vt("MSIE"));!vt("Android")||Jh(),Jh(),vt("Safari")&&(Jh()||!Ar()&&vt("Coast")||!Ar()&&vt("Opera")||!Ar()&&vt("Edge")||(Ar()?od("Microsoft Edge"):vt("Edg/"))||Ar()&&od("Opera"));var C1={},di=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=di[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}x1();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),p=a(64);if(p===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),p!=64&&s(d<<6&192|p))}})(e,(function(i){n[o++]=i})),o!==r?n.subarray(0,o):n}function x1(){if(!di){di={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));C1[r]=n;for(let o=0;o<n.length;o++){let i=n[o];di[i]===void 0&&(di[i]=o)}}}}var A1=typeof Uint8Array<"u",T1=!u4&&typeof btoa=="function";function Wg(e){if(!T1){var t;t===void 0&&(t=0),x1(),t=C1[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 $g=/[-_.]/g,f4={"-":"+",_:"/",".":"="};function m4(e){return f4[e]||""}function I1(e){if(!T1)return p4(e);$g.test(e)&&(e=e.replace($g,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 La(e){return A1&&e!=null&&e instanceof Uint8Array}var lo={};function ho(){return g4||=new Ir(null,lo)}function pd(e){P1(lo);var t=e.g;return(t=t==null||La(t)?t:typeof t=="string"?I1(t):null)==null?t:e.g=t}var Ir=class{i(){return new Uint8Array(pd(this)||0)}constructor(e,t){if(P1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},g4,y4;function P1(e){if(e!==lo)throw Error("illegal external caller")}function R1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function qg(){let e=Error("int32");return R1(e,"warning"),e}var Ua=typeof Symbol=="function"&&typeof Symbol()=="symbol",b4=new Set;function Fa(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=Fa("jas",void 0,!0,!0),Yh=Fa(void 0,"2ex"),li=Fa(void 0,"1oa",!0),uo=Fa(void 0,Symbol(),!0),I=Ua?v4:"M",D1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},O1=Object.defineProperties;function fd(e,t){Ua||I in e||O1(e,D1),e[I]|=t}function Ee(e,t){Ua||I in e||O1(e,D1),e[I]=t}function w4(e,t){Ee(t,-30975&(0|e))}function id(e,t){Ee(t,-30941&(34|e))}function md(){return typeof BigInt=="function"}function wt(e){return Array.prototype.slice.call(e)}var gd,bi={},_4={};function Gg(e){return!(!e||typeof e!="object"||e.g!==_4)}function yd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function B1(e,t){if(e!=null){if(typeof e=="string")e=e?new Ir(e,lo):ho();else if(e.constructor!==Ir)if(La(e))e=e.length?new Ir(new Uint8Array(e),lo):ho();else{if(!t)throw Error();e=void 0}}return e}function Aa(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[I]))}var Kg=[];function sn(e){if(2&e)throw Error()}function bd(e){return uo?e[uo]:void 0}Ee(Kg,55),gd=Object.freeze(Kg);var M1=Object.freeze({}),vd=typeof rn.BigInt=="function"&&typeof rn.BigInt(0)=="bigint",sd=e=>vd?e>=k4&&e<=C4:e[0]==="-"?Xg(e,S4):Xg(e,E4),S4=Number.MIN_SAFE_INTEGER.toString(),k4=vd?BigInt(Number.MIN_SAFE_INTEGER):void 0,E4=Number.MAX_SAFE_INTEGER.toString(),C4=vd?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Xg(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",L1,X=0,he=0;function Jg(e){let t=e>>>0;X=t,he=(e-t)/4294967296>>>0}function po(e){if(e<0){Jg(-e);let[t,r]=Sd(X,he);X=t>>>0,he=r>>>0}else Jg(e)}function U1(e){let t=L1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),he=0,X=t.getUint32(0,!0)}function wd(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:yi(e,t)}function _d(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=wd(e,t))=="number"?r?-e:e:r?"-"+e:e}function yi(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else md()?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+Yg(r)+Yg(e));return r}function Yg(e){return e=String(e),"0000000".slice(e.length)+e}function Na(e){if(e.length<16)po(Number(e));else if(md())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]=Sd(X,he);X=n,he=o}}}function Sd(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var F1=typeof BigInt=="function"?BigInt.asIntN:void 0,A4=typeof BigInt=="function"?BigInt.asUintN:void 0,ui=Number.isSafeInteger,ja=Number.isFinite,Ta=Math.trunc;function vi(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Qg(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 kd(e){switch(typeof e){case"bigint":return!0;case"number":return ja(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 ja(e)?0|e:void 0}function Zg(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function N1(e){return e=Ta(e),ui(e)||(po(e),e=_d(X,he)),e}function j1(e){var t=Ta(Number(e));if(ui(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(Na(e),e=X,2147483648&(t=he))if(md())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Sd(e,t);e="-"+yi(r,n)}else e=yi(e,t);return e}function ad(e){return e==null?e:typeof e=="bigint"?(sd(e)?e=Number(e):(e=F1(64,e),e=sd(e)?Number(e):String(e)),e):kd(e)?typeof e=="number"?N1(e):j1(e):void 0}function I4(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(A4(64,e));if(kd(e)){if(t==="string")return t=Ta(Number(e)),ui(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Zg(e)||(Na(e),e=yi(X,he))),e;if(t==="number")return(e=Ta(e))>=0&&ui(e)?e:(function(r){if(r<0){po(r);var n=yi(X,he);return r=Number(n),ui(r)?r:n}return Zg(n=String(r))?n:(po(r),wd(X,he))})(e)}}function V1(e){if(typeof e!="string")throw Error();return e}function Ia(e){if(e!=null&&typeof e!="string")throw Error();return e}function Pr(e){return e==null||typeof e=="string"?e:void 0}function H1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===bi)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 z1(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=Aa(e)?void 0:o&&2&(0|e[I])?e:Ed(e,t,r,n!==void 0,o);else if(yd(e)){let i={};for(let s in e)i[s]=z1(e[s],t,r,n,o);e=i}else e=t(e,n);return e}}function Ed(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]=z1(n[a],t,r,s,o);return r&&((e=bd(e))&&(n[uo]=wt(e)),r(i,n)),n}function P4(e){return e.B===bi?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return sd(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Aa(t))return}else{if(La(t))return Wg(t);if(t instanceof Ir){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=Wg(r)}}}return t})(e)}function R4(e){return Ed(e,P4,void 0,void 0,!1)}var W1,D4;function pi(e,t,r){return e=$1(e,t[0],t[1],r?1:2),t!==W1&&r&&fd(e,16384),e}function $1(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(yd(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 q1(e,t,r=id){if(e!=null){if(A1&&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):Ed(e,q1,4&n?id:r,!0,!0))}return e.B===bi&&(e=2&(n=0|(r=e.l)[I])?e:new e.constructor(Va(r,n,!0))),e}}function G1(e){let t=e.l;return new e.constructor(Va(t,0|t[I],!1))}function Va(e,t,r){let n=r||2&t?id: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=bd(i))&&(c[uo]=wt(i)),c})(e,t,(i=>q1(i,o,n))),fd(e,32|(r?2:0)),e}function Cd(e){let t=e.l,r=0|t[I];return 2&r?new e.constructor(Va(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&&Yh!=null&&((o=(e=y4??={})[Yh]||0)>=4||(e[Yh]=o+1,R1(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 K1(e){let t=0|(e=e.l)[I],r=an(e,t,1),n=B1(r,!0);return n!=null&&n!==r&&Ce(e,t,1,n),n}function X1(e,t,r,n,o){let i=e.l,s=2&(e=0|i[I])?1:n;o=!!o;let a=0|(n=xd(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=Ad(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=Rr(a,e,o),Ee(n,a),e=Ce(i,e,t,n)),ar(a)||(t=a,a=Rr(a,e,o),a!==t&&Ee(n,a))),n}function xd(e,t,r,n){return e=an(e,t,r,n),Array.isArray(e)?e:gd}function Ad(e,t){return e===0&&(e=cr(e,t)),1|e}function ar(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function e1(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=Rr(o=cr(o,n),n,!0),a=!1),o|=21,s=0;s<r.length;s++){let c=r[s],l=V1(c);Object.is(c,l)||(a&&(r=wt(r),i=0,o=Rr(o=cr(o,n),n,!0),a=!1),r[s]=l)}o!==i&&(a&&(r=wt(r),o=Rr(o=cr(o,n),n,!0)),Ee(r,o)),Ce(e,n,t,r)}}function J1(e,t){let r=0|(e=e.l)[I];sn(r),Ce(e,r,2,t===""?void 0:t)}function wi(e,t,r,n,o){sn(t);var i=!(!(64&t)&&16384&t);let s=(o=xd(e,t,r,o))!==gd;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&Ad(a,t),a=Rr(n?-17&a:16|a,t,!0),a!==i&&Ee(o,a)}return o}function Qh(e,t){var r=j0;return Id(Td(e=e.l),e,0|e[I],r)===t?t:-1}function Td(e){if(Ua)return e[li]??(e[li]=new Map);if(li in e)return e[li];let t=new Map;return Object.defineProperty(e,li,{value:t}),t}function Y1(e,t,r,n){let o=Td(e),i=Id(o,e,t,r);return i!==n&&(i&&(t=Ce(e,t,i)),o.set(r,n)),t}function Id(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 Pd(e,t,r,n){let o,i=0|e[I];if((n=an(e,i,r,n))!=null&&n.B===bi)return(t=Cd(n))!==n&&Ce(e,i,r,t),t.l;if(Array.isArray(n)){let s=0|n[I];o=2&s?pi(Va(n,s,!1),t,!0):64&s?n:pi(o,t,!0)}else o=pi(void 0,t,!0);return o!==n&&Ce(e,i,r,o),o}function Q1(e,t,r,n){let o=0|(e=e.l)[I];return(t=H1(n=an(e,o,r,n),t,o))!==n&&t!=null&&Ce(e,o,r,t),t}function Pt(e,t,r){if((t=Q1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[I];if(!(2&n)){let o=Cd(t);o!==t&&Ce(e,n,r,t=o)}return t}function Z1(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=xd(e,t,1))[I];if(!(s=!!(4&c))){var l=n,h=t;let d=!!(2&(c=Ad(c,t)));d&&(h|=2);let p=!d,b=!0,f=0,g=0;for(;f<l.length;f++){let y=H1(l[f],r,h);if(y instanceof r){if(!d){let v=!!(2&(0|y.l[I]));p&&=!v,b&&=v}l[g++]=y}}g<f&&(l.length=g),c|=4,c=b?16|c:-17&c,Ee(l,c=p?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=Cd(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=Rr(c=cr(c,t),t,o)),t=Ce(e,t,1,n)),ar(c)||(e=c,(c=Rr(c,t,o))!==e&&Ee(n,c))),n}function Rd(e,t){let r=0|e.l[I];return Z1(e,r,t,M1===void 0?2:4,!1,!(2&r))}function Rt(e,t,r,n){return n==null&&(n=void 0),Ie(e,r,n)}function Zh(e,t,r){var n=L0;r==null&&(r=void 0);e:{let o=0|(e=e.l)[I];if(sn(o),r==null){let i=Td(e);if(Id(i,e,o,n)!==t)break e;i.set(n,0)}else o=Y1(e,o,n,t);Ce(e,o,t,r)}}function cr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function Rr(e,t,r){return 32&t&&r||(e&=-33),e}function e0(e,t){var r=Gd;let n=0|e.l[I];sn(n),e=Z1(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 We(e,t,r){sn(0|e.l[I]),X1(e,t,Pr,2,!0).push(V1(r))}function t0(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Dd(){return Error("Failed to read varint, encoding is invalid.")}function r0(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Od(e){if(typeof e=="string")return{buffer:I1(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===Ir)return{buffer:pd(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 Bd(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 Dd()}function Md(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 Dd()}function $e(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 Dd();return tn(e,r),o}function cd(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 ld(e){var t=cd(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 $e(e)}function ed(e,t,{C:r=!1}={}){e.C=r,t&&(t=Od(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 r0(e.j,t)}function n0(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 r0(t,e.j-r);return e.g=n,r}function o0(e,t){if(t==0)return ho();var r=n0(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?ho():new Ir(r,lo)}var t1=[];function i0(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=$e(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw t0(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 Ea(e){switch(e.i){case 0:e.i!=0?Ea(e):Md(e.g);break;case 1:tn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Ea(e);else{var t=$e(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(!i0(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Ea(e)}break;default:throw t0(e.i,e.j)}}function Ha(e,t,r){let n=e.g.j,o=$e(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 Ld(e){var t=$e(e.g)>>>0,r=n0(e=e.g,t);if(e=e.i,l4){var n,o=e;(n=Kh)||(n=Kh=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(va===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),va=!0}catch{va=!1}}throw!va&&(Kh=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=Vg(c,r),r.length=0)}i=Vg(c,r)}return i}function s0(e){let t=$e(e.g)>>>0;return o0(e.g,t)}function Ud(e,t,r){var n=$e(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Sa=[];function B4(e){return e}var so;function a0(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=$1(e,t)}toJSON(){let e=!so;try{return e&&(so=R4),c0(this)}finally{e&&(so=void 0)}}u(){return!!(2&(0|this.l[I]))}};function c0(e){var t=e.l;{t=(e=so(t))!==t;let l=e.length;if(l){var r=e[l-1],n=yd(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)&&(Aa(n)||Gg(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||Aa(i)||Gg(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 r1(e){return e?/^\d+$/.test(e)?(Na(e),new hd(X,he)):null:M4||=new hd(0,0)}te.prototype.B=bi,te.prototype.toString=function(){try{return so=B4,c0(this).toString()}finally{so=void 0}};var hd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},M4;function n1(e){return e?/^-?\d+$/.test(e)?(Na(e),new dd(X,he)):null:L4||=new dd(0,0)}var dd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},L4;function ao(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 _i(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function za(e,t){if(t>=0)_i(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Pa(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 fo(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Dt(e,t,r){_i(e.g,8*t+r)}function Wa(e,t){return Dt(e,t,2),t=e.g.end(),fo(e,t),t.push(e.i),t}function $a(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 qa(e,t,r){Dt(e,t,2),_i(e.g,r.length),fo(e,e.g.end()),fo(e,r)}function Ot(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Fd=Ot(),l0=Ot(),Nd=Ot(),jd=Ot(),h0=Ot(),d0=Ot(),u0=Ot(),p0=Ot(),mo=class{constructor(e,t,r){this.g=e,this.i=t,e=Fd,this.j=!!e&&r===e||!1}};function Vd(e,t){return new mo(e,t,Fd)}function f0(e,t,r,n,o){(t=b0(t,n))!=null&&(r=Wa(e,r),o(t,e),$a(e,r))}var U4=Vd((function(e,t,r,n,o){return e.i===2&&(Ha(e,Pd(t,n,r),o),!0)}),f0),F4=Vd((function(e,t,r,n,o){return e.i===2&&(Ha(e,Pd(t,n,r,!0),o),!0)}),f0),Ga=Symbol(),Hd=Symbol(),o1=Symbol(),i1=Symbol(),m0,g0;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 W1||=[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,m0??=i,g0??=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 mo?d=i:(d=U4,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 p=a[c];l?r(o,c,d,l,p):t(o,c,d,p)}}return n[e]=o}function y0(e){return Array.isArray(e)?e[0]instanceof mo?e:[F4,e]:[e,void 0]}function b0(e,t){return e instanceof te?e.l:Array.isArray(e)?pi(e,t,!1):void 0}function zd(e,t,r,n){let o=r.g;e[t]=n?(i,s,a)=>o(i,s,a,n):o}function Wd(e,t,r,n,o){let i=r.g,s,a;e[t]=(c,l,h)=>i(c,l,h,a||=cn(Hd,zd,Wd,n).A,s||=$d(n),o)}function $d(e){let t=e[o1];if(t!=null)return t;let r=cn(Hd,zd,Wd,e);return t=r.I?(n,o)=>m0(n,o,r):(n,o)=>{let i=0|n[I];for(;i0(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,Ea(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=o0(a.g,c)),s=n,a&&((c=s[uo])?c.push(a):s[uo]=[a]))}return 16384&i&&fd(n,34),!0},e[o1]=t}function N4(e){let t=(e=y0(e))[0].g;if(e=e[1]){let r=$d(e),n=cn(Hd,zd,Wd,e).A;return(o,i,s)=>t(o,i,s,n,r)}return t}function Ka(e,t,r){e[t]=r.i}function Xa(e,t,r,n){let o,i,s=r.i;e[t]=(a,c,l)=>s(a,c,l,i||=cn(Ga,Ka,Xa,n).A,o||=v0(n))}function v0(e){let t=e[i1];if(!t){let r=cn(Ga,Ka,Xa,e);t=(n,o)=>w0(n,o,r),e[i1]=t}return t}function w0(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=s1(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=s1(r,o))&&a(t,i,o)}if(e=bd(e))for(fo(t,t.g.end()),r=0;r<e.length;r++)fo(t,pd(e[r])||new Uint8Array(0))}function s1(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=y0(r))[0].i;if(r=r[1]){let o=v0(r),i=cn(Ga,Ka,Xa,r).A;r=e.I?g0(i,o):(s,a,c)=>n(s,a,c,i,o)}else r=n;return e[t]=r}}function Ja(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 mo(e,t,r)}function Ya(e,t,r){return new mo(e,t,r)}function Le(e,t,r){Ce(e,0|e[I],t,r)}function _0(e,t,r){if(t=(function(n){if(n==null)return n;let o=typeof n;if(o==="bigint")return String(F1(64,n));if(kd(n)){if(o==="string")return j1(n);if(o==="number")return N1(n)}})(t),t!=null&&(typeof t=="string"&&n1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,po(t),ao(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new dd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ao(e.g,r.i,r.g);break;default:r=n1(t),ao(e.g,r.i,r.g)}}function S0(e,t,r){(t=nn(t))!=null&&t!=null&&(Dt(e,r,0),za(e.g,t))}function k0(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 E0(e,t,r){(t=Pr(t))!=null&&qa(e,r,E1(t))}function C0(e,t,r,n,o){(t=b0(t,n))!=null&&(r=Wa(e,r),o(t,e),$a(e,r))}function x0(e,t,r){(t=t==null||typeof t=="string"||La(t)||t instanceof Ir?t:void 0)!=null&&qa(e,r,Od(t).buffer)}var j4=Me((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=cd(n);let o=cd(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=vi(t))!=null&&(Dt(e,r,1),e=e.g,(r=L1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),X=r.getUint32(0,!0),he=r.getUint32(4,!0),Pa(e,X),Pa(e,he))}),Ot()),A0=Me((function(e,t,r){return e.i===5&&(Le(t,r,ld(e.g)),!0)}),(function(e,t,r){(t=vi(t))!=null&&(Dt(e,r,5),e=e.g,U1(t),Pa(e,X))}),d0),V4=Ya((function(e,t,r){return(e.i===5||e.i===2)&&(t=wi(t,0|t[I],r,!1,!1),e.i==2?Ud(e,ld,t):t.push(ld(e.g)),!0)}),(function(e,t,r){if((t=Ja(vi,t))!=null&&t.length){Dt(e,r,2),_i(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,U1(t[n]),Pa(r,X)}}),d0),Ra=Me((function(e,t,r){return e.i===0&&(Le(t,r,Bd(e.g,_d)),!0)}),_0,h0),td=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Bd(e.g,_d))===0?void 0:e),!0)}),_0,h0),H4=Me((function(e,t,r){return e.i===0&&(Le(t,r,Bd(e.g,wd)),!0)}),(function(e,t,r){if((t=I4(t))!=null&&(typeof t=="string"&&r1(t),t!=null))switch(Dt(e,r,0),typeof t){case"number":e=e.g,po(t),ao(e,X,he);break;case"bigint":r=BigInt.asUintN(64,t),r=new hd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ao(e.g,r.i,r.g);break;default:r=r1(t),ao(e.g,r.i,r.g)}}),Ot()),Dr=Me((function(e,t,r){return e.i===0&&(Le(t,r,$e(e.g)),!0)}),S0,jd),qd=Ya((function(e,t,r){return(e.i===0||e.i===2)&&(t=wi(t,0|t[I],r,!1,!1),e.i==2?Ud(e,$e,t):t.push($e(e.g)),!0)}),(function(e,t,r){if((t=Ja(nn,t))!=null&&t.length){r=Wa(e,r);for(let n=0;n<t.length;n++)za(e.g,t[n]);$a(e,r)}}),jd),oo=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=$e(e.g))===0?void 0:e),!0)}),S0,jd),nt=Me((function(e,t,r){return e.i===0&&(Le(t,r,Md(e.g)),!0)}),k0,l0),co=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=Md(e.g))===!1?void 0:e),!0)}),k0,l0),yt=Ya((function(e,t,r){return e.i===2&&(e=Ld(e),wi(t,0|t[I],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ja(Pr,t))!=null)for(let s=0;s<t.length;s++){var n=e,o=r,i=t[s];i!=null&&qa(n,o,E1(i))}}),Nd),Tr=Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=Ld(e))===""?void 0:e),!0)}),E0,Nd),me=Me((function(e,t,r){return e.i===2&&(Le(t,r,Ld(e)),!0)}),E0,Nd),bt=(function(e,t,r=Fd){return new mo(e,t,r)})((function(e,t,r,n,o){return e.i===2&&(n=pi(void 0,n,!0),wi(t,0|t[I],r,!0).push(n),Ha(e,n,o),!0)}),(function(e,t,r,n,o){if(Array.isArray(t))for(let i=0;i<t.length;i++)C0(e,t[i],r,n,o)})),Te=Vd((function(e,t,r,n,o,i){return e.i===2&&(Y1(t,0|t[I],i,r),Ha(e,t=Pd(t,n,r),o),!0)}),C0),T0=Me((function(e,t,r){return e.i===2&&(Le(t,r,s0(e)),!0)}),x0,u0),z4=Me((function(e,t,r){return e.i===0&&(Le(t,r,(e=$e(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 ja(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(Dt(e,r,0),_i(e.g,t))}),Ot()),on=Me((function(e,t,r){return e.i===0&&(Le(t,r,$e(e.g)),!0)}),(function(e,t,r){(t=nn(t))!=null&&(t=parseInt(t,10),Dt(e,r,0),za(e.g,t))}),p0),Da=class{constructor(t,r){this.i=t,this.g=r,this.j=Rt,this.defaultValue=void 0}};function I0(e,t){return(r,n)=>{if(Sa.length){let i=Sa.pop();i.o(n),ed(i.g,r,n),r=i}else r=new class{constructor(i,s){if(t1.length){let a=t1.pop();ed(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,ed(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;$d(t)(s,r);var o=i}finally{r.g.clear(),r.m=-1,r.i=-1,Sa.length<100&&Sa.push(r)}return o}}var a1=[0,Tr,Me((function(e,t,r){return e.i===2&&(Le(t,r,(e=s0(e))===ho()?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&&qa(e,r,Od(t).buffer)))}if(Array.isArray(t))return}x0(e,t,r)}),u0)],rd,c1=globalThis.trustedTypes;function l1(e){rd===void 0&&(rd=(function(){let r=null;if(!c1)return r;try{let n=o=>o;r=c1.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=rd;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 l1(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return l1(r)}var P0=[0,Dr,on,nt,-1,qd,on,-1],$4=class extends te{constructor(e){super(e)}},R0=[0,nt,me,nt,on,-1,Ya((function(e,t,r){return(e.i===0||e.i===2)&&(t=wi(t,0|t[I],r,!1,!1),e.i==2?Ud(e,O4,t):t.push($e(e.g)),!0)}),(function(e,t,r){if((t=Ja(nn,t))!=null&&t.length){r=Wa(e,r);for(let n=0;n<t.length;n++)za(e.g,t[n]);$a(e,r)}}),p0),me,-1,[0,nt,-1],on,nt,-1],D0=[0,me,-2],h1=class extends te{constructor(e){super(e)}},O0=[0],B0=[0,Dr,nt,1,nt,-3],M0=class extends te{constructor(e){super(e,2)}},Qa={};Qa[336783863]=[0,me,nt,-1,Dr,[0,[1,2,3,4,5,6,7,8],Te,O0,Te,R0,Te,D0,Te,B0,Te,P0,Te,[0,me,-2],Te,[0,me,on],Te,[0,on,me]],[0,me],nt,[0,[1,3],[2,4],Te,[0,qd],-1,Te,[0,yt],-1,bt,[0,me,-1]],me];var d1,u1=[0,td,-1,co,-3,td,qd,Tr,oo,td,-1,co,oo,co,-2,Tr],Gd=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,7,e)}},fi=[-1,{}],p1=[0,me,1,fi],f1=[0,me,yt,fi],Kd=class extends te{constructor(e){super(e,500)}o(e){return Rt(this,0,1001,e)}};Kd.prototype.g=(d1=[-500,bt,[-500,Tr,-1,yt,-3,[-2,Qa,nt],bt,a1,oo,-1,p1,f1,bt,[0,Tr,co],Tr,u1,oo,yt,987,yt],4,bt,[-500,me,-1,[-1,{}],998,me],bt,[-500,me,yt,-1,[-2,{},nt],997,yt,-1],oo,bt,[-500,me,yt,fi,998,yt],yt,oo,p1,f1,bt,[0,Tr,-1,fi],yt,-2,u1,Tr,-1,co,[0,co,z4],978,fi,bt,a1],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}}}};w0(this.l,e,cn(Ga,Ka,Xa,d1)),fo(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 Rd(this,q4)}},K4=[0,bt,[0,Dr,A0,me,-1]],m1=class extends te{constructor(e){super(e)}},g1=class extends te{constructor(e){super(e)}},L0=[1,2,3,4,5],Oa=class extends te{constructor(e){super(e)}g(){return K1(this)!=null}i(){return Pr(It(this,2))!=null}},Ba=class extends te{constructor(e){super(e)}},U0=class extends te{constructor(e){super(e)}},F0=[0,[0,T0,me,[0,Dr,Ra,-1],[0,H4,Ra]],nt,[0,L0,Te,B0,Te,R0,Te,P0,Te,O0,Te,D0],on],X4=new Da(451755788,U0);Qa[451755788]=[0,F0,[0,me,Dr,A0,yt,-1],j4];var y1=class extends te{constructor(e){super(e)}},N0=class extends te{constructor(e){super(e)}},J4=new Da(487277289,N0);Qa[487277289]=[0,F0,[0,nt,-1]];var Y4=class extends te{constructor(e){super(e)}},Q4=I0(class extends te{constructor(e){super(e)}},[0,bt,[0,1,Dr,me,K4],Ra]),b1=class extends te{constructor(e){super(e)}},Z4=class extends te{constructor(e){super(e)}J(){let e=K1(this);return e??ho()}},ev=class extends te{constructor(e){super(e)}},j0=[1,2],v1=I0(class extends te{constructor(e){super(e)}},[0,bt,[0,j0,Te,[0,V4],Te,[0,T0],Dr,me],Ra]);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 w1(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 _1(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 Cr(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=>{_1(this,Object.keys(e),(o=>{_1(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){Cr(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){Cr(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){Cr(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){Cr(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){Cr(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){Cr(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){Cr(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?'),Cr(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}}),V0=class extends rv{};async function nv(e,t,r){return e=await(async(n,o,i,s)=>{if(o&&await w1(o),!self.ModuleFactory||i&&(await w1(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 H0(e,t,r){return nv(e,t,r)}function nd(e,t){let r=Pt(e.baseOptions,Oa,1)||new Oa;typeof t=="string"?(Ie(r,2,Ia(t)),Ie(r,1)):t instanceof Uint8Array&&(Ie(r,1,B1(t,!1)),Ie(r,2)),Rt(e.baseOptions,0,1,r)}function z0(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,Oa,1)?.g()||Pt(e.baseOptions,Oa,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,g1,3);if(!i){var s=i=new g1;Zh(s,4,new h1)}"delegate"in o&&(o.delegate==="GPU"?Zh(o=i,2,s=new $4):Zh(o=i,4,s=new h1)),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),nd(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)nd(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=>{nd(e,n),e.v()}));return e.v(),Promise.resolve()}function S1(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 io(e,t){e.s=Math.max(e.s,t)}var Ca=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),S1(this)}finishProcessing(){this.g.finishProcessing(),S1(this)}close(){this.g.closeGraph()}};async function mi(e,t,r){return H0(e,t,r)}Ca.prototype.close=Ca.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",Ca);var Ma=class extends Ca{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function ov(e){let t={classifications:Rd(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=vi(h);return d!=null&&d!==h&&Ce(c,l,2,d),{index:a,score:d??0??0,categoryName:Pr(It(s,3))??""??"",displayName:Pr(It(s,4))??""??""}})),headIndex:o,headName:i}})(Pt(r,G4,4)?.g()??[],nn(It(r,2))??0,Pr(It(r,3))??"")))};return ad(It(e,2))!=null&&(t.timestampMs=ad(It(e,2))??0),t}Ma.prototype.setDefaultSampleRate=Ma.prototype.O;var gt=class extends Ma{constructor(e,t){super(new V0(e,t)),this.m=[],Rt(e=this.i=new U0,0,1,t=new Ba)}get baseOptions(){return Pt(this.i,Ba,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,m1,2);if(r=r?G1(r):new m1,e.displayNamesLocale!==void 0?Ie(r,1,Ia(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Ie(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!ja(n))throw qg();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?e1(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&Ie(r,4),e.categoryDenylist!==void 0?e1(r,5,e.categoryDenylist):"categoryDenylist"in e&&Ie(r,5),Rt(t,0,2,r),z0(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;We(e,10,"audio_in"),We(e,10,"sample_rate"),We(e,15,"timestamped_classifications");let t=new M0;a0(t,X4,this.i);let r=new Gd;J1(r,Ia("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),We(r,3,"AUDIO:audio_in"),We(r,3,"SAMPLE_RATE:sample_rate"),We(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),e0(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),io(this,o)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{io(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function k1(e){return{embeddings:Rd(e,ev).map((t=>{let r={headIndex:nn(It(t,3))??0??-1,headName:Pr(It(t,4))??""??""};if(Q1(t,b1,Qh(t,1))!==void 0)r.floatEmbedding=X1(Pt(t,b1,Qh(t,1)),1,vi,M1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=Pt(t,Z4,Qh(t,2))?.J()?.i()??n}return r})),timestampMs:ad(It(e,2))??0}}gt.prototype.classify=gt.prototype.K,gt.prototype.setOptions=gt.prototype.o,gt.createFromModelPath=function(e,t){return H0(gt,e,{baseOptions:{modelAssetPath:t}})},gt.createFromModelBuffer=function(e,t){return mi(gt,e,{baseOptions:{modelAssetBuffer:t}})},gt.createFromOptions=function(e,t){return mi(gt,e,t)};var $t=class extends Ma{constructor(e,t){super(new V0(e,t)),this.m=[],Rt(e=this.i=new N0,0,1,t=new Ba)}get baseOptions(){return Pt(this.i,Ba,1)}set baseOptions(e){Rt(this.i,0,1,e)}o(e){var t=this.i,r=Pt(this.i,y1,2);return r=r?G1(r):new y1,e.l2Normalize!==void 0?Ie(r,1,Qg(e.l2Normalize)):"l2Normalize"in e&&Ie(r,1),e.quantize!==void 0?Ie(r,2,Qg(e.quantize)):"quantize"in e&&Ie(r,2),Rt(t,0,2,r),z0(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;We(e,10,"audio_in"),We(e,10,"sample_rate"),We(e,15,"embeddings_out"),We(e,15,"timestamped_embeddings_out");let t=new M0;a0(t,J4,this.i);let r=new Gd;J1(r,Ia("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),We(r,3,"AUDIO:audio_in"),We(r,3,"SAMPLE_RATE:sample_rate"),We(r,4,"EMBEDDINGS:embeddings_out"),We(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),e0(e,r),this.g.attachProtoListener("embeddings_out",((n,o)=>{n=v1(n),this.m.push(k1(n)),io(this,o)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{io(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,o)=>{for(let i of n)n=v1(i),this.m.push(k1(n));io(this,o)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{io(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},ka;$t.prototype.embed=$t.prototype.L,$t.prototype.setOptions=$t.prototype.o,$t.createFromModelPath=function(e,t){return mi($t,e,{baseOptions:{modelAssetPath:t}})},$t.createFromModelBuffer=function(e,t){return mi($t,e,{baseOptions:{modelAssetBuffer:t}})},$t.createFromOptions=function(e,t){return mi($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 W0(){if(ka===void 0)try{await WebAssembly.instantiate(iv),ka=!0}catch{ka=!1}return ka}async function hi(e,t=W4``){let r=await W0()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var xr=class{};xr.forVisionTasks=function(e){return hi("vision",e)},xr.forTextTasks=function(e){return hi("text",e)},xr.forGenAiExperimentalTasks=function(e){return hi("genai_experimental",e)},xr.forGenAiTasks=function(e){return hi("genai",e)},xr.forAudioTasks=function(e){return hi("audio",e)},xr.isSimdSupported=function(){return W0()};var Za=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 ba(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 Er(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 xr.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=`
247
432
  class AudioProcessor extends AudioWorkletProcessor {
248
433
  bufferSize;
249
434
  inputBuffer;
@@ -280,7 +465,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","che
280
465
  }
281
466
 
282
467
  registerProcessor("audio-processor", AudioProcessor);
283
- `;var Qa=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t,sa(t)}async startRecording(){this.startTime=new Date(Date.now());let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:o}=this.options,i={video:{cursor:"always",width:854,height:480,displaySurface:"monitor"},audio:!1};this.screenStream=await navigator.mediaDevices.getDisplayMedia(i);let s=this.screenStream.getVideoTracks();if(s[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let y=s.find(f=>f.label=="");if(y&&t||y&&!r)throw aa}let c=s.find(y=>["screen:0:0","Primary Monitor"].includes(y.label))!=null,l=s.find(y=>["screen:0:0","Primary Monitor",""].includes(y.label)||["screen:"].some(f=>y.label.includes(f)))!=null,h=s.find(y=>["web-contents-media-stream","window"].some(f=>y.label.includes(f)))!=null;if(!c&&t)throw s.forEach(y=>{y.stop()}),Ag;if(!l||h)throw s.forEach(y=>{y.stop()}),xg;let{startRecording:u,stopRecording:p}=Jr(this.screenStream,this.blobs,this.options.onBufferSizeError,o);this.recordingStart=u,this.recordingStop=p,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 mi=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 z0(){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 $0(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function gi(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var Za=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new Qn}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=`
468
+ `;var ec=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t,ca(t)}async startRecording(){this.startTime=new Date(Date.now());let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:o}=this.options,i={video:{cursor:"always",width:854,height:480,displaySurface:"monitor"},audio:!1};this.screenStream=await navigator.mediaDevices.getDisplayMedia(i);let s=this.screenStream.getVideoTracks();if(s[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let b=s.find(f=>f.label=="");if(b&&t||b&&!r)throw la}let c=s.find(b=>["screen:0:0","Primary Monitor"].includes(b.label))!=null,l=s.find(b=>["screen:0:0","Primary Monitor",""].includes(b.label)||["screen:"].some(f=>b.label.includes(f)))!=null,h=s.find(b=>["web-contents-media-stream","window"].some(f=>b.label.includes(f)))!=null;if(!c&&t)throw s.forEach(b=>{b.stop()}),Tg;if(!l||h)throw s.forEach(b=>{b.stop()}),Ig;let{startRecording:d,stopRecording:p}=Qr(this.screenStream,this.blobs,this.options.onBufferSizeError,o);this.recordingStart=d,this.recordingStop=p,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 Si=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 $0(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function ki(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var tc=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new to}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=`
284
469
  .loader {
285
470
  border: 6px solid #f3f3f3;
286
471
  border-radius: 50%;
@@ -301,27 +486,27 @@ registerProcessor("audio-processor", AudioProcessor);
301
486
  0% { transform: rotate(0deg); }
302
487
  100% { transform: rotate(360deg); }
303
488
  }
304
- `,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}},Or=class extends Error{constructor(t="A timeout occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},xe=class extends Error{constructor(t="An abort occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},ec=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}},rc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},yi=class extends Error{constructor(t){let r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},nc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}};var po=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 m;(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"})(m||(m={}));var Gt=class{constructor(){}log(t,r){}};Gt.instance=new Gt;var W0="9.0.6";var $=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 Br(e,t){let r="";return Bt(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${sw(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function sw(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 ic(e,t,r,n,o,i){let s={},[a,c]=Kt();s[a]=c,e.log(m.Trace,`(${t} transport) sending data. ${Br(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(m.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}function q0(e){return e===void 0?new an(m.Information):e===null?Gt.instance:e.log!==void 0?e:new an(e)}var oc=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=>{})}},an=class{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){let n=`[${new Date().toISOString()}] ${m[t]}: ${r}`;switch(t){case m.Critical:case m.Error:this.out.error(n);break;case m.Warning:this.out.warn(n);break;case m.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,aw(W0,cw(),hw(),lw())]}function aw(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 cw(){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 lw(){if(q.isNode)return process.versions.node}function hw(){return q.isNode?"NodeJS":"Browser"}function sc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function G0(){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 ac=class extends qt{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||q.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:mn;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(G0());if(typeof AbortController>"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:mn;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new xe;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 xe});let o=null;if(t.timeout){let c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(m.Warning,"Timeout from HTTP request."),n=new Or},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(m.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!i.ok){let c=await K0(i,"text");throw new ot(c||i.statusText,i.status)}let a=await K0(i,t.responseType);return new po(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 K0(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 cc=class extends qt{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new xe):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 xe)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new po(o.status,o.statusText,o.response||o.responseText)):n(new ot(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(m.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new ot(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(m.Warning,"Timeout from HTTP request."),n(new Or)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var lc=class extends qt{constructor(t){if(super(),typeof fetch<"u"||q.isNode)this._httpClient=new ac(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new cc(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new xe):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 hc=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 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 oc(this,t)}};var dc=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 Gu(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))}},Gu=class{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}};var uw=30*1e3,dw=15*1e3,pw=1e5,re;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(re||(re={}));var pc=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(m.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")},$.isRequired(t,"connection"),$.isRequired(r,"logger"),$.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=i??uw,this.keepAliveIntervalInMilliseconds=s??dw,this._statefulReconnectBufferSize=a??pw,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new hc,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(m.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(m.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=re.Disconnected,this._logger.log(m.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(m.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(m.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 dc(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(m.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(m.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(m.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(m.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(m.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 xe("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 uc;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,u)=>{if(u){c(u);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(m.Error,`Invoke client method threw error: ${sc(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(m.Error,`Stream callback threw error: ${sc(i)}`)}}break}case D.Ping:break;case D.Close:{this._logger.log(m.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(m.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(m.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(m.Error,o);let i=new Error(o);throw this._handshakeRejecter(i),i}else this._logger.log(m.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(m.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(m.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(m.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(m.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(m.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(m.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(m.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new xe("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(m.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(m.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(m.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(m.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(m.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==re.Reconnecting){this._logger.log(m.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(m.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(m.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=re.Connected,this._logger.log(m.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(m.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(m.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==re.Reconnecting){this._logger.log(m.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(m.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(m.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(m.Error,`Stream 'error' callback called with '${t}' threw error: ${sc(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 fw=[0,2e3,1e4,3e4,null],bi=class{constructor(t){this._retryDelays=t!==void 0?[...t,null]:fw}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}};var Mt=class{};Mt.Authorization="Authorization";Mt.Cookie="Cookie";var fc=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 ue;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(ue||(ue={}));var mc=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 wi=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new mc,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if($.isRequired(t,"url"),$.isRequired(r,"transferFormat"),$.isIn(r,ue,"transferFormat"),this._url=t,this._logger.log(m.Trace,"(LongPolling transport) Connecting."),r===ue.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===ue.Binary&&(s.responseType="arraybuffer");let a=`${t}&_=${Date.now()}`;this._logger.log(m.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(m.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(m.Trace,`(LongPolling transport) polling: ${n}.`);let o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(m.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(m.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new ot(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(m.Trace,`(LongPolling transport) data received. ${Br(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(m.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Or?this._logger.log(m.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(m.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(m.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?ic(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(m.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(m.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(m.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(m.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(m.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(m.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(m.Trace,t),this.onclose(this._closeError)}}};var gc=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 $.isRequired(t,"url"),$.isRequired(r,"transferFormat"),$.isIn(r,ue,"transferFormat"),this._logger.log(m.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!==ue.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(m.Trace,`(SSE transport) data received. ${Br(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(m.Information,`SSE connected to ${this._url}`),this._eventSource=s,i=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?ic(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 yc=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){$.isRequired(t,"url"),$.isRequired(r,"transferFormat"),$.isIn(r,ue,"transferFormat"),this._logger.log(m.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,u]=Kt();l[h]=u,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===ue.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(m.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(m.Information,`(WebSockets transport) ${h}.`)},s.onmessage=l=>{if(this._logger.log(m.Trace,`(WebSockets transport) data received. ${Br(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(m.Trace,`(WebSockets transport) sending data. ${Br(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(m.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 X0=100,bc=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,$.isRequired(t,"url"),this._logger=q0(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 mn<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:mn;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 fc(r.httpClient||new lc(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||ue.Binary,$.isIn(t,ue,"transferFormat"),this._logger.log(m.Debug,`Starting connection with transfer format '${ue[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(m.Error,r),await this._stopPromise,Promise.reject(new xe(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(m.Error,r),Promise.reject(new xe(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 Ku(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(m.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(m.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(m.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(m.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 xe("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<X0);if(o===X0&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof wi&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(m.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(m.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(m.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 yi("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(m.Error,a),Promise.reject(new yi(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(m.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(u){return Promise.reject(u)}i=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(i,o),this.connectionId=c.connectionId;return}catch(u){if(this._logger.log(m.Error,`Failed to start the transport '${l.transport}': ${u}`),c=void 0,s.push(new rc(`${l.transport} failed: ${u}`,ie[l.transport])),this._connectionState!=="Connecting"){let p="Failed to select transport before stop() was called.";return this._logger.log(m.Debug,p),Promise.reject(new xe(p))}}}}return s.length>0?Promise.reject(new nc(`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 yc(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 gc(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case ie.LongPolling:return new wi(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(m.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(mw(r,i))if(t.transferFormats.map(a=>ue[a]).indexOf(n)>=0){if(i===ie.WebSockets&&!this._options.WebSocket||i===ie.ServerSentEvents&&!this._options.EventSource)return this._logger.log(m.Debug,`Skipping transport '${ie[i]}' because it is not supported in your environment.'`),new ec(`'${ie[i]}' is not supported in your environment.`,i);this._logger.log(m.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(m.Debug,`Skipping transport '${ie[i]}' because it does not support the requested transfer format '${ue[n]}'.`),new Error(`'${ie[i]}' does not support ${ue[n]}.`);else return this._logger.log(m.Debug,`Skipping transport '${ie[i]}' because it was disabled by the client.`),new tc(`'${ie[i]}' is disabled by the client.`,i)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(m.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(m.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(m.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(m.Error,`Connection disconnected with error '${t}'.`):this._logger.log(m.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(m.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(m.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(m.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 mw(e,t){return!e||(t&e)!==0}var Ku=class e{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new fo,this._transportResult=new fo,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new fo),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 fo;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}},fo=class{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}};var gw="json",wc=class{constructor(){this.name=gw,this.version=2,this.transferFormat=ue.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(m.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 yw={trace:m.Trace,debug:m.Debug,info:m.Information,information:m.Information,warn:m.Warning,warning:m.Warning,error:m.Error,critical:m.Critical,none:m.None};function bw(e){let t=yw[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}var vi=class{configureLogging(t){if($.isRequired(t,"logging"),ww(t))this.logger=t;else if(typeof t=="string"){let r=bw(t);this.logger=new an(r)}else this.logger=new an(t);return this}withUrl(t,r){return $.isRequired(t,"url"),$.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return $.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 bi(t):this.reconnectPolicy=t:this.reconnectPolicy=new bi,this}withServerTimeout(t){return $.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return $.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 bc(this.url,t);return pc.create(r,this.logger||Gt.instance,this.protocol||new wc,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function ww(e){return e.log!==void 0}var J2=Od(X2());var vo=class{},Y2=(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))(Y2||{}),Rc=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(){if(this.connection){let t=new vo;t.command="Position_Guide",console.log("Enviando comando 'Position_Guide' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,t)}}async reset(){if(this.connection){let t=new vo;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 vo;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 J2.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 vo;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 g=document.createElement("img");g.id="img-photo";let b=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;g.src=b,this.applyStyles(g,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),i.appendChild(g)}else{let g=document.createElement("div");g.innerHTML=`
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}},Or=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}},rc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}},nc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}},oc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},Ei=class extends Error{constructor(t){let r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},ic=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}};var go=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 m;(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"})(m||(m={}));var Gt=class{constructor(){}log(t,r){}};Gt.instance=new Gt;var q0="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 Br(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 ac(e,t,r,n,o,i){let s={},[a,c]=Kt();s[a]=c,e.log(m.Trace,`(${t} transport) sending data. ${Br(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(m.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}function G0(e){return e===void 0?new ln(m.Information):e===null?Gt.instance:e.log!==void 0?e:new ln(e)}var sc=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()}] ${m[t]}: ${r}`;switch(t){case m.Critical:case m.Error:this.out.error(n);break;case m.Warning:this.out.warn(n);break;case m.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(q0,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 cc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function K0(){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 lc=class extends qt{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||q.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:bn;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(K0());if(typeof AbortController>"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:bn;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(m.Warning,"Timeout from HTTP request."),n=new Or},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(m.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!i.ok){let c=await X0(i,"text");throw new ot(c||i.statusText,i.status)}let a=await X0(i,t.responseType);return new go(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 X0(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 hc=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 go(o.status,o.statusText,o.response||o.responseText)):n(new ot(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(m.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new ot(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(m.Warning,"Timeout from HTTP request."),n(new Or)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var dc=class extends qt{constructor(t){if(super(),typeof fetch<"u"||q.isNode)this._httpClient=new lc(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new hc(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 uc=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 pc=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 sc(this,t)}};var fc=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 Xd(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))}},Xd=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 mc=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(m.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 uc,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(m.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(m.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=re.Disconnected,this._logger.log(m.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(m.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(m.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 fc(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(m.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(m.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(m.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(m.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(m.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 pc;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(m.Error,`Invoke client method threw error: ${cc(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(m.Error,`Stream callback threw error: ${cc(i)}`)}}break}case D.Ping:break;case D.Close:{this._logger.log(m.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(m.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(m.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(m.Error,o);let i=new Error(o);throw this._handshakeRejecter(i),i}else this._logger.log(m.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(m.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(m.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(m.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(m.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(m.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(m.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(m.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(m.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(m.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(m.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(m.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(m.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==re.Reconnecting){this._logger.log(m.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(m.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(m.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=re.Connected,this._logger.log(m.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(m.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(m.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==re.Reconnecting){this._logger.log(m.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(m.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(m.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(m.Error,`Stream 'error' callback called with '${t}' threw error: ${cc(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],Ci=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 gc=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 yc=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 xi=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new yc,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(m.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(m.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(m.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(m.Trace,`(LongPolling transport) polling: ${n}.`);let o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(m.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(m.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new ot(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(m.Trace,`(LongPolling transport) data received. ${Br(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(m.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Or?this._logger.log(m.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(m.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(m.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?ac(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(m.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(m.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(m.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(m.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(m.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(m.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(m.Trace,t),this.onclose(this._closeError)}}};var bc=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(m.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(m.Trace,`(SSE transport) data received. ${Br(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(m.Information,`SSE connected to ${this._url}`),this._eventSource=s,i=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?ac(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 vc=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(m.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(m.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(m.Information,`(WebSockets transport) ${h}.`)},s.onmessage=l=>{if(this._logger.log(m.Trace,`(WebSockets transport) data received. ${Br(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(m.Trace,`(WebSockets transport) sending data. ${Br(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(m.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 J0=100,wc=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,W.isRequired(t,"url"),this._logger=G0(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 bn<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:bn;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 gc(r.httpClient||new dc(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(m.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(m.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(m.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 Jd(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(m.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(m.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(m.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(m.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<J0);if(o===J0&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof xi&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(m.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(m.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(m.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 Ei("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(m.Error,a),Promise.reject(new Ei(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(m.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(m.Error,`Failed to start the transport '${l.transport}': ${d}`),c=void 0,s.push(new oc(`${l.transport} failed: ${d}`,ie[l.transport])),this._connectionState!=="Connecting"){let p="Failed to select transport before stop() was called.";return this._logger.log(m.Debug,p),Promise.reject(new Ae(p))}}}}return s.length>0?Promise.reject(new ic(`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 vc(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 bc(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case ie.LongPolling:return new xi(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(m.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(m.Debug,`Skipping transport '${ie[i]}' because it is not supported in your environment.'`),new rc(`'${ie[i]}' is not supported in your environment.`,i);this._logger.log(m.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(m.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(m.Debug,`Skipping transport '${ie[i]}' because it was disabled by the client.`),new nc(`'${ie[i]}' is disabled by the client.`,i)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(m.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(m.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(m.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(m.Error,`Connection disconnected with error '${t}'.`):this._logger.log(m.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(m.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(m.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(m.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 Jd=class e{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new yo,this._transportResult=new yo,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new yo),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 yo;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}},yo=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",_c=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(m.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:m.Trace,debug:m.Debug,info:m.Information,information:m.Information,warn:m.Warning,warning:m.Warning,error:m.Error,critical:m.Critical,none:m.None};function vv(e){let t=bv[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}var Ai=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 Ci(t):this.reconnectPolicy=t:this.reconnectPolicy=new Ci,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 wc(this.url,t);return mc.create(r,this.logger||Gt.instance,this.protocol||new _c,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function wv(e){return e.log!==void 0}var Y2=Bu(J2());var ko=class{},Q2=(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))(Q2||{}),Oc=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(){if(this.connection){let t=new ko;t.command="Position_Guide",console.log("Enviando comando 'Position_Guide' para o aplicativo..."),this.connection.invoke("SendAction",this.externalSessionId,t)}}async reset(){if(this.connection){let t=new ko;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 ko;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 Y2.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 ko;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 g=document.createElement("img");g.id="img-photo";let y=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;g.src=y,this.applyStyles(g,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),i.appendChild(g)}else{let g=document.createElement("div");g.innerHTML=`
305
490
  <svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
306
491
  <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"/>
307
492
  <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"/>
308
493
  </svg>
309
- `,i.appendChild(g)}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(g=>{let b=document.createElement("div");this.applyStyles(b,{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#555"});let w=document.createElement("span");w.innerHTML=`
494
+ `,i.appendChild(g)}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(g=>{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=`
310
495
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
311
496
  <circle cx="10" cy="10" r="9" stroke="#16A34A" stroke-width="2" fill="none"/>
312
497
  <path d="M6 10L9 13L14 7" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
313
498
  </svg>
314
- `,this.applyStyles(w,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let _=document.createElement("span");_.innerText=g,b.appendChild(w),b.appendChild(_),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 g=document.getElementById("photo-message");g&&(g.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 u=document.createElement("div");this.applyStyles(u,{marginTop:"10px",fontSize:"13px",color:"#666"});let p=document.createElement("span");p.innerText="Dica: ",p.style.fontWeight="bold";let y=document.createElement("span");y.innerText="mantenha o celular est\xE1vel durante todo o processo.",u.appendChild(p),u.appendChild(y),t.appendChild(u);let f=document.getElementById("external-camera-continue");f.disabled=!0,this.applyStyles(f,{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 vi().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:ie.WebSockets,withCredentials:!1}).withAutomaticReconnect().configureLogging(m.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=Y2[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 Dc=class{constructor(t){this.context=t;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 mi("EasyProctorDb","exams2"),this.repositoryDevices=new mi("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new Za(this.context.credentials.cpf,this.backend)),this.appChecker=new Rc(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=()=>{N.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),t()}}setOnLostFocusCallback(t){this.onLostFocusCallback=()=>t()}setOnFocusCallback(t){this.onFocusCallback=()=>t()}async onChangeDevices(t={}){new pa(this.repositoryDevices,this.proctoringId).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}async onRealtimeAlerts(t={}){this.onRealtimeAlertsCallback=r=>t.data&&t.data(r)}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}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 Qa({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,o=new ma({onFocusCallback:()=>this.onFocusCallback(),onLostFocusCallback:()=>this.onLostFocusCallback()},t),i=new Ya(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 fa(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:o,noiseRecorder:i}}async login(){if(!this.context.credentials?.cpf)throw Og;this.context.token=await this.auth.login()}async start(t=mt,r={}){try{if(this.context.token===void 0)throw Dg;this.extension=new da,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=oa(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 Bg}if(this.state!="Stop")throw Tg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Xr,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.proctoringType,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=i.id;try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw Mg}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 N.registerStart(this.proctoringId,!0,`Version: ${gi()}
499
+ `,this.applyStyles(v,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let _=document.createElement("span");_.innerText=g,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 g=document.getElementById("photo-message");g&&(g.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 p=document.createElement("span");p.innerText="Dica: ",p.style.fontWeight="bold";let b=document.createElement("span");b.innerText="mantenha o celular est\xE1vel durante todo o processo.",d.appendChild(p),d.appendChild(b),t.appendChild(d);let f=document.getElementById("external-camera-continue");f.disabled=!0,this.applyStyles(f,{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 Ai().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:ie.WebSockets,withCredentials:!1}).withAutomaticReconnect().configureLogging(m.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=Q2[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 Bc=class{constructor(t){this.context=t;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 Si("EasyProctorDb","exams2"),this.repositoryDevices=new Si("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new tc(this.context.credentials.cpf,this.backend)),this.appChecker=new Oc(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=()=>{N.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),t()}}setOnLostFocusCallback(t){this.onLostFocusCallback=()=>t()}setOnFocusCallback(t){this.onFocusCallback=()=>t()}async onChangeDevices(t={}){new ma(this.repositoryDevices,this.proctoringId).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}async onRealtimeAlerts(t={}){this.onRealtimeAlertsCallback=r=>t.data&&t.data(r)}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}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 ec({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,o=new ya({onFocusCallback:()=>this.onFocusCallback(),onLostFocusCallback:()=>this.onLostFocusCallback()},t),i=new Za(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 ga(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:o,noiseRecorder:i}}async login(){if(!this.context.credentials?.cpf)throw Mg;this.context.token=await this.auth.login()}async start(t=mt,r={}){try{if(this.context.token===void 0)throw Bg;this.extension=new fa,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=sa(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 Lg}if(this.state!="Stop")throw Pg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Jr,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.proctoringType,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=i.id;try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw Ug}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 N.registerStart(this.proctoringId,!0,`Version: ${ki()}
315
500
  Navigator: ${JSON.stringify(s)}`),i.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(i.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording",i}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&N.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
316
- Version: ${gi()}
501
+ Version: ${ki()}
317
502
  Navigator: ${navigator}
318
- 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 ca;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;gi()!=="1.0.0.0"?(r=new eo(this.proctoringSession,this.proctoringId,[new Zn(this.proctoringId)]),n="Download",this.serviceType="Download"):(r=new eo(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new Zn(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=>{N.registerUpload(this.proctoringSession.id,!1,`upload error: ${i}
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 ha;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;ki()!=="1.0.0.0"?(r=new no(this.proctoringSession,this.proctoringId,[new ro(this.proctoringId)]),n="Download",this.serviceType="Download"):(r=new no(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new ro(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=>{N.registerUpload(this.proctoringSession.id,!1,`upload error: ${i}
319
504
 
320
- Upload Services: ${n}`,this.serviceType),gi()!=="1.0.0.0"&&(r=new eo(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new Zn(this.proctoringId)]),n="Upload",this.serviceType="Upload",n="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{N.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
505
+ Upload Services: ${n}`,this.serviceType),ki()!=="1.0.0.0"&&(r=new no(this.proctoringSession,this.proctoringId,[new ir(this.proctoringId,this.backend),new ro(this.proctoringId)]),n="Upload",this.serviceType="Upload",n="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{N.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
321
506
 
322
507
  Upload Services: ${n}
323
508
  Upload backup for Safe Browser`,this.serviceType)}))}),N.registerUpload(this.proctoringSession.id,!0,`upload success
324
509
 
325
- Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(i=>{N.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+i)}),await this.backend.finishAndSendUrls(this.context,this.proctoringSession).then(()=>{N.registerFinish(this.proctoringSession.id,!0,"")}).catch(i=>{N.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(),N.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
326
- Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Wi())throw N.registerError(this.proctoringId,"Multiplas telas detectadas!"),aa}async verifyBrowser(){let t=await z0();if(t!=="chrome"&&t!=="firefox")throw N.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
327
- Tentativa utilizando o browser ${t}`),Rg}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 $0().then(n=>n).catch(n=>{throw n.message})),Cg(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new Yn(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)}))}catch(r){throw this.proctoringId&&N.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{N.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 N.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),ca;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw ca;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 Oc=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 u={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,u),i.appendChild(l);let p=document.createElement("div"),y=document.createElement("input");y.setAttribute("type","checkbox"),y.setAttribute("id","termsCheckbox");let f=document.createElement("label");f.setAttribute("for","termsCheckbox"),f.innerText="Li e aceito os termos e condi\xE7\xF5es";let g={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(p,g),p.appendChild(y),p.appendChild(f),i.appendChild(p);let b=document.createElement("div"),w={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(b,w);let _=document.createElement("button");_.innerText="Cancelar";let A={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(_,A),_.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 de={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,de),R.disabled=!0,R.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),y.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")}),b.appendChild(_),b.appendChild(B),b.appendChild(R),i.appendChild(b),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 bd(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 Dc(r),o=new ua(r),i=new Oc(r),s=new Qn,a=n.login.bind(n),c=n.start.bind(n),l=n.finish.bind(n),h=n.pause.bind(n),u=n.resume.bind(n),p=n.setOnFocusCallback.bind(n),y=n.setOnLostFocusCallback.bind(n),f=n.onChangeDevices.bind(n),g=n.setOnBufferSizeErrorCallback.bind(n),b=n.setOnStopSharingScreenCallback.bind(n),w=n.onRealtimeAlerts.bind(n),_=i.signInTerms.bind(i),A=o.checkDevices.bind(o),B=n.appChecker.checkExternalCamera.bind(n.appChecker),O=n.appChecker.startSession.bind(n.appChecker),R=n.appChecker.takePicture.bind(n.appChecker),de=n.appChecker.goToPositionGuide.bind(n.appChecker),se=n.appChecker.startTransmission.bind(n.appChecker),Nr=o.runCheckDevicesFlow.bind(o),Ii=o.changeSelectedDevice.bind(o),jr=s.takePicture.bind(s);return{login:a,start:c,finish:l,onFocus:p,onLostFocus:y,onChangeDevices:f,onBufferSizeError:g,onRealtimeAlerts:w,checkDevices:A,runCheckDevicesFlow:Nr,changeSelectedDevice:Ii,capturePhoto:jr,enumarateDevices:St,checkPermissions:$i,checkIfhasMultipleMonitors:Wi,onStopSharingScreen:b,signInTerms:_,checkExternalCamera:B,startExternalCameraSession:O,takeExternalCameraPicture:R,goToExternalCameraPositionStep:de,startExternalCameraTransmission:se}}typeof window<"u"&&(window.useProctoring=bd);})();
510
+ Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(i=>{N.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+i)}),await this.backend.finishAndSendUrls(this.context,this.proctoringSession).then(()=>{N.registerFinish(this.proctoringSession.id,!0,"")}).catch(i=>{N.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(),N.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
511
+ Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Gi())throw N.registerError(this.proctoringId,"Multiplas telas detectadas!"),la}async verifyBrowser(){let t=await xg();if(t!=="chrome"&&t!=="firefox"&&!Yr())throw N.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
512
+ Tentativa utilizando o browser ${t}`),Og}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 $0().then(n=>n).catch(n=>{throw n.message})),Ag(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new eo(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)}))}catch(r){throw this.proctoringId&&N.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{N.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 N.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),ha;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw ha;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 Mc=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 p=document.createElement("div"),b=document.createElement("input");b.setAttribute("type","checkbox"),b.setAttribute("id","termsCheckbox");let f=document.createElement("label");f.setAttribute("for","termsCheckbox"),f.innerText="Li e aceito os termos e condi\xE7\xF5es";let g={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(p,g),p.appendChild(b),p.appendChild(f),i.appendChild(p);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 wu(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 Bc(r),o=new pa(r),i=new Mc(r),s=new to,a=n.login.bind(n),c=n.start.bind(n),l=n.finish.bind(n),h=n.pause.bind(n),d=n.resume.bind(n),p=n.setOnFocusCallback.bind(n),b=n.setOnLostFocusCallback.bind(n),f=n.onChangeDevices.bind(n),g=n.setOnBufferSizeErrorCallback.bind(n),y=n.setOnStopSharingScreenCallback.bind(n),v=n.onRealtimeAlerts.bind(n),_=i.signInTerms.bind(i),x=o.checkDevices.bind(o),B=n.appChecker.checkExternalCamera.bind(n.appChecker),O=n.appChecker.startSession.bind(n.appChecker),R=n.appChecker.takePicture.bind(n.appChecker),ue=n.appChecker.goToPositionGuide.bind(n.appChecker),se=n.appChecker.startTransmission.bind(n.appChecker),Nr=o.runCheckDevicesFlow.bind(o),Li=o.changeSelectedDevice.bind(o),jr=s.takePicture.bind(s);return{login:a,start:c,finish:l,onFocus:p,onLostFocus:b,onChangeDevices:f,onBufferSizeError:g,onRealtimeAlerts:v,checkDevices:x,runCheckDevicesFlow:Nr,changeSelectedDevice:Li,capturePhoto:jr,enumarateDevices:St,checkPermissions:qi,checkIfhasMultipleMonitors:Gi,onStopSharingScreen:y,signInTerms:_,checkExternalCamera:B,startExternalCameraSession:O,takeExternalCameraPicture:R,goToExternalCameraPositionStep:ue,startExternalCameraTransmission:se}}typeof window<"u"&&(window.useProctoring=wu);})();