interview-widget 2.0.2 → 2.0.3

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.
@@ -20,7 +20,7 @@
20
20
  void main(void) {
21
21
  gl_Position = vec4(aVertex, 0.0, 1.0);
22
22
  vTex = aTex;
23
- }`,e.VERTEX_SHADER),this.Y=Oc(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.P=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.Z),e.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function _t(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 Is(e){var t=_t(e,1);if(!t){if(t=_t(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=Sr(e);var r=Ms(e);if($i(r,i,Uc(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),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,r);for(let n=0,s=0;n<t.length;++n,s+=4)t[n]=r[s]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function Uc(e){let t=_t(e,2);if(!t){const r=Sr(e);t=Vc(e);const i=Is(e),n=Gc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Ls(e)}return t}function Sr(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=vt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Gc(e){if(e=Sr(e),!Wi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Wi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Wi=e.R16F}return Wi}function Ms(e){return e.l||(e.l=new Cs),e.l}function Vc(e){const t=Sr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=_t(e,2);return r||(r=Vi(Ms(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ls(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Wi,he=class{constructor(e,t,r,i,n,s,a){this.g=e,this.m=t,this.j=r,this.canvas=i,this.l=n,this.width=s,this.height=a,this.j&&--$c===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!_t(this,0)}ja(){return!!_t(this,1)}R(){return!!_t(this,2)}ia(){return(t=_t(e=this,0))||(t=Is(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return Is(this)}N(){return Uc(this)}clone(){const e=[];for(const 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}`);{const i=Sr(this),n=Ms(this);i.activeTexture(i.TEXTURE1),r=Vi(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Gc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),$i(n,i,r),js(n,i,!1,()=>{Vc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ls(this)}),Ns(n),Ls(this)}}e.push(r)}return new he(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Sr(this).deleteTexture(_t(this,2)),$c=-1}};he.prototype.close=he.prototype.close,he.prototype.clone=he.prototype.clone,he.prototype.getAsWebGLTexture=he.prototype.N,he.prototype.getAsFloat32Array=he.prototype.ha,he.prototype.getAsUint8Array=he.prototype.ia,he.prototype.hasWebGLTexture=he.prototype.R,he.prototype.hasFloat32Array=he.prototype.ja,he.prototype.hasUint8Array=he.prototype.Da;var $c=250;function at(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 Wc(e){var t=at(e,0);if(!t){t=Ar(e);const r=Hi(e),i=new Uint8Array(e.width*e.height*4);$i(r,t,zi(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),Ns(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function zi(e){let t=at(e,2);if(!t){const r=Ar(e);t=qi(e);const i=at(e,1)||Wc(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),Xr(e)}return t}function Ar(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=vt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Hi(e){return e.l||(e.l=new Cs),e.l}function qi(e){const t=Ar(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=at(e,2);return r||(r=Vi(Hi(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Xr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zc(e){const t=Ar(e);return js(Hi(e),t,!0,()=>function(r,i){const n=r.canvas;if(n.width===r.width&&n.height===r.height)return i();const s=n.width,a=n.height;return n.width=r.width,n.height=r.height,r=i(),n.width=s,n.height=a,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()}))}var fe=class{constructor(e,t,r,i,n,s,a){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=n,this.width=s,this.height=a,(this.j||this.m)&&--Hc===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!at(this,0)}ka(){return!!at(this,1)}R(){return!!at(this,2)}Aa(){return Wc(this)}za(){var e=at(this,1);return e||(zi(this),qi(this),e=zc(this),Xr(this),this.g.push(e),this.j=!0),e}N(){return zi(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const i=Ar(this),n=Hi(this);i.activeTexture(i.TEXTURE1),r=Vi(n,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),$i(n,i,r),js(n,i,!1,()=>{qi(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Xr(this)}),Ns(n),Xr(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);zi(this),qi(this),r=zc(this),Xr(this)}e.push(r)}return new fe(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&at(this,1).close(),this.m&&Ar(this).deleteTexture(at(this,2)),Hc=-1}};fe.prototype.close=fe.prototype.close,fe.prototype.clone=fe.prototype.clone,fe.prototype.getAsWebGLTexture=fe.prototype.N,fe.prototype.getAsImageBitmap=fe.prototype.za,fe.prototype.getAsImageData=fe.prototype.Aa,fe.prototype.hasWebGLTexture=fe.prototype.R,fe.prototype.hasImageBitmap=fe.prototype.ka,fe.prototype.hasImageData=fe.prototype.Ca;var Hc=250;function tt(...e){return e.map(([t,r])=>({start:t,end:r}))}const Ld=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}((qc=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:Mc()?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){const 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){const r=e.length,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),E(this,i||"input_audio",s=>{E(this,n=n||"audio_header",a=>{this.i._configureAudio(s,a,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){ot(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,i,n){const s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),E(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){E(this,t,i=>{const[n,s]=Pc(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){E(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){E(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){E(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){E(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){E(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){E(this,t,i=>{E(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){E(this,t,i=>{Dc(this,Object.keys(e),n=>{Dc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){E(this,r,n=>{E(this,t,s=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputStream(a,e.length,s,n,i),this.i._free(a)})})}addEmptyPacketToStream(e,t){E(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputStream(n,i,r)})}addDoubleVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputStream(n,i,r)})}addFloatVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputStream(n,i,r)})}addIntVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputStream(n,i,r)})}addUintVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputStream(n,i,r)})}addStringVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)E(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,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,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){E(this,r,i=>{E(this,t,n=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,n,i),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(i,n);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(i,n);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(i,n);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(i,n);this.i._addIntVectorToInputSidePacket(i,r)})}addUintVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(i,n);this.i._addUintVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(const n of e)E(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){ot(this,e,t),E(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Pt(this,e,t),E(this,e,i=>{this.i._attachProtoVectorListener(i,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?'),ot(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),E(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends qc{get ea(){return this.i}oa(e,t,r){E(this,t,i=>{const[n,s]=Pc(this,e,i);this.ea._addBoundTextureAsImageToStream(i,n,s,r)})}V(e,t){ot(this,e,t),E(this,e,r=>{this.ea._attachImageListener(r)})}ba(e,t){Pt(this,e,t),E(this,e,r=>{this.ea._attachImageVectorListener(r)})}}));var qc,Ve=class extends Ld{};async function I(e,t,r){return async function(i,n,s,a){return Id(i,n,s,a)}(e,r.canvas??(Mc()?void 0:document.createElement("canvas")),t,r)}function Yc(e,t,r,i){if(e.U){const s=new ec;if(r!=null&&r.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");v(s,1,(n.left+n.right)/2),v(s,2,(n.top+n.bottom)/2),v(s,4,n.right-n.left),v(s,3,n.bottom-n.top)}else v(s,1,.5),v(s,2,.5),v(s,4,1),v(s,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(v(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Fc(t);r=ie(s,3)*c/a,n=ie(s,4)*a/c,v(s,4,r),v(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.oa(t,e.Z,i??performance.now()),e.finishProcessing()}function $e(e,t,r){var i;if((i=e.baseOptions)!=null&&i.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Yc(e,t,r,e.B+1)}function ct(e,t,r,i){var n;if(!((n=e.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Yc(e,t,r,i)}function Tr(e,t,r,i){var n=t.data;const s=t.width,a=s*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==a)throw Error("Unsupported channel count: "+n.length/a);return e=new he([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Se=class extends As{constructor(e,t,r,i){super(e),this.g=e,this.Z=t,this.U=r,this.na=i,this.P=new Cs}l(e,t=!0){if("runningMode"in e&&$r(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.P.close(),super.close()}};Se.prototype.close=Se.prototype.close;var We=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},S(e=this.h=new Ri,0,1,t=new q),v(this.h,2,.5),v(this.h,3,.3)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&v(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&v(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},$e(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect_in"),D(e,"detections");const t=new Ie;Je(t,pd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect_in"),L(r,"DETECTIONS:detections"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(jc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.detectForVideo=We.prototype.F,We.prototype.detect=We.prototype.D,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=async function(e,t){return I(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return I(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return I(We,e,t)};var Fs=tt([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]),Ps=tt([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]),Ds=tt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Kc=tt([474,475],[475,476],[476,477],[477,474]),Rs=tt([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]),Os=tt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Xc=tt([469,470],[470,471],[471,472],[472,469]),Bs=tt([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]),Qc=[...Fs,...Ps,...Ds,...Rs,...Os,...Bs],Jc=tt([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 Zc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,S(e=this.h=new cc,0,1,t=new q),this.v=new ac,S(this.h,0,3,this.v),this.s=new Ri,S(this.h,0,2,this.s),st(this.s,4,1),v(this.s,2,.5),v(this.v,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numFaces"in e&&st(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&v(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&v(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 Zc(this),$e(this,e,t),this.j}F(e,t,r){return Zc(this),ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"face_landmarks");const t=new Ie;Je(t,yd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=qr(s),this.j.faceLandmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(D(e,"blendshapes"),L(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Fi(s),this.j.faceBlendshapes.push(Es(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(D(e,"face_geometry"),L(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=P(xd(s),ld,2))&&this.j.facialTransformationMatrixes.push({rows:Ue(i,1)??0??0,columns:Ue(i,2)??0??0,data:qt(i,3,jt,Ht()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.F,X.prototype.detect=X.prototype.D,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return I(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return I(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return I(X,e,t)},X.FACE_LANDMARKS_LIPS=Fs,X.FACE_LANDMARKS_LEFT_EYE=Ps,X.FACE_LANDMARKS_LEFT_EYEBROW=Ds,X.FACE_LANDMARKS_LEFT_IRIS=Kc,X.FACE_LANDMARKS_RIGHT_EYE=Rs,X.FACE_LANDMARKS_RIGHT_EYEBROW=Os,X.FACE_LANDMARKS_RIGHT_IRIS=Xc,X.FACE_LANDMARKS_FACE_OVAL=Bs,X.FACE_LANDMARKS_CONTOURS=Qc,X.FACE_LANDMARKS_TESSELATION=Jc;var lt=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!0),S(e=this.j=new uc,0,1,t=new q)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,r){const i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,$e(this,e,i??{}),!this.h)return this.s}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"stylized_image");const t=new Ie;Je(t,bd,this.j);const r=new ye;Me(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Le(e,r),this.g.V("stylized_image",(i,n)=>{var s=!this.h,a=i.data,c=i.width;const l=c*(i=i.height);if(a instanceof Uint8Array)if(a.length===3*l){const u=new Uint8ClampedArray(4*l);for(let h=0;h<l;++h)u[4*h]=a[3*h],u[4*h+1]=a[3*h+1],u[4*h+2]=a[3*h+2],u[4*h+3]=255;a=new ImageData(u,c,i)}else{if(a.length!==4*l)throw Error("Unsupported channel count: "+a.length/l);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),c,i)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);c=new fe([a],!1,!1,this.g.i.canvas,this.P,c,i),this.s=s=s?c.clone():c,this.h&&this.h(s),x(this,n)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.s=null,this.h&&this.h(null),x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};lt.prototype.stylize=lt.prototype.Ka,lt.prototype.setOptions=lt.prototype.o,lt.createFromModelPath=function(e,t){return I(lt,e,{baseOptions:{modelAssetPath:t}})},lt.createFromModelBuffer=function(e,t){return I(lt,e,{baseOptions:{modelAssetBuffer:t}})},lt.createFromOptions=function(e,t){return I(lt,e,t)};var Us=tt([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 el(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function tl(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 rl(e,t=!0){const r=[];for(const n of e){var i=Fi(n);e=[];for(const s of i.g())i=t&&Ue(s,1)!=null?Ue(s,1)??0:-1,e.push({score:ie(s,2)??0,index:i,categoryName:Ge(s,3)??""??"",displayName:Ge(s,4)??""??""});r.push(e)}return r}var Fe=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.j=new fc,0,1,t=new q),this.s=new xs,S(this.j,0,2,this.s),this.C=new ps,S(this.s,0,3,this.C),this.v=new hc,S(this.s,0,2,this.v),this.h=new vd,S(this.j,0,3,this.h),v(this.v,2,.5),v(this.s,4,.5),v(this.C,2,.5)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var n,s,a,c;if(st(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&v(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&v(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new kr,r=t,i=ks(e.cannedGesturesClassifierOptions,(n=P(this.h,kr,3))==null?void 0:n.h());S(r,0,2,i),S(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=P(this.h,kr,3))==null||s.g());return e.customGesturesClassifierOptions?(S(r=t=new kr,0,2,i=ks(e.customGesturesClassifierOptions,(a=P(this.h,kr,4))==null?void 0:a.h())),S(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=P(this.h,kr,4))==null||c.g()),this.l(e)}Fa(e,t){return el(this),$e(this,e,t),tl(this)}Ga(e,t,r){return el(this),ct(this,e,r,t),tl(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"hand_gestures"),D(e,"hand_landmarks"),D(e,"world_hand_landmarks"),D(e,"handedness");const t=new Ie;Je(t,_d,this.j);const r=new ye;Me(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),W(r,"IMAGE:image_in"),W(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),Le(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=qr(s);const a=[];for(const c of pt(i,Za,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(c,4)??0});this.landmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=_r(s);const a=[];for(const c of pt(i,Ja,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(c,4)??0});this.worldLandmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...rl(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...rl(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function il(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Fe.prototype.recognizeForVideo=Fe.prototype.Ga,Fe.prototype.recognize=Fe.prototype.Fa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return I(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return I(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return I(Fe,e,t)},Fe.HAND_CONNECTIONS=Us;var Pe=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.h=new xs,0,1,t=new q),this.s=new ps,S(this.h,0,3,this.s),this.j=new hc,S(this.h,0,2,this.j),st(this.j,3,1),v(this.j,2,.5),v(this.s,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numHands"in e&&st(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&v(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&v(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],$e(this,e,t),il(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ct(this,e,r,t),il(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"hand_landmarks"),D(e,"world_hand_landmarks"),D(e,"handedness");const t=new Ie;Je(t,kd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"LANDMARKS:hand_landmarks"),L(r,"WORLD_LANDMARKS:world_hand_landmarks"),L(r,"HANDEDNESS:handedness"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=qr(s),this.landmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=_r(s),this.worldLandmarks.push(Yr(i));x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Fi(l);const u=[];for(const h of i.g())u.push({score:ie(h,2)??0,index:Ue(h,1)??0??-1,categoryName:Ge(h,3)??""??"",displayName:Ge(h,4)??""??""});c.push(u)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pe.prototype.detectForVideo=Pe.prototype.F,Pe.prototype.detect=Pe.prototype.D,Pe.prototype.setOptions=Pe.prototype.o,Pe.createFromModelPath=function(e,t){return I(Pe,e,{baseOptions:{modelAssetPath:t}})},Pe.createFromModelBuffer=function(e,t){return I(Pe,e,{baseOptions:{modelAssetBuffer:t}})},Pe.createFromOptions=function(e,t){return I(Pe,e,t)},Pe.HAND_CONNECTIONS=Us;var nl=tt([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 sl(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ol(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Gi(e)}}function Yi(e,t){e=qr(e),t.push(Oi(e))}var Y=class extends Se{constructor(e,t){super(new Ve(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,S(e=this.j=new yc,0,1,t=new q),this.K=new ps,S(this.j,0,2,this.K),this.Y=new Ed,S(this.j,0,3,this.Y),this.s=new Ri,S(this.j,0,4,this.s),this.H=new ac,S(this.j,0,5,this.H),this.v=new pc,S(this.j,0,6,this.v),this.L=new xc,S(this.j,0,7,this.L),v(this.s,2,.5),v(this.s,3,.3),v(this.H,2,.5),v(this.v,2,.5),v(this.v,3,.3),v(this.L,2,.5),v(this.K,2,.5)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&v(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&v(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&v(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&v(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&v(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&v(this.L,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&v(this.K,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,sl(this),$e(this,e,i),ol(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:i,sl(this),ct(this,e,n,t),ol(this)}m(){var e=new Ee;z(e,"input_frames_image"),D(e,"pose_landmarks"),D(e,"pose_world_landmarks"),D(e,"face_landmarks"),D(e,"left_hand_landmarks"),D(e,"left_hand_world_landmarks"),D(e,"right_hand_landmarks"),D(e,"right_hand_world_landmarks");const t=new Ie,r=new Pa;Bn(r,1,ur("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,s){if(s!=null)if(Array.isArray(s))$(n,2,mi(s,Pn,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof wt||$t(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Bn(n,2,_n(s,!1),Wt())}}(r,this.j.g());const i=new ye;Me(i,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),bi(i,8,Pa,r),W(i,"IMAGE:input_frames_image"),L(i,"POSE_LANDMARKS:pose_landmarks"),L(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),L(i,"FACE_LANDMARKS:face_landmarks"),L(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),L(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),L(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),L(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Le(e,i),Ui(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{Yi(n,this.h.poseLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(L(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Er(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Tr(this,n,!0,!this.C)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{Yi(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(D(e,"extra_blendshapes"),L(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Fi(n),a.push(Es(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{Yi(n,this.h.leftHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{Yi(n,this.h.rightHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Y.prototype.detectForVideo=Y.prototype.F,Y.prototype.detect=Y.prototype.D,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(e,t){return I(Y,e,{baseOptions:{modelAssetPath:t}})},Y.createFromModelBuffer=function(e,t){return I(Y,e,{baseOptions:{modelAssetBuffer:t}})},Y.createFromOptions=function(e,t){return I(Y,e,t)},Y.HAND_CONNECTIONS=Us,Y.POSE_CONNECTIONS=nl,Y.FACE_LANDMARKS_LIPS=Fs,Y.FACE_LANDMARKS_LEFT_EYE=Ps,Y.FACE_LANDMARKS_LEFT_EYEBROW=Ds,Y.FACE_LANDMARKS_LEFT_IRIS=Kc,Y.FACE_LANDMARKS_RIGHT_EYE=Rs,Y.FACE_LANDMARKS_RIGHT_EYEBROW=Os,Y.FACE_LANDMARKS_RIGHT_IRIS=Xc,Y.FACE_LANDMARKS_FACE_OVAL=Bs,Y.FACE_LANDMARKS_CONTOURS=Qc,Y.FACE_LANDMARKS_TESSELATION=Jc;var ze=class extends Se{constructor(e,t){super(new Ve(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},S(e=this.h=new bc,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return S(this.h,0,2,ks(e,P(this.h,ws,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},$e(this,e,t),this.j}ra(e,t,r){return this.j={classifications:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"input_image"),z(e,"norm_rect"),D(e,"classifications");const t=new Ie;Je(t,Sd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),W(r,"IMAGE:input_image"),W(r,"NORM_RECT:norm_rect"),L(r,"CLASSIFICATIONS:classifications"),r.o(t),Le(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=function(s){const a={classifications:pt(s,dd,1).map(c=>{var l;return Es(((l=P(c,Ka,4))==null?void 0:l.g())??[],Ue(c,2)??0,Ge(c,3)??"")})};return Cn(hr(s,2))!=null&&(a.timestampMs=Cn(hr(s,2))??0),a}(hd(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.prototype.classifyForVideo=ze.prototype.ra,ze.prototype.classify=ze.prototype.qa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return I(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return I(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return I(ze,e,t)};var De=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!0),this.h=new vc,this.embeddings={embeddings:[]},S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t=this.h,r=P(this.h,nc,2);return r=r?r.clone():new nc,e.l2Normalize!==void 0?$r(r,1,e.l2Normalize):"l2Normalize"in e&&$(r,1),e.quantize!==void 0?$r(r,2,e.quantize):"quantize"in e&&$(r,2),S(t,0,2,r),this.l(e)}xa(e,t){return $e(this,e,t),this.embeddings}ya(e,t,r){return ct(this,e,r,t),this.embeddings}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"embeddings_out");const t=new Ie;Je(t,Ad,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"EMBEDDINGS:embeddings_out"),r.o(t),Le(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=md(i),this.embeddings=function(s){return{embeddings:pt(s,wd,1).map(a=>{var l,u;const c={headIndex:Ue(a,3)??0??-1,headName:Ge(a,4)??""??""};if(ra(a,tc,Un(a,1))!==void 0)a=qt(a=P(a,tc,Un(a,1)),1,jt,Ht()),c.floatEmbedding=a.slice();else{const h=new Uint8Array(0);c.quantizedEmbedding=((u=(l=P(a,fd,Un(a,2)))==null?void 0:l.ma())==null?void 0:u.h())??h}return c}),timestampMs:Cn(hr(s,2))??0}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};De.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Cc(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Cc(Nc(e.quantizedEmbedding),Nc(t.quantizedEmbedding))}return e},De.prototype.embedForVideo=De.prototype.ya,De.prototype.embed=De.prototype.xa,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=function(e,t){return I(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return I(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return I(De,e,t)};var Gs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function al(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function cl(e){try{const t=new Gs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Gi(e)}}Gs.prototype.close=Gs.prototype.close;var Ae=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.v=new _c,S(this.h,0,3,this.v),S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}J(){(function(e){var r,i;const t=pt(e.ca(),ye,1).filter(n=>(Ge(n,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&&(((i=(r=P(t[0],Ie,7))==null?void 0:r.l())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.s[Number(s)]=Ge(n,1)??""})})(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,al(this),$e(this,e,i),cl(this)}Ia(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,al(this),ct(this,e,n,t),cl(this)}Ba(){return this.s}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect");const t=new Ie;Je(t,Sc,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),r.o(t),Le(e,r),Ui(this,e),this.outputConfidenceMasks&&(D(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Tr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(D(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Tr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),D(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ae.prototype.getLabels=Ae.prototype.Ba,Ae.prototype.segmentForVideo=Ae.prototype.Ia,Ae.prototype.segment=Ae.prototype.segment,Ae.prototype.setOptions=Ae.prototype.o,Ae.createFromModelPath=function(e,t){return I(Ae,e,{baseOptions:{modelAssetPath:t}})},Ae.createFromModelBuffer=function(e,t){return I(Ae,e,{baseOptions:{modelAssetBuffer:t}})},Ae.createFromOptions=function(e,t){return I(Ae,e,t)};var Vs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Vs.prototype.close=Vs.prototype.close;var Fd=class extends y{constructor(e){super(e)}},jr=[0,ee,-2],Ki=[0,bt,-3,H,bt,-1],ll=[0,Ki],ul=[0,Ki,ee,-1],$s=class extends y{constructor(e){super(e)}},dl=[0,bt,-1,H],Pd=class extends y{constructor(e){super(e)}},hl=class extends y{constructor(e){super(e)}},Ws=[1,2,3,4,5,6,7,8,9,10,14,15],fl=class extends y{constructor(e){super(e)}};fl.prototype.g=Li([0,ue,[0,Ws,O,Ki,O,[0,Ki,jr],O,ll,O,[0,ll,jr],O,dl,O,[0,bt,-3,H,Ce],O,[0,bt,-3,H],O,[0,R,bt,-2,H,ee,H,-1,2,bt,jr],O,ul,O,[0,ul,jr],bt,jr,R,O,[0,bt,-3,H,jr,-1],O,[0,ue,dl]],R,[0,R,ee,-1,H]]);var ut=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.s=new _c,S(this.h,0,3,this.s),S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(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,i){const n=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,i=new fl;const s=new hl;var a=new Fd;if(st(a,1,255),S(s,0,12,a),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var c=new $s;$r(c,3,!0),v(c,1,t.keypoint.x),v(c,2,t.keypoint.y),Vr(s,5,Ws,c)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(c of(a=new Pd,t.scribble))$r(t=new $s,3,!0),v(t,1,c.x),v(t,2,c.y),bi(a,1,$s,t);Vr(s,15,Ws,a)}bi(i,1,hl,s),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),$e(this,e,n);e:{try{const u=new Vs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=u;break e}this.j(u)}finally{Gi(this)}l=void 0}return l}m(){var e=new Ee;z(e,"image_in"),z(e,"roi_in"),z(e,"norm_rect_in");const t=new Ie;Je(t,Sc,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),W(r,"IMAGE:image_in"),W(r,"ROI:roi_in"),W(r,"NORM_RECT:norm_rect_in"),r.o(t),Le(e,r),Ui(this,e),this.outputConfidenceMasks&&(D(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Tr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(D(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Tr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),D(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ut.prototype.segment=ut.prototype.segment,ut.prototype.setOptions=ut.prototype.o,ut.createFromModelPath=function(e,t){return I(ut,e,{baseOptions:{modelAssetPath:t}})},ut.createFromModelBuffer=function(e,t){return I(ut,e,{baseOptions:{modelAssetBuffer:t}})},ut.createFromOptions=function(e,t){return I(ut,e,t)};var He=class extends Se{constructor(e,t){super(new Ve(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},S(e=this.h=new Ac,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),e.maxResults!==void 0?st(this.h,3,e.maxResults):"maxResults"in e&&$(this.h,3),e.scoreThreshold!==void 0?v(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&$(this.h,4),e.categoryAllowlist!==void 0?vi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&$(this.h,5),e.categoryDenylist!==void 0?vi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&$(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},$e(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"input_frame_gpu"),z(e,"norm_rect"),D(e,"detections");const t=new Ie;Je(t,jd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),W(r,"IMAGE:input_frame_gpu"),W(r,"NORM_RECT:norm_rect"),L(r,"DETECTIONS:detections"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(jc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=async function(e,t){return I(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return I(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return I(He,e,t)};var zs=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function wl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function ml(e){try{const t=new zs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Gi(e)}}zs.prototype.close=zs.prototype.close;var Re=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,S(e=this.h=new Tc,0,1,t=new q),this.v=new xc,S(this.h,0,3,this.v),this.j=new pc,S(this.h,0,2,this.j),st(this.j,4,1),v(this.j,2,.5),v(this.v,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numPoses"in e&&st(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&v(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&v(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,wl(this),$e(this,e,i),ml(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:i,wl(this),ct(this,e,n,t),ml(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"normalized_landmarks"),D(e,"world_landmarks"),D(e,"segmentation_masks");const t=new Ie;Je(t,Nd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:normalized_landmarks"),L(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Le(e,r),Ui(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=qr(s),this.landmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],x(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=_r(s),this.worldLandmarks.push(Yr(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(L(r,"SEGMENTATION_MASK:segmentation_masks"),Er(this,"segmentation_masks"),this.g.ba("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Tr(this,s,!0,!this.s)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.detectForVideo=Re.prototype.F,Re.prototype.detect=Re.prototype.D,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=function(e,t){return I(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return I(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return I(Re,e,t)},Re.POSE_CONNECTIONS=nl;const Xi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Dd="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Rd=()=>{const e=d.useRef(null),[t,r]=d.useState(!1),[i,n]=d.useState("Initializing..."),[s,a]=d.useState(0),[c,l]=d.useState(!1);d.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(w=>{console.log("ServiceWorker registered:",w)}).catch(w=>{console.log("ServiceWorker registration failed:",w)})},[]);const u=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(Xi)!==void 0:!1,h=async()=>{try{const w=await fetch(Xi),m=w.headers.get("content-length"),g=m?parseInt(m,10):0;if(!w.body)throw new Error("No response body");const b=w.body.getReader();let _=0;const p=[];for(;;){const{done:A,value:F}=await b.read();if(A)break;if(p.push(F),_+=F.length,g){const T=Math.round(_/g*100);a(T),n(`Downloading model... ${T}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(Xi,new Response(new Blob(p),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return d.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await u()?n("Using cached model..."):(n("Model not cached. Downloading..."),await h()),n("Loading MediaPipe WASM...");const g=await Xt.forVisionTasks(Dd);n("Creating face landmarker...");const b=await X.createFromOptions(g,{baseOptions:{modelAssetPath:Xi,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=b,r(!0),n("Model loaded successfully ✅")}catch(m){console.error("Model init error:",m),n(`Error: ${m==null?void 0:m.message}`),(m==null?void 0:m.name)==="NotAllowedError"&&l(!0)}})()},[]),{faceLandmarkerRef:e,isModelLoaded:t,statusMessage:i,setStatusMessage:n,loadingProgress:s,permissionDenied:c,clearCache:async()=>{"caches"in window&&(await caches.delete("mediapipe-models-v1"),n("Cache cleared. Please refresh to re-download models."))}}},Od=()=>{const[e,t]=d.useState(0),r=d.useRef({lastTime:0,frames:0,fps:0}),i=d.useCallback(()=>{const n=performance.now(),s=r.current;if(s.frames++,n-s.lastTime>=1e3){const a=Math.round(s.frames*1e3/(n-s.lastTime));t(a),s.frames=0,s.lastTime=n}},[]);return{fps:e,updateFPS:i}},Bd=()=>{const e=d.useRef({value:100,isLookingAway:!1}),t=d.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const u=s.getContext("2d");if(!u)return;const{width:h,height:f}=s;if(u.clearRect(0,0,h,f),u.drawImage(a,0,0,h,f),l){u.fillStyle="#00FF00";for(const w of c)u.fillRect(w.x*h-.5,w.y*f-.5,1,1)}},[]),r=d.useCallback(s=>{const a=e.current.value/100,c=100,l=20,u=10,h=10;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(u,h,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(u,h+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(u,h+c*(1-a),l,2)},[]),i=d.useCallback((s,a,c,l,u,h,f)=>{if(t(s,a,c,l),u&&h&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=d.useCallback((s,a)=>{const c=s.getContext("2d");c&&(c.clearRect(0,0,s.width,s.height),c.drawImage(a,0,0,s.width,s.height))},[]);return{drawLandmarks:t,drawEngagementBar:r,drawWithEngagementBar:i,clearCanvas:n,engagementRef:e}},Ud=70,Gd=()=>{const[e,t]=d.useState(100),[r,i]=d.useState(!1),n=d.useRef(0),s=d.useCallback((a,c,l)=>{if(!l||a.length<468)return;const u=a[33],h=a[263],f=a[1];if(!u||!h||!f)return;const w=(u.x+h.x)*.5,m=(u.y+h.y)*.5,g=w-c.x,b=m-c.y,_=Math.sqrt(g*g+b*b),p=Math.abs(f.y-c.noseY)*100,A=Math.abs(f.x-c.noseX)*100,F=Math.max(0,100-(_*200+p+A)),T=F<Ud,C=performance.now();return C-n.current>100&&(t(F),i(T),n.current=C),{engagement:F,isLookingAway:T}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Vd=.05,$d=()=>{const[e,t]=d.useState(!1),[r,i]=d.useState(!1),n=d.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=d.useCallback((c,l)=>{if(!c||!l)return 0;const u=[1,33,263,61,291,10,152];let h=0,f=0;const w=l[33],m=l[263],g=c[33],b=c[263];if(!w||!m||!g||!b)return 0;const _=n(w,m),p=n(g,b);if(_===0||p===0)return 0;for(const F of u){const T=l[F],C=c[F];if(T&&C){const M=w.x+(C.x-g.x)*_/p,B=w.y+(C.y-g.y)*_/p;h+=n(T,{x:M,y:B}),f++}}return f===0?0:h/f},[n]),a=d.useCallback((c,l,u,h)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(h("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&u){let f=null,w=0;for(const m of c.faceLandmarks)s(m,u)<Vd&&(f=m,w++);return w===1?(t(!1),i(!1),h("Reference face tracked."),f):w>1?(t(!0),i(!1),h("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),h("Reference face not detected."),null)}else{c.faceLandmarks.length>1?(t(!0),h("Multiple faces detected. Set reference for single face tracking.")):(t(!1),h("No reference set. Detecting first face."));const f=c.faceLandmarks[0];return!f||f.length<468?null:f}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},Wd=1e3,zd=(e,t)=>{const[r,i]=d.useState(!1),[n,s]=d.useState("face_detected"),{incrementGazeViolation:a}=Zs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:u}=e;d.useEffect(()=>{let w;return(u||c||l)&&t?w=setTimeout(()=>{i(!0),u?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},Wd):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[u,c,l,t,a]);const h=d.useCallback(()=>c?"multiple_faces":l?"no_face_detected":u?"looking_away":"face_detected",[c,l,u]),f=d.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:h,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class te extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Hd{constructor(t={}){Oe(this,"config");Oe(this,"mediaRecorder",null);Oe(this,"audioChunks",[]);Oe(this,"recordingStream",null);Oe(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(!this.isRecordingSupported())throw new te("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new te("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=s=>{var a;s.data.size>0&&(this.audioChunks.push(s.data),(a=r==null?void 0:r.onDataAvailable)==null||a.call(r,s.data))},this.mediaRecorder.onstop=()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},this.mediaRecorder.onerror=s=>{var c;const a=new te(`Recording failed: ${s.error}`,"RECORDING_ERROR",!0);(c=r==null?void 0:r.onError)==null||c.call(r,a),this.cleanup()},this.mediaRecorder.start(100),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new te("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new te("No microphone found","NO_MICROPHONE",!1)}throw new te(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new te("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new te("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const i=this.mediaRecorder,n=()=>{try{const s=i.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:s});this.cleanup(),t(a)}catch(s){r(new te(`Failed to create audio blob: ${s instanceof Error?s.message:String(s)}`,"BLOB_CREATION_FAILED",!1))}};i.addEventListener("stop",n,{once:!0}),i.stop()})}async transcribe(t){const{audioBlob:r}=t;if(!r||r.size===0)throw new te("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const i=new FormData,n=new File([r],"recording.wav",{type:r.type||"audio/wav"});if(i.append("file",n),i.append("qna_id",this.config.qnaId||""),!this.config.interviewId)throw new te("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await Bt(`${this.config.baseUrl}${Gt.TRANSCRIBE_ANSWER(this.config.interviewId)}`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:i},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!s.ok){const c=await s.text();let l=`STT request failed: ${s.status} ${s.statusText}`;try{const u=JSON.parse(c);l=u.message||u.error||l}catch{l=c||l}throw new te(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof te?i:new te(`Transcription failed: ${i instanceof Error?i.message:String(i)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const t=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const r of t)if(MediaRecorder.isTypeSupported(r))return r;return"audio/webm"}getRecordingStream(){return this.recordingStream}cleanup(){this.recordingStream&&(this.recordingStream.getTracks().forEach(t=>t.stop()),this.recordingStream=null),this.mediaRecorder=null,this.audioChunks=[],this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}}const Nr=new Hd,qd=(e,t,r,i)=>{const n=d.useRef(null);return d.useEffect(()=>{if(!t)return;const s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});e.current&&(e.current.srcObject=l,e.current.onloadeddata=()=>{r()})}catch(l){console.error("Camera access error:",l),i("Camera access failed")}},a=n.current,c=e.current;return s(),()=>{a&&cancelAnimationFrame(a),c!=null&&c.srcObject&&c.srcObject.getTracks().forEach(u=>u.stop())}},[t,r]),d.useEffect(()=>{const s=Nr.getRecordingStream();if(s&&e.current){e.current.srcObject=s;const a=s.getVideoTracks(),c=s.getAudioTracks(),l=()=>{console.log("Media track ended - permission may have been revoked")};[...a,...c].forEach(u=>{u.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},Yd=(e,t,r,i,n,s,a,c,l,u,h,f,w,m,g)=>{const b=d.useRef(null),_=d.useCallback(()=>{var T;const p=e.current,A=t.current,F=r.current;if(!p||p.readyState<2||!F||!A){b.current=requestAnimationFrame(_);return}i();try{const C=performance.now(),M=F.detectForVideo(p,C);if(((T=M.faceLandmarks)==null?void 0:T.length)>0){g(!1);const B=n(M,l,u.current,m);B?(s(A,p,B,h,f,w,l),l&&w&&c(B,u.current,w)):a(A,p)}else a(A,p),l?(g(!0),m("Reference face not detected.")):g(!1)}catch(C){console.error("Face detection error:",C)}b.current=requestAnimationFrame(_)},[e,t,r,i,n,s,a,c,l,u,h,f,w,m,g]);return{renderLoop:_,animationFrameRef:b}},Kd=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Zs(),c=d.useRef(s),l=d.useCallback(()=>{c.current=s},[s]),u=d.useCallback(()=>{var w;const h=e.current,f=t.current;if(console.log({faceLandmarker:h,video:f}),!(!h||!f))try{const m=performance.now(),g=h.detectForVideo(f,m);if((w=g.faceLandmarks)!=null&&w[0]){const b=g.faceLandmarks[0],_=b[33],p=b[263],A=b[1];_&&p&&A&&(c.current={x:(_.x+p.x)*.5,y:(_.y+p.y)*.5,noseX:A.x,noseY:A.y},a(!0,c.current),r("Reference set. Gaze tracking active."),console.log("Reference set. Gaze tracking active.",c.current),i&&i())}}catch(m){console.error("Set reference error:",m),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:u,syncReference:l}},gl=d.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n},s)=>{var El;const{authToken:a}=ro(),c=a?Wl(a):null,l=lo(),{borderRadius:u}=rr(),h=u??18,{proctoring:f}=cn(),w=!!(f!=null&&f.gazeAnalysisEnabled),[m,g]=d.useState(!1),[b,_]=d.useState((f==null?void 0:f.showLandmarks)??!1),[p,A]=d.useState(i&&((f==null?void 0:f.showEngagementBar)??!0)),[F,T]=d.useState(w),C=d.useRef(null),M=d.useRef(null),B=d.useRef(null),G=d.useRef(null),Q=d.useCallback(async ft=>{var tn;const Jr=C.current,ve=B.current;if(!Jr||!ve)return;const Cr=ve.getContext("2d");if(!Cr)return;ve.width=Jr.videoWidth,ve.height=Jr.videoHeight,Cr.save(),Cr.scale(-1,1),Cr.drawImage(Jr,-ve.width,0,ve.width,ve.height),Cr.restore();const Zr=await new Promise(er=>ve.toBlob(er,"image/jpeg"));if(Zr&&t)try{const er=`${ft}-${Date.now()}.jpeg`,_e=await l.requestScreenshotUploadUrl(t,er);_e.data&&_e.data.upload_url&&(await l.uploadScreenshot((tn=_e==null?void 0:_e.data)==null?void 0:tn.upload_url,Zr),_e.data.asset_id&&await l.confirmScreenshotUpload(_e.data.asset_id))}catch(er){console.error(`Failed to upload screenshot for ${ft}:`,er)}},[l,t]),{faceLandmarkerRef:oe,isModelLoaded:qe,statusMessage:de,setStatusMessage:Ye,loadingProgress:Te,permissionDenied:be,clearCache:kt}=Rd(),{fps:dt,updateFPS:ge}=Od(),{drawWithEngagementBar:Qt,clearCanvas:Ke,engagementRef:re}=Bd(),{engagement:Xe,isLookingAway:V,analyzeGaze:ht,setEngagement:j,setIsLookingAway:J}=Gd(),{multipleFacesDetected:Dt,referenceFaceNotDetected:Rt,analyzeFace:Jt,setMultipleFacesDetected:Ji,setReferenceFaceNotDetected:Zt}=$d(),{referenceSet:Qr,referenceRef:Zi,setReference:N,syncReference:je}=Kd(oe,C,Ye,n),rt={multipleFacesDetected:Dt,referenceFaceNotDetected:Rt,isLookingAway:V},{showGazeWarningModal:en,getWarningType:Ch,closeWarningModal:vl,setShowGazeWarningModal:_l,setFaceDetectionState:kl}=zd(rt,w),{renderLoop:Ih}=Yd(C,M,oe,ge,Jt,Qt,Ke,ht,Qr,Zi,b,p,w,Ye,Zt);qd(C,qe,Ih,Ye),d.useEffect(()=>{je()},[je]),d.useEffect(()=>{re&&re.current&&(re.current.value=Xe,re.current.isLookingAway=V)},[Xe,V,re]);const Mh=d.useCallback(ft=>{T(ft),ft||(j(100),J(!1))},[j,J]),Lh=d.useCallback(()=>{J(!1),Ji(!1),Zt(!1),kl("face_detected"),_l(!1),vl()},[J,Ji,Zt,kl,_l,vl]),Fh={engagement:Xe,fps:dt,isLookingAway:V,multipleFacesDetected:Dt,referenceFaceNotDetected:Rt};return d.useEffect(()=>{const ft=[];return(async()=>{try{const ve=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});G.current=ve,C.current&&(C.current.srcObject=ve);const Zr=(r??ti)*60*1e3/3,tn=[0,1,2].map((_e,Ot)=>({label:`capture-${Ot+1}`,start:Ot*Zr,end:(Ot+1)*Zr})),er=(_e,Ot)=>_e===Ot?_e:Math.random()*(Ot-_e)+_e;tn.forEach(({label:_e,start:Ot,end:Ph},Dh)=>{let Ys;Dh===0?Ys=3e3:Ys=er(Ot,Ph),ft.push(setTimeout(()=>{Q(_e)},Ys))})}catch(ve){console.error("Error accessing camera:",ve)}})(),()=>{G.current&&G.current.getTracks().forEach(ve=>ve.stop()),ft.forEach(clearTimeout)}},[Q]),d.useImperativeHandle(s,()=>({setReference:()=>{N()},stopCamera:()=>{G.current&&(G.current.getTracks().forEach(ft=>ft.stop()),G.current=null)}}),[N]),o.jsxs("div",{className:`iw-relative iw-h-full ${e}`,children:[be?o.jsxs("div",{className:"iw-rounded-md iw-border iw-border-red-600 iw-p-5 iw-text-red-600",children:[o.jsx("h2",{children:"Camera Permission Denied"}),o.jsx("p",{children:"Please allow camera access to use this application."})]}):o.jsx("div",{className:"iw-flex iw-w-full iw-h-full iw-flex-wrap iw-gap-5",children:o.jsxs("div",{className:"iw-relative iw-flex-1",children:[o.jsx("video",{ref:C,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),w&&o.jsx("canvas",{ref:M,width:420,height:240,className:"iw-absolute iw-top-0 iw-left-0 iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)",borderRadius:h}}),o.jsx("canvas",{ref:B,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:[o.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),o.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),i&&((El=c==null?void 0:c.data)==null?void 0:El.user_name)&&o.jsx("div",{className:"iw-absolute iw-z-50 iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-white",children:c.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(lu,{showControls:(f==null?void 0:f.showControls)??!1,isBubbleOpen:m,setIsBubbleOpen:g,setReference:N,clearCache:kt,isModelLoaded:qe,gazeAnalysisEnabled:F&&w,referenceSet:Qr,showLandmarks:b,setShowLandmarks:_,showEngagementBar:p,setShowEngagementBar:A,handleToggleGazeAnalysis:Mh,stats:Fh,statusMessage:de,loadingProgress:Te})})]})}),w&&en&&o.jsx(au,{isOpen:en,onClose:Lh,warningType:Ch()})]})}),Xd=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],Qd=({isOpen:e,onStart:t,onClose:r,gazeEnabled:i=!1,videoFeedRef:n,interviewId:s="",interview_duration:a=ti})=>{var ht;const c=d.useRef(null),l=d.useRef(null),{baseColor:u,borderRadius:h}=rr(),[f,w]=d.useState(!1),[m,g]=d.useState(!1),[b,_]=d.useState(!1),[p,A]=d.useState(!1),[F,T]=d.useState(!1),[C,M]=d.useState(null),[B,G]=d.useState(!1),Q=d.useRef(null),oe=d.useRef(null),qe=j=>{Q.current=j,n&&(typeof n=="function"?n(j):n.current=j)},de=u??"#2563eb",Ye=oo(de),Te=h??18,be=(j,J)=>j.startsWith("#")&&j.length===7?`${j}${J}`:j,kt=[`radial-gradient(120% 85% at 50% 125%, ${be(de,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${be(de,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${be(de,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${be(de,"14")} 0, ${be(de,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),dt=f?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:B?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},ge=f?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:B?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},Qt=[{label:"Camera feed",description:ge.cameraCopy,status:ge.badge,toneClass:ge.toneClass,Icon:co},{label:"Microphone input",description:ge.micCopy,status:ge.badge,toneClass:ge.toneClass,Icon:Hl}],Ke=()=>{l.current&&(l.current.getTracks().forEach(j=>j.stop()),l.current=null)},re=async()=>{G(!0),M(null);try{const j=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});l.current=j,c.current&&(c.current.srcObject=j),w(!0)}catch(j){console.error("Media permission error:",j);let J="Unable to access camera or microphone.";(j==null?void 0:j.name)==="NotAllowedError"?J="Permissions denied. Please allow access to camera and microphone.":(j==null?void 0:j.name)==="NotFoundError"?J="No camera/microphone found. Please connect a device and retry.":j!=null&&j.message&&(J=j.message),w(!1),M(J)}finally{G(!1)}};if(d.useEffect(()=>{if(!e){Ke();return}return re(),()=>Ke()},[e]),d.useEffect(()=>()=>{oe.current&&(clearInterval(oe.current),oe.current=null)},[]),!e)return null;const Xe=()=>{i?_(!0):(t(),Ke())},V=async()=>{A(!0);const j=()=>{var J;return(J=Q.current)==null?void 0:J.setReference()};j(),oe.current&&clearInterval(oe.current),oe.current=setInterval(j,500)};return o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4",children:[o.jsxs("div",{className:" iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]",children:[o.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:Ye},children:[o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),o.jsxs("div",{className:"iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner",children:o.jsx(ao,{className:"iw-h-6 iw-w-6"})}),o.jsxs("div",{children:[o.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),o.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),o.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),o.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:o.jsxs("div",{className:`iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${dt.toneClass}`,children:[o.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${dt.dotClass}`}),dt.label]})}),r&&o.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{Ke(),r==null||r()},children:"✕"})]})]}),o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[o.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[o.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:o.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),o.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),o.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:Xd.map((j,J)=>o.jsx("li",{className:"iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("span",{className:"iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",style:{background:Ye},children:J+1}),o.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:j})]})},j))})]})}),o.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:Te},children:[o.jsx("div",{className:"iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3",children:i&&(F||p)?o.jsx(gl,{ref:qe,interviewId:s,interview_duration:a,showProctoringUI:!1,onSetReference:()=>{oe.current&&(clearInterval(oe.current),oe.current=null),A(!1),t()}}):o.jsx("video",{ref:c,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:Te}})}),o.jsx("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:!b&&!F?o.jsxs(o.Fragment,{children:[o.jsx(no,{onClick:re,disabled:B,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:de,borderRadius:Te,color:de},children:f?"Recheck permissions":"Enable camera & mic"}),o.jsx(Qe,{onClick:Xe,disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:de},children:"Proceed"})]}):i&&(b&&!F?o.jsx(Qe,{onClick:()=>g(!0),disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:de},children:"Calibrate Face Position"}):o.jsxs(Qe,{onClick:V,disabled:p||!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:de},children:[p?"Calibrating":"Start Calibration",p&&o.jsx("span",{className:"iw-ml-2 iw-animate-spin iw-inline-block iw-border-2 iw-border-t-transparent iw-border-stone-200 iw-size-4 iw-rounded-full","aria-label":"loading"})]}))})]}),i&&F?o.jsxs("span",{className:"iw-text-slate-700 iw-text-center iw-text-md",children:["Sit upright and look directly into the camera, then press the",o.jsx("span",{className:"iw-font-semibold",children:" Start Calibration "}),"button. Proper calibration is required and incorrect setup may affect your assessment."]}):o.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:Qt.map(({Icon:j,label:J,description:Dt,status:Rt,toneClass:Jt})=>o.jsx("li",{className:"iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100",children:o.jsx(j,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[o.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:J}),o.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${Jt}`,children:Rt})]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:Dt})]})]})},J))}),C&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600",children:C}),!((ht=navigator.mediaDevices)!=null&&ht.getUserMedia)&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700",children:"Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox."})]})]}),o.jsx("div",{className:" iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center",children:o.jsx("div",{className:"iw-text-xs iw-text-slate-500",children:"Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards."})}),o.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:kt,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]}),o.jsx(Kl,{isOpen:m,onDecline:()=>g(!1),onContinue:()=>{g(!1),Ke(),T(!0)}})]})};var se=(e=>(e.IDLE="idle",e.FETCHING_QUESTION="fetching_question",e.READING_QUESTION="reading_question",e.THINKING="thinking",e.ANSWERING="answering",e.TRANSCRIBING="transcribing",e.EDITING="editing",e.SUBMITTING="submitting",e.COMPLETED="completed",e))(se||{});const Jd={thinkingDuration:30,answeringDuration:120,editingDuration:30},Zd={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class eh{constructor(t={},r={}){Oe(this,"config");Oe(this,"state");Oe(this,"phaseIntervalId",null);Oe(this,"globalIntervalId",null);Oe(this,"callbacks");this.config={...Jd,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const t=this.state.phase,r=Zd[t];if(!r)return;this.stopPhaseTimer(),this.state.phase=r.next;const i=this.getDurationForPhase(r.next);i>0?(this.state.currentPhaseTimeRemaining=i,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var t,r;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(r=(t=this.callbacks).onInterviewEnd)==null||r.call(t),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(t){switch(t){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var t,r;this.state.totalTimeElapsed++,(r=(t=this.callbacks).onTick)==null||r.call(t,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var t,r;(r=(t=this.callbacks).onPhaseChange)==null||r.call(t,this.state.phase,this.getState())}}function th(e={}){const{config:t={},callbacks:r={}}=e,i=d.useRef(null);i.current||(i.current=new eh(t,{}));const n=i.current,[s,a]=d.useState(n.getState()),c=d.useCallback(()=>{a(n.getState())},[n]);d.useEffect(()=>{const f={onPhaseChange:(w,m)=>{var g;c(),(g=r.onPhaseChange)==null||g.call(r,w,m)},onTick:w=>{var m;c(),(m=r.onTick)==null||m.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),d.useEffect(()=>()=>{n.destroy()},[n]);const l=d.useCallback(()=>{n.startQuestion(),c()},[n,c]),u=d.useCallback(()=>{n.nextPhase(),c()},[n,c]),h=d.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:u,completeInterview:h,timerService:n}}function rh(e,t={}){const[r,i]=d.useState({data:null,loading:!1,error:null}),n=d.useCallback(async(...s)=>{var a,c,l,u;i(h=>({...h,loading:!0,error:null}));try{const h=await e(...s);i(f=>({...f,data:h,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,h),(c=t.onSettled)==null||c.call(t,h,null)}catch(h){const f=h.type?h:{type:"unknown",message:h.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:h};i(w=>({...w,loading:!1,error:f})),(l=t.onError)==null||l.call(t,f),(u=t.onSettled)==null||u.call(t,null,f)}},[e,t]);return{...r,execute:n}}const ih=e=>{const[t,r]=d.useState(null),[i,n]=d.useState(!1),s=document,a=()=>!!(s.fullscreenEnabled||s.webkitFullscreenEnabled||s.mozFullScreenEnabled||s.msFullscreenEnabled),c=()=>s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement,l=async m=>{var g;try{if(!a())throw new Error("Fullscreen is not supported in this environment");m.requestFullscreen?await m.requestFullscreen():m.webkitRequestFullscreen?await m.webkitRequestFullscreen():m.mozRequestFullScreen?await m.mozRequestFullScreen():m.msRequestFullscreen&&await m.msRequestFullscreen()}catch(b){const _={name:"FullscreenError",message:b instanceof Error?b.message:"Failed to enter fullscreen"};r(_),(g=e==null?void 0:e.onError)==null||g.call(e,_)}},u=async()=>{var m;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(g){const b={name:"FullscreenError",message:g instanceof Error?g.message:"Failed to exit fullscreen"};r(b),(m=e==null?void 0:e.onError)==null||m.call(e,b)}},h=d.useCallback(()=>{var g;const m=!!c();n(m),(g=e==null?void 0:e.onFullScreenChange)==null||g.call(e,m)},[e]);d.useEffect(()=>{const m=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return m.forEach(g=>{document.addEventListener(g,h)}),()=>{m.forEach(g=>{document.removeEventListener(g,h)})}},[h]);const f=async m=>{r(null);const g=m??document.documentElement;await l(g)};return{isFullScreen:i,toggleFullScreen:async m=>{i?await u():await f(m)},enterFullScreen:f,exitFullScreen:u,error:t}},nh=e=>{d.useEffect(()=>{const t=i=>{(i.ctrlKey||i.metaKey)&&["c","v","a","t","n","w","r","s","p"].includes(i.key.toLowerCase())&&(i.preventDefault(),e({type:"blocked_shortcut",severity:"low",details:{action:"shortcut_pressed",reason:`Attempted to use a blocked keyboard shortcut: Ctrl + ${i.key}`}})),i.key.startsWith("F")&&i.key.length<=3&&(i.preventDefault(),e({type:"blocked_function_key",severity:"low",details:{action:"function_key_pressed",reason:`Attempted to use a blocked function key: ${i.key}`}})),i.altKey&&i.key==="Tab"&&(i.preventDefault(),e({type:"alt_tab_attempt",severity:"medium",details:{action:"alt_tab",reason:"Attempted to use the Alt + Tab shortcut"}}))},r=i=>{i.preventDefault(),e({type:"right_click_attempt",severity:"low",details:{action:"right_click",reason:"Attempted to use the right click"}})};return document.addEventListener("keydown",t),document.addEventListener("contextmenu",r),()=>{document.removeEventListener("keydown",t),document.removeEventListener("contextmenu",r)}},[e])},sh=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),[c,l]=d.useState(null),[u,h]=d.useState(null);e.config&&Nr.updateConfig(e.config);const f=d.useCallback(async b=>{var _;try{l(null),a(null),h(null),await Nr.startRecording(b,{onStart:()=>{var p;r(!0),(p=e.onStart)==null||p.call(e)},onStop:()=>{var p;r(!1),(p=e.onStop)==null||p.call(e)},onError:p=>{var F;const A=p instanceof te?p:new te(p.message,"RECORDING_ERROR",!0);l(A),r(!1),(F=e.onError)==null||F.call(e,A)}})}catch(p){const A=p instanceof te?p:new te(p instanceof Error?p.message:String(p),"START_FAILED",!1);throw l(A),r(!1),(_=e.onError)==null||_.call(e,A),A}},[]),w=d.useCallback(async()=>{var b,_;try{const p=await Nr.stopRecording();return h(p),r(!1),(b=e.onStop)==null||b.call(e),p}catch(p){const A=p instanceof te?p:new te(p instanceof Error?p.message:String(p),"STOP_FAILED",!1);throw l(A),r(!1),(_=e.onError)==null||_.call(e,A),A}},[]),m=d.useCallback(async(b,_={})=>{var p,A;try{l(null),n(!0);const F={audioBlob:b,..._},T=await Nr.transcribe(F);return a(T.transcript),n(!1),(p=e.onTranscriptionComplete)==null||p.call(e,T),T}catch(F){const T=F instanceof te?F:new te(F instanceof Error?F.message:String(F),"TRANSCRIPTION_FAILED",!0);throw l(T),n(!1),(A=e.onError)==null||A.call(e,T),T}},[]),g=d.useCallback(()=>{Nr.cancelRecording(),r(!1),h(null)},[]);return{startRecording:f,stopRecording:w,transcribe:m,cancelRecording:g,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:u}},oh=e=>{const t=d.useRef(null),r=d.useRef(!1);d.useEffect(()=>{const i=()=>{document.hidden&&(r.current=!0,t.current&&(clearTimeout(t.current),t.current=null),e({type:"tab_switch",severity:"high",details:{action:"tab_hidden",reason:"Attempted to switch tabs or applications"}}),setTimeout(()=>{r.current=!1},100))},n=()=>{r.current||(t.current=setTimeout(()=>{r.current||e({type:"focus_loss",severity:"medium",details:{action:"window_blur",reason:"Focus lost from the interview window"}}),t.current=null},50))};return document.addEventListener("visibilitychange",i),window.addEventListener("blur",n),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("blur",n),t.current&&clearTimeout(t.current)}},[e])},ah=()=>{d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
23
+ }`,e.VERTEX_SHADER),this.Y=Oc(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.P=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.Z),e.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function _t(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 Is(e){var t=_t(e,1);if(!t){if(t=_t(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=Sr(e);var r=Ms(e);if($i(r,i,Uc(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),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,r);for(let n=0,s=0;n<t.length;++n,s+=4)t[n]=r[s]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function Uc(e){let t=_t(e,2);if(!t){const r=Sr(e);t=Vc(e);const i=Is(e),n=Gc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Ls(e)}return t}function Sr(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=vt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Gc(e){if(e=Sr(e),!Wi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Wi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Wi=e.R16F}return Wi}function Ms(e){return e.l||(e.l=new Cs),e.l}function Vc(e){const t=Sr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=_t(e,2);return r||(r=Vi(Ms(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ls(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Wi,he=class{constructor(e,t,r,i,n,s,a){this.g=e,this.m=t,this.j=r,this.canvas=i,this.l=n,this.width=s,this.height=a,this.j&&--$c===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!_t(this,0)}ja(){return!!_t(this,1)}R(){return!!_t(this,2)}ia(){return(t=_t(e=this,0))||(t=Is(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return Is(this)}N(){return Uc(this)}clone(){const e=[];for(const 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}`);{const i=Sr(this),n=Ms(this);i.activeTexture(i.TEXTURE1),r=Vi(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Gc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),$i(n,i,r),js(n,i,!1,()=>{Vc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ls(this)}),Ns(n),Ls(this)}}e.push(r)}return new he(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Sr(this).deleteTexture(_t(this,2)),$c=-1}};he.prototype.close=he.prototype.close,he.prototype.clone=he.prototype.clone,he.prototype.getAsWebGLTexture=he.prototype.N,he.prototype.getAsFloat32Array=he.prototype.ha,he.prototype.getAsUint8Array=he.prototype.ia,he.prototype.hasWebGLTexture=he.prototype.R,he.prototype.hasFloat32Array=he.prototype.ja,he.prototype.hasUint8Array=he.prototype.Da;var $c=250;function at(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 Wc(e){var t=at(e,0);if(!t){t=Ar(e);const r=Hi(e),i=new Uint8Array(e.width*e.height*4);$i(r,t,zi(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),Ns(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function zi(e){let t=at(e,2);if(!t){const r=Ar(e);t=qi(e);const i=at(e,1)||Wc(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),Xr(e)}return t}function Ar(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=vt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Hi(e){return e.l||(e.l=new Cs),e.l}function qi(e){const t=Ar(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=at(e,2);return r||(r=Vi(Hi(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Xr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zc(e){const t=Ar(e);return js(Hi(e),t,!0,()=>function(r,i){const n=r.canvas;if(n.width===r.width&&n.height===r.height)return i();const s=n.width,a=n.height;return n.width=r.width,n.height=r.height,r=i(),n.width=s,n.height=a,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()}))}var fe=class{constructor(e,t,r,i,n,s,a){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=n,this.width=s,this.height=a,(this.j||this.m)&&--Hc===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!at(this,0)}ka(){return!!at(this,1)}R(){return!!at(this,2)}Aa(){return Wc(this)}za(){var e=at(this,1);return e||(zi(this),qi(this),e=zc(this),Xr(this),this.g.push(e),this.j=!0),e}N(){return zi(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const i=Ar(this),n=Hi(this);i.activeTexture(i.TEXTURE1),r=Vi(n,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),$i(n,i,r),js(n,i,!1,()=>{qi(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Xr(this)}),Ns(n),Xr(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);zi(this),qi(this),r=zc(this),Xr(this)}e.push(r)}return new fe(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&at(this,1).close(),this.m&&Ar(this).deleteTexture(at(this,2)),Hc=-1}};fe.prototype.close=fe.prototype.close,fe.prototype.clone=fe.prototype.clone,fe.prototype.getAsWebGLTexture=fe.prototype.N,fe.prototype.getAsImageBitmap=fe.prototype.za,fe.prototype.getAsImageData=fe.prototype.Aa,fe.prototype.hasWebGLTexture=fe.prototype.R,fe.prototype.hasImageBitmap=fe.prototype.ka,fe.prototype.hasImageData=fe.prototype.Ca;var Hc=250;function tt(...e){return e.map(([t,r])=>({start:t,end:r}))}const Ld=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}((qc=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:Mc()?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){const 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){const r=e.length,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),E(this,i||"input_audio",s=>{E(this,n=n||"audio_header",a=>{this.i._configureAudio(s,a,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){ot(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,i,n){const s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),E(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){E(this,t,i=>{const[n,s]=Pc(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){E(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){E(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){E(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){E(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){E(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){E(this,t,i=>{E(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){E(this,t,i=>{Dc(this,Object.keys(e),n=>{Dc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){E(this,r,n=>{E(this,t,s=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputStream(a,e.length,s,n,i),this.i._free(a)})})}addEmptyPacketToStream(e,t){E(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputStream(n,i,r)})}addDoubleVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputStream(n,i,r)})}addFloatVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputStream(n,i,r)})}addIntVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputStream(n,i,r)})}addUintVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputStream(n,i,r)})}addStringVectorToStream(e,t,r){E(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)E(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,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,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){E(this,r,i=>{E(this,t,n=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,n,i),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(i,n);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(i,n);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(i,n);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(i,n);this.i._addIntVectorToInputSidePacket(i,r)})}addUintVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(i,n);this.i._addUintVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){E(this,t,r=>{const i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(const n of e)E(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){ot(this,e,t),E(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Pt(this,e,t),E(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){ot(this,e,t),E(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Pt(this,e,t),E(this,e,i=>{this.i._attachProtoVectorListener(i,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?'),ot(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),E(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends qc{get ea(){return this.i}oa(e,t,r){E(this,t,i=>{const[n,s]=Pc(this,e,i);this.ea._addBoundTextureAsImageToStream(i,n,s,r)})}V(e,t){ot(this,e,t),E(this,e,r=>{this.ea._attachImageListener(r)})}ba(e,t){Pt(this,e,t),E(this,e,r=>{this.ea._attachImageVectorListener(r)})}}));var qc,Ve=class extends Ld{};async function I(e,t,r){return async function(i,n,s,a){return Id(i,n,s,a)}(e,r.canvas??(Mc()?void 0:document.createElement("canvas")),t,r)}function Yc(e,t,r,i){if(e.U){const s=new ec;if(r!=null&&r.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");v(s,1,(n.left+n.right)/2),v(s,2,(n.top+n.bottom)/2),v(s,4,n.right-n.left),v(s,3,n.bottom-n.top)}else v(s,1,.5),v(s,2,.5),v(s,4,1),v(s,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(v(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Fc(t);r=ie(s,3)*c/a,n=ie(s,4)*a/c,v(s,4,r),v(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.oa(t,e.Z,i??performance.now()),e.finishProcessing()}function $e(e,t,r){var i;if((i=e.baseOptions)!=null&&i.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Yc(e,t,r,e.B+1)}function ct(e,t,r,i){var n;if(!((n=e.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Yc(e,t,r,i)}function Tr(e,t,r,i){var n=t.data;const s=t.width,a=s*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==a)throw Error("Unsupported channel count: "+n.length/a);return e=new he([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Se=class extends As{constructor(e,t,r,i){super(e),this.g=e,this.Z=t,this.U=r,this.na=i,this.P=new Cs}l(e,t=!0){if("runningMode"in e&&$r(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.P.close(),super.close()}};Se.prototype.close=Se.prototype.close;var We=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},S(e=this.h=new Ri,0,1,t=new q),v(this.h,2,.5),v(this.h,3,.3)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&v(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&v(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},$e(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect_in"),D(e,"detections");const t=new Ie;Je(t,pd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect_in"),L(r,"DETECTIONS:detections"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(jc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.detectForVideo=We.prototype.F,We.prototype.detect=We.prototype.D,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=async function(e,t){return I(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return I(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return I(We,e,t)};var Fs=tt([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]),Ps=tt([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]),Ds=tt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Kc=tt([474,475],[475,476],[476,477],[477,474]),Rs=tt([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]),Os=tt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Xc=tt([469,470],[470,471],[471,472],[472,469]),Bs=tt([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]),Qc=[...Fs,...Ps,...Ds,...Rs,...Os,...Bs],Jc=tt([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 Zc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,S(e=this.h=new cc,0,1,t=new q),this.v=new ac,S(this.h,0,3,this.v),this.s=new Ri,S(this.h,0,2,this.s),st(this.s,4,1),v(this.s,2,.5),v(this.v,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numFaces"in e&&st(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&v(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&v(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 Zc(this),$e(this,e,t),this.j}F(e,t,r){return Zc(this),ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"face_landmarks");const t=new Ie;Je(t,yd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=qr(s),this.j.faceLandmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(D(e,"blendshapes"),L(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Fi(s),this.j.faceBlendshapes.push(Es(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(D(e,"face_geometry"),L(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=P(xd(s),ld,2))&&this.j.facialTransformationMatrixes.push({rows:Ue(i,1)??0??0,columns:Ue(i,2)??0??0,data:qt(i,3,jt,Ht()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.F,X.prototype.detect=X.prototype.D,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return I(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return I(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return I(X,e,t)},X.FACE_LANDMARKS_LIPS=Fs,X.FACE_LANDMARKS_LEFT_EYE=Ps,X.FACE_LANDMARKS_LEFT_EYEBROW=Ds,X.FACE_LANDMARKS_LEFT_IRIS=Kc,X.FACE_LANDMARKS_RIGHT_EYE=Rs,X.FACE_LANDMARKS_RIGHT_EYEBROW=Os,X.FACE_LANDMARKS_RIGHT_IRIS=Xc,X.FACE_LANDMARKS_FACE_OVAL=Bs,X.FACE_LANDMARKS_CONTOURS=Qc,X.FACE_LANDMARKS_TESSELATION=Jc;var lt=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!0),S(e=this.j=new uc,0,1,t=new q)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,r){const i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,$e(this,e,i??{}),!this.h)return this.s}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"stylized_image");const t=new Ie;Je(t,bd,this.j);const r=new ye;Me(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Le(e,r),this.g.V("stylized_image",(i,n)=>{var s=!this.h,a=i.data,c=i.width;const l=c*(i=i.height);if(a instanceof Uint8Array)if(a.length===3*l){const u=new Uint8ClampedArray(4*l);for(let h=0;h<l;++h)u[4*h]=a[3*h],u[4*h+1]=a[3*h+1],u[4*h+2]=a[3*h+2],u[4*h+3]=255;a=new ImageData(u,c,i)}else{if(a.length!==4*l)throw Error("Unsupported channel count: "+a.length/l);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),c,i)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);c=new fe([a],!1,!1,this.g.i.canvas,this.P,c,i),this.s=s=s?c.clone():c,this.h&&this.h(s),x(this,n)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.s=null,this.h&&this.h(null),x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};lt.prototype.stylize=lt.prototype.Ka,lt.prototype.setOptions=lt.prototype.o,lt.createFromModelPath=function(e,t){return I(lt,e,{baseOptions:{modelAssetPath:t}})},lt.createFromModelBuffer=function(e,t){return I(lt,e,{baseOptions:{modelAssetBuffer:t}})},lt.createFromOptions=function(e,t){return I(lt,e,t)};var Us=tt([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 el(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function tl(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 rl(e,t=!0){const r=[];for(const n of e){var i=Fi(n);e=[];for(const s of i.g())i=t&&Ue(s,1)!=null?Ue(s,1)??0:-1,e.push({score:ie(s,2)??0,index:i,categoryName:Ge(s,3)??""??"",displayName:Ge(s,4)??""??""});r.push(e)}return r}var Fe=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.j=new fc,0,1,t=new q),this.s=new xs,S(this.j,0,2,this.s),this.C=new ps,S(this.s,0,3,this.C),this.v=new hc,S(this.s,0,2,this.v),this.h=new vd,S(this.j,0,3,this.h),v(this.v,2,.5),v(this.s,4,.5),v(this.C,2,.5)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var n,s,a,c;if(st(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&v(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&v(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new kr,r=t,i=ks(e.cannedGesturesClassifierOptions,(n=P(this.h,kr,3))==null?void 0:n.h());S(r,0,2,i),S(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=P(this.h,kr,3))==null||s.g());return e.customGesturesClassifierOptions?(S(r=t=new kr,0,2,i=ks(e.customGesturesClassifierOptions,(a=P(this.h,kr,4))==null?void 0:a.h())),S(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=P(this.h,kr,4))==null||c.g()),this.l(e)}Fa(e,t){return el(this),$e(this,e,t),tl(this)}Ga(e,t,r){return el(this),ct(this,e,r,t),tl(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"hand_gestures"),D(e,"hand_landmarks"),D(e,"world_hand_landmarks"),D(e,"handedness");const t=new Ie;Je(t,_d,this.j);const r=new ye;Me(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),W(r,"IMAGE:image_in"),W(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),Le(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=qr(s);const a=[];for(const c of pt(i,Za,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(c,4)??0});this.landmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=_r(s);const a=[];for(const c of pt(i,Ja,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(c,4)??0});this.worldLandmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...rl(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...rl(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function il(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Fe.prototype.recognizeForVideo=Fe.prototype.Ga,Fe.prototype.recognize=Fe.prototype.Fa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return I(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return I(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return I(Fe,e,t)},Fe.HAND_CONNECTIONS=Us;var Pe=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.h=new xs,0,1,t=new q),this.s=new ps,S(this.h,0,3,this.s),this.j=new hc,S(this.h,0,2,this.j),st(this.j,3,1),v(this.j,2,.5),v(this.s,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numHands"in e&&st(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&v(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&v(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],$e(this,e,t),il(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ct(this,e,r,t),il(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"hand_landmarks"),D(e,"world_hand_landmarks"),D(e,"handedness");const t=new Ie;Je(t,kd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"LANDMARKS:hand_landmarks"),L(r,"WORLD_LANDMARKS:world_hand_landmarks"),L(r,"HANDEDNESS:handedness"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=qr(s),this.landmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=_r(s),this.worldLandmarks.push(Yr(i));x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Fi(l);const u=[];for(const h of i.g())u.push({score:ie(h,2)??0,index:Ue(h,1)??0??-1,categoryName:Ge(h,3)??""??"",displayName:Ge(h,4)??""??""});c.push(u)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pe.prototype.detectForVideo=Pe.prototype.F,Pe.prototype.detect=Pe.prototype.D,Pe.prototype.setOptions=Pe.prototype.o,Pe.createFromModelPath=function(e,t){return I(Pe,e,{baseOptions:{modelAssetPath:t}})},Pe.createFromModelBuffer=function(e,t){return I(Pe,e,{baseOptions:{modelAssetBuffer:t}})},Pe.createFromOptions=function(e,t){return I(Pe,e,t)},Pe.HAND_CONNECTIONS=Us;var nl=tt([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 sl(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ol(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Gi(e)}}function Yi(e,t){e=qr(e),t.push(Oi(e))}var Y=class extends Se{constructor(e,t){super(new Ve(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,S(e=this.j=new yc,0,1,t=new q),this.K=new ps,S(this.j,0,2,this.K),this.Y=new Ed,S(this.j,0,3,this.Y),this.s=new Ri,S(this.j,0,4,this.s),this.H=new ac,S(this.j,0,5,this.H),this.v=new pc,S(this.j,0,6,this.v),this.L=new xc,S(this.j,0,7,this.L),v(this.s,2,.5),v(this.s,3,.3),v(this.H,2,.5),v(this.v,2,.5),v(this.v,3,.3),v(this.L,2,.5),v(this.K,2,.5)}get baseOptions(){return P(this.j,q,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&v(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&v(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&v(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&v(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&v(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&v(this.L,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&v(this.K,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,sl(this),$e(this,e,i),ol(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:i,sl(this),ct(this,e,n,t),ol(this)}m(){var e=new Ee;z(e,"input_frames_image"),D(e,"pose_landmarks"),D(e,"pose_world_landmarks"),D(e,"face_landmarks"),D(e,"left_hand_landmarks"),D(e,"left_hand_world_landmarks"),D(e,"right_hand_landmarks"),D(e,"right_hand_world_landmarks");const t=new Ie,r=new Pa;Bn(r,1,ur("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,s){if(s!=null)if(Array.isArray(s))$(n,2,mi(s,Pn,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof wt||$t(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Bn(n,2,_n(s,!1),Wt())}}(r,this.j.g());const i=new ye;Me(i,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),bi(i,8,Pa,r),W(i,"IMAGE:input_frames_image"),L(i,"POSE_LANDMARKS:pose_landmarks"),L(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),L(i,"FACE_LANDMARKS:face_landmarks"),L(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),L(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),L(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),L(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Le(e,i),Ui(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{Yi(n,this.h.poseLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(L(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Er(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Tr(this,n,!0,!this.C)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{Yi(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(D(e,"extra_blendshapes"),L(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Fi(n),a.push(Es(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{Yi(n,this.h.leftHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{Yi(n,this.h.rightHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=_r(n),a.push(Yr(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Y.prototype.detectForVideo=Y.prototype.F,Y.prototype.detect=Y.prototype.D,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(e,t){return I(Y,e,{baseOptions:{modelAssetPath:t}})},Y.createFromModelBuffer=function(e,t){return I(Y,e,{baseOptions:{modelAssetBuffer:t}})},Y.createFromOptions=function(e,t){return I(Y,e,t)},Y.HAND_CONNECTIONS=Us,Y.POSE_CONNECTIONS=nl,Y.FACE_LANDMARKS_LIPS=Fs,Y.FACE_LANDMARKS_LEFT_EYE=Ps,Y.FACE_LANDMARKS_LEFT_EYEBROW=Ds,Y.FACE_LANDMARKS_LEFT_IRIS=Kc,Y.FACE_LANDMARKS_RIGHT_EYE=Rs,Y.FACE_LANDMARKS_RIGHT_EYEBROW=Os,Y.FACE_LANDMARKS_RIGHT_IRIS=Xc,Y.FACE_LANDMARKS_FACE_OVAL=Bs,Y.FACE_LANDMARKS_CONTOURS=Qc,Y.FACE_LANDMARKS_TESSELATION=Jc;var ze=class extends Se{constructor(e,t){super(new Ve(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},S(e=this.h=new bc,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return S(this.h,0,2,ks(e,P(this.h,ws,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},$e(this,e,t),this.j}ra(e,t,r){return this.j={classifications:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"input_image"),z(e,"norm_rect"),D(e,"classifications");const t=new Ie;Je(t,Sd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),W(r,"IMAGE:input_image"),W(r,"NORM_RECT:norm_rect"),L(r,"CLASSIFICATIONS:classifications"),r.o(t),Le(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=function(s){const a={classifications:pt(s,dd,1).map(c=>{var l;return Es(((l=P(c,Ka,4))==null?void 0:l.g())??[],Ue(c,2)??0,Ge(c,3)??"")})};return Cn(hr(s,2))!=null&&(a.timestampMs=Cn(hr(s,2))??0),a}(hd(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.prototype.classifyForVideo=ze.prototype.ra,ze.prototype.classify=ze.prototype.qa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return I(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return I(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return I(ze,e,t)};var De=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!0),this.h=new vc,this.embeddings={embeddings:[]},S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t=this.h,r=P(this.h,nc,2);return r=r?r.clone():new nc,e.l2Normalize!==void 0?$r(r,1,e.l2Normalize):"l2Normalize"in e&&$(r,1),e.quantize!==void 0?$r(r,2,e.quantize):"quantize"in e&&$(r,2),S(t,0,2,r),this.l(e)}xa(e,t){return $e(this,e,t),this.embeddings}ya(e,t,r){return ct(this,e,r,t),this.embeddings}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"embeddings_out");const t=new Ie;Je(t,Ad,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"EMBEDDINGS:embeddings_out"),r.o(t),Le(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=md(i),this.embeddings=function(s){return{embeddings:pt(s,wd,1).map(a=>{var l,u;const c={headIndex:Ue(a,3)??0??-1,headName:Ge(a,4)??""??""};if(ra(a,tc,Un(a,1))!==void 0)a=qt(a=P(a,tc,Un(a,1)),1,jt,Ht()),c.floatEmbedding=a.slice();else{const h=new Uint8Array(0);c.quantizedEmbedding=((u=(l=P(a,fd,Un(a,2)))==null?void 0:l.ma())==null?void 0:u.h())??h}return c}),timestampMs:Cn(hr(s,2))??0}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};De.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Cc(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Cc(Nc(e.quantizedEmbedding),Nc(t.quantizedEmbedding))}return e},De.prototype.embedForVideo=De.prototype.ya,De.prototype.embed=De.prototype.xa,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=function(e,t){return I(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return I(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return I(De,e,t)};var Gs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function al(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function cl(e){try{const t=new Gs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Gi(e)}}Gs.prototype.close=Gs.prototype.close;var Ae=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.v=new _c,S(this.h,0,3,this.v),S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}J(){(function(e){var r,i;const t=pt(e.ca(),ye,1).filter(n=>(Ge(n,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&&(((i=(r=P(t[0],Ie,7))==null?void 0:r.l())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.s[Number(s)]=Ge(n,1)??""})})(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,al(this),$e(this,e,i),cl(this)}Ia(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,al(this),ct(this,e,n,t),cl(this)}Ba(){return this.s}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect");const t=new Ie;Je(t,Sc,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),r.o(t),Le(e,r),Ui(this,e),this.outputConfidenceMasks&&(D(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Tr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(D(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Tr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),D(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ae.prototype.getLabels=Ae.prototype.Ba,Ae.prototype.segmentForVideo=Ae.prototype.Ia,Ae.prototype.segment=Ae.prototype.segment,Ae.prototype.setOptions=Ae.prototype.o,Ae.createFromModelPath=function(e,t){return I(Ae,e,{baseOptions:{modelAssetPath:t}})},Ae.createFromModelBuffer=function(e,t){return I(Ae,e,{baseOptions:{modelAssetBuffer:t}})},Ae.createFromOptions=function(e,t){return I(Ae,e,t)};var Vs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Vs.prototype.close=Vs.prototype.close;var Fd=class extends y{constructor(e){super(e)}},jr=[0,ee,-2],Ki=[0,bt,-3,H,bt,-1],ll=[0,Ki],ul=[0,Ki,ee,-1],$s=class extends y{constructor(e){super(e)}},dl=[0,bt,-1,H],Pd=class extends y{constructor(e){super(e)}},hl=class extends y{constructor(e){super(e)}},Ws=[1,2,3,4,5,6,7,8,9,10,14,15],fl=class extends y{constructor(e){super(e)}};fl.prototype.g=Li([0,ue,[0,Ws,O,Ki,O,[0,Ki,jr],O,ll,O,[0,ll,jr],O,dl,O,[0,bt,-3,H,Ce],O,[0,bt,-3,H],O,[0,R,bt,-2,H,ee,H,-1,2,bt,jr],O,ul,O,[0,ul,jr],bt,jr,R,O,[0,bt,-3,H,jr,-1],O,[0,ue,dl]],R,[0,R,ee,-1,H]]);var ut=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.s=new _c,S(this.h,0,3,this.s),S(e=this.h,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(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,i){const n=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,i=new fl;const s=new hl;var a=new Fd;if(st(a,1,255),S(s,0,12,a),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var c=new $s;$r(c,3,!0),v(c,1,t.keypoint.x),v(c,2,t.keypoint.y),Vr(s,5,Ws,c)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(c of(a=new Pd,t.scribble))$r(t=new $s,3,!0),v(t,1,c.x),v(t,2,c.y),bi(a,1,$s,t);Vr(s,15,Ws,a)}bi(i,1,hl,s),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),$e(this,e,n);e:{try{const u=new Vs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=u;break e}this.j(u)}finally{Gi(this)}l=void 0}return l}m(){var e=new Ee;z(e,"image_in"),z(e,"roi_in"),z(e,"norm_rect_in");const t=new Ie;Je(t,Sc,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),W(r,"IMAGE:image_in"),W(r,"ROI:roi_in"),W(r,"NORM_RECT:norm_rect_in"),r.o(t),Le(e,r),Ui(this,e),this.outputConfidenceMasks&&(D(e,"confidence_masks"),L(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Tr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(D(e,"category_mask"),L(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Tr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),D(e,"quality_scores"),L(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ut.prototype.segment=ut.prototype.segment,ut.prototype.setOptions=ut.prototype.o,ut.createFromModelPath=function(e,t){return I(ut,e,{baseOptions:{modelAssetPath:t}})},ut.createFromModelBuffer=function(e,t){return I(ut,e,{baseOptions:{modelAssetBuffer:t}})},ut.createFromOptions=function(e,t){return I(ut,e,t)};var He=class extends Se{constructor(e,t){super(new Ve(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},S(e=this.h=new Ac,0,1,t=new q)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),e.maxResults!==void 0?st(this.h,3,e.maxResults):"maxResults"in e&&$(this.h,3),e.scoreThreshold!==void 0?v(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&$(this.h,4),e.categoryAllowlist!==void 0?vi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&$(this.h,5),e.categoryDenylist!==void 0?vi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&$(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},$e(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ct(this,e,r,t),this.j}m(){var e=new Ee;z(e,"input_frame_gpu"),z(e,"norm_rect"),D(e,"detections");const t=new Ie;Je(t,jd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),W(r,"IMAGE:input_frame_gpu"),W(r,"NORM_RECT:norm_rect"),L(r,"DETECTIONS:detections"),r.o(t),Le(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(jc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=async function(e,t){return I(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return I(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return I(He,e,t)};var zs=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function wl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function ml(e){try{const t=new zs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Gi(e)}}zs.prototype.close=zs.prototype.close;var Re=class extends Se{constructor(e,t){super(new Ve(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,S(e=this.h=new Tc,0,1,t=new q),this.v=new xc,S(this.h,0,3,this.v),this.j=new pc,S(this.h,0,2,this.j),st(this.j,4,1),v(this.j,2,.5),v(this.v,2,.5),v(this.h,4,.5)}get baseOptions(){return P(this.h,q,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numPoses"in e&&st(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&v(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&v(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&v(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,wl(this),$e(this,e,i),ml(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:i,wl(this),ct(this,e,n,t),ml(this)}m(){var e=new Ee;z(e,"image_in"),z(e,"norm_rect"),D(e,"normalized_landmarks"),D(e,"world_landmarks"),D(e,"segmentation_masks");const t=new Ie;Je(t,Nd,this.h);const r=new ye;Me(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),W(r,"IMAGE:image_in"),W(r,"NORM_RECT:norm_rect"),L(r,"NORM_LANDMARKS:normalized_landmarks"),L(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Le(e,r),Ui(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=qr(s),this.landmarks.push(Oi(i));x(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],x(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=_r(s),this.worldLandmarks.push(Yr(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(L(r,"SEGMENTATION_MASK:segmentation_masks"),Er(this,"segmentation_masks"),this.g.ba("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Tr(this,s,!0,!this.s)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.detectForVideo=Re.prototype.F,Re.prototype.detect=Re.prototype.D,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=function(e,t){return I(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return I(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return I(Re,e,t)},Re.POSE_CONNECTIONS=nl;const Xi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Dd="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Rd=()=>{const e=d.useRef(null),[t,r]=d.useState(!1),[i,n]=d.useState("Initializing..."),[s,a]=d.useState(0),[c,l]=d.useState(!1);d.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(w=>{console.log("ServiceWorker registered:",w)}).catch(w=>{console.log("ServiceWorker registration failed:",w)})},[]);const u=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(Xi)!==void 0:!1,h=async()=>{try{const w=await fetch(Xi),m=w.headers.get("content-length"),g=m?parseInt(m,10):0;if(!w.body)throw new Error("No response body");const b=w.body.getReader();let _=0;const p=[];for(;;){const{done:A,value:F}=await b.read();if(A)break;if(p.push(F),_+=F.length,g){const T=Math.round(_/g*100);a(T),n(`Downloading model... ${T}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(Xi,new Response(new Blob(p),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return d.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await u()?n("Using cached model..."):(n("Model not cached. Downloading..."),await h()),n("Loading MediaPipe WASM...");const g=await Xt.forVisionTasks(Dd);n("Creating face landmarker...");const b=await X.createFromOptions(g,{baseOptions:{modelAssetPath:Xi,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=b,r(!0),n("Model loaded successfully ✅")}catch(m){console.error("Model init error:",m),n(`Error: ${m==null?void 0:m.message}`),(m==null?void 0:m.name)==="NotAllowedError"&&l(!0)}})()},[]),{faceLandmarkerRef:e,isModelLoaded:t,statusMessage:i,setStatusMessage:n,loadingProgress:s,permissionDenied:c,clearCache:async()=>{"caches"in window&&(await caches.delete("mediapipe-models-v1"),n("Cache cleared. Please refresh to re-download models."))}}},Od=()=>{const[e,t]=d.useState(0),r=d.useRef({lastTime:0,frames:0,fps:0}),i=d.useCallback(()=>{const n=performance.now(),s=r.current;if(s.frames++,n-s.lastTime>=1e3){const a=Math.round(s.frames*1e3/(n-s.lastTime));t(a),s.frames=0,s.lastTime=n}},[]);return{fps:e,updateFPS:i}},Bd=()=>{const e=d.useRef({value:100,isLookingAway:!1}),t=d.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const u=s.getContext("2d");if(!u)return;const{width:h,height:f}=s;if(u.clearRect(0,0,h,f),u.drawImage(a,0,0,h,f),l){u.fillStyle="#00FF00";for(const w of c)u.fillRect(w.x*h-.5,w.y*f-.5,1,1)}},[]),r=d.useCallback(s=>{const a=e.current.value/100,c=100,l=20,u=20,h=40;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(u,h,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(u,h+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(u,h+c*(1-a),l,2)},[]),i=d.useCallback((s,a,c,l,u,h,f)=>{if(t(s,a,c,l),u&&h&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=d.useCallback((s,a)=>{const c=s.getContext("2d");c&&(c.clearRect(0,0,s.width,s.height),c.drawImage(a,0,0,s.width,s.height))},[]);return{drawLandmarks:t,drawEngagementBar:r,drawWithEngagementBar:i,clearCanvas:n,engagementRef:e}},Ud=50,Gd=()=>{const[e,t]=d.useState(100),[r,i]=d.useState(!1),n=d.useRef(0),s=d.useCallback((a,c,l)=>{if(!l||a.length<468)return;const u=a[33],h=a[263],f=a[1];if(!u||!h||!f)return;const w=(u.x+h.x)*.5,m=(u.y+h.y)*.5,g=w-c.x,b=m-c.y,_=Math.sqrt(g*g+b*b),p=Math.abs(f.y-c.noseY)*100,A=Math.abs(f.x-c.noseX)*100,F=Math.max(0,100-(_*200+p+A)),T=F<Ud,C=performance.now();return C-n.current>100&&(t(F),i(T),n.current=C),{engagement:F,isLookingAway:T}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Vd=.05,$d=()=>{const[e,t]=d.useState(!1),[r,i]=d.useState(!1),n=d.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=d.useCallback((c,l)=>{if(!c||!l)return 0;const u=[1,33,263,61,291,10,152];let h=0,f=0;const w=l[33],m=l[263],g=c[33],b=c[263];if(!w||!m||!g||!b)return 0;const _=n(w,m),p=n(g,b);if(_===0||p===0)return 0;for(const F of u){const T=l[F],C=c[F];if(T&&C){const M=w.x+(C.x-g.x)*_/p,B=w.y+(C.y-g.y)*_/p;h+=n(T,{x:M,y:B}),f++}}return f===0?0:h/f},[n]),a=d.useCallback((c,l,u,h)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(h("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&u){let f=null,w=0;for(const m of c.faceLandmarks)s(m,u)<Vd&&(f=m,w++);return w===1?(t(!1),i(!1),h("Reference face tracked."),f):w>1?(t(!0),i(!1),h("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),h("Reference face not detected."),null)}else{c.faceLandmarks.length>1?(t(!0),h("Multiple faces detected. Set reference for single face tracking.")):(t(!1),h("No reference set. Detecting first face."));const f=c.faceLandmarks[0];return!f||f.length<468?null:f}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},Wd=1e3,zd=(e,t)=>{const[r,i]=d.useState(!1),[n,s]=d.useState("face_detected"),{incrementGazeViolation:a}=Zs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:u}=e;d.useEffect(()=>{let w;return(u||c||l)&&t?w=setTimeout(()=>{i(!0),u?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},Wd):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[u,c,l,t,a]);const h=d.useCallback(()=>c?"multiple_faces":l?"no_face_detected":u?"looking_away":"face_detected",[c,l,u]),f=d.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:h,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class te extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Hd{constructor(t={}){Oe(this,"config");Oe(this,"mediaRecorder",null);Oe(this,"audioChunks",[]);Oe(this,"recordingStream",null);Oe(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(!this.isRecordingSupported())throw new te("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new te("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=s=>{var a;s.data.size>0&&(this.audioChunks.push(s.data),(a=r==null?void 0:r.onDataAvailable)==null||a.call(r,s.data))},this.mediaRecorder.onstop=()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},this.mediaRecorder.onerror=s=>{var c;const a=new te(`Recording failed: ${s.error}`,"RECORDING_ERROR",!0);(c=r==null?void 0:r.onError)==null||c.call(r,a),this.cleanup()},this.mediaRecorder.start(100),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new te("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new te("No microphone found","NO_MICROPHONE",!1)}throw new te(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new te("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new te("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const i=this.mediaRecorder,n=()=>{try{const s=i.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:s});this.cleanup(),t(a)}catch(s){r(new te(`Failed to create audio blob: ${s instanceof Error?s.message:String(s)}`,"BLOB_CREATION_FAILED",!1))}};i.addEventListener("stop",n,{once:!0}),i.stop()})}async transcribe(t){const{audioBlob:r}=t;if(!r||r.size===0)throw new te("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const i=new FormData,n=new File([r],"recording.wav",{type:r.type||"audio/wav"});if(i.append("file",n),i.append("qna_id",this.config.qnaId||""),!this.config.interviewId)throw new te("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await Bt(`${this.config.baseUrl}${Gt.TRANSCRIBE_ANSWER(this.config.interviewId)}`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:i},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!s.ok){const c=await s.text();let l=`STT request failed: ${s.status} ${s.statusText}`;try{const u=JSON.parse(c);l=u.message||u.error||l}catch{l=c||l}throw new te(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof te?i:new te(`Transcription failed: ${i instanceof Error?i.message:String(i)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const t=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const r of t)if(MediaRecorder.isTypeSupported(r))return r;return"audio/webm"}getRecordingStream(){return this.recordingStream}cleanup(){this.recordingStream&&(this.recordingStream.getTracks().forEach(t=>t.stop()),this.recordingStream=null),this.mediaRecorder=null,this.audioChunks=[],this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}}const Nr=new Hd,qd=(e,t,r,i)=>{const n=d.useRef(null);return d.useEffect(()=>{if(!t)return;const s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});e.current&&(e.current.srcObject=l,e.current.onloadeddata=()=>{r()})}catch(l){console.error("Camera access error:",l),i("Camera access failed")}},a=n.current,c=e.current;return s(),()=>{a&&cancelAnimationFrame(a),c!=null&&c.srcObject&&c.srcObject.getTracks().forEach(u=>u.stop())}},[t,r]),d.useEffect(()=>{const s=Nr.getRecordingStream();if(s&&e.current){e.current.srcObject=s;const a=s.getVideoTracks(),c=s.getAudioTracks(),l=()=>{console.log("Media track ended - permission may have been revoked")};[...a,...c].forEach(u=>{u.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},Yd=(e,t,r,i,n,s,a,c,l,u,h,f,w,m,g)=>{const b=d.useRef(null),_=d.useCallback(()=>{var T;const p=e.current,A=t.current,F=r.current;if(!p||p.readyState<2||!F||!A){b.current=requestAnimationFrame(_);return}i();try{const C=performance.now(),M=F.detectForVideo(p,C);if(((T=M.faceLandmarks)==null?void 0:T.length)>0){g(!1);const B=n(M,l,u.current,m);B?(s(A,p,B,h,f,w,l),l&&w&&c(B,u.current,w)):a(A,p)}else a(A,p),l?(g(!0),m("Reference face not detected.")):g(!1)}catch(C){console.error("Face detection error:",C)}b.current=requestAnimationFrame(_)},[e,t,r,i,n,s,a,c,l,u,h,f,w,m,g]);return{renderLoop:_,animationFrameRef:b}},Kd=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Zs(),c=d.useRef(s),l=d.useCallback(()=>{c.current=s},[s]),u=d.useCallback(()=>{var w;const h=e.current,f=t.current;if(console.log({faceLandmarker:h,video:f}),!(!h||!f))try{const m=performance.now(),g=h.detectForVideo(f,m);if((w=g.faceLandmarks)!=null&&w[0]){const b=g.faceLandmarks[0],_=b[33],p=b[263],A=b[1];_&&p&&A&&(c.current={x:(_.x+p.x)*.5,y:(_.y+p.y)*.5,noseX:A.x,noseY:A.y},a(!0,c.current),r("Reference set. Gaze tracking active."),console.log("Reference set. Gaze tracking active.",c.current),i&&i())}}catch(m){console.error("Set reference error:",m),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:u,syncReference:l}},gl=d.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n},s)=>{var El;const{authToken:a}=ro(),c=a?Wl(a):null,l=lo(),{borderRadius:u}=rr(),h=u??18,{proctoring:f}=cn(),w=!!(f!=null&&f.gazeAnalysisEnabled),[m,g]=d.useState(!1),[b,_]=d.useState((f==null?void 0:f.showLandmarks)??!1),[p,A]=d.useState(i&&((f==null?void 0:f.showEngagementBar)??!0)),[F,T]=d.useState(w),C=d.useRef(null),M=d.useRef(null),B=d.useRef(null),G=d.useRef(null),Q=d.useCallback(async ft=>{var tn;const Jr=C.current,ve=B.current;if(!Jr||!ve)return;const Cr=ve.getContext("2d");if(!Cr)return;ve.width=Jr.videoWidth,ve.height=Jr.videoHeight,Cr.save(),Cr.scale(-1,1),Cr.drawImage(Jr,-ve.width,0,ve.width,ve.height),Cr.restore();const Zr=await new Promise(er=>ve.toBlob(er,"image/jpeg"));if(Zr&&t)try{const er=`${ft}-${Date.now()}.jpeg`,_e=await l.requestScreenshotUploadUrl(t,er);_e.data&&_e.data.upload_url&&(await l.uploadScreenshot((tn=_e==null?void 0:_e.data)==null?void 0:tn.upload_url,Zr),_e.data.asset_id&&await l.confirmScreenshotUpload(_e.data.asset_id))}catch(er){console.error(`Failed to upload screenshot for ${ft}:`,er)}},[l,t]),{faceLandmarkerRef:oe,isModelLoaded:qe,statusMessage:de,setStatusMessage:Ye,loadingProgress:Te,permissionDenied:be,clearCache:kt}=Rd(),{fps:dt,updateFPS:ge}=Od(),{drawWithEngagementBar:Qt,clearCanvas:Ke,engagementRef:re}=Bd(),{engagement:Xe,isLookingAway:V,analyzeGaze:ht,setEngagement:j,setIsLookingAway:J}=Gd(),{multipleFacesDetected:Dt,referenceFaceNotDetected:Rt,analyzeFace:Jt,setMultipleFacesDetected:Ji,setReferenceFaceNotDetected:Zt}=$d(),{referenceSet:Qr,referenceRef:Zi,setReference:N,syncReference:je}=Kd(oe,C,Ye,n),rt={multipleFacesDetected:Dt,referenceFaceNotDetected:Rt,isLookingAway:V},{showGazeWarningModal:en,getWarningType:Ch,closeWarningModal:vl,setShowGazeWarningModal:_l,setFaceDetectionState:kl}=zd(rt,w),{renderLoop:Ih}=Yd(C,M,oe,ge,Jt,Qt,Ke,ht,Qr,Zi,b,p,w,Ye,Zt);qd(C,qe,Ih,Ye),d.useEffect(()=>{je()},[je]),d.useEffect(()=>{re&&re.current&&(re.current.value=Xe,re.current.isLookingAway=V)},[Xe,V,re]);const Mh=d.useCallback(ft=>{T(ft),ft||(j(100),J(!1))},[j,J]),Lh=d.useCallback(()=>{J(!1),Ji(!1),Zt(!1),kl("face_detected"),_l(!1),vl()},[J,Ji,Zt,kl,_l,vl]),Fh={engagement:Xe,fps:dt,isLookingAway:V,multipleFacesDetected:Dt,referenceFaceNotDetected:Rt};return d.useEffect(()=>{const ft=[];return(async()=>{try{const ve=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});G.current=ve,C.current&&(C.current.srcObject=ve);const Zr=(r??ti)*60*1e3/3,tn=[0,1,2].map((_e,Ot)=>({label:`capture-${Ot+1}`,start:Ot*Zr,end:(Ot+1)*Zr})),er=(_e,Ot)=>_e===Ot?_e:Math.random()*(Ot-_e)+_e;tn.forEach(({label:_e,start:Ot,end:Ph},Dh)=>{let Ys;Dh===0?Ys=3e3:Ys=er(Ot,Ph),ft.push(setTimeout(()=>{Q(_e)},Ys))})}catch(ve){console.error("Error accessing camera:",ve)}})(),()=>{G.current&&G.current.getTracks().forEach(ve=>ve.stop()),ft.forEach(clearTimeout)}},[Q]),d.useImperativeHandle(s,()=>({setReference:()=>{N()},stopCamera:()=>{G.current&&(G.current.getTracks().forEach(ft=>ft.stop()),G.current=null)}}),[N]),o.jsxs("div",{className:`iw-relative iw-h-full ${e}`,children:[be?o.jsxs("div",{className:"iw-rounded-md iw-border iw-border-red-600 iw-p-5 iw-text-red-600",children:[o.jsx("h2",{children:"Camera Permission Denied"}),o.jsx("p",{children:"Please allow camera access to use this application."})]}):o.jsx("div",{className:"iw-flex iw-w-full iw-h-full iw-flex-wrap iw-gap-5",children:o.jsxs("div",{className:"iw-relative iw-flex-1",children:[o.jsx("video",{ref:C,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),w&&o.jsx("canvas",{ref:M,width:320,height:240,className:"iw-absolute iw-top-0 iw-left-0 iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)",borderRadius:h}}),o.jsx("canvas",{ref:B,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:[o.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),o.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),i&&((El=c==null?void 0:c.data)==null?void 0:El.user_name)&&o.jsx("div",{className:"iw-absolute iw-z-50 iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-white",children:c.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(lu,{showControls:(f==null?void 0:f.showControls)??!1,isBubbleOpen:m,setIsBubbleOpen:g,setReference:N,clearCache:kt,isModelLoaded:qe,gazeAnalysisEnabled:F&&w,referenceSet:Qr,showLandmarks:b,setShowLandmarks:_,showEngagementBar:p,setShowEngagementBar:A,handleToggleGazeAnalysis:Mh,stats:Fh,statusMessage:de,loadingProgress:Te})})]})}),w&&en&&o.jsx(au,{isOpen:en,onClose:Lh,warningType:Ch()})]})}),Xd=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],Qd=({isOpen:e,onStart:t,onClose:r,gazeEnabled:i=!1,videoFeedRef:n,interviewId:s="",interview_duration:a=ti})=>{var ht;const c=d.useRef(null),l=d.useRef(null),{baseColor:u,borderRadius:h}=rr(),[f,w]=d.useState(!1),[m,g]=d.useState(!1),[b,_]=d.useState(!1),[p,A]=d.useState(!1),[F,T]=d.useState(!1),[C,M]=d.useState(null),[B,G]=d.useState(!1),Q=d.useRef(null),oe=d.useRef(null),qe=j=>{Q.current=j,n&&(typeof n=="function"?n(j):n.current=j)},de=u??"#2563eb",Ye=oo(de),Te=h??18,be=(j,J)=>j.startsWith("#")&&j.length===7?`${j}${J}`:j,kt=[`radial-gradient(120% 85% at 50% 125%, ${be(de,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${be(de,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${be(de,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${be(de,"14")} 0, ${be(de,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),dt=f?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:B?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},ge=f?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:B?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},Qt=[{label:"Camera feed",description:ge.cameraCopy,status:ge.badge,toneClass:ge.toneClass,Icon:co},{label:"Microphone input",description:ge.micCopy,status:ge.badge,toneClass:ge.toneClass,Icon:Hl}],Ke=()=>{l.current&&(l.current.getTracks().forEach(j=>j.stop()),l.current=null)},re=async()=>{G(!0),M(null);try{const j=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});l.current=j,c.current&&(c.current.srcObject=j),w(!0)}catch(j){console.error("Media permission error:",j);let J="Unable to access camera or microphone.";(j==null?void 0:j.name)==="NotAllowedError"?J="Permissions denied. Please allow access to camera and microphone.":(j==null?void 0:j.name)==="NotFoundError"?J="No camera/microphone found. Please connect a device and retry.":j!=null&&j.message&&(J=j.message),w(!1),M(J)}finally{G(!1)}};if(d.useEffect(()=>{if(!e){Ke();return}return re(),()=>Ke()},[e]),d.useEffect(()=>()=>{oe.current&&(clearInterval(oe.current),oe.current=null)},[]),!e)return null;const Xe=()=>{i?_(!0):(t(),Ke())},V=async()=>{A(!0);const j=()=>{var J;return(J=Q.current)==null?void 0:J.setReference()};j(),oe.current&&clearInterval(oe.current),oe.current=setInterval(j,500)};return o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4",children:[o.jsxs("div",{className:" iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]",children:[o.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:Ye},children:[o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),o.jsxs("div",{className:"iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner",children:o.jsx(ao,{className:"iw-h-6 iw-w-6"})}),o.jsxs("div",{children:[o.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),o.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),o.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),o.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:o.jsxs("div",{className:`iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${dt.toneClass}`,children:[o.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${dt.dotClass}`}),dt.label]})}),r&&o.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{Ke(),r==null||r()},children:"✕"})]})]}),o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[o.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[o.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:o.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),o.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),o.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:Xd.map((j,J)=>o.jsx("li",{className:"iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("span",{className:"iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",style:{background:Ye},children:J+1}),o.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:j})]})},j))})]})}),o.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:Te},children:[o.jsx("div",{className:"iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3",children:i&&(F||p)?o.jsx(gl,{ref:qe,interviewId:s,interview_duration:a,showProctoringUI:!1,onSetReference:()=>{oe.current&&(clearInterval(oe.current),oe.current=null),A(!1),t()}}):o.jsx("video",{ref:c,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:Te}})}),o.jsx("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:!b&&!F?o.jsxs(o.Fragment,{children:[o.jsx(no,{onClick:re,disabled:B,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:de,borderRadius:Te,color:de},children:f?"Recheck permissions":"Enable camera & mic"}),o.jsx(Qe,{onClick:Xe,disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:de},children:"Proceed"})]}):i&&(b&&!F?o.jsx(Qe,{onClick:()=>g(!0),disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:de},children:"Calibrate Face Position"}):o.jsxs(Qe,{onClick:V,disabled:p||!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:de},children:[p?"Calibrating":"Start Calibration",p&&o.jsx("span",{className:"iw-ml-2 iw-animate-spin iw-inline-block iw-border-2 iw-border-t-transparent iw-border-stone-200 iw-size-4 iw-rounded-full","aria-label":"loading"})]}))})]}),i&&F?o.jsxs("span",{className:"iw-text-slate-700 iw-text-center iw-text-md",children:["Sit upright and look directly into the camera, then press the",o.jsx("span",{className:"iw-font-semibold",children:" Start Calibration "}),"button. Proper calibration is required and incorrect setup may affect your assessment."]}):o.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:Qt.map(({Icon:j,label:J,description:Dt,status:Rt,toneClass:Jt})=>o.jsx("li",{className:"iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100",children:o.jsx(j,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[o.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:J}),o.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${Jt}`,children:Rt})]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:Dt})]})]})},J))}),C&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600",children:C}),!((ht=navigator.mediaDevices)!=null&&ht.getUserMedia)&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700",children:"Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox."})]})]}),o.jsx("div",{className:" iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center",children:o.jsx("div",{className:"iw-text-xs iw-text-slate-500",children:"Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards."})}),o.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:kt,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]}),o.jsx(Kl,{isOpen:m,onDecline:()=>g(!1),onContinue:()=>{g(!1),Ke(),T(!0)}})]})};var se=(e=>(e.IDLE="idle",e.FETCHING_QUESTION="fetching_question",e.READING_QUESTION="reading_question",e.THINKING="thinking",e.ANSWERING="answering",e.TRANSCRIBING="transcribing",e.EDITING="editing",e.SUBMITTING="submitting",e.COMPLETED="completed",e))(se||{});const Jd={thinkingDuration:30,answeringDuration:120,editingDuration:30},Zd={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class eh{constructor(t={},r={}){Oe(this,"config");Oe(this,"state");Oe(this,"phaseIntervalId",null);Oe(this,"globalIntervalId",null);Oe(this,"callbacks");this.config={...Jd,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const t=this.state.phase,r=Zd[t];if(!r)return;this.stopPhaseTimer(),this.state.phase=r.next;const i=this.getDurationForPhase(r.next);i>0?(this.state.currentPhaseTimeRemaining=i,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var t,r;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(r=(t=this.callbacks).onInterviewEnd)==null||r.call(t),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(t){switch(t){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var t,r;this.state.totalTimeElapsed++,(r=(t=this.callbacks).onTick)==null||r.call(t,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var t,r;(r=(t=this.callbacks).onPhaseChange)==null||r.call(t,this.state.phase,this.getState())}}function th(e={}){const{config:t={},callbacks:r={}}=e,i=d.useRef(null);i.current||(i.current=new eh(t,{}));const n=i.current,[s,a]=d.useState(n.getState()),c=d.useCallback(()=>{a(n.getState())},[n]);d.useEffect(()=>{const f={onPhaseChange:(w,m)=>{var g;c(),(g=r.onPhaseChange)==null||g.call(r,w,m)},onTick:w=>{var m;c(),(m=r.onTick)==null||m.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),d.useEffect(()=>()=>{n.destroy()},[n]);const l=d.useCallback(()=>{n.startQuestion(),c()},[n,c]),u=d.useCallback(()=>{n.nextPhase(),c()},[n,c]),h=d.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:u,completeInterview:h,timerService:n}}function rh(e,t={}){const[r,i]=d.useState({data:null,loading:!1,error:null}),n=d.useCallback(async(...s)=>{var a,c,l,u;i(h=>({...h,loading:!0,error:null}));try{const h=await e(...s);i(f=>({...f,data:h,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,h),(c=t.onSettled)==null||c.call(t,h,null)}catch(h){const f=h.type?h:{type:"unknown",message:h.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:h};i(w=>({...w,loading:!1,error:f})),(l=t.onError)==null||l.call(t,f),(u=t.onSettled)==null||u.call(t,null,f)}},[e,t]);return{...r,execute:n}}const ih=e=>{const[t,r]=d.useState(null),[i,n]=d.useState(!1),s=document,a=()=>!!(s.fullscreenEnabled||s.webkitFullscreenEnabled||s.mozFullScreenEnabled||s.msFullscreenEnabled),c=()=>s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement,l=async m=>{var g;try{if(!a())throw new Error("Fullscreen is not supported in this environment");m.requestFullscreen?await m.requestFullscreen():m.webkitRequestFullscreen?await m.webkitRequestFullscreen():m.mozRequestFullScreen?await m.mozRequestFullScreen():m.msRequestFullscreen&&await m.msRequestFullscreen()}catch(b){const _={name:"FullscreenError",message:b instanceof Error?b.message:"Failed to enter fullscreen"};r(_),(g=e==null?void 0:e.onError)==null||g.call(e,_)}},u=async()=>{var m;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(g){const b={name:"FullscreenError",message:g instanceof Error?g.message:"Failed to exit fullscreen"};r(b),(m=e==null?void 0:e.onError)==null||m.call(e,b)}},h=d.useCallback(()=>{var g;const m=!!c();n(m),(g=e==null?void 0:e.onFullScreenChange)==null||g.call(e,m)},[e]);d.useEffect(()=>{const m=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return m.forEach(g=>{document.addEventListener(g,h)}),()=>{m.forEach(g=>{document.removeEventListener(g,h)})}},[h]);const f=async m=>{r(null);const g=m??document.documentElement;await l(g)};return{isFullScreen:i,toggleFullScreen:async m=>{i?await u():await f(m)},enterFullScreen:f,exitFullScreen:u,error:t}},nh=e=>{d.useEffect(()=>{const t=i=>{(i.ctrlKey||i.metaKey)&&["c","v","a","t","n","w","r","s","p"].includes(i.key.toLowerCase())&&(i.preventDefault(),e({type:"blocked_shortcut",severity:"low",details:{action:"shortcut_pressed",reason:`Attempted to use a blocked keyboard shortcut: Ctrl + ${i.key}`}})),i.key.startsWith("F")&&i.key.length<=3&&(i.preventDefault(),e({type:"blocked_function_key",severity:"low",details:{action:"function_key_pressed",reason:`Attempted to use a blocked function key: ${i.key}`}})),i.altKey&&i.key==="Tab"&&(i.preventDefault(),e({type:"alt_tab_attempt",severity:"medium",details:{action:"alt_tab",reason:"Attempted to use the Alt + Tab shortcut"}}))},r=i=>{i.preventDefault(),e({type:"right_click_attempt",severity:"low",details:{action:"right_click",reason:"Attempted to use the right click"}})};return document.addEventListener("keydown",t),document.addEventListener("contextmenu",r),()=>{document.removeEventListener("keydown",t),document.removeEventListener("contextmenu",r)}},[e])},sh=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),[c,l]=d.useState(null),[u,h]=d.useState(null);e.config&&Nr.updateConfig(e.config);const f=d.useCallback(async b=>{var _;try{l(null),a(null),h(null),await Nr.startRecording(b,{onStart:()=>{var p;r(!0),(p=e.onStart)==null||p.call(e)},onStop:()=>{var p;r(!1),(p=e.onStop)==null||p.call(e)},onError:p=>{var F;const A=p instanceof te?p:new te(p.message,"RECORDING_ERROR",!0);l(A),r(!1),(F=e.onError)==null||F.call(e,A)}})}catch(p){const A=p instanceof te?p:new te(p instanceof Error?p.message:String(p),"START_FAILED",!1);throw l(A),r(!1),(_=e.onError)==null||_.call(e,A),A}},[]),w=d.useCallback(async()=>{var b,_;try{const p=await Nr.stopRecording();return h(p),r(!1),(b=e.onStop)==null||b.call(e),p}catch(p){const A=p instanceof te?p:new te(p instanceof Error?p.message:String(p),"STOP_FAILED",!1);throw l(A),r(!1),(_=e.onError)==null||_.call(e,A),A}},[]),m=d.useCallback(async(b,_={})=>{var p,A;try{l(null),n(!0);const F={audioBlob:b,..._},T=await Nr.transcribe(F);return a(T.transcript),n(!1),(p=e.onTranscriptionComplete)==null||p.call(e,T),T}catch(F){const T=F instanceof te?F:new te(F instanceof Error?F.message:String(F),"TRANSCRIPTION_FAILED",!0);throw l(T),n(!1),(A=e.onError)==null||A.call(e,T),T}},[]),g=d.useCallback(()=>{Nr.cancelRecording(),r(!1),h(null)},[]);return{startRecording:f,stopRecording:w,transcribe:m,cancelRecording:g,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:u}},oh=e=>{const t=d.useRef(null),r=d.useRef(!1);d.useEffect(()=>{const i=()=>{document.hidden&&(r.current=!0,t.current&&(clearTimeout(t.current),t.current=null),e({type:"tab_switch",severity:"high",details:{action:"tab_hidden",reason:"Attempted to switch tabs or applications"}}),setTimeout(()=>{r.current=!1},100))},n=()=>{r.current||(t.current=setTimeout(()=>{r.current||e({type:"focus_loss",severity:"medium",details:{action:"window_blur",reason:"Focus lost from the interview window"}}),t.current=null},50))};return document.addEventListener("visibilitychange",i),window.addEventListener("blur",n),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("blur",n),t.current&&clearTimeout(t.current)}},[e])},ah=()=>{d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
24
24
  * {
25
25
  -webkit-user-select: none !important;
26
26
  -moz-user-select: none !important;