@idscan/idvc2 2.1.6 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/idvc.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see idvc.js.LICENSE.txt */
2
+ var e,t,n={6810:(e,t,n)=>{n.d(t,{Af:()=>V,QC:()=>ne,kS:()=>ae,lz:()=>r,nd:()=>i.nd,ic:()=>re,yO:()=>se,fZ:()=>s});var r={};n.r(r),n.d(r,{bindVertexProgramAttributeStreams:()=>D,createBufferFromOutputTexture:()=>P,createFloat16MatrixTexture:()=>C,createFloat16PackedMatrixTexture:()=>R,createFloat32MatrixTexture:()=>S,createIndexBuffer:()=>v,createPackedMatrixTexture:()=>N,createUnsignedBytesMatrixTexture:()=>k,createVertexBuffer:()=>x,createVertexShader:()=>b,downloadByteEncodedFloatMatrixFromOutputTexture:()=>F,downloadFloat32MatrixFromBuffer:()=>$,downloadMatrixFromPackedOutputTexture:()=>L,downloadPackedMatrixFromBuffer:()=>_,getInternalFormatForFloat16MatrixTexture:()=>A,getInternalFormatForFloat16PackedMatrixTexture:()=>B,getInternalFormatForFloat32MatrixTexture:()=>T,getInternalFormatForPackedMatrixTexture:()=>E,getInternalFormatForUnsignedBytesMatrixTexture:()=>I,uploadDenseMatrixToTexture:()=>M,uploadPixelDataToTexture:()=>O});var a=n(2579),s=n(1906);const o=(0,a.OBj)();o.registerFlag("HAS_WEBGL",(()=>o.getNumber("WEBGL_VERSION")>0)),o.registerFlag("WEBGL_VERSION",(()=>(0,s.isWebGLVersionEnabled)(2)?2:(0,s.isWebGLVersionEnabled)(1)?1:0)),o.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",(()=>!1)),o.registerFlag("WEBGL_BUFFER_SUPPORTED",(()=>2===o.get("WEBGL_VERSION"))),o.registerFlag("WEBGL_CPU_FORWARD",(()=>!0)),o.registerFlag("WEBGL_FORCE_F16_TEXTURES",(()=>!1)),o.registerFlag("WEBGL_PACK",(()=>o.getBool("HAS_WEBGL"))),o.registerFlag("WEBGL_PACK_NORMALIZATION",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_CLIP",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_DEPTHWISECONV",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_REDUCE",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_LAZILY_UNPACK",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_CONV_IM2COL",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(()=>(0,s.getWebGLMaxTextureSize)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(()=>(0,s.getMaxTexturesInShader)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(()=>{const e=o.getNumber("WEBGL_VERSION");return 0===e?0:(0,s.getWebGLDisjointQueryTimerVersion)(e)})),o.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(()=>o.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!a.C2$.isMobile())),o.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(()=>(0,s.isCapableOfRenderingToFloatTexture)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(()=>!o.getBool("WEBGL_FORCE_F16_TEXTURES")&&o.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))),o.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(()=>(0,s.isDownloadFloatTextureEnabled)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_FENCE_API_ENABLED",(()=>(0,s.isWebGLFenceEnabled)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(()=>o.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0)),o.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",(()=>-1),(e=>{if(e<0&&-1!==e)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)})),o.registerFlag("WEBGL_FLUSH_THRESHOLD",(()=>a.C2$.isMobile()?1:-1),(e=>{if(e<0&&-1!==e)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)})),o.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",(()=>128)),o.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",(()=>!1)),o.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",(()=>1e5)),o.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",(()=>128)),o.registerFlag("WEBGL_EXP_CONV",(()=>!1)),o.registerFlag("SOFTWARE_WEBGL_ENABLED",(()=>o.getBool("IS_TEST"))),o.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",(()=>1/0)),o.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",(()=>!1)),o.registerFlag("WEBGL2_ISNAN_CUSTOM",(()=>!1));var i=n(740),l=n(9610),u=n(6697),c=n(8110),d=n(8378);class p{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=d.m1.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=(0,l.A)();this.outputShape=e,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length),this.userCode=`\n ivec3 outCoordsFromFlatIndex(int index) {\n ${this.enableShapeUniforms?c.Kn(["r","c","d"],e):c.RW(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ${t.output} = result;\n }\n `}}class h{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=d.m1.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=(0,l.A)();this.outputShape=e,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length),this.userCode=`\n ivec3 outCoordsFromFlatIndex(int index) {\n ${this.enableShapeUniforms?c.Kn(["r","c","d"],e):c.RW(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ${t.output} = result;\n }\n `}}class f{constructor(e){this.variableNames=["A"],this.outTexUsage=d.v2.DOWNLOAD;const t=(0,l.A)();this.outputShape=e,this.userCode=`\n ${c.ye}\n\n void main() {\n float x = getAAtOutCoords();\n ${t.output} = encode_float(x);\n }\n `}}class m{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=d.v2.DOWNLOAD;const t=(0,l.A)();this.outputShape=e,this.userCode=`\n ${c.ye}\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ${t.output} = encode_float(x);\n }\n `}}class g{constructor(e,t=!1){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=(0,l.A)();this.outputShape=e,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length);let r="result";t&&(r="floor(result * 255. + 0.5)"),this.userCode=`\n ${this.enableShapeUniforms?c.nc():c.ku(e)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ${n.texture2D}(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n ${n.output} = vec4(${r}, 0., 0., 0.);\n }\n `}}class y{constructor(e,t=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=(0,l.A)();this.outputShape=e,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length);let r="",a="result";t&&(a="floor(result * 255. + 0.5)");for(let t=0;t<=1;t++)for(let a=0;a<=1;a++){const s=2*t+a;r+=`\n localCoords = coords;\n if(localCoords[2] + ${a} < ${this.enableShapeUniforms?"outShape[2]":`${e[2]}`}) {\n localCoords[2] += ${a};\n if (localCoords[1] + ${t} < ${this.enableShapeUniforms?"outShape[1]":`${e[1]}`}) {\n localCoords[1] += ${t};\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ${n.texture2D}(A, uv);\n\n if (offset == 0) {\n result[${s}] = values[0];\n } else if (offset == 1) {\n result[${s}] = values[1];\n } else if (offset == 2) {\n result[${s}] = values[2];\n } else {\n result[${s}] = values[3];\n }\n }\n }\n `}this.userCode=`\n ${this.enableShapeUniforms?c.nc():c.ku(e)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ${r}\n\n ${n.output} = ${a};\n }\n `}}function b(e){const t=(0,l.A)(),n=`${t.version}\n precision highp float;\n ${t.attribute} vec3 clipSpacePos;\n ${t.attribute} vec2 uv;\n ${t.varyingVs} vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }`;return s.createVertexShader(e,n)}function x(e){const t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return s.createStaticVertexBuffer(e,t)}function v(e){const t=new Uint16Array([0,1,2,2,1,3]);return s.createStaticIndexBuffer(e,t)}function w(e,t,n,r,o,i){s.validateTextureSize(t,n);const l=s.createTexture(e),u=e.TEXTURE_2D;return s.callAndCheck(e,(()=>e.bindTexture(u,l))),s.callAndCheck(e,(()=>e.texParameteri(u,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE))),s.callAndCheck(e,(()=>e.texParameteri(u,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE))),s.callAndCheck(e,(()=>e.texParameteri(u,e.TEXTURE_MIN_FILTER,e.NEAREST))),s.callAndCheck(e,(()=>e.texParameteri(u,e.TEXTURE_MAG_FILTER,e.NEAREST))),1===(0,a.OBj)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texImage2D(u,0,r,t,n,0,o,i,null))):s.callAndCheck(e,(()=>e.texStorage2D(u,1,r,t,n))),s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null))),{texture:l,texShape:[n,t]}}function T(e){return e.internalFormatFloat}function S(e,t,n,r){const[a,s]=d.kk(t,n);return w(e,a,s,T(r),r.textureFormatFloat,e.FLOAT)}function A(e){return e.internalFormatHalfFloat}function C(e,t,n,r){const[a,s]=d.kk(t,n);return w(e,a,s,A(r),r.textureFormatFloat,r.textureTypeHalfFloat)}function I(e){return e.downloadTextureFormat}function k(e,t,n,r){const[a,s]=d.kk(t,n);return w(e,a,s,I(r),e.RGBA,e.UNSIGNED_BYTE)}function E(e){return e.internalFormatPackedFloat}function N(e,t,n,r){const[a,s]=d.qe(t,n);return w(e,a,s,E(r),e.RGBA,e.FLOAT)}function B(e){return e.internalFormatPackedHalfFloat}function R(e,t,n,r){const[a,s]=d.qe(t,n);return w(e,a,s,B(r),e.RGBA,r.textureTypeHalfFloat)}function D(e,t,n){s.callAndCheck(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n)));return s.bindVertexBufferToProgramAttribute(e,t,"clipSpacePos",n,3,20,0)&&s.bindVertexBufferToProgramAttribute(e,t,"uv",n,2,20,12)}function M(e,t,n,r,o,i){let l,u,c;s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),o instanceof Uint8Array?(l=new Uint8Array(n*r*4),u=e.UNSIGNED_BYTE,c=e.RGBA):(l=new Float32Array(n*r*4),u=e.FLOAT,c=i.internalFormatPackedFloat),l.set(o),2===(0,a.OBj)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,e.RGBA,u,l))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,c,n,r,0,e.RGBA,u,l))),s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))}function O(e,t,n){s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),n.data instanceof Uint8Array?2===(0,a.OBj)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data))):2===(0,a.OBj)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n))),s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))}function P(e,t,n,r){const a=e.createBuffer();s.callAndCheck(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,a)));const o=16*t*n;return s.callAndCheck(e,(()=>e.bufferData(e.PIXEL_PACK_BUFFER,o,e.STREAM_READ))),s.callAndCheck(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0))),s.callAndCheck(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null))),a}function $(e,t,n){const r=e,a=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),a}function F(e,t,n,r){const[a,o]=d.kk(t,n),i=new Uint8Array(d.yb(t*n,4));return s.callAndCheck(e,(()=>e.readPixels(0,0,a,o,r.downloadTextureFormat,e.UNSIGNED_BYTE,i))),new Float32Array(i.buffer)}function _(e,t,n,r,a,s,o,i){const l=e,u=new Float32Array(d.Se(s,o));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}function L(e,t,n){const r=new Float32Array(t*n*4);return s.callAndCheck(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r))),r}class V{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];const t=(0,a.OBj)().getNumber("WEBGL_VERSION");null!=e?(this.gl=e,(0,i.nd)(t,e)):this.gl=(0,i.jl)(t);let n="WEBGL_color_buffer_float";const r="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),1===(0,a.OBj)().getNumber("WEBGL_VERSION")){const e="OES_texture_float",t="OES_texture_half_float";if(this.textureFloatExtension=s.getExtensionOrThrow(this.gl,e),s.hasExtension(this.gl,t))this.textureHalfFloatExtension=s.getExtensionOrThrow(this.gl,t);else if((0,a.OBj)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),s.hasExtension(this.gl,r))this.colorBufferHalfFloatExtension=s.getExtensionOrThrow(this.gl,r);else if((0,a.OBj)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",s.hasExtension(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!s.hasExtension(this.gl,r))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(r)}this.vertexBuffer=x(this.gl),this.indexBuffer=v(this.gl),this.framebuffer=s.createFramebuffer(this.gl),this.textureConfig=d.Sq(this.gl,this.textureHalfFloatExtension)}get debug(){return(0,a.OBj)().getBool("DEBUG")}dispose(){if(this.disposed)return;null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");const e=this.gl;s.callAndCheck(e,(()=>e.finish())),s.callAndCheck(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),s.callAndCheck(e,(()=>e.deleteFramebuffer(this.framebuffer))),s.callAndCheck(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,null))),s.callAndCheck(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null))),s.callAndCheck(e,(()=>e.deleteBuffer(this.indexBuffer))),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),S(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),C(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),k(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),O(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,r){this.throwIfDisposed(),M(this.gl,e,t,n,r,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),R(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),N(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(s.unbindColorTextureFromFramebuffer(this.gl,this.framebuffer),this.outputTexture=null),s.callAndCheck(this.gl,(()=>this.gl.deleteTexture(e)))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>F(this.gl,t,n,this.textureConfig)))}downloadPackedMatrixFromBuffer(e,t,n,r,a,s){return _(this.gl,e,0,0,0,a,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return $(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);const r=P(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if((0,a.OBj)().getBool("WEBGL_FENCE_API_ENABLED")){const r=e,a=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{const e=r.clientWaitSync(a,0,0);return e===r.ALREADY_SIGNALED||e===r.CONDITION_SATISFIED},t=a}else(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>L(this.gl,t,n)))}createProgram(e){this.throwIfDisposed();const t=this.gl;null==this.vertexShader&&(this.vertexShader=b(t));const n=s.createProgram(t);return s.callAndCheck(t,(()=>t.attachShader(n,this.vertexShader))),s.callAndCheck(t,(()=>t.attachShader(n,e))),s.linkProgram(t,n),this.debug&&s.validateProgram(t,n),this.vertexAttrsAreBound||(this.setProgram(n),this.vertexAttrsAreBound=D(t,this.program,this.vertexBuffer)),n}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&s.callAndCheck(this.gl,(()=>this.gl.deleteProgram(e)))}setProgram(e){this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&s.validateProgram(this.gl,this.program),s.callAndCheck(this.gl,(()=>this.gl.useProgram(e)))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?s.getProgramUniformLocationOrThrow(this.gl,e,t):s.getProgramUniformLocation(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),s.callAndCheck(this.gl,(()=>this.gl.getAttribLocation(e,t)))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),s.bindTextureToProgramUniformSampler(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();const[r,a]=d.qe(t,n);this.setOutputMatrixTextureDriver(e,r,a)}setOutputMatrixWriteRegion(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)}setOutputPackedMatrixWriteRegion(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){null!=this.program&&s.validateProgram(this.gl,this.program),s.validateFramebuffer(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;this.debug&&this.debugValidate(),s.callAndCheck(e,(()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),s.callAndCheck(this.gl,(()=>this.gl.finish()))}getQueryTimerExtension(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=s.getExtensionOrThrow(this.gl,2===(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(2===(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(2===(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2();return void e.endQuery(t.TIME_ELAPSED_EXT)}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await a.D5U.repeatedTry((()=>this.disposed||this.isQueryAvailable(e,(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")))),this.getQueryTime(e,(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(0===t)return null;if(2===t){const t=this.gl;return t.getQueryParameter(e,t.QUERY_RESULT)/1e6}{const t=this.getQueryTimerExtensionWebGL1();return t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(0===t)return!0;if(2===t){const t=this.gl,n=this.getQueryTimerExtensionWebGL2(),r=t.getQueryParameter(e,t.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),r&&!this.disjoint}{const t=this.getQueryTimerExtensionWebGL1(),n=t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(t.GPU_DISJOINT_EXT)),n&&!this.disjoint}}pollFence(e){return new Promise((t=>{this.addItemToPoll((()=>e.isFencePassed()),(()=>t()))}))}pollItems(){const e=function(e){let t=0;for(;t<e.length;++t){if(!e[t]())break}return t-1}(this.itemsToPoll.map((e=>e.isDoneFn)));for(let t=0;t<=e;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let n;"setTimeoutCustom"in(0,a.OBj)().platform&&(n=(0,a.OBj)().platform.setTimeoutCustom.bind((0,a.OBj)().platform)),a.D5U.repeatedTry((()=>(this.pollItems(),0===this.itemsToPoll.length)),(()=>0),null,n)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),s.bindColorTextureToFramebuffer(this.gl,e,this.framebuffer),this.debug&&s.validateFramebuffer(this.gl)}unbindTextureToFrameBuffer(){null!=this.outputTexture?(s.bindColorTextureToFramebuffer(this.gl,this.outputTexture,this.framebuffer),this.debug&&s.validateFramebuffer(this.gl)):s.unbindColorTextureFromFramebuffer(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();const r=this.gl;s.bindColorTextureToFramebuffer(r,e,this.framebuffer),this.debug&&s.validateFramebuffer(r),this.outputTexture=e,s.callAndCheck(r,(()=>r.viewport(0,0,t,n))),s.callAndCheck(r,(()=>r.scissor(0,0,t,n)))}setOutputMatrixWriteRegionDriver(e,t,n,r){this.throwIfDisposed(),s.callAndCheck(this.gl,(()=>this.gl.scissor(e,t,n,r)))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(null==this.program)throw new Error("No GPU program is currently set.")}}var U=n(2512),G=n(1034),W=n(5156);class z{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length),0===this.rank)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{const e=(0,G.Ky)("rc",this.rank),t=(0,W.kW)(this.rank),n=this.getOutOfBoundsCondition(e),r=this.getSetup(e),a=this.getOutput(e);this.userCode=`\n void main() {\n ${t} rc = getOutputCoords();\n\n if(${n}) {\n setOutput(vec4(0));\n } else {\n ${r}\n\n setOutput(vec4(${a}));\n }\n }\n `}}getSourceCoordsArr(e){const t=[];for(let n=0;n<=1;n++)for(let r=0;r<=1;r++){let a=`${0===n?"r":"rp1"}, ${0===r?"c":"cp1"}`;for(let t=2;t<this.rank;t++)a=`${e[e.length-1-t]},`+a;t.push(a)}return t}getOutOfBoundsCondition(e){if(1===this.rank)return`rc > ${this.enableShapeUniforms?"outShape":this.outputShape[0]}`;let t="";for(let n=this.rank-2;n<this.rank;n++)t+=`${e[n]} >= ${this.enableShapeUniforms?`outShape[${n}]`:this.outputShape[n]}`,n<this.rank-1&&(t+="||");return t}getSetup(e){if(1===this.rank)return"";const t=e.slice(-2),n=this.enableShapeUniforms?`outShape[${this.rank} - 1]`:this.outputShape[this.rank-1],r=this.enableShapeUniforms?`outShape[${this.rank} - 2]`:this.outputShape[this.rank-2];return`\n int r = ${t[0]};\n int c = ${t[1]};\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ${n};\n bool rEdge = rp1 >= ${r};\n `}getOutput(e){const t=this.getSourceCoordsArr(e);if(1===this.rank){return`getA(rc), (rc + 1 >= ${this.enableShapeUniforms?"outShape":this.outputShape[0]} ? 0. : getA(rc + 1)), 0, 0`}return`getA(${t[0]}),\n cEdge ? 0. : getA(${t[1]}),\n rEdge ? 0. : getA(${t[2]}),\n rEdge || cEdge ? 0. : getA(${t[3]})`}}var H=n(8831);class Z{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}acquireTexture(e,t,n){const r=X(t,n),a=K(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);const s=j(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();const e=this.freeTextures[a].shift();return this.usedTextures[a].push(e),e}let o;return r===d.V9.PACKED_2X2_FLOAT32?o=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===d.V9.PACKED_2X2_FLOAT16?o=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===d.V9.UNPACKED_FLOAT32?o=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===d.V9.UNPACKED_FLOAT16?o=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===d.V9.PACKED_4X1_UNSIGNED_BYTE&&(o=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(o),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),o}releaseTexture(e,t,n,r){if(null==this.freeTextures)return;const s=X(n,r),o=K(t,s,r);o in this.freeTextures||(this.freeTextures[o]=[]);const i=j(t,s,this.gpgpu.gl,this.gpgpu.textureConfig,r),l=(0,a.OBj)().get("WEBGL_DELETE_TEXTURE_THRESHOLD");-1!==l&&this._numBytesAllocated>l?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=i):(this.freeTextures[o].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;const u=this.usedTextures[o],c=u.indexOf(e);if(c<0)throw new Error("Cannot release a texture that was never provided by this texture manager");u.splice(c,1),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);const t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(null!=this.freeTextures){for(const e in this.freeTextures)this.freeTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));for(const e in this.usedTextures)this.usedTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function j(e,t,n,r,a){const s=function(e,t){switch(e){case d.V9.PACKED_2X2_FLOAT32:return E(t);case d.V9.PACKED_2X2_FLOAT16:return B(t);case d.V9.UNPACKED_FLOAT32:return T(t);case d.V9.UNPACKED_FLOAT16:return A(t);case d.V9.PACKED_4X1_UNSIGNED_BYTE:return I(t);default:throw new Error(`Unknown physical texture type ${e}`)}}(t,r);let o;if(a){const[t,n]=(0,d.qe)(e[0],e[1]);o=t*n}else{const[t,n]=(0,d.kk)(e[0],e[1]);o=t*n}const i=function(e,t){const n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error(`Unknown internal format ${t}`)}(n,s);return o*i}function X(e,t){if(e===d.v2.UPLOAD)return d.V9.PACKED_2X2_FLOAT32;if(e===d.v2.RENDER||null==e)return function(e){return(0,a.OBj)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?d.V9.PACKED_2X2_FLOAT32:d.V9.UNPACKED_FLOAT32:e?d.V9.PACKED_2X2_FLOAT16:d.V9.UNPACKED_FLOAT16}(t);if(e===d.v2.DOWNLOAD||e===d.v2.PIXELS)return d.V9.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function K(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var q=n(4518),Q=n(9365);class Y{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=(0,u.C9)(this.outputShape.length);const t=e.length,n=(0,G.Ky)("rc",t),r=(0,W.kW)(t),a=(0,G.Qc)(t,n),s=n.slice(-2),o=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=`\n void main() {\n ${r} rc = getOutputCoords();\n vec4 packedInput = getA(${a});\n\n setOutput(getChannel(packedInput, ${o}));\n }\n `}}const J=a.GDt.whereImpl,ee={};const te=(0,a.OBj)().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");class ne extends a.Zuw{constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!(0,a.OBj)().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(null!=e){if(e instanceof V)t=e;else{const n=(0,i.jl)((0,a.OBj)().getNumber("WEBGL_VERSION"),e);t=new V(n)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const e=(0,i.jl)((0,a.OBj)().getNumber("WEBGL_VERSION"));t=new V(e),this.binaryCache=((n=(0,a.OBj)().getNumber("WEBGL_VERSION"))in ee||(ee[n]={}),ee[n]),this.gpgpuCreatedLocally=!0}var n;this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new Z(this.gpgpu),this.numMBBeforeWarning=null==(0,a.OBj)().global.screen?1024:(0,a.OBj)().global.screen.height*(0,a.OBj)().global.screen.width*window.devicePixelRatio*600/1024/1024,this.texData=new a.JLz(this,(0,a.SRH)())}nextDataId(){return ne.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if(((0,a.OBj)().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||(0,a.OBj)().getBool("DEBUG"))&&this.checkNumericalProblems(e),"complex64"===n&&null!=e)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const r={id:this.nextDataId()};return this.texData.set(r,{shape:t,dtype:n,values:e,usage:d.v2.UPLOAD,refCount:1}),r}refCount(e){if(this.texData.has(e)){return this.texData.get(e).refCount}return 0}incRef(e){this.texData.get(e).refCount++}decRef(e){if(this.texData.has(e)){this.texData.get(e).refCount--}}move(e,t,n,r,s){if((0,a.OBj)().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===r)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:r,values:t,usage:d.v2.UPLOAD,refCount:s})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const t=this.texData.get(e),{values:n,dtype:r,complexTensorInfos:s,slice:o,shape:i,isPacked:l}=t;if(null!=o){let t;t=l?new Q.cc(i,q.bl):new q.l(i,q.bl);const n=this.runWebGLProgram(t,[{dataId:e,shape:i,dtype:r}],r),a=this.readSync(n.dataId);return this.disposeIntermediateTensorInfo(n),a}if(null!=n)return this.convertAndCacheOnCPU(e);if("string"===r)return n;const u=null!=this.activeTimers;let c,d;if(u&&(c=a.D5U.now()),"complex64"===r){const e=this.readSync(s.real.dataId),t=this.readSync(s.imag.dataId);d=a.Wap.mergeRealAndImagArrays(e,t)}else d=this.getValuesFromTexture(e);return u&&(this.downloadWaitMs+=a.D5U.now()-c),this.convertAndCacheOnCPU(e,d)}async read(e){if(this.pendingRead.has(e)){const t=this.pendingRead.get(e);return new Promise((e=>t.push(e)))}const t=this.texData.get(e),{values:n,shape:r,slice:o,dtype:i,complexTensorInfos:l,isPacked:u}=t;if(null!=o){let t;t=u?new Q.cc(r,q.bl):new q.l(r,q.bl);const n=this.runWebGLProgram(t,[{dataId:e,shape:r,dtype:i}],i),a=this.read(n.dataId);return this.disposeIntermediateTensorInfo(n),a}if(null!=n)return this.convertAndCacheOnCPU(e);if((0,a.OBj)().getBool("DEBUG")&&!(0,a.OBj)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===(0,a.OBj)().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let c,p,h=null;if("complex64"!==i&&(0,a.OBj)().get("WEBGL_BUFFER_SUPPORTED")){c=this.decode(e);const t=this.texData.get(c.dataId);h=this.gpgpu.createBufferFromTexture(t.texture.texture,...d.Yz(r))}if(this.pendingRead.set(e,[]),"complex64"!==i&&await this.gpgpu.createAndWaitForFence(),"complex64"===i){const e=await Promise.all([this.read(l.real.dataId),this.read(l.imag.dataId)]),t=e[0],n=e[1];p=a.Wap.mergeRealAndImagArrays(t,n)}else if(null==h)p=this.getValuesFromTexture(e);else{const e=a.D5U.sizeFromShape(r);p=this.gpgpu.downloadFloat32MatrixFromBuffer(h,e)}if(null!=c&&this.disposeIntermediateTensorInfo(c),null!=h){const e=this.gpgpu.gl;s.callAndCheck(e,(()=>e.deleteBuffer(h)))}const f=this.convertAndCacheOnCPU(e,p),m=this.pendingRead.get(e);return this.pendingRead.delete(e),m.forEach((e=>e(f))),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&(0,a.SRH)().removeDataId(e,this),this.pendingDeletes--),f}readToGPU(e,t={}){const n=this.texData.get(e),{values:r,shape:s,slice:o,dtype:i,isPacked:l,texture:u}=n;if("complex64"===i)throw new Error("Does not support reading texture for complex64 dtype.");if(null!=o){let n;n=l?new Q.cc(s,q.bl):new q.l(s,q.bl);const r=this.runWebGLProgram(n,[{dataId:e,shape:s,dtype:i}],i),a=this.readToGPU(r,t);return this.disposeIntermediateTensorInfo(r),a}if(null==u)throw null!=r?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const c=this.decode(e,t.customTexShape),d=(0,a.SRH)().makeTensorFromTensorInfo(c),p=this.texData.get(c.dataId);return Object.assign({tensorRef:d},p.texture)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map((e=>a.D5U.decodeString(e)));return(0,a.f3b)(e.shape,e.dtype,n)}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return(0,a.f3b)(e.shape,e.dtype,t)}checkNumericalProblems(e){if(null!=e)for(let t=0;t<e.length;t++){const n=e[t];if(!s.canBeRepresented(n)){if((0,a.OBj)().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error(`The value ${n} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`);throw Error(`The value ${n} cannot be represented on this device.`)}}}getValuesFromTexture(e){const{shape:t,dtype:n,isPacked:r}=this.texData.get(e),o=a.D5U.sizeFromShape(t);if((0,a.OBj)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const n=this.decode(e),r=this.texData.get(n.dataId),a=this.gpgpu.downloadMatrixFromPackedTexture(r.texture.texture,...d.Yz(t)).subarray(0,o);return this.disposeIntermediateTensorInfo(n),a}const i=(0,a.OBj)().getBool("WEBGL_PACK")&&!0===r,l=i?s.getShapeAs3D(t):t,u=i?new m(l):new f(l),c=this.runWebGLProgram(u,[{shape:l,dtype:n,dataId:e}],"float32"),p=this.texData.get(c.dataId),h=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(p.texture.texture,p.texShape[0],p.texShape[1]).subarray(0,o);return this.disposeIntermediateTensorInfo(c),h}timerAvailable(){return(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(e){const t=this.activeTimers,n=[];let r=!1;null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,e();const s=a.D5U.flatten(this.activeTimers.map((e=>e.query))).filter((e=>null!=e)),o=a.D5U.flatten(this.activeTimers.map((e=>e.name))).filter((e=>null!=e));this.activeTimers=t,r&&(this.programTimersStack=null);const i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if((0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const e=await Promise.all(s);i.kernelMs=a.D5U.sum(e),i.getExtraProfileInfo=()=>e.map(((e,t)=>({name:o[t],ms:e}))).map((e=>`${e.name}: ${e.ms}`)).join(", ")}else i.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,i})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:a.D5U.now(),endMs:null}}endTimer(e){return(0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=a.D5U.now(),e)}async getQueryTime(e){if((0,a.OBj)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:n}=this.texData.get(e);return null!=n&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:n,texShape:r,usage:a,isPacked:s,slice:o}=this.texData.get(e),i=o&&o.origDataId||e,l=this.dataRefCount.get(i);l>1?this.dataRefCount.set(i,l-1):(this.dataRefCount.delete(i),null!=t&&(this.numBytesInGPU-=this.computeBytes(r,n),this.textureManager.releaseTexture(t,r,a,s)));const u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=te){return(0,a.OBj)().getBool("WEBGL_CPU_FORWARD")&&e.every((e=>null==this.texData.get(e.dataId).texture&&a.D5U.sizeFromShape(e.shape)<t))}getGPGPUContext(){return this.gpgpu}where(e){a.Wap.warn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");const t=e.dataSync();return J(e.shape,t)}packedUnaryOp(e,t,n){const r=new Q.cc(e.shape,t),s=this.compileAndRun(r,[e],n);return(0,a.SRH)().makeTensorFromTensorInfo(s)}abs(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){const t=(0,U.CJ)(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if((0,a.OBj)().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,q.Et,e.dtype);const t=new q.l(e.shape,q.Et),n=this.compileAndRun(t,[e]);return(0,a.SRH)().makeTensorFromTensorInfo(n)}makeTensorInfo(e,t,n){let r;if("string"===t&&null!=n&&n.length>0&&a.D5U.isString(n[0])){const s=n.map((e=>a.D5U.encodeString(e)));r=this.write(s,e,t)}else r=this.write(n,e,t);return this.texData.get(r).usage=null,{dataId:r,shape:e,dtype:t}}makeOutput(e,t,n){return(0,a.SRH)().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,n),this)}unpackTensor(e){const t=new Y(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new z(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const n=[s.getBatchDim(e.shape),...s.getRowsCols(e.shape)],r={dtype:e.dtype,shape:n,dataId:e.dataId},a=[s.getBatchDim(t),...s.getRowsCols(t)],o=new H.v(a,n),i=[n],l=this.runWebGLProgram(o,[r],e.dtype,i,!0);return{dataId:l.dataId,shape:t,dtype:l.dtype}}decode(e,t){const n=this.texData.get(e),{isPacked:r,shape:o,dtype:i}=n;if(null!=t){const e=a.D5U.sizeFromShape(o),n=t[0]*t[1]*4;a.D5U.assert(e<=n,(()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data."))}const l=s.getShapeAs3D(o);let u;u=r?new h(l):new p(l);const c=[null!=t?t:d.Yz(l)];return{dtype:i,shape:o,dataId:this.runWebGLProgram(u,[{shape:l,dtype:i,dataId:e}],i,c,!0,t).dataId}}runWebGLProgram(e,t,n,r,o=!1,i){const l=this.makeTensorInfo(e.outputShape,n),c=this.texData.get(l.dataId);if(e.packedOutput&&(c.isPacked=!0),e.outPackingScheme===d.m1.DENSE){const t=null!=i?i:d.Yz(e.outputShape);c.texShape=t.map((e=>2*e))}if(null!=e.outTexUsage&&(c.usage=e.outTexUsage),0===a.D5U.sizeFromShape(l.shape))return c.values=a.D5U.getTypedArrayFromDType(l.dtype,0),l;const p=[],h=t.map((t=>{if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let n=this.texData.get(t.dataId);if(null==n.texture){if(!e.packedInputs&&a.D5U.sizeFromShape(t.shape)<=(0,a.OBj)().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:n.values};e.packedInputs&&(n.isPacked=!0,n.shape=t.shape)}if(this.uploadToGPU(t.dataId),!!n.isPacked!=!!e.packedInputs)t=n.isPacked?this.unpackTensor(t):this.packTensor(t),p.push(t),n=this.texData.get(t.dataId);else if(n.isPacked&&!s.isReshapeFree(n.shape,t.shape)){const e=t,r=t.shape;t.shape=n.shape,t=this.packedReshape(t,r),p.push(t),n=this.texData.get(t.dataId),e.shape=r}return{shape:t.shape,texData:n,isUniform:!1}}));this.uploadToGPU(l.dataId);const f={shape:l.shape,texData:c,isUniform:!1},m=u.mi(e,h,f),g=this.getAndSaveBinary(m,(()=>u.IJ(this.gpgpu,e,h,f))),y=null!=this.activeTimers;let b;y&&(b=this.startTimer()),(0,a.OBj)().get("ENGINE_COMPILE_ONLY")||u._s(this.gpgpu,g,h,f,r),p.forEach((e=>this.disposeIntermediateTensorInfo(e))),y&&(b=this.endTimer(b),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(b)}));const x=(0,a.OBj)().get("WEBGL_FLUSH_THRESHOLD");if(x>0){const e=a.D5U.now();e-this.lastGlFlushTime>x&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=e)}if(!(0,a.OBj)().getBool("WEBGL_LAZILY_UNPACK")&&c.isPacked&&!1===o){const e=this.unpackTensor(l);return this.disposeIntermediateTensorInfo(l),e}return l}compileAndRun(e,t,n,r,a=!1){n=n||t[0].dtype;return this.runWebGLProgram(e,t,n,r,a)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){if(!this.disposed){if(!(0,a.OBj)().getBool("IS_TEST")){Object.keys(this.binaryCache).forEach((e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}))}this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0}}floatPrecision(){return null==this.floatPrecisionValue&&(this.floatPrecisionValue=(0,a.lub)((()=>{if(!(0,a.OBj)().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=(0,a.OBj)().getBool("DEBUG");(0,a.OBj)().set("DEBUG",!1);const t=this.abs((0,a.iD$)(1e-8)).dataSync()[0];if((0,a.OBj)().set("DEBUG",e),t>0)return 32}return 16}))),this.floatPrecisionValue}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}uploadToGPU(e){const t=this.texData.get(e),{shape:n,dtype:r,values:o,texture:i,usage:l,isPacked:u}=t;if(null!=i)return;const c=null!=this.activeTimers;let p;c&&(p=a.D5U.now());let h=t.texShape;if(null==h&&(h=s.getTextureShapeFromLogicalShape(n,u),t.texShape=h),null!=o){const e=s.getShapeAs3D(n);let i,l=h[1],f=h[0];const m=o instanceof Uint8Array||o instanceof Uint8ClampedArray;!u&&m||([l,f]=d.qe(h[0],h[1])),i=u?new y(e,m):new g(e,m);const b=m?[f,l]:h,x=this.makeTensorInfo(b,r),v=this.texData.get(x.dataId);v.usage=m?d.v2.PIXELS:d.v2.UPLOAD,v.texShape=b,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(x.dataId),l,f,o);const w=[[f,l]],T=!0,S=this.runWebGLProgram(i,[x],r,w,T),A=this.texData.get(S.dataId);t.texShape=A.texShape,t.isPacked=A.isPacked,t.usage=A.usage,(0,a.OBj)().get("ENGINE_COMPILE_ONLY")?this.disposeData(S.dataId):(t.texture=A.texture,t.values=null,this.texData.delete(S.dataId)),this.disposeIntermediateTensorInfo(x),c&&(this.uploadWaitMs+=a.D5U.now()-p)}else{const e=this.acquireTexture(h,l,r,u);t.texture=e}}convertAndCacheOnCPU(e,t){const n=this.texData.get(e),{dtype:r}=n;return this.releaseGPUData(e),null!=t&&(n.values=function(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){const n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length);for(let t=0;t<n.length;++t)n[t]=Math.round(e[t]);return n}throw new Error(`Unknown dtype ${t}`)}(t,r)),n.values}acquireTexture(e,t,n,r){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){const e=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${e} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,r)}computeBytes(e,t){return e[0]*e[1]*a.D5U.bytesPerElement(t)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,t]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(t));return Promise.all(e)}for(const[,t]of Object.entries(this.binaryCache)){const n=new Promise((e=>{try{this.checkCompletion_(t),e(!0)}catch(e){throw e}}));e.push(n)}return Promise.all(e)}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await(0,a.glt)(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(!1===this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)){if(console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),!1===this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS))throw s.logShaderSourceAndInfoLog(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.");throw new Error("Failed to link vertex and fragment shaders.")}return!0}getUniformLocations(){for(const[,e]of Object.entries(this.binaryCache)){const{uniformLocations:t,customUniformLocations:n,infLoc:r,nanLoc:a,inShapesLocations:s,inTexShapesLocations:o,outShapeLocation:i,outShapeStridesLocation:l,outTexShapeLocation:c}=(0,u.Yv)(this.gpgpu,e.program,e.webGLProgram);e.uniformLocations=t,e.customUniformLocations=n,e.infLoc=r,e.nanLoc=a,e.inShapesLocations=s,e.inTexShapesLocations=o,e.outShapeLocation=i,e.outShapeStridesLocation=l,e.outTexShapeLocation=c}}}ne.nextDataId=0;const re="3.21.0";function ae(){(0,a.OBj)().set("WEBGL_FORCE_F16_TEXTURES",!0)}a.C2$.isBrowser()&&(0,a.jqO)("webgl",(()=>new ne),2);const se={forceHalfFloat:ae}},4039:(e,t,n)=>{n.d(t,{D1:()=>s,t6:()=>o});var r=n(2579),a=n(6697);const s="\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n";class o{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=r.Wap.assertAndGetBroadcastShape(t,n),this.enableShapeUniforms=(0,a.C9)(this.outputShape.length),this.userCode=`\n float binaryOperation(float a, float b) {\n ${e}\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n `}}},4488:(e,t,n)=>{n.d(t,{E2:()=>l,my:()=>i});var r=n(2579),a=n(6697),s=n(1034),o=n(5156);const i="\n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n";class l{constructor(e,t,n,i=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r.Wap.assertAndGetBroadcastShape(t,n);const l=this.outputShape.length;this.enableShapeUniforms=(0,a.C9)(l);let u="";if(i)if(0===l||1===r.D5U.sizeFromShape(this.outputShape))u="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else{if(u=`\n ${(0,o.kW)(l)} coords = getOutputCoords();\n `,1===l)this.enableShapeUniforms?u+="\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ":u+=`\n result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;else{const e=(0,s.Ky)("coords",l);this.enableShapeUniforms?u+=`\n bool nextRowOutOfBounds =\n (${e[l-2]} + 1) >= outShape[${l} - 2];\n bool nextColOutOfBounds =\n (${e[l-1]} + 1) >= outShape[${l} - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `:u+=`\n bool nextRowOutOfBounds =\n (${e[l-2]} + 1) >= ${this.outputShape[l-2]};\n bool nextColOutOfBounds =\n (${e[l-1]} + 1) >= ${this.outputShape[l-1]};\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `}}this.userCode=`\n vec4 binaryOperation(vec4 a, vec4 b) {\n ${e}\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ${u}\n\n setOutput(result);\n }\n `}}},740:(e,t,n)=>{n.d(t,{jl:()=>i,nd:()=>o});var r=n(2579);const a={},s={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function o(e,t){a[e]=t}function i(e,t){if(!(e in a)||null!=t){const n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=null==t?function(e){if("undefined"!=typeof OffscreenCanvas&&2===e)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(e):t;n.addEventListener("webglcontextlost",(t=>{t.preventDefault(),delete a[e]}),!1),(0,r.OBj)().getBool("SOFTWARE_WEBGL_ENABLED")&&(s.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",s)||n.getContext("experimental-webgl",s);return n.getContext("webgl2",s)}(e,t);if(null===n)return console.log("Could not get context for WebGL version",e),null;a[e]=n}const n=a[e];return null==n||n.isContextLost()?(delete a[e],i(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),a[e])}},8954:(e,t,n)=>{n.d(t,{I:()=>r,S:()=>a});class r{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;const s=e.padInfo.top,o=e.padInfo.left,i=e.strideHeight,l=e.strideWidth,u=e.dilationHeight,c=e.dilationWidth,d=e.filterHeight,p=e.filterWidth,h=4*Math.floor(e.inChannels/4),f=e.inChannels%4,m="channelsLast"===e.dataFormat,g=m?1:2,y=m?2:3,b=m?3:1;let x="",v="";n&&(x=r?`float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:a?`float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`\n float activation(float x) {\n ${n}\n }\n `,v="result = activation(result);");const w=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${x}\n\n const ivec2 strides = ivec2(${i}, ${l});\n const ivec2 pads = ivec2(${s}, ${o});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[${b}];\n\n ivec2 xRCCorner =\n ivec2(coords[${g}], coords[${y}]) * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${d}; wR++) {\n int xR = xRCorner + wR * ${u};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${p}; wC++) {\n int xC = xCCorner + wC * ${c};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${h}; d1 += 4) {\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n if (${m}) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (${1===f}) {\n\n if (${m}) {\n dotProd +=\n getX(batch, xR, xC, ${h}) *\n getW(wR, wC, ${h}, d2);\n } else {\n dotProd +=\n getX(batch, ${h}, xR, xC) *\n getW(wR, wC, ${h}, d2);\n }\n\n } else if (${2===f}) {\n vec2 wValues = vec2(\n getW(wR, wC, ${h}, d2),\n getW(wR, wC, ${h} + 1, d2)\n );\n\n if (${m}) {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ${h}),\n getX(batch, xR, xC, ${h} + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ${h}, xR, xC),\n getX(batch, ${h} + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (${3===f}) {\n vec3 wValues = vec3(\n getW(wR, wC, ${h}, d2),\n getW(wR, wC, ${h} + 1, d2),\n getW(wR, wC, ${h} + 2, d2)\n );\n\n if (${m}) {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ${h}),\n getX(batch, xR, xC, ${h} + 1),\n getX(batch, xR, xC, ${h} + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ${h}, xR, xC),\n getX(batch, ${h} + 1, xR, xC),\n getX(batch, ${h} + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ${w}\n ${v}\n setOutput(result);\n }\n `}}class a{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,n=e.padInfo.top,r=e.padInfo.left,a=e.strideDepth,s=e.strideHeight,o=e.strideWidth,i=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.filterDepth,d=e.filterHeight,p=e.filterWidth,h=4*Math.floor(e.inChannels/4),f=e.inChannels%4;this.userCode=`\n const ivec3 strides = ivec3(${a}, ${s}, ${o});\n const ivec3 pads = ivec3(${t}, ${n}, ${r});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < ${c}; wF++) {\n int xF = xFCorner + wF * ${i};\n\n if (xF < 0 || xF >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${d}; wR++) {\n int xR = xRCorner + wR * ${l};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${p}; wC++) {\n int xC = xCCorner + wC * ${u};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${h}; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if (${1===f}) {\n dotProd +=\n getX(batch, xF, xR, xC, ${h}) *\n getW(wF, wR, wC, ${h}, d2);\n } else if (${2===f}) {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ${h}),\n getX(batch, xF, xR, xC, ${h} + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ${h}, d2),\n getW(wF, wR, wC, ${h} + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (${3===f}) {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ${h}),\n getX(batch, xF, xR, xC, ${h} + 1),\n getX(batch, xF, xR, xC, ${h} + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ${h}, d2),\n getW(wF, wR, wC, ${h} + 1, d2),\n getW(wF, wR, wC, ${h} + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `}}},4364:(e,t,n)=>{n.d(t,{J:()=>a});var r=n(6697);class a{constructor(e,t=!1,n=null,a=!1,s=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=(0,r.C9)(this.outputShape.length);const o=e.filterHeight,i=e.filterWidth,l=e.outChannels/e.inChannels;let u="",c="";n&&(u=a?`float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:s?`float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`\n float activation(float x) {\n ${n}\n }\n `,c="result = activation(result);");const d=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),s&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${u}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${l};\n int q = d2 - d1 * ${l};\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ${o}; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ${i}; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n\n float result = dotProd;\n ${d}\n ${c}\n setOutput(result);\n }\n `}}},2734:(e,t,n)=>{n.d(t,{i:()=>s});var r=n(2579),a=n(6697);class s{constructor(e,t=!1,n=null,s=!1,o=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=(0,a.C9)(this.outputShape.length);const i=e.padInfo.left,l=e.strideWidth,u=e.dilationWidth,c=e.filterHeight,d=e.filterWidth,p=d;let h="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;";for(let e=0;e<d;e++)h+=`\n vec4 xTexelC${2*e};\n int xTexelC${2*e}Ready;\n vec4 xTexelC${2*e+1};\n int xTexelC${2*e+1}Ready;\n vec4 xC${e};`;h+=`\n for (int r = 0; r < ${c}; r++) {\n for (int d1 = 0; d1 < ${e.inChannels}; d1 += 2) {\n `;for(let e=0;e<d;e++)h+=`\n xTexelC${2*e} = vec4(0.0);\n xTexelC${2*e}Ready = 0;\n xTexelC${2*e+1} = vec4(0.0);\n xTexelC${2*e+1}Ready = 0;\n xC${e} = vec4(0.0);`;h+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(let t=0;t<(p+1)/2;t++){const n=2*t;if(h+=`\n xC = xCCorner + ${n*u};\n `,1===l){if(n<d&&(i%2==1?(h+=`\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n `,h+=1===u&&n>0?`\n xC${n} = vec4(xTexelC${n-2}.zw, xTexelC${n}.xy);\n `:`\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${n} = vec4(previous.zw, xTexelC${n}.xy);\n } else {\n xC${n} = vec4(0.0, 0.0, xTexelC${n}.xy);\n }\n `):h+=`\n if (xC >= 0 && xC < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n xC${n} = xTexelC${n};\n `,n+1<d)){const e=i%2==0?r.D5U.nearestLargerEven(u):u;u%2==0&&i%2==1||u%2!=0&&i%2!=1?(h+=`\n xCOffset = xC + imod(pads[1], 2) + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n `,h+=u>1?`\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${n+1} = vec4(previous.zw, xTexelC${n+1}.xy);\n } else {\n xC${n+1} = vec4(0.0, 0.0, xTexelC${n+1}.xy);\n }\n `:`\n xC${n+1} = vec4(xTexelC${n}.zw, xTexelC${n+1}.xy);\n `):h+=1===e?`\n xC${n+1} = xTexelC${n};\n `:`\n xCOffset = xC + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n+1} = xTexelC${n+1};\n `}}else n<d&&(i%2==1?(h+=`\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n} = vec4(xTexelC${n}.zw, xTexelC${n+1}.zw);\n `,n+1<d&&(h+=`\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${n+1} = vec4(xTexelC${n+1}.xy, final.xy);\n `)):(h+=`\n if(xC >= 0 && xC < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n} = vec4(\n xTexelC${n}.xy, xTexelC${n+1}.xy);\n `,n+1<d&&(h+=`\n xC${n+1} = vec4(xTexelC${n}.zw, xTexelC${n+1}.zw);\n `)));n<d&&(h+=`\n wTexel = getW(r, ${n}, d1, d2);\n dotProd += xC${n}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${e.inChannels}) {\n dotProd += xC${n}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `,n+1<d&&(h+=`\n wTexel = getW(r, ${n+1}, d1, d2);\n dotProd += xC${n+1}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${e.inChannels}) {\n dotProd += xC${n+1}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `))}h+="\n }\n ",h+="\n }\n ",h+="\n }\n ";let f="",m="";n&&(f=s?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:o?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`vec4 activation(vec4 x) {\n ${n}\n }`,m="result = activation(result);");const g=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),o&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${f}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${h}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${g}\n ${m}\n setOutput(result);\n }\n `}}},1177:(e,t,n)=>{n.d(t,{f:()=>s});var r=n(2579),a=n(6697);class s{constructor(e,t=!1,n=null,s=!1,o=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=(0,a.C9)(this.outputShape.length);const i=e.outChannels/e.inChannels,l=e.padInfo.left,u=e.strideWidth,c=e.dilationWidth,d=e.filterHeight,p=e.filterWidth,h=p;let f="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;";for(let e=0;e<p;e++)f+=`\n vec4 xTexelC${2*e};\n int xTexelC${2*e}Ready;\n vec4 xTexelC${2*e+1};\n int xTexelC${2*e+1}Ready;\n vec4 xC${e};`;f+=`\n for (int r = 0; r < ${d}; r++) {\n `;for(let e=0;e<p;e++)f+=`\n xTexelC${2*e} = vec4(0.0);\n xTexelC${2*e}Ready = 0;\n xTexelC${2*e+1} = vec4(0.0);\n xTexelC${2*e+1}Ready = 0;\n xC${e} = vec4(0.0);`;f+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(let e=0;e<(h+1)/2;e++){const t=2*e;if(f+=`\n xC = xCCorner + ${t*c};\n `,1===u){if(t<p&&(l%2==1?(f+=`\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n `,f+=1===c&&t>0?`\n xC${t} = vec4(xTexelC${t-2}.zw, xTexelC${t}.xy);\n `:`\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${t} = vec4(previous.zw, xTexelC${t}.xy);\n } else {\n xC${t} = vec4(0.0, 0.0, xTexelC${t}.xy);\n }\n `):f+=`\n if (xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n xC${t} = xTexelC${t};\n `,t+1<p)){const e=l%2==0?r.D5U.nearestLargerEven(c):c;c%2==0&&l%2==1||c%2!=0&&l%2!=1?(f+=`\n xCOffset = xC + imod(pads[1], 2) + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n `,f+=c>1?`\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${t+1} = vec4(previous.zw, xTexelC${t+1}.xy);\n } else {\n xC${t+1} = vec4(0.0, 0.0, xTexelC${t+1}.xy);\n }\n `:`\n xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.xy);\n `):f+=1===e?`\n xC${t+1} = xTexelC${t};\n `:`\n xCOffset = xC + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t+1} = xTexelC${t+1};\n `}}else t<p&&(l%2==1?(f+=`\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n `,t+1<p&&(f+=`\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${t+1} = vec4(xTexelC${t+1}.xy, final.xy);\n `)):(f+=`\n if(xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t} = vec4(\n xTexelC${t}.xy, xTexelC${t+1}.xy);\n `,t+1<p&&(f+=`\n xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n `)));t<p&&(f+=`\n wTexel = getW(r, ${t}, d1, q);\n dotProd += xC${t} * vec4(wTexel.xz, wTexel.xz);\n `,t+1<p&&(f+=`\n wTexel = getW(r, ${t+1}, d1, q);\n dotProd += xC${t+1} * vec4(wTexel.xz, wTexel.xz);\n `))}f+="\n }\n ",f+="\n }\n ";let m="",g="";n&&(m=s?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:o?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`vec4 activation(vec4 x) {\n ${n}\n }`,g="result = activation(result);");const y=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),o&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${m}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${i};\n int q = d2 - d1 * ${i};\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${f}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${y}\n ${g}\n setOutput(result);\n }\n `}}},9610:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(2579);function a(){let e,t,n,a,s,o,i,l,u,c;return 2===(0,r.OBj)().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",a="in",s="texture",o="outputColor",i="out vec4 outputColor;",l=(0,r.OBj)().getBool("WEBGL2_ISNAN_CUSTOM")?"\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ":"",u="",c="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(e="",t="attribute",n="varying",a="varying",s="texture2D",o="gl_FragColor",i="",l="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",u="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",c="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:s,output:o,defineOutput:i,defineSpecialNaN:l,defineSpecialInf:u,defineRound:c}}},6697:(e,t,n)=>{n.d(t,{C9:()=>d,IJ:()=>o,Yv:()=>i,_s:()=>u,mi:()=>c});var r=n(2579),a=n(5156),s=n(1906);function o(e,t,n,o){const l=n.map(((e,n)=>{const r={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.isPacked,flatOffset:null};return null!=e.texData&&null!=e.texData.slice&&e.texData.slice.flatOffset>0&&(r.flatOffset=e.texData.slice.flatOffset),{name:t.variableNames[n],shapeInfo:r}})),u=l.map((e=>e.shapeInfo)),c={logicalShape:o.shape,texShape:o.texData.texShape,isUniform:!1,isPacked:o.texData.isPacked,flatOffset:null},d=a.Vm(l,c,t),p=(0,s.createFragmentShader)(e.gl,d),h=e.createProgram(p);return(0,r.OBj)().get("ENGINE_COMPILE_ONLY")?{program:t,fragmentShader:p,source:d,webGLProgram:h,inShapeInfos:u,outShapeInfo:c,uniformLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,inShapesLocations:null,inTexShapesLocations:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:Object.assign({program:t,fragmentShader:p,source:d,webGLProgram:h,inShapeInfos:u,outShapeInfo:c},i(e,t,h))}function i(e,t,n){const a={},s={},o={},i=[];let l,u,c,d=null,p=null;p=e.getUniformLocation(n,"NAN",!1),1===(0,r.OBj)().getNumber("WEBGL_VERSION")&&(d=e.getUniformLocation(n,"INFINITY",!1));const h=!1;for(let r=0;r<t.variableNames.length;r++){const i=t.variableNames[r];a[i]=e.getUniformLocation(n,i,h),a[`offset${i}`]=e.getUniformLocation(n,`offset${i}`,h),t.enableShapeUniforms&&(s[`${i}Shape`]=e.getUniformLocation(n,`${i}Shape`,h),o[`${i}TexShape`]=e.getUniformLocation(n,`${i}TexShape`,h))}return t.enableShapeUniforms&&(l=e.getUniformLocation(n,"outShape",h),c=e.getUniformLocation(n,"outShapeStrides",h),u=e.getUniformLocation(n,"outTexShape",h)),t.customUniforms&&t.customUniforms.forEach(((t,r)=>{i[r]=e.getUniformLocation(n,t.name,h)})),{uniformLocations:a,customUniformLocations:i,infLoc:d,nanLoc:p,inShapesLocations:s,inTexShapesLocations:o,outShapeLocation:l,outShapeStridesLocation:c,outTexShapeLocation:u}}function l(e,t){if(e.length!==t.length)throw Error(`Binary was compiled with ${e.length} inputs, but was executed with ${t.length} inputs`);e.forEach(((e,n)=>{const a=e.logicalShape,s=t[n],o=s.shape;if(!r.D5U.arraysEqual(a,o))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${a} and ${o} must match`);if(e.isUniform&&s.isUniform)return;const i=e.texShape,l=s.isUniform?null:s.texData.texShape;if(!r.D5U.arraysEqual(i,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${i} and ${l} must match`)}))}function u(e,t,n,s,o){t.program.enableShapeUniforms||(l(t.inShapeInfos,n),l([t.outShapeInfo],[s]));const i=s.texData.texture,u=s.texData.texShape;s.texData.isPacked?e.setOutputPackedMatrixTexture(i.texture,u[0],u[1]):e.setOutputMatrixTexture(i.texture,u[0],u[1]),e.setProgram(t.webGLProgram),1===(0,r.OBj)().getNumber("WEBGL_VERSION")&&null!==t.infLoc&&e.gl.uniform1f(t.infLoc,1/0),null!==t.nanLoc&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach(((n,s)=>{const o=t.program.variableNames[s],i=t.uniformLocations[o],l=t.uniformLocations[`offset${o}`],u=t.inShapesLocations[`${o}Shape`],c=t.inTexShapesLocations[`${o}TexShape`];if(u){const{uniformShape:r}=a.Tt(t.program.packedInputs,n.shape,n.texData.texShape);switch(r.length){case 1:e.gl.uniform1iv(u,new Int32Array(r));break;case 2:e.gl.uniform2iv(u,new Int32Array(r));break;case 3:e.gl.uniform3iv(u,new Int32Array(r));break;case 4:e.gl.uniform4iv(u,new Int32Array(r))}}if(c&&e.gl.uniform2i(c,n.texData.texShape[0],n.texData.texShape[1]),null!=i)if(n.isUniform)if(r.D5U.sizeFromShape(n.shape)<2)e.gl.uniform1f(i,n.uniformValues[0]);else{let t=n.uniformValues;t instanceof Float32Array||(t=new Float32Array(t)),e.gl.uniform1fv(i,t)}else null!=n.texData.slice&&null!=l&&e.gl.uniform1i(l,n.texData.slice.flatOffset),e.setInputMatrixTexture(n.texData.texture.texture,i,s)}));const c=t.outShapeLocation;if(c)switch(s.shape.length){case 1:e.gl.uniform1iv(c,new Int32Array(s.shape));break;case 2:e.gl.uniform2iv(c,new Int32Array(s.shape));break;case 3:e.gl.uniform3iv(c,new Int32Array(s.shape));break;case 4:e.gl.uniform4iv(c,new Int32Array(s.shape))}if(t.outShapeStridesLocation){const n=r.D5U.computeStrides(s.shape);switch(s.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(n));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(n));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(n))}}t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,s.texData.texShape[0],s.texData.texShape[1]),t.program.customUniforms&&o&&t.program.customUniforms.forEach(((n,r)=>{const a=t.customUniformLocations[r],s=o[r];if("float"===n.type)e.gl.uniform1fv(a,s);else if("vec2"===n.type)e.gl.uniform2fv(a,s);else if("vec3"===n.type)e.gl.uniform3fv(a,s);else if("vec4"===n.type)e.gl.uniform4fv(a,s);else if("int"===n.type)e.gl.uniform1iv(a,s);else if("ivec2"===n.type)e.gl.uniform2iv(a,s);else if("ivec3"===n.type)e.gl.uniform3iv(a,s);else{if("ivec4"!==n.type)throw Error(`uniform type ${n.type} is not supported yet.`);e.gl.uniform4iv(a,s)}})),e.executeProgram()}function c(e,t,n){let s="";t.concat(n).forEach((t=>{const o=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!t.isUniform){const i=t.texData.texShape,{useSqueezeShape:l,uniformShape:u,keptDims:c}=a.Tt(e.packedInputs,t.shape,i);let d="",p="",h="";if(1===u.length&&e.packedInputs){const e=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];d=`${e[0]>1}_${e[1]>1}`}else if(2!==u.length||e.packedInputs){if(u.length>2&&!e.packedInputs){const e=r.D5U.computeStrides(u);h=`${e[0]===i[1]}_${e[e.length-1]===i[1]}`}}else p=`${u[0]>1}_${u[1]>1}`;const f=t.shape.length,m=2===u.length&&r.D5U.arraysEqual(t.shape,i),g=1===r.D5U.sizeFromShape(t.shape),y=r.Wap.getBroadcastDims(t.shape,n.shape),b=!e.packedInputs&&f===n.shape.length&&r.D5U.arraysEqual(i,n.texData.texShape),x=e.packedInputs||u.length>2?"":`${i[0]>1}_${i[1]>1}`;s+=`${f}_${b}_${l?c:""}_${u.length}_${g}_${y}_${m}_${d}_${p}_${h}_${x}_${o}`}else{const e=t.isUniform?"uniform":t.texData.texShape;s+=`${t.shape}_${e}_${o}`}}));const o=e.userCode;let i=e.constructor.name;return i+="_"+s+"_"+o+`${(0,r.OBj)().getNumber("WEBGL_VERSION")}`,i}function d(e){return(0,r.OBj)().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4}},5367:(e,t,n)=>{n.d(t,{AJ:()=>p,E6:()=>d,g8:()=>f,js:()=>h});var r=n(2579),a=n(4039),s=n(4488),o=n(6515),i=n(1736),l=n(3525),u=n(4518),c=n(9365);const d="if (isnan(x)) return x;";function p({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:s,backend:o})=>{const{x:i}=s,l=o,d=a||i.dtype;if(l.shouldExecuteOnCPU([i])&&null!=n){const e=l.texData.get(i.dataId),t=n(e.values,d);return l.makeTensorInfo(i.shape,d,t)}let p;return p=(0,r.OBj)().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=t?new c.cc(i.shape,t):new u.l(i.shape,e),l.runWebGLProgram(p,[i],d)}}function h({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:i=!1,cpuKernelImpl:l,dtype:u}){return({inputs:c,backend:d})=>{const{a:p,b:h}=c,f=d;if(i&&"complex64"===p.dtype){const t=f.texData.get(p.dataId),n=f.texData.get(h.dataId),[s,i]=[[t.complexTensorInfos.real,n.complexTensorInfos.real],[t.complexTensorInfos.imag,n.complexTensorInfos.imag]].map((t=>{const[n,s]=t,o={dataId:n.dataId,dtype:n.dtype,shape:p.shape},i={dataId:s.dataId,dtype:s.dtype,shape:h.shape},l=new a.t6(e,p.shape,h.shape);return f.runWebGLProgram(l,[o,i],(0,r.x8V)(n.dtype,s.dtype))})),l=(0,o.P)({inputs:{real:s,imag:i},backend:f});return f.disposeIntermediateTensorInfo(s),f.disposeIntermediateTensorInfo(i),l}const m=u||(0,r.x8V)(p.dtype,h.dtype);if(("string"===p.dtype||"string"===h.dtype||f.shouldExecuteOnCPU([p,h]))&&null!=l){const e=f.texData.get(p.dataId).values,t=f.texData.get(h.dataId).values,n="string"===p.dtype?r.Wap.fromUint8ToStringArray(e):e,a="string"===p.dtype?r.Wap.fromUint8ToStringArray(t):t,[s,o]=l(p.shape,h.shape,n,a,m),i=f.makeTensorInfo(o,m);return f.texData.get(i.dataId).values=s,i}let g;return g=(0,r.OBj)().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=t?new s.E2(t,p.shape,h.shape,n):new a.t6(e,p.shape,h.shape),f.runWebGLProgram(g,[p,h],m)}}function f(e,t=!1){if("linear"===e)return t?c.t$:u.t$;if("relu"===e)return t?c.RX:u.RX;if("elu"===e)return t?c.Cv:u.Cv;if("relu6"===e)return t?c.eW:u.eW;if("prelu"===e)return t?l.VO:l.pU;if("leakyrelu"===e)return t?i.s4:i.oA;if("sigmoid"===e)return t?c.Tq:u.Tq;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}},745:(e,t,n)=>{n.d(t,{u:()=>o});var r=n(2579);class a{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:a,inSize:s,outSize:o}=e;this.outputShape=[a,o];const i=4*Math.floor(n/4),l=n%4;let u="sumValue += dot(values, ones);";if(null!=t){const e=1/t;u=`sumValue += dot(values * ${r.D5U.isInt(e)?e.toPrecision(2):e}, ones);`}let c="";s%n>0&&(c=`\n if (inIdx < 0 || inIdx >= ${s}) {\n return 0.0;\n }\n `),this.userCode=`\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${c}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${n};\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${i}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${u}\n }\n\n int inIdx = inOffset + ${i};\n if (${1===l}) {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ${u}\n } else if (${2===l}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ${u}\n } else if (${3===l}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ${u}\n }\n setOutput(sumValue);\n }\n `}}class s{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:r,inSize:a,outSize:s}=e;this.outputShape=[r,s];let o="0.0",i="";"prod"===t?o="1.0":"min"===t?(o="1.0 / 1e-20",i="min"):"max"===t&&(o="-1.0 / 1e-20",i="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"sum"===t?l="sumValue":"prod"===t?l="prodValue":"all"===t?l="allValue":"any"===t&&(l="anyValue");const u=4*Math.floor(n/4),c=n%4;let d=`\n if (${"sum"===t}) {\n sumValue += dot(values, ones);\n } else if (${"prod"===t}) {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ${i}(values, minMaxValue);\n if (${"min"===t} || ${"max"===t}) {\n minMaxValue = ${i}(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n `,p="vec4";"all"===t?(o="1.0",d="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",p="bvec4"):"any"===t&&(o="0.0",d="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",p="bvec4");let h="";a%n>0&&(h=`\n if (inIdx < 0 || inIdx >= ${a}) {\n return initializationValue;\n }\n `),this.userCode=`\n const float initializationValue = ${o};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${h}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${n};\n\n vec4 minMaxValue = vec4(${o});\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < ${u}; i += 4) {\n int inIdx = inOffset + i;\n ${p} values = ${p}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${d}\n }\n\n int inIdx = inOffset + ${u};\n if (${1===c}) {\n ${p} values = ${p}(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${d}\n } else if (${2===c}) {\n ${p} values = ${p}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ${d}\n } else if (${3===c}) {\n ${p} values = ${p}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ${d}\n }\n setOutput(${l});\n }\n `}}function o(e,t,n,o){const i=function(e){const t=[];for(;0===t.length||1!==t[t.length-1].outSize;){const n=t.length?t[t.length-1].outSize:e[1],a=r.Wap.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}(e.shape);let l=e;for(let r=0;r<i.length;r++){const{inSize:u,windowSize:c,outSize:d}=i[r];let p,h;p="mean"===n?0===r?new a({windowSize:c,inSize:u,batchSize:e.shape[0],outSize:d},u):new a({windowSize:c,inSize:u,batchSize:e.shape[0],outSize:d}):new s({windowSize:c,inSize:u,batchSize:e.shape[0],outSize:d},n),h=l,l=o.runWebGLProgram(p,[l],t),h.dataId!==e.dataId&&o.disposeIntermediateTensorInfo(h)}return l}},2512:(e,t,n)=>{n.d(t,{cK:()=>Ae,qO:()=>Ce,cx:()=>Ie,cm:()=>ke,pk:()=>Ee,n7:()=>Ne,gv:()=>Be,aX:()=>Re,tx:()=>De,MZ:()=>Me,TD:()=>Oe,m$:()=>Pe,ji:()=>Fe,B_:()=>$e,Rn:()=>Le,kY:()=>_e,PQ:()=>Ve,Sd:()=>Ue,$O:()=>Ge,nL:()=>We,r:()=>ze,Th:()=>He,Bo:()=>Ze,cZ:()=>je,Tg:()=>Xe,Qs:()=>Ke,fy:()=>qe,hO:()=>Qe,St:()=>Ye,Y1:()=>Je,UN:()=>et,CJ:()=>tt,nT:()=>nt,X8:()=>rt,LS:()=>at,AR:()=>st,Bk:()=>ot,$u:()=>it,$j:()=>lt,A0:()=>ut,_9:()=>ct,kI:()=>dt,KX:()=>pt,oC:()=>ht,Fv:()=>ft,CV:()=>mt});var r={};n.r(r),n.d(r,{addImpl:()=>g,bincountImpl:()=>b,bincountReduceImpl:()=>x,castImpl:()=>p,ceilImpl:()=>S,concatImpl:()=>A,equalImpl:()=>C,expImpl:()=>I,expm1Impl:()=>k,floorImpl:()=>E,gatherNdImpl:()=>N,gatherV2Impl:()=>B,greaterEqualImpl:()=>D,greaterImpl:()=>R,lessEqualImpl:()=>O,lessImpl:()=>M,linSpaceImpl:()=>P,logImpl:()=>$,maxImpl:()=>F,maximumImpl:()=>_,minimumImpl:()=>L,multiplyImpl:()=>V,negImpl:()=>G,notEqualImpl:()=>W,prodImpl:()=>H,raggedGatherImpl:()=>K,raggedTensorToTensorImpl:()=>ee,rangeImpl:()=>te,rsqrtImpl:()=>ne,scatterImpl:()=>re,sigmoidImpl:()=>ae,simpleAbsImpl:()=>o,sliceImpl:()=>se,sparseFillEmptyRowsImpl:()=>oe,sparseReshapeImpl:()=>ie,sparseSegmentReductionImpl:()=>le,sqrtImpl:()=>ue,squaredDifferenceImpl:()=>ce,stridedSliceImpl:()=>de,stringNGramsImpl:()=>he,stringSplitImpl:()=>me,stringToHashBucketFastImpl:()=>ge,subImpl:()=>ye,tileImpl:()=>xe,topKImpl:()=>Te,transposeImpl:()=>z,uniqueImpl:()=>Se});var a=n(2579);function s(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&a.D5U.assert("complex64"!==e.dtype,(()=>`${t} does not support complex64 tensors in the CPU backend.`))}))}function o(e){const t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}a.SYM;function i(e){return(t,n,r,s,o)=>{const i=a.Wap.assertAndGetBroadcastShape(t,n),l=i.length,u=a.D5U.computeStrides(i),c=a.D5U.sizeFromShape(i),d=a.D5U.getTypedArrayFromDType(o,c),p=t.length,h=n.length,f=a.D5U.computeStrides(t),m=a.D5U.computeStrides(n),g=a.Wap.getBroadcastDims(t,i),y=a.Wap.getBroadcastDims(n,i);if(g.length+y.length===0)for(let t=0;t<d.length;++t)d[t]=e(r[t%r.length],s[t%s.length]);else for(let t=0;t<d.length;++t){const n=a.D5U.indexToLoc(t,l,u),o=n.slice(-p);g.forEach((e=>o[e]=0));const i=a.D5U.locToIndex(o,p,f),c=n.slice(-h);y.forEach((e=>c[e]=0));const b=a.D5U.locToIndex(c,h,m);d[t]=e(r[i],s[b])}return[d,i]}}function l(e){const{inputs:t,backend:n}=e,{real:r,imag:a}=t,s=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,i=n.makeTensorInfo(r.shape,"complex64");return n.data.get(i.dataId).complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",s),imag:n.makeTensorInfo(a.shape,"float32",o)},i}a.Zz9;function u(e,t,n="float32"){if("complex64"===n){return l({inputs:{real:u(e,t,"float32"),imag:u(e,t,"float32")},backend:e})}const r=a.D5U.makeZerosTypedArray(a.D5U.sizeFromShape(t),n);return e.makeTensorInfo(t,n,r)}function c(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}a.iJz;function d(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.data.get(r.dataId).complexTensorInfos.real,s=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,s)}a.xJR;function p(e,t,n,r){if("int32"===r){return[t,"int32",Int32Array.from(e)]}if("bool"===r){const r=a.D5U.toTypedArray([0],n),[s,o]=i(((e,t)=>e!==t?1:0))(t,[],e,r,"bool");return[o,"bool",s]}throw new Error(`Error in Cast: failed to cast ${n} to ${r}`)}function h(e){const{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dtype:o}=r;if("complex64"===o){if("complex64"===s.dtype)return c({inputs:{x:s},backend:n});const e=u(n,s.shape,s.dtype),t=h({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),r=l({inputs:{real:t,imag:e},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),r}if("complex64"===s.dtype){const e=d({inputs:{input:s},backend:n}),t=h({inputs:{x:e},backend:n,attrs:{dtype:o}});return n.disposeIntermediateTensorInfo(e),t}if(!a.D5U.hasEncodingLoss(s.dtype,o)){const e=c({inputs:{x:s},backend:n});return{dataId:e.dataId,shape:e.shape,dtype:o}}const i=n.data.get(s.dataId).values,[f,m,g]=p(i,s.shape,s.dtype,o);return n.makeTensorInfo(f,m,g)}a.RFZ;function f(e,t,n,r){return null==n?({inputs:n,backend:o})=>{const{a:i,b:l}=n,u=o;s([i,l],e);const c=u.data.get(i.dataId).values,d=u.data.get(l.dataId).values,p="string"===i.dtype?a.Wap.fromUint8ToStringArray(c):c,h="string"===i.dtype?a.Wap.fromUint8ToStringArray(d):d,f=r||i.dtype,[m,g]=t(i.shape,l.shape,p,h,f);return u.makeTensorInfo(g,f,m)}:({inputs:e,backend:a})=>{const{a:s,b:o}=e,i=a;if("complex64"===s.dtype||"complex64"===o.dtype){const e=h({inputs:{x:s},backend:i,attrs:{dtype:"complex64"}}),t=i.data.get(e.dataId),r=t.complexTensorInfos.real,a=t.complexTensorInfos.imag,u=i.data.get(r.dataId).values,c=i.data.get(a.dataId).values,d=h({inputs:{x:o},backend:i,attrs:{dtype:"complex64"}}),p=i.data.get(d.dataId),f=p.complexTensorInfos.real,m=p.complexTensorInfos.imag,g=i.data.get(f.dataId).values,y=i.data.get(m.dataId).values,[b,x,v]=n(s.shape,o.shape,u,c,g,y),w=i.makeTensorInfo(v,"float32",b),T=i.makeTensorInfo(v,"float32",x),S=l({inputs:{real:w,imag:T},backend:i});return i.disposeIntermediateTensorInfo(e),i.disposeIntermediateTensorInfo(d),i.disposeIntermediateTensorInfo(w),i.disposeIntermediateTensorInfo(T),S}{const e=i.data.get(s.dataId).values,n=i.data.get(o.dataId).values,a=r||s.dtype,[l,u]=t(s.shape,o.shape,e,n,a);return i.makeTensorInfo(u,a,l)}}}function m(e){return(t,n,r,s,o,i)=>{const l=a.Wap.assertAndGetBroadcastShape(t,n),u=a.D5U.sizeFromShape(l),c=l.length,d=a.D5U.computeStrides(l),p=a.D5U.getTypedArrayFromDType("float32",u),h=a.D5U.getTypedArrayFromDType("float32",u),f=a.Wap.getBroadcastDims(t,l),m=a.Wap.getBroadcastDims(n,l),g=a.Wap.mergeRealAndImagArrays(r,s),y=a.Wap.mergeRealAndImagArrays(o,i),b=t.length,x=a.D5U.computeStrides(t),v=n.length,w=a.D5U.computeStrides(n);if(f.length+m.length===0)for(let t=0;t<p.length;t++){const n=t%g.length,r=t%y.length,a=e(g[2*n],g[2*n+1],y[2*r],y[2*r+1]);p[t]=a.real,h[t]=a.imag}else for(let t=0;t<p.length;t++){const n=a.D5U.indexToLoc(t,c,d),r=n.slice(-b);f.forEach((e=>r[e]=0));const s=a.D5U.locToIndex(r,b,x),o=n.slice(-v);m.forEach((e=>o[e]=0));const i=a.D5U.locToIndex(o,v,w),l=e(g[2*s],g[2*s+1],y[2*i],y[2*i+1]);p[t]=l.real,h[t]=l.imag}return[p,h,l]}}const g=i(((e,t)=>e+t)),y=m(((e,t,n,r)=>({real:e+n,imag:t+r})));f(a.mm_,g,y),a.mm_;function b(e,t,n,r,s){const o=a.D5U.sizeFromShape(r),i=a.D5U.makeZerosTypedArray(s,n);for(let n=0;n<e.length;n++){const r=e[n];if(r<0)throw new Error("Input x must be non-negative!");r>=s||(i[r]+=o>0?t[n]:1)}return i}function x(e,t,n,r=!1){const s=e.shape[0],o=e.shape[1],i=(0,a.f3b)([s,n],t.dtype);for(let a=0;a<s;a++)for(let s=0;s<o;s++){const o=e.get(a,s);if(o<0)throw new Error("Input x must be non-negative!");o>=n||(r?i.set(1,a,o):t.size>0?i.set(i.get(a,o)+t.get(a,s),a,o):i.set(i.get(a,o)+1,a,o))}return i}function v(e){return(t,n,r)=>{const s=a.D5U.getTypedArrayFromDType(n,t.length);for(let n=0;n<t.length;++n)s[n]=e(t[n],r);return s}}function w(e,t,n){return({inputs:r,attrs:o,backend:i})=>{const{x:l}=r;if(s(l,e),"string"===l.dtype||"string"===n)throw new Error("unaryKernelFunc does not support string input/output");const u=i,c=u.data.get(l.dataId).values,d=a.D5U.sizeFromShape(l.shape),p=n||l.dtype,h=a.D5U.getArrayFromDType(p,d);for(let e=0;e<d;++e)h[e]=t(c[e],o);return u.makeTensorInfo(l.shape,p,h)}}function T(e,t,n){return({inputs:r,attrs:a,backend:o})=>{const{x:i}=r;if(s(i,e),"string"===i.dtype||"string"===n)throw new Error("unaryKernelFunc does not support string input/output");const l=o,u=l.data.get(i.dataId).values,c=n||i.dtype,d=t(u,c,a);return l.makeTensorInfo(i.shape,c,d)}}const S=v((e=>Math.ceil(e)));T(a.gJX,S),a.gJX;function A(e,t,n,r){const s=a.D5U.getArrayFromDType(n,a.D5U.sizeFromShape(t));if(r&&"string"!==n){let t=0;e.forEach((e=>{const n=a.D5U.sizeFromShape(e.shape);s.set(e.vals,t),t+=n}))}else{let r=0;e.forEach((e=>{const o="string"===n?a.Wap.fromUint8ToStringArray(e.vals):e.vals;let i=0;for(let n=0;n<e.shape[0];++n){const a=n*t[1]+r;for(let t=0;t<e.shape[1];++t)s[a+t]=o[i++]}r+=e.shape[1]}))}return s}const C=i(((e,t)=>e===t?1:0)),I=(f(a.hdR,C,null,"bool"),a.hdR,v((e=>Math.exp(e)))),k=(T(a.NEP,I,"float32"),a.NEP,v((e=>Math.expm1(e)))),E=(T(a.Y0y,k),a.Y0y,v((e=>Math.floor(e))));T(a.OR,E),a.OR;function N(e,t,n,r,s,o,i,l,u){const c=(0,a.f3b)([r,o],n);for(let n=0;n<r;n++){const r=[];let a=0;for(let t=0;t<s;t++){const o=e[n*s+t];a+=o*i[t],r.push(o)}if(a<0||a>=u/o)throw new Error(`Invalid indices: ${r} does not index into ${l}`);for(let e=0;e<o;e++)c.values[n*o+e]=t.get(...t.indexToLoc(a*o+e))}return c}function B(e,t,n){const r=(0,a.f3b)(n,e.dtype);for(let n=0;n<r.size;++n){const a=r.indexToLoc(n).slice(),s=a[0],o=a[2],i=t.locToIndex([s,o]);a[2]=t.values[i];const l=e.locToIndex(a);0<=l&&l<e.values.length&&(r.values[n]=e.values[l])}return r}const R=i(((e,t)=>e>t?1:0)),D=(f(a.iZT,R,null,"bool"),a.iZT,i(((e,t)=>e>=t?1:0))),M=(f(a.Acj,D,null,"bool"),a.Acj,i(((e,t)=>e<t?1:0))),O=(f(a.vtC,M,null,"bool"),a.vtC,i(((e,t)=>e<=t?1:0)));f(a.CAk,O,null,"bool"),a.CAk;function P(e,t,n){const r=(t-e)/(n-1),s=a.D5U.makeZerosTypedArray(n,"float32");s[0]=e;for(let e=1;e<s.length;e++)s[e]=s[e-1]+r;return s}const $=v((e=>Math.log(e)));T(a.ZbH,$),a.ZbH;function F(e,t,n,r){const s=a.D5U.getTypedArrayFromDType(r,a.D5U.sizeFromShape(n));for(let n=0;n<s.length;++n){const r=n*t;let a=e[r];for(let n=0;n<t;++n){const t=e[r+n];(Number.isNaN(t)||t>a)&&(a=t)}s[n]=a}return s}const _=i(((e,t)=>Math.max(e,t))),L=(f(a.BMI,_),a.BMI,i(((e,t)=>Math.min(e,t)))),V=(f(a.q8u,L),a.q8u,i(((e,t)=>e*t))),U=m(((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n})));f(a.wYn,V,U),a.wYn;function G(e,t,n){const r=a.D5U.createScalarValue(-1,n);return V([],t,r,e,n)}a.kuV;const W=i(((e,t)=>e!==t?1:0));f(a.yQU,W,null,"bool"),a.yQU;function z(e,t,n,r,s){const o=t.length,i=a.D5U.sizeFromShape(t),l=a.D5U.computeStrides(t),u=a.D5U.computeStrides(s),c=a.D5U.getTypedArrayFromDType(n,a.D5U.sizeFromShape(s));for(let t=0;t<i;++t){const n=a.D5U.indexToLoc(t,o,l),s=new Array(n.length);for(let e=0;e<s.length;e++)s[e]=n[r[e]];c[a.D5U.locToIndex(s,o,u)]=e[t]}return c}a.G3Y;function H(e,t,n,r){const[s,o]=a.Wap.computeOutAndReduceShapes(e,r),i=(0,a.x8V)(t,"int32"),l=a.D5U.makeZerosTypedArray(a.D5U.sizeFromShape(s),i),u=a.D5U.sizeFromShape(o);for(let e=0;e<l.length;++e){const t=e*u;let r=1;for(let e=0;e<u;++e)r*=n[t+e];l[e]=r}return{outVals:l,outShape:s,outDtype:i}}a.DlI;function Z(e,t,n,r){const a=[];let s=0;const o=t.length-1+n.length,i=new Array(o).fill(null).map((()=>[0]));!function(e,t){for(let n=0;n<e.length;++n){const r=e[n],a=n===e.length-1?t:e[n+1].length;if(0===r.length)throw new Error("Ragged splits may not be empty");if(r[0]<0)throw new Error("Ragged splits must be non-negative");if(r[r.length-1]>a)throw new Error("Ragged splits must not point past values");for(let e=1;e<r.length;++e)if(r[e-1]>r[e])throw new Error("Ragged splits must be sorted in ascending order")}}(n,r);let l=1;for(let e=0;e<t.length-1;++e){l*=t[e];const n=t[e+1];for(let t=1;t<l+1;++t)i[e].push(t*n)}for(let r=0;r<e.length;++r){let o=e[r],l=e[r]+1;for(let e=0;e<n.length;++e){const r=n[e],a=e+t.length-1;if(a>=0){const e=i[a],t=e[e.length-1]-r[o];for(let e=o;e<l;++e)i[a].push(r[e+1]+t)}o=r[o],l=r[l]}l!==o&&(a.push([o,l]),s+=l-o)}return{outSplits:i,valueSlices:a,numValues:s}}function j(e,t){const n=e.slice(0,t);for(;n.length<t;)n.push(1);for(let r=t;r<e.length;r++)n[t-1]*=e[r];return n}function X(e,t,n,r,s){const o=t.slice();o[0]=s;const i=a.D5U.getArrayFromDType(n,a.D5U.sizeFromShape(o)),l=e.length;return function(e,t,n,r,a,s){const o=j(t,2)[1],i=j(s,2)[1];let l=0;for(const t of n)for(let n=t[0];n<t[1];++n){for(let t=0;t<r;++t)a[l*i+t]=e[n*o+t];++l}}(e,t,r,0===l?0:l/t[0],i,o),[i,o]}function K(e,t,n,r,s,o,i,l){if(0===e.length)throw new Error("paramsNestedSplits must be non empty");if(0===t[0].length)throw new Error("Split tensors must not be scalars");if(function(e,t,n){e.forEach(((e,r)=>{if(e<0||e>=n){const s=a.D5U.indexToLoc(r,t.length,a.D5U.computeStrides(t)).join(",");throw new Error(`indices[${s}] = ${e} is not in [0, ${n})`)}}))}(o,i,t[0][0]-1),0===r.length)throw new Error("params.rank must be nonzero");const u=r[0],{outSplits:c,valueSlices:d,numValues:p}=Z(o,i,e,u),h=function(e){const t=[];for(let n=0;n<e.length;++n){const r=e[n].length,s=a.D5U.getArrayFromDType("int32",r);t.push(s),e[n].forEach(((e,t)=>s[t]=e))}return t}(c),f=X(n,r,s,d,p);return[h,f[0],f[1]]}var q=a.Wap.RowPartitionType;class Q{constructor(e,t,n,r,s,o,i,l,u,c){this.shape=e,this.shapeShape=t,this.values=n,this.valuesShape=r,this.valuesDType=s,this.defaultValue=o,this.defaultValueShape=i,this.rowPartitionValues=l,this.rowPartitionValuesShapes=u,this.rowPartitionTypes=a.Wap.getRowPartitionTypesHelper(c),this.raggedRank=a.Wap.getRaggedRank(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===q.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===q.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const t=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case q.VALUE_ROWIDS:return Q.getMaxWidthValueRowID(t);case q.ROW_SPLITS:return Q.getMaxWidthRowSplit(t);default:throw new Error(`Cannot handle partition type ${q[this.getRowPartitionTypeByDimension(e-1)]}`)}}static getMaxWidthRowSplit(e){const t=e.length;if(0===t||1===t)return 0;let n=0;for(let r=0;r<t-1;++r){const t=e[r+1]-e[r];t>n&&(n=t)}return n}static getMaxWidthValueRowID(e){const t=e.length;if(0===t)return 0;let n=0,r=e[0],a=0;for(let s=1;s<t;++s){const t=e[s];t!==r&&(r=t,a=Math.max(s-n,a),n=s)}return Math.max(t-n,a)}tensorShapeFromTensor(e,t,n=!0){if(0===t.length){if(-1===e[0])return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return J(e,n)}calculateOutputSize(e){const t=this.valuesShape,n=this.defaultValueShape;a.Wap.validateDefaultValueShape(n,t);const r=this.tensorShapeFromTensor(this.shape,this.shapeShape),s=a.Wap.combineRaggedTensorToTensorShapes(this.raggedRank,r,t);s[0]<0&&(s[0]=e);for(let e=1;e<=this.raggedRank;++e)s[e]<0&&(s[e]=this.getMaxWidth(e));return s}calculateFirstParentOutputIndex(e,t,n){const r=Math.min(e,n),s=[];let o=0;for(let e=0;e<r;++e,o+=t)s.push(o);for(let t=r;t<e;++t)s.push(-1);return a.D5U.assert(s.length===e,(()=>"Final length of result must be equal to firstDimension.")),s}calculateOutputIndexRowSplit(e,t,n,r){const a=e.length,s=[];for(let o=0;o<a-1;++o){const a=e[o+1]-e[o];let i=Math.min(r,a),l=t[o];-1===l&&(i=0);for(let e=0;e<i;++e)s.push(l),l+=n;for(let e=0;e<a-i;++e)s.push(-1)}if(a>0&&s.length!==e[a-1])throw new Error("Invalid row split size.");return s}calculateOutputIndexValueRowID(e,t,n,r){const a=e.length,s=[];if(0===a)return[];let o=0,i=e[0];if(i>=t.length)throw new Error(`Got currentValueRowId=${i}, which is not less than ${t.length}`);let l=t[i];s.push(l);for(let u=1;u<a;++u){const a=e[u];if(a===i)l>=0&&(++o,o<r?l+=n:l=-1);else{if(o=0,i=a,a>=t.length)throw new Error(`Got nextValueRowId=${a} which is not less than ${t.length}`);l=t[a]}s.push(l)}if(s.length!==e.length)throw new Error("Invalid row ids.");return s}calculateOutputIndex(e,t,n,r){const a=this.getRowPartitionTensor(e),s=this.getRowPartitionTypeByDimension(e);switch(s){case q.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,t,n,r);case q.ROW_SPLITS:if(a.length-1>t.length)throw new Error(`Row partition size is greater than output size: ${a.length-1} > ${t.length}`);return this.calculateOutputIndexRowSplit(a,t,n,r);default:throw new Error(`Unsupported partition type: ${q[s]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(0===this.rowPartitionTypes.length)throw new Error("No row_partition_types given.");const t=this.rowPartitionTypes[0];switch(t){case q.FIRST_DIM_SIZE:return e[0];case q.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case q.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${q[t]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const e=this.getFirstDimensionSize(),t=this.calculateOutputSize(e),n=new Array(this.raggedRank+1);n[n.length-1]=1;for(let e=n.length-2;e>=0;--e)n[e]=n[e+1]*t[e+1];const r=J(t,!1),s=a.D5U.getArrayFromDType(this.valuesDType,a.D5U.sizeFromShape(r));if(n[0]*t[0]>0){let a=this.calculateFirstParentOutputIndex(e,n[0],t[0]);for(let e=1;e<=this.raggedRank;++e){a=this.calculateOutputIndex(e-1,a,n[e],t[e])}this.setOutput(this.raggedRank,a,s,r)}return[r,s]}setOutput(e,t,n,r){if(0===n.length)return;const s=this.values,o=n;let i=r.slice();i=i.slice(e+1);const l=a.D5U.sizeFromShape(i),u=t.length;let c=this.defaultValue;if(c.length!==l&&1!==c.length){const e=this.defaultValueShape;(0,a.lub)((()=>{const t=(0,a.XLQ)(c,e),n=(0,a.UFq)(t,i);c=n.dataSync()}))}let d=0,p=0,h=0;for(let e=0;e<=u;++e){let r=e<u?t[e]:-1;if(r!==h){if(p<h){const e=s.subarray(d*l);Y(o.subarray(p*l),e,(h-p)*l)}if(e>=u){const e=n.length;r=Math.floor(e/l)}if(r>h)if(1===this.defaultValue.length)o.subarray(h*l,r*l).fill(this.defaultValue[0]),h=r;else for(;r>h;){Y(o.slice(h*l),c,l),++h}r<0?(d=e+1,p=h):(d=e,p=h,h=p+1)}else++h}}}function Y(e,t,n){for(let r=0;r<n;r++)e[r]=t[r]}function J(e,t){const n=[];for(let r of e){if(r<0){if(!t)throw new Error(`Dimension ${r} must be >= 0`);if(r<-1)throw new Error(`Dimension ${r} must be >= -1`);r=-1}n.push(r)}return n}function ee(e,t,n,r,a,s,o,i,l,u){return new Q(e,t,n,r,a,s,o,i,l,u).compute()}function te(e,t,n,r){if(e===t||e<t&&n<0||t<e&&n>1)return a.D5U.makeZerosTypedArray(0,r);const s=Math.abs(Math.ceil((t-e)/n)),o=a.D5U.makeZerosTypedArray(s,r);t<e&&1===n&&(n=-1),o[0]=e;for(let e=1;e<o.length;e++)o[e]=o[e-1]+n;return o}const ne=v((e=>1/Math.sqrt(e)));T(a.bV0,ne),a.bV0;function re(e,t,n,r,s,o,i,l,u,c){const d=[r/s,s],p=e.values,h=t.values;if(0===r)return(0,a.f3b)(n,t.dtype);const f=(0,a.f3b)(d,t.dtype);"string"==typeof u||"number"==typeof u?f.values.fill(u):"boolean"==typeof u&&f.values.fill(+u);for(let e=0;e<o;e++){const a=[];let o=0;for(let t=0;t<i;t++){const n=p[e*i+t];a.push(n),o+=n*l[t]}if(o<0||o>=r/s)throw new Error(`Invalid indices: ${a} does not index into ${n}`);for(let n=0;n<s;n++)c?f.values[o*s+n]+=h[e*s+n]:f.values[o*s+n]=0===t.rank?h[0]:h[e*s+n]}return f}const ae=v((e=>1/(1+Math.exp(-e))));w(a.a5O,(e=>1/(1+Math.exp(-e)))),a.a5O;function se(e,t,n,r,s){const o=a.kuN.isSliceContinous(r,t,n),i=a.D5U.sizeFromShape(n),l=a.D5U.computeStrides(r);if(o){const n=a.kuN.computeFlatOffset(t,l);return"string"===s?e.slice(n,n+i):e.subarray(n,n+i)}const u="string"===s?a.Wap.fromUint8ToStringArray(e):e,c=(0,a.f3b)(r,s,u),d=(0,a.f3b)(n,s);for(let e=0;e<d.size;++e){const n=d.indexToLoc(e),r=n.map(((e,n)=>e+t[n]));d.set(c.get(...r),...n)}return"string"===s?a.Wap.fromStringArrayToUint8(d.values):d.values}a.p2w;function oe(e,t,n,r,s,o,i){const l=t[0],u=o[0],c=new Array(u),d=new Array(l),p=t[1];if(0===u){if(0!==l)throw new Error(a.Wap.getSparseFillEmptyRowsIndicesDenseShapeMismatch(l));return[a.D5U.getArrayFromDType(n,0),[0,p],a.D5U.getArrayFromDType(s,0),c,d]}let h=!0,f=0;const m=new Array(u).fill(0);for(let t=0;t<l;++t){const n=e[t*p];if(n<0)throw new Error(a.Wap.getSparseFillEmptyRowsNegativeIndexErrorMessage(t,n));if(n>=u)throw new Error(a.Wap.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(t,n,u));++m[n],h=h&&n>=f,f=n}let g=!0;for(let e=0;e<u;++e){const t=0===m[e];c[e]=t,g=g&&!t,m[e]=Math.max(m[e],1),e>0&&(m[e]+=m[e-1])}if(g&&h){const t=e,n=r;for(let e=0;e<l;++e)d[e]=e;return[t,[l,p],n,c,d]}{const t=m[u-1],o=a.D5U.getArrayFromDType(n,t*p),h=a.D5U.getArrayFromDType(s,t),f=new Array(u).fill(0);for(let t=0;t<l;++t){const n=e[t*p],a=f[n],s=(0===n?0:m[n-1])+a;f[n]++;for(let n=0;n<p;++n)o[s*p+n]=e[t*p+n];h[s]=r[t],d[t]=s}for(let e=0;e<u;++e){if(0===f[e]){const t=0===e?0:m[e-1];o[t*p+0]=e;for(let e=1;e<p;++e)o[t*p+e]=0;h[t]=i}}return[o,[t,p],h,c,d]}}function ie(e,t,n,r,s){const o=a.D5U.sizeFromShape(r),i=t[0],l=s.length,u=[];let c=1,d=-1;for(let e=0;e<l;++e){const t=s[e];if(-1===t){if(-1!==d)throw new Error(a.Wap.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(d,e));d=e,u.push(1)}else{if(t<0)throw new Error(a.Wap.getSparseReshapeNegativeOutputDimErrorMessage(e,t));c*=t,u.push(t)}}if(-1!==d){if(c<=0)throw new Error(a.Wap.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());const e=Math.trunc(o/c);if(c*e!==o)throw new Error(a.Wap.getSparseReshapeInputOutputMultipleErrorMessage(r,u));u[d]=e}if(a.D5U.sizeFromShape(u)!==o)throw new Error(a.Wap.getSparseReshapeInputOutputMismatchErrorMessage(r,u));const p=r.length,h=[];if(p>0){h[p-1]=1;for(let e=p-2;e>=0;--e)h[e]=h[e+1]*r[e+1]}const f=[];if(l>0){f[l-1]=1;for(let e=l-2;e>=0;--e)f[e]=f[e+1]*u[e+1]}const m=a.D5U.getArrayFromDType(n,i*l);for(let t=0;t<i;++t){let n=0;for(let r=0;r<p;++r)n+=e[t*p+r]*h[r];for(let e=0;e<l;++e)m[t*l+e]=Math.trunc(n/f[e]),n%=f[e]}return[m,[i,l],u]}function le(e,t,n,r,s,o=!1,i=0){const l=r.length,u=[t[0],e.length/t[0]],c=u[1],d=l>0?s[l-1]+1:0;if(d<0)throw new Error(a.Wap.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());const p=t.slice();p[0]=d;const h=p.reduce(((e,t)=>e*t),1),f=a.D5U.getArrayFromDType(n,h);if(0===l)return d>0&&f.fill(i),[f,p];if(d<=0)throw new Error(a.Wap.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let m=0,g=1,y=0,b=s[m];for(;;){let t=0;if(g<l){if(t=s[g],b===t){++g;continue}if(b>=t)throw new Error(a.Wap.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage())}if(b<0||b>=d)throw new Error(a.Wap.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(b,d));b>y&&f.fill(i,y*c,b*c);for(let t=m;t<g;++t){const n=r[t];if(n<0||n>=u[0])throw new Error(a.Wap.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(t,r[t],u[0]));for(let t=0;t<c;t++)f[b*c+t]+=e[n*c+t]}if(o)for(let e=0;e<c;e++)f[b*c+e]/=g-m;if(m=g,++g,y=b+1,b=t,g>l)break}return y<d&&f.fill(i,y*c,d*c),[f,p]}const ue=v((e=>Math.sqrt(e))),ce=(w(a.FKq,(e=>Math.sqrt(e))),a.FKq,i(((e,t)=>{const n=e-t;return n*n})));f(a._tC,ce),a._tC;function de(e,t,n,r){const s=(0,a.f3b)(e,t.dtype);for(let e=0;e<s.size;e++){const a=s.indexToLoc(e),o=new Array(a.length);for(let e=0;e<o.length;e++)o[e]=a[e]*n[e]+r[e];s.set(t.get(...o),...a)}return s}class pe{constructor(e,t,n,r,s,o){this.separator=a.D5U.encodeString(e),this.nGramWidths=t,this.leftPad=a.D5U.encodeString(n),this.rightPad=a.D5U.encodeString(r),this.padWidth=s,this.preserveShort=o}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}createNGrams(e,t,n,r,a,s){for(let o=0;o<a;++o){const i=this.getPadWidth(s),l=Math.max(0,i-o),u=Math.max(0,i-(a-(o+1))),c=s-(l+u),d=t+(l>0?0:o-i);let p=0;p+=l*this.leftPad.length;for(let t=0;t<c;++t)p+=e[d+t].length;p+=u*this.rightPad.length;p+=(l+u+c-1)*this.separator.length,n[r+o]=new Uint8Array(p);const h=n[r+o];let f=0;const m=e=>e.forEach((e=>h[f++]=e));for(let e=0;e<l;++e)m(this.leftPad),m(this.separator);for(let t=0;t<c-1;++t)m(e[d+t]),m(this.separator);if(c>0){m(e[d+c-1]);for(let e=0;e<u;++e)m(this.separator),m(this.rightPad)}else{for(let e=0;e<u-1;++e)m(this.rightPad),m(this.separator);m(this.rightPad)}}}compute(e,t){const n=e.length,r=t.length;if(r>0){let e=t[0];if(0!==e)throw new Error(`First split value must be 0, got ${e}`);for(let a=1;a<r;++a){let r=t[a]>=e;if(r=r&&t[a]<=n,!r)throw new Error(`Invalid split value ${t[a]}, must be in [${e}, ${n}]`);e=t[a]}if(e!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${e}`)}const s=r-1,o=a.D5U.getArrayFromDType("int32",r);if(0===n||0===r){const e=new Array(n);for(let e=0;e<=s;++e)o[e]=0;return[e,o]}o[0]=0;for(let e=1;e<=s;++e){const n=t[e]-t[e-1];let r=0;this.nGramWidths.forEach((e=>{r+=this.getNumNGrams(n,e)})),this.preserveShort&&n>0&&0===r&&(r=1),o[e]=o[e-1]+r}const i=new Array(o[s]);for(let n=0;n<s;++n){const r=t[n];let a=o[n];if(this.nGramWidths.forEach((s=>{const o=t[n+1]-t[n],l=this.getNumNGrams(o,s);this.createNGrams(e,r,i,a,l,s),a+=l})),this.preserveShort&&a===o[n]){const s=t[n+1]-t[n];if(0===s)continue;const o=s+2*this.padWidth,l=1;this.createNGrams(e,r,i,a,l,o)}}return[i,o]}}function he(e,t,n,r,a,s,o,i){return new pe(n,r,a,s,o,i).compute(e,t)}function fe(e,t,n,r){if(!e.length)return;if(0===t.length){for(let t=0;t<e.length;++t)r.push(e.subarray(t,t+1));return}if(1===t.length){const a=t[0];let s=e.indexOf(a);for(;-1!==s;){const t=e.subarray(0,s);n&&0===t.length||r.push(t),s=(e=e.subarray(s+1)).indexOf(a)}return void(n&&0===e.length||r.push(e))}let a=0;for(let s=0;s<e.length+1;s++)if(s===e.length||-1!==t.indexOf(e[s])){const t=e.subarray(a,s);n&&0===t.length||r.push(t),a=s+1}}function me(e,t,n){const r=e.length,s=[];let o=0,i=0;const l=new Array(r);for(let a=0;a<r;++a){const r=s.length;fe(e[a],t,n,s);const u=s.length-r;l[a]=u,o+=u,i=Math.max(i,u)}const u=a.D5U.getArrayFromDType("int32",2*o),c=new Array(o),d=[r,i];let p=0;for(let e=0;e<r;++e)for(let t=0;t<l[e];++t)u[2*p]=e,u[2*p+1]=t,c[p]=s[p],++p;return[u,c,d]}function ge(e,t){const n=a.D5U.getArrayFromDType("int32",e.length);for(let r=0;r<e.length;++r)n[r]=a.D5U.fingerPrint64(e[r]).modulo(t).getLowBitsUnsigned();return n}const ye=i(((e,t)=>e-t)),be=m(((e,t,n,r)=>({real:e-n,imag:t-r})));f(a.Tr8,ye,be),a.Tr8;function xe(e,t){const n=new Array(e.rank);for(let r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];const r=(0,a.f3b)(n,e.dtype);for(let t=0;t<r.values.length;++t){const n=r.indexToLoc(t),a=new Array(e.rank);for(let t=0;t<a.length;t++)a[t]=n[t]%e.shape[t];const s=e.locToIndex(a);r.values[t]=e.values[s]}return r}const ve=(e,t)=>{const n=t.value-e.value;return 0===n?e.index-t.index:n};function we(e,t,n=0,r=e.length-1){for(;r>n;){if(r-n>600){const a=r-n+1,s=t-n+1,o=Math.log(a),i=.5*Math.exp(2*o/3),l=.5*Math.sqrt(o*i*(a-i)/a)*Math.sign(s-a/2);we(e,t,Math.max(n,Math.floor(t-s*i/a+l)),Math.min(r,Math.floor(t+(a-s)*i/a+l)))}const s=e[t];let o=n,i=r;for(a.D5U.swap(e,n,t),ve(e[r],s)>0&&a.D5U.swap(e,n,r);o<i;){for(a.D5U.swap(e,o,i),o++,i--;ve(e[o],s)<0;)o+=1;for(;ve(e[i],s)>0;)i-=1}0===ve(e[n],s)?a.D5U.swap(e,n,i):(i+=1,a.D5U.swap(e,i,r)),i<=t&&(n=i+1),t<=i&&(r=i-1)}}function Te(e,t,n,r,s){const o=t[t.length-1],[i,l]=[e.length/o,o],u=a.D5U.getTypedArrayFromDType(n,i*r),c=a.D5U.getTypedArrayFromDType("int32",i*r);for(let t=0;t<i;t++){const n=t*l,a=e.subarray(n,n+l);let o=new Array(a.length);a.forEach(((e,t)=>o[t]={value:e,index:t})),r<o.length&&(we(o,r),o=o.slice(0,r)),s&&o.sort(ve);const i=t*r,d=u.subarray(i,i+r),p=c.subarray(i,i+r);for(let e=0;e<r;e++)d[e]=o[e].value,p[e]=o[e].index}const d=t.slice();return d[d.length-1]=r,[(0,a.f3b)(d,n,u),(0,a.f3b)(d,"int32",c)]}function Se(e,t,n,r){const s=a.D5U.parseAxisParam(t,n)[0],o=[1,n[0],1];for(let e=0;e<s;e++)o[0]*=n[e];o[1]=n[s];for(let e=s+1;e<n.length;e++)o[2]*=n[e];const i={},l=new Int32Array(n[s]),u=new a.YDk(o,r,e),c=[],d=1===o[0]&&1===o[2];for(let t=0;t<n[s];t++){let n;if(d)n=e[t].toString();else{const e=[];for(let n=0;n<o[0];n++)for(let r=0;r<o[2];r++)e.push(u.get(n,t,r));n=e.join(",")}if(void 0!==i[n])l[t]=i[n];else{const e=Object.keys(i).length;i[n]=e,l[t]=e,c.push(t)}}const p=o.slice();p[1]=Object.keys(i).length;const h=new a.YDk(p,r);c.forEach(((e,t)=>{for(let n=0;n<o[0];n++)for(let r=0;r<o[2];r++)h.set(u.get(n,e,r),n,t,r)}));const f=n.slice();return f[s]=p[1],{outputValues:h.values,outputShape:f,indices:l}}const{addImpl:Ae,bincountImpl:Ce,bincountReduceImpl:Ie,castImpl:ke,ceilImpl:Ee,concatImpl:Ne,equalImpl:Be,expImpl:Re,expm1Impl:De,floorImpl:Me,gatherNdImpl:Oe,gatherV2Impl:Pe,greaterImpl:$e,greaterEqualImpl:Fe,lessImpl:_e,lessEqualImpl:Le,linSpaceImpl:Ve,logImpl:Ue,maxImpl:Ge,maximumImpl:We,minimumImpl:ze,multiplyImpl:He,negImpl:Ze,notEqualImpl:je,prodImpl:Xe,raggedGatherImpl:Ke,raggedTensorToTensorImpl:qe,rangeImpl:Qe,rsqrtImpl:Ye,scatterImpl:Je,sigmoidImpl:et,simpleAbsImpl:tt,sliceImpl:nt,sparseFillEmptyRowsImpl:rt,sparseReshapeImpl:at,sparseSegmentReductionImpl:st,sqrtImpl:ot,stridedSliceImpl:it,stringNGramsImpl:lt,stringSplitImpl:ut,stringToHashBucketFastImpl:ct,subImpl:dt,tileImpl:pt,topKImpl:ht,transposeImpl:ft,uniqueImpl:mt}=r},7763:(e,t,n)=>{n.d(t,{j:()=>l});var r=n(2579),a=n(5367),s=n(2512);const o="return a + b;",i=(0,a.js)({opSnippet:o,packedOpSnippet:o,supportsComplex:!0,cpuKernelImpl:s.cK}),l={kernelName:r.mm_,backendName:"webgl",kernelFunc:i}},8163:(e,t,n)=>{n.d(t,{R:()=>c,r:()=>d});var r=n(2579),a=n(5367),s=n(3100),o=n(106),i=n(8299),l=n(3255),u=n(2207);const c=1e3;function d({a:e,b:t,transposeA:n,transposeB:d,backend:p,bias:h=null,preluActivationWeights:f=null,leakyreluAlpha:m=0,activation:g=null}){const y=e.shape.length,b=t.shape.length,x=n?e.shape[y-2]:e.shape[y-1],v=d?t.shape[b-1]:t.shape[b-2],w=n?e.shape[y-1]:e.shape[y-2],T=d?t.shape[b-2]:t.shape[b-1],S=e.shape.slice(0,-2),A=t.shape.slice(0,-2),C=r.D5U.sizeFromShape(S),I=r.D5U.sizeFromShape(A),k=r.Jyw.assertAndGetBroadcastShape(e.shape.slice(0,-2),t.shape.slice(0,-2)).concat([w,T]);r.D5U.assert(x===v,(()=>`Error in matMul: inner shapes (${x}) and (${v}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${d} must match.`));const E=n?[C,x,w]:[C,w,x],N=d?[I,T,v]:[I,v,T],B=(0,i.X)({inputs:{x:e},backend:p,attrs:{shape:E}}),R=(0,i.X)({inputs:{x:t},backend:p,attrs:{shape:N}}),D=[B,R],M=Math.max(C,I),O=n?B.shape[1]:B.shape[2],P=null!=h,$=null!=f,F="leakyrelu"===g,_=null!=g?(0,a.g8)(g,!0):null;let L;if((1===w||1===T)&&O>c&&!1===(P||$||F||null!=_)){let e=B,t=R;n&&(e=(0,u.p)({inputs:{x:B},backend:p,attrs:{perm:[0,2,1]}}),D.push(e)),d&&(t=(0,u.p)({inputs:{x:R},backend:p,attrs:{perm:[0,2,1]}}),D.push(t));const r=1===T;let a=e;1!==T&&(a=(0,i.X)({inputs:{x:e},backend:p,attrs:{shape:[M,O,1]}}),D.push(a));const s=1===T?2:1;let c=t;r&&(c=(0,i.X)({inputs:{x:t},backend:p,attrs:{shape:[M,1,O]}}),D.push(c));const h=(0,o.J)({inputs:{a,b:c},backend:p});L=(0,l.S)({inputs:{x:h},backend:p,attrs:{axis:s,keepDims:!0}}),D.push(h)}else{const a=(0,r.x8V)(e.dtype,t.dtype),o=new s.N(E,N,[M,w,T],n,d,P,_,$,F),i=[B,R];if(null!=h&&i.push(h),$&&i.push(f),F){const e=p.makeTensorInfo([],"float32",r.D5U.createScalarValue(m,"float32"));i.push(e),D.push(e)}L=p.runWebGLProgram(o,i,a)}const V=(0,i.X)({inputs:{x:L},backend:p,attrs:{shape:k}});D.push(L);for(const e of D)p.disposeIntermediateTensorInfo(e);return V}},9709:(e,t,n)=>{n.d(t,{M:()=>c});var r=n(2579),a=n(2512),s=n(6515),o=n(8955),i=n(4299),l=n(852),u=n(4518);const c={kernelName:r.RFZ,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:c,attrs:d}=t,{x:p}=n,{dtype:h}=d;if("complex64"===h){if("complex64"===p.dtype)return(0,o.y)({inputs:{x:p},backend:c});const t=r.lls(p.shape),n=e({inputs:{x:p},backend:c,attrs:{dtype:"float32"}}),a=(0,s.P)({inputs:{real:n,imag:t},backend:c});return t.dispose(),c.disposeIntermediateTensorInfo(n),a}if("complex64"===p.dtype){const t=(0,l.k)({inputs:{input:p},backend:c}),n=e({inputs:{x:t},backend:c,attrs:{dtype:h}});return c.disposeIntermediateTensorInfo(t),n}if(!r.D5U.hasEncodingLoss(p.dtype,h)){const e=(0,o.y)({inputs:{x:p},backend:c});return{dataId:e.dataId,shape:e.shape,dtype:h}}if(c.shouldExecuteOnCPU([p])){const e=c.texData.get(p.dataId).values,[t,n,r]=(0,a.cm)(e,p.shape,p.dtype,h);return c.makeTensorInfo(t,n,r)}if("int32"===h)return function(e,t){const n=new u.l(e.shape,"return float(int(x));"),r=t.runWebGLProgram(n,[e],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}(p,c);if("bool"===h){const e=c.makeTensorInfo([],"bool",r.D5U.getTypedArrayFromDType("bool",1)),t={a:p,b:e},n=(0,i.Q)({inputs:t,backend:c});return c.disposeIntermediateTensorInfo(e),n}throw new Error(`Error in Cast: failed to cast ${p.dtype} to ${h}`)}}},6515:(e,t,n)=>{n.d(t,{P:()=>s,z:()=>o});var r=n(2579),a=n(8955);function s(e){const{inputs:t,backend:n}=e,{real:r,imag:s}=t,o=n.makeTensorInfo(r.shape,"complex64"),i=n.texData.get(o.dataId),l=(0,a.y)({inputs:{x:r},backend:n}),u=(0,a.y)({inputs:{x:s},backend:n});return i.complexTensorInfos={real:l,imag:u},o}const o={kernelName:r.Zz9,backendName:"webgl",kernelFunc:s}},7842:(e,t,n)=>{n.d(t,{n:()=>f,Y:()=>m});var r=n(2579),a=n(9610),s=n(6697);class o{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=(0,s.C9)(this.outputShape.length);const{dataFormat:n}=t,r=(0,a.A)(),o="channelsLast"===n,i=o?1:2,l=o?2:3,u=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let c="";for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)c+=`\n blockIndex = rc.z + ${t};\n pos = rc.y + ${e};\n\n ${u}\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[${i}] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[${l}] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (${o}) {\n innerDims = vec2(d1, ch);\n result[${2*e+t}] = getChannel(\n getA(rc.x, d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[${2*e+t}] = getChannel(\n getA(rc.x, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n `;this.userCode=`\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ${c}\n\n ${r.output} = result;\n }\n `}}var i=n(5367),l=n(3100),u=n(1906),c=n(8163),d=n(8955),p=n(8299);function h(e,t){const n=e.length;return n>=3?t?[...e.slice(0,-3),e[n-3]*e[n-2],e[n-1]]:[...e.slice(0,-3),e[n-3],e[n-2]*e[n-1]]:!t&&1===n&&e[0]>1?[e[0],1]:null}function f({x:e,filter:t,convInfo:n,backend:a,bias:s=null,preluActivationWeights:o=null,leakyreluAlpha:i=0,activation:l=null}){const f=e.shape,m=a.texData.get(e.dataId),g=n.inChannels,y=f[0]*f[1]*f[2],b=n.outChannels,x="channelsLast"===n.dataFormat;let v;const w=[];if(null!=o){const e=h(o.shape,x);null!=e&&(o=(0,p.X)({inputs:{x:o},backend:a,attrs:{shape:e}}),w.push(o))}if(null!=s){const e=h(s.shape,x);null!=e&&(s=(0,p.X)({inputs:{x:s},backend:a,attrs:{shape:e}}),w.push(s))}if(!((1===y||1===b)&&g>c.R)&&m.isPacked&&x&&null!=m.texture&&f[2]%2!=0&&r.D5U.arraysEqual(m.shape.slice(-3),f.slice(-3))){const h=f[0]*f[1]*(f[2]+1),g={dataId:e.dataId,shape:[1,h,n.inChannels],dtype:e.dtype},y=m.shape;m.shape=m.shape.slice(),m.shape[m.shape.length-2]++,r.D5U.assert(u.isReshapeFree(m.shape,g.shape),(()=>`packed reshape ${m.shape} to ${g.shape} isn't free`));const b=(0,p.X)({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});w.push(b);const x=(0,c.r)({a:g,b,backend:a,transposeA:false,transposeB:false,bias:s,activation:l,preluActivationWeights:o,leakyreluAlpha:i}),T=a.texData.get(x.dataId);r.D5U.assert(T.isPacked,(()=>"batchMatMul result is expected to be packed")),m.shape=y,T.shape=n.outShape,v=(0,d.y)({inputs:{x},backend:a}),v.shape=n.outShape,w.push(x)}else{const r=n.outHeight*n.outWidth,u=(0,p.X)({inputs:{x:e},backend:a,attrs:{shape:x?[n.batchSize,r,n.inChannels]:[n.batchSize,n.inChannels,r]}}),d=(0,p.X)({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),h=(0,c.r)({a:x?u:d,b:x?d:u,transposeA:!x,transposeB:false,backend:a,bias:s,activation:l,preluActivationWeights:o,leakyreluAlpha:i});v=(0,p.X)({inputs:{x:h},backend:a,attrs:{shape:n.outShape}}),w.push(u),w.push(d),w.push(h)}for(const e of w)a.disposeIntermediateTensorInfo(e);return v}function m({x:e,filter:t,convInfo:n,backend:a,bias:s=null,preluActivationWeights:u=null,leakyreluAlpha:c=0,activation:d=null}){const{filterWidth:f,filterHeight:m,inChannels:g,outWidth:y,outHeight:b,dataFormat:x}=n,v="channelsLast"===x,w=f*m*g,T=b*y,S=[n.batchSize,w,T],A=[];if(null!=u){const e=h(u.shape,v);null!=e&&(u=(0,p.X)({inputs:{x:u},backend:a,attrs:{shape:e}}),A.push(u))}if(null!=s){const e=h(s.shape,v);null!=e&&(s=(0,p.X)({inputs:{x:s},backend:a,attrs:{shape:e}}),A.push(s))}const C=(0,p.X)({inputs:{x:t},backend:a,attrs:{shape:[1,w,r.D5U.sizeFromShape(t.shape)/w]}});A.push(C);const I=new o(S,n),k=[e.shape,[n.padInfo.top,n.padInfo.left],[n.strideHeight,n.strideWidth],[n.dilationHeight,n.dilationWidth],[n.inChannels],[n.filterWidth*n.inChannels],[n.outWidth]],E=a.runWebGLProgram(I,[e],"float32",k),N=(0,p.X)({inputs:{x:E},backend:a,attrs:{shape:S}});A.push(E),A.push(N);const B=null!=s,R=null!=u,D="leakyrelu"===d,M=d?(0,i.g8)(d,!0):null,O=new l.N(v?N.shape:C.shape,v?C.shape:N.shape,v?[n.batchSize,T,n.outChannels]:[n.batchSize,n.outChannels,T],!0,!1,B,M,R,D),P=v?[N,C]:[C,N];if(s&&P.push(s),R&&P.push(u),D){const e=a.makeTensorInfo([],"float32",r.D5U.createScalarValue(c,"float32"));P.push(e),A.push(e)}const $=a.runWebGLProgram(O,P,"float32"),F=(0,p.X)({inputs:{x:$},backend:a,attrs:{shape:n.outShape}});A.push($);for(const e of A)a.disposeIntermediateTensorInfo(e);return F}},5710:(e,t,n)=>{n.d(t,{X:()=>o});var r=n(2579),a=n(4364),s=n(1177);const o={kernelName:r.cie,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:o}=e,{x:i,filter:l}=t,{strides:u,pad:c,dilations:d,dimRoundingMode:p}=o;let h=d;null==h&&(h=[1,1]),r.D5U.assert(r.Wap.eitherStridesOrDilationsAreOne(u,h),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${u} and dilations '${h}'`));const f=r.Wap.computeConv2DInfo(i.shape,l.shape,u,h,c,p,!0);let m;m=(0,r.OBj)().getBool("WEBGL_PACK_DEPTHWISECONV")&&f.strideWidth<=2&&f.outChannels/f.inChannels==1?new s.f(f):new a.J(f);const g=[[f.padInfo.top,f.padInfo.left],[f.strideHeight,f.strideWidth],[f.dilationHeight,f.dilationWidth],[f.inHeight,f.inWidth]];return n.runWebGLProgram(m,[i,l],"float32",g)}}},3041:(e,t,n)=>{n.d(t,{Qq:()=>i,SX:()=>l});var r=n(2579),a=n(5367),s=n(2512);const o=a.E6+"\n return exp(x);\n",i=(0,a.AJ)({opSnippet:o,packedOpSnippet:"\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:s.aX,dtype:"float32"}),l={kernelName:r.NEP,backendName:"webgl",kernelFunc:i}},6623:(e,t,n)=>{n.d(t,{d:()=>s,p:()=>o});var r=n(2579),a=n(8299);function s(e){const{inputs:t,attrs:n,backend:s}=e,{dim:o}=n,{input:i}=t,l=i.shape.length,u=i.shape.slice();let c=o;return o<0&&(r.D5U.assert(-(l+1)<=o,(()=>`Axis must be in the interval [${-(l+1)}, ${l}]`)),c=l+o+1),u.splice(c,0,1),(0,a.X)({inputs:{x:i},backend:s,attrs:{shape:u}})}const o={kernelName:r.YFo,backendName:"webgl",kernelFunc:s}},853:(e,t,n)=>{n.d(t,{h:()=>s,v:()=>o});var r=n(2579);class a{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode="\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}}function s(e){const{backend:t,attrs:n}=e,{shape:s,value:o}=n;let{dtype:i}=n;if(i=i||r.D5U.inferDtype(o),"string"===i){const e=r.D5U.getArrayFromDType(i,r.D5U.sizeFromShape(s));return e.fill(o),t.makeTensorInfo(s,i,e)}{const e=new a(s,o),n=[[o]];return t.runWebGLProgram(e,[],i,n)}}const o={kernelName:r.deh,backendName:"webgl",kernelFunc:s}},619:(e,t,n)=>{n.d(t,{x:()=>l});var r=n(2579),a=n(8378),s=n(9610);class o{constructor(e){this.variableNames=["A"];const t=(0,s.A)(),[n,r]=e;this.outputShape=e,this.userCode=`\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${r}.0, ${n}.0);\n\n vec4 values = ${t.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n `}}class i{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=(0,s.A)(),[n,r]=e;this.outputShape=e,this.userCode=`\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${r}.0, ${n}.0);\n vec4 values = ${t.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ${t.output} = result;\n }\n `}}const l={kernelName:r.eBW,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:s}=e;let{pixels:l}=t;const{numChannels:d}=s,p="undefined"!=typeof HTMLVideoElement&&l instanceof HTMLVideoElement,h="undefined"!=typeof HTMLImageElement&&l instanceof HTMLImageElement,[f,m]=p?[l.videoWidth,l.videoHeight]:[l.width,l.height],g=[m,f],y=[m,f,d];if(h||p){const e=(0,r.OBj)().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");null!=u&&e===c||(c=e,u=document.createElement("canvas").getContext("2d",{willReadFrequently:c})),u.canvas.width=f,u.canvas.height=m,u.drawImage(l,0,0,f,m),l=u.canvas}const b=n.makeTensorInfo(g,"int32");n.texData.get(b.dataId).usage=a.v2.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(b.dataId),l);const x=(0,r.OBj)().getBool("WEBGL_PACK")?new i(y):new o(y),v=n.runWebGLProgram(x,[b],"int32");return n.disposeData(b.dataId),v}};let u,c=(0,r.OBj)().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU")},7650:(e,t,n)=>{n.d(t,{L:()=>u});var r=n(2579),a=n(8954),s=n(2734),o=n(5367),i=n(7842),l=n(8299);const u={kernelName:r._V0,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:u}=e,{x:c,filter:d,bias:p,preluActivationWeights:h}=t,{strides:f,pad:m,dataFormat:g,dilations:y,dimRoundingMode:b,activation:x,leakyreluAlpha:v}=u,w=r.Wap.convertConv2DDataFormat(g),T=r.Wap.computeConv2DInfo(c.shape,d.shape,f,y,m,b,!1,w);let S;const A=[],C=null!=p,I=null!=h,k="leakyrelu"===x,E=()=>{const e=[c,d],t=(e,t)=>{if("NCHW"===t&&1===e.shape.length&&1!==e.shape[0]){const t=(0,l.X)({inputs:{x:e},backend:n,attrs:{shape:[e.shape[0],1,1]}});return A.push(t),t}return e};if(C&&e.push(t(p,g)),I&&e.push(t(h,g)),k){const t=n.makeTensorInfo([],"float32",r.D5U.createScalarValue(v,"float32"));e.push(t),A.push(t)}return e};if(1!==T.filterHeight||1!==T.filterWidth||1!==T.dilationHeight||1!==T.dilationWidth||1!==T.strideHeight||1!==T.strideWidth||"SAME"!==T.padInfo.type&&"VALID"!==T.padInfo.type)if(T.strideWidth<=2&&"channelsLast"===w&&(0,r.OBj)().getBool("WEBGL_EXP_CONV")){const e=x?(0,o.g8)(x,!0):null,t=new s.i(T,C,e,I,k),r=[[T.padInfo.top,T.padInfo.left],[T.strideHeight,T.strideWidth],[T.dilationHeight,T.dilationWidth],[T.inHeight,T.inWidth]],a=E();S=n.runWebGLProgram(t,a,"float32",r)}else if((0,r.OBj)().getBool("WEBGL_CONV_IM2COL"))S=(0,i.Y)({x:c,filter:d,convInfo:T,backend:n,bias:p,activation:x,preluActivationWeights:h,leakyreluAlpha:v});else{const e=x?(0,o.g8)(x,!1):null,t=new a.I(T,C,e,I,k),r=E();S=n.runWebGLProgram(t,r,"float32")}else S=(0,i.n)({x:c,filter:d,convInfo:T,backend:n,bias:p,activation:x,preluActivationWeights:h,leakyreluAlpha:v});const N=(0,l.X)({inputs:{x:S},backend:n,attrs:{shape:T.outShape}});return A.push(S),A.forEach((e=>n.disposeIntermediateTensorInfo(e))),N}}},2812:(e,t,n)=>{n.d(t,{X:()=>i});var r=n(2579),a=n(4364),s=n(1177),o=n(5367);const i={kernelName:r.luS,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{x:l,filter:u,bias:c,preluActivationWeights:d}=t,{strides:p,pad:h,dilations:f,dimRoundingMode:m,activation:g,leakyreluAlpha:y}=i,b=[];let x=f;null==x&&(x=[1,1]),r.D5U.assert(r.Wap.eitherStridesOrDilationsAreOne(p,x),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${p} and dilations '${x}'`));const v=r.Wap.computeConv2DInfo(l.shape,u.shape,p,x,h,m,!0),w=(0,r.OBj)().getBool("WEBGL_PACK_DEPTHWISECONV")&&v.strideWidth<=2&&v.outChannels/v.inChannels==1,T=g?(0,o.g8)(g,w):null,S=[l,u],A=null!=c,C=null!=d,I="leakyrelu"===g;if(A&&S.push(c),C&&S.push(d),I){const e=n.makeTensorInfo([],"float32",r.D5U.createScalarValue(y,"float32"));S.push(e),b.push(e)}let k;k=w?new s.f(v,A,T,C,I):new a.J(v,A,T,C,I);const E=[[v.padInfo.top,v.padInfo.left],[v.strideHeight,v.strideWidth],[v.dilationHeight,v.dilationWidth],[v.inHeight,v.inWidth]],N=n.runWebGLProgram(k,S,"float32",E);return b.forEach((e=>n.disposeIntermediateTensorInfo(e))),N}}},8955:(e,t,n)=>{function r(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}n.d(t,{I:()=>a,y:()=>r});const a={kernelName:n(2579).iJz,backendName:"webgl",kernelFunc:r}},1736:(e,t,n)=>{n.d(t,{Ou:()=>l,oA:()=>o,s4:()=>i});var r=n(2579),a=n(4039),s=n(4488);const o="return (a < 0.) ? b * a : a;",i="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";const l={kernelName:r.J$2,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:l}=e,{x:u}=t,{alpha:c}=l,d=n.makeTensorInfo([],"float32",r.D5U.createScalarValue(c,"float32")),p=(0,r.OBj)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new s.E2(i,u.shape,d.shape):new a.t6(o,u.shape,d.shape),h=n.runWebGLProgram(p,[u,d],"float32");return n.disposeIntermediateTensorInfo(d),h}}},2489:(e,t,n)=>{n.d(t,{s:()=>l,F:()=>u});var r=n(2579),a=n(2512),s=n(745),o=n(8299);var i=n(9435);function l(e){const{inputs:t,backend:n,attrs:l}=e,{x:u}=t,{reductionIndices:c,keepDims:d}=l,p=u.shape.length,h=r.D5U.parseAxisParam(c,u.shape);let f=h;const m=r.Wap.getAxesPermutation(f,p),g=null!=m,y=n.shouldExecuteOnCPU([u]);let b=u;if(g){if(y){const e=n.texData.get(b.dataId).values,t=new Array(p);for(let e=0;e<t.length;e++)t[e]=u.shape[m[e]];const r=(0,a.Fv)(e,u.shape,u.dtype,m,t);b=n.makeTensorInfo(t,u.dtype);n.texData.get(b.dataId).values=r}else b=(0,i.H)(u,m,n);f=r.Wap.getInnerMostAxes(f.length,p)}r.Wap.assertAxesAreInnerMostDims("max",f,p);const[x,v]=r.Wap.computeOutAndReduceShapes(b.shape,f);let w,T=x;if(d&&(T=r.Wap.expandShapeToKeepDim(x,h)),y){const e=n.texData.get(b.dataId).values,t=(0,a.$O)(e,r.D5U.sizeFromShape(v),T,u.dtype);w=n.makeTensorInfo(T,u.dtype);n.texData.get(w.dataId).values=t}else w=function(e,t,n,a){const i=r.D5U.sizeFromShape(t),l=r.D5U.sizeFromShape(e.shape)/i,u=(0,o.X)({inputs:{x:e},attrs:{shape:[l,i]},backend:a}),c=(0,s.u)(u,e.dtype,"max",a),d=(0,o.X)({inputs:{x:c},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(u),a.disposeIntermediateTensorInfo(c),d}(b,v,T,n);return g&&n.disposeIntermediateTensorInfo(b),w}const u={kernelName:r.YoZ,backendName:"webgl",kernelFunc:l}},2079:(e,t,n)=>{n.d(t,{u:()=>i});var r=n(2579),a=n(789),s=n(1906),o=n(8955);const i={kernelName:r.mTV,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{x:l}=t;(0,s.assertNotComplex)(l,"maxPool");const{filterSize:u,strides:c,pad:d,dimRoundingMode:p}=i;r.D5U.assert(r.Wap.eitherStridesOrDilationsAreOne(c,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${c} and dilations '1'`));const h=r.Wap.computePool2DInfo(l.shape,u,c,1,d,p);if(1===h.filterWidth&&1===h.filterHeight&&r.D5U.arraysEqual(h.inShape,h.outShape))return(0,o.y)({inputs:{x:l},backend:n});const f=new a.n(h,"max",!1);return n.runWebGLProgram(f,[l],l.dtype)}}},5452:(e,t,n)=>{n.d(t,{$:()=>l});var r=n(2579),a=n(745),s=n(8299);var o=n(2512),i=n(9435);const l={kernelName:r.q2K,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:l}=e,{keepDims:u,axis:c}=t,d=n,p=l.shape.length,h=r.D5U.parseAxisParam(c,l.shape);let f=h;const m=r.Wap.getAxesPermutation(f,p),g=null!=m,y=d.shouldExecuteOnCPU([l]),b=[];let x=l;if(g){if(y){const e=d.texData.get(x.dataId).values,t=new Array(p);for(let e=0;e<t.length;e++)t[e]=l.shape[m[e]];const n=(0,o.Fv)(e,l.shape,l.dtype,m,t);x=d.makeTensorInfo(t,l.dtype);d.texData.get(x.dataId).values=n}else x=(0,i.H)(l,m,d);b.push(x),f=r.Wap.getInnerMostAxes(f.length,p)}r.Wap.assertAxesAreInnerMostDims("sum",f,p);const[v,w]=r.Wap.computeOutAndReduceShapes(x.shape,f);let T=v;u&&(T=r.Wap.expandShapeToKeepDim(v,h));const S=function(e,t,n,o){const i=r.D5U.sizeFromShape(t),l=r.D5U.sizeFromShape(e.shape)/i,u=(0,s.X)({inputs:{x:e},attrs:{shape:[l,i]},backend:o}),c=(0,a.u)(u,"float32","mean",o),d=(0,s.X)({inputs:{x:c},attrs:{shape:n},backend:o});return o.disposeIntermediateTensorInfo(u),o.disposeIntermediateTensorInfo(c),d}(x,w,T,d);for(const e of b)d.disposeIntermediateTensorInfo(e);return S}}},106:(e,t,n)=>{n.d(t,{J:()=>p,f:()=>h});var r=n(2579);const a="return areal * breal - aimag * bimag;",s="return areal * bimag + aimag * breal;";class o{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=r.Wap.assertAndGetBroadcastShape(t,n),this.userCode=`\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ${e}\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n `}}var i=n(4039),l=n(4488),u=n(2512),c=n(6515);const d="return a * b;";function p(e){const{inputs:t,backend:n}=e,{a:p,b:h}=t,f=r.Wap.upcastType(p.dtype,h.dtype);if("complex64"===p.dtype){const e=n.texData.get(p.dataId),t=n.texData.get(h.dataId),r=new o(a,p.shape,h.shape),i=new o(s,p.shape,h.shape),l=[{dataId:e.complexTensorInfos.real.dataId,dtype:e.complexTensorInfos.real.dtype,shape:p.shape},{dataId:e.complexTensorInfos.imag.dataId,dtype:e.complexTensorInfos.imag.dtype,shape:p.shape},{dataId:t.complexTensorInfos.real.dataId,dtype:t.complexTensorInfos.real.dtype,shape:h.shape},{dataId:t.complexTensorInfos.imag.dataId,dtype:t.complexTensorInfos.imag.dtype,shape:h.shape}],u=n.runWebGLProgram(r,l,"float32"),d=n.runWebGLProgram(i,l,"float32"),f=(0,c.P)({inputs:{real:u,imag:d},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),f}if(n.shouldExecuteOnCPU([p,h])){const e=n.texData.get(p.dataId),t=n.texData.get(h.dataId),[r,a]=(0,u.Th)(p.shape,h.shape,e.values,t.values,f),s=n.makeTensorInfo(a,f);return n.texData.get(s.dataId).values=r,s}let m;return m=(0,r.OBj)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new l.E2(d,p.shape,h.shape):new i.t6(d,p.shape,h.shape),n.runWebGLProgram(m,[p,h],f)}const h={kernelName:r.wYn,backendName:"webgl",kernelFunc:p}},4299:(e,t,n)=>{n.d(t,{Q:()=>o,n:()=>i});var r=n(2579),a=n(5367),s=n(2512);const o=(0,a.js)({opSnippet:"return float(a != b);",cpuKernelImpl:s.cZ,dtype:"bool"}),i={kernelName:r.yQU,backendName:"webgl",kernelFunc:o}},4443:(e,t,n)=>{n.d(t,{Y:()=>u,S:()=>c});var r=n(2579),a=n(5156);class s{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,s=(0,a.kW)(r),o=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),l=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?`\n ${s} start = ${s}(${o});\n ${s} end = ${s}(${i});\n\n void main() {\n ${s} outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ${s} coords = outC - start;\n setOutput(getX(${l}));\n }\n }\n `:`\n int start = ${o};\n int end = ${i};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n `}}var o=n(1034);class i{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,s=(0,a.kW)(r),i=t.map((e=>e[0])).join(","),l=t.map(((t,n)=>t[0]+e[n])).join(","),u=(0,o.Ky)("rc",r),c=(0,o.Ky)("source",r),d=`${u[r-1]} < ${this.outputShape[r-1]}`,p=1===r?"source":`vec2(${c.slice(-2).join()})`,h=[`${s} rc = outputLoc;`,`${u[r-1]} += 1;\n if(${d}) {\n `,1===r?"":`}\n rc = outputLoc;\n ${u[r-2]} += 1;\n if(${u[r-2]} < ${this.outputShape[r-2]}) {`,1===r?"":` ${u[r-1]} += 1;\n if(${d}) {`],f=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))";let m="";for(let e=0,t=1===r?2:4;e<t;e++)m+=`\n ${h[e]}\n if (${f}) {\n result[${e}] = float(value);\n } else {\n ${s} source = rc - start;\n result[${e}] = getChannel(getX(${c.join()}), ${p});\n }\n `;m+=1===r?"} ":"}}",this.userCode=`\n const ${s} start = ${s}(${i});\n const ${s} end = ${s}(${l});\n\n void main() {\n ${s} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${m}\n setOutput(result);\n }\n `}}var l=n(853);const u=e=>{const{inputs:t,backend:n,attrs:a}=e,{x:o}=t,{paddings:u,constantValue:c}=a;if(0===r.D5U.sizeFromShape(o.shape)){const e=u.map(((e,t)=>e[0]+o.shape[t]+e[1]));return(0,l.h)({backend:n,attrs:{shape:e,value:c,dtype:o.dtype}})}const d=(0,r.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new i(o.shape,u,c):new s(o.shape,u,c),p=[[c]];return n.runWebGLProgram(d,[o],o.dtype,p)},c={kernelName:r.lyA,backendName:"webgl",kernelFunc:u}},3525:(e,t,n)=>{n.d(t,{ML:()=>l,VO:()=>i,pU:()=>o});var r=n(2579),a=n(4039),s=n(4488);const o="return (a < 0.) ? b * a : a;",i="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";const l={kernelName:r.o0g,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:l,alpha:u}=t,c=(0,r.OBj)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new s.E2(i,l.shape,u.shape):new a.t6(o,l.shape,u.shape);return n.runWebGLProgram(c,[l,u],"float32")}}},852:(e,t,n)=>{n.d(t,{O:()=>o,k:()=>s});var r=n(2579),a=n(8955);function s(e){const{inputs:t,backend:n}=e,{input:r}=t,s=n.texData.get(r.dataId);return(0,a.y)({inputs:{x:s.complexTensorInfos.real},backend:n})}const o={kernelName:r.xJR,backendName:"webgl",kernelFunc:s}},5937:(e,t,n)=>{n.d(t,{k:()=>a,v:()=>s});var r=n(2579);const a=(0,n(5367).js)({opSnippet:"\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",packedOpSnippet:"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n",checkOutOfBounds:!0}),s={kernelName:r.oHH,backendName:"webgl",kernelFunc:a}},8632:(e,t,n)=>{n.d(t,{N:()=>i});var r=n(2579),a=n(5367);const s=n(4518).D1+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",o=(0,a.AJ)({opSnippet:s,packedOpSnippet:"\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"}),i={kernelName:r.SbG,backendName:"webgl",kernelFunc:o}},8299:(e,t,n)=>{n.d(t,{X:()=>o,b:()=>i});var r=n(2579),a=n(8831),s=n(1906);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:i}=t,{shape:l}=o,u=n,c=r.D5U.sizeFromShape(i.shape),d=r.D5U.inferFromImplicitShape(l,c),p=r.D5U.sizeFromShape(d);r.D5U.assert(c===p,(()=>`The new shape (${d}) has ${p} elements and the old shape (${i.shape}) has ${c} elements. The new shape and old shape must have the same number of elements.`));const h=u.texData.get(i.dataId);return!h.isPacked||(0,s.isReshapeFree)(i.shape,d)||null!==h.texture&&(0,s.isReshapeFree)(h.shape,d)?(u.incRef(i.dataId),{dataId:i.dataId,shape:d,dtype:i.dtype}):function(e,t,n){const r=[(0,s.getBatchDim)(e.shape),...(0,s.getRowsCols)(e.shape)],o={dtype:e.dtype,shape:r,dataId:e.dataId},i=[(0,s.getBatchDim)(t),...(0,s.getRowsCols)(t)],l=new a.v(i,r),u=[r],c=n.runWebGLProgram(l,[o],e.dtype,u,!0);return{dataId:c.dataId,shape:t,dtype:c.dtype}}(i,d,u)}const i={kernelName:r.HZH,backendName:"webgl",kernelFunc:o}},7721:(e,t,n)=>{n.d(t,{T:()=>o});var r=n(2579);class a{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[s,o,i,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${u[0]/c[0]},\n ${u[1]/c[1]});\n const vec2 inputShapeRC = vec2(${o}.0, ${i}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${d};\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n `}}class s{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,o,i,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${u[0]/c[0]},\n ${u[1]/c[1]},\n ${u[1]/c[1]});\n const vec3 inputShapeRC = vec3(${o}.0, ${i}.0,\n ${i}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${d};\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${l-1};\n bool hasNextRow = coords.z < ${n-1};\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n `}}const o={kernelName:r._Yw,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:o}=e,{images:i}=t,{alignCorners:l,halfPixelCenters:u,size:c}=o,[d,p]=c,h=(0,r.OBj)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new s(i.shape,d,p,l,u):new a(i.shape,d,p,l,u);return n.runWebGLProgram(h,[i],"float32")}}},3351:(e,t,n)=>{n.d(t,{B:()=>l});var r=n(2579),a=n(5367),s=n(2512);const o=a.E6+"\n return 1.0 / (1.0 + exp(-1.0 * x));\n",i=(0,a.AJ)({opSnippet:o,packedOpSnippet:"\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:s.UN}),l={kernelName:r.a5O,backendName:"webgl",kernelFunc:i}},9486:(e,t,n)=>{n.d(t,{D:()=>d,X:()=>c});var r=n(2579),a=n(3041),s=n(2489),o=n(5937),i=n(8299),l=n(1119),u=n(3255);function c(e){const{inputs:t,backend:n,attrs:c}=e,{logits:d}=t,{dim:p}=c,h=r.D5U.parseAxisParam([p],d.shape),f=(0,s.s)({inputs:{x:d},backend:n,attrs:{reductionIndices:h,keepDims:!1}}),m=r.Wap.expandShapeToKeepDim(f.shape,h),g=(0,i.X)({inputs:{x:f},backend:n,attrs:{shape:m}}),y=(0,l.l)({inputs:{a:d,b:g},backend:n}),b=(0,a.Qq)({inputs:{x:y},backend:n}),x=(0,u.S)({inputs:{x:b},backend:n,attrs:{axis:h,keepDims:!1}}),v=(0,i.X)({inputs:{x},backend:n,attrs:{shape:m}}),w=(0,o.k)({inputs:{a:b,b:v},backend:n});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(v),w}const d={kernelName:r.Gcp,backendName:"webgl",kernelFunc:c}},1119:(e,t,n)=>{n.d(t,{G:()=>l,l:()=>i});var r=n(2579),a=n(5367),s=n(2512);const o="return a - b;",i=(0,a.js)({opSnippet:o,packedOpSnippet:o,supportsComplex:!0,cpuKernelImpl:s.kI}),l={kernelName:r.Tr8,backendName:"webgl",kernelFunc:i}},3255:(e,t,n)=>{n.d(t,{S:()=>i,y:()=>l});var r=n(2579),a=n(745),s=n(8299),o=n(9435);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:l}=t,{axis:u,keepDims:c}=i;return function(e,t,n,i){const l=t,u=e.shape.length,c=r.D5U.parseAxisParam(l,e.shape);let d=c;const p=r.Wap.getAxesPermutation(d,u),h=null!=p;let f=e;h&&(f=(0,o.H)(e,p,i),d=r.Wap.getInnerMostAxes(d.length,u)),r.Wap.assertAxesAreInnerMostDims("sum",d,u);const[m,g]=r.Wap.computeOutAndReduceShapes(f.shape,d);let y=m;n&&(y=r.Wap.expandShapeToKeepDim(m,c));const b=r.D5U.sizeFromShape(g),x=r.D5U.sizeFromShape(e.shape)/b,v=(0,s.X)({inputs:{x:f},attrs:{shape:[x,b]},backend:i}),w=(0,r.z4k)(e.dtype),T=(0,a.u)(v,w,"sum",i),S=(0,s.X)({inputs:{x:T},attrs:{shape:y},backend:i});return i.disposeIntermediateTensorInfo(v),i.disposeIntermediateTensorInfo(T),h&&i.disposeIntermediateTensorInfo(f),S}(l,u,c,n)}const l={kernelName:r.GBy,backendName:"webgl",kernelFunc:i}},2207:(e,t,n)=>{n.d(t,{b:()=>i,p:()=>o});var r=n(2579),a=n(9435),s=n(2512);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o}=t,{perm:i}=r,l=n,u=o.shape.length,c=new Array(u);for(let e=0;e<c.length;e++)c[e]=o.shape[i[e]];let d;if(l.shouldExecuteOnCPU([o])){const e=l.texData.get(o.dataId).values,t=(0,s.Fv)(e,o.shape,o.dtype,i,c);d=l.makeTensorInfo(c,o.dtype);l.texData.get(d.dataId).values=t}else d=(0,a.H)(o,i,l);return d}const i={kernelName:r.G3Y,backendName:"webgl",kernelFunc:o}},9435:(e,t,n)=>{n.d(t,{H:()=>l});var r=n(2579),a=n(5156);class s{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[t[r]];this.outputShape=n,this.rank=n.length;const r=(0,a.kW)(this.rank),s=function(e){const t=e.length;if(t>6)throw Error(`Transpose for rank ${t} is not yet supported`);const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t);for(let t=0;t<e.length;t++)r[e[t]]=n[t];return r.join()}(t);this.userCode=`\n void main() {\n ${r} resRC = getOutputCoords();\n setOutput(getA(${s}));\n }\n `}}var o=n(1034);class i{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[t[r]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const r=(0,a.kW)(this.rank),s=(0,o.k6)("rc",this.rank),i=new Array(this.rank);for(let e=0;e<t.length;e++)i[t[e]]=s[e];const l=`vec2(${i.slice(-2).join()})`,u=`++${s[this.rank-1]} < ${n[this.rank-1]}`,c=`getChannel(getA(${i.join()}), ${l})`;this.userCode=`\n void main() {\n ${r} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ${c};\n if(${u}) {\n result[1] = ${c};\n }\n --${s[this.rank-1]};\n if(++${s[this.rank-2]} < ${n[this.rank-2]}) {\n result[2] = ${c};\n if(${u}) {\n result[3] = ${c};\n }\n }\n setOutput(result);\n }\n `}}function l(e,t,n){const a=(0,r.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new i(e.shape,t):new s(e.shape,t);return n.runWebGLProgram(a,[e],e.dtype)}},6090:(e,t,n)=>{n.d(t,{d:()=>s});var r=n(2579),a=n(8163);const s={kernelName:r.usg,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a:s,b:o,bias:i,preluActivationWeights:l}=t,{transposeA:u,transposeB:c,activation:d,leakyreluAlpha:p}=r;return(0,a.r)({a:s,b:o,transposeA:u,transposeB:c,backend:n,bias:i,preluActivationWeights:l,leakyreluAlpha:p,activation:d})}}},3100:(e,t,n)=>{n.d(t,{N:()=>a});var r=n(6697);class a{constructor(e,t,n,a=!1,s=!1,o=!1,i=null,l=!1,u=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.enableShapeUniforms=(0,r.C9)(this.outputShape.length);const c=a?e[1]:e[2],d=Math.ceil(c/2),p=a?"i * 2, rc.y":"rc.y, i * 2",h=s?"rc.z, i * 2":"i * 2, rc.z",f=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=s?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let g="",y="";i&&(g=l?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${i}\n }`:u?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${i}\n }`:`vec4 activation(vec4 x) {\n ${i}\n }`,y="result = activation(result);");const b=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),l&&this.variableNames.push("preluActivationWeights"),u&&this.variableNames.push("leakyreluAlpha");let x="rc.x",v="rc.x";e[0]<t[0]?x=`int(min(float(rc.x), ${e[0]-1}.))`:t[0]<e[0]&&(v=`int(min(float(rc.x), ${t[0]-1}.))`),this.userCode=`\n ${g}\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ${d}.0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < ${d}; i++) {\n int batchA = ${x};\n int batchB = ${v};\n vec4 a = getMatrixA(batchA, ${p});\n vec4 b = getMatrixB(batchB, ${h});\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (${f[0]} * ${m[0]});\n result += (${f[1]} * ${m[1]});\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n ${b}\n\n ${y}\n\n setOutput(result);\n }\n `}}},1034:(e,t,n)=>{function r(e,t){return["x","y","z","w","u","v"].slice(0,t).map((t=>`${e}.${t}`))}function a(e,t){return 1===t?[e]:r(e,t)}function s(e,t){if(1===e)return"rc";let n="";for(let r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n}n.d(t,{Ky:()=>a,Qc:()=>s,k6:()=>r})},789:(e,t,n)=>{n.d(t,{I:()=>a,n:()=>r});class r{constructor(e,t,n,r=!1,a=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,o=e.strideHeight,i=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterHeight,d=e.effectiveFilterWidth,p=e.padInfo.top,h=e.padInfo.left;this.outputShape=e.outShape;const f="avg"===t,m=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let y="0.0";if(f||(y="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n const ivec2 strides = ivec2(${o}, ${i});\n const ivec2 pads = ivec2(${p}, ${h});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < ${c};\n wR += ${l}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${d};\n wC += ${u}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${t} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${r?a?m:g:`wR * ${d} + wC`};\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `)}let b=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(b="avgValue / count");const x=4*Math.floor(s/4),v=s%4,w=`\n if (${f}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n `;this.userCode=`\n const ivec2 strides = ivec2(${o}, ${i});\n const ivec2 pads = ivec2(${p}, ${h});\n const float initializationValue = ${y};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= ${e.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4(${y});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ${c};\n wR += ${l}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${x}; wC += 4) {\n int xC = xCCorner + wC * ${u};\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n getValue(batch, xR, xC + 2 * ${u}, d),\n getValue(batch, xR, xC + 3 * ${u}, d)\n );\n\n ${w}\n }\n\n int xC = xCCorner + ${x};\n if (${1===v}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${w}\n } else if (${2===v}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n initializationValue,\n initializationValue\n );\n\n ${w}\n } else if (${3===v}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n getValue(batch, xR, xC + 2 * ${u}, d),\n initializationValue\n );\n\n ${w}\n }\n }\n setOutput(${b});\n }\n `}}class a{constructor(e,t,n,r=!1,a=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,o=e.strideDepth,i=e.strideHeight,l=e.strideWidth,u=e.dilationDepth,c=e.dilationHeight,d=e.dilationWidth,p=e.effectiveFilterDepth,h=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;const b="avg"===t;let x="0.0";if(b||(x="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n const ivec3 strides =\n ivec3(${o}, ${i}, ${l});\n const ivec3 pads = ivec3(${m}, ${g}, ${y});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ${p};\n wD += ${u}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${h};\n wR += ${c}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${f};\n wC += ${d}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${t} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${r?a?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${h} * ${f} +\n wR * ${f} + wC`};\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `)}let v=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(v="avgValue / count");const w=4*Math.floor(s/4),T=s%4,S=`\n if (${b}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n `;this.userCode=`\n const ivec3 strides =\n ivec3(${o}, ${i}, ${l});\n const ivec3 pads = ivec3(${m}, ${g}, ${y});\n const float initializationValue = ${x};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ${e.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(${x});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ${p};\n wD += ${u}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${h};\n wR += ${c}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${w}; wC += 4) {\n int xC = xCCorner + wC * ${d};\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n getValue(batch, xD, xR, xC + 3 * ${d}, ch)\n );\n\n ${S}\n }\n\n int xC = xCCorner + ${w};\n if (${1===T}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${S}\n } else if (${2===T}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n initializationValue,\n initializationValue\n );\n\n ${S}\n } else if (${3===T}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n initializationValue\n );\n\n ${S}\n }\n }\n setOutput(${v});\n }\n }\n `}}},8831:(e,t,n)=>{n.d(t,{v:()=>s});var r=n(6697),a=n(8110);class s{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=(0,r.C9)(this.outputShape.length);let n="";for(let e=0;e<4;e++){let t="thisRC = rc;";e%2==1&&(t+="thisRC.z += 1;"),e>1&&(t+="thisRC.y += 1;"),n+=`\n ${t}\n ${e>0?"if(thisRC.y < rows && thisRC.z < cols){":""}\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${e}] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ${e>0?"}":""}\n `}var s,o;this.userCode=`\n ${s=t,o=this.enableShapeUniforms,`\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${o?a.al(["r","c","d"],"inputShape"):a.RW(["r","c","d"],s)}\n return ivec3(r, c, d);\n }\n `}\n ${this.enableShapeUniforms?a.nc():a.ku(e)}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ${this.enableShapeUniforms?"outShape[1]":e[1]};\n int cols = ${this.enableShapeUniforms?"outShape[2]":e[2]};\n\n ${n}\n\n setOutput(result);\n }\n `}}},5156:(e,t,n)=>{n.d(t,{Tt:()=>b,Vm:()=>i,kW:()=>y});var r=n(2579),a=n(9610),s=n(8110);const{getBroadcastDims:o}=r.Wap;function i(e,t,n){const i=[];if(e.forEach((e=>{const t=r.D5U.sizeFromShape(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform?i.push(`uniform float ${e.name}${t>1?`[${t}]`:""};`):(i.push(`uniform sampler2D ${e.name};`),i.push(`uniform int offset${e.name};`)),n.enableShapeUniforms){const{uniformShape:t}=b(n.packedInputs,e.shapeInfo.logicalShape,e.shapeInfo.texShape);switch(t.length){case 1:i.push(`uniform int ${e.name}Shape;`);break;case 2:i.push(`uniform ivec2 ${e.name}Shape;`);break;case 3:i.push(`uniform ivec3 ${e.name}Shape;`);break;case 4:i.push(`uniform ivec4 ${e.name}Shape;`)}i.push(`uniform ivec2 ${e.name}TexShape;`)}})),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:i.push("uniform int outShape;");break;case 2:i.push("uniform ivec2 outShape;"),i.push("uniform int outShapeStrides;");break;case 3:i.push("uniform ivec3 outShape;"),i.push("uniform ivec2 outShapeStrides;");break;case 4:i.push("uniform ivec4 outShape;"),i.push("uniform ivec3 outShapeStrides;")}i.push("uniform ivec2 outTexShape;")}n.customUniforms&&n.customUniforms.forEach((e=>{i.push(`uniform ${e.type} ${e.name}${e.arrayIndex?`[${e.arrayIndex}]`:""};`)}));const m=i.join("\n"),g=e.map((e=>function(e,t,n=!1,a){let s="";s+=n?u(e,a):l(e,a);const i=e.shapeInfo.logicalShape,c=t.logicalShape;i.length<=c.length&&(s+=n?function(e,t){const n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),s="get"+a+"AtOutCoords",i=e.shapeInfo.logicalShape.length,l=t.logicalShape.length,u=o(e.shapeInfo.logicalShape,t.logicalShape),c=y(l),d=l-i;let p;const h=["x","y","z","w","u","v"];p=0===i?"":l<2&&u.length>=1?"coords = 0;":u.map((e=>`coords.${h[e+d]} = 0;`)).join("\n");let f="";f=l<2&&i>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>`coords.${h[t+d]}`)).join(", ");let m="return outputValue;";const g=1===r.D5U.sizeFromShape(e.shapeInfo.logicalShape),b=1===r.D5U.sizeFromShape(t.logicalShape);if(1!==i||g||b){if(g&&!b)m=1===l?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(u.length){const e=i-2,t=i-1;u.indexOf(e)>-1&&u.indexOf(t)>-1?m="return vec4(outputValue.x);":u.indexOf(e)>-1?m="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":u.indexOf(t)>-1&&(m="return vec4(outputValue.xx, outputValue.zz);")}}else m="\n return vec4(outputValue.xy, outputValue.xy);\n ";return`\n vec4 ${s}() {\n ${c} coords = getOutputCoords();\n ${p}\n vec4 outputValue = get${a}(${f});\n ${m}\n }\n `}(e,t):function(e,t){const n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),s="get"+a+"AtOutCoords",i=t.texShape,l=e.shapeInfo.texShape,u=e.shapeInfo.logicalShape.length,c=t.logicalShape.length;if(!e.shapeInfo.isUniform&&u===c&&null==e.shapeInfo.flatOffset&&r.D5U.arraysEqual(l,i))return`\n float ${s}() {\n return sampleTexture(${n}, resultUV);\n }\n `;const d=y(c),p=o(e.shapeInfo.logicalShape,t.logicalShape),h=c-u;let f;const m=["x","y","z","w","u","v"];f=0===u?"":c<2&&p.length>=1?"coords = 0;":p.map((e=>`coords.${m[e+h]} = 0;`)).join("\n");let g="";g=c<2&&u>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>`coords.${m[t+h]}`)).join(", ");return`\n float ${s}() {\n ${d} coords = getOutputCoords();\n ${f}\n return get${a}(${g});\n }\n `}(e,t));return s}(e,t,n.packedInputs,n.enableShapeUniforms))).join("\n"),x=t.texShape,v=(0,a.A)(),w=function(e){return`\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${e.texture2D}(textureSampler, uv).r;\n }\n `}(v);let T,S,A=function(e){return`${e.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${e.varyingFs} vec2 resultUV;\n ${e.defineOutput}\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n ${e.defineSpecialNaN}\n ${e.defineSpecialInf}\n ${e.defineRound}\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n ${c}\n ${d}\n ${p}\n `}(v);t.isPacked?(T=function(e,t,n){switch(e.length){case 0:return f();case 1:return function(e,t,n){const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(1===r[0])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n ":`\n int getOutputCoords() {\n return 2 * int(resultUV.x * ${r[1]}.0);\n }\n `;if(1===r[1])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n ":`\n int getOutputCoords() {\n return 2 * int(resultUV.y * ${r[0]}.0);\n }\n `;if(n)return"\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n ";return`\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${r[0]}, ${r[1]}));\n return 2 * (resTexRC.x * ${r[1]} + resTexRC.y);\n }\n `}(0,t,n);case 2:return function(e,t,n){const a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(r.D5U.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n ":`\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(${a[0]}, ${a[1]}));\n }\n `;const s=Math.ceil(e[1]/2);if(n)return"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n ";return`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${a[0]}, ${a[1]}));\n\n int index = resTexRC.x * ${a[1]} + resTexRC.y;\n int r = 2 * (index / ${s});\n int c = imod(index, ${s}) * 2;\n\n return ivec2(r, c);\n }\n `}(e,t,n);case 3:return function(e,t,n){if(n)return"\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),s=a*Math.ceil(e[1]/2);return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${r[0]}, ${r[1]}));\n int index = resTexRC.x * ${r[1]} + resTexRC.y;\n\n int b = index / ${s};\n index -= b * ${s};\n\n int r = 2 * (index / ${a});\n int c = imod(index, ${a}) * 2;\n\n return ivec3(b, r, c);\n }\n `}(e,t,n);default:return function(e,t,n){if(n)return"\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),s=a*Math.ceil(e[e.length-2]/2);let o=s,i="",l="b, r, c";for(let t=2;t<e.length-1;t++)o*=e[e.length-t-1],i=`\n int b${t} = index / ${o};\n index -= b${t} * ${o};\n `+i,l=`b${t}, `+l;return`\n ivec${e.length} getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${r[0]}, ${r[1]}));\n int index = resTexRC.x * ${r[1]} + resTexRC.y;\n\n ${i}\n\n int b = index / ${s};\n index -= b * ${s};\n\n int r = 2 * (index / ${a});\n int c = imod(index, ${a}) * 2;\n\n return ivec${e.length}(${l});\n }\n `}(e,t,n)}}(t.logicalShape,x,n.enableShapeUniforms),S=function(e){return`\n void setOutput(vec4 val) {\n ${e.output} = val;\n }\n `}(v)):(T=function(e,t,n){switch(e.length){case 0:return f();case 1:return function(e,t,n){if(1===t[0])return n?"\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n ":`\n int getOutputCoords() {\n return int(resultUV.x * ${t[1]}.0);\n }\n `;if(1===t[1])return n?"\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n ":`\n int getOutputCoords() {\n return int(resultUV.y * ${t[0]}.0);\n }\n `;if(n)return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n ";return`\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n return resTexRC.x * ${t[1]} + resTexRC.y;\n }\n `}(0,t,n);case 2:return function(e,t,n){if(r.D5U.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n ":`\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]}));\n }\n `;if(1===e[1])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n ":`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n return ivec2(index, 0);\n }\n `;if(1===e[0])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n ":`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n return ivec2(0, index);\n }\n `;if(n)return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n ";return`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n int r = index / ${e[1]};\n int c = index - r * ${e[1]};\n return ivec2(r, c);\n }\n `}(e,t,n);case 3:return function(e,t,n){if(n){return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${s.Kn(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n`}const r=s.RW(["r","c","d"],e);return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n ${r}\n return ivec3(r, c, d);\n }\n `}(e,t,n);case 4:return function(e,t,n){if(n){return`\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${s.Kn(["r","c","d","d2"],e)}\n return ivec4(r, c, d, d2);\n }\n `}const r=s.RW(["r","c","d","d2"],e);return`\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n ${r}\n return ivec4(r, c, d, d2);\n }\n `}(e,t,n);case 5:return function(e,t){const n=s.RW(["r","c","d","d2","d3"],e);return`\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]},\n ${t[1]}));\n\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n ${n}\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n `}(e,t);case 6:return function(e,t){const n=s.RW(["r","c","d","d2","d3","d4"],e);return`\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n ${n}\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n `}(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}(t.logicalShape,x,n.enableShapeUniforms),S=function(e){return`\n void setOutput(float val) {\n ${e.output} = vec4(val, 0, 0, 0);\n }\n `}(v)),n.packedInputs&&(A+=h);return[A,w,S,m,T,g,n.userCode].join("\n")}function l(e,t=!1){const n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`float ${r}() {return ${n};}`;const[a,s]=e.shapeInfo.texShape;if(1===a&&1===s)return`\n float ${r}() {\n return sampleTexture(${n}, halfCR);\n }\n `;const o=m(n);if(t)return`\n float ${r}() {\n vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], ${o});\n return sampleTexture(${n}, uv);\n }\n `;const[i,l]=e.shapeInfo.texShape;return`\n float ${r}() {\n vec2 uv = uvFromFlat(${i}, ${l}, ${o});\n return sampleTexture(${n}, uv);\n }\n `}(e,t);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`\n float ${r}(int index) {\n ${g(e)}\n }\n `;const a=e.shapeInfo.texShape,s=a[0],o=a[1];if(1===o&&1===s)return`\n float ${r}(int index) {\n return sampleTexture(${n}, halfCR);\n }\n `;const i=m(n);if(1===o)return t?`\n float ${r}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${i}) + 0.5) / float(${n}TexShape[0]));\n return sampleTexture(${n}, uv);\n }\n `:`\n float ${r}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${i}) + 0.5) / ${s}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(1===s)return t?`\n float ${r}(int index) {\n vec2 uv = vec2((float(index + ${i}) + 0.5) / float(${n}TexShape[1]), 0.5);\n return sampleTexture(${n}, uv);\n }\n `:`\n float ${r}(int index) {\n vec2 uv = vec2((float(index + ${i}) + 0.5) / ${o}.0, 0.5);\n return sampleTexture(${n}, uv);\n }\n `;if(t)return`\n float ${r}(int index) {\n vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], index + ${i});\n return sampleTexture(${n}, uv);\n }\n `;return`\n float ${r}(int index) {\n vec2 uv = uvFromFlat(${s}, ${o}, index + ${i});\n return sampleTexture(${n}, uv);\n }\n `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,s="get"+a.charAt(0).toUpperCase()+a.slice(1),o=e.shapeInfo.texShape;if(null!=o&&r.D5U.arraysEqual(n,o)){if(t)return`\n float ${s}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${a}TexShape[1], ${a}TexShape[0]);\n return sampleTexture(${a}, uv);\n }\n `;const e=o[0];return`\n float ${s}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${o[1]}.0, ${e}.0);\n return sampleTexture(${a}, uv);\n }\n `}const{newShape:i,keptDims:u}=r.D5U.squeezeShape(n),c=i;if(c.length<n.length){const n=["row","col"];return`\n ${l(x(e,c),t)}\n float ${s}(int row, int col) {\n return ${s}(${v(n,u)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${s}(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(${n[1]}, 1)));\n ${g(e)}\n }\n `;const d=o[0],p=o[1],h=m(a);if(1===p)return t?`\n float ${s}(int row, int col) {\n float index = dot(vec3(row, col, ${h}), vec3(${a}Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(${a}TexShape[0]));\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col) {\n float index = dot(vec3(row, col, ${h}), vec3(${n[1]}, 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ${d}.0);\n return sampleTexture(${a}, uv);\n }\n `;if(1===d)return t?`\n float ${s}(int row, int col) {\n float index = dot(vec3(row, col, ${h}), vec3(${a}Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(${a}TexShape[1]), 0.5);\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col) {\n float index = dot(vec3(row, col, ${h}), vec3(${n[1]}, 1, 1));\n vec2 uv = vec2((index + 0.5) / ${p}.0, 0.5);\n return sampleTexture(${a}, uv);\n }\n `;if(t)return`\n float ${s}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${a}Shape[1] + col + ${h};\n vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index);\n return sampleTexture(${a}, uv);\n }\n `;return`\n float ${s}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${n[1]} + col + ${h};\n vec2 uv = uvFromFlat(${d}, ${p}, index);\n return sampleTexture(${a}, uv);\n }\n`}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,s="get"+a.charAt(0).toUpperCase()+a.slice(1),o=n[1]*n[2],i=n[2],{newShape:u,keptDims:c}=r.D5U.squeezeShape(n),d=u;if(d.length<n.length){const n=["row","col","depth"];return`\n ${l(x(e,d),t)}\n float ${s}(int row, int col, int depth) {\n return ${s}(${v(n,c)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${s}(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(${o}, ${i}, 1)));\n ${g(e)}\n }\n `;const p=e.shapeInfo.texShape,h=p[0],f=p[1],y=e.shapeInfo.flatOffset;if(f===o&&null==y)return t?`\n float ${s}(int row, int col, int depth) {\n int stride1 = ${a}Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${a}TexShape[1], ${a}TexShape[0]);\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(${i}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${f}.0, ${h}.0);\n return sampleTexture(${a}, uv);\n }\n `;if(f===i&&null==y)return t?`\n float ${s}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${a}Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${a}TexShape[1], ${a}TexShape[0]);\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${n[1]}, 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${f}.0, ${h}.0);\n return sampleTexture(${a}, uv);\n }\n `;const b=m(a);if(t)return`\n float ${s}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ${a}Shape[1] * ${a}Shape[2];\n int stride1 = ${a}Shape[2];\n int index = row * stride0 + col * stride1 + depth + ${b};\n vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index);\n return sampleTexture(${a}, uv);\n }\n `;return`\n float ${s}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${o} + col * ${i} + depth + ${b};\n vec2 uv = uvFromFlat(${h}, ${f}, index);\n return sampleTexture(${a}, uv);\n }\n `}(e,t);case 4:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,s="get"+a.charAt(0).toUpperCase()+a.slice(1),o=n[3],i=n[2]*o,u=n[1]*i,{newShape:c,keptDims:d}=r.D5U.squeezeShape(n);if(c.length<n.length){const n=["row","col","depth","depth2"];return`\n ${l(x(e,c),t)}\n float ${s}(int row, int col, int depth, int depth2) {\n return ${s}(${v(n,d)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${s}(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(${u}, ${i}, ${o}, 1)));\n ${g(e)}\n }\n `;const p=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,f=h[0],y=h[1],b=`int stride2 = ${a}Shape[3];`,w=`int stride1 = ${a}Shape[2] * stride2;`,T=`int stride0 = ${a}Shape[1] * stride1;`;if(y===u&&null==p)return t?`\n float ${s}(int row, int col, int depth, int depth2) {\n ${b}\n ${w}\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${a}TexShape[1], ${a}TexShape[0]);\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(${i}, ${o}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${y}.0, ${f}.0);\n return sampleTexture(${a}, uv);\n }\n `;if(y===o&&null==p)return t?`\n float ${s}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${a}Shape[1] * ${a}Shape[2], ${a}Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${a}TexShape[1], ${a}TexShape[0]);\n return sampleTexture(${a}, uv);\n }\n `:`\n float ${s}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${n[1]*n[2]}, ${n[2]}, 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${y}.0, ${f}.0);\n return sampleTexture(${a}, uv);\n }\n `;const S=m(a);if(t)return`\n float ${s}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ${b}\n ${w}\n ${T}\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index + ${S});\n return sampleTexture(${a}, uv);\n }\n `;return`\n float ${s}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${u} + col * ${i} +\n depth * ${o} + depth2;\n vec2 uv = uvFromFlat(${f}, ${y}, index + ${S});\n return sampleTexture(${a}, uv);\n }\n `}(e,t);case 5:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),s=t[4],o=t[3]*s,i=t[2]*o,u=t[1]*i,{newShape:c,keptDims:d}=r.D5U.squeezeShape(t);if(c.length<t.length){const t=["row","col","depth","depth2","depth3"];return`\n ${l(x(e,c))}\n float ${a}(int row, int col, int depth, int depth2, int depth3) {\n return ${a}(${v(t,d)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${a}(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(${u}, ${i}, ${o}, ${s})) +\n depth3;\n ${g(e)}\n }\n `;const p=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,f=h[0],y=h[1];if(y===u&&null==p)return`\n float ${a}(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${i}, ${o}, ${s}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${y}.0, ${f}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(y===s&&null==p)return`\n float ${a}(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4(${t[1]*t[2]*t[3]},\n ${t[2]*t[3]}, ${t[3]}, 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${y}.0, ${f}.0);\n return sampleTexture(${n}, uv);\n }\n `;const b=m(n);return`\n float ${a}(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${u} + col * ${i} + depth * ${o} +\n depth2 * ${s} + depth3 + ${b};\n vec2 uv = uvFromFlat(${f}, ${y}, index);\n return sampleTexture(${n}, uv);\n }\n `}(e);case 6:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:s,keptDims:o}=r.D5U.squeezeShape(t);if(s.length<t.length){const t=["row","col","depth","depth2","depth3","depth4"];return`\n ${l(x(e,s))}\n float ${a}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ${a}(${v(t,o)});\n }\n `}const i=t[5],u=t[4]*i,c=t[3]*u,d=t[2]*c,p=t[1]*d;if(e.shapeInfo.isUniform)return`\n float ${a}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4(${p}, ${d}, ${c}, ${u})) +\n dot(\n vec2(depth3, depth4),\n vec2(${i}, 1)));\n ${g(e)}\n }\n `;const h=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,y=f[0],b=f[1];if(b===p&&null==h)return`\n float ${a}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${d}, ${c}, ${u}, ${i})) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${b}.0, ${y}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(b===i&&null==h)return`\n float ${a}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(${t[1]*t[2]*t[3]*t[4]},\n ${t[2]*t[3]*t[4]},\n ${t[3]*t[4]},\n ${t[4]})) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${b}.0, ${y}.0);\n return sampleTexture(${n}, uv);\n }\n `;const w=m(n);return`\n float ${a}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${p} + col * ${d} + depth * ${c} +\n depth2 * ${u} + depth3 * ${i} + depth4 + ${w};\n vec2 uv = uvFromFlat(${y}, ${b}, index);\n return sampleTexture(${n}, uv);\n }\n `}(e);default:throw new Error(`${n.length}-D input sampling is not yet supported`)}}function u(e,t){switch(e.shapeInfo.logicalShape.length){case 0:return function(e){const t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),r=(0,a.A)();return`\n vec4 ${n}() {\n return ${r.texture2D}(${t}, halfCR);\n }\n `}(e);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),s=e.shapeInfo.texShape,o=(0,a.A)();if(t)return`\n vec4 ${r}(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ${o.texture2D}(${n}, uv);\n }\n `;const i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];return`\n vec4 ${r}(int index) {\n vec2 uv = packedUVfrom1D(\n ${i[0]}, ${i[1]}, index);\n return ${o.texture2D}(${n}, uv);\n }\n `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,s=e.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),i=e.shapeInfo.texShape,l=i[0],u=i[1],c=(0,a.A)();if(null!=i&&r.D5U.arraysEqual(n,i))return t?`\n vec4 ${o}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${s}TexShape[1], ${s}TexShape[0]);\n\n return ${c.texture2D}(${s}, uv);\n }\n `:`\n vec4 ${o}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${u}.0, ${l}.0);\n\n return ${c.texture2D}(${s}, uv);\n }\n `;if(t)return`\n vec4 ${o}(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${s}TexShape[0]) / 2.0), ceil(float(${s}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${s}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n return ${c.texture2D}(${s}, uv);\n }\n `;const d=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],p=Math.ceil(n[1]/2);return`\n vec4 ${o}(int row, int col) {\n vec2 uv = packedUVfrom2D(${p}, ${d[0]}, ${d[1]}, row, col);\n return ${c.texture2D}(${s}, uv);\n }\n `}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),o=e.shapeInfo.texShape,i=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)];if(1===n[0]){const r=[1,2],a=["b","row","col"];return`\n ${u(x(e,n.slice(1)),t)}\n vec4 ${s}(int b, int row, int col) {\n return ${s}(${v(a,r)});\n }\n `}const l=(0,a.A)();if(t)return`\n vec4 ${s}(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${r}TexShape[0]) / 2.0), ceil(float(${r}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${r}Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${r}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ${l.texture2D}(${r}, uv);\n }\n `;const c=i[0],d=i[1],p=Math.ceil(n[2]/2),h=p*Math.ceil(n[1]/2);return`\n vec4 ${s}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${c}, ${d}, ${h}, ${p}, b, row, col);\n return ${l.texture2D}(${r}, uv);\n }\n `}(e,t);default:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),s=(0,a.A)();if(t)return`\n vec4 ${r}(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(${n}Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${n}Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ${n}Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${s.texture2D}(${n}, uv);\n }\n `;const o=e.shapeInfo.logicalShape,i=o.length,l=e.shapeInfo.texShape,u=[Math.ceil(l[0]/2),Math.ceil(l[1]/2)],c=u[0],d=u[1],p=Math.ceil(o[i-1]/2);let h=p*Math.ceil(o[i-2]/2),f="int b, int row, int col",m=`b * ${h} + (row / 2) * ${p} + (col / 2)`;for(let e=2;e<i-1;e++)f=`int b${e}, `+f,h*=o[i-e-1],m=`b${e} * ${h} + `+m;return`\n vec4 ${r}(${f}) {\n int index = ${m};\n int texR = index / ${d};\n int texC = index - texR * ${d};\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${d}, ${c});\n return ${s.texture2D}(${n}, uv);\n }\n `}(e,t)}}const c="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",d="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",p="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",h="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function f(){return"\n int getOutputCoords() {\n return 0;\n }\n "}function m(e){return`offset${e}`}function g(e){const t=e.name,n=r.D5U.sizeFromShape(e.shapeInfo.logicalShape);return n<2?`return ${t};`:`\n for (int i = 0; i < ${n}; i++) {\n if (i == index) {\n return ${t}[i];\n }\n }\n `}function y(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function b(e,t,n){const{newShape:a,keptDims:s}=r.D5U.squeezeShape(t),o=t.length,i=e&&3===o&&1===t[0],l=i?t.slice(1):a,u=!e&&o>1&&!r.D5U.arraysEqual(t,n)&&a.length<o||i;return{useSqueezeShape:u,uniformShape:u?l:t,keptDims:s}}function x(e,t){const n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function v(e,t){return t.map((t=>e[t])).join(", ")}},8110:(e,t,n)=>{n.d(t,{Kn:()=>s,RW:()=>a,al:()=>o,ku:()=>i,nc:()=>l,ye:()=>u});var r=n(2579);function a(e,t,n="index"){const a=r.D5U.computeStrides(t);return a.map(((t,r)=>`${`int ${e[r]} = ${n} / ${t}`}; ${r===a.length-1?`int ${e[r+1]} = ${n} - ${e[r]} * ${t}`:`index -= ${e[r]} * ${t}`};`)).join("")}function s(e,t,n="index"){const a=r.D5U.computeStrides(t);return a.map(((t,r)=>`${`int ${e[r]} = ${n} / outShapeStrides[${r}]`}; ${r===a.length-1?`int ${e[r+1]} = ${n} - ${e[r]} * outShapeStrides[${r}]`:`index -= ${e[r]} * outShapeStrides[${r}]`};`)).join("")}function o(e,t,n="index"){const r=function(e,t){const n=e.length,r=e.map((e=>`${t}[${e}]`)),a=new Array(n-1);a[n-2]=r[n-1];for(let e=n-3;e>=0;--e)a[e]=`(${a[e+1]} * ${r[e+1]})`;return a}(e.map(((e,t)=>t)),t);return r.map(((t,a)=>`${`int ${e[a]} = ${n} / ${r[a]}`}; ${a===r.length-1?`int ${e[a+1]} = ${n} - ${e[a]} * ${r[a]}`:`index -= ${e[a]} * ${r[a]}`};`)).join("")}function i(e){const t=r.D5U.computeStrides(e).map((e=>e.toString()));return`\n int getFlatIndex(ivec3 coords) {\n return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z;\n }\n`}function l(){return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n"}const u="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n"},8378:(e,t,n)=>{n.d(t,{Se:()=>d,Sq:()=>p,V9:()=>s,Yz:()=>u,kk:()=>i,m1:()=>r,qe:()=>c,v2:()=>a,yb:()=>l});var r,a,s,o=n(2579);function i(e,t){return[t,e]}function l(e,t){return e*t}function u(e){const t=o.D5U.sizeFromShape(e),n=Math.ceil(t/4);return o.D5U.sizeToSquarishShape(n)}function c(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function d(e,t){const[n,r]=c(e,t);return n*r*4}function p(e,t){const n=e;let r,a,s,i,l,u,c,d,p,h;return 2===(0,o.OBj)().getNumber("WEBGL_VERSION")?(r=n.R32F,a=n.R16F,s=n.RGBA16F,i=n.RGBA32F,l=n.RED,c=4,d=1,p=n.HALF_FLOAT,h=n.FLOAT,u=n.RGBA8):(r=e.RGBA,a=e.RGBA,s=e.RGBA,i=n.RGBA,l=e.RGBA,c=4,d=4,p=null!=t?t.HALF_FLOAT_OES:null,h=e.FLOAT,u=e.RGBA),{internalFormatFloat:r,internalFormatHalfFloat:a,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:l,downloadTextureFormat:u,downloadUnpackNumChannels:c,defaultNumChannels:d,textureTypeHalfFloat:p,textureTypeFloat:h}}!function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"}(r||(r={})),function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"}(a||(a={})),function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(s||(s={}))},4518:(e,t,n)=>{n.d(t,{Cv:()=>l,D1:()=>s,Et:()=>i,RX:()=>u,Tq:()=>p,bl:()=>d,eW:()=>c,l:()=>a,t$:()=>o});var r=n(6697);class a{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=(0,r.C9)(this.outputShape.length),this.userCode=`\n float unaryOperation(float x) {\n ${t}\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n `}}const s="if (isnan(x)) return x;",o="return x;",i="return abs(x);";const l="return (x >= 0.0) ? x : (exp(x) - 1.0);",u=s+"\n return (x < 0.0) ? 0.0 : x;\n",c=s+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",d="return x;",p="return 1.0 / (1.0 + exp(-1.0 * x));"},9365:(e,t,n)=>{n.d(t,{Cv:()=>s,RX:()=>o,Tq:()=>l,cc:()=>u,eW:()=>i,t$:()=>a});var r=n(6697);const a="return x;",s="\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n",o="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",i="\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",l="return 1.0 / (1.0 + exp(-1.0 * x));";class u{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=(0,r.C9)(this.outputShape.length),this.userCode=`\n vec4 unaryOperation(vec4 x) {\n ${t}\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n `}}},1906:(e,t,n)=>{n.r(t),n.d(t,{assertNotComplex:()=>te,bindCanvasToFramebuffer:()=>N,bindColorTextureToFramebuffer:()=>B,bindTextureToProgramUniformSampler:()=>E,bindTextureUnit:()=>A,bindVertexBufferToProgramAttribute:()=>S,callAndCheck:()=>o,canBeRepresented:()=>i,createFragmentShader:()=>d,createFramebuffer:()=>T,createProgram:()=>f,createStaticIndexBuffer:()=>b,createStaticVertexBuffer:()=>y,createTexture:()=>v,createVertexShader:()=>c,getBatchDim:()=>$,getExtensionOrThrow:()=>u,getFramebufferErrorMessage:()=>M,getMaxTexturesInShader:()=>j,getNumChannels:()=>x,getProgramUniformLocation:()=>k,getProgramUniformLocationOrThrow:()=>I,getRowsCols:()=>F,getShapeAs3D:()=>_,getTextureShapeFromLogicalShape:()=>L,getWebGLDisjointQueryTimerVersion:()=>X,getWebGLErrorMessage:()=>l,getWebGLMaxTextureSize:()=>z,hasExtension:()=>K,isCapableOfRenderingToFloatTexture:()=>Q,isDownloadFloatTextureEnabled:()=>Y,isReshapeFree:()=>U,isWebGLFenceEnabled:()=>ee,isWebGLVersionEnabled:()=>q,linkProgram:()=>m,logShaderSourceAndInfoLog:()=>h,resetMaxTextureSize:()=>H,resetMaxTexturesInShader:()=>Z,unbindColorTextureFromFramebuffer:()=>R,unbindTextureUnit:()=>C,validateFramebuffer:()=>D,validateProgram:()=>g,validateTextureSize:()=>w});var r=n(2579),a=n(740),s=n(8378);function o(e,t){const n=t();return(0,r.OBj)().getBool("DEBUG")&&function(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+l(e,t))}(e),n}function i(e){return!!((0,r.OBj)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||5.96e-8<Math.abs(e)&&Math.abs(e)<65504)}function l(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return`Unknown error code ${t}`}}function u(e,t){return O(e,(()=>e.getExtension(t)),'Extension "'+t+'" not supported on this browser.')}function c(e,t){const n=O(e,(()=>e.createShader(e.VERTEX_SHADER)),"Unable to create vertex WebGLShader.");if(o(e,(()=>e.shaderSource(n,t))),o(e,(()=>e.compileShader(n))),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function d(e,t){const n=O(e,(()=>e.createShader(e.FRAGMENT_SHADER)),"Unable to create fragment WebGLShader.");if(o(e,(()=>e.shaderSource(n,t))),o(e,(()=>e.compileShader(n))),(0,r.OBj)().get("ENGINE_COMPILE_ONLY"))return n;if(!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw h(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}const p=/ERROR: [0-9]+:([0-9]+):/g;function h(e,t){const n=p.exec(t);if(null==n)return console.log(`Couldn't parse line number in error: ${t}`),void console.log(e);const a=+n[1],s=e.split("\n"),o=s.length.toString().length+2,i=s.map(((e,t)=>r.D5U.rightPad((t+1).toString(),o)+e));let l=0;for(let e=0;e<i.length;e++)l=Math.max(i[e].length,l);const u=i.slice(0,a-1),c=i.slice(a-1,a),d=i.slice(a);console.log(u.join("\n")),console.log(t.split("\n")[0]),console.log(`%c ${r.D5U.rightPad(c[0],l)}`,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(d.join("\n"))}function f(e){return O(e,(()=>e.createProgram()),"Unable to create WebGLProgram.")}function m(e,t){if(o(e,(()=>e.linkProgram(t))),!(0,r.OBj)().get("ENGINE_COMPILE_ONLY")&&!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function g(e,t){if(o(e,(()=>e.validateProgram(t))),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function y(e,t){const n=O(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return o(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),o(e,(()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW))),n}function b(e,t){const n=O(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return o(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n))),o(e,(()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW))),n}function x(){return 2===(0,r.OBj)().getNumber("WEBGL_VERSION")?1:4}function v(e){return O(e,(()=>e.createTexture()),"Unable to create WebGLTexture.")}function w(e,t){const n=(0,r.OBj)().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){throw new Error("Requested texture size "+`[${e}x${t}]`+" is invalid.")}if(e>n||t>n){throw new Error("Requested texture size "+`[${e}x${t}]`+" greater than WebGL maximum on this browser / GPU "+`[${n}x${n}]`+".")}}function T(e){return O(e,(()=>e.createFramebuffer()),"Unable to create WebGLFramebuffer.")}function S(e,t,n,r,a,s,i){const l=e.getAttribLocation(t,n);return-1!==l&&(o(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,r))),o(e,(()=>e.vertexAttribPointer(l,a,e.FLOAT,!1,s,i))),o(e,(()=>e.enableVertexAttribArray(l))),!0)}function A(e,t,n){P(e,n),o(e,(()=>e.activeTexture(e.TEXTURE0+n))),o(e,(()=>e.bindTexture(e.TEXTURE_2D,t)))}function C(e,t){P(e,t),o(e,(()=>e.activeTexture(e.TEXTURE0+t))),o(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))}function I(e,t,n){return O(e,(()=>e.getUniformLocation(t,n)),'uniform "'+n+'" not present in program.')}function k(e,t,n){return e.getUniformLocation(t,n)}function E(e,t,n,r){o(e,(()=>A(e,t,r))),o(e,(()=>e.uniform1i(n,r)))}function N(e){o(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),o(e,(()=>e.viewport(0,0,e.canvas.width,e.canvas.height))),o(e,(()=>e.scissor(0,0,e.canvas.width,e.canvas.height)))}function B(e,t,n){o(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,n))),o(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)))}function R(e,t){o(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,t))),o(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)))}function D(e){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+M(e,t))}function M(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}function O(e,t,n){const r=o(e,(()=>t()));if(null==r)throw new Error(n);return r}function P(e,t){const n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n){throw new Error(`textureUnit must be in ${`[gl.TEXTURE0, gl.TEXTURE${n}]`}.`)}}function $(e,t=2){return r.D5U.sizeFromShape(e.slice(0,e.length-t))}function F(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function _(e){let t=[1,1,1];return 0===e.length||1===e.length&&1===e[0]||(t=[$(e),...F(e)]),t}function L(e,t=!1){let n=(0,r.OBj)().getNumber("WEBGL_MAX_TEXTURE_SIZE"),a=(0,r.OBj)().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");if(a===1/0&&(0,r.OBj)().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(a=n/2),t&&(n*=2,a*=2,1===(e=e.map(((t,n)=>n>=e.length-2?r.D5U.nearestLargerEven(e[n]):e[n]))).length&&(e=[2,e[0]])),2!==e.length){const t=r.D5U.squeezeShape(e);e=t.newShape}let s=r.D5U.sizeFromShape(e),o=null;e.length<=1&&s<=n?o=[1,s]:2===e.length&&e[0]<=n&&e[1]<=n?o=e:3===e.length&&e[0]*e[1]<=n&&e[2]<=n?o=[e[0]*e[1],e[2]]:3===e.length&&e[0]<=n&&e[1]*e[2]<=n?o=[e[0],e[1]*e[2]]:4===e.length&&e[0]*e[1]*e[2]<=n&&e[3]<=n?o=[e[0]*e[1]*e[2],e[3]]:4===e.length&&e[0]<=n&&e[1]*e[2]*e[3]<=n&&(o=[e[0],e[1]*e[2]*e[3]]);const i=null!=o&&Math.max(...o)>a&&Math.min(...o)<=(t?2:1)&&Math.min(...o)>0;if(null==o||i)if(t){const t=$(e);let n=2,a=2;e.length&&([n,a]=F(e)),s=t*(n/2)*(a/2),o=r.D5U.sizeToSquarishShape(s).map((e=>2*e))}else o=r.D5U.sizeToSquarishShape(s);return o}function V(e){return e%2==0}function U(e,t){if(e=e.slice(-2),t=t.slice(-2),r.D5U.arraysEqual(e,t))return!0;if(!e.length||!t.length)return!0;if(0===e[0]||0===e[1]||0===t[0]||0===t[1])return!0;if(e.length!==t.length){const n=e.slice(-1)[0],r=t.slice(-1)[0];if(n===r)return!0;if(V(n)&&V(r)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&V(e[0])&&V(t[0])}let G,W;function z(e){if(null==G){const t=(0,a.jl)(e);G=t.getParameter(t.MAX_TEXTURE_SIZE)}return G}function H(){G=null}function Z(){W=null}function j(e){if(null==W){const t=(0,a.jl)(e);W=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,W)}function X(e){if(0===e)return 0;let t;const n=(0,a.jl)(e);return t=K(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:K(n,"EXT_disjoint_timer_query")?1:0,t}function K(e,t){return null!=e.getExtension(t)}function q(e){try{if(null!=(0,a.jl)(e))return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function Q(e){if(0===e)return!1;const t=(0,a.jl)(e);if(1===e){if(!K(t,"OES_texture_float"))return!1}else if(!K(t,"EXT_color_buffer_float"))return!1;return J(t)}function Y(e){if(0===e)return!1;const t=(0,a.jl)(e);if(1!==e){if(K(t,"EXT_color_buffer_float"))return J(t);const e="EXT_color_buffer_half_float";if(K(t,e)){const n=t.getExtension(e);return function(e,t){const n=(0,s.Sq)(e,t),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const a=1,o=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,a,o,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);const l=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(i),l}(t,n)}return!1}if(!K(t,"OES_texture_float"))return!1;if(!K(t,"WEBGL_color_buffer_float"))return!1;return J(t)}function J(e){const t=(0,s.Sq)(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);const r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(r),a}function ee(e){if(2!==e)return!1;return null!=(0,a.jl)(e).fenceSync}function te(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&r.D5U.assert("complex64"!==e.dtype,(()=>`${t} does not support complex64 tensors in the WebGL backend.`))}))}},7437:(e,t,n)=>{n.d(t,{g_:()=>ut,Ue:()=>N,YL:()=>ct,fM:()=>dt,iw:()=>k,gJ:()=>pt});var r={};n.r(r),n.d(r,{json:()=>F});var a={};n.r(a),n.d(a,{json:()=>_});var s={};n.r(s),n.d(s,{json:()=>L});var o={};n.r(o),n.d(o,{json:()=>V});var i={};n.r(i),n.d(i,{json:()=>U});var l={};n.r(l),n.d(l,{json:()=>G});var u={};n.r(u),n.d(u,{json:()=>W});var c={};n.r(c),n.d(c,{json:()=>z});var d={};n.r(d),n.d(d,{json:()=>H});var p={};n.r(p),n.d(p,{json:()=>Z});var h={};n.r(h),n.d(h,{json:()=>j});var f={};n.r(f),n.d(f,{json:()=>X});var m={};n.r(m),n.d(m,{json:()=>K});var g={};n.r(g),n.d(g,{json:()=>q});var y={};n.r(y),n.d(y,{json:()=>Q});var b={};n.r(b),n.d(b,{json:()=>Y});var x={};n.r(x),n.d(x,{json:()=>J});var v={};n.r(v),n.d(v,{json:()=>ee});var w={};n.r(w),n.d(w,{json:()=>te});var T={};n.r(T),n.d(T,{add:()=>Ce.I,avgPool:()=>Ve.w,concat:()=>Me.z,depthwiseConv2d:()=>we.B,fused:()=>Ue,max:()=>Se.F,maxPool:()=>Te._,mean:()=>$e.J,mul:()=>Oe.d,pad:()=>ke.v,prelu:()=>Le.A,relu:()=>Ie.U,relu6:()=>Pe.b,reshape:()=>Re.X,scalar:()=>_e.i,sigmoid:()=>Fe.X,softmax:()=>Ae.X,squeeze:()=>Be.L,stack:()=>De.k,stridedSlice:()=>Ne.N,tensor1d:()=>Ee.R});var S=n(2579);var A,C;(0,S.OBj)().registerFlag("KEEP_INTERMEDIATE_TENSORS",(()=>!1),(e=>{e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")})),function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"}(A||(A={})),function(e){let t;!function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"}(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))}(C||(C={}));const I={};function k(e,t){const n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};I[e]=n}function E(e){return I[e]}function N(e){delete I[e]}function B(e,t,n,r,a){const s=t.inputParams[e];if(s&&void 0!==s.inputIndexStart){const e=s.inputIndexStart,o=0===s.inputIndexEnd?void 0:void 0===s.inputIndexEnd?e+1:s.inputIndexEnd;if("tensor"===s.type)return R(t.inputNames[s.inputIndexStart],n,r,a);if("tensors"===s.type){return t.inputNames.slice(e,o).map((e=>R(e,n,r,a)))}const i=R(t.inputNames.slice(e)[0],n,r,a),l=i.dataSync();return"number"===s.type?l[0]:S.D5U.toNestedArray(i.shape,l)}const o=t.attrParams[e];return o&&o.value}function R(e,t,n,r){const[a,s]=O(e);if(null!=r){const e=r.getHashTableHandleByName(a);if(null!=e)return e}const o=n.currentContextIds.find((e=>!!t[M(a,e)]));return void 0!==o?t[M(a,o)][s]:void 0}function D(e,t){const[n,r,a]=O(e);return[M(n,t&&t.currentContextId),r,a]}function M(e,t){return t?`${e}-${t}`:e}function O(e){const t=e.split(":");if(1===t.length)return[e,0,void 0];const n=t[0],r=3===t.length?t[1]:void 0;return[n,Number(t[t.length-1]),r]}function P(e,t,n){let r=B("pad",e,t,n);if("explicit"===r){r=B("explicitPaddings",e,t,n);const a=[[0,0],[0,0],[0,0],[0,0]];for(let e=0;e<4;e++)a[e][0]=r[2*e],a[e][1]=r[2*e+1];return a}return r}function $(e){return e.kept?e:(0,S.d9v)(e)}const F=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],_=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],L=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}],V=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],U=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],G=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],W=[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],z=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],H=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]}],Z=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}],j=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],X=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]}],K=[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}],q=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],Q=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}],Y=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],J=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],ee=[{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],te=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}];class ne{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[].concat(...[r,a,s,o,i,l,u,c,d,p,h,f,m,g,y,b,x,v,w].map((e=>e.json)));this.opMappers=e.reduce(((e,t)=>(e[t.tfOpName]=t,e)),{})}transformGraph(e,t={}){const n=e.node,r=[],a=[],s=[],o=n.reduce(((e,t)=>(e[t.name]=this.mapNode(t),t.op.startsWith("Placeholder")?r.push(e[t.name]):"Const"===t.op?a.push(e[t.name]):null!=t.input&&0!==t.input.length||s.push(e[t.name]),e)),{});let i=[];const l=[];let u={},c={};null!=t&&(u=this.mapSignatureEntries(t.inputs),c=this.mapSignatureEntries(t.outputs));const d=Object.keys(o);d.forEach((e=>{const t=o[e];t.inputNames.forEach(((e,n)=>{const[r,,a]=D(e),s=o[r];if(null!=s.outputs){const e=s.outputs.indexOf(a);if(-1!==e){const a=`${r}:${e}`;t.inputNames[n]=a}}t.inputs.push(s),s.children.push(t)}))})),0===Object.keys(c).length?d.forEach((e=>{const t=o[e];0===t.children.length&&l.push(t)})):Object.keys(c).forEach((e=>{const[t]=D(e),n=o[t];null!=n&&(n.signatureKey=c[e],l.push(n))})),Object.keys(u).length>0?Object.keys(u).forEach((e=>{const[t]=D(e),n=o[t];n&&(n.signatureKey=u[e],i.push(n))})):i=r;let p={};null!=e.library&&null!=e.library.function&&(p=e.library.function.reduce(((e,t)=>(e[t.signature.name]=this.mapFunction(t),e)),{}));const h={nodes:o,inputs:i,outputs:l,weights:a,placeholders:r,signature:t,functions:p};return s.length>0&&(h.initNodes=s),h}mapSignatureEntries(e){return Object.keys(e||{}).reduce(((t,n)=>(t[e[n].name]=n,t)),{})}mapNode(e){const t=E(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});const n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map((e=>e.startsWith("^")?e.slice(1):e)),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return null!=t.inputs&&(n.inputParams=t.inputs.reduce(((e,t)=>(e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e)),{})),null!=t.attrs&&(n.attrParams=t.attrs.reduce(((t,n)=>{const r=n.type;let a;switch(n.type){case"string":a=ae(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=ae(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":a=fe(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=fe(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":a=oe(e.attr,n.tfName,n.defaultValue||0),void 0===a&&n.tfDeprecatedName&&(a=oe(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":a=he(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=he(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":a=se(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=se(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":a=ge(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=ge(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":a=pe(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=pe(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":a=me(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=me(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":a=ue(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=ue(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":a=ce(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=ce(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":a=le(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=le(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${n.type} for op: ${e.op}`)}return t[n.name]={value:a,type:r},t}),{})),n}mapFunction(e){const t=e.nodeDef,n=[];let r={};null!=t&&(r=t.reduce(((e,t)=>(e[t.name]=this.mapNode(t),"Const"===t.op&&n.push(e[t.name]),e)),{}));const a=[],s=[];e.signature.inputArg.forEach((e=>{const[t]=D(e.name),n={name:t,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:ie(e.type),type:"dtype"}},children:[]};n.signatureKey=e.name,a.push(n),r[t]=n}));Object.keys(r).forEach((e=>{const t=r[e];t.inputNames.forEach(((e,n)=>{const[a,,s]=D(e),o=r[a];if(null!=o.outputs){const e=o.outputs.indexOf(s);if(-1!==e){const r=`${a}:${e}`;t.inputNames[n]=r}}t.inputs.push(o),o.children.push(t)}))}));const o=e.ret;e.signature.outputArg.forEach((e=>{const[t,n]=D(o[e.name]),a=r[t];null!=a&&(a.defaultOutput=n,s.push(a))}));const i=this.mapArgsToSignature(e);return{nodes:r,inputs:a,outputs:s,weights:n,placeholders:[],signature:i}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce(((e,t)=>(e[t.name]=this.mapArgToTensorInfo(t),e)),{}),outputs:e.signature.outputArg.reduce(((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t)),{})}}mapArgToTensorInfo(e,t){let n=e.name;return null!=t&&(n=t[n]),{name:n,dtype:e.type}}}function re(e,t){const n=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){const t=(0,S.OBj)().global;if(void 0!==t.atob)return t.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return t?n:n.toLowerCase()}function ae(e,t,n,r=!1){const a=e[t];return null!=a?re(a.s,r):n}function se(e,t,n){const r=e[t];return r?r.b:n}function oe(e,t,n){const r=e[t]||{},a=null!=r.i?r.i:null!=r.f?r.f:n;return"number"==typeof a?a:parseInt(a,10)}function ie(e){switch("string"==typeof e&&(e=A[e]),e){case A.DT_FLOAT:case A.DT_HALF:return"float32";case A.DT_INT32:case A.DT_INT64:case A.DT_INT8:case A.DT_UINT8:return"int32";case A.DT_BOOL:return"bool";case A.DT_DOUBLE:return"float32";case A.DT_STRING:return"string";default:return null}}function le(e,t,n){const r=e[t];return r&&r.func?r.func.name:n}function ue(e,t,n){const r=e[t];return r&&r.type?ie(r.type):n}function ce(e,t,n){const r=e[t];return r&&r.list&&r.list.type?r.list.type.map((e=>ie(e))):n}function de(e){if(!e.unknownRank)return null!=e.dim?e.dim.map((e=>"number"==typeof e.size?e.size:parseInt(e.size,10))):[]}function pe(e,t,n){const r=e[t];return r&&r.shape?de(r.shape):n}function he(e,t,n){const r=e[t];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map((e=>"number"==typeof e?e:parseInt(e,10))):n}function fe(e,t,n,r=!1){const a=e[t];return a&&a.list&&a.list.s?a.list.s.map((e=>re(e,r))):n}function me(e,t,n){const r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map((e=>de(e))):n}function ge(e,t,n){const r=e[t];return r&&r.list&&r.list.b?r.list.b:n}class ye{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map((e=>this.getInput(e))),null!=e.rawAttrs&&(this.attrs=Object.keys(e.rawAttrs).reduce(((e,t)=>(e[t]=this.getAttr(t),e)),{}))}getInput(e){return R(e,this.tensorMap,this.context)}getAttr(e,t){const n=this.node.rawAttrs[e];if(null!=n.tensor)return R(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return oe(this.node.rawAttrs,e,t);if(null!=n.s)return ae(this.node.rawAttrs,e,t);if(null!=n.b)return se(this.node.rawAttrs,e,t);if(null!=n.shape)return pe(this.node.rawAttrs,e,t);if(null!=n.type)return ue(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return he(this.node.rawAttrs,e,t);if(null!=n.list.s)return fe(this.node.rawAttrs,e,t);if(null!=n.list.shape)return me(this.node.rawAttrs,e,t);if(null!=n.list.b)return ge(this.node.rawAttrs,e,t);if(null!=n.list.type)return ce(this.node.rawAttrs,e,t)}return t}}var be=n(8810),xe=n(5901),ve=n(59),we=n(4718),Te=n(1174),Se=n(3307),Ae=n(682),Ce=n(6407),Ie=n(7409),ke=n(9682),Ee=n(6092),Ne=n(5158),Be=n(9590),Re=n(4968),De=n(2991),Me=n(6884),Oe=n(4841),Pe=n(3582),$e=n(5130),Fe=n(625),_e=n(9494),Le=n(8151),Ve=n(5176);const Ue={conv2d:be.T,matMul:xe.O,depthwiseConv2d:ve.B};function Ge(e,t,n=""){if("number"!=typeof e&&"number"!=typeof t){S.D5U.assert(e.length===t.length,(()=>n+` Shapes ${e} and ${t} must match`));for(let r=0;r<e.length;r++){const a=e[r],s=t[r];S.D5U.assert(a<0||s<0||a===s,(()=>n+` Shapes ${e} and ${t} must match`))}}}function We(e){return"number"!=typeof e&&!e.some((e=>e<0))}function ze(e,t,n){let r=He(e,n);const a=!We(r);if(a&&0===t.length)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${r}`);if(a&&t.forEach((e=>{r=He(e.shape,r)})),!We(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function He(e,t){if("number"==typeof e)return t;if("number"==typeof t)return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);const n=[];for(let r=0;r<e.length;++r){const a=e[r],s=t[r];if(a>=0&&s>=0&&a!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[r]=a>=0?a:s}return n}class Ze{constructor(e,t,n,r,a,s,o){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=r,this.identicalElementShapes=a,this.dynamicSize=s,this.clearAfterRead=o,this.tensors=[],this.closed_=!1,this.idTensor=(0,S.iD$)(0),(0,S.CnY)(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.tensor.id)||t.tensor.dispose()})),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);const t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map((e=>this.read(e)))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);const n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e},\n because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),Ge(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,(0,S.CnY)(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach(((e,n)=>this.write(e,t[n])))}gather(e,t){if(t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let t=0;t<this.size();t++)e.push(t)}if(0===e.length)return(0,S.XeE)([],[0].concat(this.elementShape));const n=this.readMany(e);return Ge(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),(0,S.knu)(n,0)}concat(e){if(e&&e!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${e}`);if(0===this.size())return(0,S.XeE)([],[0].concat(this.elementShape));const t=[];for(let e=0;e<this.size();e++)t.push(e);const n=this.readMany(t);return Ge(this.elementShape,n[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${n[0].shape})`),(0,S.zoF)(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);if(e.length!==t.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${t.shape[0]}`);const n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(e,(0,S.HHK)(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0;const r=e.map((e=>(n+=e,n)));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);const a=0===n?0:t.size/n,s=[];(0,S.lub)((()=>{t=(0,S.XLQ)(t,[1,n,a]);for(let n=0;n<e.length;++n){const o=[0,0===n?0:r[n-1],0],i=[1,e[n],a];s[n]=(0,S.XLQ)((0,S.tPi)(t,o,i),this.elementShape)}return s}));const o=[];for(let t=0;t<e.length;t++)o[t]=t;this.writeMany(o,s)}}class je{constructor(e,t,n,r=-1){this.tensors=e,this.elementShape=t,this.elementDtype=n,null!=e&&e.forEach((e=>{if(n!==e.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${e.dtype}`);Ge(t,e.shape,"TensorList shape mismatch: "),(0,S.CnY)(e)})),this.idTensor=(0,S.iD$)(0),this.maxNumElements=r,(0,S.CnY)(this.idTensor)}get id(){return this.idTensor.id}copy(){return new je([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.id)||t.dispose()})),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(-1!==n&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);Ge(e,this.elementShape,"TensorList shape mismatch: ");const r=ze(this.elementShape,this.tensors,e);return(0,S.lub)((()=>{const e=this.tensors.map((e=>(0,S.XLQ)(e,r)));return(0,S.knu)(e,0)}))}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(0===this.size())throw new Error("Trying to pop from an empty list.");const n=ze(this.elementShape,this.tensors,e),r=this.tensors.pop();return r.kept=!1,Ge(r.shape,e,"TensorList shape mismatch: "),(0,S.XLQ)(r,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(Ge(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");(0,S.CnY)(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(-1!==this.maxNumElements&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);const t=new je([],this.elementShape,this.elementDtype,this.maxNumElements);t.tensors.length=e;for(let n=0;n<Math.min(this.tensors.length,e);++n)t.tensors[n]=this.tensors[n];return t}getItem(e,t,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(null==this.tensors[e])throw new Error(`element at index ${e} is null.`);Ge(this.tensors[e].shape,t,"TensorList shape mismatch: ");const r=ze(this.elementShape,this.tensors,t);return(0,S.XLQ)(this.tensors[e],r)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(e<0||-1!==this.maxNumElements&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);Ge(this.elementShape,t.shape,"TensorList shape mismatch: "),(0,S.CnY)(t),null!=this.tensors[e]&&(this.tensors[e].kept=!1),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);Ge(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());const r=ze(this.elementShape,this.tensors,n);return 0===e.length?(0,S.XeE)([],[0].concat(r)):(0,S.lub)((()=>{const t=e.map((e=>(0,S.XLQ)(this.tensors[e],r)));return(0,S.knu)(t,0)}))}concat(e,t){if(e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);Ge(this.elementShape,t,"TensorList shape mismatch: ");const n=ze(this.elementShape,this.tensors,t);return 0===this.size()?(0,S.XeE)([],[0].concat(n)):(0,S.lub)((()=>{const e=this.tensors.map((e=>(0,S.XLQ)(e,n)));return(0,S.zoF)(e,0)}))}}const Xe=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{const r=B("thenBranch",e,t,n),a=B("elseBranch",e,t,n),s=B("cond",e,t,n),o=B("args",e,t,n);return(await s.data())[0]?n.functionMap[r].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap):n.functionMap[a].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=B("body",e,t,n),a=B("cond",e,t,n),s=B("args",e,t,n),o=await n.functionMap[a].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),i=s.map((e=>e.id));let l=await o[0].data();o.forEach((e=>{e.kept||-1!==i.indexOf(e.id)||e.dispose()}));let u=s;for(;l[0];){const e=u;u=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);const t=u.map((e=>e.id));e.forEach((e=>{e.kept||-1!==i.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}));const s=await n.functionMap[a].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await s[0].data(),s.forEach((e=>{e.kept||-1!==i.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}))}return u}case"LoopCond":return[$(B("pred",e,t,n))];case"Switch":{const r=B("pred",e,t,n);let a=B("data",e,t,n);return a.kept||(a=$(a)),(await r.data())[0]?[void 0,a]:[a,void 0]}case"Merge":{const r=e.inputNames.find((e=>void 0!==R(e,t,n)));if(r){return[$(R(r,t,n))]}return}case"Enter":{const r=B("frameName",e,t,n),a=B("tensor",e,t,n);return n.enterFrame(r),[$(a)]}case"Exit":{const r=B("tensor",e,t,n);return n.exitFrame(),[$(r)]}case"NextIteration":{const r=B("tensor",e,t,n);return n.nextIteration(),[$(r)]}case"TensorArrayV3":{const r=B("size",e,t,n),a=B("dtype",e,t,n),s=B("elementShape",e,t,n),o=B("dynamicSize",e,t,n),i=B("clearAfterRead",e,t,n),l=B("identicalElementShapes",e,t,n),u=B("name",e,t,n),c=new Ze(u,a,r,s,l,o,i);return n.addTensorArray(c),[c.idTensor,(0,S.iD$)(1)]}case"TensorArrayWriteV3":{const r=B("tensorArrayId",e,t,n),a=B("index",e,t,n),s=B("tensor",e,t,n),o=n.getTensorArray(r.id);return o.write(a,s),[o.idTensor]}case"TensorArrayReadV3":{const r=B("tensorArrayId",e,t,n),a=B("index",e,t,n);return[n.getTensorArray(r.id).read(a)]}case"TensorArrayGatherV3":{const r=B("tensorArrayId",e,t,n),a=B("indices",e,t,n),s=B("dtype",e,t,n);return[n.getTensorArray(r.id).gather(a,s)]}case"TensorArrayScatterV3":{const r=B("tensorArrayId",e,t,n),a=B("indices",e,t,n),s=B("tensor",e,t,n),o=n.getTensorArray(r.id);return o.scatter(a,s),[o.idTensor]}case"TensorArrayConcatV3":{const r=B("tensorArrayId",e,t,n),a=n.getTensorArray(r.id),s=B("dtype",e,t,n);return[a.concat(s)]}case"TensorArraySplitV3":{const r=B("tensorArrayId",e,t,n),a=B("tensor",e,t,n),s=B("lengths",e,t,n),o=n.getTensorArray(r.id);return o.split(s,a),[o.idTensor]}case"TensorArraySizeV3":{const r=B("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return[(0,S.iD$)(a.size(),"int32")]}case"TensorArrayCloseV3":{const r=B("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return a.clearAndClose(),[a.idTensor]}case"TensorListSetItem":{const r=B("tensorListId",e,t,n),a=B("index",e,t,n),s=B("tensor",e,t,n),o=n.getTensorList(r.id);return o.setItem(a,s),[o.idTensor]}case"TensorListGetItem":{const r=B("tensorListId",e,t,n),a=B("index",e,t,n),s=B("elementShape",e,t,n),o=B("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(a,s,o)]}case"TensorListScatterV2":case"TensorListScatter":{const r=B("indices",e,t,n),a=function(e,t,n,r){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);const a=Math.max(...t);if(null!=r&&-1!==r&&a>=r)throw new Error(`Max index must be < array size (${a} vs. ${r})`);const s=new je([],n,e.dtype,r),o=(0,S.HHK)(e,0);return t.forEach(((e,t)=>{s.setItem(e,o[t])})),s}(B("tensor",e,t,n),r,B("elementShape",e,t,n),B("numElements",e,t,n));return n.addTensorList(a),[a.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=B("elementShape",e,t,n),a=B("elementDType",e,t,n);let s;s="TensorListReserve"===e.op?"numElements":"maxNumElements";const o=B(s,e,t,n),i=function(e,t,n,r){return new je([],e,t,r)}(r,a,0,"TensorListReserve"===e.op?-1:o);return n.addTensorList(i),[i.idTensor]}case"TensorListGather":{const r=B("tensorListId",e,t,n),a=B("indices",e,t,n),s=B("elementShape",e,t,n),o=B("elementDType",e,t,n);return[n.getTensorList(r.id).gather(a,o,s)]}case"TensorListStack":{const r=B("tensorListId",e,t,n),a=B("elementShape",e,t,n),s=B("elementDType",e,t,n),o=B("numElements",e,t,n);return[n.getTensorList(r.id).stack(a,s,o)]}case"TensorListFromTensor":{const r=function(e,t,n){const r=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);Ge(e.shape.slice(1),t,"TensorList shape mismatch: ");const a=(0,S.HHK)(e);return new je(a,t,r)}(B("tensor",e,t,n),B("elementShape",e,t,n),B("elementDType",e,t,n));return n.addTensorList(r),[r.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const r=B("tensorListId",e,t,n),a=n.getTensorList(r.id),s=B("dtype",e,t,n),o=B("elementShape",e,t,n);return[a.concat(s,o)]}case"TensorListPushBack":{const r=B("tensorListId",e,t,n),a=B("tensor",e,t,n),s=n.getTensorList(r.id);return s.pushBack(a),[s.idTensor]}case"TensorListPopBack":{const r=B("tensorListId",e,t,n),a=B("elementShape",e,t,n),s=B("elementDType",e,t,n);return[n.getTensorList(r.id).popBack(a,s)]}case"TensorListSplit":{const r=B("tensor",e,t,n),a=B("elementShape",e,t,n),s=function(e,t,n){let r=0;const a=t.map((e=>(r+=e,r)));if(r!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${r}, and tensor's shape is: ${e.shape}`);const s=He(e.shape.slice(1),n),o=0===r?0:e.size/r,i=(0,S.lub)((()=>{const n=[];e=(0,S.XLQ)(e,[1,r,o]);for(let r=0;r<t.length;++r){const i=[0,0===r?0:a[r-1],0],l=[1,t[r],o];n[r]=(0,S.XLQ)((0,S.tPi)(e,i,l),s)}return e.dispose(),n})),l=new je([],n,e.dtype,t.length);for(let e=0;e<i.length;e++)l.setItem(e,i[e]);return l}(r,B("lengths",e,t,n),a);return n.addTensorList(s),[s.idTensor]}case"TensorListLength":{const r=B("tensorListId",e,t,n),a=n.getTensorList(r.id);return[(0,S.iD$)(a.size(),"int32")]}case"TensorListResize":{const r=B("tensorListId",e,t,n),a=B("size",e,t,n),s=n.getTensorList(r.id).resize(a);return n.addTensorList(s),[s.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function Ke(e,t,n){const[r,a]=B("fusedOps",e,t,n),s="biasadd"===r,o=!s,i="prelu"===a,l="fusedbatchnorm"===r,u=B("numArgs",e,t,n);if(s){if(i&&2!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&s&&1!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const c=B("strides",e,t,n),d=P(e,t,n),p=B("dataFormat",e,t,n).toUpperCase(),h=B("dilations",e,t,n);let[f,m]=B("args",e,t,n);o&&(m=f,f=void 0);return{stride:c,pad:d,dataFormat:p,dilations:h,biasArg:f,preluArg:m,activationFunc:a,leakyreluAlpha:B("leakyreluAlpha",e,t,n)}}function qe(e,t,n){return{boxes:B("boxes",e,t,n),scores:B("scores",e,t,n),maxOutputSize:B("maxOutputSize",e,t,n),iouThreshold:B("iouThreshold",e,t,n),scoreThreshold:B("scoreThreshold",e,t,n),softNmsSigma:B("softNmsSigma",e,t,n)}}class Qe{constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=(0,S.iD$)(0),this.tensorMap=new Map,(0,S.CnY)(this.handle)}get id(){return this.handle.id}clearAndClose(){this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return _e.i(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),(0,S.lub)((()=>{const e=(0,S.HHK)(t),r=n.length,a=e.length;S.D5U.assert(r===a,(()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${a} elements.`));for(let t=0;t<r;t++){const r=n[t],a=e[t];(0,S.CnY)(a),this.tensorMap.set(r,a)}return this.handle}))}async find(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return(0,S.lub)((()=>{const e=[];for(let r=0;r<n.length;r++){const a=n[r],s=this.findWithDefault(a,t);e.push(s)}return(0,S.knu)(e)}))}findWithDefault(e,t){const n=this.tensorMap.get(e);return null!=n?n:t}checkKeyAndValueTensor(e,t){if(e.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${e.dtype}`);if(t.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${t.dtype}`)}}function Ye(e,t,n,r,a=S.lub){const s=((e,t,n)=>{switch(e.category){case"arithmetic":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(B("a",e,t,n),B("b",e,t,n))];case"AddN":return[r.addN(B("tensors",e,t,n))];case"FloorMod":case"Mod":return[r.mod(B("a",e,t,n),B("b",e,t,n))];case"Mul":return[r.mul(B("a",e,t,n),B("b",e,t,n))];case"RealDiv":case"Div":return[r.div(B("a",e,t,n),B("b",e,t,n))];case"DivNoNan":return[r.divNoNan(B("a",e,t,n),B("b",e,t,n))];case"FloorDiv":return[r.floorDiv(B("a",e,t,n),B("b",e,t,n))];case"Sub":return[r.sub(B("a",e,t,n),B("b",e,t,n))];case"Minimum":return[r.minimum(B("a",e,t,n),B("b",e,t,n))];case"Maximum":return[r.maximum(B("a",e,t,n),B("b",e,t,n))];case"Pow":return[r.pow(B("a",e,t,n),B("b",e,t,n))];case"SquaredDifference":return[r.squaredDifference(B("a",e,t,n),B("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"basic_math":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Abs":case"ComplexAbs":return[r.abs(B("x",e,t,n))];case"Acos":return[r.acos(B("x",e,t,n))];case"Acosh":return[r.acosh(B("x",e,t,n))];case"Asin":return[r.asin(B("x",e,t,n))];case"Asinh":return[r.asinh(B("x",e,t,n))];case"Atan":return[r.atan(B("x",e,t,n))];case"Atan2":return[r.atan2(B("x",e,t,n),B("y",e,t,n))];case"Atanh":return[r.atanh(B("x",e,t,n))];case"Ceil":return[r.ceil(B("x",e,t,n))];case"Complex":return[r.complex(B("real",e,t,n),B("imag",e,t,n))];case"Cos":return[r.cos(B("x",e,t,n))];case"Cosh":return[r.cosh(B("x",e,t,n))];case"Elu":return[r.elu(B("x",e,t,n))];case"Erf":return[r.erf(B("x",e,t,n))];case"Exp":return[r.exp(B("x",e,t,n))];case"Expm1":return[r.expm1(B("x",e,t,n))];case"Floor":return[r.floor(B("x",e,t,n))];case"Log":return[r.log(B("x",e,t,n))];case"Log1p":return[r.log1p(B("x",e,t,n))];case"Imag":return[r.imag(B("x",e,t,n))];case"Neg":return[r.neg(B("x",e,t,n))];case"Reciprocal":return[r.reciprocal(B("x",e,t,n))];case"Real":return[r.real(B("x",e,t,n))];case"Relu":return[r.relu(B("x",e,t,n))];case"Round":return[r.round(B("x",e,t,n))];case"Selu":return[r.selu(B("x",e,t,n))];case"Sigmoid":return[r.sigmoid(B("x",e,t,n))];case"Sin":return[r.sin(B("x",e,t,n))];case"Sign":return[r.sign(B("x",e,t,n))];case"Sinh":return[r.sinh(B("x",e,t,n))];case"Softplus":return[r.softplus(B("x",e,t,n))];case"Sqrt":return[r.sqrt(B("x",e,t,n))];case"Square":return[r.square(B("x",e,t,n))];case"Tanh":return[r.tanh(B("x",e,t,n))];case"Tan":return[r.tan(B("x",e,t,n))];case"ClipByValue":return[r.clipByValue(B("x",e,t,n),B("clipValueMin",e,t,n),B("clipValueMax",e,t,n))];case"Relu6":return[r.relu6(B("x",e,t,n))];case"Rsqrt":return[r.rsqrt(R(e.inputNames[0],t,n))];case"Prod":return[r.prod(B("x",e,t,n),B("axes",e,t,n))];case"LeakyRelu":return[r.leakyRelu(B("x",e,t,n),B("alpha",e,t,n))];case"Prelu":return[r.prelu(B("x",e,t,n),B("alpha",e,t,n))];case"IsNan":return[r.isNaN(R(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"control":return Xe(e,t,n);case"convolution":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Conv1D":{const a=B("stride",e,t,n),s=B("pad",e,t,n),o=B("dataFormat",e,t,n).toUpperCase(),i=B("dilation",e,t,n);return[r.conv1d(B("x",e,t,n),B("filter",e,t,n),a,s,o,i)]}case"Conv2D":{const a=B("strides",e,t,n),s=P(e,t,n),o=B("dataFormat",e,t,n).toUpperCase(),i=B("dilations",e,t,n);return[r.conv2d(B("x",e,t,n),B("filter",e,t,n),[a[1],a[2]],s,o,[i[1],i[2]])]}case"_FusedConv2D":{const{stride:a,pad:s,dataFormat:o,dilations:i,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=Ke(e,t,n);return[r.fused.conv2d({x:B("x",e,t,n),filter:B("filter",e,t,n),strides:[a[1],a[2]],pad:s,dataFormat:o,dilations:[i[1],i[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{const{stride:a,pad:s,dataFormat:o,dilations:i,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=Ke(e,t,n);return[r.fused.depthwiseConv2d({x:B("x",e,t,n),filter:B("filter",e,t,n),strides:[a[1],a[2]],pad:s,dataFormat:o,dilations:[i[1],i[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const a=B("outputShape",e,t,n),s=B("strides",e,t,n),o=P(e,t,n);return[r.conv2dTranspose(B("x",e,t,n),B("filter",e,t,n),a,[s[1],s[2]],o)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const a=B("strides",e,t,n),s=P(e,t,n),o=B("dilations",e,t,n),i=B("dataFormat",e,t,n).toUpperCase();return[r.depthwiseConv2d(B("input",e,t,n),B("filter",e,t,n),[a[1],a[2]],s,i,[o[1],o[2]])]}case"Conv3D":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("dataFormat",e,t,n).toUpperCase(),i=B("dilations",e,t,n);return[r.conv3d(B("x",e,t,n),B("filter",e,t,n),[a[1],a[2],a[3]],s,o,[i[1],i[2],i[3]])]}case"AvgPool":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("kernelSize",e,t,n);return[r.avgPool(B("x",e,t,n),[o[1],o[2]],[a[1],a[2]],s)]}case"MaxPool":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("kernelSize",e,t,n);return[r.maxPool(B("x",e,t,n),[o[1],o[2]],[a[1],a[2]],s)]}case"MaxPoolWithArgmax":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("kernelSize",e,t,n),i=B("includeBatchInIndex",e,t,n),{result:l,indexes:u}=r.maxPoolWithArgmax(B("x",e,t,n),[o[1],o[2]],[a[1],a[2]],s,i);return[l,u]}case"AvgPool3D":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("kernelSize",e,t,n);return[r.avgPool3d(B("x",e,t,n),[o[1],o[2],o[3]],[a[1],a[2],a[3]],s)]}case"MaxPool3D":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("kernelSize",e,t,n);return[r.maxPool3d(B("x",e,t,n),[o[1],o[2],o[3]],[a[1],a[2],a[3]],s)]}case"Dilation2D":{const a=B("strides",e,t,n),s=B("pad",e,t,n),o=B("dilations",e,t,n),i=a[1],l=a[2],u=o[1],c=o[2];return[r.dilation2d(B("x",e,t,n),B("filter",e,t,n),[i,l],s,[u,c],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"creation":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Fill":{const a=B("shape",e,t,n),s=B("dtype",e,t,n),o=B("value",e,t,n);return[r.fill(a,o,s)]}case"LinSpace":{const a=B("start",e,t,n),s=B("stop",e,t,n),o=B("num",e,t,n);return[r.linspace(a,s,o)]}case"Multinomial":{const a=B("logits",e,t,n),s=B("numSamples",e,t,n),o=B("seed",e,t,n);return[r.multinomial(a,s,o)]}case"OneHot":{const a=B("indices",e,t,n),s=B("depth",e,t,n),o=B("onValue",e,t,n),i=B("offValue",e,t,n),l=B("dtype",e,t,n);return[r.oneHot(a,s,o,i,l)]}case"Ones":return[r.ones(B("shape",e,t,n),B("dtype",e,t,n))];case"OnesLike":return[r.onesLike(B("x",e,t,n))];case"RandomStandardNormal":return[r.randomStandardNormal(B("shape",e,t,n),B("dtype",e,t,n),B("seed",e,t,n))];case"RandomUniform":return[r.randomUniform(B("shape",e,t,n),B("minval",e,t,n),B("maxval",e,t,n),B("dtype",e,t,n))];case"Range":{const a=B("start",e,t,n),s=B("stop",e,t,n),o=B("step",e,t,n);return[r.range(a,s,o,B("dtype",e,t,n))]}case"TruncatedNormal":{const a=B("shape",e,t,n),s=B("mean",e,t,n),o=B("stdDev",e,t,n),i=B("seed",e,t,n);return[r.truncatedNormal(a,s,o,B("dtype",e,t,n),i)]}case"Zeros":return[r.zeros(B("shape",e,t,n),B("dtype",e,t,n))];case"ZerosLike":return[r.zerosLike(B("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"dynamic":return(async(e,t,n,r,a=T)=>{switch(e.op){case"NonMaxSuppressionV5":{const{boxes:r,scores:s,maxOutputSize:o,iouThreshold:i,scoreThreshold:l,softNmsSigma:u}=qe(e,t,n),c=await a.image.nonMaxSuppressionWithScoreAsync(r,s,o,i,l,u);return[c.selectedIndices,c.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:r,scores:s,maxOutputSize:o,iouThreshold:i,scoreThreshold:l}=qe(e,t,n),u=B("padToMaxOutputSize",e,t,n),c=await a.image.nonMaxSuppressionPaddedAsync(r,s,o,i,l,u);return[c.selectedIndices,c.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:r,scores:s,maxOutputSize:o,iouThreshold:i,scoreThreshold:l}=qe(e,t,n);return[await a.image.nonMaxSuppressionAsync(r,s,o,i,l)]}case"Where":{const r=a.cast(B("condition",e,t,n),"bool"),s=[await a.whereAsync(r)];return r.dispose(),s}case"ListDiff":return a.setdiff1dAsync(B("x",e,t,n),B("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n);case"evaluation":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"LowerBound":{const a=B("sortedSequence",e,t,n),s=B("values",e,t,n);return[r.lowerBound(a,s)]}case"TopKV2":{const a=B("x",e,t,n),s=B("k",e,t,n),o=B("sorted",e,t,n),i=r.topk(a,s,o);return[i.values,i.indices]}case"UpperBound":{const a=B("sortedSequence",e,t,n),s=B("values",e,t,n);return[r.upperBound(a,s)]}case"Unique":{const a=B("x",e,t,n),s=r.unique(a);return[s.values,s.indices]}case"UniqueV2":{const a=B("x",e,t,n),s=B("axis",e,t,n),o=r.unique(a,s);return[o.values,o.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"image":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"ResizeBilinear":{const a=B("images",e,t,n),s=B("size",e,t,n),o=B("alignCorners",e,t,n),i=B("halfPixelCenters",e,t,n);return[r.image.resizeBilinear(a,[s[0],s[1]],o,i)]}case"ResizeNearestNeighbor":{const a=B("images",e,t,n),s=B("size",e,t,n),o=B("alignCorners",e,t,n),i=B("halfPixelCenters",e,t,n);return[r.image.resizeNearestNeighbor(a,[s[0],s[1]],o,i)]}case"CropAndResize":{const a=B("image",e,t,n),s=B("boxes",e,t,n),o=B("boxInd",e,t,n),i=B("cropSize",e,t,n),l=B("method",e,t,n),u=B("extrapolationValue",e,t,n);return[r.image.cropAndResize(a,s,o,i,l,u)]}case"ImageProjectiveTransformV3":{const a=B("images",e,t,n),s=B("transforms",e,t,n),o=B("outputShape",e,t,n),i=B("fillValue",e,t,n),l=B("interpolation",e,t,n),u=B("fillMode",e,t,n);return[r.image.transform(a,s,l.toLowerCase(),u.toLowerCase(),i,o)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"graph":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":const a=B("default",e,t,n);return[R(e.name,t,n)||a];case"Placeholder":return[R(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":case"Snapshot":return[$(B("x",e,t,n))];case"IdentityN":return B("x",e,t,n).map((e=>$(e)));case"Shape":return[r.tensor1d(B("x",e,t,n).shape,"int32")];case"ShapeN":return B("x",e,t,n).map((e=>r.tensor1d(e.shape)));case"Size":return[r.scalar(B("x",e,t,n).size,"int32")];case"Rank":return[r.scalar(B("x",e,t,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const s=B("x",e,t,n),o=B("data",e,t,n),i=B("message",e,t,n),l=B("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(i);for(let e=0;e<o.length;e++)console.log(Array.prototype.slice.call(o[e].dataSync()).slice(0,l));return[s];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"logical":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Equal":return[r.equal(B("a",e,t,n),B("b",e,t,n))];case"NotEqual":return[r.notEqual(B("a",e,t,n),B("b",e,t,n))];case"Greater":return[r.greater(B("a",e,t,n),B("b",e,t,n))];case"GreaterEqual":return[r.greaterEqual(B("a",e,t,n),B("b",e,t,n))];case"Less":return[r.less(B("a",e,t,n),B("b",e,t,n))];case"LessEqual":return[r.lessEqual(B("a",e,t,n),B("b",e,t,n))];case"LogicalAnd":return[r.logicalAnd(B("a",e,t,n),B("b",e,t,n))];case"LogicalNot":return[r.logicalNot(B("a",e,t,n))];case"LogicalOr":return[r.logicalOr(B("a",e,t,n),B("b",e,t,n))];case"Select":case"SelectV2":return[r.where(B("condition",e,t,n),B("a",e,t,n),B("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"matrices":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(B("a",e,t,n),B("b",e,t,n),B("transposeA",e,t,n),B("transposeB",e,t,n))];case"Einsum":return[r.einsum(B("equation",e,t,n),...B("tensors",e,t,n))];case"Transpose":return[r.transpose(B("x",e,t,n),B("perm",e,t,n))];case"_FusedMatMul":const[a,s]=B("fusedOps",e,t,n),o="biasadd"===a,i="prelu"===s,l=B("numArgs",e,t,n),u=B("leakyreluAlpha",e,t,n);if(o){if(i&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[c,d]=B("args",e,t,n);return[r.fused.matMul({a:B("a",e,t,n),b:B("b",e,t,n),transposeA:B("transposeA",e,t,n),transposeB:B("transposeB",e,t,n),bias:c,activation:s,preluActivationWeights:d,leakyreluAlpha:u})];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"normalization":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"EuclideanNorm":return[r.euclideanNorm(B("x",e,t,n),B("axis",e,t,n),B("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[r.batchNorm(B("x",e,t,n),B("mean",e,t,n),B("variance",e,t,n),B("offset",e,t,n),B("scale",e,t,n),B("epsilon",e,t,n))];case"LRN":return[r.localResponseNormalization(B("x",e,t,n),B("radius",e,t,n),B("bias",e,t,n),B("alpha",e,t,n),B("beta",e,t,n))];case"Softmax":return[r.softmax(B("x",e,t,n))];case"LogSoftmax":return[r.logSoftmax(B("x",e,t,n))];case"SparseToDense":return[r.sparseToDense(B("sparseIndices",e,t,n),B("outputShape",e,t,n),B("sparseValues",e,t,n),B("defaultValue",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"reduction":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Max":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.max(B("x",e,t,n),a,s)]}case"Mean":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.mean(B("x",e,t,n),a,s)]}case"Min":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.min(B("x",e,t,n),a,s)]}case"Sum":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.sum(B("x",e,t,n),a,s)]}case"All":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.all(B("x",e,t,n),a,s)]}case"Any":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.any(B("x",e,t,n),a,s)]}case"ArgMax":{const a=B("axis",e,t,n);return[r.argMax(B("x",e,t,n),a)]}case"ArgMin":{const a=B("axis",e,t,n);return[r.argMin(B("x",e,t,n),a)]}case"Prod":{const a=B("axis",e,t,n),s=B("keepDims",e,t,n);return[r.prod(B("x",e,t,n),a,s)]}case"Cumprod":{const a=B("axis",e,t,n),s=B("exclusive",e,t,n),o=B("reverse",e,t,n);return[r.cumprod(B("x",e,t,n),a,s,o)]}case"Cumsum":{const a=B("axis",e,t,n),s=B("exclusive",e,t,n),o=B("reverse",e,t,n);return[r.cumsum(B("x",e,t,n),a,s,o)]}case"Bincount":const a=B("x",e,t,n),s=B("weights",e,t,n),o=B("size",e,t,n);return[r.bincount(a,s,o)];case"DenseBincount":{const a=B("x",e,t,n),s=B("weights",e,t,n),o=B("size",e,t,n),i=B("binaryOutput",e,t,n);return[r.denseBincount(a,s,o,i)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"slice_join":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"ConcatV2":case"Concat":{const a=B("n",e,t,n),s=B("axis",e,t,n);let o=B("tensors",e,t,n);return o=o.slice(0,a),[r.concat(o,s)]}case"Gather":{const a=B("x",e,t,n),s=B("indices",e,t,n);return[r.gather(a,r.cast(s,"int32"),0)]}case"GatherV2":{const a=B("axis",e,t,n),s=B("batchDims",e,t,n),o=B("x",e,t,n),i=B("indices",e,t,n);return[r.gather(o,r.cast(i,"int32"),a,s)]}case"Reverse":{const a=B("dims",e,t,n),s=[];for(let e=0;e<a.length;e++)a[e]&&s.push(e);const o=B("x",e,t,n);return[r.reverse(o,s)]}case"ReverseV2":{const a=B("axis",e,t,n),s=B("x",e,t,n);return[r.reverse(s,a)]}case"Slice":{const a=B("begin",e,t,n),s=B("size",e,t,n);return[r.slice(B("x",e,t,n),a,s)]}case"StridedSlice":{const a=B("begin",e,t,n),s=B("end",e,t,n),o=B("strides",e,t,n),i=B("beginMask",e,t,n),l=B("endMask",e,t,n),u=B("ellipsisMask",e,t,n),c=B("newAxisMask",e,t,n),d=B("shrinkAxisMask",e,t,n),p=B("x",e,t,n);return[r.stridedSlice(p,a,s,o,i,l,u,c,d)]}case"Pack":return(0,S.lub)((()=>{const a=B("axis",e,t,n),s=B("tensors",e,t,n),o=s[0].shape,i=r.squeeze(s[0]).shape,l=s.map((e=>{const t=S.D5U.arraysEqual(e.shape,o);if(!t&&!S.D5U.arraysEqual(r.squeeze(e).shape,i))throw new Error("the input tensors shape does not match");return t?e:r.reshape(e,o)}));return[r.stack(l,a)]}));case"Unpack":{const a=B("axis",e,t,n),s=B("tensor",e,t,n);return r.unstack(s,a)}case"Tile":{const a=B("reps",e,t,n);return[r.tile(B("x",e,t,n),a)]}case"Split":case"SplitV":{const a=B("axis",e,t,n),s=B("numOrSizeSplits",e,t,n),o=B("x",e,t,n);return r.split(o,s,a)}case"ScatterNd":{const a=B("indices",e,t,n),s=B("values",e,t,n),o=B("shape",e,t,n);return[r.scatterND(a,s,o)]}case"GatherNd":{const a=B("x",e,t,n),s=B("indices",e,t,n);return[r.gatherND(a,s)]}case"SparseToDense":{const a=B("sparseIndices",e,t,n),s=B("outputShape",e,t,n),o=B("sparseValues",e,t,n),i=B("defaultValue",e,t,n);return[r.sparseToDense(a,o,s,o.dtype===i.dtype?i:r.cast(i,o.dtype))]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"sparse":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"SparseFillEmptyRows":{const{outputIndices:a,outputValues:s,emptyRowIndicator:o,reverseIndexMap:i}=r.sparse.sparseFillEmptyRows(B("indices",e,t,n),B("values",e,t,n),B("denseShape",e,t,n),B("defaultValue",e,t,n));return[a,s,o,i]}case"SparseReshape":{const{outputIndices:a,outputShape:s}=r.sparse.sparseReshape(B("inputIndices",e,t,n),B("inputShape",e,t,n),B("newShape",e,t,n));return[a,s]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean(B("data",e,t,n),B("indices",e,t,n),B("segmentIds",e,t,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum(B("data",e,t,n),B("indices",e,t,n),B("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"spectral":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"FFT":return[r.fft(B("x",e,t,n))];case"IFFT":return[r.ifft(B("x",e,t,n))];case"RFFT":return[r.rfft(B("x",e,t,n))];case"IRFFT":return[r.irfft(B("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"string":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"StringNGrams":{const{nGrams:a,nGramsSplits:s}=r.string.stringNGrams(B("data",e,t,n),B("dataSplits",e,t,n),B("separator",e,t,n),B("nGramWidths",e,t,n),B("leftPad",e,t,n),B("rightPad",e,t,n),B("padWidth",e,t,n),B("preserveShortSequences",e,t,n));return[a,s]}case"StringSplit":{const{indices:a,values:s,shape:o}=r.string.stringSplit(B("input",e,t,n),B("delimiter",e,t,n),B("skipEmpty",e,t,n));return[a,s,o]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast(B("input",e,t,n),B("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"transformation":return a((()=>((e,t,n,r=T)=>{switch(e.op){case"Cast":return[r.cast(B("x",e,t,n),B("dtype",e,t,n))];case"ExpandDims":{const a=B("axis",e,t,n);return[r.expandDims(B("x",e,t,n),a)]}case"Squeeze":{const a=B("axis",e,t,n);return[r.squeeze(B("x",e,t,n),a)]}case"Reshape":return[r.reshape(B("x",e,t,n),B("shape",e,t,n))];case"MirrorPad":return[r.mirrorPad(B("x",e,t,n),B("padding",e,t,n),B("mode",e,t,n))];case"PadV2":case"Pad":return[r.pad(B("x",e,t,n),B("padding",e,t,n),B("constantValue",e,t,n))];case"SpaceToBatchND":{const a=B("blockShape",e,t,n),s=B("paddings",e,t,n);return[r.spaceToBatchND(B("x",e,t,n),a,s)]}case"BatchToSpaceND":{const a=B("blockShape",e,t,n),s=B("crops",e,t,n);return[r.batchToSpaceND(B("x",e,t,n),a,s)]}case"DepthToSpace":{const a=B("blockSize",e,t,n),s=B("dataFormat",e,t,n).toUpperCase();return[r.depthToSpace(B("x",e,t,n),a,s)]}case"BroadcastTo":return[r.broadcastTo(B("x",e,t,n),B("shape",e,t,n))];case"BroadcastArgs":return[r.broadcastArgs(B("s0",e,t,n),B("s1",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"hash_table":return(async(e,t,n,r)=>{switch(e.op){case"HashTable":case"HashTableV2":{const a=B("keyDType",e,t,n),s=B("valueDType",e,t,n),o=new Qe(a,s);return r.addHashTable(e.name,o),[o.handle]}case"LookupTableImport":case"LookupTableImportV2":{const a=B("tableHandle",e,t,n,r),s=B("keys",e,t,n),o=B("values",e,t,n),i=r.getHashTableById(a.id);return[await i.import(s,o)]}case"LookupTableFind":case"LookupTableFindV2":{const a=B("tableHandle",e,t,n,r),s=B("keys",e,t,n),o=B("defaultValue",e,t,n),i=r.getHashTableById(a.id);return[await i.find(s,o)]}case"LookupTableSize":case"LookupTableSizeV2":{const a=B("tableHandle",e,t,n,r);return[r.getHashTableById(a.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n,r);case"custom":const s=E(e.op);if(s&&s.customExecutor)return s.customExecutor(new ye(e,t,n));throw TypeError(`Custom op ${e.op} is not registered.`);default:throw TypeError(`Unknown op '${e.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return S.D5U.isPromise(s)?s.then((e=>[].concat(e))):[].concat(s)}class Je{constructor(e={},t={},n={},r={}){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let t=0;t<this.contexts.length-1;t++){const n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map((e=>0===e.id&&0===e.iterationId?"":`${e.frameName}-${e.iterationId}`)).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()}nextIteration(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");{this.contexts=this.contexts.slice(),this.lastId++;const e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(const t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}}function et(e,t,n,r){const a=new Set,s=[];let o=null,i=null;const l=new Set,u=Object.keys(e).map((e=>O(e)[0]));let c=[];null!=r&&(c=r.map((e=>O(e.name)[0])));const d=[...t];for(;d.length>0;){const e=d.pop();(at(e)||st(e)||ot(e))&&null==o&&(o=e,i=o.children.map((e=>e.name)).filter((e=>a.has(e)))),a.add(e.name),null==n[e.name]&&(-1===u.indexOf(e.name)&&-1===c.indexOf(e.name)&&(0!==e.inputs.length?e.inputs.forEach((e=>{l.has(e.name)||(l.add(e.name),d.push(e))})):s.push(e.name)))}return{inputs:e,outputs:t,usedNodes:a,missingInputs:s,dynamicNode:o,syncInputs:i}}const tt=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],nt=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],rt=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function at(e){return tt.indexOf(e.op)>=0}function st(e){return nt.indexOf(e.op)>=0}function ot(e){return rt.indexOf(e.op)>=0}class it{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this.intermediateTensors={},this.keepTensorForDebug=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,null!=e.functions&&Object.keys(e.functions).forEach((t=>{this._functionExecutorMap[t]=new it(e.functions[t],this)}))}get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const t=Object.keys(e).map((t=>e[t].map((e=>e.id))));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get outputs(){return this._outputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get inputNodes(){return this._inputs.map((e=>e.signatureKey||e.name))}get outputNodes(){return this._outputs.map((e=>{const t=e.signatureKey||e.name;return e.defaultOutput?`${t}:${e.defaultOutput}`:t}))}get functions(){return Object.keys(this._functions).reduce(((e,t)=>(e[t]=this._functions[t].signature,e)),{})}getCompilationKey(e,t){const n=e.map((e=>e.name)).sort(),r=t.map((e=>e.name)).sort();return n.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)}compile(e,t){const n=et(e,t,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:a,syncInputs:s}=n;if(null!=a)throw new Error(`This execution contains the node '${a.name}', which has the dynamic op '${a.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(r.length>0){const n=t.map((e=>e.name)),a=Object.keys(e);throw new Error(`Cannot compute the outputs [${n}] from the provided inputs [${a}]. Missing the following inputs: [${r}]`)}return function(e,t,n){const{usedNodes:r,inputs:a}=n,s=[],o=Object.keys(a).map((e=>O(e)[0])).map((t=>e.nodes[t])),i=e.initNodes;o.forEach((e=>{r.has(e.name)&&s.push(e)})),e.weights.forEach((e=>{r.has(e.name)&&s.push(e)})),null!=i&&i.forEach((e=>{r.has(e.name)&&s.push(e)}));const l=new Set,u=[];for(;s.length>0;){const e=s.pop();l.add(e.name),t[e.name]||u.push(e),e.children.forEach((e=>{!l.has(e.name)&&r.has(e.name)&&e.inputs.every((e=>l.has(e.name)))&&s.push(e)}))}return u}(this.graph,this.weightMap,n)}execute(e,t){e=this.mapInputs(e);const n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);const r=n.map((e=>this.graph.nodes[O(e)[0]])),a=t.map((e=>O(e)[0]));let s=a.map((e=>this.graph.nodes[e]));this.resetIntermediateTensors(),0===s.length&&(s=this._outputs);const o=this.getCompilationKey(r,s);let i=this.compiledMap.get(o);null==i&&(i=this.compile(e,s),this.compiledMap.set(o,i));const l={},u={};return(0,S.lub)((()=>{const n=new Je(this.weightMap,l,u,this.functionExecutorMap),r=Object.assign({},this.weightMap);Object.keys(e).forEach((t=>{const[n,a]=O(t),s=[];s[a]=e[t],r[n]=s}));const s=this.getFrozenTensorIds(r),o={};for(let e=0;e<i.length;e++){const t=i[e];if(!r[t.name]){const e=Ye(t,r,n,this._resourceManager);if(S.D5U.isPromise(e))throw new Error(`The execution of the op '${t.op}' returned a promise. Please use model.executeAsync() instead.`);r[t.name]=e,this.checkTensorForDisposal(t.name,t,r,n,s,a,o)}}return null==this.parent&&n.dispose(s),t.map((e=>R(e,r,n)))}))}getFrozenTensorIds(e){const t=[].concat.apply([],Object.keys(e).map((t=>e[t])).map((e=>e.map((e=>e.id)))));return new Set(t)}checkTensorForDisposal(e,t,n,r,a,s,o){"control"!==t.category&&-1===s.indexOf(e)&&(n[e].forEach((e=>{null!=e&&(o[e.id]=(o[e.id]||0)+t.children.length)})),t.inputs.forEach((e=>{if("control"!==e.category){const s=function(e,t,n){return t[M(e,n.currentContextId)]}(e.name,n,r);null!=s&&s.forEach((e=>{if(e&&!e.kept&&!a.has(e.id)){const n=o[e.id];if(1===n){if(this.keepTensorForDebug){const[n,a]=D(t.name,r);this.intermediateTensors[n]||(this.intermediateTensors[n]=[]),this.intermediateTensors[n][a]=e}else e.dispose();delete o[e.id]}else null!=n&&o[e.id]--}}))}})))}async executeAsync(e,t){return this._executeAsync(e,t)}disposeIntermediateTensors(){this.intermediateTensors&&(Object.keys(this.intermediateTensors).forEach((e=>this.intermediateTensors[e].forEach((e=>e.dispose())))),this.disposeTensorsMap())}disposeTensorsMap(){this.tensorsMap&&Object.keys(this.tensorsMap).forEach((e=>{this.tensorsMap[e].forEach((e=>{!e||e.kept||e.isDisposed||this.keepIds.has(e.id)||e.dispose()}))}))}getIntermediateTensors(){return this.tensorsMap}resetIntermediateTensors(){for(const e in this.intermediateTensors)this.intermediateTensors[e].forEach((e=>e.dispose())),delete this.intermediateTensors[e]}async _executeAsync(e,t,n=!1,r={},a={}){n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));try{this.keepTensorForDebug=(0,S.OBj)().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){console.warn(e.message)}this.resetIntermediateTensors();const s=new Je(this.weightMap,r,a,this.functionExecutorMap);this.tensorsMap=await this.executeWithControlFlow(e,s,t,n);const o=t.map((e=>R(e,this.tensorsMap,s))),i=o.map((e=>e.id)),l=Object.keys(e).map((t=>e[t].id));return this.keepIds=new Set([...i,...l,...this.weightIds]),this.keepTensorForDebug||this.disposeTensorsMap(),null==this.parent&&s.dispose(this.keepIds),o}async executeFunctionAsync(e,t,n){const r=e.reduce(((e,t,n)=>(e[this.inputs[n].name]=t,e)),{});return this._executeAsync(r,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,r){const a=Object.keys(e),s=a.map((e=>this.graph.nodes[O(e)[0]])),o=n.map((e=>O(e)[0]));let i=o.map((e=>this.graph.nodes[e]));0===i.length&&(i=this._outputs);const{usedNodes:l,missingInputs:u,dynamicNode:c,syncInputs:d}=et(e,i,this.weightMap,this._initNodes),p=[...s,...this.graph.weights,...this._initNodes||[]].map((e=>({node:e,contexts:t.currentContext}))),h=Object.assign({},this.weightMap);Object.keys(e).forEach((t=>{const[n,r]=O(t),a=[];a[r]=e[t],h[n]=a}));const f={},m=this.getFrozenTensorIds(h),g={};for(;p.length>0;){const e=this.processStack(s,p,t,h,g,m,o,f,l);await Promise.all(e)}null!=c||r||console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");const y=i.filter((e=>!at(e)&&!R(e.name,h,t))).map((e=>e.name));if(y.length>0){let e="";throw null!=c&&(e=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${d}]`),new Error(`Cannot compute the outputs [${y}] from the provided inputs [${a}]. Consider providing the following inputs: [${u}]. ${e}`)}return h}processStack(e,t,n,r,a,s,o,i,l){const u=[];for(;t.length>0;){const e=t.pop();n.currentContext=e.contexts;let c="";if("Enter"===e.node.op&&B("isConstant",e.node,r,n)&&([c]=D(e.node.name,n)),null==r[e.node.name]){const d=Ye(e.node,r,n,this._resourceManager);c||([c]=D(e.node.name,n));const p=n.currentContext;S.D5U.isPromise(d)?u.push(d.then((u=>(r[c]=u,n.currentContext=p,this.checkTensorForDisposal(c,e.node,r,n,s,o,i),this.processChildNodes(e.node,t,n,r,a,l),u)))):(r[c]=d,this.checkTensorForDisposal(c,e.node,r,n,s,o,i),this.processChildNodes(e.node,t,n,r,a,l))}else this.processChildNodes(e.node,t,n,r,a,l)}return u}processChildNodes(e,t,n,r,a,s){e.children.forEach((e=>{const[o]=D(e.name,n);!a[o]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some((e=>!!R(e,r,n)))&&(a[o]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every((e=>!!R(e,r,n)))&&(a[o]=!0,t.push({contexts:n.currentContext,node:e})))}))}dispose(){Object.keys(this.weightMap).forEach((e=>this.weightMap[e].forEach((e=>e.dispose()))))}checkInputShapeAndType(e){Object.keys(e).forEach((t=>{const n=e[t],[r]=O(t),a=this.graph.nodes[r];if(a.attrParams.shape&&a.attrParams.shape.value){const e=a.attrParams.shape.value,t=e.length===n.shape.length&&n.shape.every(((t,n)=>-1===e[n]||e[n]===t));S.D5U.assert(t,(()=>`The shape of dict['${a.name}'] provided in model.execute(dict) must be [${e}], but was [${n.shape}]`))}a.attrParams.dtype&&a.attrParams.dtype.value&&S.D5U.assert(n.dtype===a.attrParams.dtype.value,(()=>`The dtype of dict['${a.name}'] provided in model.execute(dict) must be ${a.attrParams.dtype.value}, but was ${n.dtype}`))}))}mapInputs(e){const t={};for(const n in e)if(null!=this._signature&&null!=this._signature.inputs&&null!=this._signature.inputs[n]){t[this._signature.inputs[n].name]=e[n]}else t[n]=e[n];return t}checkInputs(e){const t=Object.keys(e).filter((e=>{const[t]=O(e);return null==this.graph.nodes[t]}));if(t.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${t}] that are not part of graph`)}mapOutputs(e){return e.map((e=>{if(null!=this._signature&&null!=this._signature.outputs&&null!=this._signature.outputs[e]){return this._signature.outputs[e].name}return e}),{})}checkOutputs(e){e.forEach((e=>{const[t]=O(e);if(!this.graph.nodes[t])throw new Error(`The output '${e}' is not found in the graph`)}))}}class lt{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}class ut{constructor(e,t={},n=S.io){this.modelUrl=e,this.loadOptions=t,this.version="n/a",this.io=n,null==t&&(this.loadOptions={}),this.resourceManager=new lt}get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}findIOHandler(){const e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{const t=this.io.getLoadHandlers(e,this.loadOptions);if(0===t.length)t.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[0]}}load(){if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=this.handler.load();return S.D5U.isPromise(e)?e.then((e=>this.loadSync(e))):this.loadSync(e)}loadSync(e){this.artifacts=e;const t=this.artifacts.modelTopology;let n=this.artifacts.signature;if(null!=this.artifacts.userDefinedMetadata){const e=this.artifacts.userDefinedMetadata;null!=e.signature&&(n=e.signature),null!=e.structuredOutputKeys&&(this.structuredOutputKeys=e.structuredOutputKeys)}this.signature=n,this.version=`${t.versions.producer}.${t.versions.minConsumer}`;const r=this.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new it(ne.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),this.executor.resourceManager=this.resourceManager,null!=e.modelInitializer&&null!=e.modelInitializer.node){const t=ne.Instance.transformGraph(e.modelInitializer);this.initializer=new it(t),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if("string"==typeof e){const t=this.io.getSaveHandlers(e);if(0===t.length)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new Error(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}predict(e,t){const n=this.execute(e,this.outputNodes);if(this.structuredOutputKeys){const e=n instanceof S.esB?[n]:n,t={};return e.forEach(((e,n)=>t[this.structuredOutputKeys[n]]=e)),t}return n}normalizeInputs(e){if(!(e instanceof S.esB||Array.isArray(e)))return e;if((e=Array.isArray(e)?e:[e]).length!==this.inputNodes.length)throw new Error(`Input tensor count mismatch,the graph model has ${this.inputNodes.length} placeholders, while there are ${e.length} input tensors.`);return this.inputNodes.reduce(((t,n,r)=>(t[n]=e[r],t)),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce(((t,n)=>(t[n]=[e[n]],t)),{})}dispose(){this.executor.dispose(),this.initializer&&this.initializer.dispose(),this.resourceManager.dispose()}}async function ct(e,t={},n=S.io){if(null==e)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");null==t&&(t={}),t.fromTFHub&&"string"==typeof e&&(e=function(e){e.endsWith("/")||(e+="/");return`${e}model.json?tfjs-format=file`}(e));const r=new ut(e,t,n);return await r.load(),r}function dt(e){if(null==e)throw new Error("modelUrl in loadGraphModelSync() cannot be null. Please provide model artifacts or an IOHandler that loads the model");let t;if(e instanceof Array){const[n,r]=e;if(!n)throw new Error("modelJSON must be the first element of the array");if(!(r&&r instanceof ArrayBuffer))throw new Error("An ArrayBuffer of weights must be the second element of the array");if(!("modelTopology"in n))throw new Error("Model JSON is missing 'modelTopology'");if(!("weightsManifest"in n))throw new Error("Model JSON is missing 'weightsManifest'");const a=S.io.getWeightSpecs(n.weightsManifest),s=S.io.getModelArtifactsForJSONSync(n,a,r);t=S.io.fromMemorySync(s)}else if("load"in e)t=e;else{if(!("modelTopology"in e&&"weightSpecs"in e&&"weightData"in e))throw new Error("Unknown model format");t=S.io.fromMemorySync(e)}const n=new ut(t);return n.load(),n}const pt="3.21.0"},8713:(e,t,n)=>{n.d(t,{JL:()=>r,Zu:()=>a});class r{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class a{refCount(e){return s("refCount")}incRef(e){return s("incRef")}timerAvailable(){return!0}time(e){return s("time")}read(e){return s("read")}readSync(e){return s("readSync")}readToGPU(e,t){return s("readToGPU")}numDataIds(){return s("numDataIds")}disposeData(e,t){return s("disposeData")}write(e,t,n){return s("write")}move(e,t,n,r,a){return s("move")}memory(){return s("memory")}floatPrecision(){return s("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return s("dispose")}}function s(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}},4113:(e,t,n)=>{n.d(t,{SYM:()=>H.SYM,VGw:()=>H.VGw,SpW:()=>H.SpW,zJI:()=>Et,HeW:()=>Bt,a4z:()=>Mt,DBS:()=>$t,mm_:()=>H.mm_,Xze:()=>H.Xze,oT6:()=>H.oT6,IKK:()=>H.IKK,sJF:()=>H.sJF,aJk:()=>H.aJk,M2y:()=>H.M2y,qw7:()=>H.qw7,jMg:()=>H.jMg,QCc:()=>H.QCc,Oyi:()=>H.Oyi,JhU:()=>H.JhU,_k9:()=>H._k9,IMb:()=>H.IMb,ROF:()=>H.ROF,XLW:()=>H.XLW,zws:()=>H.zws,zvY:()=>H.zvY,eEB:()=>H.eEB,Ly9:()=>H.Ly9,RFZ:()=>H.RFZ,gJX:()=>H.gJX,xnO:()=>H.xnO,Zz9:()=>H.Zz9,yj2:()=>H.yj2,Eh3:()=>H.Eh3,mhS:()=>H.mhS,wUP:()=>H.wUP,wm:()=>H.wm,x12:()=>H.x12,o2y:()=>H.o2y,ik2:()=>H.ik2,mc4:()=>H.mc4,TR1:()=>H.TR1,VcC:()=>H.VcC,Byc:()=>H.Byc,iHb:()=>H.iHb,JLz:()=>Vi.JL,QRR:()=>H.QRR,T0n:()=>H.T0n,cie:()=>H.cie,sL$:()=>H.sL$,y7R:()=>H.y7R,$w:()=>H.$w,p4S:()=>H.p4S,Vn9:()=>H.Vn9,ekb:()=>H.ekb,ViN:()=>m.Vi,$g6:()=>H.$g6,SX0:()=>H.SX0,HEU:()=>H.HEU,qAh:()=>m.qA,hdR:()=>H.hdR,Omj:()=>H.Omj,NEP:()=>H.NEP,YFo:()=>H.YFo,Y0y:()=>H.Y0y,vwp:()=>H.vwp,deh:()=>H.deh,Uyb:()=>H.Uyb,OR:()=>H.OR,jeX:()=>H.jeX,eBW:()=>H.eBW,sHE:()=>H.sHE,_V0:()=>H._V0,luS:()=>H.luS,q1x:()=>H.q1x,qi_:()=>H.qi_,iZT:()=>H.iZT,Acj:()=>H.Acj,Qg5:()=>H.Qg5,iJz:()=>H.iJz,J_u:()=>H.J_u,avt:()=>H.avt,iWB:()=>H.iWB,r7n:()=>H.r7n,Zuw:()=>Vi.Zu,eZ0:()=>H.eZ0,Hhh:()=>H.Hhh,J$2:()=>H.J$2,vtC:()=>H.vtC,CAk:()=>H.CAk,e7N:()=>H.e7N,ZbH:()=>H.ZbH,kU:()=>H.kU,qCd:()=>H.qCd,PYm:()=>H.PYm,VfG:()=>H.VfG,MZg:()=>H.MZg,w6g:()=>H.w6g,qIC:()=>H.qIC,YoZ:()=>H.YoZ,mTV:()=>H.mTV,OAf:()=>H.OAf,OU7:()=>H.OU7,OV7:()=>H.OV7,vFR:()=>H.vFR,BMI:()=>H.BMI,q2K:()=>H.q2K,c17:()=>H.c17,q8u:()=>H.q8u,jQs:()=>H.jQs,Vbg:()=>H.Vbg,rIn:()=>_t,NZg:()=>H.NZg,wYn:()=>H.wYn,kuV:()=>H.kuV,uv1:()=>H.uv1,cye:()=>H.cye,W0H:()=>H.W0H,yQU:()=>H.yQU,zvA:()=>Z.z,we_:()=>H.we_,qWM:()=>H.qWM,gaJ:()=>kt,eEe:()=>Vt,QiL:()=>H.QiL,lyA:()=>H.lyA,Kgp:()=>H.Kgp,pe_:()=>H.pe_,o0g:()=>H.o0g,DlI:()=>H.DlI,gVI:()=>Lt,dDz:()=>H.dDz,BiW:()=>H.BiW,e6w:()=>H.e6w,yw1:()=>Ut.yw,xJR:()=>H.xJR,oHH:()=>H.oHH,$HU:()=>H.$HU,IH3:()=>oo,qkr:()=>H.qkr,SbG:()=>H.SbG,HZH:()=>H.HZH,_Yw:()=>H._Yw,zbQ:()=>H.zbQ,dpD:()=>H.dpD,Hmb:()=>H.Hmb,mKl:()=>H.mKl,b9H:()=>H.b9H,e07:()=>H.e07,bV0:()=>H.bV0,DYp:()=>Ft,xQA:()=>H.xQA,nr8:()=>H.nr8,PhF:()=>H.PhF,oFR:()=>H.oFR,a5O:()=>H.a5O,i5y:()=>H.i5y,RQH:()=>H.RQH,wYB:()=>H.wYB,p2w:()=>H.p2w,Gcp:()=>H.Gcp,MRv:()=>H.MRv,TQc:()=>H.TQc,O3z:()=>H.O3z,nhH:()=>H.nhH,w3H:()=>H.w3H,ZjV:()=>H.ZjV,D2d:()=>H.D2d,L8s:()=>H.L8s,FKq:()=>H.FKq,bK0:()=>H.bK0,_tC:()=>H._tC,h8e:()=>H.h8e,jQk:()=>H.jQk,_JP:()=>H._JP,s1s:()=>H.s1s,XkS:()=>H.XkS,Tr8:()=>H.Tr8,GBy:()=>H.GBy,sEM:()=>H.sEM,MIZ:()=>H.MIZ,esB:()=>X.es,YDk:()=>X.YD,n9L:()=>H.n9L,cWu:()=>H.cWu,wx7:()=>H.wx7,G3Y:()=>H.G3Y,kpP:()=>H.kpP,ToN:()=>H.ToN,Qvg:()=>H.Qvg,XDQ:()=>H.XDQ,_wD:()=>X._w,RuY:()=>H.RuY,usg:()=>H.usg,WnP:()=>Ot,Khb:()=>Gt,__u:()=>Wt,IHx:()=>bt.I,QBD:()=>zt,$6P:()=>Ht,YjB:()=>Zt,NqF:()=>jt,vHJ:()=>Xt,ZRM:()=>Kt,VfV:()=>qt,z4N:()=>Qt,fvJ:()=>Yt,C80:()=>Jt,wS1:()=>en.w,uR5:()=>rn,y3$:()=>me,Wap:()=>h,zEQ:()=>un,tgs:()=>dn,Dxk:()=>pn,JY5:()=>hn,p3b:()=>fn,E4h:()=>cn,yE8:()=>mn,anm:()=>gs,XsQ:()=>gn,UFq:()=>bn,Jyw:()=>Se,Xhn:()=>s,f3b:()=>xn.f,pju:()=>G.p,mDi:()=>vn,iUl:()=>wn,d9v:()=>yn.d,PYB:()=>ye.P,zoF:()=>an.z,gME:()=>Tn,Izb:()=>Sn,MNy:()=>An,ZaL:()=>Cn,PAt:()=>kn,Tek:()=>In.T,bc:()=>Nn,pdZ:()=>Bn,$QV:()=>Dn,T3b:()=>Ae.T3,mCk:()=>Mn,f9Y:()=>On,mew:()=>Ss,$Gn:()=>Pn,zbp:()=>$n,cbc:()=>Ct.cb,ppE:()=>Fn,MXe:()=>J,nTT:()=>_n,B10:()=>Ln.B,C2$:()=>Li,Ka3:()=>Vn,WmZ:()=>Un,cFr:()=>Y,B90:()=>se,N8o:()=>ee,hiC:()=>vt,NTj:()=>zn,AKD:()=>Hn,rvX:()=>ws,WYO:()=>Zn,pyx:()=>jn.p,Ra$:()=>Q,G48:()=>q,GRh:()=>Ts,SRH:()=>te,OBj:()=>m.OB,DgJ:()=>Gn,qNN:()=>Xn,d2q:()=>lr,Qqt:()=>ur,dt4:()=>cr,t$B:()=>dr,iyy:()=>hr,kp_:()=>za,hlL:()=>Nt,x3e:()=>pe,zel:()=>he,GWj:()=>fr,qPi:()=>xt,imm:()=>d,Iqj:()=>mr,dbB:()=>vs,DaI:()=>o,N_N:()=>ce,ukX:()=>Ae.uk,pIF:()=>Ae.pI,trD:()=>Ae.tr,UQy:()=>Ct.UQ,tiA:()=>Ct.ti,pjt:()=>gr,brS:()=>yr,Sxn:()=>Ha,asL:()=>be,BHj:()=>Io,V3u:()=>As,io:()=>r,wx0:()=>Za,xVT:()=>br,UWc:()=>xr,i2d:()=>vr,CnY:()=>oe,GDt:()=>f,hi7:()=>wr.h,d9m:()=>Tr,zN1:()=>Sr,$r2:()=>ko,SX3:()=>Ar,G9k:()=>Cr,cM7:()=>Ir,Krr:()=>kr,e_t:()=>Nr,CmS:()=>Br,l_t:()=>Rr,HvI:()=>Dr,hJK:()=>Mr,K5V:()=>Or,egP:()=>Pr,MB5:()=>Eo,eab:()=>_r,OI3:()=>W.O,mAU:()=>a,Fp7:()=>rr.F,_sB:()=>Lr._,YQQ:()=>Vr,Ip$:()=>Ur,gWQ:()=>Pt,J69:()=>Gr.J,sq6:()=>ne,ry_:()=>Hr,VV$:()=>ar,LTh:()=>Zr,VdP:()=>jr,wQq:()=>Xr,Gi7:()=>Kr,p_:()=>ys,dC7:()=>wt.d,rq4:()=>qr,SJ_:()=>Qr,W76:()=>xe,glt:()=>Mo,KOy:()=>ir,Quu:()=>Yr,lfX:()=>j,iUs:()=>zr,JpU:()=>Jr,op:()=>Z.op,N2O:()=>ea,vku:()=>ta.v,pNR:()=>na,koy:()=>ra,t1L:()=>aa,lGY:()=>sa,d_R:()=>ia,sQ3:()=>Rt,AL3:()=>la.A,S0v:()=>ua.S,WVs:()=>ca,N5s:()=>re,$gW:()=>da,N89:()=>pa,TN_:()=>ha,wzB:()=>ba,nGf:()=>xa,ruB:()=>va,LGj:()=>wa,w6H:()=>Ta,Cd_:()=>ue,kwC:()=>ve,M25:()=>Sa,jqO:()=>fe,LiG:()=>Ae.Li,wCN:()=>Ae.wC,UYe:()=>Aa.U,btT:()=>Ca.b,cjG:()=>de,XLQ:()=>nn.X,GYS:()=>Ia,SDf:()=>ka,diP:()=>Ea,sx7:()=>Na,mG2:()=>Ba,QEs:()=>Xa,NMM:()=>Ra,bp0:()=>Da,iD$:()=>It.i,snQ:()=>bs,yV1:()=>i,zcT:()=>Fr,U8D:()=>Ma,U_I:()=>Oa,m7h:()=>u,CQI:()=>le,VYu:()=>ge,ODp:()=>Pa,XD2:()=>sn.X,Xxe:()=>$a,tdS:()=>Co,O$l:()=>Fa,R_K:()=>_a,tPi:()=>on,jZU:()=>La,SmN:()=>Va,CnO:()=>Ua,p0P:()=>Ga,kuN:()=>l,XAC:()=>Wa.X,Wvh:()=>Er,fBT:()=>oa,rVs:()=>No,ers:()=>xs,uN7:()=>Ao,Vl2:()=>ja,_b3:()=>Tt,h62:()=>St,$i:()=>Ka,L9e:()=>qa.L,knu:()=>Qa.k,Nbs:()=>Ya.N,NXj:()=>Ja.N,Z_8:()=>Bo,luU:()=>Dt,Smz:()=>sr.S,z4k:()=>Ut.z4,ORZ:()=>es,AEp:()=>ln,XeE:()=>ts.X,RRF:()=>ns.R,odF:()=>rs,wOQ:()=>Ie,yXz:()=>as,Bfx:()=>ss,xZs:()=>os,piX:()=>K,p3L:()=>c,lub:()=>ae,Gg6:()=>pr,XVJ:()=>ie,hg7:()=>is,p_j:()=>Ro,p4s:()=>we,Xu6:()=>ls,Two:()=>us,bt3:()=>Ae.bt,nEe:()=>Ae.nE,pUJ:()=>cs,HHK:()=>ds,x8V:()=>Ut.x8,GaM:()=>ps,D5U:()=>rt,h76:()=>Ct.h7,fNQ:()=>Ct.fN,VD$:()=>hs,pnJ:()=>Ct.pn,jTM:()=>yt,arb:()=>Wn,itS:()=>ms,lls:()=>Wr,P84:()=>At});var r={};n.r(r),n.d(r,{browserFiles:()=>w,browserHTTPRequest:()=>D,concatenateArrayBuffers:()=>g.JY,copyModel:()=>V.ID,decodeWeights:()=>g.dI,encodeWeights:()=>g.yz,fromMemory:()=>$,fromMemorySync:()=>F,getLoadHandlers:()=>y.rM,getModelArtifactsForJSON:()=>g.jN,getModelArtifactsForJSONSync:()=>g.ji,getModelArtifactsInfoForJSON:()=>g.Q,getSaveHandlers:()=>y.yB,getWeightSpecs:()=>g.hu,http:()=>R,isHTTPScheme:()=>N,listModels:()=>V.h1,loadWeights:()=>I,moveModel:()=>V.Ny,registerLoadRouter:()=>y.pS,registerSaveRouter:()=>y.tf,removeModel:()=>V.gw,weightsLoaderFactory:()=>k,withSaveHandler:()=>_,withSaveHandlerSync:()=>L});var a={};n.r(a),n.d(a,{confusionMatrix:()=>Te});var s={};n.r(s),n.d(s,{fromPixels:()=>De,fromPixelsAsync:()=>Be,toPixels:()=>Re});var o={};n.r(o),n.d(o,{prepareAndValidate:()=>Me});var i={};n.r(i),n.d(i,{calculateShapes:()=>$e,validateInput:()=>Pe,validateUpdateShape:()=>Oe});var l={};n.r(l),n.d(l,{assertParamsValid:()=>Fe,computeFlatOffset:()=>qe,computeOutShape:()=>Le,getNormalizedAxes:()=>We,isSliceContinous:()=>Ke,maskToAxes:()=>_e,parseSliceParams:()=>Qe,sliceInfo:()=>Ye,startForAxis:()=>je,startIndicesWithElidedDims:()=>ze,stopForAxis:()=>Xe,stopIndicesWithElidedDims:()=>He,stridesForAxis:()=>Ze,stridesWithElidedDims:()=>Ve});var u={};n.r(u),n.d(u,{Serializable:()=>et,SerializationMap:()=>tt,registerClass:()=>nt});var c={};n.r(c),n.d(c,{TEST_EPSILON_FLOAT16:()=>at,createVideoElement:()=>mt,encodeStrings:()=>ft,expectArrayBuffersEqual:()=>ht,expectArraysClose:()=>st,expectArraysEqual:()=>ut,expectNumbersClose:()=>ct,expectPromiseToFail:()=>lt,expectValuesInRange:()=>pt,play:()=>gt,testEpsilon:()=>ot});var d={};n.r(d),n.d(d,{conv2d:()=>Cs.T,depthwiseConv2d:()=>Is.B,matMul:()=>ks.O});var p={};n.r(p),n.d(p,{collectGatherOpShapeInfo:()=>$i,computeOutShape:()=>Pi,segOpComputeOptimalWindowSize:()=>Oi});var h={};n.r(h),n.d(h,{ERF_A1:()=>Jo,ERF_A2:()=>ei,ERF_A3:()=>ti,ERF_A4:()=>ni,ERF_A5:()=>ri,ERF_P:()=>Yo,PARALLELIZE_THRESHOLD:()=>Go,RowPartitionType:()=>$o,SELU_SCALE:()=>Qo,SELU_SCALEALPHA:()=>qo,applyActivation:()=>Fo.QH,assertAndGetBroadcastShape:()=>Se.assertAndGetBroadcastShape,assertAxesAreInnerMostDims:()=>Jn,assertParamsConsistent:()=>Oo,assignToTypedArray:()=>ci,axesAreInnerMostDims:()=>Kn,calculateShapes:()=>$e,checkEinsumDimSizes:()=>yi,checkPadOnDimRoundingMode:()=>tn.m,combineLocations:()=>qn,combineRaggedTensorToTensorShapes:()=>_o,complexWithEvenIndex:()=>ii,complexWithOddIndex:()=>li,computeConv2DInfo:()=>tn.Ix,computeConv3DInfo:()=>tn.jw,computeDefaultPad:()=>tn.aO,computeDilation2DInfo:()=>tn.Rf,computeOptimalWindowSize:()=>Wo,computeOutAndReduceShapes:()=>Qn,computeOutShape:()=>Po,computePool2DInfo:()=>tn.Xw,computePool3DInfo:()=>tn.pl,convertConv2DDataFormat:()=>tn.sl,decodeEinsumEquation:()=>mi,eitherStridesOrDilationsAreOne:()=>tn.jT,expandShapeToKeepDim:()=>Yn,exponent:()=>pi,exponents:()=>di,fromStringArrayToUint8:()=>_i,fromUint8ToStringArray:()=>Fi,getAxesPermutation:()=>er,getBroadcastDims:()=>Se.getBroadcastDims,getComplexWithIndex:()=>ui,getEinsumComputePath:()=>bi,getEinsumPermutation:()=>gi,getFusedBiasGradient:()=>Fo.pf,getFusedDyActivation:()=>Fo.Fr,getImageCenter:()=>zo,getInnerMostAxes:()=>nr,getPermuted:()=>Zo,getRaggedRank:()=>Vo,getReductionAxes:()=>Se.getReductionAxes,getReshaped:()=>Ho,getReshapedPermuted:()=>jo,getRowPartitionTypesHelper:()=>Lo,getSliceBeginCoords:()=>Xo,getSliceSize:()=>Ko,getSparseFillEmptyRowsIndicesDenseShapeMismatch:()=>Ti,getSparseFillEmptyRowsNegativeIndexErrorMessage:()=>Si,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:()=>Ai,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:()=>ki,getSparseReshapeInputOutputMismatchErrorMessage:()=>Ni,getSparseReshapeInputOutputMultipleErrorMessage:()=>Ei,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:()=>Ci,getSparseReshapeNegativeOutputDimErrorMessage:()=>Ii,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:()=>Mi,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:()=>Bi,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:()=>Ri,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:()=>Di,getUndoAxesPermutation:()=>tr,isIdentityPermutation:()=>xi,log:()=>ai.c,mergeRealAndImagArrays:()=>si,prepareAndValidate:()=>Me,prepareSplitSize:()=>wi,segment_util:()=>p,shouldFuse:()=>Fo.uy,slice_util:()=>l,splitRealAndImagArrays:()=>oi,tupleValuesAreOne:()=>tn.I0,upcastType:()=>Ut.x8,validateDefaultValueShape:()=>Uo,validateInput:()=>Pe,validateUpdateShape:()=>Oe,warn:()=>ai.Z});var f={};n.r(f),n.d(f,{nonMaxSuppressionV3Impl:()=>Vs,nonMaxSuppressionV4Impl:()=>Us,nonMaxSuppressionV5Impl:()=>Gs,whereImpl:()=>fs});n(1044),n(8209),n(9998);var m=n(2885),g=n(1989),y=n(6493);function b(e){return new Promise((e=>setTimeout(e))).then(e)}class x{constructor(e){if(!(0,m.OB)().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(x.URL_SCHEME)&&(e=e.slice(x.URL_SCHEME.length)),null!=e&&0!==e.length||(e="model"),this.modelJsonFileName=e+".json",this.weightDataFileName=e+".weights.bin"}async save(e){if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");const t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r=(0,g.Yd)(e,n),a=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),s=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor;if(s.download=this.modelJsonFileName,s.href=a,await b((()=>s.dispatchEvent(new MouseEvent("click")))),null!=e.weightData){const e=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor;e.download=this.weightDataFileName,e.href=t,await b((()=>e.dispatchEvent(new MouseEvent("click"))))}return{modelArtifactsInfo:(0,g.Q)(e)}}}}x.URL_SCHEME="downloads://";class v{constructor(e){if(null==e||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.jsonFile=e[0],this.weightsFiles=e.slice(1)}async load(){return new Promise(((e,t)=>{const n=new FileReader;n.onload=n=>{const r=JSON.parse(n.target.result),a=r.modelTopology;if(null==a)return void t(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));if(null==r.weightsManifest)return void t(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));if(0===this.weightsFiles.length)return void e({modelTopology:a});const s=(0,g.jN)(r,(e=>this.loadWeights(e)));e(s)},n.onerror=e=>t(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),n.readAsText(this.jsonFile)}))}loadWeights(e){const t=[],n=[];for(const r of e)t.push(...r.weights),n.push(...r.paths);const r=this.checkManifestAndWeightFiles(e),a=n.map((e=>this.loadWeightsFile(e,r[e])));return Promise.all(a).then((e=>[t,(0,g.JY)(e)]))}loadWeightsFile(e,t){return new Promise(((n,r)=>{const a=new FileReader;a.onload=e=>{const t=e.target.result;n(t)},a.onerror=t=>r(`Failed to weights data from file of path '${e}'.`),a.readAsArrayBuffer(t)}))}checkManifestAndWeightFiles(e){const t=[],n=this.weightsFiles.map((e=>(0,g.EZ)(e.name))),r={};for(const a of e)a.paths.forEach((e=>{const a=(0,g.EZ)(e);if(-1!==t.indexOf(a))throw new Error(`Duplicate file basename found in weights manifest: '${a}'`);if(t.push(a),-1===n.indexOf(a))throw new Error(`Weight file with basename '${a}' is not provided.`);r[e]=this.weightsFiles[n.indexOf(a)]}));if(t.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${t.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return r}}function w(e){return new v(e)}y.U3.registerSaveRouter((e=>(0,m.OB)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(x.URL_SCHEME)?function(e="model"){return new x(e)}(e.slice(x.URL_SCHEME.length)):null));var T=n(569);function S(e,t,n,r){!function(e){(0,T.hu)(null!=e&&Array.isArray(e)&&e.length>0,(()=>"promises must be a none empty array"))}(e),function(e,t){(0,T.hu)(e>=0&&e<=1,(()=>`Progress fraction must be in range [0, 1], but got startFraction ${e}`)),(0,T.hu)(t>=0&&t<=1,(()=>`Progress fraction must be in range [0, 1], but got endFraction ${t}`)),(0,T.hu)(t>=e,(()=>`startFraction must be no more than endFraction, but got startFraction ${e} and endFraction ${t}`))}(n=null==n?0:n,r=null==r?1:r);let a=0;return Promise.all(e.map((s=>(s.then((s=>{const o=n+ ++a/e.length*(r-n);return t(o),s})),s))))}var A=n(5771);async function C(e,t){null==t&&(t={});const n=null==t.fetchFunc?(0,m.OB)().platform.fetch:t.fetchFunc,r=e.map((e=>n(e,t.requestInit,{isBinary:!0}))),a=(null==t.onProgress?await Promise.all(r):await S(r,t.onProgress,0,.5)).map((e=>e.arrayBuffer()));return null==t.onProgress?await Promise.all(a):await S(a,t.onProgress,.5,1)}async function I(e,t="",n,r){return k((e=>C(e,{requestInit:r})))(e,t,n)}function k(e){return async(t,n="",r)=>{const a=t.map((()=>!1)),s={},o=null!=r?r.map((()=>!1)):[],i=[];if(t.forEach(((e,t)=>{let n=0;e.weights.forEach((e=>{const l="quantization"in e?e.quantization.dtype:e.dtype,u=A.J[l]*T.NA(e.shape),c=()=>{a[t]=!0,null==s[t]&&(s[t]=[]),s[t].push({manifestEntry:e,groupOffset:n,sizeBytes:u})};null!=r?r.forEach(((t,n)=>{t===e.name&&(c(),o[n]=!0)})):c(),i.push(e.name),n+=u}))})),!o.every((e=>e))){const e=r.filter(((e,t)=>!o[t]));throw new Error(`Could not find weights in manifest with names: ${e.join(", ")}. \nManifest JSON has weights with names: ${i.join(", ")}.`)}const l=a.reduce(((e,t,n)=>(t&&e.push(n),e)),[]),u=[];l.forEach((e=>{t[e].paths.forEach((e=>{const t=n+(n.endsWith("/")?"":"/")+e;u.push(t)}))}));const c=await e(u),d={};let p=0;return l.forEach((e=>{const n=t[e].paths.length;let r=0;for(let e=0;e<n;e++)r+=c[p+e].byteLength;const a=new ArrayBuffer(r),o=new Uint8Array(a);let i=0;for(let e=0;e<n;e++){const t=new Uint8Array(c[p+e]);o.set(t,i),i+=t.byteLength}s[e].forEach((e=>{const t=a.slice(e.groupOffset,e.groupOffset+e.sizeBytes),n=(0,g.dI)(t,[e.manifestEntry]);for(const e in n)d[e]=n[e]})),p+=n})),d}}class E{constructor(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?((0,T.hu)("function"==typeof t.fetchFunc,(()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)")),this.fetch=t.fetchFunc):this.fetch=(0,m.OB)().platform.fetch,(0,T.hu)(null!=e&&e.length>0,(()=>"URL path for http must not be null, undefined or empty.")),Array.isArray(e)&&(0,T.hu)(2===e.length,(()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`)),this.path=e,null!=t.requestInit&&null!=t.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r=(0,g.Yd)(e,n);t.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=e.weightData&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:"application/octet-stream"}),"model.weights.bin");const a=await this.fetch(this.path,t);if(a.ok)return{modelArtifactsInfo:(0,g.Q)(e),responses:[a]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${a.status}.`)}async load(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(e){let t=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?t+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t)}const n=t.modelTopology,r=t.weightsManifest;if(null==n&&null==r)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return(0,g.jN)(t,(e=>this.loadWeights(e)))}async loadWeights(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=function(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),r=e.substring(0,t),a=n>t?e.substring(n):"";return[r+"/",a]}(t),a=this.weightPathPrefix||n,s=(0,g.hu)(e),o=[],i=[];for(const t of e)for(const e of t.paths)null!=this.weightUrlConverter?i.push(this.weightUrlConverter(e)):o.push(a+e+r);this.weightUrlConverter&&o.push(...await Promise.all(i));const l=await C(o,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,(0,g.JY)(l)]}}function N(e){return null!=e.match(E.URL_SCHEME_REGEX)}E.URL_SCHEME_REGEX=/^https?:\/\//;const B=(e,t)=>{if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;{let n=!0;if(n=Array.isArray(e)?e.every((e=>N(e))):N(e),n)return R(e,t)}return null};function R(e,t){return new E(e,t)}function D(e,t){return R(e,t)}y.U3.registerSaveRouter(B),y.U3.registerLoadRouter(B);class M{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class O{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class P{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=t=>Promise.resolve(e.save(t)))}}function $(e,t,n,r){const a=arguments;return new P(F(...a))}function F(e,t,n,r){if(1===arguments.length){return null!=e.modelTopology||null!=e.weightSpecs?new M(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new M({modelTopology:e}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new M({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r})}function _(e){return new O(e)}function L(e){return new O(e)}var V=n(780),U=n(3740),G=n(2271),W=n(8687),z=n(7097),H=n(9121),Z=n(2668);const j=(0,Z.op)({oneHot_:function(e,t,n=1,r=0,a="int32"){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);const s={indices:(0,U._1)(e,"indices","oneHot","int32")},o={dtype:a,depth:t,onValue:n,offValue:r};return z.BV.runKernel(H.we_,s,o)}});var X=n(4077),K=n(747);function q(){(0,m.OB)().set("PROD",!0)}function Q(){(0,m.OB)().set("DEBUG",!0)}function Y(){(0,m.OB)().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function J(e){(0,m.OB)().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function ee(){z.BV.disposeVariables()}function te(){return z.BV}function ne(){return z.BV.memory()}function re(e){return z.BV.profile(e)}function ae(e,t){return z.BV.tidy(e,t)}function se(e){(0,K.getTensorsInContainer)(e).forEach((e=>e.dispose()))}function oe(e){return z.BV.keep(e)}function ie(e){return z.BV.time(e)}function le(e){return z.BV.setBackend(e)}function ue(){return z.BV.ready()}function ce(){return z.BV.backendName}function de(e){z.BV.removeBackend(e)}function pe(e){return z.BV.findBackend(e)}function he(e){return z.BV.findBackendFactory(e)}function fe(e,t,n=1){return z.BV.registerBackend(e,t,n)}function me(){return z.BV.backend}function ge(e,t){(0,m.OB)().setPlatform(e,t)}(0,X.FZ)(J);var ye=n(1661);const be=(0,Z.op)({imag_:function(e){const t={input:(0,U._1)(e,"input","imag")};return z.BV.runKernel(H.J_u,t)}});const xe=(0,Z.op)({neg_:function(e){const t={x:(0,U._1)(e,"x","neg")};return z.BV.runKernel(H.kuV,t)}});const ve=(0,Z.op)({real_:function(e){const t={input:(0,U._1)(e,"input","real")};return z.BV.runKernel(H.xJR,t)}});const we=(0,Z.op)({transpose_:function(e,t,n){const r=(0,U._1)(e,"x","transpose");if(null==t&&(t=r.shape.map(((e,t)=>t)).reverse()),T.hu(r.rank===t.length,(()=>`Error in transpose: rank of input ${r.rank} must match length of perm ${t}.`)),t.forEach((e=>{T.hu(e>=0&&e<r.rank,(()=>"All entries in 'perm' must be between 0 and "+(r.rank-1)+` but got ${t}`))})),r.rank<=1)return r.clone();const a={x:r},s={perm:t};return"complex64"===r.dtype?ae((()=>{let e=ve(r),t=be(r);return e=z.BV.runKernel(H.G3Y,{x:e},s),t=z.BV.runKernel(H.G3Y,{x:t},s),n&&(t=xe(t)),(0,ye.P)(e,t)})):z.BV.runKernel(H.G3Y,a,s)}});const Te=(0,Z.op)({confusionMatrix_:function(e,t,n){const r=(0,U._1)(e,"labels","confusionMatrix"),a=(0,U._1)(t,"predictions","confusionMatrix");T.hu(null==n||n>0&&Number.isInteger(n),(()=>`If provided, numClasses must be a positive integer, but got ${n}`)),T.hu(1===r.rank,(()=>`Expected the rank of labels to be 1, but got ${r.rank}`)),T.hu(1===a.rank,(()=>`Expected the rank of predictions to be 1, but got ${a.rank}`)),T.hu(r.shape[0]===a.shape[0],(()=>`Mismatch in the number of examples: ${r.shape[0]} vs. ${a.shape[0]}. Labels and predictions should have the same number of elements.`)),T.hu(n>0&&Number.isInteger(n),(()=>`numClasses is required to be a positive integer, but got ${n}`));const s=j((0,G.p)(r,"int32"),n),o=j((0,G.p)(a,"int32"),n),i=we(s),l=(0,W.O)(i,o);return(0,G.p)(l,"int32")}});var Se=n(2200),Ae=n(6151),Ce=n(7852);function Ie(e,t,n){if((0,T.Cq)(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");const r=(0,U.C)(e,n);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return(0,Ce.H)(e,t,r,n)}let ke;function Ee(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,a=!1,s=!1,o=!1,i=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)a=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)s=!0;else if(null!=e.getContext)o=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);i=!0}if(null!=(0,Ae.pI)(H.eBW,z.BV.backendName)){const n={pixels:e},r={numChannels:t};return z.BV.runKernel(H.eBW,n,r)}const[l,u]=a?[e.videoWidth,e.videoHeight]:[e.width,e.height];let c,d;if(o)c=e.getContext("2d").getImageData(0,0,l,u).data;else if(r||n)c=e.data;else if(s||a||i){if(null==ke)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");ke=new OffscreenCanvas(1,1).getContext("2d")}else ke=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});ke.canvas.width=l,ke.canvas.height=u,ke.drawImage(e,0,0,l,u),c=ke.getImageData(0,0,l,u).data}if(4===t)d=new Int32Array(c);else{const e=l*u;d=new Int32Array(e*t);for(let n=0;n<e;n++)for(let e=0;e<t;++e)d[n*t+e]=c[4*n+e]}return Ie(d,[u,l,t],"int32")}function Ne(e){return"undefined"!=typeof window&&"undefined"!=typeof ImageBitmap&&window.hasOwnProperty("createImageBitmap")&&!(e instanceof ImageBitmap)&&function(e){return null!=e&&0!==e.width&&0!==e.height}(e)&&!function(e){return null!=e&&e.data instanceof Uint8Array}(e)}async function Be(e,t=3){let n=null;if((0,m.OB)().getBool("WRAP_TO_IMAGEBITMAP")&&Ne(e)){let t;try{t=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch(e){t=null}n=null!=t&&t.width===e.width&&t.height===e.height?t:e}else n=e;return Ee(n,t)}async function Re(e,t){let n=(0,U._1)(e,"img","toPixels");if(!(e instanceof X.es)){const e=n;n=(0,G.p)(e,"int32"),e.dispose()}if(2!==n.rank&&3!==n.rank)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${n.rank}.`);const[r,a]=n.shape.slice(0,2),s=2===n.rank?1:n.shape[2];if(s>4||2===s)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${s}`);if("float32"!==n.dtype&&"int32"!==n.dtype)throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);const o=await n.data(),i="float32"===n.dtype?255:1,l=new Uint8ClampedArray(a*r*4);for(let e=0;e<r*a;++e){const t=[0,0,0,255];for(let r=0;r<s;r++){const a=o[e*s+r];if("float32"===n.dtype){if(a<0||a>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${a}.`)}else if("int32"===n.dtype&&(a<0||a>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${a}.`);1===s?(t[0]=a*i,t[1]=a*i,t[2]=a*i):t[r]=a*i}const r=4*e;l[r+0]=Math.round(t[0]),l[r+1]=Math.round(t[1]),l[r+2]=Math.round(t[2]),l[r+3]=Math.round(t[3])}if(null!=t){t.width=a,t.height=r;const e=t.getContext("2d"),n=new ImageData(l,a,r);e.putImageData(n,0,0)}return n!==e&&n.dispose(),l}const De=(0,Z.op)({fromPixels_:Ee});function Me(e,t){const n=e.shape.length,r=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(r<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);if("int32"!==t.dtype)throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[r-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r-1]} vs. ${n}`);if(0===(0,T.NA)(e.shape))throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);const a=t.shape,s=a[a.length-1];let o=1;for(let e=0;e<a.length-1;++e)o*=a[e];const i=e.shape,l=a.slice();l.pop();let u=1;for(let e=s;e<n;++e)u*=i[e],l.push(i[e]);const c=[...(0,T.e3)(e.shape).map((e=>e/u)),1].slice(0,s);return[l,o,u,c]}function Oe(e,t,n){const r=t.rank>1?t.shape[t.rank-1]:1,a=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${a}.`;if(n.rank<a)throw new Error(s+` update.rank < ${a}. `);if(e.length<r+(n.rank-a))throw new Error(s+` Output shape length < ${r+(n.rank-a)}`);if(n.rank!==a+e.length-r)throw new Error(s+" update.rank != "+(a+e.length-r));for(let e=0;e<a;++e)if(n.shape[e]!==t.shape[e])throw new Error(s+` updates.shape[${e}] (${n.shape[e]}) != indices.shape[${e}] (${t.shape[e]}).`);for(let t=0;t<n.rank-a;++t)if(n.shape[t+a]!==e[t+r])throw new Error(s+` updates.shape[${t+a}] (${n.shape[t+a]}) != shape[${t+a}] (${e[t+a]})`)}function Pe(e,t,n){if(t.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if("int32"!==t.dtype)throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(0===n.length){if(0===t.size)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(0===e.size)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}Oe(n,t,e)}function $e(e,t,n){const r=t.shape.length,a=r>1?t.shape[r-1]:1,s=n.length;let o=1;for(let e=a;e<s;++e)o*=n[e];const i=a<1?1:a;return{sliceRank:a,numUpdates:(0,T.NA)(t.shape)/i,sliceSize:o,strides:[...(0,T.e3)(n.slice(0,a)),1],outputSize:(0,T.NA)(n)}}function Fe(e,t,n){const r=e.shape.length;T.hu(r===t.length,(()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`)),T.hu(r===n.length,(()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`));for(let a=0;a<r;++a)T.hu(t[a]+n[a]<=e.shape[a],(()=>`Error in slice${r}D: begin[${a}] + size[${a}] (${t[a]+n[a]}) would overflow input.shape[${a}] (${e.shape[a]})`))}function _e(e){const t=[];let n=0;for(;e>0;)1&e&&t.push(n),e/=2,n++;return t}function Le(e,t,n){const r=[];for(let a=0;a<e.length;a++)r[a]=Math.ceil((t[a]-e[a])/n[a]);return r}function Ve(e,t,n,r){const a=[...e];for(let e=a.length;e<r.length;e++)a.push(1);for(let e=0;e<n;e++)0===e?a[t]=1:(a.splice(t,0,1),a.pop());return a}function Ue(e,t,n){return n<=e?n:n-(t-1)}function Ge(e,t){const n=[];for(let r=0;r<e;r++)n.push(t+r);return n}function We(e,t,n,r,a,s,o,i,l){const u=e.length;let c=new Array(u),d=new Array(u),p=new Array(u);if(t.length&&n>0){const l=t[0],u=n+1;c=ze(o,l,u,r,e),d=He(i,l,u,a,e),p=Ve(s,l,u,e)}else for(let t=0;t<u;t++)c[t]=je(o,r,s,e,t,l),d[t]=Xe(i,a,s,e,t,l),p[t]=Ze(s,t,l);return{begin:c,end:d,strides:p}}function ze(e,t,n,r,a){const s=[...a],o=Ge(n,t);for(let a=0;a<s.length;a++)if(o.indexOf(a)>-1)s[a]=0;else{const o=Ue(t,n,a);let i=r[o];e&1<<o&&(i=0),s[a]=i}return s}function He(e,t,n,r,a){const s=[...a],o=Ge(n,t);for(let a=0;a<s.length;a++)if(o.indexOf(a)>-1)s[a]=Number.MAX_SAFE_INTEGER;else{const o=Ue(t,n,a);let i=r[o];e&1<<o&&(i=Number.MAX_SAFE_INTEGER),s[a]=i}for(let e=0;e<s.length;e++){const t=a[e];s[e]<0&&(s[e]+=t),s[e]=T.uZ(0,s[e],a[e])}return s}function Ze(e,t,n){let r=e[t];return(n&1<<t||null==r)&&(r=1),r}function je(e,t,n,r,a,s){let o=t[a];const i=n[a]||1;(e&1<<a||s&1<<a||null==o)&&(o=i>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);const l=r[a];return o<0&&(o+=l),o=T.uZ(0,o,l-1),o}function Xe(e,t,n,r,a,s){let o=t[a];const i=n[a]||1;(e&1<<a||s&1<<a||null==o)&&(o=i>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);const l=r[a];return o<0&&(o+=l),o=i>0?T.uZ(0,o,l):T.uZ(-1,o,l-1),o}function Ke(e,t,n){let r=n.length;for(let e=0;e<n.length;e++)if(n[e]>1){r=e;break}for(let a=r+1;a<n.length;a++)if(t[a]>0||n[a]!==e[a])return!1;return!0}function qe(e,t){let n=e.length>0?e[e.length-1]:1;for(let r=0;r<e.length-1;r++)n+=e[r]*t[r];return n}function Qe(e,t,n){let r;const a=e.shape.length;let s;return r="number"==typeof t?[t,...new Array(a-1).fill(0)]:t.length<a?t.concat(new Array(a-t.length).fill(0)):t.slice(),r.forEach((e=>{T.hu(-1!==e,(()=>"slice() does not support negative begin indexing."))})),s=null==n?new Array(a).fill(-1):"number"==typeof n?[n,...new Array(a-1).fill(-1)]:n.length<a?n.concat(new Array(a-n.length).fill(-1)):n,s=s.map(((t,n)=>t>=0?t:(T.hu(-1===t,(()=>`Negative size values should be exactly -1 but got ${t} for the slice() size at index ${n}.`)),e.shape[n]-r[n]))),[r,s]}function Ye(e,t,n,r,a,s,o,i,l){let u;if(null==r?(u=new Array(t.length),u.fill(1)):u=r,null!=o&&0!=(o&o-1))throw new Error("Multiple ellipses in slice is not allowed.");let c=!1;const d={dims:u.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:u.slice(),beginMask:a,endMask:s,ellipsisMask:o,newAxisMask:i,shrinkAxisMask:l};for(let e=0;e<d.dims;e++)c&&0!=(1<<e&i)&&d.numAddAxisAfterEllipsis++,1<<e&o&&(c=!0);c||(d.ellipsisMask|=1<<d.dims,d.dims++);const p={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};!function(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let n=0;t.beginValid=null!=e.begin,t.endValid=null!=e.end,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let r=0;r<e.dims;r++)if(1<<r&e.ellipsisMask){const a=Math.min(t.dims-(e.dims-r)+1+e.numAddAxisAfterEllipsis,t.dims);for(;n<a;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=r}else if(1<<r&e.newAxisMask)t.finalShapeGatherIndices.push(-2),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error(`Index out of range using input dim ${n}; input has only ${t.dims} dims, ${t.begin.length}.`);null!=e.begin&&(t.begin[n]=e.begin[r]),null!=e.end&&(t.end[n]=e.end[r]),t.strides[n]=e.strides[r],e.beginMask&1<<r&&(t.beginMask|=1<<n),e.endMask&1<<r&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<r?(t.finalShapeGatherIndices.push(-1),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(r)),t.inputShapeGatherIndicesSparse[n]=r,n++}}(d,p);let h=!0,f=!0,m=!0;const g=[],y=[];for(let t=0;t<e.length;++t){if(0===p.strides[t])throw Error(`strides[${t}] must be non-zero`);const n=!!(p.shrinkAxisMask&1<<t),r=e[t];if(-1===r){g.push(n?1:-1);continue}const a=[p.beginMask&1<<t,p.endMask&1<<t],s=[p.strides[t]>0?0:-1,p.strides[t]>0?r:r-1];if(n&&p.strides[t]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&1===p.strides[t];const o=!!(p.beginMask&1<<t&&p.endMask&1<<t);if(p.beginValid&&p.endValid){if(n){const e=p.begin[t]<0?r+p.begin[t]:p.begin[t];if(p.begin[t]=e,p.end[t]=p.begin[t]+1,e<0||e>=r)throw Error(`slice index ${p.begin[t]} of dimension ${t} out of bounds.`)}else p.begin[t]=Je(p.begin[t],0,p.strides[t],r,a,s),p.end[t]=Je(p.end[t],1,p.strides[t],r,a,s);const e=1===p.strides[t]&&0===p.begin[t]&&p.end[t]===r;h=h&&e,f=f&&(0===t&&1===p.strides[t]||e)}else h=h&&1===p.strides[t]&&o,f=f&&(0===t&&1===p.strides[t]||o);let i,l=!1;if(p.beginValid&&p.endValid?(i=p.end[t]-p.begin[t],l=!0):n?(i=1,l=!0):o&&r>=0&&(i=p.strides[t]<0?-r:r,l=!0),l){let e;e=0===i||i<0!=p.strides[t]<0?0:Math.trunc(i/p.strides[t])+(i%p.strides[t]!=0?1:0),g.push(e)}else g.push(-1)}for(let e=0;e<p.finalShapeGatherIndices.length;++e){const t=p.finalShapeGatherIndices[e];t>=0?y.push(g[t]):-2===t&&y.push(1)}return{finalShapeSparse:y.filter(((e,t)=>-2!==p.finalShapeGatherIndices[t])),finalShape:y,isIdentity:h,sliceDim0:f,isSimpleSlice:m,begin:p.begin,end:p.end,strides:p.strides}}function Je(e,t,n,r,a,s){if(a[t])return n>0?s[t]:s[t+1&1];{const t=e<0?r+e:e;return t<s[0]?s[0]:t>s[1]?s[1]:t}}class et{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class tt{constructor(){this.classNameMap={}}static getMap(){return null==tt.instance&&(tt.instance=new tt),tt.instance}static register(e){tt.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function nt(e){(0,T.hu)(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),(0,T.hu)("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),(0,T.hu)(e.className.length>0,(()=>"Class being registered has an empty-string as its className, which is disallowed.")),tt.register(e)}var rt=n(9122);const at=.1;function st(e,t,n){return null==n&&(n=ot()),it(e,t,((e,t)=>dt(e,t,n)))}function ot(){return 32===z.BV.backend.floatPrecision()?.001:at}function it(e,t,n){let r=!0;if(((0,T.fU)(e)||(0,T.fU)(t))&&(r=!1),(0,T.fU)(e)&&(0,T.fU)(t)&&(r=!0),r){const n=e.constructor.name,r=t.constructor.name;if(n!==r)throw new Error(`Arrays are of different type. Actual: ${n}. Expected: ${r}`)}if(Array.isArray(e)&&Array.isArray(t)){const n=(0,U.C)(e),r=(0,U.C)(t);if(!(0,T.cO)(n,r))throw new Error(`Arrays have different shapes. Actual: [${n}]. Expected: [${r}]`)}const a=(0,T.fU)(e)?e:(0,T.xH)(e),s=(0,T.fU)(t)?t:(0,T.xH)(t);if(a.length!==s.length)throw new Error(`Arrays have different lengths actual: ${a.length} vs expected: ${s.length}.\nActual: ${a}.\nExpected: ${s}.`);for(let e=0;e<s.length;++e){const t=a[e],r=s[e];if(!n(t,r))throw new Error(`Arrays differ: actual[${e}] = ${t}, expected[${e}] = ${r}.\nActual: ${a}.\nExpected: ${s}.`)}"undefined"!=typeof expect&&expect().nothing()}function lt(e,t){e().then((()=>t.fail()),(()=>t())),"undefined"!=typeof expect&&expect().nothing()}function ut(e,t){const n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;return(0,T.HD)(e)||(0,T.HD)(e[0])||(0,T.HD)(t)||(0,T.HD)(t[0])?it(e,n,((e,t)=>e==t)):it(e,t,((e,t)=>dt(e,t,0)))}function ct(e,t,n){if(null==n&&(n=ot()),!dt(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`);"undefined"!=typeof expect&&expect().nothing()}function dt(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function pt(e,t,n){for(let r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error(`Value out of range:${e[r]} low: ${t}, high: ${n}`)}function ht(e,t){const n=new Float32Array(e),r=new Float32Array(t);if(n.length!==r.length)throw new Error(`Expected ArrayBuffer to be of length ${r.length}, but it was ${n.length}`);for(let e=0;e<r.length;e++)if(n[e]!==r[e])throw new Error(`Expected ArrayBuffer value at ${e} to be ${r[e]} but got ${n[e]} instead`)}function ft(e){for(let t=0;t<e.length;t++){const n=e[t];Array.isArray(n)?ft(n):e[t]=(0,rt.encodeString)(n)}return e}function mt(e){const t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise((e=>{t.addEventListener("loadeddata",(n=>e(t))),t.load()}))}async function gt(e){await e.play(),"requestVideoFrameCallback"in e&&await new Promise((t=>{e.requestVideoFrameCallback(t)}))}const yt="3.21.0";var bt=n(6407);const xt=(0,Z.op)({floorDiv_:function(e,t){let n=(0,U._1)(e,"a","floorDiv"),r=(0,U._1)(t,"b","floorDiv");[n,r]=(0,K.makeTypesMatch)(n,r);const a={a:n,b:r};return z.BV.runKernel(H.jeX,a)}});const vt=(0,Z.op)({div_:function(e,t){let n=(0,U._1)(e,"a","div"),r=(0,U._1)(t,"b","div");if([n,r]=(0,K.makeTypesMatch)(n,r),"int32"===n.dtype&&"int32"===r.dtype)return xt(n,r);const a={a:n,b:r};return z.BV.runKernel(H.oHH,a,{})}});var wt=n(4841);const Tt=(0,Z.op)({sqrt_:function(e){const t={x:(0,U._1)(e,"x","sqrt","float32")};return z.BV.runKernel(H.FKq,t)}});const St=(0,Z.op)({square_:function(e){const t=(0,U._1)(e,"x","square");return z.BV.runKernel("Square",{x:t},{})}});const At=(0,Z.op)({zerosLike_:function(e){const t={x:(0,U._1)(e,"x","zerosLike")};return z.BV.runKernel(H.RuY,t)}});var Ct=n(633),It=n(9494);class kt extends et{minimize(e,t=!1,n){const{value:r,grads:a}=this.computeGradients(e,n);if(null!=n){const e=n.map((e=>({name:e.name,tensor:a[e.name]})));this.applyGradients(e)}else this.applyGradients(a);return se(a),t?r:(r.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return(0,Ct.pn)(e,t)}dispose(){null!=this.iterations_&&se(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:(0,It.i)(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(kt,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients});class Et extends kt{constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=z.BV.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=z.BV.registeredVariables[t];null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:ae((()=>At(r).variable(false)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:ae((()=>At(r).variable(false)))});const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const s=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;ae((()=>{const e=(0,bt.I)((0,wt.d)(s,this.rho),(0,wt.d)(St(a),1-this.rho)),t=(0,wt.d)(vt(Tt((0,bt.I)(o,this.epsilon)),Tt((0,bt.I)(s,this.epsilon))),a),n=(0,bt.I)((0,wt.d)(o,this.rho),(0,wt.d)(St(t),1-this.rho));s.assign(e),o.assign(n);const i=(0,bt.I)((0,wt.d)(t,-this.learningRate),r);r.assign(i)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(se(this.accumulatedGrads.map((e=>e.variable))),se(this.accumulatedUpdates.map((e=>e.variable))))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}}function Nt(e,t,n){const r={shape:e,value:t,dtype:n};return z.BV.runKernel(H.deh,{},r)}Et.className="Adadelta",nt(Et);class Bt extends kt{constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=z.BV.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:ae((()=>Nt(r.shape,this.initialAccumulatorValue).variable(e)))}}const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const s=this.accumulatedGrads[n].variable;ae((()=>{const e=(0,bt.I)(s,St(a));s.assign(e);const t=(0,bt.I)((0,wt.d)(vt(a,Tt((0,bt.I)(e,z.BV.backend.epsilon()))),-this.learningRate),r);r.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&se(this.accumulatedGrads.map((e=>e.variable)))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}}Bt.className="Adagrad",nt(Bt);const Rt=(0,Z.op)({pow_:function(e,t){let n=(0,U._1)(e,"base","pow"),r=(0,U._1)(t,"exp","pow");[n,r]=(0,K.makeTypesMatch)(n,r);const a={a:n,b:r};return z.BV.runKernel(H.pe_,a)}});const Dt=(0,Z.op)({sub_:function(e,t){let n=(0,U._1)(e,"a","sub"),r=(0,U._1)(t,"b","sub");[n,r]=(0,K.makeTypesMatch)(n,r);const a={a:n,b:r};return z.BV.runKernel(H.Tr8,a)}});class Mt extends kt{constructor(e,t,n,r=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],ae((()=>{this.accBeta1=(0,It.i)(t).variable(),this.accBeta2=(0,It.i)(n).variable()})),null==r&&(this.epsilon=z.BV.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);ae((()=>{const n=Dt(1,this.accBeta1),r=Dt(1,this.accBeta2);t.forEach(((t,a)=>{const s=z.BV.registeredVariables[t];null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:ae((()=>At(s).variable(false)))}),null==this.accumulatedSecondMoment[a]&&(this.accumulatedSecondMoment[a]={originalName:`${t}/v`,variable:ae((()=>At(s).variable(false)))});const o=Array.isArray(e)?e[a].tensor:e[t];if(null==o)return;const i=this.accumulatedFirstMoment[a].variable,l=this.accumulatedSecondMoment[a].variable,u=(0,bt.I)((0,wt.d)(i,this.beta1),(0,wt.d)(o,1-this.beta1)),c=(0,bt.I)((0,wt.d)(l,this.beta2),(0,wt.d)(St(o),1-this.beta2)),d=vt(u,n),p=vt(c,r);i.assign(u),l.assign(c);const h=(0,bt.I)((0,wt.d)(vt(d,(0,bt.I)(Tt(p),this.epsilon)),-this.learningRate),s);s.assign(h)})),this.accBeta1.assign((0,wt.d)(this.accBeta1,this.beta1)),this.accBeta2.assign((0,wt.d)(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&se(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&se(this.accumulatedSecondMoment.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e),ae((()=>{this.accBeta1.assign(Rt(this.beta1,this.iterations_+1)),this.accBeta2.assign(Rt(this.beta2,this.iterations_+1))}));const t=e.length/2;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}}Mt.className="Adam",nt(Mt);const Ot=(0,Z.op)({abs_:function(e){const t=(0,U._1)(e,"x","abs");if("complex64"===t.dtype){const e={x:t};return z.BV.runKernel(H.yj2,e)}{const e={x:t};return z.BV.runKernel(H.SYM,e)}}});const Pt=(0,Z.op)({maximum_:function(e,t){let n=(0,U._1)(e,"a","maximum"),r=(0,U._1)(t,"b","maximum");[n,r]=(0,K.makeTypesMatch)(n,r),"bool"===n.dtype&&(n=(0,G.p)(n,"int32"),r=(0,G.p)(r,"int32")),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.BMI,a)}});class $t extends kt{constructor(e,t,n,r=null,a=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.decay=a,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],ae((()=>{this.iteration=(0,It.i)(0).variable(),this.accBeta1=(0,It.i)(t).variable()})),null==r&&(this.epsilon=z.BV.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);ae((()=>{const n=Dt(1,this.accBeta1),r=vt(-this.learningRate,(0,bt.I)((0,wt.d)(this.iteration,this.decay),1));t.forEach(((t,a)=>{const s=z.BV.registeredVariables[t];null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:At(s).variable(false)}),null==this.accumulatedWeightedInfNorm[a]&&(this.accumulatedWeightedInfNorm[a]={originalName:`${t}/v`,variable:At(s).variable(false)});const o=Array.isArray(e)?e[a].tensor:e[t];if(null==o)return;const i=this.accumulatedFirstMoment[a].variable,l=this.accumulatedWeightedInfNorm[a].variable,u=(0,bt.I)((0,wt.d)(i,this.beta1),(0,wt.d)(o,1-this.beta1)),c=(0,wt.d)(l,this.beta2),d=Ot(o),p=Pt(c,d);i.assign(u),l.assign(p);const h=(0,bt.I)((0,wt.d)(vt(r,n),vt(u,(0,bt.I)(p,this.epsilon))),s);s.assign(h)})),this.iteration.assign((0,bt.I)(this.iteration,1)),this.accBeta1.assign((0,wt.d)(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&se(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&se(this.accumulatedWeightedInfNorm.map((e=>e.variable)))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}$t.className="Adamax",nt($t);class Ft extends kt{constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const a=z.BV.registeredVariables[t];ae((()=>{const e=(0,bt.I)((0,wt.d)(this.c,r),a);a.assign(e)}))})),this.incrementIterations()}setLearningRate(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=oe((0,It.i)(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}Ft.className="SGD",nt(Ft);class _t extends Ft{constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=(0,It.i)(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=z.BV.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:ae((()=>At(r).variable(e)))}}const a=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];null!=s&&ae((()=>{let e;const t=(0,bt.I)((0,wt.d)(this.m,a),s);e=this.useNesterov?(0,bt.I)((0,wt.d)(this.c,(0,bt.I)(s,(0,wt.d)(t,this.m))),r):(0,bt.I)((0,wt.d)(this.c,t),r),a.assign(t),r.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&se(this.accumulations.map((e=>e.variable)))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}_t.className="Momentum",nt(_t);class Lt extends kt{constructor(e,t=.9,n=0,r=null,a=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=r,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=a,null==r&&(this.epsilon=z.BV.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=z.BV.registeredVariables[t],a=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:ae((()=>At(r).variable(a)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:ae((()=>At(r).variable(a)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:ae((()=>At(r).variable(a)))});const s=Array.isArray(e)?e[n].tensor:e[t];if(null==s)return;const o=this.accumulatedMeanSquares[n].variable,i=this.accumulatedMoments[n].variable;ae((()=>{const e=(0,bt.I)((0,wt.d)(o,this.decay),(0,wt.d)(St(s),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,a=(0,bt.I)((0,wt.d)(t,this.decay),(0,wt.d)(s,1-this.decay)),l=vt((0,wt.d)(s,this.learningRate),Tt(Dt(e,(0,bt.I)(St(a),this.epsilon)))),u=(0,bt.I)((0,wt.d)(i,this.momentum),l);o.assign(e),t.assign(a),i.assign(u);const c=Dt(r,u);r.assign(c)}else{const e=(0,bt.I)((0,wt.d)(o,this.decay),(0,wt.d)(St(s),1-this.decay)),t=(0,bt.I)((0,wt.d)(i,this.momentum),vt((0,wt.d)(s,this.learningRate),Tt((0,bt.I)(e,this.epsilon))));o.assign(e),i.assign(t);const n=Dt(r,t);r.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&se(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&se(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&se(this.accumulatedMoments.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedMoments=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}}Lt.className="RMSProp",nt(Lt);class Vt{static sgd(e){return new Ft(e)}static momentum(e,t,n=!1){return new _t(e,t,n)}static rmsprop(e,t=.9,n=0,r=null,a=!1){return new Lt(e,t,n,r,a)}static adam(e=.001,t=.9,n=.999,r=null){return new Mt(e,t,n,r)}static adadelta(e=.001,t=.95,n=null){return new Et(e,t,n)}static adamax(e=.002,t=.9,n=.999,r=null,a=0){return new $t(e,t,n,r,a)}static adagrad(e,t=.1){return new Bt(e,t)}}var Ut=n(1221);const Gt=(0,Z.op)({acos_:function(e){const t={x:(0,U._1)(e,"x","acos")};return z.BV.runKernel(H.VGw,t)}});const Wt=(0,Z.op)({acosh_:function(e){const t={x:(0,U._1)(e,"x","acosh")};return z.BV.runKernel(H.SpW,t)}});const zt=(0,Z.op)({addN_:function(e){T.hu(Array.isArray(e),(()=>"The argument passed to tf.addN() must be a list of tensors")),T.hu(e.length>=1,(()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`));const t=e.map(((e,t)=>(0,U._1)(e,`tensors${t}`,"addN"))),n=t[0];t.forEach((e=>{if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),t.forEach((e=>{if(!T.cO(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));const r=t;return z.BV.runKernel(H.Xze,r)}});const Ht=(0,Z.op)({all_:function(e,t=null,n=!1){const r={x:(0,U._1)(e,"x","all","bool")},a={axis:t,keepDims:n};return z.BV.runKernel(H.oT6,r,a)}});const Zt=(0,Z.op)({any_:function(e,t=null,n=!1){const r={x:(0,U._1)(e,"x","any","bool")},a={axis:t,keepDims:n};return z.BV.runKernel(H.IKK,r,a)}});const jt=(0,Z.op)({argMax_:function(e,t=0){const n={x:(0,U._1)(e,"x","argMax")},r={axis:t};return z.BV.runKernel(H.sJF,n,r)}});const Xt=(0,Z.op)({argMin_:function(e,t=0){const n={x:(0,U._1)(e,"x","argMin")},r={axis:t};return z.BV.runKernel(H.aJk,n,r)}});const Kt=(0,Z.op)({asin_:function(e){const t={x:(0,U._1)(e,"x","asin")};return z.BV.runKernel(H.M2y,t)}});const qt=(0,Z.op)({asinh_:function(e){const t={x:(0,U._1)(e,"x","asinh")};return z.BV.runKernel(H.qw7,t)}});const Qt=(0,Z.op)({atan_:function(e){const t={x:(0,U._1)(e,"x","atan")};return z.BV.runKernel(H.jMg,t)}});const Yt=(0,Z.op)({atan2_:function(e,t){let n=(0,U._1)(e,"a","atan2"),r=(0,U._1)(t,"b","atan2");[n,r]=(0,K.makeTypesMatch)(n,r);const a={a:n,b:r};return z.BV.runKernel(H.QCc,a)}});const Jt=(0,Z.op)({atanh_:function(e){const t={x:(0,U._1)(e,"x","atanh")};return z.BV.runKernel(H.Oyi,t)}});var en=n(5176),tn=n(2582),nn=n(4968);const rn=(0,Z.op)({avgPool3d_:function(e,t,n,r,a,s="NDHWC"){const o=(0,U._1)(e,"x","avgPool3d","float32");let i=o,l=!1;4===o.rank&&(l=!0,i=(0,nn.X)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),T.hu(5===i.rank,(()=>`Error in avgPool3d: x must be rank 5 but got rank ${i.rank}.`)),T.hu("NDHWC"===s,(()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),(0,tn.m)("avgPool3d",r,a);const u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s};let d=z.BV.runKernel(H._k9,u,c);return d=(0,G.p)(d,i.dtype),l?(0,nn.X)(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}});var an=n(6884),sn=n(625);const on=(0,Z.op)({slice_:function(e,t,n){const r=(0,U._1)(e,"x","slice","string_or_numeric");if(0===r.rank)throw new Error("Slicing scalar is not possible");const a={x:r},s={begin:t,size:n};return z.BV.runKernel(H.p2w,a,s)}});const ln=(0,Z.op)({tanh_:function(e){const t={x:(0,U._1)(e,"x","tanh","float32")};return z.BV.runKernel(H.MIZ,t)}});const un=(0,Z.op)({basicLSTMCell_:function(e,t,n,r,a,s){const o=(0,U._1)(e,"forgetBias","basicLSTMCell"),i=(0,U._1)(t,"lstmKernel","basicLSTMCell"),l=(0,U._1)(n,"lstmBias","basicLSTMCell"),u=(0,U._1)(r,"data","basicLSTMCell"),c=(0,U._1)(a,"c","basicLSTMCell"),d=(0,U._1)(s,"h","basicLSTMCell"),p=(0,an.z)([u,d],1),h=(0,W.O)(p,i),f=(0,bt.I)(h,l),m=f.shape[0],g=f.shape[1]/4,y=[m,g],b=on(f,[0,0],y),x=on(f,[0,g],y),v=on(f,[0,2*g],y),w=on(f,[0,3*g],y),T=(0,bt.I)((0,wt.d)((0,sn.X)(b),ln(x)),(0,wt.d)(c,(0,sn.X)((0,bt.I)(o,v))));return[T,(0,wt.d)(ln(T),(0,sn.X)(w))]}});const cn=(0,Z.op)({batchToSpaceND_:function(e,t,n){const r=(0,U._1)(e,"x","batchToSpaceND"),a=t.reduce(((e,t)=>e*t));T.hu(r.rank>=1+t.length,(()=>`input rank is ${r.rank} but should be > than blockShape.length ${t.length}`)),T.hu(n.length===t.length,(()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`)),T.hu(r.shape[0]%a==0,(()=>`input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${a}`));const s={x:r},o={blockShape:t,crops:n};return z.BV.runKernel(H.zws,s,o)}});const dn=(0,Z.op)({batchNorm_:function(e,t,n,r,a,s){null==s&&(s=.001);const o=(0,U._1)(e,"x","batchNorm"),i=(0,U._1)(t,"mean","batchNorm"),l=(0,U._1)(n,"variance","batchNorm");let u,c;null!=a&&(u=(0,U._1)(a,"scale","batchNorm")),null!=r&&(c=(0,U._1)(r,"offset","batchNorm")),T.hu(i.rank===l.rank,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),T.hu(null==c||i.rank===c.rank,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),T.hu(null==u||i.rank===u.rank,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));const d=function(e){let t;return t=0===e.rank||1===e.rank?(0,nn.X)(e,[1,1,1,e.size]):2===e.rank?(0,nn.X)(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?(0,nn.X)(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e,t}(o),p={x:d,scale:u,offset:c,mean:i,variance:l},h={varianceEpsilon:s},f=z.BV.runKernel(H.sHE,p,h);return(0,nn.X)(f,o.shape)}});const pn=(0,Z.op)({batchNorm2d_:function(e,t,n,r,a,s){const o=(0,U._1)(e,"x","batchNorm"),i=(0,U._1)(t,"mean","batchNorm"),l=(0,U._1)(n,"variance","batchNorm");let u,c;return null!=a&&(u=(0,U._1)(a,"scale","batchNorm")),null!=r&&(c=(0,U._1)(r,"offset","batchNorm")),T.hu(2===o.rank,(()=>`Error in batchNorm2D: x must be rank 2 but got rank ${o.rank}.`)),T.hu(2===i.rank||1===i.rank,(()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${i.rank}.`)),T.hu(2===l.rank||1===l.rank,(()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`)),null!=u&&T.hu(2===u.rank||1===u.rank,(()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`)),null!=c&&T.hu(2===c.rank||1===c.rank,(()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`)),dn(o,i,l,c,u,s)}});const hn=(0,Z.op)({batchNorm3d_:function(e,t,n,r,a,s){const o=(0,U._1)(e,"x","batchNorm"),i=(0,U._1)(t,"mean","batchNorm"),l=(0,U._1)(n,"variance","batchNorm");let u,c;return null!=a&&(u=(0,U._1)(a,"scale","batchNorm")),null!=r&&(c=(0,U._1)(r,"offset","batchNorm")),T.hu(3===o.rank,(()=>`Error in batchNorm3D: x must be rank 3 but got rank ${o.rank}.`)),T.hu(3===i.rank||1===i.rank,(()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${i.rank}.`)),T.hu(3===l.rank||1===l.rank,(()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`)),null!=u&&T.hu(3===u.rank||1===u.rank,(()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`)),null!=c&&T.hu(3===c.rank||1===c.rank,(()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`)),dn(o,i,l,c,u,s)}});const fn=(0,Z.op)({batchNorm4d_:function(e,t,n,r,a,s){const o=(0,U._1)(e,"x","batchNorm"),i=(0,U._1)(t,"mean","batchNorm"),l=(0,U._1)(n,"variance","batchNorm");let u,c;return null!=a&&(u=(0,U._1)(a,"scale","batchNorm")),null!=r&&(c=(0,U._1)(r,"offset","batchNorm")),T.hu(4===o.rank,(()=>`Error in batchNorm4D: x must be rank 4 but got rank ${o.rank}.`)),T.hu(4===i.rank||1===i.rank,(()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${i.rank}.`)),T.hu(4===l.rank||1===l.rank,(()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`)),null!=u&&T.hu(4===u.rank||1===u.rank,(()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`)),null!=c&&T.hu(4===c.rank||1===c.rank,(()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`)),dn(o,i,l,c,u,s)}});const mn=(0,Z.op)({bincount_:function(e,t,n){const r=(0,U._1)(e,"x","bincount"),a=(0,U._1)(t,"weights","bincount");T.hu("int32"===r.dtype,(()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`)),T.hu(n>=0,(()=>`size must be non-negative, but got ${n}.`)),T.hu(a.size===r.size||0===a.size,(()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${a.shape}.`));const s={x:r,weights:a},o={size:n};return z.BV.runKernel(H.zvY,s,o)}});const gn=(0,Z.op)({broadcastArgs_:function(e,t){const n=(0,U._1)(e,"s0","broadcastArgs","int32"),r=(0,U._1)(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${n.rank}`);if(1!==r.rank)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${r.rank}`);const a={s0:n,s1:r};return z.BV.runKernel(H.eEB,a)}});var yn=n(8723);const bn=(0,Z.op)({broadcastTo_:function(e,t){let n=(0,U._1)(e,"broadcastTo","x");const r=n.shape;if(t.some((e=>!(e>0)||e%1!=0)))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.length<n.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${n.rank}.`);if(t.length>n.rank){const e=n.shape.slice();for(;e.length<t.length;)e.unshift(1);n=(0,nn.X)(n,e)}const a=n.shape,s=Array.from(t);for(let e=t.length-1;e>=0;e--)if(a[e]===t[e])s[e]=1;else if(1!==n.shape[e])throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${t}].`);if(0===s.map(((e,t)=>e>1?t:-1)).filter((e=>e>=0)).length)return(0,yn.d)(n);const o={x:n},i={reps:s};return z.BV.runKernel(H.n9L,o,i)}});var xn=n(2657);const vn=(0,Z.op)({ceil_:function(e){const t={x:(0,U._1)(e,"x","ceil","float32")};return z.BV.runKernel(H.gJX,t)}});const wn=(0,Z.op)({clipByValue_:function(e,t,n){const r=(0,U._1)(e,"x","clipByValue");if(T.hu(t<=n,(()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`)),t===n)return Nt(r.shape,t,r.dtype);const a={x:r},s={clipValueMin:t,clipValueMax:n};return z.BV.runKernel(H.xnO,a,s)}});const Tn=(0,Z.op)({concat1d_:function(e){return(0,an.z)(e,0)}});const Sn=(0,Z.op)({concat2d_:function(e,t){return(0,an.z)(e,t)}});const An=(0,Z.op)({concat3d_:function(e,t){return(0,an.z)(e,t)}});const Cn=(0,Z.op)({concat4d_:function(e,t){return(0,an.z)(e,t)}});var In=n(4794);const kn=(0,Z.op)({conv1d_:function(e,t,n,r,a="NWC",s=1,o){const i=(0,U._1)(e,"x","conv1d"),l=(0,U._1)(t,"filter","conv1d");let u=i,c=!1;2===i.rank&&(c=!0,u=(0,nn.X)(i,[1,i.shape[0],i.shape[1]])),T.hu(3===u.rank,(()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`)),T.hu(3===l.rank,(()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`)),tn.m("conv1d",r,o),T.hu(u.shape[2]===l.shape[1],(()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`)),T.hu(tn.jT(n,s),(()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`)),T.hu("NWC"===a,(()=>`Error in conv1d: got dataFormat of ${a} but only NWC is currently supported.`));const d=(0,nn.X)(l,[1,l.shape[0],l.shape[1],l.shape[2]]),p=(0,nn.X)(u,[u.shape[0],1,u.shape[1],u.shape[2]]),h=[1,n],f=[1,s],m=(0,In.T)(p,d,h,r,"NHWC",f,o);return c?(0,nn.X)(m,[m.shape[2],m.shape[3]]):(0,nn.X)(m,[m.shape[0],m.shape[2],m.shape[3]])}});var En=n(9832);const Nn=(0,Z.op)({conv2dTranspose_:function(e,t,n,r,a,s){const o=(0,U._1)(e,"x","conv2dTranspose"),i=(0,U._1)(t,"filter","conv2dTranspose");return(0,En._)(n,o,i,r,a,"NHWC",s)}});const Bn=(0,Z.op)({conv3d_:function(e,t,n,r,a="NDHWC",s=[1,1,1]){const o=(0,U._1)(e,"x","conv3d"),i=(0,U._1)(t,"filter","conv3d");let l=o,u=!1;4===o.rank&&(u=!0,l=(0,nn.X)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),T.hu(5===l.rank,(()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`)),T.hu(5===i.rank,(()=>`Error in conv3d: filter must be rank 5, but got rank ${i.rank}.`)),T.hu(l.shape[4]===i.shape[3],(()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${i.shape[3]}.`)),T.hu((0,tn.jT)(n,s),(()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),T.hu("NDHWC"===a,(()=>`Error in conv3d: got dataFormat of ${a} but only NDHWC is currently supported.`));const c={x:l,filter:i},d={strides:n,pad:r,dataFormat:a,dilations:s},p=z.BV.runKernel(H.x12,c,d);return u?(0,nn.X)(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}});const Rn=(0,Z.op)({conv3DBackpropInput_:function(e,t,n,r,a){T.hu(e.length===t.rank,(()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`));let s=e,o=t,i=!1;4===t.rank&&(i=!0,o=(0,nn.X)(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);const l=s[4],u=o.shape[4];T.hu(5===s.length,(()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`)),T.hu(5===o.rank,(()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${o.rank}`)),T.hu(5===n.rank,(()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`)),T.hu(l===n.shape[3],(()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`)),T.hu(u===n.shape[4],(()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`));const c={dy:o,filter:n},d={pad:a,strides:r,inputShape:s},p=z.BV.runKernel(H.ik2,c,d);return i?(0,nn.X)(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}});const Dn=(0,Z.op)({conv3dTranspose_:function(e,t,n,r,a){const s=(0,U._1)(e,"x","conv3dTranspose"),o=(0,U._1)(t,"filter","conv3dTranspose");return Rn(n,s,o,r,a)}});const Mn=(0,Z.op)({cos_:function(e){const t={x:(0,U._1)(e,"x","cos","float32")};return z.BV.runKernel(H.mc4,t)}});const On=(0,Z.op)({cosh_:function(e){const t={x:(0,U._1)(e,"x","cosh","float32")};return z.BV.runKernel(H.TR1,t)}});const Pn=(0,Z.op)({cumprod_:function(e,t=0,n=!1,r=!1){const a={x:(0,U._1)(e,"x","cumprod")},s={axis:t,exclusive:n,reverse:r};return z.BV.runKernel(H.Byc,a,s)}});const $n=(0,Z.op)({cumsum_:function(e,t=0,n=!1,r=!1){const a={x:(0,U._1)(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:r};return z.BV.runKernel(H.iHb,a,s)}});const Fn=(0,Z.op)({denseBincount_:function(e,t,n,r=!1){const a=(0,U._1)(e,"x","denseBincount"),s=(0,U._1)(t,"weights","denseBincount");T.hu("int32"===a.dtype,(()=>`Error in denseBincount: input dtype must be int32, but got ${a.dtype}`)),T.hu(a.rank<=2,(()=>`Error in denseBincount: input must be at most rank 2, but got rank ${a.rank}.`)),T.hu(n>=0,(()=>`size must be non-negative, but got ${n}.`)),T.hu(s.size===a.size||0===s.size,(()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${a.shape}, weights shape: ${s.shape}.`));const o={x:a,weights:s},i={size:n,binaryOutput:r};return z.BV.runKernel(H.QRR,o,i)}});const _n=(0,Z.op)({depthToSpace_:function(e,t,n="NHWC"){const r=(0,U._1)(e,"x","depthToSpace","float32"),a="NHWC"===n?r.shape[1]:r.shape[2],s="NHWC"===n?r.shape[2]:r.shape[3],o="NHWC"===n?r.shape[3]:r.shape[1];T.hu(t>1,(()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`)),T.hu(a*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n ${a} and ${t} for depthToSpace with input shape\n ${r.shape}`)),T.hu(s*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n ${s} and ${t} for depthToSpace with input shape\n ${r.shape}`)),T.hu(o%(t*t)==0,(()=>`Dimension size must be evenly divisible by ${t*t} but is ${o} for depthToSpace with input shape ${r.shape}`));const i={x:r},l={blockSize:t,dataFormat:n};return z.BV.runKernel(H.T0n,i,l)}});var Ln=n(4718);const Vn=(0,Z.op)({diag_:function(e){const t={x:(0,U._1)(e,"x","diag")};return z.BV.runKernel(H.$w,t)}});const Un=(0,Z.op)({dilation2d_:function(e,t,n,r,a=[1,1],s="NHWC"){const o=(0,U._1)(e,"x","dilation2d"),i=(0,U._1)(t,"filter","dilation2d");T.hu(3===o.rank||4===o.rank,(()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${o.rank}.`)),T.hu(3===i.rank,(()=>`Error in dilation2d: filter must be rank 3, but got rank ${i.rank}.`)),T.hu("NHWC"===s,(()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`));let l=o,u=!1;3===o.rank&&(l=(0,nn.X)(o,[1,o.shape[0],o.shape[1],o.shape[2]]),u=!0);const c={x:l,filter:i},d={strides:n,pad:r,dilations:a},p=z.BV.runKernel(H.p4S,c,d);return u?(0,nn.X)(p,[p.shape[1],p.shape[2],p.shape[3]]):p}});const Gn=(0,Z.op)({equal_:function(e,t){let n=(0,U._1)(e,"a","equal","string_or_numeric"),r=(0,U._1)(t,"b","equal","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.hdR,a)}});const Wn=(0,Z.op)({where_:function(e,t,n){const r=(0,U._1)(t,"a","where"),a=(0,U._1)(n,"b","where"),s=(0,U._1)(e,"condition","where","bool"),o=(0,Se.assertAndGetBroadcastShape)((0,Se.assertAndGetBroadcastShape)(s.shape,r.shape),a.shape),i={condition:bn(s,o),t:bn(r,o),e:bn(a,o)};return z.BV.runKernel(H.PhF,i)}});const zn=(0,Z.op)({divNoNan_:function(e,t){let n=(0,U._1)(e,"a","div"),r=(0,U._1)(t,"b","div");[n,r]=(0,K.makeTypesMatch)(n,r);const a=vt(n,r),s=At(a),o=Gn(r,s);return Wn(o,s,a)}});const Hn=(0,Z.op)({dot_:function(e,t){const n=(0,U._1)(e,"t1","dot"),r=(0,U._1)(t,"t2","dot");T.hu(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),(()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`));const a=1===n.rank?n.size:n.shape[1],s=1===r.rank?r.size:r.shape[0];if(T.hu(a===s,(()=>`Error in dot: inner dimensions of inputs must match, but got ${a} and ${s}.`)),1===n.rank&&1===r.rank){const e=(0,nn.X)(n,[1,-1]),t=(0,nn.X)(r,[-1,1]),a=(0,W.O)(e,t);return(0,nn.X)(a,[])}if(1===n.rank&&2===r.rank){const e=(0,nn.X)(n,[1,-1]),t=(0,nn.X)(r,[r.shape[0],r.shape[1]]),a=(0,W.O)(e,t);return(0,nn.X)(a,[a.size])}if(2===n.rank&&1===r.rank){const e=(0,nn.X)(r,[-1,1]),t=(0,W.O)(n,e);return(0,nn.X)(t,[t.size])}{const e=(0,nn.X)(r,[r.shape[0],r.shape[1]]);return(0,W.O)(n,e)}}});const Zn=(0,Z.op)({einsum_:function(e,...t){const n=t.map(((e,t)=>(0,U._1)(e,`tensors${t}`,"einsum"))),r={equation:e};return z.BV.runKernel(H.$g6,n,r)}});var jn=n(3233);const Xn=(0,Z.op)({erf_:function(e){let t=(0,U._1)(e,"x","erf");T.hu("int32"===t.dtype||"float32"===t.dtype,(()=>"Input dtype must be `int32` or `float32`.")),"int32"===t.dtype&&(t=(0,G.p)(t,"float32"));const n={x:t};return z.BV.runKernel(H.Omj,n)}});function Kn(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function qn(e,t,n){const r=e.length+t.length,a=[];let s=0,o=0;for(let i=0;i<r;i++)-1===n.indexOf(i)?a.push(e[s++]):a.push(t[o++]);return a}function Qn(e,t){const n=[],r=e.length;for(let a=0;a<r;a++)-1===t.indexOf(a)&&n.push(e[a]);return[n,t.map((t=>e[t]))]}function Yn(e,t){return qn(e,t.map((e=>1)),t)}function Jn(e,t,n){T.hu(Kn(t,n),(()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`))}function er(e,t){if(Kn(e,t))return null;const n=[];for(let r=0;r<t;++r)-1===e.indexOf(r)&&n.push(r);return e.forEach((e=>n.push(e))),n}function tr(e){return e.map(((e,t)=>[t,e])).sort(((e,t)=>e[1]-t[1])).map((e=>e[0]))}function nr(e,t){const n=[];for(let r=t-e;r<t;++r)n.push(r);return n}var rr=n(3307);const ar=(0,Z.op)({min_:function(e,t=null,n=!1){const r={x:(0,U._1)(e,"x","min")},a={axis:t,keepDims:n};return z.BV.runKernel(H.c17,r,a)}});var sr=n(5475);function or(e,t,n=null){if(0===e.rank)return Ot(e);if(1!==e.rank&&null===n)return or((0,nn.X)(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return(0,sr.S)(Ot(e),n);if(t===1/0)return(0,rr.F)(Ot(e),n);if(t===-1/0)return ar(Ot(e),n);if("euclidean"===t||2===t)return Tt((0,sr.S)(Rt(Ot(e),(0,It.i)(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(n)&&2===n.length){if(1===t)return(0,rr.F)((0,sr.S)(Ot(e),n[0]),n[1]-1);if(t===1/0)return(0,rr.F)((0,sr.S)(Ot(e),n[1]),n[0]);if(t===-1/0)return ar((0,sr.S)(Ot(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return Tt((0,sr.S)(St(e),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}const ir=(0,Z.op)({norm_:function(e,t="euclidean",n=null,r=!1){const a=or(e=(0,U._1)(e,"x","norm"),t,n);let s=a.shape;if(r){const t=(0,T.EC)(n,e.shape);s=Yn(a.shape,t)}return(0,nn.X)(a,s)}});const lr=(0,Z.op)({euclideanNorm_:function(e,t=null,n=!1){return ir(e,"euclidean",t,n)}});const ur=(0,Z.op)({exp_:function(e){const t={x:(0,U._1)(e,"x","exp")};return z.BV.runKernel(H.NEP,t)}});const cr=(0,Z.op)({expandDims_:function(e,t=0){const n=(0,U._1)(e,"x","expandDims","string_or_numeric");T.hu(t<=n.rank,(()=>"Axis must be <= rank of the tensor"));const r={input:n},a={dim:t};return z.BV.runKernel(H.YFo,r,a)}});const dr=(0,Z.op)({expm1_:function(e){const t={x:(0,U._1)(e,"x","expm1")};return z.BV.runKernel(H.Y0y,t)}});const pr=(0,Z.op)({tile_:function(e,t){const n=(0,U._1)(e,"x","tile","string_or_numeric");T.hu(n.rank===t.length,(()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`));const r={x:n},a={reps:t};return z.BV.runKernel(H.n9L,r,a)}});const hr=(0,Z.op)({eye_:function(e,t,n,r="float32"){null==t&&(t=e);const a=(0,xn.f)([e,t],r),s=e<=t?e:t;for(let e=0;e<s;++e)a.set(1,e,e);const o=(0,nn.X)(a.toTensor(),[e,t]);if(null==n)return o;if(1===n.length)return pr(cr(o,0),[n[0],1,1]);if(2===n.length)return pr(cr(cr(o,0),0),[n[0],n[1],1,1]);if(3===n.length)return pr(cr(cr(cr(o,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`)}});const fr=(0,Z.op)({floor_:function(e){const t={x:(0,U._1)(e,"x","floor","float32")};return z.BV.runKernel(H.OR,t)}});const mr=(0,Z.op)({gather_:function(e,t,n=0,r=0){const a={x:(0,U._1)(e,"x","gather"),indices:(0,U._1)(t,"indices","gather","int32")},s={axis:n,batchDims:r};return z.BV.runKernel(H.qi_,a,s)}});const gr=(0,Z.op)({greater_:function(e,t){let n=(0,U._1)(e,"a","greater","string_or_numeric"),r=(0,U._1)(t,"b","greater","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.iZT,a)}});const yr=(0,Z.op)({greaterEqual_:function(e,t){let n=(0,U._1)(e,"a","greaterEqual","string_or_numeric"),r=(0,U._1)(t,"b","greaterEqual","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.Acj,a)}});const br=(0,Z.op)({isFinite_:function(e){const t={x:(0,U._1)(e,"x","isFinite")};return z.BV.runKernel(H.avt,t)}});const xr=(0,Z.op)({isInf_:function(e){const t={x:(0,U._1)(e,"x","isInf")};return z.BV.runKernel(H.iWB,t)}});const vr=(0,Z.op)({isNaN_:function(e){const t={x:(0,U._1)(e,"x","isNaN")};return z.BV.runKernel(H.r7n,t)}});var wr=n(9133);const Tr=(0,Z.op)({less_:function(e,t){let n=(0,U._1)(e,"a","less","string_or_numeric"),r=(0,U._1)(t,"b","less","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.vtC,a)}});const Sr=(0,Z.op)({lessEqual_:function(e,t){let n=(0,U._1)(e,"a","lessEqual","string_or_numeric"),r=(0,U._1)(t,"b","lessEqual","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.CAk,a)}});function Ar(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");const r={start:e,stop:t,num:n};return z.BV.runKernel(H.e7N,{},r)}const Cr=(0,Z.op)({localResponseNormalization_:function(e,t=5,n=1,r=1,a=.5){const s=(0,U._1)(e,"x","localResponseNormalization");T.hu(4===s.rank||3===s.rank,(()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ${s.rank}.`)),T.hu(T.GN(t),(()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`));let o=s,i=!1;3===s.rank&&(i=!0,o=(0,nn.X)(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const l={x:o},u={depthRadius:t,bias:n,alpha:r,beta:a},c=z.BV.runKernel(H.eZ0,l,u);return i?(0,nn.X)(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});const Ir=(0,Z.op)({log_:function(e){const t={x:(0,U._1)(e,"x","log","float32")};return z.BV.runKernel(H.ZbH,t)}});const kr=(0,Z.op)({log1p_:function(e){const t={x:(0,U._1)(e,"x","log1p")};return z.BV.runKernel(H.kU,t)}});const Er=(0,Z.op)({softplus_:function(e){const t={x:(0,U._1)(e,"x","softplus")};return z.BV.runKernel(H.MRv,t)}});const Nr=(0,Z.op)({logSigmoid_:function(e){const t=(0,U._1)(e,"x","logSigmoid"),n=(0,Ct.cb)((e=>({value:xe(Er(xe(e))),gradFunc:t=>(0,wt.d)(t,(0,sn.X)(xe(e)))})));return n(t)}});const Br=(0,Z.op)({logSoftmax_:function(e,t=-1){const n=(0,U._1)(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);const r=(0,Ct.cb)(((e,n)=>{const r=(0,rr.F)(e,t,!0),a=Dt(e,r),s=Dt((0,G.p)(a,"float32"),Ir((0,sr.S)(ur(a),t,!0)));n([s]);return{value:s,gradFunc:(e,n)=>{const[r]=n,a=ur(r);return Dt(e,(0,wt.d)((0,sr.S)(e,t,!0),a))}}}));return r(n)}});const Rr=(0,Z.op)({logSumExp_:function(e,t=null,n=!1){const r=(0,U._1)(e,"x","logSumExp"),a=(0,T.EC)(t,r.shape),s=(0,rr.F)(r,a,!0),o=Dt(r,s),i=ur(o),l=(0,sr.S)(i,a),u=Ir(l),c=(0,bt.I)((0,nn.X)(s,u.shape),u);if(n){const e=Yn(c.shape,a);return(0,nn.X)(c,e)}return c}});const Dr=(0,Z.op)({logicalAnd_:function(e,t){const n=(0,U._1)(e,"a","logicalAnd","bool"),r=(0,U._1)(t,"b","logicalAnd","bool");(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.PYm,a)}});const Mr=(0,Z.op)({logicalNot_:function(e){const t={x:(0,U._1)(e,"x","logicalNot","bool")};return z.BV.runKernel(H.VfG,t)}});const Or=(0,Z.op)({logicalOr_:function(e,t){const n=(0,U._1)(e,"a","logicalOr","bool"),r=(0,U._1)(t,"b","logicalOr","bool");(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.MZg,a)}});const Pr=(0,Z.op)({logicalXor_:function(e,t){const n=(0,U._1)(e,"a","logicalXor","bool"),r=(0,U._1)(t,"b","logicalXor","bool");return(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape),Dr(Or(e,t),Mr(Dr(e,t)))}}),$r=2147483648;const Fr=(0,Z.op)({searchSorted_:function(e,t,n="left"){const r=(0,U._1)(e,"sortedSequence","searchSorted"),a=(0,U._1)(t,"values","searchSorted"),s=r.shape[r.shape.length-1],o=a.shape[a.shape.length-1],i=(0,nn.X)(r,[-1,s]),l=(0,nn.X)(a,[-1,o]);if(i.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(i.shape[0]!==l.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if((0,T.NA)(l.shape)>=$r)throw new Error("values tensor size must less than 2147483648");if(i.shape[1]>=$r)throw new Error(`trailing dim_size must less than 2147483648 for int32 output type, was ${i.shape[1]}`);const u={sortedSequence:i,values:l},c={side:n};return z.BV.runKernel(H.nr8,u,c)}});function _r(e,t){return Fr(e,t,"left")}var Lr=n(1174);const Vr=(0,Z.op)({maxPool3d_:function(e,t=[1,1,1],n,r,a,s="NDHWC"){const o=(0,U._1)(e,"x","maxPool3d");let i=o,l=!1;4===o.rank&&(l=!0,i=(0,nn.X)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),T.hu(5===i.rank,(()=>`Error in maxPool3d: x must be rank 5 but got rank ${i.rank}.`)),T.hu("NDHWC"===s,(()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),(0,tn.m)("maxPool3d",r,a);const u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s},d=z.BV.runKernel(H.OAf,u,c);return l?(0,nn.X)(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}});const Ur=(0,Z.op)({maxPoolWithArgmax_:function(e,t,n,r,a=!1){const s={x:(0,U._1)(e,"x","maxPoolWithArgmax")},o={filterSize:t,strides:n,pad:r,includeBatchInIndex:a},i=z.BV.runKernel(H.vFR,s,o);return{result:i[0],indexes:i[1]}}});var Gr=n(5130);function Wr(e,t="float32"){if("complex64"===t){const t=Wr(e,"float32"),n=Wr(e,"float32");return(0,ye.P)(t,n)}const n=(0,T.wT)((0,T.NA)(e),t);return z.BV.makeTensor(n,e,t)}function zr(e,t="float32"){if("complex64"===t){const t=zr(e,"float32"),n=Wr(e,"float32");return(0,ye.P)(t,n)}const n=(0,T.p8)((0,T.NA)(e),t);return z.BV.makeTensor(n,e,t)}function Hr(e,t,{indexing:n="xy"}={}){if("xy"!==n&&"ij"!==n)throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(void 0===e)return[];let r=(0,U._1)(e,"x","meshgrid",e instanceof X.es?e.dtype:"float32");if(void 0===t)return[r];let a=(0,U._1)(t,"y","meshgrid",t instanceof X.es?t.dtype:"float32");const s=(0,T.NA)(r.shape),o=(0,T.NA)(a.shape);return"xy"===n?(r=(0,nn.X)(r,[1,-1]),a=(0,nn.X)(a,[-1,1]),[(0,W.O)(zr([o,1],r.dtype),r),(0,W.O)(a,zr([1,s],a.dtype))]):(r=(0,nn.X)(r,[-1,1]),a=(0,nn.X)(a,[1,-1]),[(0,W.O)(r,zr([1,o],r.dtype)),(0,W.O)(zr([s,1],a.dtype),a)])}const Zr=(0,Z.op)({minimum_:function(e,t){let n=(0,U._1)(e,"a","minimum"),r=(0,U._1)(t,"b","minimum");[n,r]=(0,K.makeTypesMatch)(n,r),"bool"===n.dtype&&(n=(0,G.p)(n,"int32"),r=(0,G.p)(r,"int32")),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.q8u,a)}});const jr=(0,Z.op)({mirrorPad_:function(e,t,n){T.hu("reflect"===n||"symmetric"===n,(()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`));const r=(0,U._1)(e,"x","mirrorPad");if(0===r.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");T.hu(t.length===r.rank,(()=>`Padding doesn't match input. Must be ${r.rank}. Got ${t.length}.`));const a="reflect"===n?1:0;for(let e=0;e<r.rank;e++)T.hu(2===t[e].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),T.hu(t[e][0]>=0&&t[e][0]<=r.shape[e]-a&&t[e][1]>=0&&t[e][1]<=r.shape[e]-a,(()=>`Padding in dimension ${e} cannot be greater than or equal to ${r.shape[e]-a} or less than 0 for input of shape ${r.shape}`));const s={paddings:t,mode:n},o={x:r};return z.BV.runKernel(H.jQs,o,s)}});const Xr=(0,Z.op)({mod_:function(e,t){let n=(0,U._1)(e,"a","mod"),r=(0,U._1)(t,"b","mod");[n,r]=(0,K.makeTypesMatch)(n,r);const a={a:n,b:r};return z.BV.runKernel(H.Vbg,a)}});const Kr=(0,Z.op)({moments_:function(e,t=null,n=!1){e=(0,U._1)(e,"x","moments");const r=(0,T.EC)(t,e.shape),a=(0,Gr.J)(e,r,n);let s=a.shape;n||(s=Yn(a.shape,r));const o=St(Dt((0,G.p)(e,"float32"),(0,nn.X)(a,s)));return{mean:a,variance:(0,Gr.J)(o,r,n)}}});const qr=(0,Z.op)({multiRNNCell_:function(e,t,n,r){const a=(0,U._1)(t,"data","multiRNNCell"),s=(0,U.sI)(n,"c","multiRNNCell"),o=(0,U.sI)(r,"h","multiRNNCell");let i=a;const l=[];for(let t=0;t<e.length;t++){const n=e[t](i,s[t],o[t]);l.push(n[0]),l.push(n[1]),i=n[1]}const u=[],c=[];for(let e=0;e<l.length;e+=2)u.push(l[e]),c.push(l[e+1]);return[u,c]}});const Qr=(0,Z.op)({multinomial_:function(e,t,n,r=!1){const a=(0,U._1)(e,"logits","multinomial"),s=a.size,o=a.rank;if(s<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${s}.`);if(o>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${o}`);n=n||Math.random();const i={logits:1===o?(0,nn.X)(a,[1,-1]):a},l={numSamples:t,seed:n,normalized:r},u=z.BV.runKernel(H.NZg,i,l);return 1===o?(0,nn.X)(u,[u.size]):u}});const Yr=(0,Z.op)({notEqual_:function(e,t){let n=(0,U._1)(e,"a","notEqual","string_or_numeric"),r=(0,U._1)(t,"b","notEqual","string_or_numeric");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H.yQU,a)}});const Jr=(0,Z.op)({onesLike_:function(e){const t={x:(0,U._1)(e,"x","onesLike")};return z.BV.runKernel(H.qWM,t)}});const ea=(0,Z.op)({outerProduct_:function(e,t){const n=(0,U._1)(e,"v1","outerProduct"),r=(0,U._1)(t,"v2","outerProduct");T.hu(1===n.rank&&1===r.rank,(()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`));const a=(0,nn.X)(n,[-1,1]),s=(0,nn.X)(r,[1,-1]);return(0,W.O)(a,s)}});var ta=n(9682);const na=(0,Z.op)({pad1d_:function(e,t,n=0){return(0,T.hu)(2===t.length,(()=>"Invalid number of paddings. Must be length of 2.")),(0,ta.v)(e,[t],n)}});const ra=(0,Z.op)({pad2d_:function(e,t,n=0){return(0,T.hu)(2===t.length&&2===t[0].length&&2===t[1].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,ta.v)(e,t,n)}});const aa=(0,Z.op)({pad3d_:function(e,t,n=0){return(0,T.hu)(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,ta.v)(e,t,n)}});const sa=(0,Z.op)({pad4d_:function(e,t,n=0){return(0,T.hu)(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,ta.v)(e,t,n)}});const oa=(0,Z.op)({spaceToBatchND_:function(e,t,n){const r=(0,U._1)(e,"x","spaceToBatchND");T.hu(r.rank>=1+t.length,(()=>`input rank ${r.rank} should be > than [blockShape] ${t.length}`)),T.hu(n.length===t.length,(()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`)),T.hu(r.shape.reduce(((e,r,a)=>a>0&&a<=t.length?e&&(r+n[a-1][0]+n[a-1][1])%t[a-1]==0:e),!0),(()=>`input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`));const a={x:r},s={blockShape:t,paddings:n};return z.BV.runKernel(H.TQc,a,s)}});const ia=(0,Z.op)({pool_:function(e,t,n,r,a,s,o){null==a&&(a=[1,1]),null==s&&(s=1),0===r&&(r="valid");const i=(0,U._1)(e,"x","maxPool");let l=i,u=!1;3===i.rank&&(u=!0,l=(0,nn.X)(i,[1,i.shape[0],i.shape[1],i.shape[2]])),T.hu(tn.jT(s,a),(()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${a}'`));const c=tn.Xw(l.shape,t,s,a,r),d=[c.dilationHeight,c.dilationWidth];let p;p="same"===r?function(e,t){const n=e.map(((e,n)=>e+(e-1)*(t[n]-1))).map((e=>e-1)),r=n.map((e=>Math.floor(e/2))),a=n.map(((e,t)=>e-r[t]));return n.map(((e,t)=>[r[t],a[t]]))}([c.filterHeight,c.filterWidth],d):[[0,0],[0,0]];const h=1===d[0]&&1===d[1],[f,m]=function(e,t,n){const r=n.map((e=>e[0])),a=n.map((e=>e[1])),s=e.concat(r,a),o=t.map(((e,t)=>(e-s[t]%e)%e)),i=a.map(((e,t)=>e+o[t])),l=t.map(((e,t)=>[r[t],i[t]])),u=t.map(((e,t)=>[0,o[t]]));return[l,u]}([c.inHeight,c.inWidth],d,p),g=h?r:"valid",y=h?l:oa(l,d,f),b=("avg"===n?()=>(0,en.w)(y,t,s,g,o):()=>(0,Lr._)(y,t,s,g,o))(),x=h?b:cn(b,d,m);return u?(0,nn.X)(x,[x.shape[1],x.shape[2],x.shape[3]]):x}});var la=n(8151),ua=n(9798);const ca=(0,Z.op)({prod_:function(e,t=null,n=!1){let r=(0,U._1)(e,"x","prod");"bool"===r.dtype&&(r=(0,G.p)(r,"int32"));const a={x:r},s={axis:t,keepDims:n};return z.BV.runKernel(H.DlI,a,s)}});const da=(0,Z.op)({raggedGather_:function(e,t,n,r){const a={paramsNestedSplits:e.map(((e,t)=>(0,U._1)(e,`tensors${t}`,"raggedGather","int32"))),paramsDenseValues:(0,U._1)(t,"paramsDenseValues","raggedGather"),indices:(0,U._1)(n,"indices","raggedGather","int32")},s={outputRaggedRank:r},o=z.BV.runKernel(H.dDz,a,s);return{outputNestedSplits:o.slice(0,o.length-1),outputDenseValues:o[o.length-1]}}});const pa=(0,Z.op)({raggedTensorToTensor_:function(e,t,n,r,a){const s=(0,U._1)(e,"shape","raggedTensorToTensor","int32"),o=(0,U._1)(t,"values","raggedTensorToTensor"),i={shape:s,values:o,defaultValue:(0,U._1)(n,"defaultValue","raggedTensorToTensor",o.dtype),rowPartitionTensors:r.map(((e,t)=>(0,U._1)(e,`tensors${t}`,"raggedTensorToTensor","int32")))},l={rowPartitionTypes:a};return z.BV.runKernel(H.BiW,i,l)}});const ha=(0,Z.op)({rand_:function(e,t,n){const r=(0,T.NA)(e);let a=null;if(null==n||"float32"===n)a=new Float32Array(r);else if("int32"===n)a=new Int32Array(r);else{if("bool"!==n)throw new Error(`Unknown data type ${n}`);a=new Uint8Array(r)}for(let e=0;e<r;e++)a[e]=t();return z.BV.makeTensor(a,e,n)}});var fa=n(6377);class ma{constructor(e,t,n,r,a){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);const s=a||Math.random();this.random=fa.alea(s.toString())}nextValue(){if(!isNaN(this.nextVal)){const e=this.nextVal;return this.nextVal=NaN,e}let e,t,n=!1;for(;!n;){let r,a,s;do{r=2*this.random()-1,a=2*this.random()-1,s=r*r+a*a}while(s>=1||0===s);const o=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*r*o,t=this.mean+this.stdDev*a*o,this.truncated&&!this.isValidTruncated(e)||(n=!0)}return this.truncated&&!this.isValidTruncated(t)||(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class ga{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;const a=r||Math.random();this.randu=fa.alea(a.toString()),this.randn=new ma(0,1,n,!1,this.randu()),this.d=e<1?e+2/3:e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,a,s;for(;;){do{r=this.randn.nextValue(),s=1+this.c*r}while(s<=0);if(s*=s*s,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),a=this.randu(),a<t||Math.log(a)<n)break}return s=1/this.beta*this.d*s,this.alpha<1&&(s*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(s)}convertValue(e){return"float32"===this.dtype?e:Math.round(e)}}class ya{constructor(e=0,t=1,n,r){if(this.canReturnFloat=()=>null==this.dtype||"float32"===this.dtype,this.min=e,this.range=t-e,this.dtype=n,null==r&&(r=Math.random()),"number"==typeof r&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=fa.alea(r)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}const ba=(0,Z.op)({randomGamma_:function(e,t,n=1,r="float32",a){if(null==n&&(n=1),null==r&&(r="float32"),"float32"!==r&&"int32"!==r)throw new Error(`Unsupported data type ${r}`);const s=new ga(t,n,r,a),o=(0,xn.f)(e,r);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});const xa=(0,Z.op)({randomNormal_:function(e,t=0,n=1,r,a){if(null!=r&&"bool"===r)throw new Error(`Unsupported data type ${r}`);const s=new ma(t,n,r,!1,a),o=(0,xn.f)(e,r);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});const va=(0,Z.op)({randomStandardNormal_:function(e,t,n){if(null!=t&&"bool"===t)throw new Error(`Unsupported data type ${t}`);return xa(e,0,1,t,n)}});const wa=(0,Z.op)({randomUniform_:function(e,t=0,n=1,r="float32",a){const s=(0,xn.f)(e,r),o=new ya(t,n,null,a);for(let e=0;e<s.values.length;e++)s.values[e]=o.nextValue();return s.toTensor()}});function Ta(e,t,n=1,r="float32"){if(0===n)throw new Error("Cannot have a step of zero");const a={start:e,stop:t,step:n,dtype:r};return z.BV.runKernel(H.e6w,{},a)}const Sa=(0,Z.op)({reciprocal_:function(e){const t={x:(0,U._1)(e,"x","reciprocal")};return z.BV.runKernel(H.$HU,t)}});var Aa=n(7409),Ca=n(3582);const Ia=(0,Z.op)({reverse_:function(e,t){const n={x:(0,U._1)(e,"x","reverse")},r={dims:t};return z.BV.runKernel(H.mKl,n,r)}});const ka=(0,Z.op)({reverse1d_:function(e){const t=(0,U._1)(e,"x","reverse");return T.hu(1===t.rank,(()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`)),Ia(t,0)}});const Ea=(0,Z.op)({reverse2d_:function(e,t){const n=(0,U._1)(e,"x","reverse");return T.hu(2===n.rank,(()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`)),Ia(n,t)}});const Na=(0,Z.op)({reverse3d_:function(e,t){const n=(0,U._1)(e,"x","reverse");return T.hu(3===n.rank,(()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`)),Ia(n,t)}});const Ba=(0,Z.op)({reverse4d_:function(e,t){const n=(0,U._1)(e,"x","reverse");return T.hu(4===n.rank,(()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`)),Ia(n,t)}});const Ra=(0,Z.op)({round_:function(e){const t={x:(0,U._1)(e,"x","round")};return z.BV.runKernel(H.e07,t)}});const Da=(0,Z.op)({rsqrt_:function(e){const t={x:(0,U._1)(e,"x","rsqrt","float32")};return z.BV.runKernel(H.bV0,t)}});const Ma=(0,Z.op)({selu_:function(e){const t={x:(0,U._1)(e,"x","selu")};return z.BV.runKernel(H.oFR,t)}});const Oa=(0,Z.op)({separableConv2d_:function(e,t,n,r,a,s=[1,1],o="NHWC"){const i=(0,U._1)(e,"x","separableConv2d"),l=(0,U._1)(t,"depthwiseFilter","separableConv2d"),u=(0,U._1)(n,"pointwiseFilter","separableConv2d");let c=i,d=!1;if(3===i.rank&&(d=!0,c=(0,nn.X)(i,[1,i.shape[0],i.shape[1],i.shape[2]])),"NCHW"===o)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");T.hu(4===c.rank,(()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`)),T.hu(4===l.rank,(()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`)),T.hu(4===u.rank,(()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`)),T.hu(1===u.shape[0],(()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${u.shape[0]}.`)),T.hu(1===u.shape[1],(()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`));const p=l.shape[2],h=l.shape[3];T.hu(u.shape[2]===p*h,(()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${p*h}, but got ${u.shape[2]}.`));const f=(0,Ln.B)(c,l,r,a,o,s),m=(0,In.T)(f,u,1,"valid",o);return d?(0,nn.X)(m,[m.shape[1],m.shape[2],m.shape[3]]):m}});const Pa=async function(e,t){const n=(0,U._1)(e,"x","setdiff1d"),r=(0,U._1)(t,"y","setdiff1d");T.hu(n.dtype===r.dtype,(()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`)),T.hu(1===n.rank,(()=>`x should be 1D tensor, but got x (${n.shape}).`)),T.hu(1===r.rank,(()=>`y should be 1D tensor, but got y (${r.shape}).`));const a=await n.data(),s=await r.data(),o=new Set(s);let i=0;for(let e=0;e<a.length;e++)o.has(a[e])||i++;const l=new X.YD([i],n.dtype),u=new X.YD([i],"int32");for(let e=0,t=0;e<a.length;e++)o.has(a[e])||(l.values[t]=a[e],u.values[t]=e,t++);return[l.toTensor(),u.toTensor()]};const $a=(0,Z.op)({sign_:function(e){const t={x:(0,U._1)(e,"x","sign")};return z.BV.runKernel(H.i5y,t)}});const Fa=(0,Z.op)({sin_:function(e){const t={x:(0,U._1)(e,"x","sin","float32")};return z.BV.runKernel(H.RQH,t)}});const _a=(0,Z.op)({sinh_:function(e){const t={x:(0,U._1)(e,"x","sinh")};return z.BV.runKernel(H.wYB,t)}});const La=(0,Z.op)({slice1d_:function(e,t,n){const r=(0,U._1)(e,"x","slice1d");return T.hu(1===r.rank,(()=>`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`)),on(r,[t],[n])}});const Va=(0,Z.op)({slice2d_:function(e,t,n){const r=(0,U._1)(e,"x","slice2d");return T.hu(2===r.rank,(()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`)),on(r,t,n)}});const Ua=(0,Z.op)({slice3d_:function(e,t,n){const r=(0,U._1)(e,"x","slice3d");return T.hu(3===r.rank,(()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`)),on(r,t,n)}});const Ga=(0,Z.op)({slice4d_:function(e,t,n){const r=(0,U._1)(e,"x","slice4d");return T.hu(4===r.rank,(()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`)),on(r,t,n)}});var Wa=n(682);const za=(0,Z.op)({fft_:function(e){(0,T.hu)("complex64"===e.dtype,(()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`));const t={input:e};return z.BV.runKernel(H.vwp,t)}});const Ha=(0,Z.op)({ifft_:function(e){(0,T.hu)("complex64"===e.dtype,(()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`));const t={input:e};return z.BV.runKernel(H.Qg5,t)}});const Za=(0,Z.op)({irfft_:function(e){const t=e.shape[e.shape.length-1],n=e.size/t;let r;if(t<=2){const a=(0,nn.X)(e,[n,t]);r=Ha(a)}else{const a=[n,2*(t-1)],s=(0,nn.X)(ve(e),[n,t]),o=(0,nn.X)(be(e),[n,t]),i=Ia(on(s,[0,1],[n,t-2]),1),l=(0,wt.d)(Ia(on(o,[0,1],[n,t-2]),1),(0,It.i)(-1)),u=(0,an.z)([s,i],1),c=(0,an.z)([o,l],1),d=(0,nn.X)((0,ye.P)(u,c),[a[0],a[1]]);r=Ha(d)}if(r=ve(r),3===e.rank&&0!==e.shape[0]){const t=r,n=e.shape[0];r=(0,nn.X)(r,[n,r.shape[0]/n,r.shape[1]]),t.dispose()}return r}});const ja=(0,Z.op)({split_:function(e,t,n=0){const r={x:(0,U._1)(e,"x","split")},a={numOrSizeSplits:t,axis:n};return z.BV.runKernel(H.L8s,r,a)}});const Xa=(0,Z.op)({rfft_:function(e,t){(0,T.hu)("float32"===e.dtype,(()=>`The dtype for rfft() must be real value but got ${e.dtype}`));let n=e.shape[e.shape.length-1];const r=e.size/n;let a;if(null!=t&&t<n){const r=e.shape.map((e=>0)),s=e.shape.map((e=>e));s[e.shape.length-1]=t,a=on(e,r,s),n=t}else if(null!=t&&t>n){const r=e.shape.map((e=>e));r[e.shape.length-1]=t-n,a=(0,an.z)([e,Wr(r)],e.shape.length-1),n=t}else a=e;const s=At(a),o=(0,nn.X)((0,ye.P)(a,s),[r,n]),i=za(o),l=Math.floor(n/2)+1,u=ve(i),c=be(i),d=ja(u,[l,n-l],u.shape.length-1),p=ja(c,[l,n-l],c.shape.length-1),h=a.shape.slice();return h[a.shape.length-1]=l,(0,nn.X)((0,ye.P)(d[0],p[0]),h)}});const Ka=(0,Z.op)({squaredDifference_:function(e,t){let n=(0,U._1)(e,"a","squaredDifference"),r=(0,U._1)(t,"b","squaredDifference");[n,r]=(0,K.makeTypesMatch)(n,r),(0,Se.assertAndGetBroadcastShape)(n.shape,r.shape);const a={a:n,b:r};return z.BV.runKernel(H._tC,a,{})}});var qa=n(9590),Qa=n(2991),Ya=n(1901),Ja=n(5158);const es=(0,Z.op)({tan_:function(e){const t={x:(0,U._1)(e,"x","tan","float32")};return z.BV.runKernel(H.sEM,t)}});var ts=n(701),ns=n(6092);function rs(e,t,n){if((0,T.Cq)(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");const r=(0,U.C)(e,n);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return(0,Ce.H)(e,t,r,n)}function as(e,t,n){if((0,T.Cq)(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");const r=(0,U.C)(e,n);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return(0,Ce.H)(e,t,r,n)}function ss(e,t,n){if((0,T.Cq)(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");const r=(0,U.C)(e,n);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return(0,Ce.H)(e,t,r,n)}function os(e,t,n){if((0,T.Cq)(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");const r=(0,U.C)(e,n);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||r,(0,Ce.H)(e,t,r,n)}const is=(0,Z.op)({topk_:function(e,t=1,n=!0){const r=(0,U._1)(e,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");const a=r.shape[r.shape.length-1];if(t<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);if(t>a)throw new Error(`'k' passed to topk() must be <= the last dimension (${a}) but got ${t}`);const s={x:r},o={k:t,sorted:n},[i,l]=z.BV.runKernel(H.cWu,s,o);return{values:i,indices:l}}});const ls=(0,Z.op)({truncatedNormal_:function(e,t=0,n=1,r,a){if(null!=r&&"bool"===r)throw new Error("Unsupported data type $ { dtype }");const s=new ma(t,n,r,!0,a),o=(0,xn.f)(e,r);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});const us=(0,Z.op)({unique_:function(e,t=0){const n=(0,U._1)(e,"x","unique","string_or_numeric");(0,T.hu)(n.rank>0,(()=>"The input tensor must be at least 1D"));const r={x:n},a={axis:t},[s,o]=z.BV.runKernel(H.kpP,r,a);return{values:s,indices:o}}});const cs=(0,Z.op)({unsortedSegmentSum_:function(e,t,n){const r=(0,U._1)(e,"x","unsortedSegmentSum"),a=(0,U._1)(t,"segmentIds","unsortedSegmentSum","int32");(0,T.hu)((0,T.GN)(n),(()=>"numSegments must be of dtype int"));const s={x:r,segmentIds:a},o={numSegments:n};return z.BV.runKernel(H.Qvg,s,o)}});const ds=(0,Z.op)({unstack_:function(e,t=0){const n=(0,U._1)(e,"x","unstack","string_or_numeric");T.hu(t>=-n.shape.length&&t<n.shape.length,(()=>`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`));const r={value:n},a={axis:t};return z.BV.runKernel(H.ToN,r,a)}});function ps(e,t){return Fr(e,t,"right")}function hs(e,t=!0,n,r){return z.BV.makeVariable(e,t,n,r)}function fs(e,t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(e);const r=(0,xn.f)(e,"int32"),a=(0,xn.f)([n.length,e.length],"int32");for(let t=0;t<n.length;t++){const s=r.indexToLoc(n[t]),o=t*e.length;a.values.set(s,o)}return a.toTensor()}const ms=async function(e){const t=(0,U._1)(e,"condition","whereAsync","bool"),n=await t.data(),r=fs(t.shape,n);return e!==t&&t.dispose(),r};const gs=async function(e,t,n){const r=(0,U._1)(e,"tensor","boolMask"),a=(0,U._1)(t,"mask","boolMask","bool"),s=null==n?0:n,o=a.rank,i=r.shape;T.hu(o>0,(()=>"mask cannot be scalar")),T.k5(i.slice(s,s+o),a.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let e=s;e<s+o;e++)l*=i[e];const u=i.slice(0,s).concat([l],i.slice(s+o)),c=(0,nn.X)(r,u),d=(0,nn.X)(a,[-1]),p=await ms(d),h=(0,qa.L)(p,[1]),f=mr(c,h,s);return e!==r&&r.dispose(),t!==a&&a.dispose(),h.dispose(),c.dispose(),d.dispose(),p.dispose(),f};const ys=(0,Z.op)({movingAverage_:function(e,t,n,r,a=!0){const s=(0,U._1)(e,"v","movingAverage"),o=(0,U._1)(t,"x","movingAverage"),i=(0,U._1)(n,"decay","movingAverage");(0,K.assertTypesMatch)(s,o),T.hu(T.cO(s.shape,o.shape),(()=>"Shape mismatch in v and x"));const l=(0,It.i)(1),u=Dt(l,i);let c=(0,wt.d)(Dt(o,s),u);if(a){T.hu(null!=r,(()=>"When using zeroDebias: true, step is required."));const e=(0,U._1)(r,"step","movingAverage");c=vt(c,Dt(l,Rt(i,e)))}return(0,bt.I)(s,c)}});const bs=(0,Z.op)({scatterND_:function(e,t,n){const r=(0,U._1)(e,"indices","scatterND","int32"),a=(0,U._1)(t,"updates","scatterND");Pe(a,r,n);const s={indices:r,updates:a},o={shape:n};return z.BV.runKernel(H.xQA,s,o)}});const xs=(0,Z.op)({sparseToDense_:function(e,t,n,r=0){const a=(0,U._1)(e,"sparseIndices","sparseToDense","int32"),s=(0,U._1)(t,"sparseValues","sparseToDense","string_or_numeric"),o=(0,U._1)(r,"defaultValue","sparseToDense",s.dtype);!function(e,t,n,r){if("int32"!==e.dtype)throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);const a=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);const o=t.size;if(0!==t.rank&&(1!==t.rank||o!==a))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${a}]`);if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(a,s,n,o);const i={sparseIndices:a,sparseValues:s,defaultValue:o},l={outputShape:n};return z.BV.runKernel(H.D2d,i,l)}});const vs=(0,Z.op)({gatherND_:function(e,t){const n=(0,U._1)(t,"indices","gatherND","int32"),r={params:(0,U._1)(e,"x","gatherND","string_or_numeric"),indices:n};return z.BV.runKernel(H.q1x,r)}});const ws=(0,Z.op)({dropout_:function(e,t,n,r){const a=(0,U._1)(e,"x","dropout");if(T.hu("float32"===a.dtype,(()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${a.dtype} tensor instead.`)),T.hu(t>=0&&t<1,(()=>`rate must be a float in the range [0, 1), but got ${t}.`)),0===t)return e instanceof X.es?a.clone():a;const s=function(e,t){if(null==t)return e.shape.slice();if(T.cO(e.shape,t))return t;if(e.shape.length===t.length){const n=[];for(let r=0;r<e.shape.length;r++)null==t[r]&&null!=e.shape[r]?n.push(e.shape[r]):n.push(t[r]);return n}return t}(a,n),o=1-t,i=vt(fr((0,bt.I)(wa(s,0,1,"float32",r),o)),o);return(0,wt.d)(a,i)}});function Ts(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function Ss(e,t,n){const r=1-e%2,a=new Float32Array(e);for(let s=0;s<e;++s){const o=2*Math.PI*s/(e+r-1);a[s]=t-n*Math.cos(o)}return(0,ns.R)(a,"float32")}const As=async function(e,t,n=1){const r=(0,U._1)(e,"predictions","inTopK"),a=(0,U._1)(t,"targets","inTopK");(0,T.hu)(r.rank>1,(()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${r.rank}`)),(0,T.hu)(r.rank-1===a.rank,(()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${r.rank} and targets rank ${a.rank}`)),(0,T.k5)(r.shape.slice(0,r.shape.length-1),a.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const s=r.shape[r.shape.length-1];(0,T.hu)(n>0&&n<=s,(()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`));const o=await r.data(),i=await a.data(),[l,u]=[o.length/s,s],c=(0,T.WP)("bool",l);for(let e=0;e<l;e++){const t=e*u,r=o.subarray(t,t+u),a=[];for(let e=0;e<r.length;e++)a.push({value:r[e],index:e});a.sort(((e,t)=>t.value-e.value)),c[e]=0;for(let t=0;t<n;t++)if(a[t].index===i[e]){c[e]=1;break}}return e!==r&&r.dispose(),t!==a&&a.dispose(),(0,ts.X)(c,a.shape,"bool")};var Cs=n(8810),Is=n(59),ks=n(5901);const Es=(0,Z.op)({hammingWindow_:function(e){return Ss(e,.54,.46)}});const Ns=(0,Z.op)({hannWindow_:function(e){return Ss(e,.5,.5)}});const Bs=(0,Z.op)({frame_:function(e,t,n,r=!1,a=0){let s=0;const o=[];for(;s+t<=e.size;)o.push(on(e,s,t)),s+=n;if(r)for(;s<e.size;){const r=s+t-e.size,i=(0,an.z)([on(e,s,t-r),Nt([r],a)]);o.push(i),s+=n}return 0===o.length?rs([],[0,t]):(0,nn.X)((0,an.z)(o),[o.length,t])}});const Rs=(0,Z.op)({stft_:function(e,t,n,r,a=Ns){null==r&&(r=Ts(t));const s=Bs(e,t,n),o=(0,wt.d)(s,a(t));return Xa(o,r)}});const Ds=(0,Z.op)({cropAndResize_:function(e,t,n,r,a="bilinear",s=0){const o=(0,U._1)(e,"image","cropAndResize"),i=(0,U._1)(t,"boxes","cropAndResize","float32"),l=(0,U._1)(n,"boxInd","cropAndResize","int32"),u=i.shape[0];T.hu(4===o.rank,(()=>`Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`)),T.hu(2===i.rank&&4===i.shape[1],(()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${i.shape}.`)),T.hu(1===l.rank&&l.shape[0]===u,(()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${i.shape}.`)),T.hu(2===r.length,(()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`)),T.hu(r[0]>=1&&r[1]>=1,(()=>`cropSize must be atleast [1,1], but was ${r}`)),T.hu("bilinear"===a||"nearest"===a,(()=>`method must be bilinear or nearest, but was ${a}`));const c={image:o,boxes:i,boxInd:l},d={method:a,extrapolationValue:s,cropSize:r};return z.BV.runKernel(H.VcC,c,d)}});const Ms=(0,Z.op)({flipLeftRight_:function(e){const t=(0,U._1)(e,"image","flipLeftRight","float32");T.hu(4===t.rank,(()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`));const n={image:t};return z.BV.runKernel(H.Uyb,n,{})}});const Os=(0,Z.op)({grayscaleToRGB_:function(e){const t=(0,U._1)(e,"image","grayscaleToRGB"),n=t.rank-1,r=t.shape[n];T.hu(t.rank>=2,(()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`)),T.hu(1===r,(()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${r}.`));const a=new Array(t.rank);return a.fill(1,0,n),a[n]=3,pr(t,a)}});const Ps=(0,Z.op)({rotateWithOffset_:function(e,t,n=0,r=.5){const a=(0,U._1)(e,"image","rotateWithOffset","float32");T.hu(4===a.rank,(()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${a.rank}.`));const s={image:a},o={radians:t,fillValue:n,center:r};return z.BV.runKernel(H.b9H,s,o)}});function $s(e,t,n,r,a,s){null==r&&(r=.5),null==a&&(a=Number.NEGATIVE_INFINITY),null==s&&(s=0);const o=e.shape[0];return n=Math.min(n,o),T.hu(0<=r&&r<=1,(()=>`iouThreshold must be in [0, 1], but was '${r}'`)),T.hu(2===e.rank,(()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`)),T.hu(4===e.shape[1],(()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`)),T.hu(1===t.rank,(()=>"scores must be a 1D tensor")),T.hu(t.shape[0]===o,(()=>`scores has incompatible shape with boxes. Expected ${o}, but was ${t.shape[0]}`)),T.hu(0<=s&&s<=1,(()=>`softNmsSigma must be in [0, 1], but was '${s}'`)),{maxOutputSize:n,iouThreshold:r,scoreThreshold:a,softNmsSigma:s}}const Fs=(0,Z.op)({nonMaxSuppression_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=(0,U._1)(e,"boxes","nonMaxSuppression","float32"),o=(0,U._1)(t,"scores","nonMaxSuppression","float32"),i=$s(s,o,n,r,a),l={maxOutputSize:n=i.maxOutputSize,iouThreshold:r=i.iouThreshold,scoreThreshold:a=i.scoreThreshold};return z.BV.runKernel(H.uv1,{boxes:s,scores:o},l)}});function _s(e,t,n){const r=function(e,t,n){return function(e,t,n){let r=0,a=e.length,s=0,o=!1;for(;r<a;){s=r+(a-r>>>1);const i=n(t,e[s]);i>0?r=s+1:(a=s,o=!i)}return o?r:-r-1}(e,t,n||Ls)}(e,t,n),a=r<0?-(r+1):r;e.splice(a,0,t)}function Ls(e,t){return e>t?1:e<t?-1:0}function Vs(e,t,n,r,a){return Ws(e,t,n,r,a,0)}function Us(e,t,n,r,a,s){return Ws(e,t,n,r,a,0,!1,s,!0)}function Gs(e,t,n,r,a,s){return Ws(e,t,n,r,a,s,!0)}function Ws(e,t,n,r,a,s,o=!1,i=!1,l=!1){const u=[];for(let e=0;e<t.length;e++)t[e]>a&&u.push({score:t[e],boxIndex:e,suppressBeginIndex:0});u.sort(Zs);const c=s>0?-.5/s:0,d=[],p=[];for(;d.length<n&&u.length>0;){const t=u.pop(),{score:n,boxIndex:s,suppressBeginIndex:o}=t;if(n<a)break;let i=!1;for(let n=d.length-1;n>=o;--n){const o=zs(e,s,d[n]);if(o>=r){i=!0;break}if(t.score=t.score*Hs(r,c,o),t.score<=a)break}t.suppressBeginIndex=d.length,i||(t.score===n?(d.push(s),p.push(t.score)):t.score>a&&_s(u,t,Zs))}const h=d.length,f=n-h;i&&f>0&&(d.push(...new Array(f).fill(0)),p.push(...new Array(f).fill(0)));const m={selectedIndices:d};return o&&(m.selectedScores=p),l&&(m.validOutputs=h),m}function zs(e,t,n){const r=e.subarray(4*t,4*t+4),a=e.subarray(4*n,4*n+4),s=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),i=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(a[0],a[2]),c=Math.min(a[1],a[3]),d=Math.max(a[0],a[2]),p=Math.max(a[1],a[3]),h=(i-s)*(l-o),f=(d-u)*(p-c);if(h<=0||f<=0)return 0;const m=Math.max(s,u),g=Math.max(o,c),y=Math.min(i,d),b=Math.min(l,p),x=Math.max(y-m,0)*Math.max(b-g,0);return x/(h+f-x)}function Hs(e,t,n){const r=Math.exp(t*n*n);return n<=e?r:0}function Zs(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}const js=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=(0,U._1)(e,"boxes","nonMaxSuppressionAsync"),o=(0,U._1)(t,"scores","nonMaxSuppressionAsync"),i=$s(s,o,n,r,a);n=i.maxOutputSize,r=i.iouThreshold,a=i.scoreThreshold;const l=await Promise.all([s.data(),o.data()]),u=l[0],c=l[1],{selectedIndices:d}=Vs(u,c,n,r,a);return s!==e&&s.dispose(),o!==t&&o.dispose(),(0,ns.R)(d,"int32")};const Xs=(0,Z.op)({nonMaxSuppressionWithScore_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const o=(0,U._1)(e,"boxes","nonMaxSuppression"),i=(0,U._1)(t,"scores","nonMaxSuppression"),l=$s(o,i,n,r,a,s),u={boxes:o,scores:i},c={maxOutputSize:n=l.maxOutputSize,iouThreshold:r=l.iouThreshold,scoreThreshold:a=l.scoreThreshold,softNmsSigma:s=l.softNmsSigma},d=z.BV.runKernel(H.W0H,u,c);return{selectedIndices:d[0],selectedScores:d[1]}}});const Ks=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const o=(0,U._1)(e,"boxes","nonMaxSuppressionAsync"),i=(0,U._1)(t,"scores","nonMaxSuppressionAsync"),l=$s(o,i,n,r,a,s);n=l.maxOutputSize,r=l.iouThreshold,a=l.scoreThreshold,s=l.softNmsSigma;const u=await Promise.all([o.data(),i.data()]),c=u[0],d=u[1],{selectedIndices:p,selectedScores:h}=Gs(c,d,n,r,a,s);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:(0,ns.R)(p,"int32"),selectedScores:(0,ns.R)(h)}};const qs=(0,Z.op)({nonMaxSuppressionPadded_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const o=(0,U._1)(e,"boxes","nonMaxSuppression"),i=(0,U._1)(t,"scores","nonMaxSuppression"),l=$s(o,i,n,r,a,null),u={boxes:o,scores:i},c={maxOutputSize:l.maxOutputSize,iouThreshold:l.iouThreshold,scoreThreshold:l.scoreThreshold,padToMaxOutputSize:s},d=z.BV.runKernel(H.cye,u,c);return{selectedIndices:d[0],validOutputs:d[1]}}});const Qs=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const o=(0,U._1)(e,"boxes","nonMaxSuppressionAsync"),i=(0,U._1)(t,"scores","nonMaxSuppressionAsync"),l=$s(o,i,n,r,a,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,[p,h]=await Promise.all([o.data(),i.data()]),{selectedIndices:f,validOutputs:m}=Us(p,h,u,c,d,s);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:(0,ns.R)(f,"int32"),validOutputs:(0,It.i)(m,"int32")}};const Ys=(0,Z.op)({resizeBilinear_:function(e,t,n=!1,r=!1){const a=(0,U._1)(e,"images","resizeBilinear");T.hu(3===a.rank||4===a.rank,(()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`)),T.hu(2===t.length,(()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`)),T.hu(!1===r||!1===n,(()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false."));let s=a,o=!1;3===a.rank&&(o=!0,s=(0,nn.X)(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const[]=t,i={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=z.BV.runKernel(H._Yw,i,l);return o?(0,nn.X)(u,[u.shape[1],u.shape[2],u.shape[3]]):u}});const Js=(0,Z.op)({resizeNearestNeighbor_:function(e,t,n=!1,r=!1){const a=(0,U._1)(e,"images","resizeNearestNeighbor");T.hu(3===a.rank||4===a.rank,(()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`)),T.hu(2===t.length,(()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`)),T.hu("float32"===a.dtype||"int32"===a.dtype,(()=>"`images` must have `int32` or `float32` as dtype")),T.hu(!1===r||!1===n,(()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false."));let s=a,o=!1;3===a.rank&&(o=!0,s=(0,nn.X)(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const[]=t,i={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=z.BV.runKernel(H.dpD,i,l);return o?(0,nn.X)(u,[u.shape[1],u.shape[2],u.shape[3]]):u}});const eo=(0,Z.op)({threshold_:function(e,t="binary",n=!1,r=.5){const a=(0,U._1)(e,"image","threshold"),s=a.shape[0]*a.shape[1];let o,i,l,u,c=(0,wt.d)((0,ns.R)([r]),255);if(T.hu(3===a.rank,(()=>`Error in threshold: image must be rank 3,but got rank ${a.rank}.`)),T.hu(3===a.shape[2]||1===a.shape[2],(()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${a.shape[2]}.`)),T.hu("int32"===a.dtype||"float32"===a.dtype,(()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${a.dtype}.`)),T.hu("otsu"===t||"binary"===t,(()=>`Method must be binary or otsu, but was ${t}`)),3===a.shape[2]){[o,i,l]=ja(a,[1,1,1],-1);const e=(0,wt.d)(o,.2989),t=(0,wt.d)(i,.587),n=(0,wt.d)(l,.114);u=(0,bt.I)((0,bt.I)(e,t),n)}else u=e;if("otsu"===t){c=function(e,t){let n,r,a,s,o,i,l=(0,ns.R)([-1]),u=(0,ns.R)([0]),c=(0,ns.R)([0]);for(let d=0;d<e.size-1;d++){n=on(e,0,d+1),r=on(e,d+1),o=vt((0,sr.S)(n),t),i=vt((0,sr.S)(r),t);const p=(0,sr.S)((0,wt.d)(n,Ta(0,n.size)));a=vt(p,(0,sr.S)(n));const h=Nt(r.shape,n.size),f=(0,bt.I)(Ta(0,r.size),h),m=(0,wt.d)(r,f);s=vt((0,sr.S)(m),(0,sr.S)(r));const g=Dt(a,s),y=Dt(a,s),b=(0,wt.d)(o,i);c=(0,wt.d)((0,wt.d)(b,g),y);const x=gr(c,u);u=Wn(x,c,u),l=Wn(x,(0,ns.R)([d]),l)}return l}(mn((0,G.p)(Ra(u),"int32"),(0,ts.X)([]),256),s)}const d=n?Sr(u,c):gr(u,c);return(0,G.p)((0,wt.d)(d,255),"int32")}});const to=(0,Z.op)({transform_:function(e,t,n="nearest",r="constant",a=0,s){const o=(0,U._1)(e,"image","transform","float32"),i=(0,U._1)(t,"transforms","transform","float32");T.hu(4===o.rank,(()=>`Error in transform: image must be rank 4,but got rank ${o.rank}.`)),T.hu(2===i.rank&&(i.shape[0]===o.shape[0]||1===i.shape[0])&&8===i.shape[1],(()=>"Error in transform: Input transform should be batch x 8 or 1 x 8")),T.hu(null==s||2===s.length,(()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`));const l={image:o,transforms:i},u={interpolation:n,fillMode:r,fillValue:a,outputShape:s};return z.BV.runKernel(H.wx7,l,u)}});const no=(0,Z.op)({bandPart_:function(e,t,n){(0,T.hu)(t%1==0,(()=>`bandPart(): numLower must be an integer, got ${t}.`)),(0,T.hu)(n%1==0,(()=>`bandPart(): numUpper must be an integer, got ${n}.`));const r=(0,U._1)(e,"a","bandPart");(0,T.hu)(r.rank>=2,(()=>`bandPart(): Rank must be at least 2, got ${r.rank}.`));const a=r.shape,[s,o]=r.shape.slice(-2);if(!(t<=s))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`);if(!(n<=o))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`);t<0&&(t=s),n<0&&(n=o);const i=(0,nn.X)(Ta(0,s,1,"int32"),[-1,1]),l=Ta(0,o,1,"int32"),u=Dt(i,l),c=Dr(Sr(u,(0,It.i)(+t,"int32")),yr(u,(0,It.i)(-n,"int32"))),d=Wr([s,o],r.dtype);return(0,nn.X)((0,Qa.k)(ds((0,nn.X)(r,[-1,s,o])).map((e=>Wn(c,e,d)))),a)}});const ro=(0,Z.op)({gramSchmidt_:function(e){let t;if(Array.isArray(e)){t=!1,(0,T.hu)(null!=e&&e.length>0,(()=>"Gram-Schmidt process: input must not be null, undefined, or empty"));const n=e[0].shape[0];for(let t=1;t<e.length;++t)(0,T.hu)(e[t].shape[0]===n,(()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[t].shape[0]} vs. ${n})`))}else t=!0,e=ja(e,e.shape[0],0).map((e=>(0,qa.L)(e,[0])));(0,T.hu)(e.length<=e[0].shape[0],(()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`));const n=[],r=e;for(let t=0;t<e.length;++t)n.push(z.BV.tidy((()=>{let e=r[t];if(t>0)for(let r=0;r<t;++r){const t=(0,wt.d)((0,sr.S)((0,wt.d)(n[r],e)),n[r]);e=Dt(e,t)}return vt(e,ir(e,"euclidean"))})));return t?(0,Qa.k)(n,0):n}});function ao(e,t=!1){return z.BV.tidy((()=>{(0,T.hu)(2===e.shape.length,(()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`));const n=e.shape[0],r=e.shape[1];let a=hr(n),s=(0,yn.d)(e);const o=rs([[1]],[1,1]);let i=(0,yn.d)(o);const l=n>=r?r:n;for(let e=0;e<l;++e){const t=s,l=i,u=a;[i,s,a]=z.BV.tidy((()=>{const t=on(s,[e,e],[n-e,1]),l=ir(t),u=on(s,[e,e],[1,1]),c=Wn(gr(u,0),rs([[-1]]),rs([[1]])),d=Dt(u,(0,wt.d)(c,l)),p=vt(t,d);i=1===p.shape[0]?(0,yn.d)(o):(0,an.z)([o,on(p,[1,0],[p.shape[0]-1,p.shape[1]])],0);const h=xe(vt((0,W.O)(c,d),l)),f=on(s,[e,0],[n-e,r]),m=(0,wt.d)(h,i),g=we(i);if(0===e)s=Dt(f,(0,W.O)(m,(0,W.O)(g,f)));else{const t=Dt(f,(0,W.O)(m,(0,W.O)(g,f)));s=(0,an.z)([on(s,[0,0],[e,r]),t],0)}const y=we(m),b=on(a,[0,e],[n,a.shape[1]-e]);if(0===e)a=Dt(b,(0,W.O)((0,W.O)(b,i),y));else{const t=Dt(b,(0,W.O)((0,W.O)(b,i),y));a=(0,an.z)([on(a,[0,0],[n,e]),t],1)}return[i,s,a]})),se([t,l,u])}return!t&&n>r&&(a=on(a,[0,0],[n,r]),s=on(s,[0,0],[r,r])),[a,s]}))}const so=(0,Z.op)({qr_:function(e,t=!1){if((0,T.hu)(e.rank>=2,(()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`)),2===e.rank)return ao(e,t);{const n=e.shape.slice(0,e.shape.length-2).reduce(((e,t)=>e*t)),r=ds((0,nn.X)(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],s=[];r.forEach((e=>{const[n,r]=ao(e,t);a.push(n),s.push(r)}));return[(0,nn.X)((0,Qa.k)(a,0),e.shape),(0,nn.X)((0,Qa.k)(s,0),e.shape)]}}});var oo;!function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(oo||(oo={}));const io=(0,Z.op)({computeWeightedLoss_:function(e,t,n=oo.SUM_BY_NONZERO_WEIGHTS){const r=(0,U._1)(e,"losses","computeWeightedLoss");let a=null;null!=t&&(a=(0,U._1)(t,"weights","computeWeightedLoss"));const s=null==a?r:(0,wt.d)(r,a);if(n===oo.NONE)return s;if(n===oo.SUM)return(0,sr.S)(s);if(n===oo.MEAN){if(null==a)return(0,Gr.J)(s);{const e=r.size/a.size,t=vt((0,sr.S)(s),(0,sr.S)(a));return e>1?vt(t,(0,It.i)(e)):t}}if(n===oo.SUM_BY_NONZERO_WEIGHTS){if(null==a)return vt((0,sr.S)(s),(0,It.i)(r.size));{const e=(0,wt.d)(a,zr(r.shape)),t=(0,G.p)((0,sr.S)(Yr(e,(0,It.i)(0))),"float32");return vt((0,sr.S)(s),t)}}throw Error(`Unknown reduction: ${n}`)}});const lo=(0,Z.op)({absoluteDifference_:function(e,t,n,r=oo.SUM_BY_NONZERO_WEIGHTS){const a=(0,U._1)(e,"labels","absoluteDifference"),s=(0,U._1)(t,"predictions","absoluteDifference");let o=null;null!=n&&(o=(0,U._1)(n,"weights","absoluteDifference")),(0,T.k5)(a.shape,s.shape,"Error in absoluteDifference: ");const i=Ot(Dt(a,s));return io(i,o,r)}});const uo=(0,Z.op)({cosineDistance_:function(e,t,n,r,a=oo.SUM_BY_NONZERO_WEIGHTS){const s=(0,U._1)(e,"labels","cosineDistance"),o=(0,U._1)(t,"predictions","cosineDistance");let i=null;null!=r&&(i=(0,U._1)(r,"weights","cosineDistance")),(0,T.k5)(s.shape,o.shape,"Error in cosineDistance: ");const l=(0,It.i)(1),u=Dt(l,(0,sr.S)((0,wt.d)(s,o),n,!0));return io(u,i,a)}});const co=(0,Z.op)({hingeLoss_:function(e,t,n,r=oo.SUM_BY_NONZERO_WEIGHTS){let a=(0,U._1)(e,"labels","hingeLoss");const s=(0,U._1)(t,"predictions","hingeLoss");let o=null;null!=n&&(o=(0,U._1)(n,"weights","hingeLoss")),(0,T.k5)(a.shape,s.shape,"Error in hingeLoss: ");const i=(0,It.i)(1);a=Dt((0,wt.d)((0,It.i)(2),a),i);const l=(0,Aa.U)(Dt(i,(0,wt.d)(a,s)));return io(l,o,r)}});const po=(0,Z.op)({huberLoss_:function(e,t,n,r=1,a=oo.SUM_BY_NONZERO_WEIGHTS){const s=(0,U._1)(e,"labels","huberLoss"),o=(0,U._1)(t,"predictions","huberLoss");let i=null;null!=n&&(i=(0,U._1)(n,"weights","huberLoss")),(0,T.k5)(s.shape,o.shape,"Error in huberLoss: ");const l=(0,It.i)(r),u=Ot(Dt(o,s)),c=Zr(u,l),d=Dt(u,c),p=(0,bt.I)((0,wt.d)((0,It.i)(.5),St(c)),(0,wt.d)(l,d));return io(p,i,a)}});const ho=(0,Z.op)({logLoss_:function(e,t,n,r=1e-7,a=oo.SUM_BY_NONZERO_WEIGHTS){const s=(0,U._1)(e,"labels","logLoss"),o=(0,U._1)(t,"predictions","logLoss");let i=null;null!=n&&(i=(0,U._1)(n,"weights","logLoss")),(0,T.k5)(s.shape,o.shape,"Error in logLoss: ");const l=(0,It.i)(1),u=(0,It.i)(r),c=xe((0,wt.d)(s,Ir((0,bt.I)(o,u)))),d=(0,wt.d)(Dt(l,s),Ir((0,bt.I)(Dt(l,o),u))),p=Dt(c,d);return io(p,i,a)}});const fo=(0,Z.op)({meanSquaredError_:function(e,t,n,r=oo.SUM_BY_NONZERO_WEIGHTS){const a=(0,U._1)(e,"labels","meanSquaredError"),s=(0,U._1)(t,"predictions","meanSquaredError");let o=null;null!=n&&(o=(0,U._1)(n,"weights","meanSquaredError")),(0,T.k5)(a.shape,s.shape,"Error in meanSquaredError: ");const i=Ka(a,s);return io(i,o,r)}});const mo=(0,Z.op)({sigmoidCrossEntropy_:function(e,t,n,r=0,a=oo.SUM_BY_NONZERO_WEIGHTS){let s=(0,U._1)(e,"multiClassLabels","sigmoidCrossEntropy");const o=(0,U._1)(t,"logits","sigmoidCrossEntropy");let i=null;if(null!=n&&(i=(0,U._1)(n,"weights","sigmoidCrossEntropy")),(0,T.k5)(s.shape,o.shape,"Error in sigmoidCrossEntropy: "),r>0){const e=(0,It.i)(r),t=(0,It.i)(1),n=(0,It.i)(.5);s=(0,bt.I)((0,wt.d)(s,Dt(t,e)),(0,wt.d)(n,e))}const l=function(e,t){const n=(0,U._1)(e,"labels","sigmoidCrossEntropyWithLogits"),r=(0,U._1)(t,"logits","sigmoidCrossEntropyWithLogits");(0,T.k5)(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");const a=(0,Aa.U)(r),s=(0,wt.d)(r,n),o=kr(ur(xe(Ot(r))));return(0,bt.I)(Dt(a,s),o)}(s,o);return io(l,i,a)}});const go=(0,Z.op)({softmaxCrossEntropy_:function(e,t,n,r=0,a=oo.SUM_BY_NONZERO_WEIGHTS){let s=(0,U._1)(e,"onehotLabels","softmaxCrossEntropy");const o=(0,U._1)(t,"logits","softmaxCrossEntropy");let i=null;if(null!=n&&(i=(0,U._1)(n,"weights","softmaxCrossEntropy")),(0,T.k5)(s.shape,o.shape,"Error in softmaxCrossEntropy: "),r>0){const e=(0,It.i)(r),t=(0,It.i)(1),n=(0,It.i)(s.shape[1]);s=(0,bt.I)((0,wt.d)(s,Dt(t,e)),vt(e,n))}const l=function(e,t,n=-1){if(-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);const r=(0,Ct.cb)(((e,t,r)=>{const a=Rr(t,[n],!0),s=Dt((0,G.p)(t,"float32"),a);r([e,s]);const o=xe((0,wt.d)(s,e));return{value:(0,sr.S)(o,[n]),gradFunc:(e,t)=>{const[r,a]=t,s=Yn(e.shape,[n]);return[(0,wt.d)((0,nn.X)(e,s),Dt((0,G.p)(r,"float32"),ur(a))),(0,wt.d)((0,nn.X)(e,s),Dt(ur(a),(0,G.p)(r,"float32")))]}}}));return r(e,t)}(s,o);return io(l,i,a)}});const yo=(0,Z.op)({sparseFillEmptyRows_:function(e,t,n,r){const a=(0,U._1)(e,"indices","sparseFillEmptyRows","int32"),s=(0,U._1)(t,"values","sparseFillEmptyRows"),o=(0,U._1)(n,"denseShape","sparseFillEmptyRows","int32"),i=(0,U._1)(r,"defaultValue","sparseFillEmptyRows",s.dtype);if(2!==a.rank)throw new Error(`Indices should be Tensor2D but received shape\n ${a.shape}`);if(1!==s.rank)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(1!==o.rank)throw new Error(`Dense shape should be Tensor1D but received shape ${o.shape}`);if(0!==i.rank)throw new Error(`Default value should be a scalar but received shape ${i.shape}`);const l={indices:a,values:s,denseShape:o,defaultValue:i},u=z.BV.runKernel(H.O3z,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}});const bo=(0,Z.op)({sparseReshape_:function(e,t,n){const r=(0,U._1)(e,"inputIndices","sparseReshape","int32"),a=(0,U._1)(t,"inputShape","sparseReshape","int32"),s=(0,U._1)(n,"newShape","sparseReshape","int32");if(2!==r.rank)throw new Error(`Input indices should be Tensor2D but received shape\n ${r.shape}`);if(1!==a.rank)throw new Error(`Input shape should be Tensor1D but received shape ${a.shape}`);if(1!==s.rank)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);const o={inputIndices:r,inputShape:a,newShape:s},i=z.BV.runKernel(H.nhH,o);return{outputIndices:i[0],outputShape:i[1]}}});const xo=(0,Z.op)({sparseSegmentMean_:function(e,t,n){const r=(0,U._1)(e,"data","sparseSegmentMean"),a=(0,U._1)(t,"indices","sparseSegmentMean","int32"),s=(0,U._1)(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error(`Indices should be Tensor1D but received shape\n ${a.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n ${s.shape}`);const o={data:r,indices:a,segmentIds:s};return z.BV.runKernel(H.w3H,o)}});const vo=(0,Z.op)({sparseSegmentSum_:function(e,t,n){const r=(0,U._1)(e,"data","sparseSegmentSum"),a=(0,U._1)(t,"indices","sparseSegmentSum","int32"),s=(0,U._1)(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error(`Indices should be Tensor1D but received shape\n ${a.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n ${s.shape}`);const o={data:r,indices:a,segmentIds:s};return z.BV.runKernel(H.ZjV,o)}});const wo=(0,Z.op)({stringNGrams_:function(e,t,n,r,a,s,o,i){const l=(0,U._1)(e,"data","stringNGrams","string");if("string"!==l.dtype)throw new Error("Data must be of datatype string");if(1!==l.shape.length)throw new Error(`Data must be a vector, saw: ${l.shape}`);const u=(0,U._1)(t,"dataSplits","stringNGrams");if("int32"!==u.dtype)throw new Error("Data splits must be of datatype int32");const c={separator:n,nGramWidths:r,leftPad:a,rightPad:s,padWidth:o,preserveShortSequences:i},d={data:l,dataSplits:u},p=z.BV.runKernel(H._JP,d,c);return{nGrams:p[0],nGramsSplits:p[1]}}});const To=(0,Z.op)({stringSplit_:function(e,t,n=!0){const r=(0,U._1)(e,"input","stringSplit","string"),a=(0,U._1)(t,"delimiter","stringSplit","string");if(1!==r.rank)throw new Error(`Input should be Tensor1D but received shape ${r.shape}`);if(0!==a.rank)throw new Error(`Delimiter should be a scalar but received shape ${a.shape}`);const s={skipEmpty:n},o={input:r,delimiter:a},i=z.BV.runKernel(H.s1s,o,s);return{indices:i[0],values:i[1],shape:i[2]}}});const So=(0,Z.op)({stringToHashBucketFast_:function(e,t){const n=(0,U._1)(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");const a={input:n};return z.BV.runKernel(H.XkS,a,r)}}),Ao={fft:za,ifft:Ha,rfft:Xa,irfft:Za},Co={hammingWindow:Es,hannWindow:Ns,frame:Bs,stft:Rs},Io={flipLeftRight:Ms,grayscaleToRGB:Os,resizeNearestNeighbor:Js,resizeBilinear:Ys,rotateWithOffset:Ps,cropAndResize:Ds,nonMaxSuppression:Fs,nonMaxSuppressionAsync:js,nonMaxSuppressionWithScore:Xs,nonMaxSuppressionWithScoreAsync:Ks,nonMaxSuppressionPadded:qs,nonMaxSuppressionPaddedAsync:Qs,threshold:eo,transform:to},ko={bandPart:no,gramSchmidt:ro,qr:so},Eo={absoluteDifference:lo,computeWeightedLoss:io,cosineDistance:uo,hingeLoss:co,huberLoss:po,logLoss:ho,meanSquaredError:fo,sigmoidCrossEntropy:mo,softmaxCrossEntropy:go},No={sparseFillEmptyRows:yo,sparseReshape:bo,sparseSegmentMean:xo,sparseSegmentSum:vo},Bo={stringNGrams:wo,stringSplit:To,stringToHashBucketFast:So},Ro={sgd:Vt.sgd,momentum:Vt.momentum,adadelta:Vt.adadelta,adagrad:Vt.adagrad,rmsprop:Vt.rmsprop,adamax:Vt.adamax,adam:Vt.adam},Do="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:e=>e();function Mo(){return new Promise((e=>Do((()=>e()))))}function Oo(e,t){const n=e[0].length;e.forEach(((e,t)=>{T.hu(e.length===n,(()=>`Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`))})),T.hu(t>=0&&t<n,(()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`));const r=e[0];e.forEach(((e,a)=>{for(let s=0;s<n;s++)T.hu(s===t||e[s]===r[s],(()=>`Error in concat${n}D: Shape of tensors[${a}] (${e}) does not match the shape of the rest (${r}) along the non-concatenated axis ${a}.`))}))}function Po(e,t){const n=e[0].slice();for(let r=1;r<e.length;r++)n[t]+=e[r][t];return n}var $o,Fo=n(9323);function _o(e,t,n){let r=new Array;if(null==n&&null==t)return r;if(null==t)for(;r.length<e+n.length;)r.push(-1);else r=t.slice();if(null==n)return r;if(e+n.length!==r.length)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e+n.length}, but shape.rank = ${r.length}`);for(let a=1;a<n.length;++a){const s=n[a],o=r[r.length-n.length+a],i=r[o];if(s>=0)if(i>=0){if(i!==s)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${a+e}] = ${s} but shape[${a+e}] = ${i}`)}else r[o]=s}return r}function Lo(e){const t={FIRST_DIM_SIZE:$o.FIRST_DIM_SIZE,VALUE_ROWIDS:$o.VALUE_ROWIDS,ROW_LENGTHS:$o.ROW_LENGTHS,ROW_SPLITS:$o.ROW_SPLITS,ROW_LIMITS:$o.ROW_LIMITS,ROW_STARTS:$o.ROW_STARTS},n=[];for(const r of e){if(!(r in t))break;n.push(t[r])}return n}function Vo(e){return 0===e.length?0:e[0]===$o.FIRST_DIM_SIZE?e.length-1:e.length}function Uo(e,t){if(null==e||null==t)return;const n=e.length,r=t.length;if(n>=r)throw new Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${r})`);for(let a=0;a<Math.min(n,r-1);++a){const n=e[a],r=t[a+1];if(n>=0&&r>=0&&1!==n&&n!==r)throw new Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${a-e.length}] = ${n} but ragged tensor input.flatValues.shape[${a-e.length}] = ${r}`)}}!function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"}($o||($o={}));const Go=30;function Wo(e){return e<=Go?e:(0,T.jP)(e,Math.floor(Math.sqrt(e)))}function zo(e,t,n){return[n*("number"==typeof e?e:e[0]),t*("number"==typeof e?e:e[1])]}function Ho(e,t,n,r=!0){let a=[];if(r)a=a.concat(t.slice(0)),a.push(e[0]/n),a=a.concat(e.slice(1));else{a=a.concat(e[0]);const n=t.length;for(let r=0;r<n;++r)a=a.concat([e[r+1]/t[r],t[r]]);a=a.concat(e.slice(n+1))}return a}function Zo(e,t,n=!0){const r=[];if(n){r.push(t);for(let n=t+1;n<e;++n)n<=2*t?(r.push(n),r.push(n-(t+1))):r.push(n)}else{const n=[],a=[];for(let r=1;r<e;++r)r>=2*t+1||r%2==1?a.push(r):n.push(r);r.push(...n),r.push(0),r.push(...a)}return r}function jo(e,t,n,r=!0){const a=[];r?a.push(e[0]/n):a.push(e[0]*n);for(let n=1;n<e.length;++n)n<=t.length?r?a.push(t[n-1]*e[n]):a.push(e[n]/t[n-1]):a.push(e[n]);return a}function Xo(e,t){const n=[0];for(let r=0;r<t;++r)n.push(e[r][0]);return n}function Ko(e,t,n){const r=e.slice(0,1);for(let a=0;a<n;++a)r.push(e[a+1]-t[a][0]-t[a][1]);return r}const qo=1.7580993408473768,Qo=1.0507009873554805,Yo=.3275911,Jo=.254829592,ei=-.284496736,ti=1.421413741,ni=-1.453152027,ri=1.061405429;var ai=n(4706);function si(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${t.length}.`);const n=new Float32Array(2*e.length);for(let r=0;r<n.length;r+=2)n[r]=e[r/2],n[r+1]=t[r/2];return n}function oi(e){const t=new Float32Array(e.length/2),n=new Float32Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=e[r],n[r/2]=e[r+1];return{real:t,imag:n}}function ii(e){const t=Math.ceil(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let t=0;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],r[Math.floor(t/4)]=e[t+1];return{real:n,imag:r}}function li(e){const t=Math.floor(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let t=2;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],r[Math.floor(t/4)]=e[t+1];return{real:n,imag:r}}function ui(e,t){return{real:e[2*t],imag:e[2*t+1]}}function ci(e,t,n,r){e[2*r]=t,e[2*r+1]=n}function di(e,t){const n=new Float32Array(e/2),r=new Float32Array(e/2);for(let a=0;a<Math.ceil(e/2);a++){const s=(t?2:-2)*Math.PI*(a/e);n[a]=Math.cos(s),r[a]=Math.sin(s)}return{real:n,imag:r}}function pi(e,t,n){const r=(n?2:-2)*Math.PI*(e/t);return{real:Math.cos(r),imag:Math.sin(r)}}const hi="->",fi=/->/g;function mi(e,t){const n=((e=e.replace(/\s/g,"")).length-e.replace(fi,"").length)/hi.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error('Equation must contain exactly one arrow ("->").');const[r,a]=e.split(hi);(0,T.hu)(-1===r.indexOf("..."),(()=>'The ellipsis notation ("...") is not supported yet.'));const s=r.split(","),o=s.length;if(t!==o)throw new Error(`Expected ${o} input tensors, received ${t}`);if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const i=[];for(let e=0;e<a.length;++e){const t=a[e];if(!s.some((e=>-1!==e.indexOf(t))))throw new Error(`Output subscripts contain the label ${t} not present in the input subscripts.`);-1===i.indexOf(t)&&i.push(t)}for(let e=0;e<r.length;++e){const t=r[e];-1===i.indexOf(t)&&","!==t&&i.push(t)}const l=new Array(s.length);for(let e=0;e<o;++e){if(new Set(s[e].split("")).size!==s[e].length)throw new Error(`Found duplicate axes in input component ${s[e]}. Support for duplicate axes in input is not implemented yet.`);l[e]=[];for(let t=0;t<s[e].length;++t)l[e].push(i.indexOf(s[e][t]))}const u=i.length,c=[];for(let e=a.length;e<u;++e)c.push(e);return{allDims:i,summedDims:c,idDims:l}}function gi(e,t){let n=new Array(e);n.fill(-1);for(let e=0;e<t.length;++e)n[t[e]]=e;const r=[];for(let t=0;t<e;++t)-1===n[t]&&r.push(t);return n=n.filter((e=>-1!==e)),{permutationIndices:n,expandDims:r}}function yi(e,t,n){const r=new Array(e);for(let e=0;e<n.length;++e){const a=n[e].shape;for(let n=0;n<t[e].length;++n)void 0===r[t[e][n]]?r[t[e][n]]=a[n]:(0,T.hu)(r[t[e][n]]===a[n],(()=>`Expected dimension ${r[t[e][n]]} at axis ${n} of input shaped ${JSON.stringify(a)}, but got dimension ${a[n]}`))}}function bi(e,t){const n=e,r=[];let a=0;0===e.length&&n.push(-1),a=e.length+1;for(let e=0;e<a;++e)r.push([]);const s=[];for(let e=0;e<n.length;++e){const a=vi(t,n[e]);for(const t of a)-1===s.indexOf(t)&&(r[e].push(t),s.push(t))}return{path:n,steps:r}}function xi(e){return e.every(((e,t)=>e===t))}function vi(e,t){const n=[];for(let r=0;r<e.length;++r)0!==e[r].length&&-1===e[r].indexOf(t)&&-1!==t||n.push(r);return n}function wi(e,t,n=0){let r=[];if("number"==typeof t)(0,T.hu)(e.shape[n]%t==0,(()=>"Number of splits must evenly divide the axis.")),r=new Array(t).fill(e.shape[n]/t);else{const a=t.reduce(((e,t)=>(-1===t&&(e+=1),e)),0);(0,T.hu)(a<=1,(()=>"There should be only one negative value in split array."));const s=t.indexOf(-1);if(-1!==s){const r=t.reduce(((e,t)=>t>0?e+t:e));t[s]=e.shape[n]-r}(0,T.hu)(e.shape[n]===t.reduce(((e,t)=>e+t)),(()=>"The sum of sizes must match the size of the axis dimension.")),r=t}return r}function Ti(e){return`Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ${e}`}function Si(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function Ai(e,t,n){return`indices(${e}, 0) is invalid: ${t} >= ${n}`}function Ci(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function Ii(e,t){return`size ${e} must be non-negative, not ${t}`}function ki(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function Ei(e,t){return`Input to reshape is a SparseTensor with ${(0,T.NA)(e)}\n dense values, but the requested shape requires a multiple of ${(0,T.NA)(t)}. inputShape=${e} outputShape= ${t}`}function Ni(e,t){return`Input to reshape is a tensor with ${(0,T.NA)(e)} dense values, but the requested shape has ${(0,T.NA)(t)}. inputShape=${e} outputShape=${t}`}function Bi(){return"segment ids must be >= 0"}function Ri(){return"segment ids are not increasing"}function Di(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function Mi(e,t,n){return`Bad: indices[${e}] == ${t} out of range [0, ${n})`}function Oi(e,t){let n,r=!1;for(e<=Go?(n=e,r=!0):n=(0,T.jP)(e,Math.floor(Math.sqrt(e)));!r;)n>t||n===e?r=!0:n=(0,T.jP)(e,n+1);return n}function Pi(e,t,n){const r=[],a=e.length;for(let s=0;s<a;s++)s!==t?r.push(e[s]):r.push(n);return r}function $i(e,t,n,r){const a=t.shape.length,s=e.shape.length;if(0!==r&&(r<-a||r>a))throw new Error(`Expect batchDims in the range of [-${a}, ${a}], but got ${r}`);if(r<0&&(r+=a),r>s)throw new Error(`batchDims (${r}) must be less than rank(x) (\n ${s}).`);if(n<r)throw new Error(`batchDims (${r}) must be less than or equal to axis (${n}).`);for(let n=0;n<r;++n)if(e.shape[n]!==t.shape[n])throw new Error(`x.shape[${n}]: ${e.shape[n]} should be equal to indices.shape[${n}]: ${t.shape[n]}.`);const o=e.shape[n],i=[];let l=1,u=1,c=1;for(let t=0;t<r;++t)i.push(e.shape[t]),l*=e.shape[t];for(let t=r;t<n;t++)i.push(e.shape[t]),u*=e.shape[t];for(let e=r;e<a;e++)i.push(t.shape[e]);for(let t=n+1;t<s;t++)i.push(e.shape[t]),c*=e.shape[t];return{batchSize:l,sliceSize:c,outerSize:u,dimSize:o,outputShape:i}}function Fi(e){try{return e.map((e=>(0,rt.decodeString)(e)))}catch(e){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`)}}function _i(e){return e.map((e=>(0,rt.encodeString)(e)))}var Li=n(5999),Vi=n(8713)},5186:(e,t,n)=>{var r=n(7097),a=(n(9998),n(2885)),s=n(1044),o=n(8209),i=n(780);class l{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){window&&(0,a.OB)().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(e=>{if(e.source===window&&e.data.name===this.messageName){e.stopPropagation();(0,this.functionRefs[e.data.index])(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}}),!0))):setTimeout(e,t)}}if((0,a.OB)().get("IS_BROWSER")){(0,a.OB)().setPlatform("browser",new l);try{i.xQ.registerManager(o.Ew.URL_SCHEME,new o.JL)}catch(e){}try{i.xQ.registerManager(s.ns.URL_SCHEME,new s.y$)}catch(e){}}var u=n(4155);const c=()=>n(5410);let d;class p{constructor(){this.util=n(8628),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=(0,a.OB)().global.fetch?(0,a.OB)().global.fetch(e,t):(null==d&&(d=c()),d(e,t))}now(){const e=u.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}}(0,a.OB)().get("IS_NODE")&&!(0,a.OB)().get("IS_BROWSER")&&(0,a.OB)().setPlatform("node",new p);var h=n(2657),f=n(2271),m=n(8723),g=n(9798),y=n(4077);(0,r.wv)();const b={buffer:h.f,cast:f.p,clone:m.d,print:g.S};(0,y.Vp)(b)},5999:(e,t,n)=>{let r;function a(e){r=e}function s(e){if(void 0!==r)return r;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){const t=e;return t.userAgentData&&t.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function o(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}n.r(t),n.d(t,{isBrowser:()=>o,isMobile:()=>s,mockIsMobile:()=>a})},7097:(e,t,n)=>{n.d(t,{BV:()=>v,wv:()=>x});var r=n(8713),a=n(2885),s=n(5938),o=n(9121),i=n(6151),l=n(4706),u=n(9122),c=n(569);class d{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new h)}profileKernel(e,t,n){let r;const s=()=>{r=n()};let o;const i=u.now();if(this.backendTimer.timerAvailable())o=this.backendTimer.time(s);else{s();for(const e of r)e.dataSync();o=Promise.resolve({kernelMs:u.now()-i})}if((0,a.OB)().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let t=0;t<r.length;t++){const n=r[t];n.data().then((t=>{p(t,n.dtype,e)}))}return{kernelName:e,outputs:r,inputs:t,timeMs:o.then((e=>e.kernelMs)),extraInfo:o.then((e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""))}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:r,inputs:a,extraInfo:s}=e;n.forEach((e=>{Promise.all([e.data(),r,s]).then((n=>{this.logger.logKernelProfile(t,e,n[0],n[1],a,n[2])}))}))}}function p(e,t,n){if("float32"!==t)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(isNaN(r)||!isFinite(r))return console.warn(`Found ${r} in the result of '${n}'`),!0}return!1}class h{logKernelProfile(e,t,n,r,a,s){const o="number"==typeof r?c.oj(`${r}ms`,9):r.error,i=c.oj(e,25),l=t.rank,u=t.size,d=c.oj(t.shape.toString(),14);let p="";for(const e in a){const n=a[e];if(null!=n){const r=n.shape||t.shape,a=r.length;p+=`${e}: ${a}D ${a>0?r:""} `}}console.log(`%c${i}\t%c${o}\t%c${l}D ${d}\t%c${u}\t%c${p}\t%c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}var f=n(4077),m=n(747);function g(e){return null!=e.kernelName}class y{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((e=>e.name))))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class b{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new y}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then((()=>{}));if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void await this.setBackend(n)}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t,n=1){return e in this.registryFactory?(l.Z(`${e} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new d(this.backendInstance),!0}setupRegisteredKernels(){(0,i.tr)(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){(0,i.tr)(e).forEach((t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])}))}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const n=t.factory();if(!n||n instanceof r.Zu||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,r=n.then((n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0))).catch((n=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,l.Z(`Initialization of backend ${e} failed`),l.Z(n.stack||n.message)),!1)));return this.pendingBackendInit=r,{success:r,asyncInit:!0}}}catch(t){return l.Z(`Initialization of backend ${e} failed`),l.Z(t.stack||t.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority))}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:r,asyncInit:a}=this.initializeBackend(n);if(a||r)return{name:n,asyncInit:a}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),r=n.backend,a=this.readSync(t),s=r.refCount(t);r.disposeData(t,!0),n.backend=e,e.move(t,a,n.shape,n.dtype,s),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,r=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=e}return this.scopedRun((()=>this.startScope(r)),(()=>this.endScope(n)),(()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n)))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(e){throw t(),e}}nextTensorId(){return b.nextTensorId++}nextVariableId(){return b.nextVariableId++}clone(e){const t=v.runKernel(o.iJz,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],(e=>({x:()=>{const t={x:e},n={dtype:"float32"};return v.runKernel(o.RFZ,t,n)}})),[],{}),t}runKernel(e,t,n){null==this.backendName&&this.backend;if(!(null!=(0,i.pI)(e,this.backendName)))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const r=this.backend.numDataIds();let a=0;n.forEach((e=>{a+="complex64"===e.dtype?3:1}));const s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-t-a-s;if(o>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${o} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[];const r=this.isTapeOn(),a=this.state.numBytes,s=this.state.numTensors;let o,l;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;const u=g(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(g(e)){const{kernelName:t,inputs:a,attrs:s}=e;null==this.backendName&&this.backend;const u=(0,i.pI)(t,this.backendName);c.hu(null!=u,(()=>`Cannot find registered kernel '${t}' for backend '${this.backendName}'`)),o=()=>{const e=this.backend.numDataIds();l=u.kernelFunc({inputs:a,attrs:s,backend:this.backend});const o=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,o);const i=o.map((e=>null!=e.rank?e:this.makeTensorFromTensorInfo(e)));if(r){const e=this.getTensorsForGradient(t,a,i);n=this.saveTensorsForBackwardMode(e)}return i}}else{const{forwardFunc:t}=e,a=e=>{r&&(n=e.map((e=>this.keep(this.clone(e)))))};o=()=>{const e=this.backend.numDataIds();l=this.tidy((()=>t(this.backend,a)));const n=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(u,e,n),n}}const{inputs:d,attrs:p}=e,h=g(e)?null:e.backwardsFunc;let f;return this.scopedRun((()=>this.state.kernelDepth++),(()=>this.state.kernelDepth--),(()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(f=this.profiler.profileKernel(u,d,(()=>o())),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),t=f.outputs):t=o()})),r&&this.addTapeNode(u,d,t,h,n,p),this.state.profiling&&this.state.activeProfile.kernels.push({name:u,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(d).map((e=>null!=d[e]?d[e].shape:null)),outputShapes:t.map((e=>e.shape)),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(l)?t:t[0]}saveTensorsForBackwardMode(e){const t=e.map((e=>this.keep(this.clone(e))));return t}getTensorsForGradient(e,t,n){const r=(0,i.uk)(e);if(null!=r){const e=r.inputsToSave||[],a=r.outputsToSave||[];let s;r.saveAllInputs?(c.hu(Array.isArray(t),(()=>"saveAllInputs is true, expected inputs to be an array.")),s=Object.keys(t).map((e=>t[e]))):s=e.map((e=>t[e]));const o=n.filter(((e,t)=>a[t]));return s.concat(o)}return[]}makeTensor(e,t,n,r){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let a=e;"string"===n&&c.HD(e[0])&&(a=e.map((e=>u.encodeString(e))));const s=r.write(a,t,n),o=new f.es(t,n,s,this.nextTensorId());if(this.trackTensor(o,r),"string"===n){const e=this.state.tensorInfo.get(s),t=(0,c.Ub)(a);this.state.numBytes+=t-e.bytes,e.bytes=t}return o}makeTensorFromDataId(e,t,n,r){const a={dataId:e,shape:t,dtype:n=n||"float32"};return this.makeTensorFromTensorInfo(a,r)}makeTensorFromTensorInfo(e,t){const{dataId:n,shape:r,dtype:a}=e,s=new f.es(r,a,n,this.nextTensorId());return this.trackTensor(s,t),s}makeVariable(e,t=!0,n,r){n=n||this.nextVariableId().toString(),null!=r&&r!==e.dtype&&(e=e.cast(r));const a=new f._w(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[a.name])throw new Error(`Variable with name ${a.name} was already registered`);return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*c.bT(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof f._w||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*c.bT(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map((e=>e.totalBytesSnapshot))),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const e of this.state.activeProfile.kernels)e.kernelTimeMs=await e.kernelTimeMs,e.extraInfo=await e.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,r,a,s){const o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:a},l=(0,i.uk)(e);null!=l&&(r=l.gradFunc),null!=r&&(o.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],r=c.wT(e.size,e.dtype);return this.makeTensor(r,e.shape,e.dtype)}return e})),r(e.length>1?e:e[0],a,s))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=(0,m.getTensorsInContainer)(e),n=new Set(t.map((e=>e.id)));for(let e=0;e<this.state.activeScope.track.length;e++){const t=this.state.activeScope.track[e];t.kept||n.has(t.id)||t.dispose()}const r=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach((e=>{e.kept||e.scopeId!==r.id||this.track(e)}))}gradients(e,t,n,r=!1){if(c.hu(t.length>0,(()=>"gradients() received an empty list of xs.")),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const a=this.scopedRun((()=>this.startTape()),(()=>this.endTape()),(()=>this.tidy("forward",e)));c.hu(a instanceof f.es,(()=>"The result y returned by f() must be a tensor."));const s=function(e,t,n){const r={},a={};for(let e=0;e<t.length;e++)r[t[e].id]=!0;for(let n=0;n<e.length;n++){const s=e[n],o=s.inputs;for(const e in o){const n=o[e];let i=!1;for(let e=0;e<t.length;e++)if(r[n.id]){s.outputs.forEach((e=>r[e.id]=!0)),i=!0,a[s.id]=!0;break}if(i)break}}const s={};s[n.id]=!0;const o={};for(let t=e.length-1;t>=0;t--){const n=e[t],r=n.inputs;for(let e=0;e<n.outputs.length;e++)if(s[n.outputs[e].id]){for(const e in r)s[r[e].id]=!0,o[n.id]=!0;break}}const i=[];for(let t=0;t<e.length;t++){const n=e[t];if(a[n.id]&&o[n.id]){const e={};for(const t in n.inputs){const a=n.inputs[t];r[a.id]&&(e[t]=a)}const t=Object.assign({},n);t.inputs=e,t.outputs=n.outputs,i.push(t)}}return i}(this.state.activeTape,t,a);if(!r&&0===s.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",(()=>{const e={};e[a.id]=null==n?function(e){const t=(0,c.p8)((0,c.NA)(e),"float32");return v.makeTensor(t,e,"float32")}(a.shape):n,function(e,t,n,r){for(let a=t.length-1;a>=0;a--){const s=t[a],o=[];if(s.outputs.forEach((t=>{const n=e[t.id];null!=n?o.push(n):o.push(null)})),null==s.gradient)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);const i=s.gradient(o);for(const t in s.inputs){if(!(t in i))throw new Error(`Cannot backprop through input ${t}. Available gradients found: ${Object.keys(i)}.`);const a=n((()=>i[t]()));if("float32"!==a.dtype)throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${t} must have 'float32' dtype, but has '${a.dtype}'`);const o=s.inputs[t];if(!c.cO(a.shape,o.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${t}' has shape '${a.shape}', which does not match the shape of the input '${o.shape}'`);if(null==e[o.id])e[o.id]=a;else{const t=e[o.id];e[o.id]=r(t,a),t.dispose()}}}}(e,s,(e=>this.tidy(e)),w);const r=t.map((t=>e[t.id]));return 0===this.state.gradientDepth&&(this.state.activeTape.forEach((e=>{for(const t of e.saved)t.dispose()})),this.state.activeTape=null),{value:a,grads:r}}))}customGrad(e){return c.hu(c.mf(e),(()=>"The f passed in customGrad(f) must be a function.")),(...t)=>{let n;c.hu(t.every((e=>e instanceof f.es)),(()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors"));const r={};t.forEach(((e,t)=>{r[t]=e}));return this.runKernelFunc({forwardFunc:(r,a)=>(n=e(...t,a),c.hu(n.value instanceof f.es,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),c.hu(c.mf(n.gradFunc),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.")),n.value),backwardsFunc:(e,r)=>{const a=n.gradFunc(e,r),s=Array.isArray(a)?a:[a];c.hu(s.length===t.length,(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).")),c.hu(s.every((e=>e instanceof f.es)),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."));const o={};return s.forEach(((e,t)=>{o[t]=()=>e})),o},inputs:r})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=(0,u.now)(),n=await this.backend.time(e);return n.wallMs=(0,u.now)()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new y;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function x(){const e=(0,s.D)();if(null==e._tfengine){const t=new a.qA(e);e._tfengine=new b(t)}return(0,a.iG)(e._tfengine.ENV),(0,f.Vi)((()=>e._tfengine)),e._tfengine}b.nextTensorId=0,b.nextVariableId=0;const v=x();function w(e,t){const n={a:e,b:t};return v.runKernel(o.mm_,n)}},2885:(e,t,n)=>{n.d(t,{OB:()=>i,Vi:()=>l,iG:()=>u,qA:()=>s});var r=n(569);const a="tfjsflags";class s{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=o,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(i().getBool("IS_TEST")||i().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];i().getBool("IS_TEST")||i().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${t}.`),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if((0,r.tI)(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if(a in e){e.tfjsflags.split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){if("true"===(t=t.toLowerCase())||"false"===t)return"true"===t;if(""+ +t===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}(t,n)}))}}}function o(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,((e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")))),t}function i(){return l}let l=null;function u(e){l=e}},9998:(e,t,n)=>{n(7097);var r=n(5999),a=n(2885),s=n(4155);const o=(0,a.OB)();o.registerFlag("DEBUG",(()=>!1),(e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")})),o.registerFlag("IS_BROWSER",(()=>r.isBrowser())),o.registerFlag("IS_NODE",(()=>void 0!==s&&void 0!==s.versions&&void 0!==s.versions.node)),o.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),o.registerFlag("PROD",(()=>!1)),o.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>o.getBool("DEBUG"))),o.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),o.registerFlag("IS_TEST",(()=>!1)),o.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>!0)),o.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1)),o.registerFlag("ENGINE_COMPILE_ONLY",(()=>!1)),o.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(()=>!1)),o.registerFlag("USE_SETTIMEOUTCUSTOM",(()=>!1))},5938:(e,t,n)=>{n.d(t,{D:()=>s,R:()=>o});var r=n(4155);let a;function s(){if(null==a){let e;if("undefined"!=typeof window)e=window;else if(void 0!==n.g)e=n.g;else if(void 0!==r)e=r;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}a=e}return a}function o(e,t){const n=function(){const e=s();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const r=t();return n.set(e,r),n.get(e)}}},633:(e,t,n)=>{n.d(t,{UQ:()=>i,cb:()=>p,fN:()=>c,h7:()=>u,pn:()=>d,ti:()=>l});var r=n(7097),a=n(4077),s=n(3740),o=n(569);function i(e){return o.hu(o.mf(e),(()=>"The f passed in grad(f) must be a function")),(t,n)=>{const a=(0,s._1)(t,"x","tf.grad","string_or_numeric"),i=null!=n?(0,s._1)(n,"dy","tf.grad"):null;return r.BV.tidy((()=>{const{value:t,grads:n}=r.BV.gradients((()=>e(a)),[a],i);return null!=i&&o.k5(t.shape,i.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),h(n),n[0]}))}}function l(e){return o.hu(o.mf(e),(()=>"The f passed in grads(f) must be a function")),(t,n)=>{o.hu(Array.isArray(t),(()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"));const a=(0,s.sI)(t,"args","tf.grads","string_or_numeric"),i=null!=n?(0,s._1)(n,"dy","tf.grads"):null;return r.BV.tidy((()=>{const{value:t,grads:n}=r.BV.gradients((()=>e(...a)),a,i);return null!=i&&o.k5(t.shape,i.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),h(n),n}))}}function u(e){return o.hu(o.mf(e),(()=>"The f passed in valueAndGrad(f) must be a function")),(t,n)=>{o.hu(t instanceof a.es,(()=>"The x passed in valueAndGrad(f)(x) must be a tensor")),o.hu(null==n||n instanceof a.es,(()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"));const{grads:s,value:i}=r.BV.gradients((()=>e(t)),[t],n);return h(s),{grad:s[0],value:i}}}function c(e){return o.hu(o.mf(e),(()=>"The f passed in valueAndGrads(f) must be a function")),(t,n)=>{o.hu(Array.isArray(t)&&t.every((e=>e instanceof a.es)),(()=>"The args passed in valueAndGrads(f)(args) must be array of tensors")),o.hu(null==n||n instanceof a.es,(()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"));const s=r.BV.gradients((()=>e(...t)),t,n);return null!=n&&o.k5(s.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),h(s.grads),s}}function d(e,t){o.hu(o.mf(e),(()=>"The f passed in variableGrads(f) must be a function")),o.hu(null==t||Array.isArray(t)&&t.every((e=>e instanceof a._w)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in r.BV.registeredVariables)t.push(r.BV.registeredVariables[e])}const s=n?t.filter((e=>!e.trainable)):null,i=t.length;t=t.filter((e=>e.trainable)),o.hu(t.length>0,(()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${i} variables is trainable.`));const{value:l,grads:u}=r.BV.gradients(e,t,null,!0);o.hu(u.some((e=>null!=e)),(()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize().")),o.hu(0===l.rank,(()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${l.rank} tensor`));const c={};return t.forEach(((e,t)=>{null!=u[t]&&(c[e.name]=u[t])})),null!=s&&s.forEach((e=>c[e.name]=null)),{value:l,grads:c}}function p(e){return r.BV.customGrad(e)}function h(e){if(e.filter((e=>null==e)).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.")}},1044:(e,t,n)=>{n.d(t,{ns:()=>d,y$:()=>h});n(9998);var r=n(2885),a=n(1989),s=n(6493);const o="tensorflowjs",i="models_store",l="model_info_store";function u(){if(!(0,r.OB)().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function c(e){const t=e.result;t.createObjectStore(i,{keyPath:"modelPath"}),t.createObjectStore(l,{keyPath:"modelPath"})}class d{constructor(e){if(this.indexedDB=u(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise(((e,n)=>{const r=this.indexedDB.open(o,1);r.onupgradeneeded=()=>c(r),r.onsuccess=()=>{const s=r.result;if(null==t){const t=s.transaction(i,"readonly"),r=t.objectStore(i).get(this.modelPath);r.onsuccess=()=>{if(null==r.result)return s.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));e(r.result.modelArtifacts)},r.onerror=e=>(s.close(),n(r.error)),t.oncomplete=()=>s.close()}else{const r=(0,a.Q)(t),o=s.transaction(l,"readwrite");let u=o.objectStore(l);const c=u.put({modelPath:this.modelPath,modelArtifactsInfo:r});let d;c.onsuccess=()=>{d=s.transaction(i,"readwrite");const a=d.objectStore(i).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:r});a.onsuccess=()=>e({modelArtifactsInfo:r}),a.onerror=e=>{u=o.objectStore(l);const t=u.delete(this.modelPath);t.onsuccess=()=>(s.close(),n(a.error)),t.onerror=e=>(s.close(),n(a.error))}},c.onerror=e=>(s.close(),n(c.error)),o.oncomplete=()=>{null==d?s.close():d.oncomplete=()=>s.close()}}},r.onerror=e=>n(r.error)}))}}d.URL_SCHEME="indexeddb://";const p=e=>{return(0,r.OB)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(d.URL_SCHEME)?(t=e.slice(d.URL_SCHEME.length),new d(t)):null;var t};s.U3.registerSaveRouter(p),s.U3.registerLoadRouter(p);class h{constructor(){this.indexedDB=u()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open(o,1);n.onupgradeneeded=()=>c(n),n.onsuccess=()=>{const r=n.result,a=r.transaction(l,"readonly"),s=a.objectStore(l).getAll();s.onsuccess=()=>{const t={};for(const e of s.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},s.onerror=e=>(r.close(),t(s.error)),a.oncomplete=()=>r.close()},n.onerror=e=>t(n.error)}))}async removeModel(e){var t;return e=(t=e).startsWith(d.URL_SCHEME)?t.slice(d.URL_SCHEME.length):t,new Promise(((t,n)=>{const r=this.indexedDB.open(o,1);r.onupgradeneeded=()=>c(r),r.onsuccess=()=>{const a=r.result,s=a.transaction(l,"readwrite"),o=s.objectStore(l),u=o.get(e);let c;u.onsuccess=()=>{if(null==u.result)return a.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const r=o.delete(e),s=()=>{c=a.transaction(i,"readwrite");const r=c.objectStore(i).delete(e);r.onsuccess=()=>t(u.result.modelArtifactsInfo),r.onerror=e=>n(u.error)};r.onsuccess=s,r.onerror=e=>(s(),a.close(),n(u.error))}},u.onerror=e=>(a.close(),n(u.error)),s.oncomplete=()=>{null==c?a.close():c.oncomplete=()=>a.close()}},r.onerror=e=>n(r.error)}))}}},1989:(e,t,n)=>{n.d(t,{EZ:()=>m,JY:()=>f,Q:()=>x,Yd:()=>g,_n:()=>p,dI:()=>l,hu:()=>v,jN:()=>b,ji:()=>y,n7:()=>h,yz:()=>i});var r=n(1661),a=n(701),s=n(569),o=n(5771);async function i(e,t){const n=[],r=[],a=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);for(let s=0;s<a.length;++s){const o=a[s],i=Array.isArray(e)?e[s].tensor:e[o];if("float32"!==i.dtype&&"int32"!==i.dtype&&"bool"!==i.dtype&&"string"!==i.dtype&&"complex64"!==i.dtype)throw new Error(`Unsupported dtype in weight '${o}': ${i.dtype}`);const l={name:o,shape:i.shape,dtype:i.dtype};if("string"===i.dtype){const e=new Promise((async e=>{const t=await i.bytes(),n=t.reduce(((e,t)=>e+t.length),0)+4*t.length,r=new Uint8Array(n);let a=0;for(let e=0;e<t.length;e++){const n=t[e],s=new Uint8Array(new Uint32Array([n.length]).buffer);r.set(s,a),a+=4,r.set(n,a),a+=n.length}e(r)}));r.push(e)}else r.push(i.data());null!=t&&(l.group=t),n.push(l)}return{data:u(await Promise.all(r)),specs:n}}function l(e,t){const n={};let i,l=0;for(const u of t){const t=u.name,c=u.dtype,d=u.shape,p=(0,s.NA)(d);let h;if("quantization"in u){const n=u.quantization;if("uint8"===n.dtype||"uint16"===n.dtype){if(!("min"in n)||!("scale"in n))throw new Error(`Weight ${u.name} with quantization ${n.dtype} doesn't have corresponding metadata min and scale.`)}else{if("float16"!==n.dtype)throw new Error(`Weight ${u.name} has unknown quantization dtype ${n.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);if("float32"!==c)throw new Error(`Weight ${u.name} is quantized with ${n.dtype} which only supports weights of type float32 not ${c}.`)}const r=o.J[n.dtype],a=e.slice(l,l+p*r),s="uint8"===n.dtype?new Uint8Array(a):new Uint16Array(a);if("float32"===c)if("uint8"===n.dtype||"uint16"===n.dtype){h=new Float32Array(s.length);for(let e=0;e<s.length;e++){const t=s[e];h[e]=t*n.scale+n.min}}else{if("float16"!==n.dtype)throw new Error(`Unsupported quantization type ${n.dtype} for weight type float32.`);void 0===i&&(i=w()),h=i(s)}else{if("int32"!==c)throw new Error(`Unsupported dtype in weight '${t}': ${c}`);if("uint8"!==n.dtype&&"uint16"!==n.dtype)throw new Error(`Unsupported quantization type ${n.dtype} for weight type int32.`);h=new Int32Array(s.length);for(let e=0;e<s.length;e++){const t=s[e];h[e]=Math.round(t*n.scale+n.min)}}l+=p*r}else if("string"===c){const t=(0,s.NA)(u.shape);h=[];for(let n=0;n<t;n++){const t=new Uint32Array(e.slice(l,l+4))[0];l+=4;const n=new Uint8Array(e.slice(l,l+t));h.push(n),l+=t}}else{const s=o.J[c],i=e.slice(l,l+p*s);if("float32"===c)h=new Float32Array(i);else if("int32"===c)h=new Int32Array(i);else if("bool"===c)h=new Uint8Array(i);else{if("complex64"!==c)throw new Error(`Unsupported dtype in weight '${t}': ${c}`);{h=new Float32Array(i);const e=new Float32Array(h.length/2),s=new Float32Array(h.length/2);for(let t=0;t<e.length;t++)e[t]=h[2*t],s[t]=h[2*t+1];const o=(0,a.X)(e,d,"float32"),l=(0,a.X)(s,d,"float32");n[t]=(0,r.P)(o,l),o.dispose(),l.dispose()}}l+=p*s}"complex64"!==c&&(n[t]=(0,a.X)(h,d,c))}return n}function u(e){if(null===e)throw new Error(`Invalid input value: ${JSON.stringify(e)}`);let t=0;const n=[];e.forEach((e=>{if(t+=e.byteLength,n.push(e.byteLength===e.buffer.byteLength?e:new e.constructor(e)),!(e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${e.constructor.name}`)}));const r=new Uint8Array(t);let a=0;return n.forEach((e=>{r.set(new Uint8Array(e.buffer),a),a+=e.byteLength})),r.buffer}const c="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function d(e){return c?Buffer.byteLength(e):new Blob([e]).size}function p(e){if(c)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let e=0,r=t.length;e<r;e++)n+=String.fromCharCode(t[e]);return btoa(n)}function h(e){if(c){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n.set([t.charCodeAt(e)],e);return n.buffer}function f(e){if(1===e.length)return e[0];let t=0;e.forEach((e=>{t+=e.byteLength}));const n=new Uint8Array(t);let r=0;return e.forEach((e=>{n.set(new Uint8Array(e),r),r+=e.byteLength})),n.buffer}function m(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);const t=e.split("/");return t[t.length-1]}function g(e,t){const n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return null!=e.signature&&(n.signature=e.signature),null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer),null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig),n}function y(e,t,n){const r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(null!=e.trainingConfig&&(r.trainingConfig=e.trainingConfig),null!=e.weightsManifest){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");r.weightSpecs=t,r.weightData=n}return null!=e.signature&&(r.signature=e.signature),null!=e.userDefinedMetadata&&(r.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(r.modelInitializer=e.modelInitializer),r}async function b(e,t){let n,r;return null!=e.weightsManifest&&([n,r]=await t(e.weightsManifest)),y(e,n,r)}function x(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:d(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:d(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:e.weightData.byteLength}}function v(e){const t=[];for(const n of e)t.push(...n.weights);return t}function w(){const e=function(){const e=e=>{let t=e<<13,n=0;for(;0==(8388608&t);)n-=8388608,t<<=1;return t&=-8388609,n+=947912704,t|n},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let e=1024;e<2048;e++)t[e]=939524096+(e-1024<<13);return t}(),t=function(){const e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}(),n=function(){const e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}();return r=>{const a=new ArrayBuffer(4*r.length),s=new Uint32Array(a);for(let a=0;a<r.length;a++){const o=r[a],i=e[n[o>>10]+(1023&o)]+t[o>>10];s[a]=i}return new Float32Array(a)}}},8209:(e,t,n)=>{n.d(t,{Ew:()=>y,JL:()=>x});n(9998);var r=n(2885),a=n(569),s=n(1989),o=n(6493);const i="/",l="tensorflowjs_models",u="info",c="model_topology",d="weight_specs",p="weight_data",h="model_metadata";function f(e){return{info:[l,e,u].join(i),topology:[l,e,c].join(i),weightSpecs:[l,e,d].join(i),weightData:[l,e,p].join(i),modelMetadata:[l,e,h].join(i)}}function m(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function g(e){const t=e.split(i);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(i)}class y{constructor(e){if(!(0,r.OB)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=f(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=(0,s.Q)(e);try{this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,(0,s._n)(e.weightData));const a={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(a)),{modelArtifactsInfo:r}}catch(e){throw m(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${r.modelTopologyBytes}, weightSpecsBytes=${r.weightSpecsBytes}, weightDataBytes=${r.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;const r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==r)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=r;const a=this.LS.getItem(this.keys.modelMetadata);if(null!=a){const e=JSON.parse(a);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const o=this.LS.getItem(this.keys.weightData);if(null==o)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=(0,s.n7)(o),t}}y.URL_SCHEME="localstorage://";const b=e=>{return(0,r.OB)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(y.URL_SCHEME)?(t=e.slice(y.URL_SCHEME.length),new y(t)):null;var t};o.U3.registerSaveRouter(b),o.U3.registerLoadRouter(b);class x{constructor(){(0,a.hu)((0,r.OB)().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),(0,a.hu)("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=l+i,n=i+u;for(let r=0;r<this.LS.length;++r){const a=this.LS.key(r);if(a.startsWith(t)&&a.endsWith(n)){e[g(a)]=JSON.parse(this.LS.getItem(a))}}return e}async removeModel(e){var t;const n=f(e=(t=e).startsWith(y.URL_SCHEME)?t.slice(y.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error(`Cannot find model at path '${e}'`);const r=JSON.parse(this.LS.getItem(n.info));return m(n),r}}},780:(e,t,n)=>{n.d(t,{ID:()=>d,Ny:()=>p,gw:()=>c,h1:()=>u,xQ:()=>o});var r=n(569),a=n(6493);const s="://";class o{constructor(){this.managers={}}static getInstance(){return null==o.instance&&(o.instance=new o),o.instance}static registerManager(e,t){(0,r.hu)(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith(s)&&(e=e.slice(0,e.indexOf(s))),(0,r.hu)(e.length>0,(()=>"scheme must not be an empty string."));const n=o.getInstance();(0,r.hu)(null==n.managers[e],(()=>`A model store manager is already registered for scheme '${e}'.`)),n.managers[e]=t}static getManager(e){const t=o.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(o.getInstance().managers)}}function i(e){if(-1===e.indexOf(s))throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${o.getSchemes().join(",")}`);return{scheme:e.split(s)[0],path:e.split(s)[1]}}async function l(e,t,n=!1){(0,r.hu)(e!==t,(()=>`Old path and new path are the same: '${e}'`));const s=a.U3.getLoadHandlers(e);(0,r.hu)(s.length>0,(()=>`Copying failed because no load handler is found for source URL ${e}.`)),(0,r.hu)(s.length<2,(()=>`Copying failed because more than one (${s.length}) load handlers for source URL ${e}.`));const l=s[0],u=a.U3.getSaveHandlers(t);(0,r.hu)(u.length>0,(()=>`Copying failed because no save handler is found for destination URL ${t}.`)),(0,r.hu)(u.length<2,(()=>`Copying failed because more than one (${s.length}) save handlers for destination URL ${t}.`));const c=u[0],d=i(e).scheme,p=i(e).path,h=d===i(e).scheme,f=await l.load();n&&h&&await o.getManager(d).removeModel(p);const m=await c.save(f);return n&&!h&&await o.getManager(d).removeModel(p),m.modelArtifactsInfo}async function u(){const e=o.getSchemes(),t={};for(const n of e){const e=await o.getManager(n).listModels();for(const r in e){t[n+s+r]=e[r]}}return t}async function c(e){const t=i(e);return o.getManager(t.scheme).removeModel(t.path)}async function d(e,t){return l(e,t,!1)}async function p(e,t){return l(e,t,!0)}},6493:(e,t,n)=>{n.d(t,{U3:()=>r,pS:()=>s,rM:()=>i,tf:()=>a,yB:()=>o});class r{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==r.instance&&(r.instance=new r),r.instance}static registerSaveRouter(e){r.getInstance().saveRouters.push(e)}static registerLoadRouter(e){r.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return r.getHandlers(e,"save")}static getLoadHandlers(e,t){return r.getHandlers(e,"load",t)}static getHandlers(e,t,n){const a=[];return("load"===t?r.getInstance().loadRouters:r.getInstance().saveRouters).forEach((t=>{const r=t(e,n);null!==r&&a.push(r)})),a}}const a=e=>r.registerSaveRouter(e),s=e=>r.registerLoadRouter(e),o=e=>r.getSaveHandlers(e),i=(e,t)=>r.getLoadHandlers(e,t)},5771:(e,t,n)=>{n.d(t,{J:()=>r});const r={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8}},9121:(e,t,n)=>{n.d(t,{$HU:()=>ft,$g6:()=>J,$w:()=>X,Acj:()=>ge,BMI:()=>_e,BiW:()=>dt,Byc:()=>V,CAk:()=>Ce,D2d:()=>zt,DlI:()=>ut,Eh3:()=>R,FKq:()=>Pt,G3Y:()=>rn,GBy:()=>$t,Gcp:()=>Lt,HEU:()=>te,HZH:()=>gt,Hhh:()=>$e,Hmb:()=>bt,IKK:()=>u,IMb:()=>v,J$2:()=>Se,J_u:()=>xe,JhU:()=>y,Kgp:()=>ot,L8s:()=>_t,Ly9:()=>A,M2y:()=>p,MIZ:()=>Jt,MRv:()=>Ot,MZg:()=>Re,NEP:()=>ae,NZg:()=>Ke,O3z:()=>Vt,OAf:()=>Ue,OR:()=>ce,OU7:()=>Ge,OV7:()=>Ve,Omj:()=>ne,Oyi:()=>m,PYm:()=>Ne,PhF:()=>kt,QCc:()=>g,QRR:()=>W,Qg5:()=>be,QiL:()=>at,Qvg:()=>on,RFZ:()=>I,ROF:()=>b,RQH:()=>Bt,RuY:()=>un,SX0:()=>ee,SYM:()=>r,SbG:()=>wt,SpW:()=>s,T0n:()=>z,TQc:()=>Ft,TR1:()=>L,ToN:()=>sn,Tr8:()=>Qt,Uyb:()=>ue,VGw:()=>a,Vbg:()=>Xe,VcC:()=>G,VfG:()=>Be,Vn9:()=>Q,W0H:()=>tt,XDQ:()=>ln,XLW:()=>w,XkS:()=>qt,Xze:()=>i,Y0y:()=>oe,YFo:()=>se,YoZ:()=>Fe,ZbH:()=>ke,ZjV:()=>Wt,Zz9:()=>N,_JP:()=>Xt,_V0:()=>fn,_Yw:()=>xt,_k9:()=>x,_tC:()=>Ht,a5O:()=>Mt,aJk:()=>d,avt:()=>ve,b9H:()=>pn,bK0:()=>Zt,bV0:()=>At,c17:()=>He,cWu:()=>tn,cie:()=>H,cye:()=>et,dDz:()=>ct,deh:()=>le,dpD:()=>yt,e07:()=>St,e6w:()=>pt,e7N:()=>Ie,eBW:()=>dn,eEB:()=>C,eZ0:()=>Pe,ekb:()=>q,gJX:()=>k,h8e:()=>cn,hdR:()=>re,i5y:()=>Dt,iHb:()=>U,iJz:()=>ye,iWB:()=>we,iZT:()=>me,ik2:()=>F,jMg:()=>f,jQk:()=>jt,jQs:()=>je,jeX:()=>de,kU:()=>Ee,kpP:()=>an,kuV:()=>Qe,luS:()=>mn,lyA:()=>st,mKl:()=>Tt,mTV:()=>Le,mc4:()=>_,mhS:()=>D,mm_:()=>o,n9L:()=>en,nhH:()=>Ut,nr8:()=>It,o0g:()=>lt,o2y:()=>$,oFR:()=>Et,oHH:()=>Y,oT6:()=>l,p2w:()=>Nt,p4S:()=>K,pe_:()=>it,q1x:()=>fe,q2K:()=>ze,q8u:()=>Ze,qCd:()=>Me,qIC:()=>Oe,qWM:()=>nt,qi_:()=>he,qkr:()=>mt,qw7:()=>h,r7n:()=>Te,s1s:()=>Kt,sEM:()=>Yt,sHE:()=>pe,sJF:()=>c,sL$:()=>Z,usg:()=>hn,uv1:()=>Je,vFR:()=>We,vtC:()=>Ae,vwp:()=>ie,w3H:()=>Gt,w6g:()=>De,wUP:()=>M,wYB:()=>Rt,wYn:()=>qe,we_:()=>rt,wm:()=>O,wx7:()=>nn,x12:()=>P,xJR:()=>ht,xQA:()=>Ct,xnO:()=>E,y7R:()=>j,yQU:()=>Ye,yj2:()=>B,zbQ:()=>vt,zvY:()=>S,zws:()=>T});const r="Abs",a="Acos",s="Acosh",o="Add",i="AddN",l="All",u="Any",c="ArgMax",d="ArgMin",p="Asin",h="Asinh",f="Atan",m="Atanh",g="Atan2",y="AvgPool",b="AvgPoolGrad",x="AvgPool3D",v="AvgPool3DGrad",w="BatchMatMul",T="BatchToSpaceND",S="Bincount",A="BroadcastTo",C="BroadcastArgs",I="Cast",k="Ceil",E="ClipByValue",N="Complex",B="ComplexAbs",R="Concat",D="Conv2D",M="Conv2DBackpropFilter",O="Conv2DBackpropInput",P="Conv3D",$="Conv3DBackpropFilterV2",F="Conv3DBackpropInputV2",_="Cos",L="Cosh",V="Cumprod",U="Cumsum",G="CropAndResize",W="DenseBincount",z="DepthToSpace",H="DepthwiseConv2dNative",Z="DepthwiseConv2dNativeBackpropFilter",j="DepthwiseConv2dNativeBackpropInput",X="Diag",K="Dilation2D",q="Dilation2DBackpropInput",Q="Dilation2DBackpropFilter",Y="RealDiv",J="Einsum",ee="Elu",te="EluGrad",ne="Erf",re="Equal",ae="Exp",se="ExpandDims",oe="Expm1",ie="FFT",le="Fill",ue="FlipLeftRight",ce="Floor",de="FloorDiv",pe="FusedBatchNorm",he="GatherV2",fe="GatherNd",me="Greater",ge="GreaterEqual",ye="Identity",be="IFFT",xe="Imag",ve="IsFinite",we="IsInf",Te="IsNan",Se="LeakyRelu",Ae="Less",Ce="LessEqual",Ie="LinSpace",ke="Log",Ee="Log1p",Ne="LogicalAnd",Be="LogicalNot",Re="LogicalOr",De="LogicalXor",Me="LogSoftmax",Oe="LowerBound",Pe="LRN",$e="LRNGrad",Fe="Max",_e="Maximum",Le="MaxPool",Ve="MaxPoolGrad",Ue="MaxPool3D",Ge="MaxPool3DGrad",We="MaxPoolWithArgmax",ze="Mean",He="Min",Ze="Minimum",je="MirrorPad",Xe="Mod",Ke="Multinomial",qe="Multiply",Qe="Neg",Ye="NotEqual",Je="NonMaxSuppressionV3",et="NonMaxSuppressionV4",tt="NonMaxSuppressionV5",nt="OnesLike",rt="OneHot",at="Pack",st="PadV2",ot="Pool",it="Pow",lt="Prelu",ut="Prod",ct="RaggedGather",dt="RaggedTensorToTensor",pt="Range",ht="Real",ft="Reciprocal",mt="Relu",gt="Reshape",yt="ResizeNearestNeighbor",bt="ResizeNearestNeighborGrad",xt="ResizeBilinear",vt="ResizeBilinearGrad",wt="Relu6",Tt="Reverse",St="Round",At="Rsqrt",Ct="ScatterNd",It="SearchSorted",kt="Select",Et="Selu",Nt="Slice",Bt="Sin",Rt="Sinh",Dt="Sign",Mt="Sigmoid",Ot="Softplus",Pt="Sqrt",$t="Sum",Ft="SpaceToBatchND",_t="SplitV",Lt="Softmax",Vt="SparseFillEmptyRows",Ut="SparseReshape",Gt="SparseSegmentMean",Wt="SparseSegmentSum",zt="SparseToDense",Ht="SquaredDifference",Zt="Square",jt="StridedSlice",Xt="StringNGrams",Kt="StringSplit",qt="StringToHashBucketFast",Qt="Sub",Yt="Tan",Jt="Tanh",en="Tile",tn="TopK",nn="Transform",rn="Transpose",an="Unique",sn="Unpack",on="UnsortedSegmentSum",ln="UpperBound",un="ZerosLike",cn="Step",dn="FromPixels",pn="RotateWithOffset",hn="_FusedMatMul",fn="FusedConv2D",mn="FusedDepthwiseConv2D"},6151:(e,t,n)=>{n.d(t,{Li:()=>p,T3:()=>m,bt:()=>f,nE:()=>h,pI:()=>l,tr:()=>c,uk:()=>u,wC:()=>d});var r=n(2885),a=n(5938),s=n(4706);const o=(0,a.R)("kernelRegistry",(()=>new Map)),i=(0,a.R)("gradRegistry",(()=>new Map));function l(e,t){const n=g(e,t);return o.get(n)}function u(e){return i.get(e)}function c(e){const t=o.entries(),n=[];for(;;){const{done:r,value:a}=t.next();if(r)break;const[s,o]=a,[i]=s.split("_");i===e&&n.push(o)}return n}function d(e){const{kernelName:t,backendName:n}=e,r=g(t,n);o.has(r)&&s.Z(`The kernel '${t}' for backend '${n}' is already registered`),o.set(r,e)}function p(e){const{kernelName:t}=e;i.has(t)&&(0,r.OB)().getBool("DEBUG")&&s.Z(`Overriding the gradient for '${t}'`),i.set(t,e)}function h(e,t){const n=g(e,t);if(!o.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);o.delete(n)}function f(e){if(!i.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);i.delete(e)}function m(e,t){c(e).forEach((e=>{d(Object.assign({},e,{backendName:t}))}))}function g(e,t){return`${t}_${e}`}},4706:(e,t,n)=>{n.d(t,{Z:()=>a,c:()=>s});var r=n(2885);function a(...e){(0,r.OB)().getBool("IS_TEST")||(0,r.OB)().getBool("PROD")||console.warn(...e)}function s(...e){(0,r.OB)().getBool("IS_TEST")||(0,r.OB)().getBool("PROD")||console.log(...e)}},6407:(e,t,n)=>{n.d(t,{I:()=>i});var r=n(7097),a=n(9121),s=n(747),o=n(3740);const i=(0,n(2668).op)({add_:function(e,t){let n=(0,o._1)(e,"a","add"),i=(0,o._1)(t,"b","add");[n,i]=(0,s.makeTypesMatch)(n,i);const l={a:n,b:i};return r.BV.runKernel(a.mm_,l)}})},5176:(e,t,n)=>{n.d(t,{w:()=>d});var r=n(7097),a=n(9121),s=n(3740),o=n(569),i=n(2271),l=n(2582),u=n(2668),c=n(4968);const d=(0,u.op)({avgPool_:function(e,t,n,u,d){const p=(0,s._1)(e,"x","avgPool","float32");o.hu(l.jT(n,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`));let h=p,f=!1;3===p.rank&&(f=!0,h=(0,c.X)(p,[1,p.shape[0],p.shape[1],p.shape[2]])),o.hu(4===h.rank,(()=>`Error in avgPool: x must be rank 4 but got rank ${h.rank}.`)),l.m("avgPool",u,d);const m={x:h},g={filterSize:t,strides:n,pad:u,dimRoundingMode:d};let y=r.BV.runKernel(a.JhU,m,g);return y=(0,i.p)(y,p.dtype),f?(0,c.X)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},2200:(e,t,n)=>{function r(e,t){const n=e.length,r=[];for(let a=0;a<n;a++){const s=n-1-a,o=e[s]||1;(t[t.length-1-a]||1)>1&&1===o&&r.unshift(s)}return r}function a(e,t){const n=[];for(let r=0;r<t.length;r++){const a=e[e.length-r-1],s=t.length-r-1,o=t[s];(null==a||1===a&&o>1)&&n.unshift(s)}return n}function s(e,t){const n=[],r=Math.max(e.length,t.length);for(let a=0;a<r;a++){let r=e[e.length-a-1];null==r&&(r=1);let s=t[t.length-a-1];if(null==s&&(s=1),1===r)n.unshift(s);else if(1===s)n.unshift(r);else{if(r!==s){throw Error(`Operands could not be broadcast together with shapes ${e} and ${t}.`)}n.unshift(r)}}return n}n.r(t),n.d(t,{assertAndGetBroadcastShape:()=>s,getBroadcastDims:()=>r,getReductionAxes:()=>a})},2657:(e,t,n)=>{n.d(t,{f:()=>s});var r=n(4077),a=n(569);function s(e,t="float32",n){return t=t||"float32",a.Mu(e),new r.YD(e,t,n)}},2271:(e,t,n)=>{n.d(t,{p:()=>i});var r=n(7097),a=n(9121),s=n(3740),o=n(569);const i=(0,n(2668).op)({cast_:function(e,t){const n=(0,s._1)(e,"x","cast");if(!o.LP(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");const i={x:n},l={dtype:t};return r.BV.runKernel(a.RFZ,i,l)}})},8723:(e,t,n)=>{n.d(t,{d:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({clone_:function(e){const t={x:(0,s._1)(e,"x","clone","string_or_numeric")};return r.BV.runKernel(a.iJz,t)}})},1661:(e,t,n)=>{n.d(t,{P:()=>i});var r=n(7097),a=n(9121),s=n(3740),o=n(569);const i=(0,n(2668).op)({complex_:function(e,t){const n=(0,s._1)(e,"real","complex"),i=(0,s._1)(t,"imag","complex");o.k5(n.shape,i.shape,`real and imag shapes, ${n.shape} and ${i.shape}, must match in call to tf.complex().`);const l={real:n,imag:i};return r.BV.runKernel(a.Zz9,l)}})},6884:(e,t,n)=>{n.d(t,{z:()=>l});var r=n(7097),a=n(9121),s=n(3740),o=n(569),i=n(8723);const l=(0,n(2668).op)({concat_:function(e,t=0){(0,o.hu)(e.length>=1,(()=>"Pass at least one tensor to concat"));const n=(0,s.sI)(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach((e=>{if("complex64"!==e.dtype)throw new Error(`Cannot concatenate complex64 tensors with a tensor\n with dtype ${e.dtype}. `)})),1===n.length)return(0,i.d)(n[0]);const l=n,u={axis:t};return r.BV.runKernel(a.Eh3,l,u)}})},4794:(e,t,n)=>{n.d(t,{T:()=>c});var r=n(7097),a=n(9121),s=n(3740),o=n(569),i=n(2582),l=n(2668),u=n(4968);const c=(0,l.op)({conv2d_:function(e,t,n,l,c="NHWC",d=[1,1],p){const h=(0,s._1)(e,"x","conv2d","float32"),f=(0,s._1)(t,"filter","conv2d","float32");let m=h,g=!1;3===h.rank&&(g=!0,m=(0,u.X)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),o.hu(4===m.rank,(()=>`Error in conv2d: input must be rank 4, but got rank ${m.rank}.`)),o.hu(4===f.rank,(()=>`Error in conv2d: filter must be rank 4, but got rank ${f.rank}.`)),i.m("conv2d",l,p);const y="NHWC"===c?m.shape[3]:m.shape[1];o.hu(y===f.shape[2],(()=>`Error in conv2d: depth of input (${y}) must match input depth for filter ${f.shape[2]}.`)),o.hu(i.jT(n,d),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${d}'`));const b={x:m,filter:f},x={strides:n,pad:l,dataFormat:c,dilations:d,dimRoundingMode:p},v=r.BV.runKernel(a.mhS,b,x);return g?(0,u.X)(v,[v.shape[1],v.shape[2],v.shape[3]]):v}})},9832:(e,t,n)=>{n.d(t,{_:()=>u});var r=n(7097),a=n(9121),s=n(569),o=n(2582),i=n(2668),l=n(4968);const u=(0,i.op)({conv2DBackpropInput_:function(e,t,n,i,u,c="NHWC",d){s.hu(e.length===t.rank,(()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`));let p=e,h=t,f=!1;3===t.rank&&(f=!0,h=(0,l.X)(t,[1,t.shape[0],t.shape[1],t.shape[2]]),p=[1,e[0],e[1],e[2]]),s.hu(4===p.length,(()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${p.length}.`)),s.hu(4===h.rank,(()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${h.rank}`)),s.hu(4===n.rank,(()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`));const m="NHWC"===c?p[3]:p[1],g="NHWC"===c?h.shape[3]:h.shape[1];s.hu(m===n.shape[2],(()=>`Error in conv2dDerInput: depth of input (${m}) must match input depth for filter ${n.shape[2]}.`)),s.hu(g===n.shape[3],(()=>`Error in conv2dDerInput: depth of output (${g}) must match output depth for filter ${n.shape[3]}.`)),o.m("conv2dDerInput",u,d);const y={dy:h,filter:n},b={strides:i,pad:u,dataFormat:c,dimRoundingMode:d,inputShape:p},x=r.BV.runKernel(a.wm,y,b);return f?(0,l.X)(x,[x.shape[1],x.shape[2],x.shape[3]]):x}})},2582:(e,t,n)=>{n.d(t,{I0:()=>f,Ix:()=>i,Rf:()=>a,Xw:()=>s,aO:()=>u,jT:()=>m,jw:()=>l,m:()=>y,pl:()=>o,sl:()=>g});var r=n(569);function a(e,t,n,r,a="NHWC",s){return i(e,[...t,e[3]],n,s,r,null,null,g(a))}function s(e,t,n,r,a,s,o="channelsLast"){const[l,u]=c(t);let d;if("channelsLast"===o)d=[l,u,e[3],e[3]];else{if("channelsFirst"!==o)throw new Error(`Unknown dataFormat ${o}`);d=[l,u,e[1],e[1]]}return i(e,d,n,r,a,s,!1,o)}function o(e,t,n,r,a,s,o="NDHWC"){const[i,u,c]=d(t);let p,h;if("NDHWC"===o)h="channelsLast",p=[i,u,c,e[4],e[4]];else{if("NCDHW"!==o)throw new Error(`Unknown dataFormat ${o}`);h="channelsFirst",p=[i,u,c,e[1],e[1]]}return l(e,p,n,r,a,!1,h,s)}function i(e,t,n,r,a,s,o=!1,i="channelsLast"){let[l,d,f,m]=[-1,-1,-1,-1];if("channelsLast"===i)[l,d,f,m]=e;else{if("channelsFirst"!==i)throw new Error(`Unknown dataFormat ${i}`);[l,m,d,f]=e}const[g,y,,b]=t,[x,v]=c(n),[w,T]=c(r),S=p(g,w),A=p(y,T),{padInfo:C,outHeight:I,outWidth:k}=function(e,t,n,r,a,s,o,i,l){let c,d,p;if("number"==typeof e){c={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};const a=function(e,t,n,r,a){null==r&&(r=u(e,t,n));const s=e[0],o=e[1],i=h((s-t+2*r)/n+1,a),l=h((o-t+2*r)/n+1,a);return[i,l]}([t,n],s,r,e,i);d=a[0],p=a[1]}else if("same"===e){d=Math.ceil(t/r),p=Math.ceil(n/a);const e=Math.max(0,(d-1)*r+s-t),i=Math.max(0,(p-1)*a+o-n),l=Math.floor(e/2),u=e-l,h=Math.floor(i/2);c={top:l,bottom:u,left:h,right:i-h,type:"SAME"}}else if("valid"===e)c={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((t-s+1)/r),p=Math.ceil((n-o+1)/a);else{if("object"!=typeof e)throw Error(`Unknown padding parameter: ${e}`);{const u="channelsLast"===l?e[1][0]:e[2][0],f="channelsLast"===l?e[1][1]:e[2][1],m="channelsLast"===l?e[2][0]:e[3][0],g="channelsLast"===l?e[2][1]:e[3][1];c={top:u,bottom:f,left:m,right:g,type:0===u&&0===f&&0===m&&0===g?"VALID":"EXPLICIT"},d=h((t-s+u+f)/r+1,i),p=h((n-o+m+g)/a+1,i)}}return{padInfo:c,outHeight:d,outWidth:p}}(a,d,f,x,v,S,A,s,i),E=o?b*m:b;let N;return"channelsFirst"===i?N=[l,E,I,k]:"channelsLast"===i&&(N=[l,I,k,E]),{batchSize:l,dataFormat:i,inHeight:d,inWidth:f,inChannels:m,outHeight:I,outWidth:k,outChannels:E,padInfo:C,strideHeight:x,strideWidth:v,filterHeight:g,filterWidth:y,effectiveFilterHeight:S,effectiveFilterWidth:A,dilationHeight:w,dilationWidth:T,inShape:e,outShape:N,filterShape:t}}function l(e,t,n,r,a,s=!1,o="channelsLast",i){let[l,c,f,m,g]=[-1,-1,-1,-1,-1];if("channelsLast"===o)[l,c,f,m,g]=e;else{if("channelsFirst"!==o)throw new Error(`Unknown dataFormat ${o}`);[l,g,c,f,m]=e}const[y,b,x,,v]=t,[w,T,S]=d(n),[A,C,I]=d(r),k=p(y,A),E=p(b,C),N=p(x,I),{padInfo:B,outDepth:R,outHeight:D,outWidth:M}=function(e,t,n,r,a,s,o,i,l,c,d){let p,f,m,g;if("number"==typeof e){p={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};const s=function(e,t,n,r,a,s){null==a&&(a=u(e,t,r));const o=e[0],i=e[1],l=e[2],c=h((o-t+2*a)/r+1,s),d=h((i-t+2*a)/r+1,s),p=h((l-t+2*a)/r+1,s);return[c,d,p,n]}([t,n,r,1],i,1,a,e,d);f=s[0],m=s[1],g=s[2]}else if("same"===e){f=Math.ceil(t/a),m=Math.ceil(n/s),g=Math.ceil(r/o);const e=(f-1)*a+i-t,u=(m-1)*s+l-n,d=(g-1)*o+c-r,h=Math.floor(e/2),y=e-h,b=Math.floor(u/2),x=u-b,v=Math.floor(d/2);p={top:b,bottom:x,left:v,right:d-v,front:h,back:y,type:"SAME"}}else{if("valid"!==e)throw Error(`Unknown padding parameter: ${e}`);p={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},f=Math.ceil((t-i+1)/a),m=Math.ceil((n-l+1)/s),g=Math.ceil((r-c+1)/o)}return{padInfo:p,outDepth:f,outHeight:m,outWidth:g}}(a,c,f,m,w,T,S,k,E,N,i),O=s?v*g:v;let P;return"channelsFirst"===o?P=[l,O,R,D,M]:"channelsLast"===o&&(P=[l,R,D,M,O]),{batchSize:l,dataFormat:o,inDepth:c,inHeight:f,inWidth:m,inChannels:g,outDepth:R,outHeight:D,outWidth:M,outChannels:O,padInfo:B,strideDepth:w,strideHeight:T,strideWidth:S,filterDepth:y,filterHeight:b,filterWidth:x,effectiveFilterDepth:k,effectiveFilterHeight:E,effectiveFilterWidth:N,dilationDepth:A,dilationHeight:C,dilationWidth:I,inShape:e,outShape:P,filterShape:t}}function u(e,t,n,r=1){const a=p(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}function c(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function d(e){return"number"==typeof e?[e,e,e]:e}function p(e,t){return t<=1?e:e+(e-1)*(t-1)}function h(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function f(e){const[t,n,r]=c(e);return 1===t&&1===n&&1===r}function m(e,t){return f(e)||f(t)}function g(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function y(e,t,n){if(null!=n){if("string"==typeof t)throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);if("number"==typeof t)r.hu(r.GN(t),(()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`));else{if("object"!=typeof t)throw Error(`Error in ${e}: Unknown padding parameter: ${t}`);t.forEach((t=>{t.forEach((t=>{r.hu(r.GN(t),(()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`))}))}))}}}},4718:(e,t,n)=>{n.d(t,{B:()=>c});var r=n(7097),a=n(9121),s=n(3740),o=n(569),i=n(2582),l=n(2668),u=n(4968);const c=(0,l.op)({depthwiseConv2d_:function(e,t,n,l,c="NHWC",d=[1,1],p){const h=(0,s._1)(e,"x","depthwiseConv2d","float32"),f=(0,s._1)(t,"filter","depthwiseConv2d","float32");let m=h,g=!1;3===h.rank&&(g=!0,m=(0,u.X)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),o.hu(4===m.rank,(()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${m.rank}.`)),o.hu(4===f.rank,(()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${f.rank}.`));const y="NHWC"===c?m.shape[3]:m.shape[1];o.hu(y===f.shape[2],(()=>`Error in depthwiseConv2d: number of input channels (${y}) must match the inChannels dimension in filter ${f.shape[2]}.`)),i.m("depthwiseConv2d",l,p);const b={x:m,filter:f},x={strides:n,pad:l,dataFormat:c,dilations:d,dimRoundingMode:p},v=r.BV.runKernel(a.cie,b,x);return g?(0,u.X)(v,[v.shape[1],v.shape[2],v.shape[3]]):v}})},3233:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({elu_:function(e){const t={x:(0,s._1)(e,"x","elu","float32")};return r.BV.runKernel(a.SX0,t)}})},8810:(e,t,n)=>{n.d(t,{T:()=>b});var r=n(7097),a=n(633),s=n(9121),o=n(747),i=n(3740),l=n(569),u=n(6407),c=n(2200),d=n(4794),p=n(2582),h=n(2668),f=n(4968);const m=(0,h.op)({conv2DBackpropFilter_:function(e,t,n,a,o,i="NHWC",u){let c=e;3===e.rank&&(c=(0,f.X)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let d=t;3===d.rank&&(d=(0,f.X)(t,[1,t.shape[0],t.shape[1],t.shape[2]])),l.hu(4===c.rank,(()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${c.shape}.`)),l.hu(4===d.rank,(()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${d.shape}.`)),l.hu(4===n.length,(()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`));const h="NHWC"===i?c.shape[3]:c.shape[1],m="NHWC"===i?d.shape[3]:d.shape[1];l.hu(h===n[2],(()=>`Error in conv2dDerFilter: depth of input ${h}) must match input depth in filter (${n[2]}.`)),l.hu(m===n[3],(()=>`Error in conv2dDerFilter: depth of dy (${m}) must match output depth for filter (${n[3]}).`)),p.m("conv2dDerFilter",o,u);const g={x:c,dy:d},y={strides:a,pad:o,dataFormat:i,dimRoundingMode:u,filterShape:n};return r.BV.runKernel(s.wUP,g,y)}});var g=n(9832),y=n(9323);const b=(0,h.op)({fusedConv2d_:function({x:e,filter:t,strides:n,pad:h,dataFormat:b="NHWC",dilations:x=[1,1],dimRoundingMode:v,bias:w,activation:T="linear",preluActivationWeights:S,leakyreluAlpha:A}){if(T=T||"linear",!1===(0,y.uy)(r.BV.state.gradientDepth,T)){l.hu("NHWC"===b,(()=>`Error in fused conv2d: got dataFormat of ${b} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`));let r=(0,d.T)(e,t,n,h,b,x,v);return null!=w&&(r=(0,u.I)(r,w)),(0,y.QH)(r,T,S,A)}const C=(0,i._1)(e,"x","conv2d","float32"),I=(0,i._1)(t,"filter","conv2d","float32");let k=C,E=!1;3===C.rank&&(E=!0,k=(0,f.X)(C,[1,C.shape[0],C.shape[1],C.shape[2]])),l.hu(4===k.rank,(()=>`Error in fused conv2d: input must be rank 4, but got rank ${k.rank}.`)),l.hu(4===I.rank,(()=>`Error in fused conv2d: filter must be rank 4, but got rank ${I.rank}.`)),p.m("fused conv2d",h,v);const N="NHWC"===b?k.shape[3]:k.shape[1];l.hu(I.shape[2]===N,(()=>`Error in conv2d: depth of input (${N}) must match input depth for filter ${I.shape[2]}.`)),l.hu(p.jT(n,x),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${x}'`));const B=p.Ix(k.shape,I.shape,n,x,h,v);let R,D;if(null!=w&&(R=(0,i._1)(w,"bias","fused conv2d"),[R]=(0,o.makeTypesMatch)(R,C),"NHWC"===b?c.assertAndGetBroadcastShape(B.outShape,R.shape):(l.hu(R.shape.length<=1,(()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${R.shape.length}.`)),l.hu(0===R.shape.length||R.shape[0]===B.outChannels||1===R.shape[0],(()=>`Error in fused conv2d: bias shape (${R.shape}) is not compatible with the number of output channels (${B.outChannels})`)))),null!=S){const e=S.shape;if(l.hu(e.length<=1||3===e.length,(()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${e.length}.`)),1===e.length)l.hu(1===e[0]||e[0]===B.outChannels,(()=>`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the number of output channels (${B.outChannels}).`));else if(3===e.length)try{c.assertAndGetBroadcastShape(e,B.outShape)}catch(t){const n=`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the output shape of the conv2d (${B.outShape}).`;throw Error(n)}D=(0,i._1)(S,"prelu weights","fused conv2d")}const M=(e,t)=>{l.hu("NHWC"===b,(()=>`Error in gradient of fused conv2D: got dataFormat of ${b} but only NHWC is currently supported.`));const[r,a,s,o]=t,i=(0,y.Fr)(e,s,T);l.hu(p.I0(x),(()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${x}'`));const u=[(0,g._)(a.shape,i,r,n,h),m(a,i,r.shape,n,h)];if(null!=o){const e=(0,y.pf)(o,i);u.push(e)}return u},O={x:k,filter:I,bias:R,preluActivationWeights:D},P={strides:n,pad:h,dataFormat:b,dilations:x,dimRoundingMode:v,activation:T,leakyreluAlpha:A};if(null==w){const e=(0,a.cb)(((e,t,n)=>{let a=r.BV.runKernel(s._V0,O,P);return n([t,e,a]),E&&(a=(0,f.X)(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:M}}));return e(k,I)}{const e=(0,a.cb)(((e,t,n,a)=>{let o=r.BV.runKernel(s._V0,O,P);return a([t,e,o,n]),E&&(o=(0,f.X)(o,[o.shape[1],o.shape[2],o.shape[3]])),{value:o,gradFunc:M}}));return e(k,I,R)}}})},59:(e,t,n)=>{n.d(t,{B:()=>b});var r=n(7097),a=n(633),s=n(9121),o=n(747),i=n(3740),l=n(569),u=n(6407),c=n(2200),d=n(2582),p=n(4718),h=n(2668),f=n(4968);const m=(0,h.op)({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,a,o,i=[1,1],l){let u=e;3===e.rank&&(u=(0,f.X)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let c=t;3===c.rank&&(c=(0,f.X)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const d={x:u,dy:c},p={strides:a,pad:o,dimRoundingMode:l,dilations:i,filterShape:n};return r.BV.runKernel(s.sL$,d,p)}});const g=(0,h.op)({depthwiseConv2dNativeBackpropInput_:function(e,t,n,a,o,i=[1,1],l){let u=t,c=!1;3===t.rank&&(c=!0,u=(0,f.X)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const d={dy:u,filter:n},p={strides:a,pad:o,dimRoundingMode:l,dilations:i,inputShape:e},h=r.BV.runKernel(s.y7R,d,p);return c?(0,f.X)(h,[h.shape[1],h.shape[2],h.shape[3]]):h}});var y=n(9323);const b=(0,h.op)({fusedDepthwiseConv2d_:function({x:e,filter:t,strides:n,pad:h,dataFormat:b="NHWC",dilations:x=[1,1],dimRoundingMode:v,bias:w,activation:T="linear",preluActivationWeights:S,leakyreluAlpha:A}){if(!1===(0,y.uy)(r.BV.state.gradientDepth,T)){let r=(0,p.B)(e,t,n,h,b,x,v);return null!=w&&(r=(0,u.I)(r,w)),(0,y.QH)(r,T,S,A)}const C=(0,i._1)(e,"x","depthwiseConv2d","float32"),I=(0,i._1)(t,"filter","depthwiseConv2d","float32");let k=C,E=!1;3===C.rank&&(E=!0,k=(0,f.X)(C,[1,C.shape[0],C.shape[1],C.shape[2]])),l.hu(4===k.rank,(()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${k.rank}.`)),l.hu(4===I.rank,(()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${I.rank}.`)),l.hu(k.shape[3]===I.shape[2],(()=>`Error in fused depthwiseConv2d: number of input channels (${k.shape[3]}) must match the inChannels dimension in filter ${I.shape[2]}.`)),null==x&&(x=[1,1]),l.hu(d.jT(n,x),(()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${x}'`)),d.m("fused depthwiseConv2d",h,v);const N=d.Ix(k.shape,I.shape,n,x,h,v,!0);let B,R;null!=w&&(B=(0,i._1)(w,"bias","fused conv2d"),[B]=(0,o.makeTypesMatch)(B,C),c.assertAndGetBroadcastShape(N.outShape,B.shape)),null!=S&&(R=(0,i._1)(S,"prelu weights","fused depthwiseConv2d"));const D=(e,t)=>{l.hu(d.I0(x),(()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${x}'`));const[r,a,s,o]=t,i=(0,y.Fr)(e,s,T),u=g(a.shape,i,r,n,h,x,v),c=m(a,i,r.shape,n,h,x,v);if(null!=o){return[u,c,(0,y.pf)(B,i)]}return[u,c]},M={x:k,filter:I,bias:B,preluActivationWeights:R},O={strides:n,pad:h,dataFormat:b,dilations:x,dimRoundingMode:v,activation:T,leakyreluAlpha:A};if(null==w){const e=(0,a.cb)(((e,t,n)=>{let a=r.BV.runKernel(s.luS,M,O);return n([t,e,a]),E&&(a=(0,f.X)(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:D}}));return e(k,I)}{const e=(0,a.cb)(((e,t,n,a)=>{let o=r.BV.runKernel(s.luS,M,O);return a([t,e,o,n]),E&&(o=(0,f.X)(o,[o.shape[1],o.shape[2],o.shape[3]])),{value:o,gradFunc:D}}));return e(k,I,B)}}})},5901:(e,t,n)=>{n.d(t,{O:()=>m});var r=n(7097),a=n(633),s=n(9121),o=n(747),i=n(3740),l=n(569),u=n(6407),c=n(2200),d=n(9323),p=n(8687),h=n(2668),f=n(4968);const m=(0,h.op)({fusedMatMul_:function({a:e,b:t,transposeA:n=!1,transposeB:h=!1,bias:m,activation:g="linear",preluActivationWeights:y,leakyreluAlpha:b=.2}){if(!1===(0,d.uy)(r.BV.state.gradientDepth,g)){let r=(0,p.O)(e,t,n,h);return null!=m&&(r=(0,u.I)(r,m)),(0,d.QH)(r,g,y,b)}let x=(0,i._1)(e,"a","fused matMul"),v=(0,i._1)(t,"b","fused matMul");[x,v]=(0,o.makeTypesMatch)(x,v);const w=n?x.shape[x.rank-2]:x.shape[x.rank-1],T=h?v.shape[v.rank-1]:v.shape[v.rank-2],S=n?x.shape[x.rank-1]:x.shape[x.rank-2],A=h?v.shape[v.rank-2]:v.shape[v.rank-1],C=x.shape.slice(0,-2),I=v.shape.slice(0,-2),k=l.NA(C),E=l.NA(I);l.hu(w===T,(()=>`Error in fused matMul: inner shapes (${w}) and (${T}) of Tensors with shapes ${x.shape} and ${v.shape} and transposeA=${n} and transposeB=${h} must match.`));const N=c.assertAndGetBroadcastShape(x.shape.slice(0,-2),v.shape.slice(0,-2)).concat([S,A]),B=n?(0,f.X)(x,[k,w,S]):(0,f.X)(x,[k,S,w]),R=h?(0,f.X)(v,[E,A,T]):(0,f.X)(v,[E,T,A]);let D,M;null!=m&&(D=(0,i._1)(m,"bias","fused matMul"),[D]=(0,o.makeTypesMatch)(D,x),c.assertAndGetBroadcastShape(N,D.shape)),null!=y&&(M=(0,i._1)(y,"prelu weights","fused matMul"));const O=(e,t)=>{const[r,a,s,o]=t,i=(0,d.Fr)((0,f.X)(e,s.shape),s,g);let l,u;if(n||h?!n&&h?(l=(0,p.O)(i,a,!1,!1),u=(0,p.O)(i,r,!0,!1)):n&&!h?(l=(0,p.O)(a,i,!1,!0),u=(0,p.O)(r,i,!1,!1)):(l=(0,p.O)(a,i,!0,!0),u=(0,p.O)(i,r,!0,!0)):(l=(0,p.O)(i,a,!1,!0),u=(0,p.O)(r,i,!0,!1)),null!=m){return[l,u,(0,d.pf)(o,i)]}return[l,u]},P={a:B,b:R,bias:D,preluActivationWeights:M},$={transposeA:n,transposeB:h,activation:g,leakyreluAlpha:b};if(null==m){const e=(0,a.cb)(((e,t,n)=>{const a=r.BV.runKernel(s.usg,P,$);return n([e,t,a]),{value:(0,f.X)(a,N),gradFunc:O}}));return e(B,R)}{const e=(0,a.cb)(((e,t,n,a)=>{const o=r.BV.runKernel(s.usg,P,$);return a([e,t,o,n]),{value:(0,f.X)(o,N),gradFunc:O}}));return e(B,R,D)}}})},9323:(e,t,n)=>{n.d(t,{Fr:()=>f,QH:()=>g,pf:()=>m,uy:()=>y});var r=n(2200),a=n(3233),s=n(9133),o=n(4841),i=n(8151),l=n(7409),u=n(3582),c=n(4968),d=n(625),p=n(1901),h=n(5475);function f(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return(0,o.d)(e,(0,p.N)(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function m(e,t){let n=t;const a=r.getReductionAxes(e.shape,t.shape);return a.length>0&&(n=(0,h.S)(n,a)),(0,c.X)(n,e.shape)}function g(e,t,n,r){if("linear"===t)return e;if("relu"===t)return(0,l.U)(e);if("elu"===t)return(0,a.p)(e);if("relu6"===t)return(0,u.b)(e);if("prelu"===t)return(0,i.A)(e,n);if("leakyrelu"===t)return(0,s.h)(e,r);if("sigmoid"===t)return(0,d.X)(e);throw new Error(`Unknown fused activation ${t}.`)}const y=(e,t)=>!(e>0)||"linear"===t},9133:(e,t,n)=>{n.d(t,{h:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({leakyRelu_:function(e,t=.2){const n={x:(0,s._1)(e,"x","leakyRelu")},o={alpha:t};return r.BV.runKernel(a.J$2,n,o)}})},8687:(e,t,n)=>{n.d(t,{O:()=>i});var r=n(7097),a=n(9121),s=n(747),o=n(3740);const i=(0,n(2668).op)({matMul_:function(e,t,n=!1,i=!1){let l=(0,o._1)(e,"a","matMul"),u=(0,o._1)(t,"b","matMul");[l,u]=(0,s.makeTypesMatch)(l,u);const c={a:l,b:u},d={transposeA:n,transposeB:i};return r.BV.runKernel(a.XLW,c,d)}})},3307:(e,t,n)=>{n.d(t,{F:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({max_:function(e,t=null,n=!1){const o={x:(0,s._1)(e,"x","max")},i={reductionIndices:t,keepDims:n};return r.BV.runKernel(a.YoZ,o,i)}})},1174:(e,t,n)=>{n.d(t,{_:()=>c});var r=n(7097),a=n(9121),s=n(3740),o=n(569),i=n(2582),l=n(2668),u=n(4968);const c=(0,l.op)({maxPool_:function(e,t,n,l,c){const d=(0,s._1)(e,"x","maxPool");let p=d,h=!1;3===d.rank&&(h=!0,p=(0,u.X)(d,[1,d.shape[0],d.shape[1],d.shape[2]])),o.hu(4===p.rank,(()=>`Error in maxPool: input must be rank 4 but got rank ${p.rank}.`)),o.hu(i.jT(n,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`)),i.m("maxPool",l,c);const f={x:p},m={filterSize:t,strides:n,pad:l,dimRoundingMode:c},g=r.BV.runKernel(a.mTV,f,m);return h?(0,u.X)(g,[g.shape[1],g.shape[2],g.shape[3]]):g}})},5130:(e,t,n)=>{n.d(t,{J:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({mean_:function(e,t=null,n=!1){const o={x:(0,s._1)(e,"x","mean")},i={axis:t,keepDims:n};return r.BV.runKernel(a.q2K,o,i)}})},4841:(e,t,n)=>{n.d(t,{d:()=>i});var r=n(7097),a=n(9121),s=n(747),o=n(3740);const i=(0,n(2668).op)({mul_:function(e,t){let n=(0,o._1)(e,"a","mul"),i=(0,o._1)(t,"b","mul");[n,i]=(0,s.makeTypesMatch)(n,i);const l={a:n,b:i};return r.BV.runKernel(a.wYn,l)}})},2668:(e,t,n)=>{n.d(t,{op:()=>o,z:()=>s});var r=n(7097),a=n(569);const s="__op";function o(e){const t=Object.keys(e);if(1!==t.length)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0];const o=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+=s;const i=(...e)=>{r.BV.startScope(n);try{const t=o(...e);return(0,a.tI)(t)&&console.error("Cannot return a Promise inside of tidy."),r.BV.endScope(t),t}catch(e){throw r.BV.endScope(null),e}};return Object.defineProperty(i,"name",{value:n,configurable:!0}),i}},9682:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({pad_:function(e,t,n=0){const o=(0,s._1)(e,"x","pad");if(0===o.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const i={paddings:t,constantValue:n},l={x:o};return r.BV.runKernel(a.lyA,l,i)}})},8151:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({prelu_:function(e,t){const n={x:(0,s._1)(e,"x","prelu"),alpha:(0,s._1)(t,"alpha","prelu")};return r.BV.runKernel(a.o0g,n)}})},9798:(e,t,n)=>{function r(e,t=!1){console.log(e.toString(t))}n.d(t,{S:()=>r})},7409:(e,t,n)=>{n.d(t,{U:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({relu_:function(e){const t={x:(0,s._1)(e,"x","relu")};return r.BV.runKernel(a.qkr,t)}})},3582:(e,t,n)=>{n.d(t,{b:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({relu6_:function(e){const t={x:(0,s._1)(e,"x","relu6")};return r.BV.runKernel(a.SbG,t)}})},4968:(e,t,n)=>{n.d(t,{X:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({reshape_:function(e,t){const n={x:(0,s._1)(e,"x","reshape","string_or_numeric")},o={shape:t};return r.BV.runKernel(a.HZH,n,o)}})},9494:(e,t,n)=>{n.d(t,{i:()=>s});var r=n(569),a=n(7852);function s(e,t){if(((0,r.fU)(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&(0,r.fU)(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return(0,a.H)(e,[],[],t)}},625:(e,t,n)=>{n.d(t,{X:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({sigmoid_:function(e){const t={x:(0,s._1)(e,"x","sigmoid","float32")};return r.BV.runKernel(a.a5O,t)}})},682:(e,t,n)=>{n.d(t,{X:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({softmax_:function(e,t=-1){const n=(0,s._1)(e,"logits","softmax","float32");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);const o={logits:n},i={dim:t};return r.BV.runKernel(a.Gcp,o,i)}})},9590:(e,t,n)=>{n.d(t,{L:()=>i});var r=n(3740),a=n(569),s=n(2668),o=n(4968);const i=(0,s.op)({squeeze_:function(e,t){const n=(0,r._1)(e,"x","squeeze","string_or_numeric");return(0,o.X)(n,(0,a.bp)(n.shape,t).newShape)}})},2991:(e,t,n)=>{n.d(t,{k:()=>i});var r=n(7097),a=n(9121),s=n(3740),o=n(569);const i=(0,n(2668).op)({stack_:function(e,t=0){const n=(0,s.sI)(e,"tensors","stack","string_or_numeric");o.hu(n.length>=1,(()=>"Pass at least one tensor to tf.stack")),n.length>0&&o.hu(t<=n[0].rank,(()=>"Axis must be <= rank of the tensor"));const i=n,l={axis:t};return r.BV.runKernel(a.QiL,i,l)}})},1901:(e,t,n)=>{n.d(t,{N:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({step_:function(e,t=0){const n={x:(0,s._1)(e,"x","step")},o={alpha:t};return r.BV.runKernel(a.h8e,n,o)}})},5158:(e,t,n)=>{n.d(t,{N:()=>o});var r=n(7097),a=n(9121),s=n(3740);const o=(0,n(2668).op)({stridedSlice_:function(e,t,n,o,i=0,l=0,u=0,c=0,d=0){const p={x:(0,s._1)(e,"x","stridedSlice","string_or_numeric")},h={begin:t,end:n,strides:o,beginMask:i,endMask:l,ellipsisMask:u,newAxisMask:c,shrinkAxisMask:d};return r.BV.runKernel(a.jQk,p,h)}})},5475:(e,t,n)=>{n.d(t,{S:()=>i});var r=n(7097),a=n(9121),s=n(3740),o=n(2271);const i=(0,n(2668).op)({sum_:function(e,t=null,n=!1){let i=(0,s._1)(e,"x","sum");"bool"===i.dtype&&(i=(0,o.p)(i,"int32"));const l={x:i},u={axis:t,keepDims:n};return r.BV.runKernel(a.GBy,l,u)}})},701:(e,t,n)=>{n.d(t,{X:()=>s});var r=n(3740),a=n(7852);function s(e,t,n){const s=(0,r.C)(e,n);return(0,a.H)(e,t,s,n)}},6092:(e,t,n)=>{n.d(t,{R:()=>o});var r=n(3740),a=n(569),s=n(7852);function o(e,t){(0,a.Cq)(e);const n=(0,r.C)(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return(0,s.H)(e,null,n,t)}},7852:(e,t,n)=>{n.d(t,{H:()=>o});var r=n(7097),a=n(569),s=n(9122);function o(e,t,n,o){if(null==o&&(o=(0,a.D2)(e)),"complex64"===o)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!(0,a.fU)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){(0,a.Mu)(t);const e=(0,a.NA)(t),r=(0,a.NA)(n);(0,a.hu)(e===r,(()=>`Based on the provided shape, [${t}], the tensor should have ${e} values but has ${r}`));for(let e=0;e<n.length;++e){const r=n[e],s=e!==n.length-1||r!==(0,a.NA)(t.slice(e));(0,a.hu)(n[e]===t[e]||!s,(()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `))}}return(0,a.fU)(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==o?(0,s.toTypedArray)(e,o):(0,a.xH)(e,[],!0),r.BV.makeTensor(e,t,o)}},4077:(e,t,n)=>{n.d(t,{es:()=>b,YD:()=>d,_w:()=>x,FZ:()=>y,Vp:()=>g,Vi:()=>m});var r=n(5938),a=n(569);function s(e,t,n,r){const s=(0,a.e3)(t),i=function(e,t,n,r){const s=(0,a.NA)(t),i=r[r.length-1],l=new Array(i).fill(0),c=t.length,d="complex64"===n?u(e):e;if(c>1)for(let e=0;e<s/i;e++){const t=e*i;for(let e=0;e<i;e++)l[e]=Math.max(l[e],o(d[t+e],0,n).length)}return l}(e,t,n,s),c=t.length,d=l(e,t,n,s,i),p=["Tensor"];return r&&(p.push(` dtype: ${n}`),p.push(` rank: ${c}`),p.push(` shape: [${t}]`),p.push(" values:")),p.push(d.map((e=>" "+e)).join("\n")),p.join("\n")}function o(e,t,n){let r;return r=Array.isArray(e)?`${parseFloat(e[0].toFixed(7))} + ${parseFloat(e[1].toFixed(7))}j`:(0,a.HD)(e)?`'${e}'`:"bool"===n?i(e):parseFloat(e.toFixed(7)).toString(),(0,a.oj)(r,t)}function i(e){return 0===e?"false":"true"}function l(e,t,n,r,a,s=!0){const c="complex64"===n?2:1,d=t[0],p=t.length;if(0===p){if("complex64"===n){return[o(u(e)[0],0,n)]}return"bool"===n?[i(e[0])]:[e[0].toString()]}if(1===p){if(d>20){const t=3*c;let r=Array.from(e.slice(0,t)),s=Array.from(e.slice((d-3)*c,d*c));return"complex64"===n&&(r=u(r),s=u(s)),["["+r.map(((e,t)=>o(e,a[t],n))).join(", ")+", ..., "+s.map(((e,t)=>o(e,a[d-3+t],n))).join(", ")+"]"]}return["["+("complex64"===n?u(e):Array.from(e)).map(((e,t)=>o(e,a[t],n))).join(", ")+"]"]}const h=t.slice(1),f=r.slice(1),m=r[0]*c,g=[];if(d>20){for(let t=0;t<3;t++){const r=t*m,s=r+m;g.push(...l(e.slice(r,s),h,n,f,a,!1))}g.push("...");for(let t=d-3;t<d;t++){const r=t*m,s=r+m;g.push(...l(e.slice(r,s),h,n,f,a,t===d-1))}}else for(let t=0;t<d;t++){const r=t*m,s=r+m;g.push(...l(e.slice(r,s),h,n,f,a,t===d-1))}const y=2===p?",":"";g[0]="["+g[0]+y;for(let e=1;e<g.length-1;e++)g[e]=" "+g[e]+y;let b=",\n";for(let e=2;e<p;e++)b+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(s?"":b),g}function u(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var c=n(9122);class d{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=a.NA(e),null!=n){const e=n.length;a.hu(e===this.size,(()=>`Length of values '${e}' does not match the size inferred by the shape '${this.size}'.`))}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||a.rQ(t,this.size),this.strides=(0,a.e3)(e)}set(e,...t){0===t.length&&(t=[0]),a.hu(t.length===this.rank,(()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`));const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const n of e){if(n<0||n>=this.shape[t]){const t=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(t)}t++}let n=e[e.length-1];for(let t=0;t<e.length-1;++t)n+=this.strides[t]*e[t];return this.values[n]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return p().makeTensor(this.values,this.shape,this.dtype)}}let p=null,h=null,f=null;function m(e){p=e}function g(e){h=e}function y(e){f=e}class b{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=a.NA(e),this.strides=(0,a.e3)(e),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return h.buffer(this.shape,this.dtype,e)}bufferSync(){return h.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return(0,a.GX)(this.shape,e,"complex64"===this.dtype)}arraySync(){return(0,a.GX)(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=p().read(this.dataId);if("string"===this.dtype){const t=await e;try{return t.map((e=>c.decodeString(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),p().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=p().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>c.decodeString(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await p().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(p().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return h.print(this,e)}clone(){return this.throwIfDisposed(),h.clone(this)}toString(e=!1){return s(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),h.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),p().makeVariable(this,e,t,n)}}Object.defineProperty(b,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),(0,r.R)("Tensor",(()=>b));class x extends b{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!a.cO(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);p().disposeTensor(this),this.dataId=e.dataId,p().incRef(this,null)}dispose(){p().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(x,Symbol.hasInstance,{value:e=>e instanceof b&&null!=e.assign&&e.assign instanceof Function})},747:(e,t,n)=>{n.r(t),n.d(t,{assertTypesMatch:()=>i,getTensorsInContainer:()=>u,isTensorInList:()=>l,makeTypesMatch:()=>o});var r=n(4077),a=n(1221),s=n(569);function o(e,t){if(e.dtype===t.dtype)return[e,t];const n=(0,a.x8)(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function i(e,t){(0,s.hu)(e.dtype===t.dtype,(()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`))}function l(e,t){return t.some((t=>t.id===e.id))}function u(e){const t=[];return c(e,t,new Set),t}function c(e,t,n){if(null==e)return;if(e instanceof r.es)return void t.push(e);if(a=e,!Array.isArray(a)&&"object"!=typeof a)return;var a;const s=e;for(const e in s){const r=s[e];n.has(r)||(n.add(r),c(r,t,n))}}},3740:(e,t,n)=>{n.d(t,{C:()=>l,_1:()=>d,sI:()=>p});var r=n(7097),a=n(2885),s=n(4077),o=n(569),i=n(9122);function l(e,t){let n=e;if((0,o.fU)(e))return"string"===t?[]:[e.length];if(!Array.isArray(e))return[];const r=[];for(;Array.isArray(n)||(0,o.fU)(n)&&"string"!==t;)r.push(n.length),n=n[0];return Array.isArray(e)&&(0,a.OB)().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&u(e,r,[]),r}function u(e,t,n){if(n=n||[],!Array.isArray(e)&&!(0,o.fU)(e))return void(0,o.hu)(0===t.length,(()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`));(0,o.hu)(t.length>0,(()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`)),(0,o.hu)(e.length===t[0],(()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`));const r=t.slice(1);for(let t=0;t<e.length;++t)u(e[t],r,n.concat(t))}function c(e,t,n,r){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error(`Argument '${n}' passed to '${r}' must be ${e} tensor, but got ${t} tensor`)}}function d(e,t,n,a="numeric"){if(e instanceof s.es)return c(a,e.dtype,t,n),e;let u=(0,o.D2)(e);if("string"!==u&&["bool","int32","float32"].indexOf(a)>=0&&(u=a),c(a,u,t,n),null==e||!(0,o.fU)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){const r=null==e?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${r}'`)}const d=l(e,u);(0,o.fU)(e)||Array.isArray(e)||(e=[e]);const p="string"!==u?(0,i.toTypedArray)(e,u):(0,o.xH)(e,[],!0);return r.BV.makeTensor(p,d,u)}function p(e,t,n,r="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map(((e,a)=>d(e,`${t}[${a}]`,n,r)))}},1221:(e,t,n)=>{var r,a,s,o,i;n.d(t,{x8:()=>u,yw:()=>r,z4:()=>c}),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(r||(r={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(a||(a={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(s||(s={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(o||(o={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(i||(i={}));const l={float32:o,int32:a,bool:s,complex64:i};function u(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return l[e][t]}function c(e){return u(e,"int32")}},9122:(e,t,n)=>{n.r(t),n.d(t,{arraysEqual:()=>a.cO,assert:()=>a.hu,assertNonNegativeIntegerDimensions:()=>a.Mu,assertNonNull:()=>a.Cq,assertShapesMatch:()=>a.k5,bytesFromStringArray:()=>a.Ub,bytesPerElement:()=>a.bT,checkConversionForErrors:()=>a.D5,clamp:()=>a.uZ,computeStrides:()=>a.e3,createScalarValue:()=>x,createShuffledIndices:()=>a.U$,decodeString:()=>A,distSquared:()=>a.E7,encodeString:()=>S,fetch:()=>T,fingerPrint64:()=>b,flatten:()=>a.xH,getArrayFromDType:()=>a.rQ,getTypedArrayFromDType:()=>a.WP,hasEncodingLoss:()=>a.QB,hexToLong:()=>i,indexToLoc:()=>a.NE,inferDtype:()=>a.D2,inferFromImplicitShape:()=>a.JZ,isBoolean:()=>a.jn,isFunction:()=>a.mf,isInt:()=>a.GN,isNumber:()=>a.hj,isPromise:()=>a.tI,isScalarShape:()=>a.N9,isString:()=>a.HD,isTypedArray:()=>a.fU,isValidDtype:()=>a.LP,locToIndex:()=>a.qy,makeOnesTypedArray:()=>a.p8,makeZerosNestedTypedArray:()=>a.l6,makeZerosTypedArray:()=>a.wT,nearestDivisor:()=>a.jP,nearestLargerEven:()=>a.nY,now:()=>w,parseAxisParam:()=>a.EC,randUniform:()=>a.bj,repeatedTry:()=>a.WD,rightPad:()=>a.oj,shuffle:()=>a.TV,shuffleCombo:()=>a.d7,sizeFromShape:()=>a.NA,sizeToSquarishShape:()=>a.YP,squeezeShape:()=>a.bp,sum:()=>a.Sm,swap:()=>a.LF,tanh:()=>a.AE,toNestedArray:()=>a.GX,toTypedArray:()=>v});var r=n(2885),a=n(569),s=n(3720);const o=n.n(s)()||s;function i(e){return o.fromString(e,!0,16)}const l=i("c3a5c85c97cb3127"),u=i("b492b66fbe98f273"),c=i("9ae16a3b2f90404f");function d(e){return e.xor(e.shru(47))}function p(e,t,n){const r=e.slice(t,t+n);return o.fromBytes(Array.from(r),!0,!0)}function h(e,t){return p(e,t,8)}function f(e,t){return p(e,t,4)}function m(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function g(e,t,n=i("9ddfea08eb382d69")){let r=e.xor(t).mul(n);r=r.xor(r.shru(47));let a=t.xor(r).mul(n);return a=a.xor(a.shru(47)),a=a.mul(n),a}function y(e,t,n,r){return function(e,t,n,r,a,s){a=a.add(e),s=m(s.add(a).add(r),21);const o=a;return a=(a=a.add(t)).add(n),s=s.add(m(a,44)),[a.add(r),s.add(o)]}(h(e,t),h(e,t+8),h(e,t+16),h(e,t+24),n,r)}function b(e,t=e.length){const n=o.fromNumber(81,!0);if(t<=32)return t<=16?function(e,t=e.length){if(t>=8){const n=c.add(2*t),r=h(e,0).add(c),a=h(e,t-8);return g(m(a,37).mul(n).add(r),m(r,25).add(a).mul(n),n)}if(t>=4){const n=c.add(2*t);return g(f(e,0).shl(3).add(t),f(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),r=t+(e[t-1]<<2);return d(c.mul(n).xor(l.mul(r))).mul(c)}return c}(e,t):function(e,t=e.length){const n=c.add(2*t),r=h(e,0).mul(u),a=h(e,8),s=h(e,t-8).mul(n),o=h(e,t-16).mul(c);return g(m(r.add(a),43).add(m(s,30)).add(o),r.add(m(a.add(c),18)).add(s),n)}(e,t);if(t<=64)return function(e,t=e.length){const n=c.add(2*t),r=h(e,0).mul(c),a=h(e,8),s=h(e,t-8).mul(n),o=h(e,t-16).mul(c),i=m(r.add(a),43).add(m(s,30)).add(o),l=g(i,r.add(m(a.add(c),18)).add(s),n),u=h(e,16).mul(n),d=h(e,24),p=i.add(h(e,t-32)).mul(n),f=l.add(h(e,t-24)).mul(n);return g(m(u.add(d),43).add(m(p,30)).add(f),u.add(m(d.add(r),18)).add(p),n)}(e,t);let r=n,a=n.mul(u).add(113),s=d(a.mul(c).add(113)).mul(c),i=[o.UZERO,o.UZERO],p=[o.UZERO,o.UZERO];r=r.mul(c).add(h(e,0));let b=0;const x=64*(t-1>>6),v=x+(t-1&63)-63;do{r=m(r.add(a).add(i[0]).add(h(e,b+8)),37).mul(u),a=m(a.add(i[1]).add(h(e,b+48)),42).mul(u),r=r.xor(p[1]),a=a.add(i[0]).add(h(e,b+40)),s=m(s.add(p[0]),33).mul(u),i=y(e,b,i[1].mul(u),r.add(p[0])),p=y(e,b+32,s.add(p[1]),a.add(h(e,b+16))),[s,r]=[r,s],b+=64}while(b!==x);const w=u.add(s.and(255).shl(1));return b=v,p[0]=p[0].add(t-1&63),i[0]=i[0].add(p[0]),p[0]=p[0].add(i[0]),r=m(r.add(a).add(i[0]).add(h(e,b+8)),37).mul(w),a=m(a.add(i[1]).add(h(e,b+48)),42).mul(w),r=r.xor(p[1].mul(9)),a=a.add(i[0].mul(9).add(h(e,b+40))),s=m(s.add(p[0]),33).mul(w),i=y(e,b,i[1].mul(w),r.add(p[0])),p=y(e,b+32,s.add(p[1]),a.add(h(e,b+16))),[s,r]=[r,s],g(g(i[0],p[0],w).add(d(a).mul(l)).add(s),g(i[1],p[1],w).add(r),w)}function x(e,t){return"string"===t?S(e):v([e],t)}function v(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=a.xH(e)),(0,r.OB)().getBool("DEBUG")&&a.D5(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error(`Unknown data type ${t}`)}function w(){return(0,r.OB)().platform.now()}function T(e,t){return(0,r.OB)().platform.fetch(e,t)}function S(e,t="utf-8"){return t=t||"utf-8",(0,r.OB)().platform.encode(e,t)}function A(e,t="utf-8"){return t=t||"utf-8",(0,r.OB)().platform.decode(e,t)}},569:(e,t,n)=>{function r(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,i(e,t,n)}function a(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,r=0;for(;n>0;)r=Math.random()*n|0,n--,i(e,n,r),i(t,n,r)}function s(e,t,n){return Math.max(e,Math.min(t,n))}function o(e){return e%2==0?e:e+1}function i(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function l(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function u(e,t){const n=Math.random();return t*n+(1-n)*e}function c(e,t){let n=0;for(let r=0;r<e.length;r++){const a=Number(e[r])-Number(t[r]);n+=a*a}return n}function d(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function p(e,t,n=""){d(y(e,t),(()=>n+` Shapes ${e} and ${t} must match`))}function h(e){d(null!=e,(()=>"The input to the tensor constructor must be a non-null value."))}function f(e,t=[],n=!1){if(null==t&&(t=[]),Array.isArray(e)||D(e)&&!n)for(let r=0;r<e.length;++r)f(e[r],t,n);else t.push(e);return t}function m(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function g(e){return 0===e.length}function y(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function b(e){return e%1==0}function x(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{const t=Math.exp(2*e);return(t-1)/(t+1)}}function v(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function w(e){const t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return r(t),t}function T(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function S(e,t=(e=>0),n,r=setTimeout){return new Promise(((a,s)=>{let o=0;const i=()=>{if(e())return void a();o++;const l=t(o);null!=n&&o>=n?s():r(i,l)};i()}))}function A(e,t){let n=1,r=-1;for(let t=0;t<e.length;++t)if(e[t]>=0)n*=e[t];else if(-1===e[t]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${t}`);r=t}else if(e[t]<0)throw Error(`Shapes can not be < 0. Found ${e[t]} at dim ${t}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function C(e,t){const n=t.length;return d((e=null==e?t.map(((e,t)=>t)):[].concat(e)).every((e=>e>=-n&&e<n)),(()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`)),d(e.every((e=>b(e))),(()=>`All values in axis param must be integers but got axis ${e}`)),e.map((e=>e<0?n+e:e))}function I(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:C(t,e).sort();let o=0;for(let t=0;t<e.length;++t){if(null!=s){if(s[o]===t&&1!==e[t])throw new Error(`Can't squeeze axis ${t} since its dim '${e[t]}' is not 1`);(null==s[o]||s[o]>t)&&1===e[t]&&(n.push(e[t]),r.push(t)),s[o]<=t&&o++}1!==e[t]&&(n.push(e[t]),r.push(t))}return{newShape:n,keptDims:r}}function k(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else{if("bool"!==e)throw new Error(`Unknown data type ${e}`);n=new Uint8Array(t)}return n}function E(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function N(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(isNaN(r)||!isFinite(r))throw Error(`A tensor of type ${t} being uploaded contains ${r}.`)}}function B(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}function R(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function D(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}function M(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function O(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t}function P(e){return"string"==typeof e||e instanceof String}function $(e){return"boolean"==typeof e}function F(e){return"number"==typeof e}function _(e){return Array.isArray(e)?_(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":F(e)?"float32":P(e)?"string":$(e)?"bool":"float32"}function L(e){return!!(e&&e.constructor&&e.call&&e.apply)}function V(e,t){for(let n=t;n<e;++n)if(e%n==0)return n;return e}function U(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}function G(e,t,n,r=!1){const a=new Array;if(1===t.length){const s=t[0]*(r?2:1);for(let t=0;t<s;t++)a[t]=n[e+t]}else{const s=t[0],o=t.slice(1),i=o.reduce(((e,t)=>e*t))*(r?2:1);for(let t=0;t<s;t++)a[t]=G(e+t*i,o,n,r)}return a}function W(e,t,n=!1){if(0===e.length)return t[0];const r=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===r)return[];if(r!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return G(0,e,t,n)}function z(e,t){const n=H(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n}function H(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function Z(e,t){const n=e.reduce(((e,t)=>e*t),1);if(null==t||"float32"===t)return W(e,new Float32Array(n));if("int32"===t)return W(e,new Int32Array(n));if("bool"===t)return W(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function j(e){e.forEach((t=>{d(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function X(e,t,n){if(0===t)return 0;if(1===t)return e[0];let r=e[e.length-1];for(let t=0;t<e.length-1;++t)r+=n[t]*e[t];return r}function K(e,t,n){if(0===t)return[];if(1===t)return[e];const r=new Array(t);for(let t=0;t<r.length-1;++t)r[t]=Math.floor(e/n[t]),e-=r[t]*n[t];return r[r.length-1]=e,r}function q(e){return e&&e.then&&"function"==typeof e.then}n.d(t,{AE:()=>x,Cq:()=>h,D2:()=>_,D5:()=>N,E7:()=>c,EC:()=>C,GN:()=>b,GX:()=>W,HD:()=>P,JZ:()=>A,LF:()=>i,LP:()=>B,Mu:()=>j,N9:()=>g,NA:()=>m,NE:()=>K,QB:()=>R,Sm:()=>l,TV:()=>r,U$:()=>w,Ub:()=>O,WD:()=>S,WP:()=>k,YP:()=>v,bT:()=>M,bj:()=>u,bp:()=>I,cO:()=>y,d7:()=>a,e3:()=>U,fU:()=>D,hj:()=>F,hu:()=>d,jP:()=>V,jn:()=>$,k5:()=>p,l6:()=>Z,mf:()=>L,nY:()=>o,oj:()=>T,p8:()=>z,qy:()=>X,rQ:()=>E,tI:()=>q,uZ:()=>s,wT:()=>H,xH:()=>f})},4211:(e,t,n)=>{n.d(t,{Z:()=>g});const r={distanceBetweenPoints:(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),distanceBetweenPointsXoR:(e,t)=>Math.trunc(Math.sqrt(Math.abs(e[0]-t[0]^e[1]-t[1]+2^2))),sizeByTwoPoints:(e,t)=>(t[0]-e[0])*(t[1]-e[1]),rectCenter:(e,t)=>[e[0]+(t[0]-e[0])/2,e[1]+(t[1]-e[1])/2],angleBetweenTwoVectors:(e,t)=>{const n=e=>{const t=e.map((e=>e**2)).reduce(((e,t)=>e+t));return Math.sqrt(t)},r=e.reduce(((e,n,r)=>e+n*t[r]),0)/(n(e)*n(t));return 180*Math.acos(r)/Math.PI},triangleArea:(e,t,n)=>{const r=(e+t+n)/2;return Math.sqrt(r*(r-e)*(r-t)*(r-n))}};var a=n(8169),s=n(2372),o=n(2328);const i={rgbaToGrayscale:(e,t,n,r)=>{for(let a=0;a<n;++a)for(let n=0;n<r;++n)e[a*r+n]=(2*t[4*a*r+4*n+0]+7*t[4*a*r+4*n+1]+1*t[4*a*r+4*n+2])/10}};var l=n(5034);const u={pdf:e=>e.init(r,s.Z.minPDFframes,s.Z.cropSize,o.Z.borderCanvas),face:e=>e.init(r,i),docDetector:e=>e.init(r,a.ZP),barcode:e=>e.init({base64ToArrayBuffer:l.RG,getDataFromBase64Img:l.uH})},c={...u,hasModule:e=>e in u},d={type:null,angles:null,faceMesh:null,mrz:null,classLocal:null},p={mrz:null,pdf:null,face:null,barcode:null,docDetector:null,heic:null},h=(e,t)=>{const n="model"===e.toLowerCase()?d:p;return((e,t)=>Object.keys(e).includes(t))(n,t)?n:null},f=(e,t)=>{if("module"!==e.toLowerCase())return;const n=h("module",t)[t];c.hasModule(t)&&c[t](n)},m=(e,t)=>!!h(e,t)[t],g={isExist:m,isLoaded:(e,t)=>!(h(e,t)[t]instanceof Promise),setModule:(e,t,n)=>{h(e,t)[t]=n,n instanceof Promise?n.then((()=>f(e,t))):f(e,t)},execute:function(e,t,n){const r=h(e,t)[t];if(!r)return!1;const a=r[n];for(var s=arguments.length,o=new Array(s>3?s-3:0),i=3;i<s;i++)o[i-3]=arguments[i];return"function"==typeof a?a.apply(r,o):a},asyncExecute:async function(e,t,n){const r=h(e,t)[t];if(!r)return!1;for(var a=arguments.length,s=new Array(a>3?a-3:0),o=3;o<a;o++)s[o-3]=arguments[o];if(r instanceof Promise){const e=await r,t=e[n];return"function"==typeof t?t.apply(e,s):t}const i=r[n];return"function"==typeof i?i.apply(r,s):i},addCallback:(e,t,n)=>{h(e,t)[t].then((()=>{n()}))},existPropertyInModule:(e,t)=>{let n=!1;if(m("module",e)){n=t in h("module",e)}return n},allocateAll:()=>{const e={pdf:s.Z.cropSize,mrz:s.Z.cropSize,docDetector:s.Z.cropResizedSize,face:s.Z.cropFaceSize},t=Object.keys(e);return Object.entries(p).filter((e=>{let[n,r]=e;return Boolean(r)&&t.includes(n)})).map((async t=>{let[n,r]=t;const{width:a,height:o}=e[n];["pdf"].includes(n)&&r.setSizes(a,o);const i="face"===n&&!s.Z.isRealFaceAvailable&&"face"===s.Z.currentStepType;("face"!==n||i)&&(r instanceof Promise?r.then((e=>e.allocate(a,o))):r.allocate(a,o))}))}}},1015:(e,t,n)=>{n.r(t),n.d(t,{Abs:()=>C.SYM,Acos:()=>C.VGw,Acosh:()=>C.SpW,AdadeltaOptimizer:()=>C.zJI,AdagradOptimizer:()=>C.HeW,AdamOptimizer:()=>C.a4z,AdamaxOptimizer:()=>C.DBS,Add:()=>C.mm_,AddN:()=>C.Xze,All:()=>C.oT6,Any:()=>C.IKK,ArgMax:()=>C.sJF,ArgMin:()=>C.aJk,Asin:()=>C.M2y,Asinh:()=>C.qw7,Atan:()=>C.jMg,Atan2:()=>C.QCc,Atanh:()=>C.Oyi,AvgPool:()=>C.JhU,AvgPool3D:()=>C._k9,AvgPool3DGrad:()=>C.IMb,AvgPoolGrad:()=>C.ROF,BatchMatMul:()=>C.XLW,BatchToSpaceND:()=>C.zws,Bincount:()=>C.zvY,BroadcastArgs:()=>C.eEB,BroadcastTo:()=>C.Ly9,Cast:()=>C.RFZ,Ceil:()=>C.gJX,ClipByValue:()=>C.xnO,Complex:()=>C.Zz9,ComplexAbs:()=>C.yj2,Concat:()=>C.Eh3,Conv2D:()=>C.mhS,Conv2DBackpropFilter:()=>C.wUP,Conv2DBackpropInput:()=>C.wm,Conv3D:()=>C.x12,Conv3DBackpropFilterV2:()=>C.o2y,Conv3DBackpropInputV2:()=>C.ik2,Cos:()=>C.mc4,Cosh:()=>C.TR1,CropAndResize:()=>C.VcC,Cumprod:()=>C.Byc,Cumsum:()=>C.iHb,DataStorage:()=>C.JLz,DenseBincount:()=>C.QRR,DepthToSpace:()=>C.T0n,DepthwiseConv2dNative:()=>C.cie,DepthwiseConv2dNativeBackpropFilter:()=>C.sL$,DepthwiseConv2dNativeBackpropInput:()=>C.y7R,Diag:()=>C.$w,Dilation2D:()=>C.p4S,Dilation2DBackpropFilter:()=>C.Vn9,Dilation2DBackpropInput:()=>C.ekb,ENV:()=>C.ViN,Einsum:()=>C.$g6,Elu:()=>C.SX0,EluGrad:()=>C.HEU,Environment:()=>C.qAh,Equal:()=>C.hdR,Erf:()=>C.Omj,Exp:()=>C.NEP,ExpandDims:()=>C.YFo,Expm1:()=>C.Y0y,FFT:()=>C.vwp,Fill:()=>C.deh,FlipLeftRight:()=>C.Uyb,Floor:()=>C.OR,FloorDiv:()=>C.jeX,FromPixels:()=>C.eBW,FusedBatchNorm:()=>C.sHE,FusedConv2D:()=>C._V0,FusedDepthwiseConv2D:()=>C.luS,GPGPUContext:()=>k.Af,GatherNd:()=>C.q1x,GatherV2:()=>C.qi_,GraphModel:()=>I.g_,Greater:()=>C.iZT,GreaterEqual:()=>C.Acj,IFFT:()=>C.Qg5,Identity:()=>C.iJz,Imag:()=>C.J_u,IsFinite:()=>C.avt,IsInf:()=>C.iWB,IsNan:()=>C.r7n,KernelBackend:()=>C.Zuw,LRN:()=>C.eZ0,LRNGrad:()=>C.Hhh,LeakyRelu:()=>C.J$2,Less:()=>C.vtC,LessEqual:()=>C.CAk,LinSpace:()=>C.e7N,Log:()=>C.ZbH,Log1p:()=>C.kU,LogSoftmax:()=>C.qCd,LogicalAnd:()=>C.PYm,LogicalNot:()=>C.VfG,LogicalOr:()=>C.MZg,LogicalXor:()=>C.w6g,LowerBound:()=>C.qIC,MathBackendWebGL:()=>k.QC,Max:()=>C.YoZ,MaxPool:()=>C.mTV,MaxPool3D:()=>C.OAf,MaxPool3DGrad:()=>C.OU7,MaxPoolGrad:()=>C.OV7,MaxPoolWithArgmax:()=>C.vFR,Maximum:()=>C.BMI,Mean:()=>C.q2K,Min:()=>C.c17,Minimum:()=>C.q8u,MirrorPad:()=>C.jQs,Mod:()=>C.Vbg,MomentumOptimizer:()=>C.rIn,Multinomial:()=>C.NZg,Multiply:()=>C.wYn,Neg:()=>C.kuV,NonMaxSuppressionV3:()=>C.uv1,NonMaxSuppressionV4:()=>C.cye,NonMaxSuppressionV5:()=>C.W0H,NotEqual:()=>C.yQU,OP_SCOPE_SUFFIX:()=>C.zvA,OneHot:()=>C.we_,OnesLike:()=>C.qWM,Optimizer:()=>C.gaJ,OptimizerConstructors:()=>C.eEe,Pack:()=>C.QiL,PadV2:()=>C.lyA,Pool:()=>C.Kgp,Pow:()=>C.pe_,Prelu:()=>C.o0g,Prod:()=>C.DlI,RMSPropOptimizer:()=>C.gVI,RaggedGather:()=>C.dDz,RaggedTensorToTensor:()=>C.BiW,Range:()=>C.e6w,Rank:()=>C.yw1,Real:()=>C.xJR,RealDiv:()=>C.oHH,Reciprocal:()=>C.$HU,Reduction:()=>C.IH3,Relu:()=>C.qkr,Relu6:()=>C.SbG,Reshape:()=>C.HZH,ResizeBilinear:()=>C._Yw,ResizeBilinearGrad:()=>C.zbQ,ResizeNearestNeighbor:()=>C.dpD,ResizeNearestNeighborGrad:()=>C.Hmb,Reverse:()=>C.mKl,RotateWithOffset:()=>C.b9H,Round:()=>C.e07,Rsqrt:()=>C.bV0,SGDOptimizer:()=>C.DYp,ScatterNd:()=>C.xQA,SearchSorted:()=>C.nr8,Select:()=>C.PhF,Selu:()=>C.oFR,Sigmoid:()=>C.a5O,Sign:()=>C.i5y,Sin:()=>C.RQH,Sinh:()=>C.wYB,Slice:()=>C.p2w,Softmax:()=>C.Gcp,Softplus:()=>C.MRv,SpaceToBatchND:()=>C.TQc,SparseFillEmptyRows:()=>C.O3z,SparseReshape:()=>C.nhH,SparseSegmentMean:()=>C.w3H,SparseSegmentSum:()=>C.ZjV,SparseToDense:()=>C.D2d,SplitV:()=>C.L8s,Sqrt:()=>C.FKq,Square:()=>C.bK0,SquaredDifference:()=>C._tC,Step:()=>C.h8e,StridedSlice:()=>C.jQk,StringNGrams:()=>C._JP,StringSplit:()=>C.s1s,StringToHashBucketFast:()=>C.XkS,Sub:()=>C.Tr8,Sum:()=>C.GBy,Tan:()=>C.sEM,Tanh:()=>C.MIZ,Tensor:()=>C.esB,TensorBuffer:()=>C.YDk,Tile:()=>C.n9L,TopK:()=>C.cWu,Transform:()=>C.wx7,Transpose:()=>C.G3Y,Unique:()=>C.kpP,Unpack:()=>C.ToN,UnsortedSegmentSum:()=>C.Qvg,UpperBound:()=>C.XDQ,Variable:()=>C._wD,ZerosLike:()=>C.RuY,_FusedMatMul:()=>C.usg,abs:()=>C.WnP,acos:()=>C.Khb,acosh:()=>C.__u,add:()=>C.IHx,addN:()=>C.QBD,all:()=>C.$6P,any:()=>C.YjB,argMax:()=>C.NqF,argMin:()=>C.vHJ,asin:()=>C.ZRM,asinh:()=>C.VfV,atan:()=>C.z4N,atan2:()=>C.fvJ,atanh:()=>C.C80,avgPool:()=>C.wS1,avgPool3d:()=>C.uR5,backend:()=>C.y3$,backend_util:()=>C.Wap,basicLSTMCell:()=>C.zEQ,batchNorm:()=>C.tgs,batchNorm2d:()=>C.Dxk,batchNorm3d:()=>C.JY5,batchNorm4d:()=>C.p3b,batchToSpaceND:()=>C.E4h,bincount:()=>C.yE8,booleanMaskAsync:()=>C.anm,broadcastArgs:()=>C.XsQ,broadcastTo:()=>C.UFq,broadcast_util:()=>C.Jyw,browser:()=>C.Xhn,buffer:()=>C.f3b,cast:()=>C.pju,ceil:()=>C.mDi,clipByValue:()=>C.iUl,clone:()=>C.d9v,complex:()=>C.PYB,concat:()=>C.zoF,concat1d:()=>C.gME,concat2d:()=>C.Izb,concat3d:()=>C.MNy,concat4d:()=>C.ZaL,conv1d:()=>C.PAt,conv2d:()=>C.Tek,conv2dTranspose:()=>C.bc,conv3d:()=>C.pdZ,conv3dTranspose:()=>C.$QV,copyRegisteredKernels:()=>C.T3b,cos:()=>C.mCk,cosh:()=>C.f9Y,cosineWindow:()=>C.mew,cumprod:()=>C.$Gn,cumsum:()=>C.zbp,customGrad:()=>C.cbc,denseBincount:()=>C.ppE,deprecationWarn:()=>C.MXe,depthToSpace:()=>C.nTT,depthwiseConv2d:()=>C.B10,deregisterOp:()=>I.Ue,device_util:()=>C.C2$,diag:()=>C.Ka3,dilation2d:()=>C.WmZ,disableDeprecationWarnings:()=>C.cFr,dispose:()=>C.B90,disposeVariables:()=>C.N8o,div:()=>C.hiC,divNoNan:()=>C.NTj,dot:()=>C.AKD,dropout:()=>C.rvX,einsum:()=>C.WYO,elu:()=>C.pyx,enableDebugMode:()=>C.Ra$,enableProdMode:()=>C.G48,enclosingPowerOfTwo:()=>C.GRh,engine:()=>C.SRH,env:()=>C.OBj,equal:()=>C.DgJ,erf:()=>C.qNN,euclideanNorm:()=>C.d2q,exp:()=>C.Qqt,expandDims:()=>C.dt4,expm1:()=>C.t$B,eye:()=>C.iyy,fft:()=>C.kp_,fill:()=>C.hlL,findBackend:()=>C.x3e,findBackendFactory:()=>C.zel,floor:()=>C.GWj,floorDiv:()=>C.qPi,forceHalfFloat:()=>k.kS,fused:()=>C.imm,gather:()=>C.Iqj,gatherND:()=>C.dbB,gather_util:()=>C.DaI,getBackend:()=>C.N_N,getGradient:()=>C.ukX,getKernel:()=>C.pIF,getKernelsForBackend:()=>C.trD,gpgpu_util:()=>k.lz,grad:()=>C.UQy,grads:()=>C.tiA,greater:()=>C.pjt,greaterEqual:()=>C.brS,ifft:()=>C.Sxn,imag:()=>C.asL,image:()=>C.BHj,inTopKAsync:()=>C.V3u,io:()=>C.io,irfft:()=>C.wx0,isFinite:()=>C.xVT,isInf:()=>C.UWc,isNaN:()=>C.i2d,keep:()=>C.CnY,kernel_impls:()=>C.GDt,leakyRelu:()=>C.hi7,less:()=>C.d9m,lessEqual:()=>C.zN1,linalg:()=>C.$r2,linspace:()=>C.SX3,loadGraphModel:()=>I.YL,loadGraphModelSync:()=>I.fM,localResponseNormalization:()=>C.G9k,log:()=>C.cM7,log1p:()=>C.Krr,logSigmoid:()=>C.e_t,logSoftmax:()=>C.CmS,logSumExp:()=>C.l_t,logicalAnd:()=>C.HvI,logicalNot:()=>C.hJK,logicalOr:()=>C.K5V,logicalXor:()=>C.egP,losses:()=>C.MB5,lowerBound:()=>C.eab,matMul:()=>C.OI3,math:()=>C.mAU,max:()=>C.Fp7,maxPool:()=>C._sB,maxPool3d:()=>C.YQQ,maxPoolWithArgmax:()=>C.Ip$,maximum:()=>C.gWQ,mean:()=>C.J69,memory:()=>C.sq6,meshgrid:()=>C.ry_,min:()=>C.VV$,minimum:()=>C.LTh,mirrorPad:()=>C.VdP,mod:()=>C.wQq,moments:()=>C.Gi7,movingAverage:()=>C.p_,mul:()=>C.dC7,multiRNNCell:()=>C.rq4,multinomial:()=>C.SJ_,neg:()=>C.W76,nextFrame:()=>C.glt,norm:()=>C.KOy,notEqual:()=>C.Quu,oneHot:()=>C.lfX,ones:()=>C.iUs,onesLike:()=>C.JpU,op:()=>C.op,outerProduct:()=>C.N2O,pad:()=>C.vku,pad1d:()=>C.pNR,pad2d:()=>C.koy,pad3d:()=>C.t1L,pad4d:()=>C.lGY,pool:()=>C.d_R,pow:()=>C.sQ3,prelu:()=>C.AL3,print:()=>C.S0v,prod:()=>C.WVs,profile:()=>C.N5s,raggedGather:()=>C.$gW,raggedTensorToTensor:()=>C.N89,rand:()=>C.TN_,randomGamma:()=>C.wzB,randomNormal:()=>C.nGf,randomStandardNormal:()=>C.ruB,randomUniform:()=>C.LGj,range:()=>C.w6H,ready:()=>C.Cd_,real:()=>C.kwC,reciprocal:()=>C.M25,registerBackend:()=>C.jqO,registerGradient:()=>C.LiG,registerKernel:()=>C.wCN,registerOp:()=>I.iw,relu:()=>C.UYe,relu6:()=>C.btT,removeBackend:()=>C.cjG,reshape:()=>C.XLQ,reverse:()=>C.GYS,reverse1d:()=>C.SDf,reverse2d:()=>C.diP,reverse3d:()=>C.sx7,reverse4d:()=>C.mG2,rfft:()=>C.QEs,round:()=>C.NMM,rsqrt:()=>C.bp0,scalar:()=>C.iD$,scatterND:()=>C.snQ,scatter_util:()=>C.yV1,searchSorted:()=>C.zcT,selu:()=>C.U8D,separableConv2d:()=>C.U_I,serialization:()=>C.m7h,setBackend:()=>C.CQI,setPlatform:()=>C.VYu,setWebGLContext:()=>k.nd,setdiff1dAsync:()=>C.ODp,sigmoid:()=>C.XD2,sign:()=>C.Xxe,signal:()=>C.tdS,sin:()=>C.O$l,sinh:()=>C.R_K,slice:()=>C.tPi,slice1d:()=>C.jZU,slice2d:()=>C.SmN,slice3d:()=>C.CnO,slice4d:()=>C.p0P,slice_util:()=>C.kuN,softmax:()=>C.XAC,softplus:()=>C.Wvh,spaceToBatchND:()=>C.fBT,sparse:()=>C.rVs,sparseToDense:()=>C.ers,spectral:()=>C.uN7,split:()=>C.Vl2,sqrt:()=>C._b3,square:()=>C.h62,squaredDifference:()=>C.$i,squeeze:()=>C.L9e,stack:()=>C.knu,step:()=>C.Nbs,stridedSlice:()=>C.NXj,string:()=>C.Z_8,sub:()=>C.luU,sum:()=>C.Smz,sumOutType:()=>C.z4k,tan:()=>C.ORZ,tanh:()=>C.AEp,tensor:()=>C.XeE,tensor1d:()=>C.RRF,tensor2d:()=>C.odF,tensor3d:()=>C.wOQ,tensor4d:()=>C.yXz,tensor5d:()=>C.Bfx,tensor6d:()=>C.xZs,tensor_util:()=>C.piX,test_util:()=>C.p3L,tidy:()=>C.lub,tile:()=>C.Gg6,time:()=>C.XVJ,topk:()=>C.hg7,train:()=>C.p_j,transpose:()=>C.p4s,truncatedNormal:()=>C.Xu6,unique:()=>C.Two,unregisterGradient:()=>C.bt3,unregisterKernel:()=>C.nEe,unsortedSegmentSum:()=>C.pUJ,unstack:()=>C.HHK,upcastType:()=>C.x8V,upperBound:()=>C.GaM,util:()=>C.D5U,valueAndGrad:()=>C.h76,valueAndGrads:()=>C.fNQ,variable:()=>C.VD$,variableGrads:()=>C.pnJ,version_converter:()=>I.gJ,version_core:()=>C.jTM,version_webgl:()=>k.ic,webgl:()=>k.yO,webgl_util:()=>k.fZ,where:()=>C.arb,whereAsync:()=>C.itS,zeros:()=>C.lls,zerosLike:()=>C.P84});var r=n(6151),a=(n(5186),n(619)),s=n(9709),o=n(6623),i=n(7721),l=n(5937),u=n(5710),c=n(7650),d=n(2079),p=n(2489),h=n(8299),f=n(6090),m=n(9486),g=n(8955),y=n(1119),b=n(106),x=n(7763),v=n(4443),w=n(5452),T=n(8632),S=n(2812),A=n(3351),C=n(4113),I=n(7437),k=n(6810);(0,r.wC)(a.x),(0,r.wC)(s.M),(0,r.wC)(o.p),(0,r.wC)(i.T),(0,r.wC)(l.v),(0,r.wC)(u.X),(0,r.wC)(c.L),(0,r.wC)(d.u),(0,r.wC)(p.F),(0,r.wC)(h.b),(0,r.wC)(f.d),(0,r.wC)(m.D),(0,r.wC)(g.I),(0,r.wC)(y.G),(0,r.wC)(b.f),(0,r.wC)(x.j),(0,r.wC)(v.S),(0,r.wC)(w.$),(0,r.wC)(T.N),(0,r.wC)(S.X),(0,r.wC)(A.B)},2579:(e,t,n)=>{n.d(t,{$HU:()=>r.$HU,$g6:()=>r.$g6,$w:()=>r.$w,Acj:()=>r.Acj,B90:()=>r.B90,BHj:()=>r.BHj,BMI:()=>r.BMI,BiW:()=>r.BiW,Byc:()=>r.Byc,C2$:()=>r.C2$,CAk:()=>r.CAk,CQI:()=>r.CQI,CnY:()=>r.CnY,D2d:()=>r.D2d,D5U:()=>r.D5U,DlI:()=>r.DlI,Eh3:()=>r.Eh3,FKq:()=>r.FKq,G3Y:()=>r.G3Y,GBy:()=>r.GBy,GDt:()=>r.GDt,Gcp:()=>r.Gcp,HEU:()=>r.HEU,HHK:()=>r.HHK,HZH:()=>r.HZH,Hhh:()=>r.Hhh,Hmb:()=>r.Hmb,IHx:()=>r.IHx,IKK:()=>r.IKK,IMb:()=>r.IMb,J$2:()=>r.J$2,JLz:()=>r.JLz,J_u:()=>r.J_u,JhU:()=>r.JhU,Jyw:()=>r.Jyw,L8s:()=>r.L8s,L9e:()=>r.L9e,M2y:()=>r.M2y,MIZ:()=>r.MIZ,MRv:()=>r.MRv,MZg:()=>r.MZg,NEP:()=>r.NEP,NZg:()=>r.NZg,O3z:()=>r.O3z,OAf:()=>r.OAf,OBj:()=>r.OBj,OR:()=>r.OR,OU7:()=>r.OU7,OV7:()=>r.OV7,Omj:()=>r.Omj,Oyi:()=>r.Oyi,PYm:()=>r.PYm,PhF:()=>r.PhF,QCc:()=>r.QCc,QRR:()=>r.QRR,Qg5:()=>r.Qg5,QiL:()=>r.QiL,Qqt:()=>r.Qqt,Qvg:()=>r.Qvg,RFZ:()=>r.RFZ,ROF:()=>r.ROF,RQH:()=>r.RQH,RRF:()=>r.RRF,RuY:()=>r.RuY,SRH:()=>r.SRH,SX0:()=>r.SX0,SYM:()=>r.SYM,SbG:()=>r.SbG,SpW:()=>r.SpW,T0n:()=>r.T0n,TQc:()=>r.TQc,TR1:()=>r.TR1,ToN:()=>r.ToN,Tr8:()=>r.Tr8,UFq:()=>r.UFq,Uyb:()=>r.Uyb,VGw:()=>r.VGw,Vbg:()=>r.Vbg,VcC:()=>r.VcC,VfG:()=>r.VfG,W0H:()=>r.W0H,Wap:()=>r.Wap,XD2:()=>r.XD2,XLQ:()=>r.XLQ,XLW:()=>r.XLW,XeE:()=>r.XeE,Xhn:()=>r.Xhn,XkS:()=>r.XkS,Xze:()=>r.Xze,Y0y:()=>r.Y0y,YDk:()=>r.YDk,YFo:()=>r.YFo,YoZ:()=>r.YoZ,ZbH:()=>r.ZbH,ZjV:()=>r.ZjV,Zuw:()=>r.Zuw,Zz9:()=>r.Zz9,_JP:()=>r._JP,_V0:()=>r._V0,_Yw:()=>r._Yw,_k9:()=>r._k9,_tC:()=>r._tC,a5O:()=>r.a5O,aJk:()=>r.aJk,avt:()=>r.avt,b9H:()=>r.b9H,bK0:()=>r.bK0,bV0:()=>r.bV0,c17:()=>r.c17,cWu:()=>r.cWu,cie:()=>r.cie,cye:()=>r.cye,d9v:()=>r.d9v,dC7:()=>r.dC7,dDz:()=>r.dDz,deh:()=>r.deh,dpD:()=>r.dpD,dt4:()=>r.dt4,e07:()=>r.e07,e6w:()=>r.e6w,e7N:()=>r.e7N,eBW:()=>r.eBW,eEB:()=>r.eEB,eZ0:()=>r.eZ0,esB:()=>r.esB,f3b:()=>r.f3b,gJX:()=>r.gJX,glt:()=>r.glt,h8e:()=>r.h8e,hdR:()=>r.hdR,hiC:()=>r.hiC,i5y:()=>r.i5y,iD$:()=>r.iD$,iHb:()=>r.iHb,iJz:()=>r.iJz,iUl:()=>r.iUl,iWB:()=>r.iWB,iZT:()=>r.iZT,ik2:()=>r.ik2,io:()=>r.io,jMg:()=>r.jMg,jQk:()=>r.jQk,jQs:()=>r.jQs,jeX:()=>r.jeX,jqO:()=>r.jqO,kU:()=>r.kU,knu:()=>r.knu,kpP:()=>r.kpP,kuN:()=>r.kuN,kuV:()=>r.kuV,lls:()=>r.lls,luS:()=>r.luS,luU:()=>r.luU,lub:()=>r.lub,lyA:()=>r.lyA,mKl:()=>r.mKl,mTV:()=>r.mTV,mc4:()=>r.mc4,mhS:()=>r.mhS,mm_:()=>r.mm_,n9L:()=>r.n9L,nhH:()=>r.nhH,nr8:()=>r.nr8,o0g:()=>r.o0g,o2y:()=>r.o2y,oFR:()=>r.oFR,oHH:()=>r.oHH,oT6:()=>r.oT6,odF:()=>r.odF,p2w:()=>r.p2w,p4S:()=>r.p4S,pe_:()=>r.pe_,pju:()=>r.pju,q1x:()=>r.q1x,q2K:()=>r.q2K,q8u:()=>r.q8u,qWM:()=>r.qWM,qi_:()=>r.qi_,qkr:()=>r.qkr,qw7:()=>r.qw7,r7n:()=>r.r7n,s1s:()=>r.s1s,sEM:()=>r.sEM,sHE:()=>r.sHE,sJF:()=>r.sJF,sL$:()=>r.sL$,tPi:()=>r.tPi,usg:()=>r.usg,uv1:()=>r.uv1,vFR:()=>r.vFR,vtC:()=>r.vtC,vwp:()=>r.vwp,w3H:()=>r.w3H,wCN:()=>r.wCN,wUP:()=>r.wUP,wYB:()=>r.wYB,wYn:()=>r.wYn,we_:()=>r.we_,wm:()=>r.wm,wx7:()=>r.wx7,x12:()=>r.x12,x8V:()=>r.x8V,xJR:()=>r.xJR,xQA:()=>r.xQA,xnO:()=>r.xnO,y7R:()=>r.y7R,yQU:()=>r.yQU,yj2:()=>r.yj2,z4k:()=>r.z4k,zbQ:()=>r.zbQ,zoF:()=>r.zoF,zvY:()=>r.zvY,zws:()=>r.zws});n(5186);var r=n(4113)},6714:(e,t,n)=>{n.d(t,{I:()=>a,m:()=>r});const r=["DLIC_H_0","DLIC_H_180","DLIC_H_270","DLIC_H_90","DLIC_V_0","DLIC_V_180","DLIC_V_270","DLIC_V_90","FAIL_H_0","FAIL_V_90","PASS_H_0","PASS_H_180","PASS_H_270","PASS_H_90"];function a(e){const t=e.split("_");return t[2]?parseInt(t[2],10):0}},9742:(e,t)=>{t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,s=l(e),o=s[0],i=s[1],u=new a(function(e,t,n){return 3*(t+n)/4-n}(0,o,i)),c=0,d=i>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;2===i&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[c++]=255&t);1===i&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,a=r%3,s=[],o=16383,i=0,l=r-a;i<l;i+=o)s.push(u(e,i,i+o>l?l:i+o));1===a?(t=e[r-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],r=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=s.length;o<i;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,r){for(var a,s,o=[],i=t;i<r;i+=3)a=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(n[(s=a)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8764:(e,t,n)=>{const r=n(9742),a=n(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=l,t.h2=50;const o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=i(n);const a=r.write(e,t);a!==n&&(r=r.slice(0,a));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return l.from(r,t,n);const a=function(e){if(l.isBuffer(e)){const t=0|f(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||q(e.length)?i(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return c(e),i(e<0?0:0|f(e))}function p(e){const t=e.length<0?0:0|f(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let a=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(a)return r?-1:Z(e).length;t=(""+t).toLowerCase(),a=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:x(e,t,n,r,a);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):x(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function x(e,t,n,r,a){let s,o=1,i=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,i/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){let r=-1;for(s=n;s<i;s++)if(u(e,s)===u(t,-1===r?0:s-r)){if(-1===r&&(r=s),s-r+1===l)return r*o}else-1!==r&&(s-=s-r),r=-1}else for(n+l>i&&(n=i-l),s=n;s>=0;s--){let n=!0;for(let r=0;r<l;r++)if(u(e,s+r)!==u(t,r)){n=!1;break}if(n)return s}return-1}function v(e,t,n,r){n=Number(n)||0;const a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;const s=t.length;let o;for(r>s/2&&(r=s/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(q(r))return o;e[n+o]=r}return o}function w(e,t,n,r){return X(Z(t,e.length-n),e,n,r)}function T(e,t,n,r){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return X(j(t),e,n,r)}function A(e,t,n,r){return X(function(e,t){let n,r,a;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,a=n%256,s.push(a),s.push(r);return s}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let a=t;for(;a<n;){const t=e[a];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(a+o<=n){let n,r,i,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[a+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[a+1],r=e[a+2],128==(192&n)&&128==(192&r)&&(l=(15&t)<<12|(63&n)<<6|63&r,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[a+1],r=e[a+2],i=e[a+3],128==(192&n)&&128==(192&r)&&128==(192&i)&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&i,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),a+=o}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=k));return n}(r)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(K(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let a=0,s=Math.min(n,r);a<s;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:r<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=l.allocUnsafe(t);let a=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))a+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,a)):Uint8Array.prototype.set.call(r,t,a);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,a)}a+=t.length}return r},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.h2;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,a){if(K(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(a>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0);const i=Math.min(s,o),u=this.slice(r,a),c=e.slice(t,n);for(let e=0;e<i;++e)if(u[e]!==c[e]){s=u[e],o=c[e];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const a=this.length-t;if((void 0===n||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let s=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function E(e,t,n){let r="";n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(127&e[a]);return r}function N(e,t,n){let r="";n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function B(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let a="";for(let r=t;r<n;++r)a+=Q[e[r]];return a}function R(e,t,n){const r=e.slice(t,n);let a="";for(let e=0;e<r.length-1;e+=2)a+=String.fromCharCode(r[e]+256*r[e+1]);return a}function D(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,a,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,a){G(t,r,a,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function P(e,t,n,r,a){G(t,r,a,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function $(e,t,n,r,a,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,s){return t=+t,n>>>=0,s||$(e,0,n,4),a.write(e,t,n,r,23,4),n+4}function _(e,t,n,r,s){return t=+t,n>>>=0,s||$(e,0,n,8),a.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);let r=this[e],a=1,s=0;for(;++s<t&&(a*=256);)r+=this[e+s]*a;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);let r=this[e+--t],a=1;for(;t>0&&(a*=256);)r+=this[e+--t]*a;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Y((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,a=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(a)<<BigInt(32))})),l.prototype.readBigUInt64BE=Y((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],a=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(a)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);let r=this[e],a=1,s=0;for(;++s<t&&(a*=256);)r+=this[e+s]*a;return a*=128,r>=a&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);let r=t,a=1,s=this[e+--r];for(;r>0&&(a*=256);)s+=this[e+--r]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Y((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Y((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),a.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),a.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),a.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),a.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){M(this,e,t,n,Math.pow(2,8*n)-1,0)}let a=1,s=0;for(this[t]=255&e;++s<n&&(a*=256);)this[t+s]=e/a&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){M(this,e,t,n,Math.pow(2,8*n)-1,0)}let a=n-1,s=1;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Y((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Y((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}let a=0,s=1,o=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}let a=n-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Y((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Y((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return _(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return _(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const a=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),a},l.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{const s=l.isBuffer(e)?e:l.from(e,r),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=s[a%o]}return this};const L={};function V(e,t,n){L[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function U(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function G(e,t,n,r,a,s){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let a;throw a=s>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(s+1)}${r}`:`>= -(2${r} ** ${8*(s+1)-1}${r}) and < 2 ** ${8*(s+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new L.ERR_OUT_OF_RANGE("value",a,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||z(t,e.length-(n+1))}(r,a,s)}function W(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function z(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new L.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,a=n;return Number.isInteger(n)&&Math.abs(n)>2**32?a=U(String(n)):"bigint"==typeof n&&(a=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(a=U(a)),a+="n"),r+=` It must be ${t}. Received ${a}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function Z(e,t){let n;t=t||1/0;const r=e.length;let a=null;const s=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&s.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function j(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,r){let a;for(a=0;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let a=0;a<16;++a)t[r+a]=e[n]+e[a]}return t}();function Y(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},645:(e,t)=>{t.read=function(e,t,n,r,a){var s,o,i=8*a-r-1,l=(1<<i)-1,u=l>>1,c=-7,d=n?a-1:0,p=n?-1:1,h=e[t+d];for(d+=p,s=h&(1<<-c)-1,h>>=-c,c+=i;c>0;s=256*s+e[t+d],d+=p,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),s-=u}return(h?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,a,s){var o,i,l,u=8*s-a-1,c=(1<<u)-1,d=c>>1,p=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=c?(i=0,o=c):o+d>=1?(i=(t*l-1)*Math.pow(2,a),o+=d):(i=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;e[n+h]=255&i,h+=f,i/=256,a-=8);for(o=o<<a|i,u+=a;u>0;e[n+h]=255&o,h+=f,o/=256,u-=8);e[n+h-f]|=128*m}},3720:e=>{e.exports=n;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var a={},s={};function o(e,t){var n,r,o;return t?(o=0<=(e>>>=0)&&e<256)&&(r=s[e])?r:(n=l(e,(0|e)<0?-1:0,!0),o&&(s[e]=n),n):(o=-128<=(e|=0)&&e<128)&&(r=a[e])?r:(n=l(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function i(e,t){if(isNaN(e))return t?y:g;if(t){if(e<0)return y;if(e>=h)return T}else{if(e<=-f)return S;if(e+1>=f)return w}return e<0?i(-e,t).neg():l(e%p|0,e/p|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=o,n.fromNumber=i,n.fromBits=l;var u=Math.pow;function c(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return c(e.substring(1),t,n).neg();for(var a=i(u(n,8)),s=g,o=0;o<e.length;o+=8){var l=Math.min(8,e.length-o),d=parseInt(e.substring(o,o+l),n);if(l<8){var p=i(u(n,l));s=s.mul(p).add(i(d))}else s=(s=s.mul(a)).add(i(d))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?i(e,t):"string"==typeof e?c(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=d;var p=4294967296,h=p*p,f=h/2,m=o(1<<24),g=o(0);n.ZERO=g;var y=o(0,!0);n.UZERO=y;var b=o(1);n.ONE=b;var x=o(1,!0);n.UONE=x;var v=o(-1);n.NEG_ONE=v;var w=l(-1,2147483647,!1);n.MAX_VALUE=w;var T=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var S=l(0,-2147483648,!1);n.MIN_VALUE=S;var A=n.prototype;A.toInt=function(){return this.unsigned?this.low>>>0:this.low},A.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},A.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(S)){var t=i(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=i(u(e,6),this.unsigned),s=this,o="";;){var l=s.div(a),c=(s.sub(l.mul(a)).toInt()>>>0).toString(e);if((s=l).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},A.getHighBits=function(){return this.high},A.getHighBitsUnsigned=function(){return this.high>>>0},A.getLowBits=function(){return this.low},A.getLowBitsUnsigned=function(){return this.low>>>0},A.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},A.isZero=function(){return 0===this.high&&0===this.low},A.eqz=A.isZero,A.isNegative=function(){return!this.unsigned&&this.high<0},A.isPositive=function(){return this.unsigned||this.high>=0},A.isOdd=function(){return 1==(1&this.low)},A.isEven=function(){return 0==(1&this.low)},A.equals=function(e){return r(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},A.eq=A.equals,A.notEquals=function(e){return!this.eq(e)},A.neq=A.notEquals,A.ne=A.notEquals,A.lessThan=function(e){return this.comp(e)<0},A.lt=A.lessThan,A.lessThanOrEqual=function(e){return this.comp(e)<=0},A.lte=A.lessThanOrEqual,A.le=A.lessThanOrEqual,A.greaterThan=function(e){return this.comp(e)>0},A.gt=A.greaterThan,A.greaterThanOrEqual=function(e){return this.comp(e)>=0},A.gte=A.greaterThanOrEqual,A.ge=A.greaterThanOrEqual,A.compare=function(e){if(r(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},A.comp=A.compare,A.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(b)},A.neg=A.negate,A.add=function(e){r(e)||(e=d(e));var t=this.high>>>16,n=65535&this.high,a=this.low>>>16,s=65535&this.low,o=e.high>>>16,i=65535&e.high,u=e.low>>>16,c=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=a+u)>>>16,c+=(p+=n+i)>>>16,c+=t+o,l((h&=65535)<<16|(f&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},A.subtract=function(e){return r(e)||(e=d(e)),this.add(e.neg())},A.sub=A.subtract,A.multiply=function(e){if(this.isZero())return g;if(r(e)||(e=d(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(S))return e.isOdd()?S:g;if(e.eq(S))return this.isOdd()?S:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return i(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,a=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,c=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,y=0,b=0,x=0;return b+=(x+=o*h)>>>16,y+=(b+=s*h)>>>16,b&=65535,y+=(b+=o*p)>>>16,f+=(y+=a*h)>>>16,y&=65535,f+=(y+=s*p)>>>16,y&=65535,f+=(y+=o*c)>>>16,f+=n*h+a*p+s*c+o*u,l((b&=65535)<<16|(x&=65535),(f&=65535)<<16|(y&=65535),this.unsigned)},A.mul=A.multiply,A.divide=function(e){if(r(e)||(e=d(e)),e.isZero())throw Error("division by zero");var n,a,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?y:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return x;s=y}else{if(this.eq(S))return e.eq(b)||e.eq(v)?S:e.eq(S)?b:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?b:v:(a=this.sub(e.mul(n)),s=n.add(a.div(e)));if(e.eq(S))return this.unsigned?y:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(a=this;a.gte(e);){n=Math.max(1,Math.floor(a.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(n)/Math.LN2),c=o<=48?1:u(2,o-48),p=i(n),h=p.mul(e);h.isNegative()||h.gt(a);)h=(p=i(n-=c,this.unsigned)).mul(e);p.isZero()&&(p=b),s=s.add(p),a=a.sub(h)}return s},A.div=A.divide,A.modulo=function(e){return r(e)||(e=d(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},A.mod=A.modulo,A.rem=A.modulo,A.not=function(){return l(~this.low,~this.high,this.unsigned)},A.and=function(e){return r(e)||(e=d(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},A.or=function(e){return r(e)||(e=d(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},A.xor=function(e){return r(e)||(e=d(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},A.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},A.shl=A.shiftLeft,A.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},A.shr=A.shiftRight,A.shiftRightUnsigned=function(e){if(r(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},A.shru=A.shiftRightUnsigned,A.shr_u=A.shiftRightUnsigned,A.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},A.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},A.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},A.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},A.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},2437:(e,t,n)=>{!function(e,t){e((function(){var e,n={mobileDetectRules:{phones:{iPhone:"\\biPhone\\b|\\biPod\\b",BlackBerry:"BlackBerry|\\bBB10\\b|rim[0-9]+|\\b(BBA100|BBB100|BBD100|BBE100|BBF100|STH100)\\b-[0-9]+",Pixel:"; \\bPixel\\b",HTC:"HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\bEVO\\b|T-Mobile G1|Z520m|Android [0-9.]+; Pixel",Nexus:"Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 5X|Nexus 6",Dell:"Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\\b001DL\\b|\\b101DL\\b|\\bGS01\\b",Motorola:"Motorola|DROIDX|DROID BIONIC|\\bDroid\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b|XT1068|XT1092|XT1052",Samsung:"\\bSamsung\\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F|SM-J330F|SM-G610F|SM-G981B|SM-G892A|SM-A530F",LG:"\\bLG\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)|LM-G710",Sony:"SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533|SOV34|601SO|F8332",Asus:"Asus.*Galaxy|PadFone.*Mobile",Xiaomi:"^(?!.*\\bx11\\b).*xiaomi.*$|POCOPHONE F1|MI 8|Redmi Note 9S|Redmi Note 5A Prime|N2G47H|M2001J2G|M2001J2I|M1805E10A|M2004J11G|M1902F1G|M2002J9G|M2004J19G|M2003J6A1G",NokiaLumia:"Lumia [0-9]{3,4}",Micromax:"Micromax.*\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\b",Palm:"PalmSource|Palm",Vertu:"Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature",Pantech:"PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790",Fly:"IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250",Wiko:"KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM",iMobile:"i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)",SimValley:"\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\b",Wolfgang:"AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q",Alcatel:"Alcatel",Nintendo:"Nintendo (3DS|Switch)",Amoi:"Amoi",INQ:"INQ",OnePlus:"ONEPLUS",GenericPhone:"Tapatalk|PDA;|SAGEM|\\bmmp\\b|pocket|\\bpsp\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\bwap\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser"},tablets:{iPad:"iPad|iPad.*Mobile",NexusTablet:"Android.*Nexus[\\s]+(7|9|10)",GoogleTablet:"Android.*Pixel C",SamsungTablet:"SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-T830|SM-T837V|SM-T720|SM-T510|SM-T387V|SM-P610|SM-T290|SM-T515|SM-T590|SM-T595|SM-T725|SM-T817P|SM-P585N0|SM-T395|SM-T295|SM-T865|SM-P610N|SM-P615|SM-T970|SM-T380|SM-T5950|SM-T905|SM-T231|SM-T500|SM-T860",Kindle:"Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)",SurfaceTablet:"Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)",HPTablet:"HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10",AsusTablet:"^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\\bP027\\b|\\bP024\\b|\\bP00C\\b",BlackBerryTablet:"PlayBook|RIM Tablet",HTCtablet:"HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410",MotorolaTablet:"xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617",NookTablet:"Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2",AcerTablet:"Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20\\b|\\bA3-A30|A3-A40",ToshibaTablet:"Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO",LGTablet:"\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\\b",FujitsuTablet:"Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b",PrestigioTablet:"PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002",LenovoTablet:"Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304X|TB-X304F|TB-X304L|TB-X505F|TB-X505L|TB-X505X|TB-X605F|TB-X605L|TB-8703F|TB-8703X|TB-8703N|TB-8704N|TB-8704F|TB-8704X|TB-8704V|TB-7304F|TB-7304I|TB-7304X|Tab2A7-10F|Tab2A7-20F|TB2-X30L|YT3-X50L|YT3-X50F|YT3-X50M|YT-X705F|YT-X703F|YT-X703L|YT-X705L|YT-X705X|TB2-X30F|TB2-X30L|TB2-X30M|A2107A-F|A2107A-H|TB3-730F|TB3-730M|TB3-730X|TB-7504F|TB-7504X|TB-X704F|TB-X104F|TB3-X70F|TB-X705F|TB-8504F|TB3-X70L|TB3-710F|TB-X704L",DellTablet:"Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7",YarvikTablet:"Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b",MedionTablet:"Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB",ArnovaTablet:"97G4|AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2",IntensoTablet:"INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004",IRUTablet:"M702pro",MegafonTablet:"MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b",EbodaTablet:"E-Boda (Supreme|Impresspeed|Izzycomm|Essential)",AllViewTablet:"Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)",ArchosTablet:"\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|c|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b",AinolTablet:"NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark",NokiaLumiaTablet:"Lumia 2520",SonyTablet:"Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP641|SGP612|SOT31|SGP771|SGP611|SGP612|SGP712",PhilipsTablet:"\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b",CubeTablet:"Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT",CobyTablet:"MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010",MIDTablet:"M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10",MSITablet:"MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b",SMiTTablet:"Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)",RockChipTablet:"Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A",FlyTablet:"IQ310|Fly Vision",bqTablet:"Android.*(bq)?.*\\b(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))\\b|Maxwell.*Lite|Maxwell.*Plus",HuaweiTablet:"MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09|AGS-L09|CMR-AL19",NecTablet:"\\bN-06D|\\bN-08D",PantechTablet:"Pantech.*P4100",BronchoTablet:"Broncho.*(N701|N708|N802|a710)",VersusTablet:"TOUCHPAD.*[78910]|\\bTOUCHTAB\\b",ZyncTablet:"z1000|Z99 2G|z930|z990|z909|Z919|z900",PositivoTablet:"TB07STA|TB10STA|TB07FTA|TB10FTA",NabiTablet:"Android.*\\bNabi",KoboTablet:"Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build",DanewTablet:"DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b",TexetTablet:"NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE",PlaystationTablet:"Playstation.*(Portable|Vita)",TrekstorTablet:"ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab",PyleAudioTablet:"\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b",AdvanTablet:"Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ",DanyTechTablet:"Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1",GalapadTablet:"Android [0-9.]+; [a-z-]+; \\bG1\\b",MicromaxTablet:"Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b",KarbonnTablet:"Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b",AllFineTablet:"Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide",PROSCANTablet:"\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b",YONESTablet:"BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026",ChangJiaTablet:"TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503",GUTablet:"TX-A1301|TX-M9002|Q702|kf026",PointOfViewTablet:"TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10",OvermaxTablet:"OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)|Qualcore 1027",HCLTablet:"HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync",DPSTablet:"DPS Dream 9|DPS Dual 7",VistureTablet:"V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10",CrestaTablet:"CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989",MediatekTablet:"\\bMT8125|MT8389|MT8135|MT8377\\b",ConcordeTablet:"Concorde([ ]+)?Tab|ConCorde ReadMan",GoCleverTablet:"GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042",ModecomTablet:"FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003",VoninoTablet:"\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b",ECSTablet:"V07OT2|TM105A|S10OT1|TR10CS1",StorexTablet:"eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab",VodafoneTablet:"SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497|VFD 1400",EssentielBTablet:"Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2",RossMoorTablet:"RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711",iMobileTablet:"i-mobile i-note",TolinoTablet:"tolino tab [0-9.]+|tolino shine",AudioSonicTablet:"\\bC-22Q|T7-QC|T-17B|T-17P\\b",AMPETablet:"Android.* A78 ",SkkTablet:"Android.* (SKYPAD|PHOENIX|CYCLOPS)",TecnoTablet:"TECNO P9|TECNO DP8D",JXDTablet:"Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b",iJoyTablet:"Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)",FX2Tablet:"FX2 PAD7|FX2 PAD10",XoroTablet:"KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151",ViewsonicTablet:"ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a",VerizonTablet:"QTAQZ3|QTAIR7|QTAQTZ3|QTASUN1|QTASUN2|QTAXIA1",OdysTablet:"LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10",CaptivaTablet:"CAPTIVA PAD",IconbitTablet:"NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S",TeclastTablet:"T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi",OndaTablet:"\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+|V10 \\b4G\\b",JaytechTablet:"TPC-PA762",BlaupunktTablet:"Endeavour 800NG|Endeavour 1010",DigmaTablet:"\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b",EvolioTablet:"ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b",LavaTablet:"QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b",AocTablet:"MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712",MpmanTablet:"MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010",CelkonTablet:"CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b",WolderTablet:"miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b",MediacomTablet:"M-MPI10C3G|M-SP10EG|M-SP10EGP|M-SP10HXAH|M-SP7HXAH|M-SP10HXBH|M-SP8HXAH|M-SP8MXA",MiTablet:"\\bMI PAD\\b|\\bHM NOTE 1W\\b",NibiruTablet:"Nibiru M1|Nibiru Jupiter One",NexoTablet:"NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI",LeaderTablet:"TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100",UbislateTablet:"UbiSlate[\\s]?7C",PocketBookTablet:"Pocketbook",KocasoTablet:"\\b(TB-1207)\\b",HisenseTablet:"\\b(F5281|E2371)\\b",Hudl:"Hudl HT7S3|Hudl 2",TelstraTablet:"T-Hub2",GenericTablet:"Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bTP750\\b|\\bQTAQZ3\\b|WVT101|TM1088|KT107"},oss:{AndroidOS:"Android",BlackBerryOS:"blackberry|\\bBB10\\b|rim tablet os",PalmOS:"PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino",SymbianOS:"Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\bS60\\b",WindowsMobileOS:"Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Windows Mobile|Windows Phone [0-9.]+|WCE;",WindowsPhoneOS:"Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;",iOS:"\\biPhone.*Mobile|\\biPod|\\biPad|AppleCoreMedia",iPadOS:"CPU OS 13",SailfishOS:"Sailfish",MeeGoOS:"MeeGo",MaemoOS:"Maemo",JavaOS:"J2ME/|\\bMIDP\\b|\\bCLDC\\b",webOS:"webOS|hpwOS",badaOS:"\\bBada\\b",BREWOS:"BREW"},uas:{Chrome:"\\bCrMo\\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?",Dolfin:"\\bDolfin\\b",Opera:"Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+$|Coast/[0-9.]+",Skyfire:"Skyfire",Edge:"\\bEdgiOS\\b|Mobile Safari/[.0-9]* Edge",IE:"IEMobile|MSIEMobile",Firefox:"fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS",Bolt:"bolt",TeaShark:"teashark",Blazer:"Blazer",Safari:"Version((?!\\bEdgiOS\\b).)*Mobile.*Safari|Safari.*Mobile|MobileSafari",WeChat:"\\bMicroMessenger\\b",UCBrowser:"UC.*Browser|UCWEB",baiduboxapp:"baiduboxapp",baidubrowser:"baidubrowser",DiigoBrowser:"DiigoBrowser",Mercury:"\\bMercury\\b",ObigoBrowser:"Obigo",NetFront:"NF-Browser",GenericBrowser:"NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger",PaleMoon:"Android.*PaleMoon|Mobile.*PaleMoon"},props:{Mobile:"Mobile/[VER]",Build:"Build/[VER]",Version:"Version/[VER]",VendorID:"VendorID/[VER]",iPad:"iPad.*CPU[a-z ]+[VER]",iPhone:"iPhone.*CPU[a-z ]+[VER]",iPod:"iPod.*CPU[a-z ]+[VER]",Kindle:"Kindle/[VER]",Chrome:["Chrome/[VER]","CriOS/[VER]","CrMo/[VER]"],Coast:["Coast/[VER]"],Dolfin:"Dolfin/[VER]",Firefox:["Firefox/[VER]","FxiOS/[VER]"],Fennec:"Fennec/[VER]",Edge:"Edge/[VER]",IE:["IEMobile/[VER];","IEMobile [VER]","MSIE [VER];","Trident/[0-9.]+;.*rv:[VER]"],NetFront:"NetFront/[VER]",NokiaBrowser:"NokiaBrowser/[VER]",Opera:[" OPR/[VER]","Opera Mini/[VER]","Version/[VER]"],"Opera Mini":"Opera Mini/[VER]","Opera Mobi":"Version/[VER]",UCBrowser:["UCWEB[VER]","UC.*Browser/[VER]"],MQQBrowser:"MQQBrowser/[VER]",MicroMessenger:"MicroMessenger/[VER]",baiduboxapp:"baiduboxapp/[VER]",baidubrowser:"baidubrowser/[VER]",SamsungBrowser:"SamsungBrowser/[VER]",Iron:"Iron/[VER]",Safari:["Version/[VER]","Safari/[VER]"],Skyfire:"Skyfire/[VER]",Tizen:"Tizen/[VER]",Webkit:"webkit[ /][VER]",PaleMoon:"PaleMoon/[VER]",SailfishBrowser:"SailfishBrowser/[VER]",Gecko:"Gecko/[VER]",Trident:"Trident/[VER]",Presto:"Presto/[VER]",Goanna:"Goanna/[VER]",iOS:" \\bi?OS\\b [VER][ ;]{1}",Android:"Android [VER]",Sailfish:"Sailfish [VER]",BlackBerry:["BlackBerry[\\w]+/[VER]","BlackBerry.*Version/[VER]","Version/[VER]"],BREW:"BREW [VER]",Java:"Java/[VER]","Windows Phone OS":["Windows Phone OS [VER]","Windows Phone [VER]"],"Windows Phone":"Windows Phone [VER]","Windows CE":"Windows CE/[VER]","Windows NT":"Windows NT [VER]",Symbian:["SymbianOS/[VER]","Symbian/[VER]"],webOS:["webOS/[VER]","hpwOS/[VER];"]},utils:{Bot:"Googlebot|facebookexternalhit|Google-AMPHTML|s~amp-validator|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom|contentkingapp|AspiegelBot",MobileBot:"Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2",DesktopMode:"WPDesktop",TV:"SonyDTV|HbbTV",WebKit:"(webkit)[ /]([\\w.]+)",Console:"\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|Nintendo Switch|PLAYSTATION|Xbox)\\b",Watch:"SM-V700"}},detectMobileBrowsers:{fullPattern:/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,shortPattern:/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,tabletPattern:/android|ipad|playbook|silk/i}},r=Object.prototype.hasOwnProperty;function a(e,t){return null!=e&&null!=t&&e.toLowerCase()===t.toLowerCase()}function s(e,t){var n,r,a=e.length;if(!a||!t)return!1;for(n=t.toLowerCase(),r=0;r<a;++r)if(n===e[r].toLowerCase())return!0;return!1}function o(e){for(var t in e)r.call(e,t)&&(e[t]=new RegExp(e[t],"i"))}function i(e,t){this.ua=function(e){return(e||"").substr(0,500)}(e),this._cache={},this.maxPhoneWidth=t||600}return n.FALLBACK_PHONE="UnknownPhone",n.FALLBACK_TABLET="UnknownTablet",n.FALLBACK_MOBILE="UnknownMobile",e="isArray"in Array?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},function(){var t,a,s,i,l,u,c=n.mobileDetectRules;for(t in c.props)if(r.call(c.props,t)){for(a=c.props[t],e(a)||(a=[a]),l=a.length,i=0;i<l;++i)(u=(s=a[i]).indexOf("[VER]"))>=0&&(s=s.substring(0,u)+"([\\w._\\+]+)"+s.substring(u+5)),a[i]=new RegExp(s,"i");c.props[t]=a}o(c.oss),o(c.phones),o(c.tablets),o(c.uas),o(c.utils),c.oss0={WindowsPhoneOS:c.oss.WindowsPhoneOS,WindowsMobileOS:c.oss.WindowsMobileOS}}(),n.findMatch=function(e,t){for(var n in e)if(r.call(e,n)&&e[n].test(t))return n;return null},n.findMatches=function(e,t){var n=[];for(var a in e)r.call(e,a)&&e[a].test(t)&&n.push(a);return n},n.getVersionStr=function(e,t){var a,s,o,i,l=n.mobileDetectRules.props;if(r.call(l,e))for(o=(a=l[e]).length,s=0;s<o;++s)if(null!==(i=a[s].exec(t)))return i[1];return null},n.getVersion=function(e,t){var r=n.getVersionStr(e,t);return r?n.prepareVersionNo(r):NaN},n.prepareVersionNo=function(e){var t;return 1===(t=e.split(/[a-z._ \/\-]/i)).length&&(e=t[0]),t.length>1&&(e=t[0]+".",t.shift(),e+=t.join("")),Number(e)},n.isMobileFallback=function(e){return n.detectMobileBrowsers.fullPattern.test(e)||n.detectMobileBrowsers.shortPattern.test(e.substr(0,4))},n.isTabletFallback=function(e){return n.detectMobileBrowsers.tabletPattern.test(e)},n.prepareDetectionCache=function(e,r,a){if(e.mobile===t){var s,o,l;if(o=n.findMatch(n.mobileDetectRules.tablets,r))return e.mobile=e.tablet=o,void(e.phone=null);if(s=n.findMatch(n.mobileDetectRules.phones,r))return e.mobile=e.phone=s,void(e.tablet=null);n.isMobileFallback(r)?(l=i.isPhoneSized(a))===t?(e.mobile=n.FALLBACK_MOBILE,e.tablet=e.phone=null):l?(e.mobile=e.phone=n.FALLBACK_PHONE,e.tablet=null):(e.mobile=e.tablet=n.FALLBACK_TABLET,e.phone=null):n.isTabletFallback(r)?(e.mobile=e.tablet=n.FALLBACK_TABLET,e.phone=null):e.mobile=e.tablet=e.phone=null}},n.mobileGrade=function(e){var t=null!==e.mobile();return e.os("iOS")&&e.version("iPad")>=4.3||e.os("iOS")&&e.version("iPhone")>=3.1||e.os("iOS")&&e.version("iPod")>=3.1||e.version("Android")>2.1&&e.is("Webkit")||e.version("Windows Phone OS")>=7||e.is("BlackBerry")&&e.version("BlackBerry")>=6||e.match("Playbook.*Tablet")||e.version("webOS")>=1.4&&e.match("Palm|Pre|Pixi")||e.match("hp.*TouchPad")||e.is("Firefox")&&e.version("Firefox")>=12||e.is("Chrome")&&e.is("AndroidOS")&&e.version("Android")>=4||e.is("Skyfire")&&e.version("Skyfire")>=4.1&&e.is("AndroidOS")&&e.version("Android")>=2.3||e.is("Opera")&&e.version("Opera Mobi")>11&&e.is("AndroidOS")||e.is("MeeGoOS")||e.is("Tizen")||e.is("Dolfin")&&e.version("Bada")>=2||(e.is("UC Browser")||e.is("Dolfin"))&&e.version("Android")>=2.3||e.match("Kindle Fire")||e.is("Kindle")&&e.version("Kindle")>=3||e.is("AndroidOS")&&e.is("NookTablet")||e.version("Chrome")>=11&&!t||e.version("Safari")>=5&&!t||e.version("Firefox")>=4&&!t||e.version("MSIE")>=7&&!t||e.version("Opera")>=10&&!t?"A":e.os("iOS")&&e.version("iPad")<4.3||e.os("iOS")&&e.version("iPhone")<3.1||e.os("iOS")&&e.version("iPod")<3.1||e.is("Blackberry")&&e.version("BlackBerry")>=5&&e.version("BlackBerry")<6||e.version("Opera Mini")>=5&&e.version("Opera Mini")<=6.5&&(e.version("Android")>=2.3||e.is("iOS"))||e.match("NokiaN8|NokiaC7|N97.*Series60|Symbian/3")||e.version("Opera Mobi")>=11&&e.is("SymbianOS")?"B":(e.version("BlackBerry")<5||e.match("MSIEMobile|Windows CE.*Mobile")||e.version("Windows Mobile"),"C")},n.detectOS=function(e){return n.findMatch(n.mobileDetectRules.oss0,e)||n.findMatch(n.mobileDetectRules.oss,e)},n.getDeviceSmallerSide=function(){return window.screen.width<window.screen.height?window.screen.width:window.screen.height},i.prototype={constructor:i,mobile:function(){return n.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.mobile},phone:function(){return n.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.phone},tablet:function(){return n.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.tablet},userAgent:function(){return this._cache.userAgent===t&&(this._cache.userAgent=n.findMatch(n.mobileDetectRules.uas,this.ua)),this._cache.userAgent},userAgents:function(){return this._cache.userAgents===t&&(this._cache.userAgents=n.findMatches(n.mobileDetectRules.uas,this.ua)),this._cache.userAgents},os:function(){return this._cache.os===t&&(this._cache.os=n.detectOS(this.ua)),this._cache.os},version:function(e){return n.getVersion(e,this.ua)},versionStr:function(e){return n.getVersionStr(e,this.ua)},is:function(e){return s(this.userAgents(),e)||a(e,this.os())||a(e,this.phone())||a(e,this.tablet())||s(n.findMatches(n.mobileDetectRules.utils,this.ua),e)},match:function(e){return e instanceof RegExp||(e=new RegExp(e,"i")),e.test(this.ua)},isPhoneSized:function(e){return i.isPhoneSized(e||this.maxPhoneWidth)},mobileGrade:function(){return this._cache.grade===t&&(this._cache.grade=n.mobileGrade(this)),this._cache.grade}},"undefined"!=typeof window&&window.screen?i.isPhoneSized=function(e){return e<0?t:n.getDeviceSmallerSide()<=e}:i.isPhoneSized=function(){},i._impl=n,i.version="1.4.5 2021-03-13",i}))}(e.exports?function(t){e.exports=t()}:n.amdD)},8985:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Deferred=void 0;t.Deferred=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}}},7279:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EndOfStreamError=t.defaultMessages=void 0,t.defaultMessages="End-Of-Stream";class n extends Error{constructor(){super(t.defaultMessages)}}t.EndOfStreamError=n},6654:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StreamReader=t.EndOfStreamError=void 0;const r=n(7279),a=n(8985);var s=n(7279);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return s.EndOfStreamError}});t.StreamReader=class{constructor(e){if(this.s=e,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new r.EndOfStreamError))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async peek(e,t,n){const r=await this.read(e,t,n);return this.peekQueue.push(e.subarray(t,t+r)),r}async read(e,t,n){if(0===n)return 0;if(0===this.peekQueue.length&&this.endOfStream)throw new r.EndOfStreamError;let a=n,s=0;for(;this.peekQueue.length>0&&a>0;){const n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");const r=Math.min(n.length,a);e.set(n.subarray(0,r),t+s),s+=r,a-=r,r<n.length&&this.peekQueue.push(n.subarray(r))}for(;a>0&&!this.endOfStream;){const n=Math.min(a,1048576),r=await this.readFromStream(e,t+s,n);if(s+=r,r<n)break;a-=r}return s}async readFromStream(e,t,n){const r=this.s.read(n);if(r)return e.set(r,t),r.length;{const r={buffer:e,offset:t,length:n,deferred:new a.Deferred};return this.deferred=r.deferred,this.s.once("readable",(()=>{this.readDeferred(r)})),r.deferred.promise}}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}}},5167:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StreamReader=t.EndOfStreamError=void 0;var r=n(7279);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return r.EndOfStreamError}});var a=n(6654);Object.defineProperty(t,"StreamReader",{enumerable:!0,get:function(){return a.StreamReader}})},4155:e=>{var t,n,r=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var i,l=[],u=!1,c=-1;function d(){u&&i&&(u=!1,i.length?l=i.concat(l):c=-1,l.length&&p())}function p(){if(!u){var e=o(d);u=!0;for(var t=l.length;t;){for(i=l,l=[];++c<t;)i&&i[c].run();c=-1,t=l.length}i=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function f(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||u||o(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},6377:(e,t,n)=>{var r=n(4832),a=n(8652),s=n(801),o=n(2030),i=n(3618),l=n(9049),u=n(1971);u.alea=r,u.xor128=a,u.xorwow=s,u.xorshift7=o,u.xor4096=i,u.tychei=l,e.exports=u},4832:function(e,t,n){var r;!function(e,a,s){function o(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function i(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new o(e),r=t&&t.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},9049:function(e,t,n){var r;!function(e,a,s){function o(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}function i(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function l(e,t){var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},8652:function(e,t,n){var r;!function(e,a,s){function o(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function l(e,t){var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},3618:function(e,t,n){var r;!function(e,a,s){function o(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,s=t.i;return t.w=r=r+1640531527|0,n=a[s+34&127],e=a[s=s+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[s]=n^e,t.i=s,n+(r^r>>>16)|0},function(e,t){var n,r,a,s,o,i=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),a=0,s=-32;s<l;++s)t&&(r^=t.charCodeAt((s+32)%t.length)),0===s&&(o=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,s>=0&&(o=o+1640531527|0,a=0==(n=i[127&s]^=r+o)?a+1:0);for(a>=128&&(i[127&(t&&t.length||0)]=-1),a=127,s=512;s>0;--s)r=i[a+34&127],n=i[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,i[a]=r^n;e.w=o,e.X=i,e.i=a}(t,e)}function i(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.X&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},2030:function(e,t,n){var r;!function(e,a,s){function o(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function i(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.x&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},801:function(e,t,n){var r;!function(e,a,s){function o(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,a))||(a.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},1971:function(e,t,n){var r;!function(a,s,o){var i,l=256,u=o.pow(l,6),c=o.pow(2,52),d=2*c,p=255;function h(e,t,n){var r=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,b(s)]:null==e?function(){try{var e;return i&&(e=i.randomBytes)?e=e(l):(e=new Uint8Array(l),(a.crypto||a.msCrypto).getRandomValues(e)),b(e)}catch(e){var t=a.navigator,n=t&&t.plugins;return[+new Date,a,n,a.screen,b(s)]}}():e,3),r),h=new f(r),x=function(){for(var e=h.g(6),t=u,n=0;e<c;)e=(e+n)*l,t*=l,n=h.g(1);for(;e>=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return x.int32=function(){return 0|h.g(4)},x.quick=function(){return h.g(4)/4294967296},x.double=x,y(b(h.S),s),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,h),e.state=function(){return m(h,{})}),n?(o.random=e,t):e})(x,p,"global"in t?t.global:this==o,t.state)}function f(e){var t,n=e.length,r=this,a=0,s=r.i=r.j=0,o=r.S=[];for(n||(e=[n++]);a<l;)o[a]=a++;for(a=0;a<l;a++)o[a]=o[s=p&s+e[a%n]+(t=o[a])],o[s]=t;(r.g=function(e){for(var t,n=0,a=r.i,s=r.j,o=r.S;e--;)t=o[a=p&a+1],n=n*l+o[p&(o[a]=o[s=p&s+t])+(o[s]=t)];return r.i=a,r.j=s,n})(l)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n,r=[],a=typeof e;if(t&&"object"==a)for(n in e)try{r.push(g(e[n],t-1))}catch(e){}return r.length?r:"string"==a?e:e+"\0"}function y(e,t){for(var n,r=e+"",a=0;a<r.length;)t[p&a]=p&(n^=19*t[p&a])+r.charCodeAt(a++);return b(t)}function b(e){return String.fromCharCode.apply(0,e)}if(y(o.random(),s),e.exports){e.exports=h;try{i=n(5042)}catch(e){}}else void 0===(r=function(){return h}.call(t,n,t,e))||(e.exports=r)}("undefined"!=typeof self?self:this,[],Math)},842:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractTokenizer=void 0;const r=n(5167);t.AbstractTokenizer=class{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const n=Buffer.alloc(e.len);if(await this.readBuffer(n,{position:t})<e.len)throw new r.EndOfStreamError;return e.get(n,0)}async peekToken(e,t=this.position){const n=Buffer.alloc(e.len);if(await this.peekBuffer(n,{position:t})<e.len)throw new r.EndOfStreamError;return e.get(n,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new r.EndOfStreamError;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new r.EndOfStreamError;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}}},778:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferTokenizer=void 0;const r=n(5167),a=n(842);class s extends a.AbstractTokenizer{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){const n=this.normalizeOptions(e,t),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new r.EndOfStreamError;return e.set(this.uint8Array.subarray(n.position,n.position+a),n.offset),a}async close(){}}t.BufferTokenizer=s},7859:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromFile=t.FileTokenizer=void 0;const r=n(842),a=n(5167),s=n(7209);class o extends r.AbstractTokenizer{constructor(e,t){super(t),this.fd=e}async readBuffer(e,t){const n=this.normalizeOptions(e,t);this.position=n.position;const r=await s.read(this.fd,e,n.offset,n.length,n.position);if(this.position+=r.bytesRead,r.bytesRead<n.length&&(!t||!t.mayBeLess))throw new a.EndOfStreamError;return r.bytesRead}async peekBuffer(e,t){const n=this.normalizeOptions(e,t),r=await s.read(this.fd,e,n.offset,n.length,n.position);if(!n.mayBeLess&&r.bytesRead<n.length)throw new a.EndOfStreamError;return r.bytesRead}async close(){return s.close(this.fd)}}t.FileTokenizer=o,t.fromFile=async function(e){const t=await s.stat(e);if(!t.isFile)throw new Error(`File not a file: ${e}`);const n=await s.open(e,"r");return new o(n,{path:e,size:t.size})}},7209:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readFile=t.writeFileSync=t.writeFile=t.read=t.open=t.close=t.stat=t.createReadStream=t.pathExists=void 0;const r=n(4059);t.pathExists=r.existsSync,t.createReadStream=r.createReadStream,t.stat=async function(e){return new Promise(((t,n)=>{r.stat(e,((e,r)=>{e?n(e):t(r)}))}))},t.close=async function(e){return new Promise(((t,n)=>{r.close(e,(e=>{e?n(e):t()}))}))},t.open=async function(e,t){return new Promise(((n,a)=>{r.open(e,t,((e,t)=>{e?a(e):n(t)}))}))},t.read=async function(e,t,n,a,s){return new Promise(((o,i)=>{r.read(e,t,n,a,s,((e,t,n)=>{e?i(e):o({bytesRead:t,buffer:n})}))}))},t.writeFile=async function(e,t){return new Promise(((n,a)=>{r.writeFile(e,t,(e=>{e?a(e):n()}))}))},t.writeFileSync=function(e,t){r.writeFileSync(e,t)},t.readFile=async function(e){return new Promise(((t,n)=>{r.readFile(e,((e,r)=>{e?n(e):t(r)}))}))}},599:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReadStreamTokenizer=void 0;const r=n(842),a=n(5167);class s extends r.AbstractTokenizer{constructor(e,t){super(t),this.streamReader=new a.StreamReader(e)}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const n=this.normalizeOptions(e,t),r=n.position-this.position;if(r>0)return await this.ignore(r),this.readBuffer(e,t);if(r<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===n.length)return 0;const s=await this.streamReader.read(e,n.offset,n.length);if(this.position+=s,(!t||!t.mayBeLess)&&s<n.length)throw new a.EndOfStreamError;return s}async peekBuffer(e,t){const n=this.normalizeOptions(e,t);let r=0;if(n.position){const t=n.position-this.position;if(t>0){const a=new Uint8Array(n.length+t);return r=await this.peekBuffer(a,{mayBeLess:n.mayBeLess}),e.set(a.subarray(t),n.offset),r-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{r=await this.streamReader.peek(e,n.offset,n.length)}catch(e){if(t&&t.mayBeLess&&e instanceof a.EndOfStreamError)return 0;throw e}if(!n.mayBeLess&&r<n.length)throw new a.EndOfStreamError}return r}async ignore(e){const t=Math.min(256e3,e),n=new Uint8Array(t);let r=0;for(;r<e;){const a=e-r,s=await this.readBuffer(n,{length:Math.min(t,a)});if(s<0)return s;r+=s}return r}}t.ReadStreamTokenizer=s},5849:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromStream=t.EndOfStreamError=void 0;const r=n(599),a=n(778);var s=n(5167);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return s.EndOfStreamError}}),t.fromStream=function(e,t){return t=t||{},new r.ReadStreamTokenizer(e,t)},t.fromBuffer=function(e,t){return new a.BufferTokenizer(e,t)}},6597:(e,t,n)=>{t.FY=t.dL=void 0;const r=n(7209),a=n(5849);var s=n(7859);var o=n(5849);Object.defineProperty(t,"dL",{enumerable:!0,get:function(){return o.EndOfStreamError}}),Object.defineProperty(t,"FY",{enumerable:!0,get:function(){return o.fromBuffer}})},3416:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnsiStringType=t.StringType=t.BufferType=t.Uint8ArrayType=t.IgnoreType=t.Float80_LE=t.Float80_BE=t.Float64_LE=t.Float64_BE=t.Float32_LE=t.Float32_BE=t.Float16_LE=t.Float16_BE=t.INT64_BE=t.UINT64_BE=t.INT64_LE=t.UINT64_LE=t.INT32_LE=t.INT32_BE=t.INT24_BE=t.INT24_LE=t.INT16_LE=t.INT16_BE=t.INT8=t.UINT32_BE=t.UINT32_LE=t.UINT24_BE=t.UINT24_LE=t.UINT16_BE=t.UINT16_LE=t.UINT8=void 0;const r=n(645);function a(e){return new DataView(e.buffer,e.byteOffset)}t.UINT8={len:1,get:(e,t)=>a(e).getUint8(t),put:(e,t,n)=>(a(e).setUint8(t,n),t+1)},t.UINT16_LE={len:2,get:(e,t)=>a(e).getUint16(t,!0),put:(e,t,n)=>(a(e).setUint16(t,n,!0),t+2)},t.UINT16_BE={len:2,get:(e,t)=>a(e).getUint16(t),put:(e,t,n)=>(a(e).setUint16(t,n),t+2)},t.UINT24_LE={len:3,get(e,t){const n=a(e);return n.getUint8(t)+(n.getUint16(t+1,!0)<<8)},put(e,t,n){const r=a(e);return r.setUint8(t,255&n),r.setUint16(t+1,n>>8,!0),t+3}},t.UINT24_BE={len:3,get(e,t){const n=a(e);return(n.getUint16(t)<<8)+n.getUint8(t+2)},put(e,t,n){const r=a(e);return r.setUint16(t,n>>8),r.setUint8(t+2,255&n),t+3}},t.UINT32_LE={len:4,get:(e,t)=>a(e).getUint32(t,!0),put:(e,t,n)=>(a(e).setUint32(t,n,!0),t+4)},t.UINT32_BE={len:4,get:(e,t)=>a(e).getUint32(t),put:(e,t,n)=>(a(e).setUint32(t,n),t+4)},t.INT8={len:1,get:(e,t)=>a(e).getInt8(t),put:(e,t,n)=>(a(e).setInt8(t,n),t+1)},t.INT16_BE={len:2,get:(e,t)=>a(e).getInt16(t),put:(e,t,n)=>(a(e).setInt16(t,n),t+2)},t.INT16_LE={len:2,get:(e,t)=>a(e).getInt16(t,!0),put:(e,t,n)=>(a(e).setInt16(t,n,!0),t+2)},t.INT24_LE={len:3,get(e,n){const r=t.UINT24_LE.get(e,n);return r>8388607?r-16777216:r},put(e,t,n){const r=a(e);return r.setUint8(t,255&n),r.setUint16(t+1,n>>8,!0),t+3}},t.INT24_BE={len:3,get(e,n){const r=t.UINT24_BE.get(e,n);return r>8388607?r-16777216:r},put(e,t,n){const r=a(e);return r.setUint16(t,n>>8),r.setUint8(t+2,255&n),t+3}},t.INT32_BE={len:4,get:(e,t)=>a(e).getInt32(t),put:(e,t,n)=>(a(e).setInt32(t,n),t+4)},t.INT32_LE={len:4,get:(e,t)=>a(e).getInt32(t,!0),put:(e,t,n)=>(a(e).setInt32(t,n,!0),t+4)},t.UINT64_LE={len:8,get:(e,t)=>a(e).getBigUint64(t,!0),put:(e,t,n)=>(a(e).setBigUint64(t,n,!0),t+8)},t.INT64_LE={len:8,get:(e,t)=>a(e).getBigInt64(t,!0),put:(e,t,n)=>(a(e).setBigInt64(t,n,!0),t+8)},t.UINT64_BE={len:8,get:(e,t)=>a(e).getBigUint64(t),put:(e,t,n)=>(a(e).setBigUint64(t,n),t+8)},t.INT64_BE={len:8,get:(e,t)=>a(e).getBigInt64(t),put:(e,t,n)=>(a(e).setBigInt64(t,n),t+8)},t.Float16_BE={len:2,get(e,t){return r.read(e,t,!1,10,this.len)},put(e,t,n){return r.write(e,n,t,!1,10,this.len),t+this.len}},t.Float16_LE={len:2,get(e,t){return r.read(e,t,!0,10,this.len)},put(e,t,n){return r.write(e,n,t,!0,10,this.len),t+this.len}},t.Float32_BE={len:4,get:(e,t)=>a(e).getFloat32(t),put:(e,t,n)=>(a(e).setFloat32(t,n),t+4)},t.Float32_LE={len:4,get:(e,t)=>a(e).getFloat32(t,!0),put:(e,t,n)=>(a(e).setFloat32(t,n,!0),t+4)},t.Float64_BE={len:8,get:(e,t)=>a(e).getFloat64(t),put:(e,t,n)=>(a(e).setFloat64(t,n),t+8)},t.Float64_LE={len:8,get:(e,t)=>a(e).getFloat64(t,!0),put:(e,t,n)=>(a(e).setFloat64(t,n,!0),t+8)},t.Float80_BE={len:10,get(e,t){return r.read(e,t,!1,63,this.len)},put(e,t,n){return r.write(e,n,t,!1,63,this.len),t+this.len}},t.Float80_LE={len:10,get(e,t){return r.read(e,t,!0,63,this.len)},put(e,t,n){return r.write(e,n,t,!0,63,this.len),t+this.len}};t.IgnoreType=class{constructor(e){this.len=e}get(e,t){}};t.Uint8ArrayType=class{constructor(e){this.len=e}get(e,t){return e.subarray(t,t+this.len)}};t.BufferType=class{constructor(e){this.len=e}get(e,t){return Buffer.from(e.subarray(t,t+this.len))}};t.StringType=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return Buffer.from(e).toString(this.encoding,t,t+this.len)}};class s{constructor(e){this.len=e}static decode(e,t,n){let r="";for(let a=t;a<n;++a)r+=s.codePointToString(s.singleByteDecoder(e[a]));return r}static inRange(e,t,n){return t<=e&&e<=n}static codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}static singleByteDecoder(e){if(s.inRange(e,0,127))return e;const t=s.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}get(e,t=0){return s.decode(e,t,t+this.len)}}t.AnsiStringType=s,s.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},2372:(e,t,n)=>{n.d(t,{Z:()=>d});var r=n(1494);const a=[{oneLetterKey:"a",fullNameKey:"userAgent"},{oneLetterKey:"c",fullNameKey:"capturedMethod"},{oneLetterKey:"l",fullNameKey:"logs"},{oneLetterKey:"s",fullNameKey:"steps"}];var s=n(9423);class o{constructor(){this.data={},this.currentStep=""}set step(e){"steps"in this.data||(this.data.steps={}),e in this.data.steps||(this.data.steps[e]={start:0,end:0,duration:0}),this.currentStep=e}get step(){return this.currentStep}get stepData(){return this.data.steps[this.currentStep]}get steps(){const e={};return Object.keys(this.data.steps).forEach((t=>{const n=s.Z[t].id;e[n]=this.data.steps[t].duration})),e}start(){this.data.steps[this.currentStep].start=Math.trunc(performance.now())}end(){const e=this.data.steps[this.currentStep];e.end=Math.trunc(performance.now()),e.duration=e.end-e.start}}class i{constructor(){this.logger=new o}startLogger(e){this.changeStep(e),this.logger.start()}setLogger(e){this.logger.currentStep||this.startLogger(e),this.logger.currentStep!==e&&(this.logger.end(),this.startLogger(e))}end(){this.logger.end()}start(){this.logger.start()}changeStep(e){this.logger.step=e}changeCurrentStep(e){this.logger.currentStep=e}getSteps(){return this.logger.steps}getStep(){return this.logger.step}prepareDataForSubmit(){const e={};return Object.keys(this.logger.data).forEach((t=>{a.forEach((n=>{n.fullNameKey===t&&(e[n.oneLetterKey]=this.logger[t])}))})),e}}var l=n(5622);class u{constructor(){this.userAgent=window.navigator.userAgent,this.capturedMethod="",this.logs={}}captureMethod(e){this.capturedMethod=e.reduce(((e,t)=>{let n="";return!0===t.isAuto?n="1":"file"===t.source?n="0":"video"===t.source&&(n="2"),`${e}${n}`}),"")}getMetaData(e){this.captureMethod(e);const t=Object.keys(this),n={};return t.forEach((e=>{a.forEach((t=>{t.fullNameKey===e&&(n[t.oneLetterKey]=this[t.fullNameKey])}))})),n}prepareMetaDataForSubmit(e){const t=this.getMetaData(e);return(e=>{const t={},n=e;let r,a,s="";const o=[];let i="",l=256;for(let e=0;e<256;e+=1)t[String.fromCharCode(e)]=e;for(let e=0;e<n.length;e+=1)r=n.charAt(e),a=s+r,t.hasOwnProperty(a)?s=a:(o.push(t[s]),i+=String.fromCharCode(t[s]),t[a]=l,l+=1,s=String(r));return""!==s&&(o.push(t[s]),i+=String.fromCharCode(t[s])),i})(JSON.stringify(t))}}var c=n(6879);const d={globalMax:0,topImage:null,running:!1,stepTime:0,steps:[],allowedTypesIds:[],curStep:0,type:0,isRealFaceAvailable:!1,realFaceTurnSide:c.m.LEFT,capturingMode:"processImage5",isStarted:!1,isBrowserSupport:!0,origData:null,resizedData:null,cameraSupported:!0,isMirroring:!1,RUNTIME:"webgl",VERSION:"2.2.0",k:1,minPDFframes:2,networkUrl:"",isVideoCapture:!1,isDetectFace:!1,isMobile:!1,videoLoading:!1,sizeK:1.56,stream:null,track:null,firstCameraInit:!1,config:{},invertFace:!1,passpFront:null,passpMrzData:"",loop:null,loopStarted:!1,loopFrame:!1,showForceCapturingBtn:!1,baseWidth:0,baseHeight:0,resizedCanvasSizes:{width:0,height:0},videoCanvasSizes:{width:0,height:0},cropResizedSizes:{width:0,height:0},cropFace:{width:0,height:0},cropSizes:{width:0,height:0},resizedToBorder:{width:0,height:0},offsetsFace:{left:0,top:0},offsetsResized:{left:0,top:0},offsets:{left:0,top:0},isShowComeBackText:!1,isShowTurnText:!1,isShowCloserText:!1,isShowCenterText:!1,isShowAwayText:!1,isShowStayCalmText:!1,isShowNotSeeText:!1,isShowFacePercentText:!1,isShowHelpText:!1,isShowStayText:!1,isShowHoldText:!1,uploader:null,loggerController:null,keys:{imageProcessingKey:"",pdf417key:"",commonLicenseKey:""},licenseKeyError:null,metaData:null,processFace3d:{started:!1,ended:!0,start(){this.started=!0,this.ended=!1},end(){this.started=!1,this.ended=!0}},resetHints(){this.isShowStayText=!1,this.isShowHoldText=!1,this.isShowHelpText=!1,this.isShowCloserText=!1,this.isShowCenterText=!1,this.isShowAwayText=!1,this.isShowComeBackText=!1,this.isShowTurnText=!1,this.isShowFacePercentText=!1,this.isShowStayCalmText=!1,this.isShowNotSeeText=!1},clearStepData(){this.resizedData=null,this.origData=null},resetStats(){this.stepTime=Date.now(),this.topImage=null,this.clearStepData()},get cropSize(){return{width:this.cropSizes.width,height:this.cropSizes.height}},set cropSize({width:e,height:t}){this.cropSizes.width=e,this.cropSizes.height=t},get cropResizedSize(){return{width:this.cropResizedSizes.width,height:this.cropResizedSizes.height}},set cropResizedSize({width:e,height:t}){this.cropResizedSizes.width=e,this.cropResizedSizes.height=t},get cropFaceSize(){return{width:this.cropFace.width,height:this.cropFace.height}},set cropFaceSize({width:e,height:t}){this.cropFace.width=e,this.cropFace.height=t},set baseSizes({width:e,height:t}){this.baseWidth=e,this.baseHeight=t},get baseSizes(){return{width:this.baseWidth,height:this.baseHeight}},get currentStepObj(){return this.steps[this.currentStep]},get currentStepMode(){return this.currentStepObj.capturingMode},get currentStepType(){const e=this.currentStep>=0?this.currentStep:0;return this?.steps[e]?.type},set currentStepImg(e){const t=this.currentStep>=0?this.currentStep:0;this.steps[t].img=e},get currentStepImg(){const e=this.currentStep>=0?this.currentStep:0;return this?.steps[e]?.img},get currentStepCamera(){const e=this.currentStep>=0?this.currentStep:0,t=this?.steps[e]?.camera;return t||"environment"},get currentStep(){return this.curStep},set currentStep(e){this.curStep=+e},set resizedToBorderScale({width:e,height:t}){this.resizedToBorder.width=+e,this.resizedToBorder.height=+t},get resizedToBorderScale(){return{width:this.resizedToBorder.width,height:this.resizedToBorder.height}},calculateIsMirroring(){this.isMirroring="user"===this.currentStepObj.camera||!this.isMobile},dropSizes(){this.baseWidth=1600,this.baseHeight=1600,this.resizedCanvasSizes={width:0,height:0},this.videoCanvasSizes={width:0,height:0},this.cropResizedSize={width:0,height:0},this.cropFaceSize={width:0,height:0},this.cropSize={width:0,height:0},this.offsetsFace={left:0,top:0},this.offsetsResized={left:0,top:0},this.offsets={left:0,top:0}},dropKeys(){if(this.keys={pdf417key:"",imageProcessingKey:"",commonLicenseKey:""},delete this.licenseKeyError,this.config.licenseKey)try{this.keys=JSON.parse(atob(this.config.licenseKey))}catch(e){this.licenseKeyError="Invalid License Key"}},dropMediaDevices(){this.stream=null,this.track=null,this.videoLoading=!1,this.invertFace=!1,this.isDetectFace=!1},dropState(){this.isVideoCapture=!1,this.isStarted=!1,this.steps=[],this.curStep=-1,this.type=0,this.passpFront=null,this.loopFrame=!1},dropCounters(){this.sizeK=1.56},fillSteps(){this.type=r.Z.idByName(this.config.types[0]),this.config.steps=this.config.documentTypes[this.config.types[0]],this.steps=Object.values(this.config.steps).map((e=>l.Z.createStep(e)))},setMRZParsedResults(e){this.currentStepObj.mrzText=e.mrzText},updateRealFaceTurnSide(){this.realFaceTurnSide=((e,t)=>{const n=Math.ceil(e),r=Math.floor(t);return Math.floor(Math.random()*(r-n+1))+n})(0,2)},init(){this.dropKeys(),this.resetStats(),this.dropSizes(),this.resetHints(),this.dropMediaDevices(),this.dropState(),this.fillSteps(),this.capturingMode="processImage5",this.showForceCapturingBtn=!1,this.isRealFaceAvailable=!0,this.allowedTypesIds=r.Z.idsByNames(this.config.types),this.loggerController=new i,this.metaData=new u,this.networkUrl=this.config.useCDN?"https://neurons.cdn.idscan.net":`${this.config.networkUrl}`}}},1494:(e,t,n)=>{n.d(t,{Z:()=>r});const r={items:[{name:"ID",id:1,nName:"",humanName:"Driver's License or ID card"},{name:"Passport",id:2,nName:"passp",humanName:"Passport"},{name:"PassportCard",id:3,nName:"passpcard",humanName:"Passport Card"},{name:"GreenCard",id:6,nName:"gc",humanName:"Green Card or Employment Authorization"},{name:"InternationalId",id:7,nName:"iid",humanName:"International ID"},{name:"VIN",id:8,nName:"vin",humanName:"Vehicle Identification Number"},{name:"Barcode",id:9,nName:"barcode",humanName:"1-D and 2-D Barcodes"}],get length(){return this.items.length},ids(){return this.items.map((e=>e.id))},names(){return this.items.map((e=>e.name))},nameById(e){const t=this.items.filter((t=>t.id===e));return t.length?t[0].name:""},humanNameById(e){const t=this.items.filter((t=>t.id===e));return t.length?t[0].humanName:""},humanNames(){const e=[];return this.items.forEach((t=>{e[t.id]=t.humanName})),e},humanNameByName(e){const t=e.toLowerCase(),n=this.items.find((e=>e.name.toLowerCase()===t));return n?n.humanName:""},setHumanName(e){Object.keys(e).forEach((t=>{this.items.find((e=>e.name===t)).humanName=e[t]}))},idByName(e){const t=e.toLowerCase();if(this.items&&this.items.length>0){return this.items.find((e=>e?.name.toLowerCase()===t))?.id||0}return 0},idsByNames(e){return e.map(this.idByName.bind(this))},recordById(e){if(0===e)return null;for(let t=0;t<=this.length;t+=1)if(this.items[t].id===e)return this.items[t];return null}}},6444:(e,t,n)=>{n.d(t,{J3:()=>r,_2:()=>o,i0:()=>i});const r=["en","es"],a={es:{errorCodes:{mrz:"MRZ no fue reconocido",barcode:"Advertencia: <br/>No se pudieron leer los datos del código de barras.<br/>Intenta tomar una imagen de mayor calidad.",heic:"El archivo HEIC está dañado",fileTypeHeic:"Error de tipo de archivo. Solo se admiten los tipos de archivo JPEG, PNG y HEIC.",fileType:"Error de tipo de archivo. Solo se admiten los tipos de archivo JPEG y PNG.",disableStepFileUpload:"Se debe utilizar un dispositivo con una cámara para capturar esta imagen",notAllowedDocument:"Este tipo de documento no está permitido",frontSide:"Advertencia: <br/>No se pudo leer la parte frontal del documento. <br/>Intenta tomar una imagen de mayor calidad",default:"Lo sentimos, pero algo salió mal. Inténtalo de nuevo",CameraNotFound:"No se encontró ninguna cámara en su dispositivo",CameraNotAllowed:"Se le ha denegado el permiso para acceder a la cámara",CameraNotAvailable:"La cámara no está disponible en este momento",CameraInUse:"La cámara ya está en uso",MediaDevicesNotSupported:"Tu navegador no es compatible"},hintTexts:{front:"Coloque el anverso del documento",frontMRZ:"Haga zoom para capturar el código en la parte inferior",mrz:"Haga zoom para capturar el código en la parte posterior",capturing:"Coloque el anverso del documento",pdf:"Coloque el código de barras dentro del marco",back:"Da la vuelta a tu documento",barcode:"Coloque el código de barras dentro del marco",hold:"Sostener el **placeholder** lado del documento <br> dentro de la caja",dontSee:"No te veo",dontMove:"No te muevas",turnFaceLeft:"Gira la cara a la izquierda",turnFaceRight:"Gira la cara a la derecha",turnFaceUp:"Levanta tu cara",turnFaceDown:"Bajar la cara",faceCam:"Enfréntate a la cámara",camAway:"Mover la cámara más lejos",moveCenter:"Mover al centro",comeCloser:"Acércate",holdCamera:"Manténgase firme, analizando el documento <br>"},keyErrors:["La clave de licencia ha caducado","Clave de licencia no válida"],typeError:{typeSelectHeader:"Tipo no definido. <br> Seleccione manualmente",typeErrorHeader:"Este tipo de documento no está permitido",typeErrorBody:"Solo se permiten los siguientes tipos de documentos:"},camera:{loading:"Carga",awaiting:"A la espera de la respuesta de la cámara"},general:{documentType:"Su Tipo de Documento es",selectDocumentTypeText:"Seleccionar Tipo de Documento",changeBtn:"Cambiar",correctBtn:"Corregir",cancelBtn:"Cancelar",doneBtn:"Hecho",closeBtn:"Cerrar",retakeBtn:"VOLVER",continueBtn:"CONTINUAR",submitBtn:"ENVIAR",resetAllStepsBtn:"Restablecer todos los pasos",btnUploader:"Cambiar a cargador manual",btnCamera:"Cambiar al modo de cámara",pressToUpdateText:"Pulse para actualizar",pressToUpdateTextSuccess:"Pulse para actualizar"},uploaderDescription:{textFront:"Haga clic aquí para cargar el frente de su identificación",textBack:"Haga clic aquí para cargar el reverso de una identificación",textFace:"Haga clic aquí para cargar una foto de su rostro",textPdf:"Haga clic aquí para cargar el reverso de una identificación",textMrz:"Haga clic aquí para cargar una foto de su documento'",textFrontBack:"Asegúrese de que su identificación llene toda la pantalla de la cámara con poco o ningún fondo.",textPass:"Asegúrese de que su identificación llene toda la pantalla de la cámara <br> con poco o ningún fondo, y que se incluya el código MRZ completo",textFacePosition:"Coloque su rostro para ocupar toda la pantalla de la cámara con poco o ningún fondo."},documentsTypes:{ID:"Licencia de Conducir",Passport:"Pasaporte",PassportCard:"Tarjeta de Pasaporte",GreenCard:"Tarjeta Verde o Autorización de Empleo",InternationalId:"Identificación Internacional"}},en:{errorCodes:{mrz:"MRZ not recognized",barcode:"Warning: <br/>Barcode data could not be read.<br/>Try taking a higher quality image.",heic:"HEIC file incorrupted",fileType:"Error file type. Only jpeg and png supported.",fileTypeHeic:"Error file type. Only jpeg, png and heic supported.",disableStepFileUpload:"A device with a camera must be used to capture this image",notAllowedDocument:"This document type is not allowed",frontSide:"Warning: <br/>Front of the document could not be read. <br/>Try taking a higher quality image",default:"We're sorry, but something went wrong. Please try again",CameraNotFound:"No camera was found on your device",CameraNotAllowed:"You have denied camera access permission",CameraNotAvailable:"Camera is not available at this moment",CameraInUse:"Camera is already in use",MediaDevicesNotSupported:"Your browser is not supported"},hintTexts:{front:"Position the front of the document",frontMRZ:"Zoom in to capture code at bottom",mrz:"Zoom in to capture code on back side",capturing:"Position the front of the document",pdf:"Position the barcode inside the frame",back:"Turn around your document",barcode:"Position the barcode inside the frame",hold:"Hold the **placeholder** side of the document <br> inside the box",dontSee:"I don't see you",dontMove:"Don't move",turnFaceLeft:"Turn your face left",turnFaceRight:"Turn your face right",turnFaceUp:"Turn your face up",turnFaceDown:"Turn your face down",faceCam:"Face the camera",camAway:"Move camera further away",moveCenter:"Move to the center",comeCloser:"Come closer",holdCamera:"Hold steady, analyzing document <br>"},keyErrors:["License Key has expired","Invalid license key"],typeError:{typeSelectHeader:"Type not defined. <br> Please select manually",typeErrorHeader:"This document type is not allowed",typeErrorBody:"Only the following document types are allowed:"},camera:{loading:"Loading",awaiting:"Awaiting camera response"},general:{documentType:"Your document type is",selectDocumentTypeText:"Select Document Type",changeBtn:"Change",correctBtn:"Correct",cancelBtn:"Cancel",doneBtn:"Done",closeBtn:"CLOSE",retakeBtn:"Retake",continueBtn:"CONTINUE",submitBtn:"SUBMIT",resetAllStepsBtn:"Reset all steps",btnUploader:"Switch to manual uploader",btnCamera:"Switch to camera mode",pressToUpdateText:"Press to update",pressToUpdateTextSuccess:"Press to update"},documentsTypes:{ID:"Driver's License",Passport:"Passport",PassportCard:"Passport Card",GreenCard:"Green Card or Employment Authorization",InternationalId:"International ID"},uploaderDescription:{textFront:"Click here to upload the front of your ID",textBack:"Click here to upload the back of your ID",textFace:"Click here to upload a photo of your face",textPdf:"Click here to upload the back of a ID",textMrz:"Click here to upload a photo of your document",textFrontBack:"Please make sure your ID fills up the entire <br> camera screen with little to no background.",textPass:"Please make sure your ID fills up the entire camera screen <br> with little to no background, and the full MRZ code is included.",textFacePosition:"Please position your face to take up <br> the full camera screen with little to no background."}}};let s=a.en;const o=e=>{if(e){const t=e.toLowerCase(),n=Object.keys(a).includes(t)?t:"en";s=a[n]}else s=a.en},i=e=>e?s[e]:s},9423:(e,t,n)=>{n.d(t,{Z:()=>r});const r={auto:{id:0,camera:"environment",name:"Front Scan",time:5,max:.15,core:["tf","mrz"],description:"capture of a document with the following analysis of the document type. In case if a document requires the back side, the step for the back side of a document will be added automatically. Use the step &#39;front&#39; if you use the component for the document validation."},mrz:{id:1,camera:"environment",name:"MRZ",time:5,core:["mrz"],description:"detection, capture and parsing of the mrz-code of a document."},front:{id:2,camera:"environment",name:"Front Scan",time:5,max:.15,core:["tf"],description:"capture front of a document without analysis."},pdf:{id:3,camera:"environment",name:"PDF",time:5,core:["pdf"],description:"detection and capture of pdf417 of a document."},back:{id:4,camera:"environment",name:"Back Scan",time:5,core:["mrz","pdf"],description:""},face:{id:5,camera:"user",name:"Face",time:10,max:.33,core:["face"],description:"detection and capture of a face using the front camera."},barcode:{id:6,camera:"environment",name:"Barcode",time:5,core:["barcode"],description:"detection, capture and parsing 1 dimensional (barcodes) or 2 dimensional (qr codes)."},photo:{id:7,camera:"environment",name:"Photo",time:5,core:[],description:"Take a photo."}}},9224:(e,t,n)=>{n.d(t,{az:()=>r,ve:()=>a});const r=(e="div",t=null,n=[],r=null,a=[])=>{const s=document.createElement(e);return t&&Object.keys(t).length&&Object.entries(t).forEach((([e,t])=>{"textContent"===e&&(s.textContent=t.toString()),"boolean"==typeof t?t&&s.setAttribute(e,""):s.setAttribute(e,t)})),s.classList.add(...n),null!==r&&r instanceof HTMLElement&&r.appendChild(s),0!==a.length&&a.forEach((e=>s.appendChild(e))),s},a=e=>new Promise((t=>{const n=document.createElement("script");n.async=!0,n.type="module",document.getElementsByTagName("head")[0].appendChild(n),n.onload=()=>t(n),n.src=e}))},7868:(e,t,n)=>{n.d(t,{ew:()=>a,jA:()=>r});const r=(e,{baseWidth:t,baseHeight:n})=>{let r=e,a=e;return t>n&&(r=e,a=r*n/t),n>t&&(a=e,r=a*t/n),{width:Math.trunc(r),height:Math.trunc(a)}},a=e=>{let t=Math.abs(Math.trunc(255-e));return t>200&&(t=200),t<50&&(t=50),`rgba(255,215,${t.toString()},0.3)`}},4526:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(2372),a=n(2328),s=n(6444);const o=(e=0)=>{const t=(0,s.i0)("keyErrors"),n=+e,o=n>=0&&n<=t.length;r.Z.licenseKeyError=o?t[n]:t[0],a.Z.updateKeyError()}},8169:(e,t,n)=>{n.d(t,{ZP:()=>o,lv:()=>s});const r=(...e)=>{const t=(e,t)=>e+(Number.isFinite(t)?t:0),n=Array.isArray(e[0])?e[0]:e,r=n.length;return Array.isArray(n)&&n.length?n.reduce(t,0)/r:0},a={unbiased:e=>Array.isArray(e)?e.length-1:-1,biased:e=>Array.isArray(e)?e.length+1:-1,uncorrected:e=>Array.isArray(e)?e.length:-1},s=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),o={randomIntFromInterval:s,mean:r,STD:(e,t="unbiased",n=-1)=>{if(!Array.isArray(e)||!e.length)return-1;const s=r(e),o=a[t](e),i=e.reduce(((e,t)=>e+(s-t)**2),0)/o,l=Math.sqrt(i);return n>-1?+l.toFixed(n):l}}},5034:(e,t,n)=>{n.d(t,{RG:()=>a,Ue:()=>o,uH:()=>s});const r=e=>window.atob(e),a=e=>{const t=r(e),n=t.length,a=new Uint8Array(new ArrayBuffer(n));for(let e=0;e<n;e+=1)a[e]=t.charCodeAt(e);return a},s=e=>{const t=";base64,",n=e.indexOf(t)+t.length;return e.substring(n)},o=e=>e.trim().toLowerCase()},5226:(e,t,n)=>{n.d(t,{Z:()=>s});var r=n(2372),a=n(1494);const s=e=>{const{allowedTypesIds:t}=r.Z;e.clearList(),t.map((e=>a.Z.recordById(e))).forEach((t=>{t&&e.addType(t)})),e.render()}},5622:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(9423);class a{constructor(e,t,n,r,a){if(this.configs=[],"string"==typeof e)this.name=e,this.type=t||"front",this.camera=n||"environment",this.img=a||null,this.time=0;else{const{name:t,type:n,camera:r,img:a,err:s,text:o,time:i,configs:l}=e;this.name=t,this.type=n,this.camera=r,this.img=a,this.time=i||0,s&&(this.err=s),o&&(this.text=o),l&&l.length&&l.forEach((e=>{this.setConfig(e.name,e.value)}))}}setConfig(e,t){const n=this.hasConfig(e);n?n.value=t:this.configs.push({name:e,value:t})}hasConfig(e){return this.configs.find((({name:t})=>t===e))}getConfig(e){const t=this.configs.find((({name:t})=>t===e));return t?t.value:null}get isShowManualSwitchButton(){const e=this.getConfig("mode");let t=!0;return e&&(t=!(!e.uploader||!e.video)),t}get capturingMode(){const e=this.getConfig("mode"),t={uploader:!0,video:!0};return e&&(t.video="boolean"!=typeof e.video||e.video,t.uploader="boolean"!=typeof e.uploader||e.uploader),t}prepareStepForCallback(e){const t={index:e+1,img:this.img,type:this.type,isAuto:this.isAuto,source:this.source?this.source:""};return this.trackString&&(t.trackString=this.trackString),this.mrzText&&(t.mrzText=this.mrzText),this.mrzImg&&(t.mrzImg=this.mrzImg),t}static createStep(e){const t=Object.keys(e).filter((e=>{const t=e.toLowerCase().trim();return"type"!==t&&"camera"!==t&&"name"!==t&&t})),{type:n,camera:s,name:o}=e,i={type:n,img:null,camera:s||r.Z[n].camera,name:o||r.Z[n].name,err:null,text:"",time:r.Z[n].time,configs:[]};return t.forEach((t=>{i.configs&&t in e&&i.configs.push({name:t,value:e[t]})})),new a(i)}}},6245:(e,t,n)=>{n.d(t,{E9:()=>h,Jo:()=>m,ud:()=>f});var r=n(2372),a=n(6444),s=n(2328);let o,i,l,u=[];const c=(e,t)=>{const n=(0,a.i0)("camera");e.innerText=t in n?n[t]:t},d=(e="",t="")=>{i||(i=document.getElementById("VC-loading-text-bottom")),l||(l=document.getElementById("VC-loading-text-top")),c(i,e),c(l,t)},p=()=>{r.Z.videoLoading=!!u.length,o||(o=document.getElementById("VC-loading")),r.Z.videoLoading?o.classList.add("vc-loading-mask--enabled"):o.classList.remove("vc-loading-mask--enabled"),u.length?s.Z.video.classList.add("video--active"):s.Z.video.classList.remove("video--active");const e=u.at(-1);e?d(e.bottomText,e.topText):d()},h=e=>{u.push(e),p()},f=e=>{u=u.filter((({name:t})=>t!==e)),p()},m=()=>{u=[],p()}},6879:(e,t,n)=>{var r;n.d(t,{m:()=>r}),function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e[e.UP=2]="UP"}(r||(r={}))},2328:(e,t,n)=>{n.d(t,{Z:()=>ee});class r{constructor(){this.isShowing=!1,this.callback=null,this.el=document.getElementById("VC-force-btn")}static getInstance(){return r.instance||(r.instance=new r),r.instance}get state(){return this.isShowing}set state(e){this.isShowing=e}addClickCallback(e){this.callback=e,this.el.addEventListener("click",(()=>{this.callback&&this.callback()}))}setAvailable(e){this.state=e,this.el.style.display=e?"flex":"none"}}const a=r;var s=n(2372),o=n(7868),i=n(1494),l=n(6444);const u=class{constructor(e,t,n,r){this.typeErrors=(0,l.i0)("typeError"),this.dialogTypeBackground=r,this.dialogType=document.getElementById("vc-dialog-type"),this.dialogSelectType=document.getElementById("VC-dialog-select-type"),this.dialogHeader=this.dialogType?.querySelector(".vc-dialog-type__header>h2"),this.allowedTypes=this.dialogType?.querySelector("#VC-allowed-types"),this.allowedTypesUl=this.dialogType?.querySelector("#VC-allowed-types-list"),this.allowedTypesText=this.dialogType?.querySelector("#VC-allowed-types-text"),this.closeDialogBtn=this.dialogType?.querySelector("#closeTypeDialog"),this.dialogModes={select:this.setSelectDialog.bind(this),error:this.setErrorDialog.bind(this)},this.allowedTypesUl.innerHTML="",this.dialogSelectType.innerHTML="",e.forEach((e=>this.allowedTypesUl.append(e))),t.forEach((e=>{this.dialogSelectType&&this.dialogSelectType.append(e)})),this.dialogMode="select",this.dialogSelectType.addEventListener("change",(()=>{if(this.dialogSelectType){const e=+this.dialogSelectType.value;n(e),this.toggleDialogType(!1),this.dialogSelectType.value="0"}})),this.closeDialogBtn.addEventListener("click",(()=>this.hideDialog()))}toggleDialogType(e){e?this.showDialog():this.hideDialog()}showDialog(){this.dialogType&&this.dialogType.classList.remove("d-none"),this.dialogTypeBackground.classList.remove("d-none")}hideDialog(){this.dialogType&&this.dialogType.classList.add("d-none"),this.dialogTypeBackground.classList.add("d-none")}set dialogMode(e){this.dialogModes[e]()}setSelectDialog(){this.dialogHeader&&this.dialogSelectType&&this.allowedTypes&&(this.dialogHeader.innerHTML=this.typeErrors.typeSelectHeader,this.dialogSelectType.classList.remove("d-none"),this.allowedTypes.classList.add("d-none"))}setErrorDialog(){this.dialogHeader&&this.dialogSelectType&&this.allowedTypes&&(this.dialogHeader.innerHTML=this.typeErrors.typeErrorHeader,this.allowedTypesText.textContent=this.typeErrors.typeErrorBody,this.allowedTypes.classList.remove("d-none"),this.dialogSelectType.classList.add("d-none"))}};var c=n(9224);const d=class{constructor(e){this.background=null,this.background=e.background,this.container=document.getElementById(e.containerId),this.doneBtn=document.getElementById(e.doneBtnId),this.cancelBtn=document.getElementById(e.cancelBtnId),this.container.classList.add(e.isMobile?"vc-dialog-bottom--mobile":"vc-dialog-bottom--desktop")}addDoneHandler(e){this.doneBtn.onclick=()=>e()}addCancelHandler(e){this.cancelBtn.onclick=()=>e()}hide(){this.background&&this.container&&(this.background.classList.add("d-none"),this.container.classList.add("d-none"))}show(){this.background&&this.container&&(this.container.classList.remove("d-none"),this.background.classList.remove("d-none"))}};const p=class extends d{constructor(e,t,n){super({isMobile:e,background:t,containerId:"vc-select-type-dialog",doneBtnId:"vc-btn-doctype-done",cancelBtnId:"vc-btn-doctype-cancel"}),this.type=0,this.elementsList=[],this.createElement=(e,t)=>{const n=(0,c.az)("label",null,["select-doctype-dialog__content__element"]),r={type:"radio",id:e,name:"docType",value:e},a=(0,c.az)("input",r,["select-doctype-dialog__content__element__radio"],n);return(0,c.az)("span",{textContent:t},["select-doctype-dialog__content__element__text"],n),(0,c.az)("span",null,["select-doctype-dialog__content__element__checkmark"],n),a.addEventListener("change",(e=>{const t=e.target;this.setActiveLabel(t.parentElement)})),n},this.spinner=n,this.cancelButtonContainer=this.cancelBtn.parentElement,this.doneButtonContainer=this.doneBtn.parentElement,this.list=document.getElementById("vc-doctype-dialog-container")}show(){super.show(),this.spinner.classList.add("v-none");this.container.clientWidth<315&&(this.container.classList.add("vc-dialog-bottom--f14"),this.doneButtonContainer.classList.add("vc-dialog-bottom__header__done--w50"),this.cancelButtonContainer.classList.add("vc-dialog-bottom__header__cancel--w50"))}hide(){super.hide(),this.hideCancelButton(),this.spinner.classList.remove("v-none")}showCancelButton(){this.cancelButtonContainer.classList.remove("v-none")}hideCancelButton(){this.cancelButtonContainer.classList.add("v-none")}addDoneHandler(e){super.addDoneHandler((()=>{const t=this.list.querySelector(":checked");t&&(this.type=i.Z.idByName(t.value),this.hide(),e())}))}addCancelHandler(e){super.addCancelHandler((()=>{const t=this.elementsList.find((e=>e.id===this.selectedType));this.elementsList.forEach((e=>e.element.classList.remove("select-doctype-dialog__content__element--selected"))),t.element.classList.add("select-doctype-dialog__content__element--selected"),t.element.querySelector("input").checked=!0,e()}))}setActiveLabel(e){this.elementsList.forEach((e=>e.element.classList.remove("select-doctype-dialog__content__element--selected"))),e.classList.add("select-doctype-dialog__content__element--selected")}hasElement(e){return-1!==this.elementsList.findIndex((({name:t})=>t===e))}addElement(e,t,n){this.hasElement(e)||this.elementsList.push({name:e,element:t,id:n})}clearList(){this.elementsList.length=0}addType({name:e,humanName:t,id:n}){const r=this.createElement(e,t);this.addElement(e,r,n)}render(){this.list.innerHTML="",this.elementsList.forEach((({element:e})=>this.list.appendChild(e))),1===this.elementsList.length&&(this.selectedType=this.elementsList[0].id,this.setActiveLabel(this.elementsList[0].element))}setCheckedLi(){const e=this.elementsList.find((e=>e.id===this.type));if(e){e.element.classList.add("select-doctype-dialog__content__element--selected");e.element.querySelector("input").checked=!0}}set selectedType(e){this.type=e,this.setCheckedLi()}get selectedType(){return this.type}};const h=class extends d{constructor(e,t){super({isMobile:e,background:t,containerId:"vc-predicted-type-dialog",mainId:"vc-predicted-type-dialog-main",cancelBtnId:"vc-predicted-type-dialog-change",doneBtnId:"vc-predicted-type-dialog-correct"}),this.type=null,this.header=null,this.header=document.getElementById("vc-predicted-type-dialog-name")}addDoneHandler(e){super.addDoneHandler((()=>{this.hide(),e()}))}addCancelHandler(e){super.addCancelHandler((()=>{this.hide(),e()}))}setHeader(){this.header.textContent=this.type.humanName}set selectedType(e){this.type=i.Z.recordById(+e),this.setHeader()}};var f,m,g,y,b,x,v,w,T,S,A,C,I=function(e,t,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n},k=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};m=new WeakMap,g=new WeakMap,y=new WeakMap,b=new WeakMap,x=new WeakMap,v=new WeakMap,w=new WeakMap,T=new WeakMap,S=new WeakMap,f=new WeakSet,A=function(){"error"===k(this,b,"f")?(this.setCaretVisible(!1),this.removeAllChangeDocumentTypeListener(),k(this,m,"f").classList.remove(k(this,v,"f").pointer)):(this.updateByTypesCount(k(this,S,"f")),k(this,f,"m",C).call(this))},C=function(){k(this,T,"f").forEach((e=>{k(this,m,"f").addEventListener("click",e)}))};const E=class{constructor(){f.add(this),m.set(this,void 0),g.set(this,null),y.set(this,null),b.set(this,null),x.set(this,"message-box"),v.set(this,{primary:"message-box--primary",error:"message-box--error",pointer:"message-box--pointer"}),w.set(this,"Scan your document"),T.set(this,[]),S.set(this,1),I(this,m,document.getElementById("vc-message-box"),"f"),null!==k(this,m,"f")&&(I(this,g,k(this,m,"f").querySelector(".message-box__text"),"f"),I(this,y,k(this,m,"f").querySelector("#idvc-change-document-type-btn"),"f"))}setClass(){k(this,b,"f")&&(k(this,m,"f").className=`${k(this,x,"f")} ${k(this,v,"f")[k(this,b,"f")]}`)}get type(){return k(this,b,"f")}message(e=k(this,w,"f"),t="primary"){const n=t.trim().toLowerCase(),r=k(this,b,"f"),a=["error","primary"].includes(n)?n:"primary";r!==a&&(I(this,b,a,"f"),this.setClass(),k(this,f,"m",A).call(this)),k(this,g,"f")instanceof HTMLSpanElement&&(k(this,g,"f").textContent=e)}updateByTypesCount(e=k(this,S,"f")){I(this,S,e,"f"),1===k(this,S,"f")?(this.setCaretVisible(!1),this.removeAllChangeDocumentTypeListener(),k(this,m,"f").classList.remove(k(this,v,"f").pointer)):(k(this,m,"f").classList.add(k(this,v,"f").pointer),this.setCaretVisible(!0))}addChangeDocumentTypeListener(e){k(this,T,"f").push(e),k(this,m,"f").addEventListener("click",e)}removeAllChangeDocumentTypeListener(){k(this,T,"f").forEach((e=>{k(this,m,"f").removeEventListener("click",e)}))}setCaretVisible(e){k(this,y,"f")&&(e?k(this,y,"f").classList.remove("d-none"):k(this,y,"f").classList.add("d-none"))}};var N,B,R,D,M,O,P,$,F=function(e,t,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n},_=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};$=new WeakMap,N=new WeakSet,B=function(){const{height:e,width:t}=this.svgSizes,{width:n}=this.borders;this.cssVars.height=`calc(${Number.isFinite(e)?`${e}px`:e} * 0.9)`,this.cssVars.width=`calc(${Number.isFinite(n)?`${n}px`:n} * 0.63)`,this.cssVars.rx="100%",this.cssVars.y="5%",this.cssVars.x=`calc(${t} / 2 - var(--clean-width) / 2)`},R=function({width:e,height:t}){this.borders.width=e,this.borders.height=t},D=function(){const{width:e,height:t}=this.svgSizes;this.cssVars.rx="16px",this.cssVars.y=`calc((${t} - var(--clean-height)) / 2)`,this.cssVars.x=`calc((${e} - var(--clean-width)) / 2)`},M=function(){Object.entries(this.cssVars).forEach((([e,t])=>{const n=`--clean-${e}`;this.cssVarContainer.style.setProperty(n,Number.isFinite(t)?`${t}px`:t)}))},O=function(){this.successMask.classList.add("video-mask-overlay__stroke--animation")},P=function(){this.successMask.classList.remove("video-mask-overlay__stroke--animation")};const L=class{constructor(e){N.add(this),this.type="environment",this.cssVarContainer=null,this.borders={width:0,height:0},this.cssVars={width:"80%",height:"90%",rx:"16px",x:"10%",y:"5%"},this._mainContainerSizes={width:"100%",height:"100%"},this.getSizes=e=>{const t=getComputedStyle(e);return{width:t.getPropertyValue("width"),height:t.getPropertyValue("height")}},$.set(this,((e,t)=>{let n;const r=Math.abs(e-t);return e&&t?n=r<10?e-.1*e:e>t?t:e:(n=e||t,n-=.1*n),Math.trunc(n)})),this.svg=document.getElementById("vc-video-mask-overlay"),this.strokeMask=this.svg.querySelector(".video-mask-overlay__stroke--white"),this.successMask=this.svg.querySelector(".video-mask-overlay__stroke--success"),this.cssVarContainer=e}get svgSizes(){return this.getSizes(this.svg)}get strokeSizes(){const{width:e,height:t}=this.getSizes(this.strokeMask);return{width:Math.ceil(Number.parseInt(e,10)),height:Math.ceil(Number.parseInt(t,10))}}get strokeLength(){return Math.ceil(this.strokeMask.getTotalLength())}set sizes({width:e,height:t}){F(this,N,{width:e,height:t},"a",R)}set fillPercentage(e){try{const t=Math.min(100,e),n=this.strokeLength;0===t?_(this,N,"m",P).call(this):_(this,N,"m",O).call(this);const r=n?n/2:"50%",a=r/100*t,s=100===t?0:a,o=100===t?0:r-a,i=100===t?"100%":r+r/100*t;this.successMask.style.strokeDasharray=`${s} ${o??"100%"}`,this.successMask.style.strokeDashoffset=i}catch(e){this.successMask.style.strokeDasharray="0 0",this.successMask.style.strokeDashoffset=0}}set maskType(e){this.type=["environment","user"].includes(e)?e:"environment"}set mainContainerSizes({width:e,height:t}){const{width:n,height:r}=this.borders;if(Number.isFinite(e)&&Number.isFinite(t)&&(this._mainContainerSizes.width=e,this._mainContainerSizes.height=t),"environment"===this.type){const a=_(this,$,"f").call(this,e,n),s=_(this,$,"f").call(this,t,r);Number.isFinite(n)&&Number.isFinite(r)&&(this.cssVars.width=a,this.cssVars.height=s)}"user"===this.type?_(this,N,"m",B).call(this):_(this,N,"m",D).call(this),_(this,N,"m",M).call(this)}};const V=class{constructor(){this.icon=document.getElementById("vc-flashlight"),this.onIcon=document.getElementById("vc-flashlight-icon--switched-on"),this.offIcon=document.getElementById("vc-flashlight-icon--switched-off"),this.isEnableFlashLight=!1,this.addClickEventListener()}show(e){this.icon&&(e?(this.icon.classList.remove("vc-flashlight-icon--hide"),this.icon.classList.add("vc-flashlight-icon--show")):(this.icon.classList.remove("vc-flashlight-icon--show"),this.icon.classList.add("vc-flashlight-icon--hide")))}turnOff(){this.offIcon&&this.onIcon&&(this.isEnableFlashLight=!1,this.offIcon.classList.remove("d-none"),this.onIcon.classList.add("d-none"))}turnOn(){this.offIcon&&this.onIcon&&(this.isEnableFlashLight=!0,this.onIcon.classList.remove("d-none"),this.offIcon.classList.add("d-none"))}get isTurnedOn(){return this.isEnableFlashLight}addClickEventListener(e){this.icon&&(this.icon.onclick=()=>{this.isEnableFlashLight?this.turnOff():this.turnOn(),e&&"function"==typeof e&&e()})}},U={el:null,loadingEl:null,containerEl:null,state:null,callback:null,init(){return U.el=document.getElementById("manualSwitchBtn"),U.loadingEl=document.getElementById("manualSwitchBtnLoading"),U.containerEl=document.getElementById("manualSwitchBtnWrap"),this},setLoading(e){if(!U.el||!U.loadingEl)return;const t=!U.el.classList.contains("el-button--disabled");e?(U.loadingEl.style.display="block",U.el.classList.add("el-button--disabled")):(t&&U.el.classList.remove("el-button--disabled"),U.loadingEl.style.display="none")},setEnabled(e){U.el&&(e?U.el.classList.remove("el-button--disabled"):U.el.classList.add("el-button--disabled"))},setAvailable(e){U.containerEl&&(U.containerEl.style.display=e?"block":"none")},setText(){const e=(0,l.i0)("general");"video"===U.state&&(U.el.innerHTML=`${e.btnCamera}`),"uploader"===U.state&&(U.el.innerHTML=`${e.btnUploader}`)},setState(e){if(U.el){switch(e){case"video":case"uploader":U.state=e;break;default:throw new Error(`type ${e} of state is not supported`)}this.setText()}},addClickCallback(e){U.callback=e,U.el&&U.el.addEventListener("click",(()=>{U.el?.classList.contains("el-button--disabled")||("video"===U.state?U.setState("uploader"):U.setState("video"),U.callback&&U.callback())}))}},G=U;var W=n(5226),z=n(6879);const H={[z.m.LEFT]:"turnFaceLeft",[z.m.RIGHT]:"turnFaceRight",[z.m.UP]:"turnFaceUp"},Z=()=>{let e=!1;const t=s.Z.steps.length>0,n=Number.isInteger(+s.Z.currentStep),r=s.Z.steps[s.Z.currentStep];return t&&n&&r&&(e="type"in s.Z.steps[s.Z.currentStep]),e};class j{static init(){j.holdText=document.getElementById("VC-hold-text"),j.arrowUpHintContainer=document.getElementById("vc-arrow-up-hint-container"),j.arrowLeftHintContainer=document.getElementById("vc-arrow-left-hint-container"),j.arrowRightHintContainer=document.getElementById("vc-arrow-right-hint-container"),j.arrowLeftFaceTheCameraContainer=document.getElementById("vc-arrow-left-face-the-camera-container"),j.arrowRightFaceTheCameraContainer=document.getElementById("vc-arrow-right-face-the-camera-container")}static showFaceTheCameraArrows(){j.arrowLeftFaceTheCameraContainer.classList.remove("d-none"),j.arrowRightFaceTheCameraContainer.classList.remove("d-none")}static hideFaceTheCameraArrows(){j.arrowLeftFaceTheCameraContainer.classList.add("d-none"),j.arrowRightFaceTheCameraContainer.classList.add("d-none")}static showArrow(e,t,n){const r=[j.arrowLeftHintContainer,j.arrowRightHintContainer,j.arrowUpHintContainer];r.forEach((e=>{e.classList.add("d-none")})),j.currentArrowContainer=r[e],j.currentArrowContainer.classList.remove("d-none");const a=Array.from(j.currentArrowContainer.firstElementChild.children);let s=0;n&&(t>=71&&t<=99&&(s=1),t>=61&&t<=70&&(s=2),t>=56&&t<=60&&(s=3),t<=55&&(s=4));for(let e=0;e<a.length;e+=1)"white"!==a[e].getAttribute("fill")&&(a[e].setAttribute("fill","white"),a[e].setAttribute("fill-opacity","0.4"));for(let e=0;e<s;e+=1)"#17EA4C"!==a[e].getAttribute("fill")&&(a[e].setAttribute("fill","#17EA4C"),a[e].setAttribute("fill-opacity","1"))}static hideArrows(){j.currentArrowContainer&&j.currentArrowContainer.classList.add("d-none")}static updateHoldText(e,t){const n=(0,l.i0)("hintTexts");let r="";if(j.hideArrows(),j.hideFaceTheCameraArrows(),s.Z.isShowCloserText&&(r=n.comeCloser),s.Z.isShowCenterText&&(r=n.moveCenter),s.Z.isShowAwayText&&(r=n.camAway),s.Z.isShowComeBackText&&(j.showFaceTheCameraArrows(),r=n.faceCam),s.Z.isShowStayCalmText&&(r=n.dontMove),s.Z.isShowNotSeeText&&(r=n.dontSee),s.Z.isShowTurnText&&(r=n[H[s.Z.realFaceTurnSide]]),s.Z.isShowFacePercentText&&e&&(j.showArrow(s.Z.realFaceTurnSide,e,t),r=n[H[s.Z.realFaceTurnSide]]),s.Z.isShowCenterText&&(r=n.moveCenter),s.Z.isShowHoldText&&Z()){let e=s.Z.steps[s.Z.currentStep].type;"front"!==e&&"auto"!==e||(e="front"),r=n.hold.replace("**placeholder**",e)}return s.Z.isShowStayText&&Z()&&(r="back"===s.Z.steps[s.Z.currentStep].type?1===s.Z.type?n.pdf:n.mrz:"auto"===s.Z.currentStepType&&2===s.Z.type?n.frontMRZ:"face"!==s.Z.currentStepType?n.holdCamera:""),j.holdText.textContent===r||(j.holdText.innerHTML=r),r}}const X=j,K=(e,t)=>{const{width:n,height:r}=t,{width:a,height:s}=e;return!(n!==a||s!==r)},q=e=>(0,c.az)("li",{textContent:i.Z.humanNameByName(e)},["VC-allowed-types-list__element"]),Q=e=>(0,c.az)("option",{textContent:i.Z.humanNameByName(e),value:i.Z.idByName(e).toString()},["VC-dialog-select-type__option"]),Y=()=>[(0,c.az)("option",{textContent:"Press change",value:"0",disabled:!0,selected:!0},["VC-dialog-select-type__option"]),...s.Z.config.types.map(Q)];class J{static init(e){J.dialogTypeBackground=document.getElementById("vc-dialog-type-background"),J.stepImg=document.getElementById("VC-step-img"),J.videoError=document.getElementById("VC-video-wrap-error"),J.btnsWrap=document.getElementById("VC-btns"),J.uploaderWrap=document.getElementById("VC-uploader"),J.videoPos=document.getElementById("VC-videoPos"),J.fakeContour=document.getElementById("VC-fakeContour"),J.stepsWrapper=document.getElementById("VC-steps"),J.guidlinesBtn=document.getElementById("VC-guidlines"),J.videoWrap=document.getElementById("VC-videoWrap"),J.resetAllStepsBtn=document.getElementById("VC-reset-all"),J.spinner=document.querySelector(".el-loading-spinner"),J.version=document.getElementById("VC-version"),J.selectDocumentTypeText=document.getElementById("vc-select-type-dialog-text"),J.resizedCanvas=document.getElementById("resizedCanvas"),J.mrzCanvas=document.getElementById("mrzCanvas"),J.videoCanvas=document.getElementById("videoCanvas"),J.borderCanvas=document.getElementById("VC-borderCanvas"),J.borderCtx=J.borderCanvas.getContext("2d",{willReadFrequently:!0}),J.resizedCtx=J.resizedCanvas.getContext("2d",{willReadFrequently:!0}),J.mrzCtx=J.mrzCanvas.getContext("2d",{willReadFrequently:!0}),J.videoCtx=J.videoCanvas.getContext("2d",{willReadFrequently:!0}),J.retakeBtn=document.getElementById("VS-retake-btn"),J.continueBtn=document.getElementById("VS-continue-btn"),J.submitBtn=document.getElementById("VS-submit-btn"),J.changeBtn=document.getElementById("vc-predicted-type-dialog-change"),J.correctBtn=document.getElementById("vc-predicted-type-dialog-correct"),J.cancelBtn=document.getElementById("vc-btn-doctype-cancel"),J.closeBtn=document.getElementById("closeTypeDialog"),J.doneBtn=document.getElementById("vc-btn-doctype-done"),J.videoErrorText=document.getElementById("VC-video-wrap-error-text"),J.mainContainer=document.getElementById("vc-main-content"),J.video=document.getElementById("VC-video"),J.dialogSelectType=document.getElementById("VC-dialog-select-type"),J.pressToUpdateText=document.getElementById("vc-uploader-press-to-update"),J.pressToUpdateTextSuccess=document.getElementById("vc-uploader-press-to-update-success"),J.documentType=document.getElementById("vc-dialog-type-text"),J.messageBox=new E,J.forceBtn=a.getInstance(),J.msBtn=G.init(),J.flashlight=new V,J.Mask=new L(J.videoPos),J.typeError=new u(s.Z.config.types.map(q),Y(),e,J.dialogTypeBackground),X.init()}static initTypeSelect(){J.selectDocumentType||(J.selectDocumentType=new p(s.Z.isMobile,J.dialogTypeBackground,J.spinner)),J.predictedType||(J.predictedType=new h(s.Z.isMobile,J.dialogTypeBackground))}static resizeMainContainer(){if(s.Z.track){const{width:e=0,height:t=0}=s.Z.track.getSettings(),n=()=>Math.trunc(t/e*100);let r;if(t<e)r=n();else{const e=n();r=e>=100?100:e}J.mainContainer.style.paddingTop=`${r}%`;const a=window.getComputedStyle(J.mainContainer);J.Mask.mainContainerSizes={width:Math.ceil(+a.getPropertyValue("width")),height:Math.ceil(+a.getPropertyValue("height"))}}}static updateHoldText(e,t){X.updateHoldText(e,t)}static updateStepImg(){if(s.Z.steps&&J.stepImg&&void 0!==s.Z.currentStep)if(s.Z.currentStepImg){J.stepImg.classList.remove("d-none"),J.stepImg.style.setProperty("--vc-background-image",`url("${s.Z.currentStepImg}")`);const{errorCode:e}=s.Z.currentStepObj;e?J.showVideoError(e):J.hideVideoError()}else J.stepImg.classList.add("d-none"),J.hideVideoError()}static showVideoError(e){J.videoError.classList.remove("video-wrap__error--disabled"),J.videoError.classList.add("video-wrap__error--enabled");const t=(0,l.i0)("errorCodes");J.videoErrorText.innerHTML=e in t?t[e]:e}static hideVideoError(){J.videoError.classList.add("video-wrap__error--disabled"),J.videoError.classList.remove("video-wrap__error--enabled"),J.videoErrorText.innerText=""}static updateVideoWrap(){J.videoWrap&&(s.Z.currentStepImg&&s.Z.currentStepObj.isAuto?J.videoWrap.classList.add("video-wrap--has-image"):J.videoWrap.classList.remove("video-wrap--has-image"),s.Z.isVideoCapture?J.videoWrap.classList.add("video-wrap--enabled"):J.videoWrap.classList.remove("video-wrap--enabled"))}static setVideoWrapEnabled(e=!0){e?J.videoWrap.classList.add("video-wrap--enabled"):J.videoWrap.classList.remove("video-wrap--enabled")}static updateContinueBtn(){J.continueBtn&&(s.Z?.currentStepImg?J.continueBtn.classList.remove("el-button--disabled"):J.continueBtn.classList.add("el-button--disabled"),s.Z.currentStep<s.Z.steps.length-1?J.continueBtn.classList.remove("d-none"):J.continueBtn.classList.add("d-none"))}static updateBtnsWrap(){s.Z.isVideoCapture||s.Z.currentStepObj?.isAuto?(J.btnsWrap.classList.remove("video-wrap__btns--one-btn"),J.btnsWrap.classList.add("video-wrap__btns--two-btn")):(J.btnsWrap.classList.remove("video-wrap__btns--two-btn"),J.btnsWrap.classList.add("video-wrap__btns--one-btn"))}static saveCanvas(){J.resizedCtx.save(),J.borderCtx.save(),J.videoCtx.save()}static restoreCanvas(){J.resizedCtx.restore(),J.borderCtx.restore(),J.videoCtx.restore()}static updateSubmitBtn(){const e=s.Z.steps.filter((e=>null!==e.img)).length===s.Z.steps.length;if(J.submitBtn){e&&s.Z.config.h_showSubmitBtn?J.submitBtn.classList.remove("el-button--disabled"):J.submitBtn.classList.add("el-button--disabled");s.Z.currentStep>=s.Z.steps.length-1&&s.Z.config.h_showSubmitBtn?J.submitBtn.classList.remove("d-none"):J.submitBtn.classList.add("d-none")}}static updateResetAllBtn(){if(J.resetAllStepsBtn){const{steps:e}=s.Z,t=e.filter((e=>null!==e.img)).length===s.Z.steps.length;e&&t?J.resetAllStepsBtn.classList.remove("d-none"):J.resetAllStepsBtn.classList.add("d-none")}}static updateRetakeButton(){J.retakeBtn&&(s.Z.isStarted?J.retakeBtn.classList.add("el-button--disabled"):J.retakeBtn.classList.remove("el-button--disabled"),s.Z.currentStepObj?.isAuto||s.Z.isVideoCapture?J.retakeBtn.classList.remove("d-none"):J.retakeBtn.classList.add("d-none"))}static updateKeyError(){s.Z.licenseKeyError&&J.messageBox.message(s.Z.licenseKeyError,"error")}static initGeneralText(){const e=(0,l.i0)("documentsTypes"),t=(0,l.i0)("general");s.Z.uploader&&s.Z.uploader.setText(),i.Z.setHumanName(e),(0,W.Z)(J.selectDocumentType),G.setText(),J.messageBox.message(i.Z.humanNameById(s.Z.type)),Object.keys(t).forEach((e=>{J[e]&&(J[e].innerText=t[e])}))}static toggleUploaderWrap(){s.Z.isVideoCapture?J.uploaderWrap.classList.remove("uploader-wrap--enabled"):J.uploaderWrap.classList.add("uploader-wrap--enabled")}static setUploaderWrapEnabled(e=!0){e?J.uploaderWrap.classList.add("uploader-wrap--enabled"):J.uploaderWrap.classList.remove("uploader-wrap--enabled")}static toggleVideoPos(){J.videoPos&&(s.Z.isStarted?J.videoPos.classList.add("video-pos--active"):J.videoPos.classList.remove("video-pos--active"))}static toggleBorderCanvas(){J.borderCanvas&&(s.Z.isStarted?J.borderCanvas.classList.add("border-canvas--active"):J.borderCanvas.classList.remove("border-canvas--active"))}static resizeBorders(){const e="face"===s.Z.steps[s.Z.currentStep].type?1:s.Z.sizeK;J.setDefaultVideoCanvasSizes();const{baseWidth:t,baseHeight:n}=J.getBaseSizes(e);J.setOffsets(t,n),J.setCropSizes(t,n);const r=(0,o.jA)(640,s.Z),{resizedBaseWidth:a,resizedBasedHeight:i}=J.getResizedBaseSizes(e);J.setResizedCrops(a,i),J.setResizedOffsets();const{width:l,height:u}=J.getCropSizes(e);J.setCropFace(.85),J.setFaceOffsets(r),J.setResizedCanvasSizes(r),J.setResizedCanvas(),J.setBorderCanvas(l,u),J.Mask.sizes={width:l,height:u},J.setFakeContourStyles(l)}static clearBorderCtx(){J.borderCtx.clearRect(0,0,J.borderCanvas.width,J.borderCanvas.height)}static recreateCanvas(e){let t=e;const n=t.parentElement,{width:r,height:a,id:s,className:o}=t,i=r&&a?t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,r,a):new ImageData(new Uint8ClampedArray([]),0,0);t.width=0,t.height=0,t.remove(),t=null;const l=document.createElement("canvas");l.id=s,n&&n.append(l),l.width=r,l.height=a,l.className=o;const u=l.getContext("2d");return u&&u.putImageData(i,0,0),{canvas:l,ctx:u}}static setVideoCanvasSizes({width:e,height:t}){K(J.videoCanvas,{width:e,height:t})||(J.videoCanvas.width=e,J.videoCanvas.height=t)}static setDefaultVideoCanvasSizes(){const e=(0,o.jA)(1600,s.Z),{width:t,height:n}=e;s.Z.videoCanvasSizes={width:t,height:n},J.setVideoCanvasSizes(s.Z.videoCanvasSizes)}static getBaseSizes(e=1){let t=J.videoCanvas.width,n=Math.trunc(t/e);return n>J.videoCanvas.height&&(n=J.videoCanvas.height,t=Math.trunc(n*e)),{baseHeight:n,baseWidth:t}}static setOffsets(e,t){const{width:n,height:r}=J.videoCanvas,a=Math.trunc((n-(e<0?0:e))/2),o=Math.trunc((r-(t<0?0:t))/2);s.Z.offsets.left=a,s.Z.offsets.top=o}static setCropSizes(e,t){s.Z.cropSize={width:e<0?0:e,height:t<0?0:t}}static getResizedBaseSizes(e){const{width:t,height:n}=(0,o.jA)(640,s.Z);let r=t,a=Math.trunc(r/e);return a>n&&(a=n,r=Math.trunc(a*e)),{resizedBaseWidth:r,resizedBasedHeight:a}}static setResizedCrops(e,t){s.Z.cropResizedSize={width:Math.ceil(e),height:Math.ceil(t)}}static setResizedOffsets(){const e=(0,o.jA)(640,s.Z);s.Z.offsetsResized.left=Math.trunc((e.width-s.Z.cropResizedSize.width)/2),s.Z.offsetsResized.top=Math.trunc((e.height-s.Z.cropResizedSize.height)/2)}static getCropSizes(e){const t=Math.trunc(s.Z.cropSize.width*J.videoWrap.offsetWidth/J.videoCanvas.width);return{width:t,height:Math.trunc(t/e)}}static setCropFace(e){s.Z.cropFaceSize={width:Math.trunc(s.Z.cropResizedSize.width/1.35*e+20),height:Math.trunc(s.Z.cropResizedSize.height*e+20)}}static setFaceOffsets({width:e}){s.Z.offsetsFace.left=Math.trunc((e-s.Z.cropFaceSize.width)/2),s.Z.offsetsFace.top=Math.trunc(s.Z.offsetsResized.top+.1*s.Z.cropFaceSize.height-20)}static setResizedCanvasSizes({width:e,height:t}){s.Z.resizedCanvasSizes={width:e,height:t}}static setResizedCanvas(){if(!K(J.resizedCanvas,s.Z.resizedCanvasSizes)){const{width:e,height:t}=s.Z.resizedCanvasSizes;J.resizedCanvas.width=e,J.resizedCanvas.height=t}}static setBorderCanvas(e,t){J.borderCanvas.width=e,J.borderCanvas.height=t}static getFakeContourWidth(e){return Math.trunc(e-.05*e)}static setFakeContourStyles(e){const t=J.getFakeContourWidth(e);J.fakeContour.style.width=`${t}px`,J.fakeContour.style.height=`${Math.trunc(t/1.56)}px`,J.fakeContour.style.display="none"}static rectreateDistinctCanvas(e){const t=`${e}Canvas`,n=`${e}Ctx`;if(t in J&&n in J){const{canvas:e,ctx:r}=J.recreateCanvas(J[t]);J[t]=e,J[n]=r}}static drawVideo(){const{width:e,height:t}=J.videoCanvas;J.videoCtx.drawImage(J.video,0,0,e,t)}static drawResized(){const{width:e,height:t}=J.resizedCanvas;J.resizedCtx.drawImage(J.videoCanvas,0,0,e,t)}static recreateWorkingCanvas(){if(s.Z.browser&&"iOS"===s.Z.browser.os&&s.Z.browserMajorVersion&&s.Z.browserMajorVersion<15){["resized","video"].forEach(J.rectreateDistinctCanvas)}}static drawResizedVideo(){J.drawVideo(),J.drawResized()}static setMirroring(){s.Z.isMirroring?J.videoWrap.classList.add("video-wrap--mirror"):J.videoWrap.classList.remove("video-wrap--mirror")}}const ee=J},7496:function(e,t){var n;(function(){var r=function(e){return e instanceof r?e:this instanceof r?void(this.EXIFwrapped=e):new r(e)};e.exports&&(t=t.default=r),t.EXIF=r;var a=r.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},s=r.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},o=r.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},i=r.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},l=r.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function u(e){return!!e.exifdata}function c(e){var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;for(var n=2,r=e.byteLength;n<r;){if(255!=t.getUint8(n))return!1;if(225==t.getUint8(n+1))return g(t,n+4,t.getUint16(n+2));n+=2+t.getUint16(n+2)}}var d={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};function p(e,t,n){for(var r,a,s,o,i=new DataView(e),l={},u=t;u<t+n;)28===i.getUint8(u)&&2===i.getUint8(u+1)&&(o=i.getUint8(u+2))in d&&(s=i.getInt16(u+3),a=d[o],r=m(i,u+5,s),l.hasOwnProperty(a)?l[a]instanceof Array?l[a].push(r):l[a]=[l[a],r]:l[a]=r),u++;return l}function h(e,t,n,r,a){var s,o,i,l=e.getUint16(n,!a),u={};for(i=0;i<l;i++)s=n+12*i+2,(o=r[e.getUint16(s,!a)])||console.log("Unknown tag: "+e.getUint16(s,!a)),u[o]=f(e,s,t,n,a);return u}function f(e,t,n,r,a){var s,o,i,l,u,c,d=e.getUint16(t+2,!a),p=e.getUint32(t+4,!a),h=e.getUint32(t+8,!a)+n;switch(d){case 1:case 7:if(1==p)return e.getUint8(t+8,!a);for(l=0,s=p>4?h:t+8,o=[];l<p;l++)o[l]=e.getUint8(s+l);return o;case 2:return m(e,s=p>4?h:t+8,p-1);case 3:if(1==p)return e.getUint16(t+8,!a);for(l=0,s=p>2?h:t+8,o=[];l<p;l++)o[l]=e.getUint16(s+2*l,!a);return o;case 4:if(1==p)return e.getUint32(t+8,!a);for(l=0,o=[];l<p;l++)o[l]=e.getUint32(h+4*l,!a);return o;case 5:if(1==p)return u=e.getUint32(h,!a),c=e.getUint32(h+4,!a),(i=new Number(u/c)).numerator=u,i.denominator=c,i;for(l=0,o=[];l<p;l++)u=e.getUint32(h+8*l,!a),c=e.getUint32(h+4+8*l,!a),o[l]=new Number(u/c),o[l].numerator=u,o[l].denominator=c;return o;case 9:if(1==p)return e.getInt32(t+8,!a);for(l=0,o=[];l<p;l++)o[l]=e.getInt32(h+4*l,!a);return o;case 10:if(1==p)return e.getInt32(h,!a)/e.getInt32(h+4,!a);for(l=0,o=[];l<p;l++)o[l]=e.getInt32(h+8*l,!a)/e.getInt32(h+4+8*l,!a);return o}}function m(e,t,n){for(var r="",a=t;a<t+n;a++)r+=String.fromCharCode(e.getUint8(a));return r}function g(e,t){if("Exif"!=m(e,t,4))return!1;var n,r,u,c,d,p=t+6;if(18761==e.getUint16(p))n=!1;else{if(19789!=e.getUint16(p))return!1;n=!0}if(42!=e.getUint16(p+2,!n))return!1;var f=e.getUint32(p+4,!n);if(f<8)return!1;if((r=h(e,p,p+f,s,n)).ExifIFDPointer)for(u in c=h(e,p,p+r.ExifIFDPointer,a,n)){switch(u){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":c[u]=l[u][c[u]];break;case"ExifVersion":case"FlashpixVersion":c[u]=String.fromCharCode(c[u][0],c[u][1],c[u][2],c[u][3]);break;case"ComponentsConfiguration":c[u]=l.Components[c[u][0]]+l.Components[c[u][1]]+l.Components[c[u][2]]+l.Components[c[u][3]]}r[u]=c[u]}if(r.GPSInfoIFDPointer)for(u in d=h(e,p,p+r.GPSInfoIFDPointer,o,n))"GPSVersionID"===u&&(d[u]=d[u][0]+"."+d[u][1]+"."+d[u][2]+"."+d[u][3]),r[u]=d[u];return r.thumbnail=function(e,t,n,r){var a,s,o,l,u=(s=t+n,o=r,l=(a=e).getUint16(s,!o),a.getUint32(s+2+12*l,!o));if(!u||u>e.byteLength)return{};var c=h(e,t,t+u,i,r);if(c.Compression)switch(c.Compression){case 6:if(c.JpegIFOffset&&c.JpegIFByteCount){var d=t+c.JpegIFOffset,p=c.JpegIFByteCount;c.blob=new Blob([new Uint8Array(e.buffer,d,p)],{type:"image/jpeg"})}break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",c.Compression)}else 2==c.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return c}(e,p,f,n),r}function y(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var n=0;n<e.attributes.length;n++){var r=e.attributes.item(n);t["@attributes"][r.nodeName]=r.nodeValue}}}else if(3==e.nodeType)return e.nodeValue;if(e.hasChildNodes())for(var a=0;a<e.childNodes.length;a++){var s=e.childNodes.item(a),o=s.nodeName;if(null==t[o])t[o]=y(s);else{if(null==t[o].push){var i=t[o];t[o]=[],t[o].push(i)}t[o].push(y(s))}}return t}function b(e){try{var t={};if(e.children.length>0)for(var n=0;n<e.children.length;n++){var r=e.children.item(n),a=r.attributes;for(var s in a){var o=a[s],i=o.nodeName,l=o.nodeValue;void 0!==i&&(t[i]=l)}var u=r.nodeName;if(void 0===t[u])t[u]=y(r);else{if(void 0===t[u].push){var c=t[u];t[u]=[],t[u].push(c)}t[u].push(y(r))}}else t=e.textContent;return t}catch(e){console.log(e.message)}}r.enableXmp=function(){r.isXmpEnabled=!0},r.disableXmp=function(){r.isXmpEnabled=!1},r.getData=function(e,t){return!((self.Image&&e instanceof self.Image||self.HTMLImageElement&&e instanceof self.HTMLImageElement)&&!e.complete||(u(e)?t&&t.call(e):function(e,t){function n(n){var a=c(n);e.exifdata=a||{};var s=function(e){var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;for(var n=2,r=e.byteLength;n<r;){if(s=n,56===(a=t).getUint8(s)&&66===a.getUint8(s+1)&&73===a.getUint8(s+2)&&77===a.getUint8(s+3)&&4===a.getUint8(s+4)&&4===a.getUint8(s+5)){var a,s,o=t.getUint8(n+7);return o%2!=0&&(o+=1),0===o&&(o=4),p(e,n+8+o,t.getUint16(n+6+o))}n++}}(n);if(e.iptcdata=s||{},r.isXmpEnabled){var o=function(e){if("DOMParser"in self){var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;for(var n=2,r=e.byteLength,a=new DOMParser;n<r-4;){if("http"==m(t,n,4)){var s=n-1,o=t.getUint16(n-2)-1,i=m(t,s,o),l=i.indexOf("xmpmeta>")+8,u=(i=i.substring(i.indexOf("<x:xmpmeta"),l)).indexOf("x:xmpmeta")+10;return i=i.slice(0,u)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+i.slice(u),b(a.parseFromString(i,"text/xml"))}n++}}}(n);e.xmpdata=o||{}}t&&t.call(e)}if(e.src)if(/^data\:/i.test(e.src))n(function(e,t){t=t||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var n=atob(e),r=n.length,a=new ArrayBuffer(r),s=new Uint8Array(a),o=0;o<r;o++)s[o]=n.charCodeAt(o);return a}(e.src));else if(/^blob\:/i.test(e.src)){(s=new FileReader).onload=function(e){n(e.target.result)},function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){(200==this.status||0===this.status)&&t(this.response)},n.send()}(e.src,(function(e){s.readAsArrayBuffer(e)}))}else{var a=new XMLHttpRequest;a.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";n(a.response),a=null},a.open("GET",e.src,!0),a.responseType="arraybuffer",a.send(null)}else if(self.FileReader&&(e instanceof self.Blob||e instanceof self.File)){var s;(s=new FileReader).onload=function(e){n(e.target.result)},s.readAsArrayBuffer(e)}}(e,t),0))},r.getTag=function(e,t){if(u(e))return e.exifdata[t]},r.getIptcTag=function(e,t){if(u(e))return e.iptcdata[t]},r.getAllTags=function(e){if(!u(e))return{};var t,n=e.exifdata,r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);return r},r.getAllIptcTags=function(e){if(!u(e))return{};var t,n=e.iptcdata,r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);return r},r.pretty=function(e){if(!u(e))return"";var t,n=e.exifdata,r="";for(t in n)n.hasOwnProperty(t)&&("object"==typeof n[t]?n[t]instanceof Number?r+=t+" : "+n[t]+" ["+n[t].numerator+"/"+n[t].denominator+"]\r\n":r+=t+" : ["+n[t].length+" values]\r\n":r+=t+" : "+n[t]+"\r\n");return r},r.readFromBinaryFile=function(e){return c(e)},void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}).call(this)},5410:()=>{},8628:()=>{},5042:()=>{},4059:()=>{}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={id:e,loaded:!1,exports:{}};return n[e].call(s.exports,s,s.exports,a),s.loaded=!0,s.exports}a.m=n,a.amdD=function(){throw new Error("define cannot be used indirect")},a.amdO={},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>"networks/"+({343:"MRZ",513:"cdnLoader",584:"asyncLoader",596:"PDF",911:"ZXing",975:"Face"}[e]||e)+"."+{130:"0b466182",215:"bf164218",343:"16515b82",400:"8e839581",513:"2caa8b83",584:"52c5ed04",596:"04105754",716:"7c63165d",911:"d5fea691",975:"728ec3c6"}[e]+".js",a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="@idscan/idvc2:",a.l=(n,r,s,o)=>{if(e[n])e[n].push(r);else{var i,l;if(void 0!==s)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var d=u[c];if(d.getAttribute("src")==n||d.getAttribute("data-webpack")==t+s){i=d;break}}i||(l=!0,(i=document.createElement("script")).type="module",i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack",t+s),i.src=n),e[n]=[r];var p=(t,r)=>{i.onerror=i.onload=null,clearTimeout(h);var a=e[n];if(delete e[n],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach((e=>e(r))),t)return t(r)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.p="",(()=>{a.b=document.baseURI||self.location.href;var e={20:0};a.f.j=(t,n)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var s=new Promise(((n,a)=>r=e[t]=[n,a]));n.push(r[2]=s);var o=a.p+a.u(t),i=new Error;a.l(o,(n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+s+": "+o+")",i.name="ChunkLoadError",i.type=s,i.request=o,r[1](i)}}),"chunk-"+t,t)}};var t=(t,n)=>{var r,s,[o,i,l]=n,u=0;if(o.some((t=>0!==e[t]))){for(r in i)a.o(i,r)&&(a.m[r]=i[r]);if(l)l(a)}for(t&&t(n);u<o.length;u++)s=o[u],a.o(e,s)&&e[s]&&e[s][0](),e[s]=0},n=self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var s={};(()=>{a.d(s,{Z:()=>vu});var e=a(9423),t=a(1494);const n={auto:{description:'enable "realFaceMode" only for iphone.'},none:{description:"disable this option."},all:{description:'enable "realFaceMode" for all devices.'}},r=[{name:"el",type:"String",description:"Id of an element on the page where the component will be integrated.",defaultValue:"videoCapturingEl",validationFn:"validateElement"},{name:"licenseKey",type:"String",description:"Key for the library",defaultValue:"",validationFn:"validateString"},{name:"networkUrl",type:"String",description:"Path to the folder with neural networks. Specify the path on the server if you need to remove the folder to another location. The default path is 'networks'.",defaultValue:"networks",validationFn:"validateString"},{name:"language",type:"String",description:"The option sets the language used for the translation of the text in the library",defaultValue:void 0,validationFn:"validateLanguage"},{name:"documentTypes",type:"Array",description:"The option that describes what steps needs for each document type you are needed",defaultValue:[{type:"ID",steps:[{type:"front",name:"Document Front",mode:{uploader:!0,video:!0}},{type:"pdf",name:"Document PDF417 Barcode",mode:{uploader:!0,video:!0}},{type:"face",name:"Face",mode:{uploader:!0,video:!0}}]}],validationFn:"validateDocumentTypes"},{name:"realFaceMode",values:["auto","none","all"],type:"Array",description:"Option that enable advanced capture with volumetric face detection. Available values: 'auto', 'none'. Auto - enable \"realFaceMode\" only for iphone. All - enable \"realFaceMode\" for all devices. None - disable this option.",defaultValue:"auto",validationFn:"validateDistinctStringInArray",arrayValues:Object.keys(n),multiple:!1},{name:"resizeUploadedImage",type:"Number",description:"Sets the maximum size for manually loaded pictures.",defaultValue:-1,validationFn:"validateNumber"},{name:"h_showSubmitBtn",type:"Boolean",description:'This option enables/disables the "submit" button after capturing all the images',defaultValue:!0,hidden:!0,validationFn:"validateBool"},{name:"h_stepMode",type:"Object",description:"Default value for step mode (video/uploader)",defaultValue:{uploader:!0,video:!0},hidden:!0,validationFn:null},{name:"isShowDocumentTypeSelect",type:"Boolean",description:"If only one document type is in the config and this option is disabled, the library starts immediately.",defaultValue:!0,validationFn:"validateBool"},{name:"useCDN",type:"Boolean",description:"Set to true if you prefer to load neural networks from cdn instead of your domain.",defaultValue:!1,validationFn:"validateBool"},{name:"useHeic",type:"Boolean",description:"This option switches on/off the HEIC images processing (HEIC is Apple’s proprietary version of the Image File format). It’s possible to upload only via a Mac/MacBook.",defaultValue:!1,validationFn:"validateBool"},{name:"autoContinue",type:"Boolean",description:"This option switches on/off the automatic transition to the next step.",defaultValue:!0,validationFn:"validateBool"},{name:"isShowGuidelinesButton",type:"Boolean",description:"Switches on the button show guidLines",defaultValue:!1,validationFn:"validateBool"},{name:"fixFrontOrientAfterUpload",type:"Boolean",description:"This option provides the possibility to adjust the correct position of the document in case of manual uploading.",defaultValue:!1,validationFn:"validateBool"},{name:"isSubmitMetaData",type:"Boolean",description:"",defaultValue:!0,validationFn:"validateBool"},{name:"onChange",type:"Function",description:"Callback-function which will be called after change one step. The returnable value is the object with the type and the image",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"clickGuidlines",type:"Function",description:"Callback-function which will be called after guidLines button.",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"onReset",type:"Function",description:"Callback-function which will be called after reset all the steps. The returnable value is the object with the steps",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"submit",type:"Function",description:"Callback-function which will be called after completing all the steps.",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"onRetakeHook",type:"Function",description:"The function that will be called before reset the current step. The returnable value is the object with the current step",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"onCameraError",type:"Function",description:"The function that is invoked in case if the camera is not available. The response value is the object with the error code and the message",defaultValue:()=>!0,validationFn:"validateFunction"},{name:"onMounted",type:"Function",description:"the function that will be called on the component mounted. This function doesn't return a value.",defaultValue:()=>!0,validationFn:"validateFunction"}],o=e=>!(!e||"function"!=typeof e),i=e=>"string"==typeof e,l=e=>{const t=Number.parseInt(e,10);return Number.isFinite(t)},u=(e,t)=>{try{const n=i(t),r=e.includes(t.toLowerCase());return n&&r}catch{return!1}};var c=a(5034);const d=({mode:e,type:t,name:n})=>!1===(e?.video||e?.uploader)?(console.error(`{ name: ${n}, type: ${t}, mode: { uploader: false, video: false} } cannot have both modes set to false, it has been reconfigured to { name: ${n}, type: ${t}, mode: { uploader: true, video: true } }`),{mode:{uploader:!0,video:!0},type:t,name:n}):{mode:e,type:t,name:n};const p=class{constructor(e){this.el="",this.commonStepTypes=new Set,this.types=[],this.steps=[],this.documentTypes=null,this.licenseKey="",this.autoContinue=!1,this.resizeUploadedImage=-1,this.fixFrontOrientAfterUpload=!1,this.useCDN=!1,this.networkUrl="networks",this.realFaceMode="auto",this.language=void 0,this.validate(e)}getFunction(e){return e in this&&"function"==typeof this[e]&&this[e].bind(this)}validate(e){r.forEach((({name:t,defaultValue:n,validationFn:r,arrayValues:a})=>{let s;s=t in e?"boolean"==typeof e[t]?e[t]:e[t]||n:n;const o=this.getFunction(r);o&&o(s,n,t,a)}))}validateDocumentTypes(e,t,n){this[n]=null;Array.isArray(e)||this.setFallback(t,n);const r=e.map((e=>e.type)),a=this.validateTypes(r),s=e.filter((e=>a.includes(e.type))).map((e=>{const t=(n=e.type,({type:e})=>{if(!["pdf","mrz"].includes(e))return!0;let t=!1;const r="id"===(0,c.Ue)(n);return r&&"pdf"===e&&(t=!0),!r&&"mrz"===e&&(t=!0),t});var n;return e.steps=e.steps.map((e=>(e.type=(0,c.Ue)(e.type),e))).filter(this.filterValidStep).filter(t).map(d),e})).filter((e=>e.steps.length));s.length?(s.forEach((({type:e,steps:t})=>{this[n]&&"object"==typeof this[n]?(this.steps=t,this[n][e]=t):this[n]={[e]:t}})),this.setCommonStepTypes(this[n])):this.setFallback(t,n)}validateFunction(e,t,n){const r=o(e);e&&r?this[n]=e:this.setFallback((()=>!0),n)}validateString(e,t,n){const r=i(e);e&&r?this[n]=e:this.setFallback(t,n)}validateNumber(e,t,n){l(e)?this[n]=+e:this.setFallback(t,n)}setFallback(e,t){((e,t)=>{console.error(`Type of config param "${e}" is not valid. "${e}" set to ${t}`)})(t,e),this[t]=e}validateDistinctStringInArray(e,t,n,r){try{u(r,e)?this[n]=e:this.setFallback(t,n)}catch{this.setFallback(t,n)}}validateBool(e,t,n){"boolean"==typeof e?this[n]=e:this.setFallback(t,n)}filterValidStep(t){return!!Object.keys(e.Z).includes(t.type)||(console.error(`Next step types are not allowed: [${t.type}]`),!1)}validateTypes(e){const n=t.Z.names(),r=e&&e.length?e:n,a=e=>n.includes(e),s=e=>!n.includes(e);try{const e=Array.isArray(r),t=r.filter(a),n=r.filter(s),o=!!t.length;return n.length&&console.error(`Next types are not allowed: [${n}]`),e&&o?(this.types=t,t):(this.types=[],[])}catch{return this.types=[],[]}}validateElement(e,t){const n=e||t;if(!document.getElementById(n))throw new Error(`element with id '${n}' does not exist `);this.el=n}validateLanguage(e,t,n){this[n]=e||void 0}setCommonStepTypes(e){const t=({type:e})=>e,n=Object.keys(e);if(!n.length)return;let r=e[n[0]]?.map(t);if(n.length>1)for(let a=1;a<n.length;a+=1){const a=e[n[1]]?.map(t);r=r?.filter((e=>a?.includes(e)))}this.commonStepTypes=new Set(r)}};var h=a(2372),f=a(2579),m=a(6597),g=a(8764);const y=a(3416);function b(e){return function(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}(e)||function(e){return x[toString.call(e)]}(e)}a.g.Buffer=a.g.Buffer||g.lW;var x={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};async function v(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||g.lW.isBuffer(e)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof g.lW?e:g.lW.from(e);if(!(t&&t.length>1))return;return async function(e){try{return async function(e){let t=g.lW.alloc(T);const n=12,r=(e,n)=>w(t,e,n),a=(e,t)=>{return r((n=e,[...n].map((e=>e.charCodeAt(0)))),t);var n},s=(t,n)=>async function(e,t,n){const r=g.lW.alloc(T);return await t.ignore(n),await t.peekBuffer(r,{mayBeLess:!0}),r.includes(g.lW.from(e))}(t,e,n);e.fileInfo.size||(e.fileInfo.size=Number.MAX_SAFE_INTEGER);if(await e.peekBuffer(t,{length:n,mayBeLess:!0}),r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(r([37,33]))return await e.peekBuffer(t,{length:24,mayBeLess:!0}),a("PS-Adobe-",{offset:2})&&a(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(r([31,160])||r([31,157]))return{ext:"Z",mime:"application/x-compress"};if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(a("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===t[0]||70===t[0])&&r([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(a("FLIF"))return{ext:"flif",mime:"image/flif"};if(a("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(a("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(a("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(a("FORM"))return{ext:"aif",mime:"audio/aiff"};if(a("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(a("OggS")){await e.ignore(28);const l=g.lW.alloc(8);return await e.readBuffer(l),w(l,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:w(l,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:w(l,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:w(l,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:w(l,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:w(l,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(r([80,75])&&(3===t[2]||5===t[2]||7===t[2])&&(4===t[3]||6===t[3]||8===t[3]))return{ext:"zip",mime:"application/zip"};if(a("ftyp",{offset:4})&&0!=(96&t[8])){const u=t.toString("binary",8,12).replace("\0"," ").trim();switch(u){case"avif":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return u.startsWith("3g")?u.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(a("MThd"))return{ext:"mid",mime:"audio/midi"};if(a("wOFF")&&(r([0,1,0,0],{offset:4})||a("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(a("wOF2")&&(r([0,1,0,0],{offset:4})||a("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(r([212,195,178,161])||r([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(a("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(a("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(a("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(r([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(a("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(a("%PDF")){return await s("Adobe Illustrator",1350)?{ext:"ai",mime:"application/postscript"}:{ext:"pdf",mime:"application/pdf"}}if(r([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(r([73,73,42,0]))return a("CR",{offset:8})?{ext:"cr2",mime:"image/x-canon-cr2"}:r([28,0,254,0],{offset:8})||r([31,0,11,0],{offset:8})?{ext:"nef",mime:"image/x-nikon-nef"}:r([8,0,0,0],{offset:4})&&(r([45,0,254,0],{offset:8})||r([39,0,254,0],{offset:8}))?{ext:"dng",mime:"image/x-adobe-dng"}:(t=g.lW.alloc(24),await e.peekBuffer(t),(r([16,251,134,1],{offset:4})||r([8,0,0,0],{offset:4}))&&r([0,254,0,4,0,1,0,0,0,1,0,0,0,3,1],{offset:9})?{ext:"arw",mime:"image/x-sony-arw"}:{ext:"tif",mime:"image/tiff"});if(r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(a("MAC "))return{ext:"ape",mime:"audio/ape"};if(r([82,73,70,70])){if(r([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(r([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(r([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(a("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(r([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(a("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(a("MSCF")||a("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(r([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(r([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(r([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(a("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(a("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(r([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(a("IMPM"))return{ext:"it",mime:"audio/x-it"};if(a("-lh0-",{offset:2})||a("-lh1-",{offset:2})||a("-lh2-",{offset:2})||a("-lh3-",{offset:2})||a("-lh4-",{offset:2})||a("-lh5-",{offset:2})||a("-lh6-",{offset:2})||a("-lh7-",{offset:2})||a("-lzs-",{offset:2})||a("-lz4-",{offset:2})||a("-lz5-",{offset:2})||a("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(r([0,0,1,186])){if(r([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(r([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(r([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(a("<?xml "))return{ext:"xml",mime:"application/xml"};if(a("BEGIN:"))return{ext:"ics",mime:"text/calendar"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([82,97,114,33,26,7])&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(a("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(r([137,80,78,71,13,10,26,10])){async function o(){return{length:await e.readToken(y.INT32_BE),type:await e.readToken(new y.StringType(4,"binary"))}}await e.ignore(8);do{const c=await o();switch(c.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(c.length+4)}}while(e.position<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(r([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(r([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(r([102,114,101,101],{offset:4})||r([109,100,97,116],{offset:4})||r([109,111,111,118],{offset:4})||r([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(r([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(r([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(r([48,38,178,117,142,102,207,17,166,217])){async function i(){const t=g.lW.alloc(16);return await e.readBuffer(t),{id:t,size:await e.readToken(y.UINT64_LE)}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const d=await i();let p=d.size-24;if(w(d.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const h=g.lW.alloc(16);if(p-=await e.readBuffer(h),w(h,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"wma",mime:"audio/x-ms-wma"};if(w(h,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"wmv",mime:"video/x-ms-asf"};break}await e.ignore(p)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(r([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((r([126,16,4])||r([126,24,4]))&&r([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(r([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(r([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new y.StringType(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}}(e)}catch(e){if(!(e instanceof m.dL))throw e}}(m.FY(t))}function w(e,t,n){n={offset:0,...n};for(const[r,a]of t.entries())if(n.mask){if(a!==(n.mask[r]&e[r+n.offset]))return!1}else if(a!==e[r+n.offset])return!1;return!0}const T=4100;function S(e){return new Promise((async(t,n)=>{const r=new FileReader;r.addEventListener("loadend",(e=>{let n=e.target.result;n instanceof ArrayBuffer&&(n=function(e){if(b(e)){let t=g.lW.from(e.buffer,e.byteOffset,e.byteLength);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return g.lW.from(e)}(new Uint8Array(e.target.result))),v(n).then((e=>{t(e)}))})),r.addEventListener("error",(e=>{n(new Error(e.message))})),r.addEventListener("abort",(e=>{n(new Error(e.type))})),r.readAsArrayBuffer(e)}))}var A=a(6444);const C="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBggGBQkIBwgKCQkKDRYODQwMDRoTFBAWHxwhIB8cHh4jJzIqIyUvJR4eKzssLzM1ODg4ISo9QTw2QTI3ODX/2wBDAQkKCg0LDRkODhk1JB4kNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTX/wgARCADJATYDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAMEAQIFBgf/xAAZAQEBAQEBAQAAAAAAAAAAAAAAAQIDBAX/2gAMAwEAAhADEAAAAPs8mMwAhQAAAQqkhQpCkBSAEKCkhViVGNJ9WHEkkHI9XOtrBae8X+e7uN8H0cZ83v8An71rOF6eHX4dWpXuYz0fk7+R9/l9b4vVz+mKfTEGp1OPWHU5fXl1vP243fj3uXWOqus3+e/O+nh2uHbrefYEd1oxprEkvJ9HMvnvVwnzdpfVeP0+S9vl9T4vT5n2ef1/g9Xivo+P03k9VbfPi+jl1eHX0Xj9Hh/peL3PzvZye/Pn9efJ68/d/M9tVPGfU8XsPhfSi9HLyf1PH6nwerzfv8ve4d/Pejz+q8Xruc02dIg1eB6/BpvnmWXPfSsGlvV5dYbnm9efpPJ24Xp4dfh14Hp59fh1q9MZKWs+r8fp8n7fL3/P6Ke8itrPU83bPLfF9fn6fHrvx28W6/0uFqoeueT349Lj001wt8+vQ49oW/P+z57WEADeWznpX1jSzCAZMAAyovcuseoi1jrr830beDtN5+sPi668tWPo8VR+rjB9/wCfFvFTpyCybHSbn3p9OLWAAEKBCgAAAAAg1xrblux5O0Hm1ri2vXnGpW9fB255tACSfHp7vm9MkgCgAAAgAKAAAAACUEAAAFK6tSSQoAAAAAAAAAAAAAAAAAUbbUkkQdeeLlQiSM3JpoELY5dR5Pv5KusAAAAAAg7nL0drn3QAAKOtWpmSIOvPFzBqcC8K1hCzr3s9rWdFscupeL080NgAAAAAA6GOvQx0AAAo6tqSSIOvPGs+e1wo3AAEi+px6Npqxy6oq7zrIAAFYBkkl2sqdOM2d2+fZGCLWJs7UgUdW1JJEHXnprPk9+bJqAbmlnoMd7+eljl1Hku/jq6wAACAo6eOnbx2r75bNX+PoRFrNPr558dbXPsQUNW3JIQdOcGufnN8fU49GEwbKPNa8/QnTq562OXVFLeNEAAFPrwGS1z7Sy7amEFjHTeWl14x6yLvHvJnQoatuSQg6c4Nc+Prn3sdlADja5SS9XPWxy6jlb4xIoACt05DozVzn2r656WAZLnLvT68cWC9x7750KGrbkkiDry5++cKdWdAAOZeeh1s9bHLqPJd/HV1gAAEL6nn3kmoN4ABN8blmq/TlnN6HL0oFDVtySRB15UtY2LTQAFS5wXM7scuqNbMAAAo9vPrZNnc+N1OvIACXGt5qv05Jb/L0bZo5+rckkiDrz1uaGsdDO1ACnc2Zd5qxy6jz/Xz19YAAEVyMnQzq3dAAImmodYRc595cbHP1bkkkQdeeLmvZsTKBqVmbbSWxy6jzfXy19ZAAGlyFdHOrrYACJZqLWUlvl3mzsc/VuSSRB154uVc24uTUy6py7nqzeRLY5dUKIAAKHXz66iWRY7koAG+bpqC/wAO+00Ofq3JJIg688XOK51xYXREullualVLY5dUeT9Hkq65gBAUPSY7WcdIN88WFAmxvS50slzu5y7kHP1bkkkQdecesc+5tywWXpupcjUkLWdWOXYcbpwisAA0uYtZHbx0TW8ulkO8b51NncdxsaUJcbsY6Dn61cmZDh9eHP1yut9jPXDPMZvzUttG55F5TTXpuPqAQAFYNbBU6ccWSZ1LnelzkiudNZ3zu3jolzLkHP1q5JJIoBAUAAEAAAAAYqK401nCYrJtNS53vKgADn6tqJpAAAAAAAAAAACkKQBQQAAOfq1bepJtAAAAAAAAAAAAAAAAAEBzd2rVIjkwYBgAyYAAAAAAUEAAAAyZBsSnTt//xAA0EAABBAECBQMDAgUEAwAAAAADAAECBAUSFAYQERMVFiAyMTRDITUiMDM2QAcXI1AlQVH/2gAIAQEAAQgAJORpvCDVxLbhW3CtuFbcK24VtwrbhW3CtuFbcK24VtwrbhW3CtuFbcK24VtwrbhW3CtuFbcK24VtwrbhW3CtuFbcK24VtwrbhW3CtuFbcK24V2Gj+oq5XIztKv8A0IPz4ot2aGHlZqYR8llsJG0sBxIS7enQv8VZfIYvKBFVz88jicc9yrg8n5rEROsTlsja4qJQLxbeymKmI9TFWmt4wB40mtGyNqcrOVyUOMPGtkK+QAJyUuK7dmhins1MLLI5bAwsrhbiI+VOardZZbLZKrxSOgFmeMWi/EJz1MIexW4QvW8nQLZuXM9av5tsXh4YyyIfUQD3p4G0Wzwrfv5zdbmo14GWZ58SZTLYy9qqYfLizeN7oqVk1XDWbdvBGLm6G7JjJXXnbDepZTJWeLJ42dgF8FkM6z/V+f6xtN0ieAKY5l8nVQbYDv0Fxl/bZlwZ/bYU/X/cT/h48/eavTijKXJ2o4y/iqAMbQFXq4D+/wCys1jvKYg9ZcJZmdWjZovVrRqVRghkGI/+onQWDHbHZyDXuNH68NzVPLZDE8IgnW4Mx1UNDehWe/v+snbrJcTO0+F7rx4F6+nbOjgP9+PrWSm742yy4UFfLQybY6lrfG1YtIQy5G0M5IWeDs6xRYkobuD6yv8ADGSwdmVrFcLcQkzQpis0mNLj47VsBGyKpYa6Wyw7IhPyO/Q0EQ0y9GmoTeEmlHLUSXMLINfEgu43FDA+GxocbkdyfiXDXs1kRGp53EedxWmXDoMpjaW2vYnE3qvE5L8y5GuEuh4YsdPN2MuOllGP1iW1iMjLinyrXr+TJWlClnMeSzhY0qmIo7fAbHI4TG38HkyOKJRzeWnKYi9e4mhfr2LWTcEtvax9yfCewbhPHW8TSJWt2+HLFPMNk8NG7fIPojjNPEEE3DWMyODewxY+RtZas5RxP5Y053qIMjVJTsVcXZrcKPQVSxkAAjC3hMROge5ePTwmUq8UTyb5KxkbgHr1rVjVknm1jMNGUOwIwzN1HbfoUaf6v7hnKLr2yZWxODRU7JiQdptJ4/Hnqd2Zn9jO7RdlF3i7PFsyZhsybJ2WK03fKWXLrQMy8isxbWTExH7dezCxHrFGOwWQbTElplyJaGB3eVnLzK0oDlkzSrxG3OtalWiRoVDEKV+4/wBX/wAjSoPIU9UPIHdGsGm+qQjFiRnbyJlK+d1N5Em8pt7qfzkq7NthrSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSy0stLLSyyLN1Gq/2w/wDpsj9Rqv8AbD5E+b+ydoA36T8jUULlcnx92UnJsmdm7k13JruTXcmu5Ndya7k13JruTXcmu5Ndya7k13JrhuTyax19+S+o1X+2HyJ835W7cKYdc7WRPad9XOtdPV/pUL8LsPbcwRbNshY+mzr02demzr02demzr02demzr02demzr02demzr02denDL02dYnHTx7F1+/J/jVf7YfInzflmLHevPD3VzyrHiSAiMUUZx5kydQJJQJ5ekvL0l5ekvL0l5ekvL0l5eknzNJk2ZpP9fL0kC/Wsk0BsF7cOkevVAM8ZNGXJ36Rd1CzGb9Pbk/xqv9sPkT5upS0QeTzk85vKTinFmeXJmTALJn0rCk149m9mV/cz/wAvh79ydWo/R+Qo6iRZuViXQPIB+j6J88r+JV/th8ifN1dfpRP0pg3FsY0zctEeeTr7e9OMcB/RK3sNiKhyyITwVJeCpLwVJeCpLwVJeDpLxlVeLrJsZWUcJRnFnYGPq0S9wcoQk7uuyNdoaFOGloxRi9yfMD6gxfnlPxKv9sPkT5urjs1I2rBQ1XZS92fH0kGawDN2C+yzno1rMxP6livUsV6livUsV6livUsV5qK8zFM6F0AD+MpXLL2Rk8JM7RnE0HZpR0Sdn5BbSGLc8p+JV/th8ifN1kY92zUHLDi7Nu2P3Z77QbrHg21mv7Mr+5n/AJNaLTJFnsjdn1+4MHmRtNuLN0flH5N155T8Sr/bD5E+brKQdq8TQrw62iWB+2/We04IKu7WMgY0efag79X7I12RrsjXZGuyNdkaJCDkk7duCrv0MyszZhvH3VptCbs9t/hzG+ocX55X8Sr/AGw+RPm/Ltvj7YmH7bWs9mFYYRQAJhj53svbBdKOHnbq87dXnbq87dXnbq87dXlLK8pZUctai/VsfbLbiSZvdZf9Y86z9Qtzyv4lX+2HyJ835XgOepJoVLLWgRm3OU2hB5So9SyLZl7MhjbRb5pw8TdXibq8TdXibq8TdXibi2FlbCymoWVjaxa0CRN7rD9SNzqs7B55X8Sr/bD5E+b87jSp3BlrVrQ7Q3eCIWIhvMkzyyFsI5M3Rujfyyw0EduTOrH9eXvM/Ur84R0QZueV/Eq/2w+RPm/KUmhF3lC2O7lRduxRgWfdH/5GH8Khj3LNp3cmSNc1Urgsisj1i9mUnJsmdm7k13JruTXcmu5NdyaeclrkmZEA821xdni7s/sHWlP9ZEi/dl0VeGovsyv4lX+2HyJ83UziF8wM+WdyGsUg2BszjtlpyYd1n6t1azf0k7NatQ0k79m1U7bys1qd8VkMXk3O3gp2bRCt6amvTU16amvTU16amicPEG3VeGmvDTQyzUizUH7v8BCVnj+sUMMiKUIgi3RpyUiTdv0jYmyezN3QJkI/68sr+JV/th8soDIGuk7PirqxVW5Us9J6JKYO5B4TJRsgL2K1alCqPQLRJZYVkoWEDxN1ApZIEm0fyPqzrtQXagjRdpv1Yjs3RDPGDu6a3BSMGT9X3bf+pncjJ5O7IQ5vJnjoitEUzdG/TllfxKv9sP8AyZ1oSdPU/wDj1JLakTVJKNRm+URQh9PdlfxKpJp1Ru3/AEuSfqQcGq5DaEeBIXAFbrHcBW4CtwFbgK3AVuArcBW4CtwFbgK3AVuArcBW4CtwFbgK3AVuArcBW4CtwFbgK3AVuArcBW4CtwFbgK3AVuArcBW4CtwFbgK3AVYydcDKJpnLIk7P1dSTp03Nubf5LchfVVfov//EADsQAAICAAIHBQYFAwMFAAAAAAECAAMRkgQSICExQZEQMlFSYRMiQnGBsQUwU3LBQFChFGLRM0NU4fH/2gAIAQEACT8AJVV7zf8AERW/cMfvKq8sqryyqvLKq8sqryyqvLKq8sqryyqvLKq8sqryyqvLKq8sqryyqvLKq8sqryyqvLKq8sqryyqvLKq8sqTLKkyyqvLKq8sqryyqvLKq8sqTLKkyyqvLKq8sqryyqvLMayPDh0gwdeInxDE/Xf26Q9ToyjcFIPUT8TtS9iwHuVlNx/bK1r0uskArwcjjNMcJbXrEFFPP5T8QscVMNdLkQggnDkBAarCdR9XkR4TTnNNb2DuJidX6TS2FFm4gop1W6SxrBYuOLYY48xumm2totbezrTVXeQPeOOHIzTrBQbFXupjgRj4T8UusarAvXYiHEfRRNIel1dVwAUg9RPxK6vSH1sDqVldx8NWBTdUuuHAwxAOB7NOcU2PWN6JiNb6RmfDm0uaqyoAggAjj6zSXtZbSgGCgcAeQjivAkW3kY4YccJ+J6V7Xxt1WU/TCWmrSqjbvrwwxXhhjjPxG9PY6mHs0r563ipmmvpehW0M6YooIIK+AHjNKc6OK0dsUQ6msWHh6RjU+5bAOKNL30o1G3cVUbkYjkPSafctxY4pSQFq3nAYf8y0MyOAjoMMVI8Jp9opFli4hE1sFxw+GfiVt9SXol9bonAkcwo8RsfEh/wAH/wBxgq6o+0tHQywMZ50+887fef8Alf8A2fpfyYK9G0dypa2sFsVh1qwMdfz485+pd9zO8Rin7hwgxvU40IfMThh1wnBBgT5jzP1MKrYbUwLDEdwRw9puU6w3AjVGGE86GU1tU5dfac0OJ5S03XXDVs5anivZ+pT9x2HWGGH1D4GcfbthkWd80N917OBof7GW1pZqp3lxJ73Aw4D2Ff8AkRBZW2iUqy+I17JjZotvA+dfA+omH+mva8treU2NLXetf0z74HqOcAF9OBJHBxGRbfbW4FxrDnGBv/1D655QgmzHt8rfxHJC7h2EhhCLbb9R3Z3UAYb5RS1tRYo7aQAm/wAZeNK025vecdxMeOEqXUqTVxaxd5xlfsdKTfXrEbj4YjkZRrpX/wBJksUkDwMqQo7OxVLVLDWjnEfWYeydcaB4O2IaLquBjiDxlFYq9orBTaoJAGE0Smqxxh7R713TVd8KwSbFCgLFGoocMA6srgnHqIa79CsP6oBI5H5xwQvE4yqsojIQptXE6s/DwLcNxe9cBK/a6TYo1zrjDHWxMqw1rTYHVwRwAmpr4kvQ5wBx44T8MNL+N16ag6YkxjpV7o6Y4hBi3z5CaMlou1e7eowwxlFWi6FSSxAtDFjgQJoxGjvSlQb2i63uljiRj/uncY+63ND4iYG8VWquB8WOE0Q6TaowNmjOmq2YjCIPb6U5YVVnuDEnDE4TRUZDY7agtGODYzR6qBbutsa9ScOBwwh3IwA+QmDL8WsI6tPA/wAbbsnyMIXxI4mWuw8C0JGwSVHLZJAMJBEVS3mj4jy8ow/byiBVPxCYuR0hwbmOze0GB7XGsvLnBqDk3OEgj4wd52B3xhj4R2fAcz/VHAzU6Qw44QJ0M1V+QhxY7fhPIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJ6zyD+zes8g2rq1P7pekvrzbbEDWjN1jN1jN1jN1jN1jN1jN1jN1jN1jN1jN1jN1jN1jN1h8v8/kes8g2PoPGOUTyrw2HOr5Twnu2DiuzagDnGXV9DLq+hl1fQy6voZdX0Mur6GXV9DLq+hl1fQy6voZdX0Mur6GXVy6voY6vr4d38j1nkGx3axq/XntcVm9WGOxcAy8QQZevQy9ehl69DL16GXr0MvXoZevQy4H6GXgfQy9ehlodsMZxPZvXY3bPrPIO3goxm8scYjD6bFTkft7PgYj+djzfl+Q9vj289r1nkHb+mftODHf8ALtA7dyt7wnJhsISzcSGMrbOZW2cyts5lbZzK2zmVnMYhzGIc0Q5jKzmMGo2GGJaXS2Wxgezuja9Z5B2nAahE+FNr1E82xQW1DhjrTRmzzRmzzRmzzRmzzRmzzRmzyk5pSc3YZuH5Ph2+s8g7d6M5LD5T4SBtcn/gzjZSS/XHY835RJB2iROO16zyDt40OH+kwNdyKfqMdoYoHxf5CdyseyX7nYRekrXpK16StekrXpK16StekVePhFXp2cTtc569vMdvrPINhz7C1iCnlPptWGsFS1hXjhwgwVdhwFVsBioli5RLFyiWLlEsXKJYuUSxcojjLHGWOMohBYHw2/Da9Z5Bsd9feT5icfiHgdggKOM/7p9z9o4bNLMrNuMoeUPKHlDyh5Q0paUtKWiFCTt+A7fHt9Z5BsglrSdevzYQ4Hmp4r2MFUc4jJozk4f78P6f02vWeQbBAAhOrUrceZOAjGq7zr/MFD+DHESw3MOCfCJ8DncPAiMCPtssQNaM3WM3WM3WM3WM3WM3WMYT2cSOG17ogPZy2PWeQdtip+5sIwFKtgKlP3g1GXuMu4rN6/DcOH17F9rcei/ON7W/x5L8o4qsUYt5W+cZEc/BrbFygOccNWXrll65ZeuWXrll65ZcpH7ZcvSXL0jywg+BE1Wm8dm4eMIDeYyxj+2Pw5Q4w4Q+6O31nkHYLDTuw1ThylDSlhW+5uxAynkY1o0duPPU+UT5nmeytm1u8ZQ8S1Rj4/lKIoi6om8eBESBohJiQDsEURRses8g/qd0eFZqwgRou36zygf2biATMTWf8S5OstrzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNLa80trzS2vNHDt5VnE/wBo/8QAKhEAAgICAgICAQMEAwAAAAAAAAECEQMSECAEIRMwMQUyMxVAQVAiQ2H/2gAIAQIBAT8Av6/f2X2t8e+tl9cEVN0zKowlRlw0tkYYKcW2YlGcqZkhpKieOKx7GCMZqmTWsqG0kKEfj2oVf5RhipSpmRRhOqM2JRVoTIY4vHsSMKUpUzPFRdIjiUYbSNotnrb0Z4xhVInOKhZ4yhliZIfHIaTlSJx0dUSolCKx7Car8D/PKFFs+Njg0eN+88n95/0HjftZhgvcok5uUrZl/hMMtJGeF/8AMk7ZH+EyNUtTxvUyUIyyHkSd68Yv4XxgVTRn/kPJ/Yq4hNvKomerVnkKcptR/BCbxYlIhOHkwMjlDKkQywyLWRnxaP0OvhRkr/Bq65RFJcNWY5KMrJtSlZObcdUYpqEWmY8mkjK4ydonOLx6igzdyjqSxinH49RRiYpKMrZOVz2iZJxnH/019kJxjDViUbtsjKKnsZpqbtEcylHWRL44+2yGTE57JmbNiyV7N8Sj6ZP45YtbPF8l4J0PNCWbay8bdpk8m3oeSLx6EYxX5ElQsY40Ij+O1JixoUUUu1c0ikfGfGj40PGT8aeSXszYJYmWzyfM+L0jx/OeR0z2WzDjyN2Qx+hQ6ONkoifossssstFotcWWWWWWWWWi0WXxZSJ4ozVMXgYzL+l4ZO2Q/SsF2kf0+BHwcaIY4wVIVFlllotEyyy2Wyyyyyyyyy2Wyyyyyyyyyyyyyy+LLLLLLLLLL/vaK+lcx5oooortFeiiiiiiiiiiiiikUia+hcx712UqRubm5ubm5ubm5ubm5ubknf0LmPC+tRNWas1ZqzVmrNWas1ZqyqIrhrlGvVcx4Xd9I/XMjw+Y8NdFzEXdD6KVG7NmbM2ZszZl8WxyaLbFaLZbGhCXMvzyuYiH2Q+ijZoaGhoaGhRXDViVdGuFzL88rmIu6H0i1XdcMi+0iL4fRcxF9tstlstlsti4kRXZoiuXyuY/bGKo0RojRGiNEaIoooruuZcrmPCH9UZKjZGyNkbI2Rsiyy/oXMuVzH7qZTKZTPZ7Fwxd1wx8rmPS/piikUikUikUuWX2bEyyXRcx+mukZ0bm5ubnyClZZZRR+BS4cqE7KEikUNcrmLVGyHJFo2NkbFikjZDkh/Qi2WxFDialM1Eq4bLLfRf3NmxsbGxsbF91/p0UUUUUUUUUUUUUV2oooorpRRXFFFc0V/qf/8QAKREAAgIBBAIBAwQDAAAAAAAAAAECERIDEBMgITEwFCIyBDNAQUNRYP/aAAgBAwEBPwD+Z5+bVk4ohlJWQ1LdM1ZuMqJtxjZCWashNudGtKUSEso2K7M3nQ0zVk1Eg5ShZpajk6e05yU621HUTRk2rY5uUqQostqJpScyKdmrKUGQnmj0rISyRGxTbnRT6IckjkiKaZrP7TRf2H+U1vyRqSfiLIJRjSNP9w1I5RNGdfaIlfKQv+zW/EjJx0zRiqvaf7u2r5gaP4Gj+e019rNG/NGnSj5HHOVDT0ZEKlCyWnKDuJpamXsV8hC/7HKn0m3eydDWUSCpEKUrZOObtE4ZxNO4ryQi1PIeokyknkQ1LHF55Dm6Jq4kUlGmQTjIyRKLc7LdUOLcKNKOKpj02naI2yUZY0aWnOF+Cptiyys1NNakSMGoYiySpohDHyKElPIlMcvuHrEZWtpe+l7KTQ9Vjm2W97LZbLZZZZYtZnKzllZHWt+Tnikaeqp7QhkS0q2onqRiS1h6roveM2jTk2SXkoooooplMplMooplMplMooplMplMplPaEpRPqZkf1WofVah9TIf6ibJSlL2UyiiimUzS9FIpGKMUYoxRSMUYoxRijFFIpGKMUYoxRijFGKMUYoxRijFGKKRSKRSKRSKRSKRSKQl/AstFotFotFotFotFotFosv4VvLezJGSMl3m6ZkzJmTMmZMyZkzJmTMmZMyZZZpfHLZyocrL3yZGXWWm2zhZws4WcLOFnCzhZws4WcLOFnEziOIhCvjltN9oi6OaORHIjkRyI5EciORHIjkRyIU0yUqLIS3Yp/BLZlb0VtDpP38el7J7R3m9oyF2Y/RH3tRW8kQ6OCZxI40caONHGjjRiYiSFpxaFFRHTKRSE0eiTvePrsx+iHaaIdHqJM5jmOY5jmOUyMj2Kkhy6J0WmhrePrtL2SI9pkVXSadlFFFFFFbQRNdoE1sheuz9khdmhdKRSKRSKRSKQ0toeyT7RZN7IXrtLb0+z89ZTaZyM5GcjORnIzkZkZCk0Jt95bw7S2Yuq6yg2zBmDMGYMwZgyijFiTXeW8O0t34Yns3RdvtaLRaLRaLRaHsiXd7Iiu0t7tjRTKH4Yn1m3ZbLZbLZbLY3skOJXVRGiiC7yLF5GkJ7N/wChIfgUhbvTtnCcJwnCcQ9MxMRMsXkcNlGyqLGxSZkyNvtNMwkQi0UxxMGKNFEotmDIwkL18OKMUNbKRmjKJlQ5XtGJRSF4/mNGJgYGDMGKAor/AL3/2Q==",I="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBggGBQkIBwgKCQkKDRYODQwMDRoTFBAWHxwhIB8cHh4jJzIqIyUvJR4eKzssLzM1ODg4ISo9QTw2QTI3ODX/2wBDAQkKCg0LDRkODhk1JB4kNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTX/wgARCADIATUDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAEDAgQFBgf/xAAYAQEBAQEBAAAAAAAAAAAAAAAAAQIDBP/aAAwDAQACEAMQAAAA+1SV5iQAAAAAASoAgBAAAAAAAVpfrVGM2SAAAAASAAAAAAQAAAAAKGo1ezZHnenPl6yOrnSW9e1nXjunKpO/jedvn9YHqMdOXrJO1nfB1n0GNWzXC3zpszlg1LPV46o8l0462pbL3M7383iaz1pcJd5dBdtLI8T14+f3gnos9GbtL6vHT5n3890dPO9NLLOvnp0M68/vnyNZujozVaegx05O8cHWPRY6ZGpZ2M67ed/Nu3DRubz1vPr2cb8p05+jxuo62daFu2lkeJ68fP8ATmX0WNs3bPVY6/O+3D0WN+a1jn6zfHXm9/O9e4pt2MulNeS3z9ZnpoXOvWccfWds5Nz9A5d/GdOOjqX5eux17Gd+U1z9Fnda9bOtCttLI8T14+f6cy+ixtLtR6nHT5j34dDGuhb5/XPbmvdcu3KueBvHSzr0ON+a3jszXk98+pL5jWPZY6cHeOpnWpZ6THTxnTjo6l+XrsdexnflNc/RZ3WvWzrQrbM2fFdeXn98x38aS7a+mzv5v15bstKa56LG9LUvmtqNua56dWXKsI09TTubTS1OWz7fn17Gd/Nu3DRubz13Pr18b8r05+ixus601oLdrGbPn9TnoOrNTLcvbzvhaxVZy7nonoM78xc9/HTy3TlvTW9Ls51xdY9ZjryNYk4G+eJ1Zrl2e159fI746+pZL3M7383iaz1prA3pdBb9YuzclRICgASYlW8TLdjagAABCAAEAgAAGhbtliYpFkGJNBGcuU1kFwuarm/PSQAAAEEAkJABAABoW7GsTM16zhqZSyAYpbnpK2Z1ZNDX1ztm85cSLISLIBKzErhcVawUEAgAtzsmldbKXZUdOdG8JCqA3uHoyWrWbM6smqrjDUAylmVRIISBVWudOsAAAAbGOmcuk1uwRYJWViIsJZnpZNV3Nes7GOkGFkxm0gALABBDMUpIIoIkKNG228rFyXGyqr83POslwZr1mzO85qjXO7PTJRCQRZAJIzZABCAAKCABo6bTNq1bx5H0Z1Lerl6fz6sxuSuyvWL8datYhJXGxEi2Agy57ylUAAAAAANGtnXNc4bc7TfjmadfnbMW3O5XX3ztxuaqucoyayllQCQVxMKAAAAAAGjV2+V8tW2trN8utpv8tRJK3Y3TvExZNYWQRYICSsyyrNSrAAAAAUEGjW1rK4r01tMoit7luzKneb8bwsr1kTLlLksxBFQmFysY3MpAoCASCASQDTt2Nc7Y1tWrTMos3eetvGqtYzm882LJCgAqATHUwylQAAAAAANGtnXO/OiyKxSrWLc6xIsymsbIsEQJJXKakAjIoAAAAAAGjW5ZkzjZK5yzLXrCMmqrnIylympBFYs4aQyCjLnvJQAAAAAANGtrWIuZgKtzqKwS7O8UilkAEy5S5LhYIQRmyoAAAAAAGjV2+WxNZZow1MLmyaruQJlyUCDGwACRDOspogAAAAKANHTbuLpUAYayMpS5KgqSRbCYWY3MUAAiKCAoECBKgDWut1rCRAGNkM2Z0tACAAAAAAoFIBAAACSt29f/xAAzEAABBAEDAwEGBQQDAQAAAAABAAIDBAUGERIQExQ2FjQ1QENRFSAxM0EhIzAyIiVQUv/aAAgBAQABCACSQveWR9iM/r48K8eFePCvHhXjwrx4V48K8eFePCvHhXjwrx4V48K8eFePCvHhXjwrx4V48K8eFePCvHhXjwrx4V48K8eFePCvHhXjxLx4V48K8eFePCvHhXjwoRcP2oZe407wHeFh/wDGuzurOa6Ov7tH01DqG1iL7IIPbW+vba+sJqC1kobj5hqG0dMnIK7mp6zsUGKxrG/DZljHttfVvMT18pQrMqZWafUVui461vgkButb6zN2TH4mazFgdQ2sobIni1DafpibIGjO6zj68789qW3i8ma8FSQz04ZXLUmdsYeSAV9PajtZbIugnpZ+zZxN+y+3qC1Bp2reZitVXb+UgrSdMhq27UyM8EfttfVbWN+azFGTlZhqYY9XJjXozzMfqC03TLMgrNt8OHktDC3ZMjiYbMyyv0lX92j6a2+MxddJ+65ND0C5Zb/fTvSaB1nMSQxswVuTKSURiARprK87eUgl05Vqx5ieLO5StHjtNYG1jLcz7ep/TtpOP4zha1bHsx9l+KfdGIq2bcxkidm6T9VC6dTZqvk/G8LSZJ0/CTrr96osbQs5GyYqk87L1uC9WhsxVMjNlp7ubpS6ip24hq/GdM18cudKPxCuj6+Cyfwi2pfQMKu+mJlpb05V6ZX6Sr+7R9Na/GYuuk/dcmh6Bcst/vp3pU9VRqp6+uoZSepFcqxqnafStssRe2WRT8nPldGXprOimB9q2054nEMdia2ioxL58bvYzGptRhzYqHGSuoZ52Ih11+9UVQfg2Agy1XNf9FB4tSbKTz4yGk/UWLgxVqGOuDsd1pzJT5XHSTWc38cudKPxCuj69Cyfwi2pfQMSu+mJlpX03W6ZX6Sr+7R9NbfGYuuk/dcoh6BcssRz06uYV73+wp8pBJpavQGpqz7d3GwRXKklC3JXmxmAtZaB8tbF1n0sVBBNlMpDldKXJq8Gl709JllmIpS5HRs9aCGo9mEZVNDFT6atDIXs3ma1bFbP09kYcZk+/PrV4lNF4WV9SYdal9Q21o/KQVgab7mKny2pL0dbTmMnxWOkgs5v45c6UfiFdH16Fk/hFtS+gYld9MTLS3pyr0yv0lX92jW4C1oeWZi66X92ySHoZyygIfp9cHK4wm9Y2nx0EemK90SZq1NarzvtWZchbknlyM02mZWQYs6uyn9QaLS3Ql/e7lJsdpnH+Noxw/BS0y6kyAzklZmrP7mn5OBxdPK42kLfsfjFqWtHLlcTWdXwVOTVdmidWWTUylGWDDQxZ/MzvyNaeWlaFiDBRQGEZFyzfxy50o/EK6Pr0LJ/Cbal9AxK76YmWlvTlXplfpKFxMEfTPYCzlbzJoBorIL2KvrC6ds46G42YaetDTBxyvYSey7FFiqYKzBUykb59PWZdMwUB7E5BYDAWsTeklsNfxWR0pdu5WazFmKUmRxM1aH2IyCwml7mNysVmajhbFa1lJH4HHS4vGCvO3Sd0ZoWysripr2UoWYoMVNFqezkC/RV9z3EexOQVLT1qtgLlF7dFX+mR0jet5GeeP2JyCraNvw2YpD+FTHUwyCuQusUZ4mO09adphmPVipJLhpKowtKTHYmGrMsr9JQRkwRoRgID/ERyCI4khRu2PzGV+kq/u0fTmEZV3CublzK5lCRyEv3B36yDcb9Afl8r9JQybV41uSnycCu+hYXlfbyl5K7/wBmbvjD0E2T+D1jO7enNq7oRlXdK7jl3HLulCVB4U0/b228wrzCvMK8wrzCvLK8sryyvLKbNyYCjIVkXE9tV2kwMQYB+togvG35q37DU5m/6KN/8dJBs7qEGOXaK7RXaK7blwctj0n/AEb/AIo/2x0yH01C/atGi4noAhG5dortuRGyB2TH79JW/wAoFBEcl2kIwEP8Gy2C4tXALg1dtq7bVwauDVwC4tXEdMr9JQ/sRprCUdmFPssiaS8ZaoTsBOCEx/NvQx/YhRv/AIRG/SM7tHXcLm1d0LuhdwLuNXMknbk5cnLk5cnLk5cnLkVyct3LcrcrcrcrcrdyyXL+2qzAK8ZRICkdyKydt1u9IemBuvjtCu6EgAjq9u4JQKB3CeNnIPLV3CVv0AJXEog9WfIZL6aik2rRgKR4Y0udhIAyiS4RsV+MR5qpKmpj9kOhGxKiO7E9vJcChET+ojCAA/LsF+hPyGS+moBvAxCP72mCRhYqm7Y3Mdup4hNajUIBjITmcVG7Y7dJBs9Ru2XMLuhGUrulc3Lm5c3LuOXdKEoQO5PyGS+moNmVY055KcpnGOwwxeTuNmVTzY5zq/8AoURuFtsmncKQbjfqGFCIoRBdpq7QRiXaKII6An+N3Ldy3ct3Ldy3et3rd63et3rd63et3rd63esiXf294jvBGms3CvNtgjw6tCV8G9rxbTyY32q1iExmjQknMO1pSDZyjO7enFqH+EsBQHEkfIZL6arM3gYfyuZyC22KY7kFImPDV3QjIVyK3PUOKEpCEq7oXcC7gQO5PyGS+mq/u0ac/iu4UJfuDuOko/lRfqU9vJq4lBhKESDGhcWriF2wUYvsWkflZ8hkvpqF/GrH04FbEIEg/wBGP5BS/wCqjOzunMBd0Luruld0ruoShB7ehjau0F2gu0EBxJHyGS+moP6wMTWcR1dH9geJTv8AnH03KAQYUIl2l2iuB/LuVuVuU1335hcwuYXMLmFzC5hcwuYXMLmFzC5hcwuYWScP7arM4wt3/JKP5UJ3BCLAgwfnIBRi/wDkxuXBy4lcSuJXEriVxK4lcSuBXArgVwK4FcCuDlwK7ZXbK7RVqs+dzWskjcxxfH34v58iFeRCvIhT54eJ2iniBO/kQryIV5EK8iFeRCvIhXkQryIV5MK8mJeRCvIhXkQryIV5ES8iFeRCvIhXkQryIV5EK8iFeRCvIhXkQryIV5EK8iFeRCvIhQk5/wBIoohE07//xAA8EAABAwEFAwkFBwUBAQAAAAABAAIDERASIWGSBDFTEzBBUVKxssHRIDJAgZEUIjRUYqHCQlBxgtIz4f/aAAgBAQAJPwA0A953kEwPPW7E/uoo9Kij0qKPSoo9Kij0hRR6VFHpCij0hRR6VFHpUUekKKPSFFHpCij0qJmkKKPSoo9KiZpCij0qKPSoo9KiZpUUelRR6Qoo9Kij0hRR6Qoo9IUTNIUUekKKPSFFHpCij0qKPSoo9KNw5bvohRwwIW9wvH54/wBmPvjH5LsCxkLmuiDzfBrWpHQclDsul3qodl0O9UyFpgjvtuA55pkPKiS5dobu/wDymRH7bQSVBwrd3Y52RbMQx5bud6qHZdDvVNjLNqAvkg1TWCKFl5pFbx3eqh2XS71UOy6XeqDS9lKB241NEyFvIx3xcB8ymQ8rHJdDaG7vGeapelia803VIqo4HMDQavB8iqB0kbXGmYsZE7lAa3wfIhMha0Rl4uA9Y6ymRB+ze4ADT54pkJlnfdIIN0e9nko4AyR1CQDXvti2csjeWgkOr3qHZdDvVRbMA94FQ13qms5Ex372N5ULo43PAOQJTIeVdJcu0N3ec0Gl7YTIB0VpVBrXvvVDdwo4izNdgWcAeJ1vB8nLjeYXW3+FlC+SYtaMy4oM5eNt41dhTD1C99ic77RG+rzq6UMblzEXccSmMo5lBjVdTfEFhLsjKzV+7hREfZ2OunHyTqx7MQ+SrugK8YBHd9zGtE99I717C7vojU3nd67L174be96mC/DbD+I6P26V+B2oXIaCpr/j/UqohibR/wB2nWny6LOM7vs4re9cHyK4D/CVxvMr8qfCv1eN1ma7A7rOAPE63g+TlxvNdbf4Wfm/5rgjuYrnJzuN+oxsul7DVt7chBoPqrl5sgZ90ZtK3GIBfhngSG/i6tev5Lc9jQf3Rn1j0V7k/tHJZ0vUX4aOO+K+9U4712Xr8TM4xOv4tpV3/IWMe2svS38TXJXORhNW9fT6q+Q+O+bxrjU2XbzZSwXRTCgK4zu+zit71wfIrgP8JXG8yvyp8K/X43WZrsCzgDxOt4P/AEuN5hdbf4Iriu7yr/LRSFx6qVd6qgfJFQVV0vj33dyMdGuum86ipfjZR11XwwEN+911aUYeTcy/i7GipffNhX/UqnKN2cRZVu0VwwsBaRGampQfXbIXcnQdbenUFeLLhH3RVbnMce63tDwhX+Vnlq2gw3K4Cx1TeNFcvulLxdNcKALjO77OK3vXB8iuA/wlcbzK/Knwr9fjdZmuwLOAPE63g/8AS43mutv8LATSR3eUDy0khaeqlXeiLS/Z8IzdX3pH4uuhCkcreUfebexRj0Ljf8JzKyRhj9KIryru4K4Ym7QWe50XqLGr27kcYohQNfTeB6Jsutf+ZNz5VaEH8hHEHDHGtGpwLomYI7472Bu44BDGI4EioTwNp2plZDew+lnGd32cVveuD5FcF/hK43mV+VPhX6/G6zNdkWPiAbGGUeTWtT1BS7Nqd6KbZdTvRPhcZ47jLpOeSfDypkv3qm7v/wAJ8VNipfqTjS7uwysfFXbK3KE578M0+ETRSFxcSbtKuyzU2y6neifEQ6O5RhPpZLAGPfeAJNe5FofJShduFDVTbLqd6KSBzGVqGE1xFOpPiptl64AThUu34ZpzHPDias3KSC59o5WlTWl6vVYWBmzPvPDq13g4JzDFLGGAY3tzfRS7Nqd6KbZdTvRPhMkzqtIJp0ZKbZdTvSyXZwyR5cAS6vcptl1O9FLsxDHgkBzvROZyQjuXam8qB0kbmgnMEJ8PKtkvXqm7vOSLQ90Jjr0VpRFpeytS3cauJszXZH9mzXYHdYULSUT8fmuhosCCYPqmBMCYE1DmDYPZFmKYmpiYmJgTU1NQszXZFnV7efNm0Ic9muwOfPNhBBCwIIIIIWZrsiwVRDG9bjRTxawhzh9qioqKioqKioqKioqKioqLNdLRaSWNNGDKw1jk3ZHnAgh8HmuyLDRrRUlAFz3nf9Exv0X9WB+XMA8wPgc12RZgHNI+qwc1xvZk44fWzewVOQJ/+Lr9o+wbCj8HmuyLaOe/BzCd7RXFMkL+yW0/dEGQuIdlSoouv2x7JsFtefzXQ0WRRvqMS9yYBMTi5rsfknUYP62+870UTA5vvVNAR1JjWPruaa+yPi812Rzh9gmwfCZrsDu5kWGwBAfEZreWCwe2bAhYEEfYKPwOa7I5so2D2SUSifgc1vaLv0w5gc0EEEEEEEEEEEEEEPaFboqfmheB95qeGHqdgf3UsepSx6gpY9SlZqClZqUseoKWPUFLHqUseoKWPUFLHqClj1BSx6gpY9SmZqClj1BSx6gpY9Slj1BTR6gpY9QUsepSx6gpY9QUsepSs1BSs1BSs1BSx6gpY9Slj1BSx6lLHqUseoKWPUhyhy3fVGrnYkr/xAAdEQACAwEBAQEBAAAAAAAAAAABEQACEBIgQDBQ/9oACAECAQECAH/Db/lVrxwaoCc8JCpqAQiAMqDVLnBXk1SUPmm20QRxQmumICwpDq5gw4Nt5ppwQaBFyBaVlo2ZSGCIGEDDgwQ+aacGCIQEkkDolkgEV0S0BJGHBgh800641nMAtEM7qSa6crhwbbyLd9mzcb6ZjB7Nup1AWLd9dQW6Nm3Ccf5iCH7FiSWjD9QHPPPPKxeUkkkkK888888888pbX3YvR4bbbysf4HVjbeEQHX+jbbfgaIK8cGCAwj2kl6bxvwIYIIMsCMHhL5xFKwxwwjBDBjfzDHWHbeBDqSSSXwDEPFvA1ttt/EMdSbdA2wQ/o/gEPl4MS8JJJfAMASwQwRtttvyfgEHoakkklG2/gHkHVG23qXxD0Ccfptt/EPQ1JLEkkkvCSSSSSU//xAAeEQABBQEAAwEAAAAAAAAAAAAhAAEQESAwQFBwYP/aAAgBAgEDPwD8m3C1WbabVSNCT4NYbi+hJ5GRllTxcPm8VgQUeRkYpWjFPFtA1SvAgo9jFJnTIowMjQkSdMm2cBFMm0EyaGyJPwI+9f6ayZMm+vMmTJvV/wD/xAAdEQACAwEBAQEBAAAAAAAAAAABEQACEhAgQDBg/9oACAEDAQECAP5C1t7FmTDfetbFiRbQJs5e1ba0LcN9i7emPN+14eoTUrS/FWO1qy8qOPctwcPaeb9rw8HHBBcmktKDKBvBLRmsqbcHD2vm/a8PDHYECoBmahAE1N+GWlSRUW4OHtfDt0dRCfNiE0OrRYsALECV5bg4e064RjFa5zM5wKg5NcVoKgZhGTTAoKQ0wKAEZQHEB+Zg+ttvjfT9RLJ1vWtaHAejjbbb07W3ve973vYsxErelSEQGHws5ykpYdS8DgjcWc54DCBBFlfiklnOc5ylDAI9aBigPB4eta1+CXpKHxXpEEMBfUuD4SfIgPRDEl9AHgcHDAW9abbeh8Jj8DohHFnOc5yoPTbfswBJQGGDi/FfCvCghgjfltvXxN64ZWGJZSSS8D4SYlBDB3T1rTcSSHxDq8pJLrbYjbbbbbbba8ECJe0kklEkkuJJJAeTAF9o5//EACERAAIDAAICAgMAAAAAAAAAAAABEBEhIDBAYCJwAkFQ/9oACAEDAQM/APUKHDMmuFFmRhZTlouXc0xjNjDOrIwt8LjC0OoVxnFXOzphhnVkYabNDG/xioTismpotGzsYfEzpydMmykYMtGDTinfDY0pGzsYfEztyLGhmGQ7LQmKNNLKZ+42dMMM5OHyyGo0wY1NToxmDi2MZsYZ63a8GvGz+whCFKEIXkIX1GxjH9iIQhCF6h//2Q==",k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBggGBQkIBwgKCQkKDRYODQwMDRoTFBAWHxwhIB8cHh4jJzIqIyUvJR4eKzssLzM1ODg4ISo9QTw2QTI3ODX/2wBDAQkKCg0LDRkODhk1JB4kNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTX/wgARCADIATUDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAMEAQIFBgf/xAAYAQEBAQEBAAAAAAAAAAAAAAAAAQIDBP/aAAwDAQACEAMQAAAA+1SR5kTNbWSAACzNyyjnVGRFlaxGgkLMSLzrLpWJCMslYFmJK51XY6MJWk+tQYzJHK6cPO9vKAAB6Lj6urjvmT530c6udXoo85XOFdHL0cdE+d7ezy85XRjnV6KPO0PRZdGPnm3ssPomSFVGp0kK9xS1zAAAvZ6WJpHF0gWEulIhoTRdJjjV05KJOQF0pUi6THGrpx2oQKGq6cNkAAAGTAUgAAAACFZMAAyYAAAKrcl57JmtpVBA0sGTUkUAYTUAAAAAAAAAwghnSVnZN11u/M9bCdLM9FzVrzEi1mb06FAjuYmQAAABgyAAADRBHOkrOybtcre6uiIa7/Nu5CSWFJ2tjNuSOSK4KAAAMEabG6gYTK4SNMAjnSwmybXXPu+tkKVa1POQklLBcwpYatNxzMVwUAAADRMmy4TU1SRcrhIkGJ1lZ2TZqC9LkCAC8SSTWy8688k7VybjSK4KAAAAABGmElUuhlMEM6Ts7Js1mdNalICeIdcSSTW68289TZehNiK4KAAAAABhAXIAIJuVnZNmk6VNJiEvZRa4kkala5znEglWwoAAAAAAAAAAgm5Wdkitp3XRlgJjmWdSYJuuy0mABOuQoAAAAAAAAAgm5U2ZAAAAAAAAAAAAAAAAAAgnTqcushkAApXGKBQAAAAAAQAIUJ5Z5oYABQttySRkAKILkAAFAAAAAIAAom8skowAChbbSSMgBQXMgKAUBQAQACAExSkAgwAChbbSSIa5VWpZSnU8YiKtl2BgLglMEZrFwjqBBsZCaismIzUklaunGxmNyhbbSSOLWlQrVqqSnOJyVdzVITEvTMm5y6tCJzz9l4mUaJGDJ0jQtpwTqG56TKSKFttJIzQQoqBkKAAUAAgAAJiFBYEKwBCqC20kjnV5zSIyV7evGkDl1MdSXU5NXIlLRxa3O/HIKtdWNEwSmxkyYTQhrJPEhZOvFBbaSRWqnSNTW29GSoSEZclwUqFyI6iNjQhLBuXJMG5isGEAwZjc5mlyLMULbaSRRqnXML5MuSgCcyXpRUJAcuurGSgdgzHM0lSqW4p1ZLqay4FmYkMGxcjn220kijXndNowWC+ca2gXI6BWOhHHtug49dSBQrv5ZTn1g59diOTXTTU6EaEZk3Ml+LkULbaSQFIyAFACMi0ICgEEwKABAFYgAAVNW1bpIgAZAAAgAAAAAKBSAYAAATKzb1//xAA3EAABBAIBAgMFBgUEAwAAAAAEAQIDBQAGFBEVEBITFjEzNEMHIDAyNUI2QEVHUCE3QVEkRlL/2gAIAQEAAQgAkkV71ZH6Ea+8hwgkaPn7nV53OrzudXnc6vO51edzq87nV4M4QuNXwceHOPDltc1FF6Xcl2GkQtg6lbTQBdeSFc1B9pPXii7TQG9OMm5a2oz50XctbQZk6x7TQSyixMt7moovS7kywrZRjCGRblrczJXx95qOx92z2qoPQ9bJ9hpBmI+aPaaCWYWNlvc1FF6XcitpoAuvJ9qaDunAywuaiqmkiNgsa0mnW0hXctbQVk695qOx92zjw5x4cSLyfChl9Rq9R16wMXw2P9PZ+Brn6fJ4/a3/AEnJ/wCKAs2r6+ab/uheZqv0Mg/hc3J/4XCwD9X1TPtd/pOAfwvuGVf6dcZ/Y7P/AF7L39OiwD9X1TPtc/pWbV9fP7n5v/6uflD/ALPy5P8AwsFn9jvuGzuHc10Y/wAtH4GhMPhSOX2cFz2cFz2cFz2cFz2cFz2cFz2cFwEJgEKxxeGxaoHs6wc12lAPPiKU/QK2y8/rVmqB1V8XawAaBW1vl9Fn2aVTAZRUX7NKl4MQqw6BWwkgTJsWqB7Oo/NioBoQLIVIPs0qhoSI2eygfsr2LPYCt4nGwvSQDYUjkh0CtgJAmTYtVD2dR+afoFbZef1vYCt773XLnVQ7smaYkSgGC1t1NGv2aVTwYxV9lQ/ZXsX3LX6WRTyJC1M5EmciTORJnIkzkSZyJM5EmciTOTLnJkzkyZyZM5MucmTOTJnJkzkyZyZM5MmcmXOTJnJkzkyZyZM5MucmTORJnIkzkSZyZc5EmciTORJnIkzkSZyJM5EmGyvf5PNH8Jvg1vnXPSXPSXPSXPSXPSXxazz4i9ZljT0lz0lz0lz0lxzFYn8o5eiYi4T+3I/hN8Ifz4cWgQjpXEWRRLlV6TyIvVK67lilRhPjD71yR3pG9U+5N7k/DcvRPwZP+sj92E/tyP4TfCH8+bE9VWCFPZ8vEoC1w2qnBia+WqlWWsgcvhD71w1iIiPyGRHwtXPN/qqYi9U6+E3uT8Jccq/uYrl+4i9U8HN64qKnjN/xkfwm+EX5sPRJ7oVnjbxpJVzJlKqdsY3xh964SzzwOwSTojmY97vOqKNK+RVRcm9yfhozqqqrU8qr4+fGu8uIvXwd08vjP7mdI/hN8IvzLk0fpnNe7wNajw5GvEZ5IlXxh965M/yQuXGPWN6OSV6PkVyA/nd4Te5Px5M6dPf4P/8AnGs6Y5n/AFMvRGosfwm+EfvyeL1oHx5BP6qKjsc/1yEjb4w+9ckYkjFarm+RytXGPdG7q2GX1Y+uTe5Px+mKmIn3SU/Lkfwm+DPfkszYG9XsakpMiyrHO5FSUeZkEkisReqdU8IfevgT0Uh3l8IZ1hV2Me98DVf/ACpP7cj+E3wISdYv/FhFPaWyaWRsczPK9sD3uVCZ1eo72wQCWY6IjE8GP8meqmeg/OO7OO7OO7GdUhRrv5Un9uR/Cb/hif24P8tH9+S4Cje5j+9gZ3sDO9gZ3sDO9gZ3sDO+AZ3sDO9gZ3sDO9g53wDO9gZ3sDO+AZ3wDO9gZ3sDO9gZ3sDO9gZ3sHO9gYMaOZ5vQ+9a/Swf5aP77ghnOVXcATOAJnAEzgC5wBM4AmcATOAJnAEzgCZwBc4AmcATOAJnAEzgCZwBM4AmKAJnAEzgCZwBM4AmRQRQdfSX71r9LB/lo/8ADWv0sH+Wj8Cy4QBJSSgNtDNNiGVb8FL6KpaNbQFHmiRrtQPZBrJKm+Ht3zxRhbCCfdFVkB+1AVp6iz22zhUxPoT2myB1XpeczZAhAxJ0k2UBlRBYMTZwOyLZLDs4ElSSc+rvhrRs/lr9iAsmGPGqtnCti+NCDtYB57BYa22gtHFJA+8FjMNGWHagJ6gewjsNpArD1GnttlDp50hnstkCrEg8xWyBDBCkMk2YBtPBYsTZgOyPslg2UGWrJOeFswRgxcq1WxC2074YgL4KzsShBAdrrzz2DRElwBR+cmeeIaF0s8UrJomyRZa/Swf5aPw3GvntNVLGED2NbKxFgFMASDeqqYd5y0Gz3UhSVzxNCqRrGjPNDitZoxKm7pErLSa+GJYVfgpfxzgWloimQTUZ4M88QhFFFrJZYwBVbrtCWQoJS65KalMTMOl5cM1iBCbG4VKWu6T7HBJrYxJGxV72sKmtNwAJgorZlKZcxlzjzLf7E9Fozq0WmUS/gIiO2EVL6KcCzsPOVDPRFVZBEIZFHBq5RcABQWu0pcyglya6WchgBNvRbMSLVEylXtvcj0D1M20owenAaFt1q2GsAnluaoUafWzBbt9iy51ksm3WxiGVVFi8+Wv0sH+Wj/w1r9LB/lo/DYWGS0BcdaBOtaBdjT6yUUEYT6uuyTj2dFLlUSR38Ml56Hxb/TcjZ6tCLoSAXagrF58DhtkOklFoSaups5bT7QmGRiofF9onlNgQ+L7RWsMOKJ9ewtk2qE9Lck6TdHlyUEJYewsfY7NV1b0sCz9No0eloYPoz2MBoRae4hcLT1jdnhPsD+cTdazral1ySUu5TVg9VsZl1cpC+fZTC7p9cy82UoO37dFd7EVSwhQsLvS6iggJwW7Lg12eyWkvCjxSz30F+XeWXWUTZTLa6YMtlspi3ElbHf7IVWnxhxWtdOfSjvXUiXF6uHJLlr9LB/lo/Cxrh7UCQMsXWgh4Co5KvWxKsh8zazVgaktJ4B9SAGPYQ0msgKsgzpVrIH27LFbTXBLUrkPk14GRRMrtYArFDUZayB1w2xV1ZA+5ZZLNqoE9spzrHVALMyQiaxqBrSt4U9tRj3Cwvmm1kCStFDZDrlfFTy1rqzWBK01CsM08AsqaVDNaBNAFESroBameaeKYMciWOSYoMc2L0ypoYyInRzRwRxDtgYKLCFAkIo4Y4rpHDsEgYS8ljhIHlMJcQGOUsazkiwGwOhKfEySJY3na2Eag/krq+CqAiEEy1+lg/wAtH4XdqykpyD5Ke7OOLSIv23LQGY95+xlQ3yVoBV/LW0iFn1ttZTWKiWU+5rDrPdUM3aOAmpihn2M7vpleDc7StAIBOeNctKvpgGJf177RgEMOzJLUWpqpsPUqkgxdh6F3kOe3zPZXuuGbCgWsxWqhbAw7VnW8Y26xF0wJ0NndgVDEU4i4CCAYWYftXohATgVmwzFnGBG1Gy2dwNATC/YfIZcwYLukJlKGdCdfkpbSV1TVWcpoL5jAb4CzMlHCZsFfLatAgKv68Q6MN1nfV9QnQw23CrRUnObcCdsYfNWWg1sMpAeWv0sH+Wj8LuIuannYBQ0pUGyMMgoNLgWGWS4v6OczbUNeVTEl62LGHWlXJtl5yoaCwbrAojhdPs4Jmq+zoZptqPLnMqJj0o2Zrusl1t1YwmVOuT0RbG1yaW2eru5Ci6uxHh100YSrsSYtjMJ9jrPz9EMorU+OjCaDQ2gA96A6fUD4n0cwZ+r+e1ktayy1llpOOc/Y6azsa6rZPQUpglsbNHQUE9ZCJypag1bLZZUn1E+JaSYM+uPAvLEsOj1maeiODvAKIgSCYAipoCKItkYA2rPqDvXpC9YVtnLZVFlrDDzYrCI7XO8CCrZVkJsAqssctfpZB8Bif4Y0dxT2tZJG5jlfH68X/PIhzkQ5yIc5EOciHORDnIhzkQ5yIc5EOciHORDnIhzkw5yYs5MOciHORDnIhzkRZyIc5EOciHORDnIhzkQ5yIc5EOciHORDnIhzkQ5yIc5EOciHEk8/+kUUSRNXr//EAE0QAAIBAwEDCAQICQsDBQAAAAECAwAEERITITEFFDJBUVJhkhAiotEgIzNCcYGTsRVAVFVjcpGhsiQwNVBTYrO0wcLDBlbwNEOCxPH/2gAIAQEACT8AOAOk3+gpA57W3n99IiKTjOjP3UyfZH3UyfZH3UyfZH3UyfZH3UyfZH3UyfZH3UyfZH3UkbqDjoYqKPy1FH5RTpBts6PiS2cceAPaKlQSvcNaqNi2+VSAV4drCp0TEzwfIOfXTGobh1ZFOkl3b6tomxI06Tg7yMcanR8zJB8g49d86RvXrwauUMSOqM3Nn4sCR83sU1coIpHZFbmz8VAJ+b2MKnQveY2A2DjXlind7wNOkG2zo+JLZxx4A0UMVi7pOdkfUZBlurfjwq6QrCmuQ83caVyF7vaRTpzH+12J72nhjPGp02ex2+dg/Q17PPDv7qlRVNul18i3yTHSG4dpFToXvMbAbB/XyxTs7wNOkG2zo+JLZxx4A1OiYmeD5Bz66Y1DcOrIqdOdbbYbPYP084xnGONOkTxwidxsicIW0Z3DvUUazCM+12R4Lx3Yz1GrpBE7sitzd+K4J+b/AHhTpzH+12J72nhjPGoo/LUUflo6D4cP2UMMNxFcWGo/Sd/o/tR9x/mP7U/cPT+m/wBlf9x3H8cNfni+/wCKv0/+MK/PFj/y1+WW/wDBNX5ZcfwQ1+j/AM1JX6b/AGV+WXv8Ffka/wCPFX/n8or80f8A3q/7ctv8dK/R/wCakr9N/sr88Xv/ABV+eP8Amr8zx/5pa/I7n73r8ruP4Ia/8/lHwDjWN/1V3B93oLBQ2rK1JN+0e6nm8w91STeYe6nm8w91PN+0e6pJvMPdTzeYe6ixUtqy3plnj5vq0bEgdLHHIPZU1zrivXvhvGNbFSRw4ZQVPdjVcS3J0OvTkxn5vD1RUs5nu9esORoGptRxgVPdnTcxXI1uvTjzj5vD1jVze6JZEkOXTOVDAfN7HNXF6IopHkGHTOWCg/N7EFT3eqwxssuvVIZPW9XtNSzx831aNiQOljjkHu1JMY+UpZZJTkZBkGDp3VcXuLmMRvl04ag/d7VFSz807+Rr6evsxxqe70c35t01zp2u17vHVU1yALKOy3MOgjBweHHIFT3eqwxssuvVIZPW9XtNSzx831adiQOljjkHu1PdjVcy3J0OvSkxn5vD1RU93t+c85xrXRr1au7wqWdGlthbMIyOgJNp2HfkU8xtzG8eoka8PnPV4mri92UUjyA60zlgoPzexBUs/Ne/ka+nr7McfgeNNgACmpqampqampqampqampqampqamp/3U1NTU1NTU1NTU1NTU1NTU1NR7a7B6SKIoiiKI+ADqrFYrFY/GOwenf1KO01MwHdU4FSv5qYyRn5x4r8Ht/HOwenryaMfmrZ+aipVjjK13cfsyPgceH4if5vsHp/9tt/08fT80ZrcVzn69/8AqPgdW+vpokdVesR+Jj4XYPT0GYEN2NgjH1gj0tpVhjNLo1nOnsHAfuA+B1CuqhgGuz8Z7B6d2oca9WRdzr2H3ejesZy58eofC6vQfxnsHp+odZ+itVvcMcp+rgfUfoqdVQcSi4J+vqqNhbMRiQcM4+7x/meBFdv4v2D0MqOTxbsqdJNJ4EngfqpSRTmSJegve/W7awHIwpPAVcx6R80kn/T4JFEURRFHOPxfsH9T9wfd8ObDKcEaW41P7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6p/Yb3VP7De6n16cZ3Eff8AD8a7g+74dvESd5JQVawfZiraDyCraDyCraHyCraDyCraDyCraDyCraDyCraDyCraDyCrWD7MVbQeQVbQeQVbQeQVbQeQVbQeQVbQeQVbQeQVbQeQVaw/ZirWH7MVbQeQVbQeQVGkeeOlcfD8a7g+7+pvGu4Pu9DiOGJdTseoVBeWrXAzA1xDoWX9U1JrunBYqm8JjvVr2ljoEpI3HUMjFLO8d0+iGJUzI7ZIwBUc8E9uRtYZ00uueFMTcWvT7Ow4rbZj0baVY8pDq6Os0s8jiPaybGPWIkzjU1CadpUMoWBNZ0Di58KE1zzzfBHAmp5BjOQKMk0dywSFIky7t3QO2jIIQ+zKFDtNecaNPeoywpaNonjlTDo3YRQmt5LbG2iuU0OmRkE1LmKybEkvzOGciluIpGj2sQmi0bVO8vaKFwDNqEErxERzaelpNawbSdreTV3144oPrsYRNKdO7SQTuou0FxMsC94MTjBoTkx6NtIkeUh1dHWaE0riPbOIU17OPhrbwoTXBuEMiLbprOgDJb6K2tyL35BIE1vJuzuFF5YrlgkKRrl3c5GkDtppBCjmNkKeuHBxo09tGWBLQkTpMml4z2EUJ7fmS65knj0uqkZBxSXEEyoJdE8eglDwYeFSbV7QDaOOhv7DW3G11CCV48Rz6eOg1MkKcMu2MmpEjjXi7tgCmDI4DKw6wfR413B93oGuY6WCd7SwOK5MuuBM7zxmMW/hvG81baUKTtK6Ju1EcSatbl0vhE0BhiLhyqEEbq5NuZgj6pTASJrbLMQ4FG/vrCCEG2e7jO1d+6OsioIJBDKXn2Otp3WU+trXHVVpPLLysYDalEJU46WT1Yq3nnHKPJwggaKMvmQZGmoJpoxyPzI7FC+JR9HbUExitIZY59CFzGXXduFW82m1vWnmjCEvGjlsHFW02k8t8/EOg6zFnu1ZXM0VxOHhh0aXdQMEgGoZ5uT7rT8bdoQ8hxhl38Vq2dLeaXQiKNOpSmPVp7uS35OtWjzcW2x2fUqf3jVpewzxGRLmG4Q7OBO1TwyfA1a32ZuUppUKWrsCpNQyFJeT1VDpOGOk1BKbW8e2kuYtJzDMuMtjqyKtZ5X5WEHNSkZKtp3HJ6sVBPOL7kvm0LRRl/jOGKt5pkTkk2bbJC+JABuOO2oJilkkyz6ELtGXG7cKtpsQcoG5ljCEukbFt5FW02H5Z5+sOj1zFnu1BNpvZIngR0Ks4TBJAq0uDCbeNI43TQ0rAZIGahuubXFsNubtCDHLn5NSeoCrbY2xggWPSmE4HNc+EHJ08jmKe30bBewv87PVUdvywHfVovCdpCM8EJyuBWw5RA4Wd7nQn6nV+0VFsW0DMfHRu4buz0eNdwfd/U3jXcH3ehS108eiPS2k792cmnubK+gtdeua6M64IOGWkuLcnkxbhbe4mMu1brkHZ9FXU8x5Vt5nuRJIWBYYIOKmuNlcXssZvDKxjuBv0oE6qugbeZrjZwRjAAWPr7TV3exXV/LltFwwSONANRC1Bcy2NtasXEV5sSW+8nAqadES2knALnLCMIcN21O5s59rHEmTpwiLvx9JNXYlV7F3SJBpRBtABV3tVeyd0iQaUQa8AeJq5mW4tOVltY0DnRsxgY08N9QXT8m20C/IXux7SzYFXhisviTpHTkJYcT2VNLFbSxyyuInKFiBu3ipZriae5MbwxyFHuVUsOlVzLHPz42jlzl7YFuBY8SB11yhPHtEYNayza9tj52/rHhV5dCcXMkcQjnKC2C8MAVNKGub7ZSujlDIAWFTTz2kljzoRSyFyjh8biamtuTEjffZyg84k82B+yng5F0PgS3gJeYdqA4X99CCwQ4xe3urZv8AqY3ZHiaVJjNGNXKE2RAD2nT20V5XeUnVcwjESDtOnO4VNFyzJkERWI9VPDrNXNtd6IspYWYOtSO3VvyaurW0RONgATP/APLVj9wqSDkgJKM29yDziUZ4DOBvpoORwDhbq8BO0/UHR/aaSG2VwMX15q2P0DT11dz38kUZbRayiEXLHryOocanNxLow7njkHGD9Ho8a7g+70JrhlG8UZ7o3i6JpLiQu7KMgDNSXFxKYhCGuJNehO4vhRncxqUiWWTUsKk5IUUZyIpDLFA0uYo3PWFrVtrLXssHvjBzWozpEYR2YJzUlxBKYti7QS6NondNRlVtIXhiQHdoZdJBoSZslkWPLd85Oa1c4WEwcd2knNaucJCYR2aSc1tsmRZnhEnxTyLwcr2008ZmCidIpdKzheGsUCsAK4CHGNJyKeeGWAkxzQPodcjBGew0JYEszmB4n0vGe0GommgnYvKZWJaRjv1E9tS3VzOqaI3uZjJs17FqW7thcHM8UE5RJT4itrbxWbBodg+goRRnmuJsB5p5TI5HZk1CjyQtqjZl3ofCoY5k46XXO+kWVG4q65BpFESroCdQUbsVEkMYJIRFwN+TUMcRlOpyi41HtNQos8g0vIF9ZgO01DGZo+jLp9YfXUKSmJw6FlyVYbwRUMc0bcUdcilV0IwVYZFbW0a1BWJ7V9mVU8V+ik0RRDd7z6PGu4PQhkWEA6F68nFcmiKN49cdxBMJovoJFcj/AMggmMUky3QJGGxnTgVycl25thc6nudluLY6wasjHcPIIo7aKUSa2PRAauSWtMprSWOTap9BONxqw1k3JgEIm8SM5xVoZvwmsbFtpgRBzgdW+uS0uTaBC7vdiPpDPAqas8G6fRKEl1bH93rVGNMduk4mD5DBvCpxPckkFYvW0YGfWI3CoMHk6WWLQZOno+rdmrb+lomlzr+S0oHxw31b/wBExJJnX8rqQvjhuqwO022y5ttvDVnOO7UGt5o42jgDb2Z8YXNQ9CF5Gh1cGXiuat8m5u0tZIjJviZquUiJ6KcXb6FG81OttE6hgJTpPbjFWbXXP5tjEsj7H7wasOaXNqgkIEwlUg+IAwa5GiW3nPTN6MgZwTjTVt/RcKy51/K5Qtjhuq33z3SWrxa/ki1WHPLiBA8xeXZpHngPEmrOSwkicpIkvAY6wetfGp+cGJdTug9QeGrhmpxPcNnIi9YJjvEbhU4e6kYIIY8uwyevHD66uVSQ9GIHU7fQo31cpbIwyA/SP1calFvbuMhp/U++izw6iodlK6vEZ6vR413B6EhknZdyTLlHHWprks8j2oiYTxbcOJW6sAdlWrmY3LyLGZiUxnKnSDiuRvwpac0EWnbpHh9eesiuTxydPYXS3MFq0oYEqSekM8cmrFbCySPBR3WR3fwK8BVt8dHykJ2TWvQ1k5qDWIOUYdgda7rZGc5/fXIH4UgmEQhPOETGFweJrk4QwWzsJ7cyKRHHoK4476BmsHgEEDlxkx93t3Ven8HEnXbTICR+q/GuT0a/mnne1bWOB6HXirXnE/JcRSW21hSdUYU4PDdVpzablSERw2+sMRpjKjJ4b6gGxPJnQ1r/AOp2GyxR5nBYwJJLN6j4mUYC6evFE3cF5E8kM3qpmV1IYac7qixpNtz+HWNzR/Pq7ayv3HrMUEiP9INTm25UgjCieIalB/VarePlSW3uddwsZEQdPrNcnfgqylttAtduJNcnf3cK/wCltd3C+TdC6j72Qcaqhyl9apHbnUPXIjYVFw5sL+HWNzR49erNr+25UiVJkjmEUkbKpXIJpJBFdza0hNwZHiUcBqq7F3yZJCYgjoEkXO4jUuMjFXueTd+u3lQFh4q48auzBFJIGmtpUDqwzvw3EVdmzvZTmTWokR/pB3irl7TlKNAomQB18rVMefWuSk8G4An+6cirhLmQMcSpHoyvVkdvo8a4qNJ+rd/UwzoGT9f/AOUNQPSWnCHsbcf31LH5qlj8wqWPzVLH5hUqeYVMnmFSx+YVLH5qlj8wqWPzCpU8wqWPzCpY/MKlj81TJ5hUsfmFSx+YVLH5qlj8wqVPMKlj8wqWPzVLH5hUsfmFSx+apU8wqVPMKlTzCpY/MKlj81Sx+YVLH5qlj81Sx+YVLH5qG0PaOH7aOWbeTX//xAAdEQEBAQADAQEBAQAAAAAAAAAREgEAECACUEAw/9oACAECAQECAHmZMzMzO4ucAAM6ADgHDpe/j/D77+es5vn59/Pfz/lm3d3d3u9ZtUtU5rS1WbStPgJmZmZmZmZmZmZkmZmZmZJmZkz8fO8yTfn8DOt588qs3fwM7zv559fgZ6zj/fn4+dn4ees/EVf5V6VV7VUmZmZmZmZmZmZmZkOKq+2qqqqqqqqqqqqqql/QzgcN6AAAAAAAAD1nN8bx/pX8zPWczhvsPAB0cDOZzfSq8VVVVVfa8fOcAAkzAAkAMwAOAAec6c3pVVVzVVXiqr4z8fPAAAHQAAdAAAABz//EAB4RAQEAAgIDAQEAAAAAAAAAAAEAESEQIEBgcDBQ/9oACAECAQM/AOMzMzMzY7OJ4ejmf4++2uN8b74nvnzSODuRHjkR6tm39DPTWZmZmZmZmZmZmZmZmfIZmZ/Bn5Zq19j/AP/EAB8RAAIBBQEBAQEAAAAAAAAAABESAQACEBNAMCADgP/aAAgBAwEBAgDF07dmzZs2bLbu79fD8e+63Tq1atWrVbb1xU3MzszMzOzM7u7u7u7MzMzMzMzNF04AAA+AAOa2pxHhH1PNbU4jwipqKOJ5rKnEeEVNRUzGJ5rKnFvhFTm3E81tTi3wipyYmea2pxb4RicxPNbU4iWZmbEZHRbUwAMAAAAAAAAAAAAAAAARFADE0zu7u7u7u7u7u7u7vEgAARH2iqqoiIiIiIiKqoqrEfzUAB2xj//EAB8RAQEBAAICAwEBAAAAAAAAAAABAiFQEEARIDASgP/aAAgBAwEDPwDxIiIiIj59/j8OPf8A6RERER8e7V8VVVVVVVVVVVVVVVVVVVVVVVfHPT89Pz03Dnp+en56fnp+enqr9b7VVV+kRPMRlllllllllllllllllllllllKiIiJ+MRlERERERERGUZRERE/0d//2Q==",E=e=>{switch(e){case"front":case"capturing":return`url(${C})`;case"pdf":case"back":return`url(${I})`;case"barcode":return"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAA2CAYAAABjhwHjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAelSURBVHgB5VpLVttIFK2SfU6TUdwriFhBs4OIBQTwCkImOaR7EFgBsALCoEO6J5gVGJPMo+zArCDqFQRmDLDU95XqyU+lkiwLnO6T3HNsWfV/9XmfW9Zn43Gke73PqiMypV692doanU0mR1rrQ2+Z2WzzzXAYo8wIZV4iabS3tfUKfYfo+6sts44yCdcRZbuNC+0F6gdG33m/xOdmcTU1wGdnUSFaMXquKTWlZy9N382wavgZfri6+qyzbJDZsljBc6ShUvZub3t74jQ1Ui2A9jYyrTf4ve8M5pS2z6JG7HZaKJzb1uvhcGrr7+IRYSAyOzJj0PrCbYe2sGoBczSU8gvHoFmtqT9FRweqGUmWZaUBvh+Pd9DpIEX9P6yAFWTZKVbxBqvrzT/7+DHCyhzW1PWttl84ZWexI5I329tHMiHo9d5Sm0GWHSu7RSvjw5aVCqWC+/tQ9XqRt65ntQl1wq0E0H7PSDurIAjxGsu8tXZnfSl8V+GAXZzVXZWbgk21YnxX4ehM4dzcqDS9dfNISdGTVvDVcPgoq/howtlzdkTbDgrJaHisjrbPhaukg+Az9m14B6dAtVT9i/BTGXEDnvEuMG7WeLxOvz9MJl9LmUHwbu/Fi9P3V1c70JwnMgvaklYsqVMsaHekllzRlZw5VunYnqFMhwC/0lPPZgOo9dCpljSagg4oC9frjTHbj66S64DtcZPOZsYpgBY9JPcLXtKF69lUdkANYO8G8r3vdDZQToFVgrSn3W4kwCEpFEzwl0pBSm8B9yz1ezR7jkFdCrNZ0pA7cjofGL8yCKJKyTSdQLCnoj16xqoj6Ox2Vhxd4InREiivdbUi9M/H48FdHsIQQvqi1ZyRE4v02TwvoS8+9Gx0GWx8nfaUrAPBvsHJTYoMrRO3nSbUKRzZpyzTR+KGG4mnKt+//BSgimam2ehyxl3uFB/52oMAJhK3EcWBSC8i8Zbw7jT0uUPxoBwf4Yc24mYm7NYIO3EpWbYD+3UtfULeagU/wj6lNeJc1eFQyEVLEB6dZOUoP0aeCVbNbvENQalrKKR9+l3alpyAjlQXQLBb9ywII27e2cSwEa+BMeJQOre6HKHXOgUMTYrJcx4LO4d9e/OkKK33s/v7awoys0VcifU0/vr06SUGv6s80XpG5zFNk7QmUG0C0QYNzMAlVnUS1LhshXAH2FI80ySYpeJ23VmsAzyNdZSN/Jlp3Iab8SHLtWDkzcuya3YCfCiEO4E65d84By8hWISfv8nCxl0C1yHTPJxHSESNasCf4/FGEASGVynaDoL9s9z1M33ijE6x0sSLhMI2jqxUt3SOadKa+imEWyvbJu+KGXfJ4Uc8COvIWUZA5sIto/Vb2SP8xCnIXhMfYusb4dqyYAw24kSHhZVcMrgwtCIlMZ2pnIsk7fg3VkEY+thpIZIvrJUdDiVSPmB16NHGPRQylOhErxEv2tf6mKhyOThW3Xc4Y4o6hurWxEFCabgRN0fkBYLgSNDpm01GPLNKwnKdjZH8T2PEacIKOysvQjgCN/ETXKvikgOevJ2ZTuCLEN9AlnG/ivHlpiESWTHvGt4tP/xFSGnlCo/dOsTsNlGEqx1PfxngPE5x1iqG1lyEiIsLW/gUzsAlv8KR2MA4mG+J7bg25HjQ/gRa3DgbcuXKNIMT8bLb9NCgT7sC8KB85oZMgNjC5BZi8vk1suNy2/+mPCBtOV2zjmmBXAPKmfkCgzkqNTg/gyPk/wMj/A2ezS2eG2SzTD1uN1f9istQJP6Qi0UX6N/rs/YPck9+JBMtnzH3HrT+uue4OVj+cyvAhTPTtM2NcHWukXHSrWF+DGB8T33pfmqP+QyuHASxp9TIfGMVSOuJ66mE8+w9XBU+DoX7Uuq5jFCCfv8ZVqbUJznzZmexkwEfs6ath4HVMhlx1zWrGPEHwjUFTX0ahSJdl87ADNJ58qV7i/u0b03ZNvDxNoRG96sNjKHf3h758nDb6WW2zHZ1nAKo/82ujLPjfhX4iS5CbAS+qBIFkDCufOpPjHadtxG7oYk5I1kWFvU9rDbxI2hnnuDwLaYdS6tT/1JZIEK5hCMf29eQvmgXlP/NYCNwtQCSa/RQ8GGlAgkmHASvFnMcCC/fYsu49S0xxR5Qwul1/2ao03Jxl+veNE0PaBJ0btsiTpcXIa7j0MXdIzbhCdqh37+g3e9ybfz7cGh8RaIuZITvuQiZC1RjmJtg2YRd+g0lc7wK4QoOhW0QLhv3yUlW+X9Uju1WNoPnstnch42pXJPjUBjxBViJcIIfOaIv3KK+lfEhF/TFcyhzIctIsKKy/GWkFuDhwlV5lgLMtxSrAsXCaRahqgHzLcShvK7715FFiQcSzsCDhXN5FglXMZkVxQ2qaoMgIAbu0JJDrTkUeSVWJ1zsTa1xUP+vKEXidVyHC+9ZWc5xrvyZdBm04WSqkTh4/5aXgW3K/OdwL/zP1TykXwoUWWOlntdkuhcrEV9u8B9OofrPjQfCHEp+5hoDWnH5kncj/pxKeEzHOVS5epYfA3brUssii7IhpcstJjiURC1AmhPDEX9cssnPoSwDy48sQEJfdkWSoqpgxFKtT2nmi4sVXHJkQdDYXlMZugz9Fw80H/TWFQSXAAAAAElFTkSuQmCC)";case"face":return"url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBggGBQkIBwgKCQkKDRYODQwMDRoTFBAWHxwhIB8cHh4jJzIqIyUvJR4eKzssLzM1ODg4ISo9QTw2QTI3ODX/2wBDAQkKCg0LDRkODhk1JB4kNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTX/wgARCADtASwDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAUGAgMEAQf/xAAZAQEAAwEBAAAAAAAAAAAAAAAAAQIDBAX/2gAMAwEAAhADEAAAAPuIAAAPD1FT04422IAAAAAAGa10y798WAAAAAAAAHhpVpO3B5NUAAAAAAAJunTY6dQAAAAAAAAENbCtacYAAAAAAAS21veMu/1IAAAAAAAAq+nHE2wAAAAAAAAFyy9Dsi4AAAAAAAHhTdfP5JoTL03wmNSuB4jw8PTNOadidsW1oitOdAWjPtlq7AAAAAAAAeIou3n4K9VdLhj6CZQCYBIQCSHiKdv5/POYsWfXOV6AAAAAAAAPEULXz01ns+ucz6gAAAAAILTkgtOUT9Oqfp0gAAAAAAAEUTXz8Ji3Y9/ZXUAAAAAJcU5VLbzxP06p+nSAAAAAAAB4ika8GqYvGHo+xYAAAAADFWkdHm+IsVOucp0AAAAAAAAcs0qOvFlE3LD0QAAAAAARTd/P55zsFOqep0gAAAAAAAVDTi9MS2Y9xIAAAAAAqm3n8Fs+6uttz7M0gAAAAAACnacU3ToiL89px7wAAAAAAKvtw6FZCus5G2+LgAAAAAACpacdly661ryWnHuAAAAAAArG3D3115prY69GUSAAAAAAAK5flk6bxN8LFl2AAAAAAAVfXisufXX9OSz06wAAAAAAAOSc4G2E9n1b4uAAAAAABw2yxRotSbpukAAAAAAABAX59MRPU6c4sAAAAAAIu+EZbG0U6s0gAAAAAAAAQtsETLU6AAAAAAlirXdOWy06c0gAAAAAAAADWitX5rLl2AAAAAARl8NxIxqAAAAAAAAAB5Cra8ljy684kkAAAACua8dlp1ZAAAAAAAAAAAjrZRbOw59YAAAAHFbHhtlP16QAAAAAAAAAABX782cWmc+hJEgAActsoDTmtWfXmkAAAAAAAAAAACpacXbXWcz6SQABxXyq2nFcc+3pi4AAAAAAAAAAAAq1+Tsi/HNbDn1bFkARD6c8fOe2Znab9UXAAAAAAAAAAAAFWvyWXLs47ZwOnN3V07q66LUipxkI1mqbw18OyLSMagAAAAAAAAAAeHiIG/NoLHn2IEcF8uKabomTptmslHWwhr89jp09VdPZAAAAAAAAAAc80rN+WTrrF2yl6bylOgBMIAnmtnXNOSUrrHWzlq6y9dwAAAAAAAABG2yg7YWSnT1RfEr2nLrhYc+vKJBAib4RN8LLTq64viV+/NrmLJn05JAAAAAAA8RyzXjnOHvjMU2l67gCMtjBWxsWfT1V0wRXdeTatYqdHqfQYIpevBL127Y07q6bFvQAAADBEZbKLtjH2y1oIHRGl0y7skgDRNazfl7I0j5ynq7yddgAIG/PX78gBPZW8nG0vXboi4AAjJyrOvHqmqJBAAs+XbLxsACMSn6cVnp19cXAA8KNt5+tUgEgCap02OnR6kf/xAA+EAACAQIDBAQMBAYCAwAAAAABAgMEBQARMQYSIUETQFFxEBQgIjAyQlJhgaHBFSORsVRiY3KS0SSCwuHx/9oACAEBAAE/APRX6r8YuBQerD5o7+fUIZngmWWM5MpzGKKqWspUmTRh1Srn8VpJJT7Ck4Zi7EsSSeo7NVZSZ6ZtH85e/n1TaWfcokiGsjfQdSpJ/FquKUewwOAcxn1PaSbfuCx8kTqdpm6a1wNz3cv04dTusnSXSoPY+X6cPDS7PPPRCRpOjkbiBlyw2ztYunRv3Ng2KvGkAPcwx+DV38O36jH4RW/w74Nqrf4d8fhlZ/DS/wCOBaq06U74Fkrm0gPzYYFhruca/NhhdnKw84l+eE2Zm9ueMdwJxcLE1JT9LG5lA9cEeRs0+9bCPccjqc779RI3vMT4LZS+N3COM8V1buHpSAwIYAg4uFL4nWyxcgc17vDssfyJx/MOpcvDszBkks55+YvptpqfhDOP7D+48Oy2lR3r9+pzjKpl/uPgs8PQ2qEe8N79ePprxD01qmGpUbw+Xh2W0qe9fv1OuXcr517JG/c4Vd9gBzOWEQJGqjRRl6Z0EkbIdGGWGUoxU8jl4Nl0yp537WA6lXV8Vvh35e4KNTisqBVVckwXd3znli3J0lxgXtkHULinR3KoX+ofBs3WQrCaYnKUsW7+pXupNTc5B7MZ3AMXS3eIxU3ayZP34si713h+Z+h6hfFyu83xyP08FdTtbK2IpwYIr/PniJxLCrjRgD1Fk3r+VPOp/wDLF/g6W2FucbBvtiwcbsnwU/t1DaDhdT/YMWmn8ZuMSkcFO83cMbTj82A/A4oBlb4B/TX9uo3P/i3537HV/vieIVFLJHydSMWLzLwgOuTD6dQ2h43Q/BBjZyk3KZ6htZOA7hjaNukroYhqF/c4iQRxqo9kZdR2ngyminGhG6cWio8ZtsTalRun5YEfiu1I7GfMf9h1C8Iai+tEmpKriCJYIUjTRABiM/iW0u8OKK+fyXqVzoxW0Lxe1qvfixV3ilUYJfNSQ5ceTYkooJqpJ3TORPVPUEtSJdGrC5YnRew4vVeKSjKKcpZOC93bjZqj6KB6hxxk4L3dTvlnLM1VTjP31H74t+0BiQR1YZwNHGvzxBMlRCssZzRhmPT11+hpXeONGkkU5dgxRUk96rDNOTuZ+c32GERY0CKMgBkOqX22w+JyVEcYWRSCSMbNz9JQNHzjb6H00sohheRtEUnFloEuM001SN4A/qTiONIkCIoVRoB1WeIT08kTaOpU4sMppro0D+2CvzHpr/UdDbig1lOXyxYqfxe1pnrJ556veYmobwJk9oiRe/EE61ECSpxVxn6W5P8AiV7jpkOaqd3/AHhVCKFUZADq97oDW0R3BnJHxX/WLBcehbxWY5Kx8z4Hs9JdbiKCm4cZX9QffGzdISz1cnPgn3PWb7aOLVdOPjIv3xZrx02VPUn8z2HPtf8Av0VwuEdBBvPxY+qvbijpp71XmSUnc9tuz4DEUSxRKkYyVRkB1q+0sdJXgQjIOu+Ri03veAgqzx0WQ/f0FxukVvT35TomKiolqpjLMxZji3xRw0MQiGSlQet3z8+9iMfypi52ISgy0gCvzTke7FuvMtC3Q1QZoxw4+smIJ46mIPC4dfJuN/SLOOkyd/f5DFBa57nKZpmIjJ4udW7sX+ljphTLCoVMiMWxt+2U5/pr1uP/AJe1HdKT/j/88Ffa4K9c3G7Jyca4lpa2zyl0LBffTT54pdpBpVRd7J/rC3ugYZ9P9DifaKmjGUIaU/oMTV9bdpDEgJX3E0+eLfs8seUlZ559zl88AZDIY2mTOmhbscjFhfftEXwzH16y7rEhd2CqNScVe0hE+VKgaMalueNnIzJXyynVU+p8OoIOKmyUdTx3DG3anDDbMJnwqSB/ZiHZymQ5yM8v0GIYI6dN2FFRexfDf4uktLnmjBsUF5loKfoo1VvP3iW7OzFBc4bhHnGcnGqHUdXrK6GhiLzNl2DmcVVdVXioEUand9mMffFLs3EtMRUktIw1Hs92KqhqrPOJEY7vKRfvi23xKvKKfKOb6N6Ctr4aCLelbzjovM4qq2pu04QAkZ+bGuKLZyNYSas7zsNBoMVttqLTMJYmJQHhINR34td9SpyiqMkl5Hk3VbpeEt43FG/MRwGKelq71Ul3Ykc3Og+AxQ2+Ggi3IhxOrHU+B0WRCrgMp1Bxc9n2jzlowWXnH/rFtvj0xEVVm0em97S4ilSaMPEwdToR5NyviU2cdNlJJ73JcUtDVXacuScifOkbFDboKCPKIecdWOp8DIHQqwBB1BxdLAUzmoxmNTF/rFsvr0xENXmyaBua4Vg6hgeB6gSBiW6UcHrzp3A5/tiXaWlT1Ed8XS5i5FD0G4y897PhjZ2sE1GYTweL9vJuVlirQXjyjm97t78RT1dlqihHeh0bFDcYa+POM5ONUOo8E00dPEZJXCKOZxcr3JVkxU+aRfVsWywNLlLWAqnJOZ78RxpEgSNQqjQDyJJFijZ3OSqMycT1XT17VBVTm+YU4h2o5TU/+JxDtDRS+szRn+YYhqoagflSo/8Aa2fo5JUiQtIyqBzY5Yqdo6WHMRBpj8OAxPtFVy8I92IfDicTVE1Rxlld+8+Rb6s0Vako0BybuxG6yIHQ5qRmD5NVRxVkJSZQRyPMYrbZUWqXpYmYoDwkHLvxTbSZUx8YQtKuhXRsPLV3iqA4seSj1VxbLJFRZPJlJN28h3eVtJW5IKVNW4v3eQDkcxiC71lP6sxYdjccUu0+gqYfmmKavp6wfkShvhz8u83J7fEOiUEtzOKiqmqZM55Gc+g2bneWhZG0jbIeUQGBBGYxdUihuLpFHuKNQDi2QwxUKGGMIGGZ5nymOSk9gxUTtU1EksnrMSfLDFWzUkEHgRi03qpNTHTykSK3DM6jyP/EACARAAIBBAMBAQEAAAAAAAAAAAABAhESMUAQIDBBIVD/2gAIAQIBAT8A8o6L1VoyWpH+NHTemuXIuLkXIqiqKoqi5FyLi4UuktNcMfohPmWrP2hzLVl7R5lpoY/dcS0kq8PQjxLSiJ1JY0I41PhHJLGhEkQHorBhjxoQwSI40okj5oRxxhaSJKpWmhUih6aY4j91ExqxZL2Q9ZDx7RHroa9V+LYiyS9IoeymSj5JGNuLqNeCQkPbWBSHGvXIojdCLqPbeOFIqmOBaxRKJDlxAe0okuUy4vLukBoa10ilByMjj4KIlQuE6jWqlUwN8pjXZRMDfKY1pULRKhLqmZGqcqNBvqhItKetoo9X2ToJ1LDA32iutC0p3Ql4Puh914NdP//EACURAAICAQIHAQEBAQAAAAAAAAECAAMRIUAQEhMgMDEyQSJRQv/aAAgBAwEBPwDxWtk7BTg5inI2jHAh1Oxpb82lx02SHBg2dx2QlZyuzs98VpyIaCJ0mnSadNp02nTadNp0mnRadFp0DHpwOyn1sj6je+FYyYPIRkSwYPGj1sjD74UDzXj940bNvfCsYXzWjK8aNm/uL7i+vM0I14UetkzcsY5Mr+tg/wBcKm2Vhy2I6YEq+thb9Qe4RymA5Gx/7loysq+thd9SsZaXRPWxbR4dVlX1sLvqULjWW/UGxuH7KjlZjFmwcZeKMCfT7J1yJU3KcGcoJzsAn9ZlrYGBKlxs7K/0RLce4CCPO9uIqlzAMbSxNMyg5HmY4EReY5gGNqwyMSo4bHmtOBKhgbd/5bMU5Hlc8zY3Fi5EqfBx5LH5ZUv/AFubK/0Sqz8PiZwsUFzAMbq0YMqt/DB3vZywsWMQADd2avHq0yIlhXQwMD2vb+CKhc5MtULE9bsavBHrDTlZIt3+zqrDcIWZ4lP+z1L5V87knEa6U6njiGoGdAQUiBQONw0iWcsVw23ZgsLF/UWnSFWQyu3PgdwsLF4tWmsZCnqJZnau/LADZFQLxerGoiWkaGAg9r249QKXOsVAvF6seolmNDsciF1ENwEdw0pbPa9YaAtWdYtgbgzYj2FtBEq/TAMdhOBCf6zBdBaDAwPjJAjWgRrjCxPZW2DAc9rKGhQp6i3aTLOYleO65vzszBYRFu/2Bwe92IhcnwVHI73ABiAAd7nJ78kRHPZ//9k=)";case"mrz":case"pass":return`url(${k})`;default:return"url()"}};function N(e){e.preventDefault(),e.stopPropagation()}const B=class{constructor(t,n,r,a,s,o){this.onsubmit=r,this.onHandle=a,this.states=["success","error","warning"],this.types=Object.keys(e.Z),this.translation=(0,A.i0)("errorCodes"),this.dropArea=document.getElementById(t),this.dropAreaBackground=this.dropArea.querySelector(".uploader__background"),this.fileInput=document.getElementById("vc-upload-drop-file"),this.stepName=document.getElementById("vc-uploader-drop-step-name"),this.errorTextEl=document.getElementById("vc-uploader-error-text"),this.pressToUpdate=document.getElementById("vc-uploader-press-to-update"),this.textFront=document.getElementById("uploader-text-front"),this.textBack=document.getElementById("uploader-text-back"),this.textFace=document.getElementById("uploader-text-face"),this.textPdf=document.getElementById("uploader-text-pdf"),this.textMrz=document.getElementById("uploader-text-mrz"),this.textFrontBack=document.getElementById("uploader-text-front-back"),this.textPass=document.getElementById("uploader-text-pass"),this.textFacePosition=document.getElementById("uploader-text-face-postion"),this.fileInput.onchange=this.handleFiles.bind(this),this.dropArea.ondrop=this.handleDrop.bind(this),this.moduleController=s,this.addedFileTypes=o,this.changeType(n),["dragenter","dragover","dragleave","drop"].forEach((e=>{this.dropArea.addEventListener(e,N,!1),document.body.addEventListener(e,N,!1)})),["dragenter","dragover"].forEach((e=>{this.dropArea.addEventListener(e,this.highlight.bind(this),!1)})),["dragleave","drop"].forEach((e=>{this.dropArea.addEventListener(e,this.unhighlight.bind(this),!1)})),this.setText()}checkType(e){let t=e;if(-1!==["bmp","gif","jpg","png","tif",...this.addedFileTypes].indexOf(e))this.dropArea.classList.remove("uploader__error"),this.dropArea.classList.add("uploader__success");else{let e="fileType";this.addedFileTypes.includes("heic")&&(e="fileTypeHeic"),this.showError(e),t=!1}return t}handleFiles(e){this.onHandle();const{files:t}=e.target;if(t&&t.length>0){const e=t[0];S(e).then((t=>{const n=this.checkType(t.ext);if(n)if("heic"===n){const t=new FileReader;t.onload=e=>{const t="heic";this.moduleController.isExist("module","heic")?this.moduleController.execute("module","heic","convert",e).then((e=>{e&&e.imageDataArr&&e.imageDataArr[0]?this.onsubmit({data:e.imageDataArr[0],err:!1}):(this.showError(t),this.onsubmit({data:null,err:!0}))})).catch((()=>{this.showError(t),this.onsubmit({data:null,err:!0})})):this.showError("disableStepFileUpload")},t.readAsArrayBuffer(e)}else{const t=new FileReader;t.readAsDataURL(e),t.onloadend=()=>{this.onsubmit({data:t.result,err:!1})}}else this.onsubmit({data:null,err:!0})})).catch((()=>{this.onsubmit({data:null,err:!0})}))}else this.onsubmit({data:null,err:!0});this.resetInput()}setText(){const e=(0,A.i0)("uploaderDescription");Object.keys(e).forEach((t=>{this[t]&&(this[t].innerHTML=e[t])}))}showError(e){this.clearStates(),e in this.translation?this.errorTextEl.innerHTML=this.translation[e]:this.errorTextEl.innerHTML=e,"disableStepFileUpload"===e?this.pressToUpdate.classList.add("uploader__press-update--disabled"):this.pressToUpdate.classList.remove("uploader__press-update--disabled"),this.dropArea.classList.add("uploader__error")}clearStates(){this.states.forEach((e=>{this.dropArea.classList.remove(`uploader__${e}`)}))}resetInput(){this.fileInput.type="text",this.fileInput.type="file"}highlight(){this.dropArea.classList.add("uploader__highlight")}unhighlight(){this.dropArea.classList.remove("uploader__highlight")}handleDrop(e){const t=e.dataTransfer;t&&this.handleFiles({target:{files:t.files}})}changeType(e,t){this.types.forEach((e=>{this.dropArea.classList.remove(`uploader__${e}`)})),this.clearStates();const n=t&&1===t?"pdf":"mrz";this.dropArea.classList.add(`uploader__${"back"===e.type?n:e.type}`),this.dropAreaBackground.style.backgroundImage=E("back"===e.type?n:e.type),e.img&&(this.dropArea.classList.remove("uploader__error"),this.dropArea.classList.add("uploader__success")),this.stepName.innerHTML=e.name||"",e.errorCode&&this.showError(e.errorCode)}transition(){this.dropArea.classList.add("transition"),setTimeout((()=>this.dropArea.classList.remove("transition")),150)}setDisabled(e){!0===e?this.fileInput.setAttribute("disabled","disabled"):this.fileInput.removeAttribute("disabled")}},R={checkIsTouchScreen:()=>"ontouchstart"in document.documentElement,prepareCameraErr(e){const t={};return e&&["code","message","name"].forEach((n=>{e&&e[n]&&void 0!==e[n]&&(t[n]=e[n])})),t},formDataForSubmit(e,t,n={}){const r={...n,steps:e,documentType:t.type};return t.config.isSubmitMetaData&&t.metaData&&t.loggerController&&(t.metaData.logs=t.loggerController.prepareDataForSubmit(),r.metaData=t.metaData.prepareMetaDataForSubmit(e)),r},imageToImageData(e){const t=document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});return t.height=e.height,t.width=e.width,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height)},async base64ToImageData(e){return new Promise((t=>{const n=new Image;n.onload=async()=>{t(this.imageToImageData(n))},n.src=e}))}};var D=a(2328),M=a(4155),O=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,s=t.length;a<s;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))},P=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},$=function(e){this.version=e,this.type="node",this.name="node",this.os=M.platform},F=function(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"},_=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},L=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},V=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,U=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],G=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function W(e){return e?H(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new L:"undefined"!=typeof navigator?H(navigator.userAgent):void 0!==M&&M.version?new $(M.version.slice(1)):null}function z(e){return""!==e&&U.reduce((function(t,n){var r=n[0],a=n[1];if(t)return t;var s=a.exec(e);return!!s&&[r,s]}),!1)}function H(e){var t=z(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new _;var a=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);a?a.length<3&&(a=O(O([],a,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(3-a.length),!0)):a=[];var s=a.join("."),o=function(e){for(var t=0,n=G.length;t<n;t++){var r=G[t],a=r[0];if(r[1].exec(e))return a}return null}(e),i=V.exec(e);return i&&i[1]?new F(n,s,o,i[1]):new P(n,s,o)}var Z=a(2437),j=a.n(Z);const X=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,K=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,q=()=>{const{userAgent:e}=navigator,t=window.matchMedia("(any-pointer: coarse)"),n=navigator.maxTouchPoints>0,r=()=>window.PointerEvent&&n;return{isMobileUserAgent:()=>X.test(e)||K.test(e.substring(0,4))||["iPad Simulator","iPhone Simulator","iPad","iPhone"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,isTouchable:r,isTouchScreen:()=>t.matches,isSurface:()=>-1!==e.indexOf("Windows")&&r()}},Q=()=>{const e=q(),t=e.isMobileUserAgent(),n=e.isTouchable(),r=e.isTouchScreen(),a=e.isSurface();return t&&n&&r||a};var Y=a(5226);const J=e=>{(e=>{if(e&&(h.Z.config.language=e),!h.Z.config.language){const e=navigator.language.slice(0,2);h.Z.config.language=A.J3.includes(e)?e:A.J3[0]}})(e),(0,A._2)(h.Z.config.language),D.Z.initGeneralText(),(0,Y.Z)(D.Z.selectDocumentType)},ee=new(j())(window.navigator.userAgent);let te=null;const ne=()=>{h.Z.browser=W(),h.Z.browserMajorVersion=+h.Z.browser.version.split(".")[0],h.Z.isMobile=Q()},re=()=>{const{types:e}=h.Z.config;if(1===e.length){const n=t.Z.names().indexOf(e[0]);h.Z.type=t.Z.ids()[n],D.Z.selectDocumentType.selectedType=h.Z.type}},ae=()=>{ne()},se=()=>{(()=>{const{config:{realFaceMode:e}}=h.Z;switch(e){case"all":h.Z.isRealFaceAvailable=!0;break;case"auto":h.Z.isRealFaceAvailable=ee.is("iPhone");break;default:h.Z.isRealFaceAvailable=!1}})(),D.Z.initTypeSelect(),J()},oe=()=>{if("boolean"==typeof te)return te;const e=r.find((e=>"h_stepMode"===e.name))?.defaultValue;return te=h.Z.config.types.map((e=>h.Z.config.documentTypes[e])).map((e=>e)).flat().filter(Boolean).map((({mode:t})=>{const n=t&&"video"in t?t.video:e.video,r=t&&"uploader"in t?t.uploader:e.uploader;return n&&!r})).some(Boolean),te},ie=ne,le=()=>{te=null};var ue,ce,de=a(4211);!function(e){e.Back="environment",e.Front="user"}(ue||(ue={})),function(e){e.MediaDevicesNotSupported="MediaDevicesNotSupported",e.CameraNotFound="CameraNotFound",e.CameraNotAllowed="CameraNotAllowed",e.CameraInUse="CameraInUse",e.CameraNotAvailable="CameraNotAvailable"}(ce||(ce={}));class pe extends Error{constructor(e,...t){super(...t),this.reason=e,this.name="CameraError"}}const he=e=>{const t=(0,A.i0)("errorCodes");(e=>{const t=document.getElementById("VC-browser-compatibility");t.classList.add("browser-not-compability--enable"),t.textContent=e})(e.reason in t?t[e.reason]:t.default),console.log(`${e.name}: ${e.message}`)},fe=[],me=e=>{e.getTracks().forEach((t=>{t.stop(),e.removeTrack(t)}))},ge=e=>{let t=ce.CameraInUse;switch(e.name){case"NotFoundError":case"OverconstrainedError":t=ce.CameraNotFound;break;case"NotAllowedError":case"SecurityError":t=ce.CameraNotAllowed;break;case"AbortError":case"NotReadableError":t=ce.CameraNotAvailable;break;default:throw e}return new pe(t)},ye=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"],be=async()=>{try{let e=await navigator.mediaDevices.enumerateDevices();if(e.filter((({kind:e})=>"videoinput"===e.toLowerCase()||"video"===e.toLowerCase())).every((({label:e})=>""===e))){const t=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});e=await navigator.mediaDevices.enumerateDevices(),me(t)}return e.filter((({kind:e})=>"videoinput"===e.toLowerCase()||"video"===e.toLowerCase())).forEach((e=>{const t=e.label||"";e.cameraType=(e=>{const t=e.toLowerCase();return ye.some((e=>t.includes(e)))})(t)?ue.Back:ue.Front,t&&fe.push(e)})),fe}catch(e){return ge(e)}},xe=async({cameraType:e,defaultConstraints:t})=>{try{const n=await(async e=>{if(fe.length||await be(),!fe.length)return!1;let t=fe.filter((({cameraType:t})=>t===e));t.length||(t=fe),t=t.sort(((e,t)=>e.label.localeCompare(t.label)));{let e=0;const n=t.map((({label:e})=>{const t=e.match(/\b([0-9]+)MP?\b/i);return null!==t?parseInt(t[1],10):NaN}));return n.some(Number.isNaN)||(e=n.lastIndexOf(Math.max(...n))),t[e]}})(e);if(!n)return new pe(ce.CameraNotFound);const r=JSON.parse(JSON.stringify(t));return""===n.deviceId?r.video.facingMode={ideal:e===ue.Back?"environment":"user"}:r.video.deviceId={exact:n.deviceId},await navigator.mediaDevices.getUserMedia(r)}catch(e){return ge(e)}},ve=1920,we=1080,Te={audio:!1,video:{width:{min:1280,ideal:ve,max:1920},height:{min:720,ideal:we,max:1080}}};var Se=a(6245);const Ae="camera",Ce={};let Ie=!1;const ke=()=>{h.Z.track&&(h.Z.track.stop(),h.Z.track=null),h.Z.stream&&(me(h.Z.stream),h.Z.stream&&(h.Z.stream=null)),D.Z.video.srcObject=null},Ee=e=>{h.Z.isVideoCapture=e,D.Z.toggleUploaderWrap(),D.Z.updateVideoWrap(),D.Z.updateBtnsWrap(),D.Z.updateContinueBtn(),D.Z.updateSubmitBtn(),D.Z.updateRetakeButton()},Ne=async()=>{Ie||(de.Z.isExist("module","pdf")&&de.Z.execute("module","pdf","allocate"),D.Z.msBtn.setState("video"),Ee(!1),D.Z.msBtn.setLoading(!1),D.Z.msBtn.setLoading(!0),D.Z.msBtn.setEnabled(!!h.Z.stream),D.Z.msBtn.setLoading(!1),(0,Se.ud)(Ae),Ie=!0)},Be=async e=>{await Ne(),(0,Se.ud)(Ae),D.Z.msBtn.setEnabled(!1);const t=e.message;throw new Error(t)},Re=e=>{(0,Se.ud)(Ae),Ee(!1),D.Z.msBtn.setEnabled(!1),console.log(e),console.log(`${e.name}: ${e.message}`)},De=async e=>{if(e in Ce&&void 0!==Ce[e]){const{width:t,height:n}=Ce[e];if(t&&n)return h.Z.baseSizes={width:t,height:n},{width:t,height:n}}try{ke();const t=await xe({cameraType:"user"===e?ue.Front:ue.Back,defaultConstraints:Te});if(t instanceof pe)return he(t),Be(t),{width:0,height:0};let n,r;if(h.Z.stream=t,[h.Z.track]=h.Z.stream.getVideoTracks(),h.Z.firstCameraInit=!0,h.Z.track.getCapabilities&&"function"==typeof h.Z.track.getCapabilities){const e=h.Z.track.getCapabilities();n=e.width.max,r=e.height.max}else{const e=h.Z.track.getSettings();n=e.width,r=e.height}return Ce[e]={...Ce[e],width:ve<n?ve:n,height:we<r?we:r},h.Z.baseSizes={width:n,height:r},{width:n,height:r}}catch(e){Be(e)}},Me=e=>{h.Z.config.onCameraError(R.prepareCameraErr(e)),console.error(e)},Oe=e=>{if("getCapabilities"in e&&"function"==typeof e.getCapabilities){return!!e.getCapabilities().torch}return!1},Pe=async()=>{try{if(h.Z.track&&Oe(h.Z.track)){const e={advanced:[{torch:D.Z.flashlight.isTurnedOn}]};await h.Z.track.applyConstraints(e)}}catch(e){Me(e)}},$e=async e=>{(0,Se.E9)({name:Ae,bottomText:"awaiting"});try{D.Z.Mask.maskType=e,await De(e),await(async e=>{Ee(!0);try{if(h.Z.stream&&h.Z.firstCameraInit)h.Z.firstCameraInit=!1;else{ke();const t=await xe({cameraType:"user"===e?ue.Front:ue.Back,defaultConstraints:Te});t instanceof pe?(he(t),Re(t)):(h.Z.stream=t,h.Z.track=h.Z.stream.getVideoTracks()[0])}D.Z.video.srcObject=h.Z.stream}catch(e){Re(e)}})(e),D.Z.flashlight.addClickEventListener((async()=>{await Pe()})),await Pe()}catch(e){(0,Se.ud)(Ae),Me(e)}},Fe=Ne,_e=ke,Le=async()=>{(0,Se.E9)({name:Ae,bottomText:"awaiting"}),D.Z.msBtn.setState("uploader"),D.Z.msBtn.setLoading(!1),await $e(h.Z.currentStepCamera)},Ve=$e,Ue=Ee,Ge=(e="environment")=>{"boolean"!=typeof Ce[e]?.flashAvailable&&h.Z.track&&(Ce[e].flashAvailable=Oe(h.Z.track)),D.Z.flashlight.show(!!Ce[e]?.flashAvailable)},We=De,ze=()=>Object.keys(Ce).forEach((e=>delete Ce[e])),He=e=>new Promise((t=>setTimeout(t,e))),Ze=e=>new Promise((t=>{requestAnimationFrame((()=>{if(e){const n=e();"object"==typeof n&&"then"in n&&"function"==typeof n?.then?n.then((e=>t(e))):t(n)}else t(!0)}))})),je=()=>{h.Z.loopStarted&&He(100).then(je)},Xe=e=>{h.Z.isStarted=e,D.Z.toggleVideoPos(),D.Z.toggleBorderCanvas()},Ke=()=>{h.Z.loopFrame&&(h.Z.loopFrame=!1,je()),h.Z.resetStats(),Xe(!1)},qe=async()=>{h.Z.resetStats(),D.Z.updateRetakeButton(),await He(200),D.Z.resizeBorders(),await He(300),D.Z.toggleVideoPos()},Qe=async()=>{await qe(),"face"!==h.Z.currentStepType||h.Z.config.faceModule||(h.Z.invertFace="user"===h.Z.currentStepCamera),Xe(!0),D.Z.updateRetakeButton(),h.Z.showForceCapturingBtn&&"photo"===h.Z.currentStepType?D.Z.forceBtn.setAvailable(!0):D.Z.forceBtn.setAvailable(!1),await He(400),h.Z.loopFrame=!0,h.Z.loop&&h.Z.loop()};var Ye=a(4526);function Je(){if(h.Z.origData)return h.Z.origData;try{const{left:e,top:t}=h.Z.offsets,{width:n,height:r}=h.Z.cropSize;return h.Z.origData=D.Z.videoCtx.getImageData(e,t,n,r),h.Z.origData}catch(e){return new ImageData(1,1)}}function et(){if(h.Z.resizedData)return h.Z.resizedData;const{left:e,top:t}=h.Z.offsetsResized,{width:n,height:r}=h.Z.cropResizedSize;return 0===n||(h.Z.resizedData=D.Z.resizedCtx.getImageData(e,t,n,r)),h.Z.resizedData}const tt=()=>D.Z.videoCanvas.toDataURL("image/jpeg"),nt=(e,t,n,r,a)=>{const s=new Path2D;s.moveTo(t[0][0],t[0][1]);for(let e=1;e<t.length;e+=1){const n=t[e];s.lineTo(n[0],n[1])}a&&(e.lineWidth="number"==typeof a?a:2.5),n&&s.closePath(),e.strokeStyle=r,e.stroke(s)},rt=[];let at=!0,st=null,ot=null,it=null;const lt=()=>{const e=Math.min(...rt.map((({blurConfidence:e})=>e))),t=rt.findIndex((({blurConfidence:t})=>t===e));rt.splice(t,1)},ut=(e=Je(),t=!1)=>{it||(it=new Worker(new URL(a.p+a.u(716),a.b),{type:"module"}));let n=1;return st||at&&(at=!1,setTimeout((()=>{at=!0}),150),ot="PENDING",it.postMessage({fn:"process",iData:et()}),it.onmessage=({data:r})=>{st=new Promise((t=>{n=r.blurConfidence,n>.6&&t(""),t(de.Z.execute("model","classLocal","predictFromImage",e,1))})).then((r=>{it.postMessage({fn:"drop"}),ot="FULFILLED";const a=(e=>!("string"!=typeof e||"front"!==e.toLowerCase()))(r);if(!r||!a)return!1;const s={img:t?e:Je(),blurConfidence:n};for(rt.push(s);rt.length>4;)lt();return!0}))}),{status:ot,promise:st}},ct=()=>{ot=null,st=null},dt=async e=>{let t=!0;const n=await de.Z.asyncExecute("module","mrz","detectMrz",e);if(n?.status)h.Z.setMRZParsedResults(n.results),delete h.Z.currentStepObj.errorCode;else{const e="mrz";h.Z.currentStepObj.errorCode=e,h.Z.uploader&&h.Z.uploader.showError(e),t=!1,"licenceKeyError"===n?.error?.errorType&&(0,Ye.Z)(n.error.errorVal)}return t},pt=e=>{let t;const{width:n,height:r}=e;de.Z.execute("module","pdf","setSizes",n,r),de.Z.execute("module","pdf","allocate");const a=de.Z.execute("module","pdf","readPDF",e);h.Z.currentStepObj.trackString="";const s=a?.error&&"licenceKeyError"===a?.errorType;let o=!0;try{o=s||2!==a.status.value}catch(e){}if(o){s&&(0,Ye.Z)(a?.errorVal);const e="barcode";h.Z.currentStepObj.errorCode=e,h.Z.uploader&&h.Z.uploader.showError(e),t=!1}else h.Z.currentStepObj.trackString=a?.data,delete h.Z.currentStepObj.errorCode,t=!0;return t},ht=async e=>{let t=!0;if((await de.Z.execute("module","barcode","process",e))?.status)delete h.Z.currentStepObj.errorCode;else{const e="barcode";h.Z.currentStepObj.errorCode=e,h.Z.uploader&&h.Z.uploader.showError(e),t=!1}return t};var ft=a(7496);const mt=(e,t,n,r,a)=>{switch(n>4&&n<9?(e.width=r,e.height=a):(e.width=a,e.height=r),n){case 2:t.transform(-1,0,0,1,a,0);break;case 3:t.transform(-1,0,0,-1,a,r);break;case 4:t.transform(1,0,0,-1,0,r);break;case 5:t.transform(0,1,1,0,0,0);break;case 6:t.transform(0,-1,1,0,0,a);break;case 7:t.transform(0,-1,-1,0,r,a);break;case 8:t.transform(0,1,-1,0,r,0)}},gt=(e,t,n)=>new Promise((r=>{const a=new Image;a.src=e,a.onload=()=>{ft.EXIF.getData(a,(()=>{const e=ft.EXIF.getTag(a,"Orientation")||0;let{width:s,height:o}=a;const i=document.createElement("canvas"),l=i.getContext("2d");"none"!==t&&(s>o?s>t&&(o*=t/s,s=t):o>t&&(s*=t/o,o=t)),i.width=s,i.height=o,n&&("samsung"===n.name||"iOS"!==n.os&&"Android OS"!==n.os)&&mt(i,l,e,o,s),l.drawImage(a,0,0,s,o),r(i.toDataURL("image/jpeg",1))}))}})),yt=async(e,t,n)=>gt(e,t,n);var bt=a(6714);const xt=async e=>h.Z.config.resizeUploadedImage>0&&h.Z.config.resizeUploadedImage<=1300?R.base64ToImageData(h.Z.currentStepImg):(async e=>{const t=await yt(e,1300,h.Z.browser);return R.base64ToImageData(t)})(e),vt=async e=>{h.Z.currentStepImg=-1!==h.Z.config.resizeUploadedImage?await yt(e,h.Z.config.resizeUploadedImage,h.Z.browser):await(async(e,t)=>gt(e,"none",t))(e,h.Z.browser)},wt=xt,Tt=vt,St=async e=>{if(h.Z.config.fixFrontOrientAfterUpload){const t=await de.Z.execute("model","angles","predictFromImage",e,1);if(t){const e=(0,bt.I)(t[0].label),n=await(async(e,t)=>new Promise((n=>{const r=new Image;r.src=e,r.onload=()=>{const{width:e,height:a}=r,s=document.createElement("canvas"),o=s.getContext("2d");s.width=e,s.height=a,mt(s,o,{0:1,90:8,180:3,270:6}[t],a,e),o.drawImage(r,0,0,e,a),n(s.toDataURL("image/jpeg",1))}})))(h.Z.currentStepImg,e);await vt(n)}}return xt(h.Z.currentStepImg)},At=()=>{0!==h.Z.type&&t.Z.ids().includes(h.Z.type)?(D.Z.predictedType.selectedType=h.Z.type,D.Z.predictedType.show()):(D.Z.selectDocumentType.selectedType=0,D.Z.selectDocumentType.show())},Ct=e=>{h.Z.type=e};var It=a(5622);const kt="stepProcessing",Et=()=>h.Z.steps&&h.Z.steps.filter((e=>null!==e.img)).length===h.Z.steps.length,Nt=()=>{let e="";D.Z.stepsWrapper.innerHTML="",h.Z.steps.forEach(((t,n)=>{const r="user"===t.camera?"idvc-step__img--mirror":"",a=t.img?t.img:"",s=a?"idvc-step__top--has-img":"",o=a?"idvc-step--has-img":"",i=n===h.Z.currentStep?"idvc-step--active":"",l=1===h.Z.type?"pdf":"mrz",u=`background-image: ${E("back"===t.type?l:t.type)}`,c=`<div class="idvc-step ${i} ${o}" id="step${n}" data-id="${n}">\n <div class="idvc-step__top ${s} idvc-step__top--${"back"===t.type?l:t.type}" style="${u}">\n <div class="idvc-step__img ${r}" style="background-image: url('${a}')"></div>\n </div>\n <div class="idvc-step__bottom"><div class="idvc-step__name">${t.name}</div><div class="idvc-step__icon"></div></div>\n </div>`;e+=c})),1===h.Z.steps.length?D.Z.stepsWrapper.style.display="none":D.Z.stepsWrapper.style.display="flex",D.Z.stepsWrapper.innerHTML=e;Array.from(D.Z.stepsWrapper.children).forEach((e=>{e.addEventListener("click",(()=>{const t=e.getAttribute("data-id");t&&Dt(+t)}))}))},Bt=()=>{if(h.Z.type){const e=h.Z.steps.findIndex((e=>"back"===e.type)),t=h.Z.config.steps.findIndex((e=>"auto"===e.type)),n=-1!==t,r=-1===e;2!==h.Z.type?r&&n&&h.Z.steps.splice(t+1,0,new It.Z("Back Scan","back","environment",400,null)):!r&&n&&h.Z.steps.splice(e,1)}Nt(),D.Z.updateContinueBtn(),D.Z.updateSubmitBtn(),D.Z.updateResetAllBtn()},Rt=()=>{"face"===h.Z.currentStepType&&h.Z.isRealFaceAvailable&&(h.Z.updateRealFaceTurnSide(),de.Z.execute("module","face","setDirection",h.Z.realFaceTurnSide))},Dt=e=>{(()=>{const e="error"===D.Z.messageBox.type,{type:n}=h.Z;e||n?!e&&n&&D.Z.messageBox.message(t.Z.humanNameById(n)):D.Z.messageBox.message()})(),e!==h.Z.currentStep&&(de.Z.existPropertyInModule("face","setDetectFace")&&de.Z.execute("module","face","setDetectFace",!1),Rt(),h.Z.currentStep=e,h.Z.loggerController&&h.Z.loggerController.setLogger(h.Z.currentStepType),(()=>{const e="photo"===h.Z.currentStepType;h.Z.capturingMode=e?"processImage4":"processImage5",h.Z.showForceCapturingBtn=e})(),D.Z.msBtn.setAvailable((e=>{const t=h.Z.steps[e];return!!t&&t.isShowManualSwitchButton})(e)),D.Z.forceBtn.setAvailable(!1),h.Z.calculateIsMirroring(),D.Z.setMirroring(),D.Z.updateStepImg(),Nt(),(async()=>{const{video:e}=h.Z.currentStepMode;h.Z.isVideoCapture&&(Ke(),Ue(!1)),h.Z.cameraSupported&&e&&!h.Z.currentStepImg?await Le():(await Fe(),h.Z.currentStepImg||(D.Z.setUploaderWrapEnabled(!0),D.Z.setVideoWrapEnabled(!1))),h.Z.type&&h.Z.uploader&&(h.Z.uploader.changeType(h.Z.currentStepObj,h.Z.type),h.Z.isVideoCapture||(0,Se.ud)(kt))})().then((()=>{const{isAuto:e}=h.Z.currentStepObj;h.Z.currentStepImg&&(e?(D.Z.setUploaderWrapEnabled(!1),D.Z.setVideoWrapEnabled(!0)):(D.Z.setUploaderWrapEnabled(!0),D.Z.setVideoWrapEnabled(!1))),h.Z.resetHints(),D.Z.updateHoldText(),D.Z.updateContinueBtn(),D.Z.updateSubmitBtn(),D.Z.updateRetakeButton(),D.Z.updateResetAllBtn(),D.Z.updateBtnsWrap()})))},Mt=()=>{let e=0;if(Et())e=h.Z.steps.length-1;else do{e=e+1>=h.Z.steps.length?0:e+1}while(t=e,h.Z.steps[t].img);var t;return e},Ot=()=>{const{steps:e,config:{autoContinue:t}}=h.Z,n=e.length,r=Mt(),a=r<n;t&&a?Dt(r):h.Z.loggerController&&h.Z.loggerController.end(),a&&!Et()||(0,Se.ud)(kt)},Pt=()=>{D.Z.updateVideoWrap(),D.Z.updateStepImg(),D.Z.updateContinueBtn(),D.Z.updateSubmitBtn(),D.Z.updateResetAllBtn(),Nt(),D.Z.forceBtn.setAvailable(!1)},$t=(e={})=>{if(Et()&&!h.Z.config.h_showSubmitBtn&&D.Z.typeError?.dialogType?.classList.contains("d-none")){const t=h.Z.steps.map(((e,t)=>e.prepareStepForCallback(t)));h.Z.config.submit(R.formDataForSubmit(t,h.Z,e))}},Ft=(e=-1)=>{const t=-1===e?h.Z.currentStepObj:h.Z.steps[e];t?.img&&(t.img=null),delete h.Z.currentStepObj.mrzText,delete h.Z.currentStepObj.errorCode},_t=()=>{h.Z.passpFront&&(h.Z.passpFront=null,h.Z.isShowStayText=!1,D.Z.updateHoldText()),"auto"===h.Z.currentStepType&&(h.Z.steps=h.Z.steps.filter((e=>"back"!==e.type)),(()=>{if(1===h.Z.config.types.length){const e=t.Z.names().indexOf(h.Z.config.types[0]);Ct(t.Z.ids()[e])}else Ct(null)})(),Nt())},Lt=(e=!1)=>{D.Z.restoreCanvas(),h.Z.clearStepData(),e&&_t(),Ft(),Rt(),h.Z.config.onChange({step:h.Z.currentStepObj.prepareStepForCallback(h.Z.currentStep)}),Pt(),Ve(h.Z.steps[h.Z.currentStep].camera)},Vt=e=>{"mrz"===h.Z.currentStepObj.type&&(h.Z.currentStepObj.mrzImg=D.Z.mrzCanvas.toDataURL("image/jpeg",e)),h.Z.currentStepImg=D.Z.resizedCanvas.toDataURL("image/jpeg",e),h.Z.config.onChange({step:h.Z.currentStepObj.prepareStepForCallback(h.Z.currentStep)}),D.Z.resizedCanvas.toBlob((e=>{h.Z.currentStepObj.blob=e}),"image/jpeg",e),Pt(),$t({event:"filled"}),Ot()},Ut=(e=!0)=>{h.Z.config.onChange({step:h.Z.currentStepObj.prepareStepForCallback(h.Z.currentStep)}),e?Ot():(0,Se.ud)(kt),$t({event:"filled"})},Gt=async()=>{let e=!0;if(1!==h.Z.config.types.length)if(Bt(),2===h.Z.type&&h.Z.currentStepObj.img){(0,Se.E9)({name:kt});const t=await wt(h.Z.currentStepObj.img);e=await dt(t)}else delete h.Z.currentStepObj.errorCode;Ut(e)},Wt=()=>{1!==h.Z.config.types.length&&Bt(),0!==h.Z.type&&h.Z.allowedTypesIds.includes(h.Z.type)&&h.Z.topImage?((e,t)=>{(0,Se.ud)(kt);const{type:n}=h.Z;if(2!==n||h.Z.passpFront)Vt(t);else{h.Z.passpFront=D.Z.resizedCanvas.toDataURL("image/jpeg",t),D.Z.resizedCanvas.toBlob((e=>{h.Z.steps[h.Z.currentStep].blob=e}),"image/jpeg",t);const n=de.Z.execute("module","mrz","checkMrz",e);n?.error?((0,Ye.Z)(n.error.errorVal),Lt()):n?.status?(h.Z.loggerController&&(h.Z.loggerController.end(),h.Z.loggerController.changeStep("mrz"),h.Z.loggerController.start()),Vt(t),h.Z.loggerController&&h.Z.loggerController.end()):Lt()}})(h.Z.topImage,h.Z.k):(D.Z.typeError.dialogMode="error",D.Z.typeError.toggleDialogType(!0),h.Z.type=0,Ft(),Nt(),Lt())},zt=()=>{const{isVideoCapture:e}=h.Z;(e?Wt:Gt)(),D.Z.messageBox.message(t.Z.humanNameById(h.Z.type))};var Ht=a(8169);const Zt={status:!1,cancel:!1,touch:!1,image:null},jt=.3;let Xt=null,Kt=null,qt=0,Qt=0,Yt=[];const Jt={...Zt},en=()=>{Jt.status=!0,Jt.image=(()=>{const e=rt.sort(((e,t)=>e.blurConfidence-t.blurConfidence))[0].img;return rt.length=0,e})(),Jt.cancel=!1,Jt.touch=!1},tn=e=>{qt=e?qt+1:0,qt>5&&(D.Z.videoCtx.drawImage(D.Z.video,0,0,D.Z.videoCanvas.width,D.Z.videoCanvas.height),qt=0,en(),Yt.length=0),Qt+=1,h.Z.isShowHelpText=Qt>100,D.Z.updateHoldText(),D.Z.Mask.fillPercentage=Math.trunc(qt/5*100)},nn={processImage4:()=>{const e={...Zt};return D.Z.videoCtx.drawImage(D.Z.video,0,0,D.Z.videoCanvas.width,D.Z.videoCanvas.height),e},processImage5:e=>{try{D.Z.mrzCanvas.width=et().width,D.Z.mrzCanvas.height=et().height,D.Z.mrzCtx.putImageData(et(),0,0),D.Z.mrzCtx.scale(jt,jt),D.Z.mrzCtx.drawImage(D.Z.mrzCanvas,0,0),Kt||(Kt=(()=>{let e=0,t=0;return()=>(e&&t||(e=Math.floor(et().width*jt),t=Math.floor(et().height*jt)),D.Z.mrzCtx.getImageData(0,0,e,t))})()),Xt||(Xt=new Worker(new URL(a.p+a.u(215),a.b),{type:"module"})),Xt.postMessage({iData:Kt(),resizedToBorderScaleWidth:h.Z.resizedToBorderScale.width,resizedToBorderScaleHeight:h.Z.resizedToBorderScale.height}),Xt.onmessage=({data:e})=>(e=>{D.Z.clearBorderCtx();const t=D.Z.borderCtx,{width:n}=D.Z.borderCanvas,r=Yt.length;for(let e=0;e<r;e+=1){t.beginPath();const r=Yt[e],s=h.Z.isMirroring?n-r.x:r.x;(a=r).r>=a.maxRadius&&(a.mode=1),a.r<=0&&(a.mode=0),0===a.mode&&(a.r+=a.step),1===a.mode&&(a.end=!0),t.arc(s,r.y,r.r,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.5)",t.strokeStyle="rgba(255, 255, 255, 0)",t.fill(),t.stroke()}var a;if(Yt=Yt.filter((e=>!e.end)),Yt.length<100){let t=100-e.length;t<0&&(t=100);for(let n=0;n<t;n+=1)e[n]&&Yt.push({x:Math.trunc((e[n].x2+e[n].x1)/2),y:Math.trunc((e[n].y2+e[n].y1)/2),r:0,opacity:1,step:(0,Ht.lv)(50,90)/100,maxRadius:(0,Ht.lv)(2,5)})}})(e.segments),(e=>{if(e){const{status:e,promise:t}=ut();"FULFILLED"===e&&t.then((e=>tn(e))).then(ct)}else tn(!0)})(e)}catch(e){return console.log(e),Jt}if(Jt.status){const e={...Jt};return Jt.status=!1,Jt.cancel=!1,Jt.touch=!1,Jt.image=null,e}return{...Jt}}},rn={staticImageMode:!0,flipHorizontal:!0},an=async()=>{const e=await(async()=>de.Z.isExist("model","faceMesh")?de.Z.execute("model","faceMesh","estimateFaces",et(),rn):null)();return e?(null===de.Z.execute("module","face","getDirection")&&de.Z.execute("module","face","setDirection",h.Z.realFaceTurnSide),de.Z.execute("module","face","processFace",h.Z.startProccessFaceTime,Je(),e,et())):null},sn={back(){let e;const{type:t}=h.Z;return e=1===t?de.Z.execute("module","pdf","proccessPDF",Je(),!1):de.Z.execute("module","mrz","processMRZ",Je()),e},mrz:()=>(de.Z.execute("module","mrz","allocate"),de.Z.execute("module","mrz","processMRZ",Je())),pdf(){const{width:e,height:t}=h.Z.cropSize;return de.Z.execute("module","pdf","setSizes",e,t),de.Z.execute("module","pdf","proccessPDF",Je())},face:async(e=20)=>{let t;if(!(4===D.Z.video.readyState))return t;const n="user"===h.Z.currentStepCamera,r=Date.now()-h.Z.stepTime>=e;return h.Z.isRealFaceAvailable&&n&&r&&(h.Z.stepTime=Date.now(),t=await an()),h.Z.isRealFaceAvailable&&n||(t=await(()=>{const e=D.Z.resizedCtx.getImageData(h.Z.offsetsFace.left,h.Z.offsetsFace.top,h.Z.cropFace.width,h.Z.cropFace.height);return de.Z.execute("module","face","detect",e)})()),t},async auto(){let e;return 2===h.Z.type?(h.Z.loggerController&&"mrz"!==h.Z.loggerController.getStep()&&(h.Z.loggerController.changeStep("mrz"),h.Z.loggerController.start()),e=h.Z.passpFront?de.Z.execute("module","mrz","processMRZ",Je()):await nn[h.Z.capturingMode](),e&&e.status&&h.Z.loggerController&&(h.Z.loggerController.end(),h.Z.loggerController.changeCurrentStep("auto"))):e=await nn[h.Z.capturingMode](),e},front:()=>(h.Z.isShowHoldText=!0,nn[h.Z.capturingMode](!0)),barcode:()=>de.Z.execute("module","barcode","process",tt(),Je()),photo:()=>nn[h.Z.capturingMode]()},on={back:["mrz","pdf"],mrz:["mrz"],pdf:["pdf"],face:["face"],auto:["mrz"],front:[],barcode:["barcode"]},ln=(e,...t)=>{return n=e,!(!Object.keys(on).includes(n)||on[n].filter((e=>!de.Z.isLoaded("module",e))).length)&&sn[e].apply(null,t);var n};var un=a(7868);const cn=[127,34,139,11,0,37,232,231,120,72,37,39,128,121,47,232,121,128,104,69,67,175,171,148,157,154,155,118,50,101,73,39,40,9,151,108,48,115,131,194,204,211,74,40,185,80,42,183,40,92,186,230,229,118,202,212,214,83,18,17,76,61,146,160,29,30,56,157,173,106,204,194,135,214,192,203,165,98,21,71,68,51,45,4,144,24,23,77,146,91,205,50,187,201,200,18,91,106,182,90,91,181,85,84,17,206,203,36,148,171,140,92,40,39,193,189,244,159,158,28,247,246,161,236,3,196,54,68,104,193,168,8,117,228,31,189,193,55,98,97,99,126,47,100,166,79,218,155,154,26,209,49,131,135,136,150,47,126,217,223,52,53,45,51,134,211,170,140,67,69,108,43,106,91,230,119,120,226,130,247,63,53,52,238,20,242,46,70,156,78,62,96,46,53,63,143,34,227,173,155,133,123,117,111,44,125,19,236,134,51,216,206,205,154,153,22,39,37,167,200,201,208,36,142,100,57,212,202,20,60,99,28,158,157,35,226,113,160,159,27,204,202,210,113,225,46,43,202,204,62,76,77,137,123,116,41,38,72,203,129,142,64,98,240,49,102,64,41,73,74,212,216,207,42,74,184,169,170,211,170,149,176,105,66,69,122,6,168,123,147,187,96,77,90,65,55,107,89,90,180,101,100,120,63,105,104,93,137,227,15,86,85,129,102,49,14,87,86,55,8,9,100,47,121,145,23,22,88,89,179,6,122,196,88,95,96,138,172,136,215,58,172,115,48,219,42,80,81,195,3,51,43,146,61,171,175,199,81,82,38,53,46,225,144,163,110,246,33,7,52,65,66,229,228,117,34,127,234,107,108,69,109,108,151,48,64,235,62,78,191,129,209,126,111,35,143,163,161,246,117,123,50,222,65,52,19,125,141,221,55,65,3,195,197,25,7,33,220,237,44,70,71,139,122,193,245,247,130,33,71,21,162,153,158,159,170,169,150,188,174,196,216,186,92,144,160,161,2,97,167,141,125,241,164,167,37,72,38,12,145,159,160,38,82,13,63,68,71,226,35,111,158,153,154,101,50,205,206,92,165,209,198,217,165,167,97,220,115,218,133,112,243,239,238,241,214,135,169,190,173,133,171,208,32,125,44,237,86,87,178,85,86,179,84,85,180,83,84,181,201,83,182,137,93,132,76,62,183,61,76,184,57,61,185,212,57,186,214,207,187,34,143,156,79,239,237,123,137,177,44,1,4,201,194,32,64,102,129,213,215,138,59,166,219,242,99,97,2,94,141,75,59,235,24,110,228,25,130,226,23,24,229,22,23,230,26,22,231,112,26,232,189,190,243,221,56,190,28,56,221,27,28,222,29,27,223,30,29,224,247,30,225,238,79,20,166,59,75,60,75,240,147,177,215,20,79,166,187,147,213,112,233,244,233,128,245,128,114,188,114,217,174,131,115,220,217,198,236,198,131,134,177,132,58,143,35,124,110,163,7,228,110,25,356,389,368,11,302,267,452,350,349,302,303,269,357,343,277,452,453,357,333,332,297,175,152,377,384,398,382,347,348,330,303,304,270,9,336,337,278,279,360,418,262,431,304,408,409,310,415,407,270,409,410,450,348,347,422,430,434,313,314,17,306,307,375,387,388,260,286,414,398,335,406,418,364,367,416,423,358,327,251,284,298,281,5,4,373,374,253,307,320,321,425,427,411,421,313,18,321,405,406,320,404,405,315,16,17,426,425,266,377,400,369,322,391,269,417,465,464,386,257,258,466,260,388,456,399,419,284,332,333,417,285,8,346,340,261,413,441,285,327,460,328,355,371,329,392,439,438,382,341,256,429,420,360,364,394,379,277,343,437,443,444,283,275,440,363,431,262,369,297,338,337,273,375,321,450,451,349,446,342,467,293,334,282,458,461,462,276,353,383,308,324,325,276,300,293,372,345,447,382,398,362,352,345,340,274,1,19,456,248,281,436,427,425,381,256,252,269,391,393,200,199,428,266,330,329,287,273,422,250,462,328,258,286,384,265,353,342,387,259,257,424,431,430,342,353,276,273,335,424,292,325,307,366,447,345,271,303,302,423,266,371,294,455,460,279,278,294,271,272,304,432,434,427,272,407,408,394,430,431,395,369,400,334,333,299,351,417,168,352,280,411,325,319,320,295,296,336,319,403,404,330,348,349,293,298,333,323,454,447,15,16,315,358,429,279,14,15,316,285,336,9,329,349,350,374,380,252,318,402,403,6,197,419,318,319,325,367,364,365,435,367,397,344,438,439,272,271,311,195,5,281,273,287,291,396,428,199,311,271,268,283,444,445,373,254,339,263,466,249,282,334,296,449,347,346,264,447,454,336,296,299,338,10,151,278,439,455,292,407,415,358,371,355,340,345,372,390,249,466,346,347,280,442,443,282,19,94,370,441,442,295,248,419,197,263,255,359,440,275,274,300,383,368,351,412,465,263,467,466,301,368,389,380,374,386,395,378,379,412,351,419,436,426,322,373,390,388,2,164,393,370,462,461,164,0,267,302,11,12,374,373,387,268,12,13,293,300,301,446,261,340,385,384,381,330,266,425,426,423,391,429,355,437,391,327,326,440,457,438,341,382,362,459,457,461,434,430,394,414,463,362,396,369,262,354,461,457,316,403,402,315,404,403,314,405,404,313,406,405,421,418,406,366,401,361,306,408,407,291,409,408,287,410,409,432,436,410,434,416,411,264,368,383,309,438,457,352,376,401,274,275,4,421,428,262,294,327,358,433,416,367,289,455,439,462,370,326,2,326,370,305,460,455,254,449,448,255,261,446,253,450,449,252,451,450,256,452,451,341,453,452,413,464,463,441,413,414,258,442,441,257,443,442,259,444,443,260,445,444,467,342,445,459,458,250,289,392,290,290,328,460,376,433,435,250,290,392,411,416,433,341,463,464,453,464,465,357,465,412,343,412,399,360,363,440,437,399,456,420,456,363,401,435,288,372,383,353,339,255,249,448,261,255,133,243,190,133,155,112,33,246,247,33,130,25,398,384,286,362,398,414,362,463,341,263,359,467,263,249,255,466,467,260,75,60,166,238,239,79,162,127,139,72,11,37,121,232,120,73,72,39,114,128,47,233,232,128,103,104,67,152,175,148,173,157,155,119,118,101,74,73,40,107,9,108,49,48,131,32,194,211,184,74,185,191,80,183,185,40,186,119,230,118,210,202,214,84,83,17,77,76,146,161,160,30,190,56,173,182,106,194,138,135,192,129,203,98,54,21,68,5,51,4,145,144,23,90,77,91,207,205,187,83,201,18,181,91,182,180,90,181,16,85,17,205,206,36,176,148,140,165,92,39,245,193,244,27,159,28,30,247,161,174,236,196,103,54,104,55,193,8,111,117,31,221,189,55,240,98,99,142,126,100,219,166,218,112,155,26,198,209,131,169,135,150,114,47,217,224,223,53,220,45,134,32,211,140,109,67,108,146,43,91,231,230,120,113,226,247,105,63,52,241,238,242,124,46,156,95,78,96,70,46,63,116,143,227,116,123,111,1,44,19,3,236,51,207,216,205,26,154,22,165,39,167,199,200,208,101,36,100,43,57,202,242,20,99,56,28,157,124,35,113,29,160,27,211,204,210,124,113,46,106,43,204,96,62,77,227,137,116,73,41,72,36,203,142,235,64,240,48,49,64,42,41,74,214,212,207,183,42,184,210,169,211,140,170,176,104,105,69,193,122,168,50,123,187,89,96,90,66,65,107,179,89,180,119,101,120,68,63,104,234,93,227,16,15,85,209,129,49,15,14,86,107,55,9,120,100,121,153,145,22,178,88,179,197,6,196,89,88,96,135,138,136,138,215,172,218,115,219,41,42,81,5,195,51,57,43,61,208,171,199,41,81,38,224,53,225,24,144,110,105,52,66,118,229,117,227,34,234,66,107,69,10,109,151,219,48,235,183,62,191,142,129,126,116,111,143,7,163,246,118,117,50,223,222,52,94,19,141,222,221,65,196,3,197,45,220,44,156,70,139,188,122,245,139,71,162,145,153,159,149,170,150,122,188,196,206,216,92,163,144,161,164,2,167,242,141,241,0,164,37,11,72,12,144,145,160,12,38,13,70,63,71,31,226,111,157,158,154,36,101,205,203,206,165,126,209,217,98,165,97,237,220,218,237,239,241,210,214,169,140,171,32,241,125,237,179,86,178,180,85,179,181,84,180,182,83,181,194,201,182,177,137,132,184,76,183,185,61,184,186,57,185,216,212,186,192,214,187,139,34,156,218,79,237,147,123,177,45,44,4,208,201,32,98,64,129,192,213,138,235,59,219,141,242,97,97,2,141,240,75,235,229,24,228,31,25,226,230,23,229,231,22,230,232,26,231,233,112,232,244,189,243,189,221,190,222,28,221,223,27,222,224,29,223,225,30,224,113,247,225,99,60,240,213,147,215,60,20,166,192,187,213,243,112,244,244,233,245,245,128,188,188,114,174,134,131,220,174,217,236,236,198,134,215,177,58,156,143,124,25,110,7,31,228,25,264,356,368,0,11,267,451,452,349,267,302,269,350,357,277,350,452,357,299,333,297,396,175,377,381,384,382,280,347,330,269,303,270,151,9,337,344,278,360,424,418,431,270,304,409,272,310,407,322,270,410,449,450,347,432,422,434,18,313,17,291,306,375,259,387,260,424,335,418,434,364,416,391,423,327,301,251,298,275,281,4,254,373,253,375,307,321,280,425,411,200,421,18,335,321,406,321,320,405,314,315,17,423,426,266,396,377,369,270,322,269,413,417,464,385,386,258,248,456,419,298,284,333,168,417,8,448,346,261,417,413,285,326,327,328,277,355,329,309,392,438,381,382,256,279,429,360,365,364,379,355,277,437,282,443,283,281,275,363,395,431,369,299,297,337,335,273,321,348,450,349,359,446,467,283,293,282,250,458,462,300,276,383,292,308,325,283,276,293,264,372,447,346,352,340,354,274,19,363,456,281,426,436,425,380,381,252,267,269,393,421,200,428,371,266,329,432,287,422,290,250,328,385,258,384,446,265,342,386,387,257,422,424,430,445,342,276,422,273,424,306,292,307,352,366,345,268,271,302,358,423,371,327,294,460,331,279,294,303,271,304,436,432,427,304,272,408,395,394,431,378,395,400,296,334,299,6,351,168,376,352,411,307,325,320,285,295,336,320,319,404,329,330,349,334,293,333,366,323,447,316,15,315,331,358,279,317,14,316,8,285,9,277,329,350,253,374,252,319,318,403,351,6,419,324,318,325,397,367,365,288,435,397,278,344,439,310,272,311,248,195,281,375,273,291,175,396,199,312,311,268,276,283,445,390,373,339,295,282,296,448,449,346,356,264,454,337,336,299,337,338,151,294,278,455,308,292,415,429,358,355,265,340,372,388,390,466,352,346,280,295,442,282,354,19,370,285,441,295,195,248,197,457,440,274,301,300,368,417,351,465,251,301,389,385,380,386,394,395,379,399,412,419,410,436,322,387,373,388,326,2,393,354,370,461,393,164,267,268,302,12,386,374,387,312,268,13,298,293,301,265,446,340,380,385,381,280,330,425,322,426,391,420,429,437,393,391,326,344,440,438,458,459,461,364,434,394,428,396,262,274,354,457,317,316,402,316,315,403,315,314,404,314,313,405,313,421,406,323,366,361,292,306,407,306,291,408,291,287,409,287,432,410,427,434,411,372,264,383,459,309,457,366,352,401,1,274,4,418,421,262,331,294,358,435,433,367,392,289,439,328,462,326,94,2,370,289,305,455,339,254,448,359,255,446,254,253,449,253,252,450,252,256,451,256,341,452,414,413,463,286,441,414,286,258,441,258,257,442,257,259,443,259,260,444,260,467,445,309,459,250,305,289,290,305,290,460,401,376,435,309,250,392,376,411,433,453,341,464,357,453,465,343,357,412,437,343,399,344,360,440,420,437,456,360,420,363,361,401,288,265,372,353,390,339,249,339,448,255],dn=e=>{h.Z.isDetectFace=!!e},pn=new ImageData(new Uint8ClampedArray(4),1,1);let hn=pn;const fn=["leftTop","rightTop","rightBottom","leftBottom"],mn=(e,t)=>{D.Z.borderCtx.clearRect(0,0,D.Z.borderCanvas.width,D.Z.borderCanvas.height),e&&(D.Z.borderCtx.strokeStyle="green"===t?"rgb(19, 206, 102)":"rgb(249, 249, 79)",D.Z.borderCtx.lineWidth=3,D.Z.borderCtx.beginPath(),fn.forEach((t=>{const{x:n,y:r}=(a=e[t],{x:(h.Z.isMobile?a.x:1-a.x)*D.Z.borderCanvas.width,y:a.y*D.Z.borderCanvas.height});var a;D.Z.borderCtx.lineTo(n,r)})),D.Z.borderCtx.closePath(),D.Z.borderCtx.stroke())},gn=e=>(D.Z.borderCtx.font="14px Arial",e.map((e=>(e=>{const{width:t}=D.Z.borderCanvas,n=Math.trunc(e.x);return{y:Math.trunc(e.y),x:h.Z.isMirroring?t-n:n}})(e)))),yn={pdf:e=>{if(h.Z.isShowHelpText=e.pdfSuccessCount>20,h.Z.isShowStayText=!0,h.Z.currentStepObj.trackString=e.trackString,D.Z.clearBorderCtx(),D.Z.updateHoldText(),D.Z.Mask.fillPercentage=Math.trunc(e.pdfCount/h.Z.minPDFframes*100),e.coords){const t=gn(e.coords);D.Z.borderCtx.strokeStyle="rgb(19, 206, 102)",D.Z.borderCtx.lineWidth=3,D.Z.borderCtx.beginPath(),D.Z.borderCtx.moveTo(t[0].x,t[0].y),D.Z.borderCtx.lineTo(t[1].x,t[1].y),D.Z.borderCtx.lineTo(t[2].x,t[2].y),D.Z.borderCtx.lineTo(t[3].x,t[3].y),D.Z.borderCtx.lineTo(t[0].x,t[0].y),D.Z.borderCtx.stroke()}},mrz:e=>{h.Z.isShowStayText=!0,h.Z.isShowHelpText=!1,D.Z.updateHoldText(),e.coords?mn(e.coords.locations,e.coords.color):mn(null),e.status&&(((e,t)=>{D.Z.mrzCanvas.width=e.width,D.Z.mrzCanvas.height=e.height;let n=0,r=0,a=0,s=0;D.Z.mrzCtx.putImageData(e,0,0),t.leftTop.y<=t.rightTop.y?(n=t.rightBottom.y*D.Z.mrzCanvas.height-t.leftTop.y*D.Z.mrzCanvas.height,r=t.rightTop.x*D.Z.mrzCanvas.width-t.leftBottom.x*D.Z.mrzCanvas.width,a=t.leftBottom.x*D.Z.mrzCanvas.width,s=t.leftTop.y*D.Z.mrzCanvas.height):(n=t.leftBottom.y*D.Z.mrzCanvas.height-t.rightTop.y*D.Z.mrzCanvas.height,r=t.rightBottom.x*D.Z.mrzCanvas.width-t.leftTop.x*D.Z.mrzCanvas.width,a=t.leftTop.x*D.Z.mrzCanvas.width,s=t.rightTop.y*D.Z.mrzCanvas.height);const o=D.Z.mrzCtx.getImageData(a,s,r,n);D.Z.mrzCanvas.width=o.width,D.Z.mrzCanvas.height=o.height,D.Z.mrzCtx.putImageData(o,0,0)})(e.image,e.coords.locations),h.Z.setMRZParsedResults(e.results),2===h.Z.type&&(h.Z.currentStepObj.img=h.Z.passpFront))},SimpleFace:e=>{h.Z.isShowHelpText=e.faceFailCount>20,e.faceSuccessCount>5&&(de.Z.execute("module","face","dropResults"),e.status=!0,e.image=hn,hn=pn),e.faceFailCount||!e.faceSuccessCount||e.status?e.faceFailCount&&!e.faceSuccessCount&&dn(!1):(dn(!0),hn=Je()),D.Z.updateHoldText(),D.Z.Mask.fillPercentage=Math.trunc(e.faceSuccessCount/5*100)},VolumeFace:e=>{h.Z.resetHints(),D.Z.clearBorderCtx(),(e=>{h.Z.startProccessFaceTime=(new Date).getTime(),h.Z.isShowHelpText=e.faceFailCount>20,e.faceSuccessCount?h.Z.topImage=Je():e.faceFailCount&&!e.faceSuccessCount&&(h.Z.isShowNotSeeText=!0),e.distance>30&&!e.realFace&&(h.Z.isShowTurnText=!1,h.Z.isShowFacePercentText=!0),1===e.perimeter?h.Z.isShowCloserText=!0:2===e.perimeter&&(h.Z.isShowAwayText=!0),h.Z.isShowCenterText=e.moveToCenter,h.Z.isShowNotSeeText=e.noFace||!e.drawPoints})(e);let t=0;if(e.distance){const{distance:n,drawPoints:r}=e,a=(e=>{const t=2.5*e;return(0,un.ew)(t)})(n);((e,t)=>{const n=e.length,r=new Array(n),{width:a,height:s}=h.Z.cropResizedSize,{width:o,height:i}=D.Z.borderCanvas,l=o/a,u=i/s;for(let t=0;t<n;t+=1)r[t]=[0,0],r[t][0]=Math.trunc(e[t].x*l),r[t][1]=Math.trunc(e[t].y*u);const c=cn.length/3;for(let e=0;e<c;e+=1){const n=[cn[3*e],cn[3*e+1],cn[3*e+2]].map((e=>r[e]));nt(D.Z.borderCtx,n,!0,t)}})(r,a),(e=>{dn(!0),e.realFace?e.distance>90?(h.Z.isShowStayCalmText=!0,h.Z.isShowComeBackText=!1):(h.Z.isShowStayCalmText=!1,h.Z.isShowComeBackText=!0):h.Z.isShowTurnText=!0})(e),t=n}else dn(!1);((e,t=0)=>{D.Z.Mask.fillPercentage=Math.trunc(e.faceSuccessCount/3*100),D.Z.updateHoldText(t,e.isCorrectDirection)})(e,t)}},bn={...yn,hasFn:e=>e in yn},xn="loop",vn=async(e,t,n=!1)=>{h.Z.loopFrame=!1,_e(),Xe(!1),D.Z.resizedCanvas.width=e.width,D.Z.resizedCanvas.height=e.height,D.Z.resizedCtx.putImageData(e,0,0);const r=["back","auto"].includes(h.Z.currentStepType)?1:.95;h.Z.currentStepObj.isAuto=!n,h.Z.currentStepObj.source="video","auto"===h.Z.currentStepType?((0,Se.E9)({name:xn}),h.Z.topImage=e,h.Z.k=r,h.Z.currentStepImg=D.Z.resizedCanvas.toDataURL("image/jpeg",r),D.Z.updateStepImg(),h.Z.passpFront?Wt():At()):Vt(r),D.Z.restoreCanvas(),D.Z.updateRetakeButton()},wn=()=>{(0,Se.ud)(xn),Ue(!1),_e(),Ke()},Tn=async()=>{if(h.Z.loopFrame){const{type:e,time:t}=h.Z.currentStepObj;if(e in sn){const n=await ln(e,t);await(async e=>{if(e&&e.error&&"licenceKeyError"===e.error.errorType)(0,Ye.Z)(e.error.errorVal);else if(e&&"type"in e&&bn.hasFn(e.type)&&bn[e.type](e),e&&e.status){const{cancel:t,image:n}=e;await vn(n)}else D.Z.restoreCanvas()})(n)}}},Sn=()=>{const{currentStepType:e}=h.Z,t="back"===e&&1===h.Z.type,n="auto"===e&&h.Z.passpFront,r="auto"===e&&!h.Z.passpFront;(["back","auto","front"].includes(e)||t||r)&&et(),(["face","back","mrz","pdf","auto","barcode"].includes(e)||n)&&Je()},An=async()=>{const e=document.getElementById(h.Z.config.el);return void 0!==e&&null!=e?(h.Z.resizedToBorderScale=(()=>{const{width:e,height:t}=D.Z.borderCanvas,{width:n,height:r}=et();return{width:+(n/e).toFixed(2),height:+(r/t).toFixed(2)}})(),await(async()=>{for(h.Z.loopStarted=!0;h.Z.loopFrame&&!h.Z.licenseKeyError;)h.Z.clearStepData(),D.Z.saveCanvas(),D.Z.recreateWorkingCanvas(),D.Z.setResizedCanvasSizes(h.Z.resizedCanvasSizes),D.Z.setVideoCanvasSizes(h.Z.videoCanvasSizes),D.Z.drawResizedVideo(),await Ze(Sn),await Ze(Tn);h.Z.loopStarted=!1})()):wn(),!1},Cn=vn;let In=null,kn=null,En=-1,Nn=-1,Bn=null,Rn=null;const Dn=e=>[e.touches[0].clientX,e.touches[0].clientY],Mn=e=>{[En,Nn]=Dn(e),Bn=null},On=e=>{if(En<0)return;const[t,n]=Dn(e),r=En-t,a=Nn-n;Rn=Math.abs(a)>Math.abs(r),Bn=r>0},Pn=()=>{En>=0&&Nn>=0&&"boolean"==typeof Bn&&"boolean"==typeof Rn&&!Rn&&kn(Bn?"next":"prev"),En=-1,Nn=-1,Bn=null,Rn=null},$n=(e,t)=>{In=e,kn=t,In.addEventListener("touchstart",Mn,{passive:!0}),In.addEventListener("touchmove",On,{passive:!0}),document.addEventListener("touchend",Pn,{passive:!0})},Fn=()=>h.Z.config.useCDN?Promise.all([a.e(400),a.e(513)]).then(a.bind(a,7255)):Promise.all([a.e(400),a.e(584)]).then(a.bind(a,5530));let _n=!1,Ln=null;const Vn=()=>{h.Z.isRealFaceAvailable&&!h.Z.processFace3d.ended?setTimeout(Vn,50):h.Z.currentStepCamera&&Ve(h.Z.currentStepCamera)},Un=()=>D.Z.msBtn.addClickCallback((()=>{let e=!0;"video"===D.Z.msBtn.state?Ke():"uploader"===D.Z.msBtn.state&&h.Z.currentStepObj.img&&(Ke(),Lt(!0),e=!1),((e,t)=>{h.Z.uploader&&h.Z.uploader.clearStates(),"uploader"===e&&t&&Ve(h.Z.currentStepObj.camera),"video"===e&&((0,Se.Jo)(),Ue(!1),_e(),Ke()),!h.Z.isVideoCapture&&h.Z.uploader&&h.Z.uploader.changeType(h.Z.currentStepObj)})(D.Z.msBtn.state,e)})),Gn=()=>{D.Z.dialogSelectType.addEventListener("change",(()=>{var e;D.Z.typeError.toggleDialogType(!1),e=parseInt(D.Z.dialogSelectType.value,10),Ct(e),Dt(0),Bt(),D.Z.updateBtnsWrap(),$t({event:"filled"}),Ot(),D.Z.dialogSelectType.value="0"}))},Wn=e=>{D.Z.retakeBtn.addEventListener("click",(()=>{if(!D.Z.retakeBtn.classList.contains("el-button--disabled")){if("onRetakeHook"in h.Z.config)try{h.Z.config.onRetakeHook({step:h.Z.currentStepObj.prepareStepForCallback(h.Z.currentStep)})}catch(e){console.error(e)}Lt(!0)}})),D.Z.guidlinesBtn.addEventListener("click",(()=>h.Z.config.clickGuidlines())),D.Z.continueBtn.addEventListener("click",(()=>{D.Z.continueBtn.classList.contains("el-button--disabled")||Dt(h.Z.currentStep+1)})),D.Z.submitBtn.addEventListener("click",(()=>{if(!D.Z.submitBtn.classList.contains("el-button--disabled")){const e=h.Z.steps.map(((e,t)=>e.prepareStepForCallback(t)));h.Z.config.submit(R.formDataForSubmit(e,h.Z,{event:"submit"}))}})),(e=>{D.Z.resetAllStepsBtn.addEventListener("click",(()=>e.resetAllSteps()))})(e),D.Z.forceBtn.addClickCallback((()=>Cn(Je(),!1,!0))),Un(),(e=>{h.Z.config.types.length>1&&D.Z.messageBox.addChangeDocumentTypeListener((()=>e.changeDocumentType()))})(e)},zn=()=>{D.Z.video.addEventListener("loadedmetadata",(async()=>{h.Z.stream&&h.Z.stream.active?(h.Z.isStarted=!0,await qe(),D.Z.Mask.fillPercentage=0,await He(100),await D.Z.video.play(),D.Z.resizeMainContainer(),Ge(h.Z.currentStepCamera)):h.Z.currentStepCamera&&Ve(h.Z.currentStepCamera)})),D.Z.video.addEventListener("loadeddata",(async()=>{if(h.Z.baseSizes={width:D.Z.video.videoWidth,height:D.Z.video.videoHeight},h.Z.currentStepImg)(0,Se.Jo)(),_e(),Ke(),D.Z.forceBtn.setAvailable(!1);else{await Qe(),(0,Se.Jo)();const e=()=>Ln||Fn();Ln=await e(),Ln.default(),await Promise.all(de.Z.allocateAll())}})),D.Z.video.addEventListener("error",(()=>{D.Z.video.srcObject&&_e()}))},Hn=e=>{_n||(Wn(e),$n(D.Z.mainContainer,(e=>{if(h.Z.currentStepImg){if("next"===e){const e=h.Z.steps.length>h.Z.currentStep+1;Dt(e?h.Z.currentStep+1:h.Z.currentStep)}if("prev"===e){const e=h.Z.currentStep-1>=0;Dt(e?h.Z.currentStep-1:h.Z.currentStep)}}})),Gn(),window.addEventListener("orientationchange",(()=>{const{videoLoading:e,isVideoCapture:t}=h.Z;!e&&t&&(Ke(),_e(),Pt(),h.Z.currentStepImg||Vn())}),!1),window.addEventListener("resize",(()=>{h.Z.track&&h.Z.steps[h.Z.currentStep]&&(D.Z.resizeBorders(),D.Z.resizeMainContainer())})),zn(),(e=>{D.Z.selectDocumentType.addDoneHandler((()=>{const n=t.Z.nameById(D.Z.selectDocumentType.selectedType);h.Z.config.steps=h.Z.config.documentTypes[n],D.Z.selectDocumentType.selectedType&&(h.Z.type=D.Z.selectDocumentType.selectedType,h.Z.currentStep=-1,e.mount())})),D.Z.selectDocumentType.addCancelHandler((()=>{h.Z.currentStepImg?((0,Se.Jo)(),D.Z.selectDocumentType.hide()):(D.Z.selectDocumentType.hide(),e.start())})),D.Z.predictedType.addDoneHandler((()=>zt())),D.Z.predictedType.addCancelHandler((()=>{D.Z.selectDocumentType.selectedType=h.Z.type,D.Z.selectDocumentType.show()}))})(e),_n=!0)},Zn="manualUpload",jn=()=>{D.Z.updateStepImg(),D.Z.updateContinueBtn(),D.Z.updateSubmitBtn(),D.Z.updateResetAllBtn()},Xn=({data:e})=>e&&"object"==typeof e?(e=>(D.Z.resizedCanvas.width=e.width,D.Z.resizedCanvas.height=e.height,D.Z.resizedCtx.putImageData(e,0,0),D.Z.resizedCanvas.toDataURL()))(e):e,Kn=async(e,t)=>{const{currentStepType:n}=h.Z,r="front"===n||"auto"===n?await St(e):await wt(t);let a;h.Z.currentStepObj.isAuto=!1,h.Z.currentStepObj.source="file","front"===n?a=await(async e=>{const t=ut(e,!0);if(t)return!!t;const n="frontSide";return h.Z.currentStepObj.errorCode=n,h.Z.uploader&&h.Z.uploader.showError(n),!!t})(r):"back"===n&&1===h.Z.type||"pdf"===n?a=pt(r):"mrz"===n||"back"===n?a=await dt(r):"barcode"===n&&(a=await ht(t)),h.Z.licenseKeyError&&((0,Ye.Z)(1),a=!1),Nt(),jn(),Ut(a),(0,Se.ud)(Zn)},qn=()=>{h.Z.currentStepImg=null,Nt(),jn(),(0,Se.ud)(Zn);h.Z.uploader&&h.Z.uploader.showError("fileType")},Qn=async e=>{if(Ft(),e.err)return void(0,Se.ud)(Zn);const t=Xn(e);(0,Se.E9)({name:Zn}),await Tt(t);const n=new Image;n.onload=()=>Kn(n,t),n.onerror=qn,h.Z.currentStepImg&&(n.src=h.Z.currentStepImg)};var Yn=a(1015);const Jn=()=>{window.tf=Yn};a(6810);var er=a(6090),tr=a(2512),nr=a(4518),rr=a(9365);const ar="return abs(x);";const sr={kernelName:f.SYM,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])&&"complex64"!==r.dtype){const e=n.texData.get(r.dataId),t=(0,tr.CJ)(e.values);return n.makeTensorInfo(r.shape,r.dtype,t)}let a;return a=(0,f.OBj)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new rr.cc(r.shape,ar):new nr.l(r.shape,ar),n.runWebGLProgram(a,[r],r.dtype)}};var or=a(5367);const ir=nr.D1+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n",lr=(0,or.AJ)({opSnippet:ir}),ur={kernelName:f.VGw,backendName:"webgl",kernelFunc:lr},cr=nr.D1+"\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));",dr=(0,or.AJ)({opSnippet:cr}),pr={kernelName:f.SpW,backendName:"webgl",kernelFunc:dr};var hr=a(7763);class fr{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map(((e,t)=>`T${t}`));const n=[];this.variableNames.forEach((e=>{n.push(`float v${e} = get${e}AtOutCoords();`)}));const r=this.variableNames.map((e=>`v${e}`)).join(" + ");this.userCode=`\n void main() {\n ${n.join("\n ")}\n\n float result = ${r};\n setOutput(result);\n }\n `}}class mr{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map(((e,t)=>`T${t}`));const n=[];this.variableNames.forEach((e=>{n.push(`vec4 v${e} = get${e}AtOutCoords();`)}));const r=this.variableNames.map((e=>`v${e}`)).join(" + ");this.userCode=`\n void main() {\n ${n.join("\n ")}\n\n vec4 result = ${r};\n setOutput(result);\n }\n `}}var gr=a(8955);const yr={kernelName:f.Xze,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:r}=t,a=n;if(1===a.length)return(0,gr.y)({inputs:{x:a[0]},backend:r});if(a.length>(0,f.OBj)().get("WEBGL_MAX_TEXTURES_IN_SHADER")){const t=Math.floor(a.length/2),n=e({inputs:a.slice(0,t),backend:r}),s=e({inputs:a.slice(t),backend:r});return e({inputs:[n,s],backend:r})}const s=a.map((e=>e.dtype)).reduce(((e,t)=>(0,f.x8V)(e,t))),o=a.map((e=>e.shape)),i=(0,f.OBj)().getBool("WEBGL_PACK")?new mr(a[0].shape,o):new fr(a[0].shape,o);return r.runWebGLProgram(i,a,s)}};var br=a(745),xr=a(8299),vr=a(2207);const wr={kernelName:f.oT6,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:o}=r,i=a.shape.length,l=f.D5U.parseAxisParam(s,a.shape);let u=l;const c=f.Wap.getAxesPermutation(u,i);let d=a;null!=c&&(d=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:c}}),u=f.Wap.getInnerMostAxes(u.length,i)),f.Wap.assertAxesAreInnerMostDims("all",u,i);const[p,h]=f.Wap.computeOutAndReduceShapes(d.shape,u),m=f.D5U.sizeFromShape(h),g=(0,xr.X)({inputs:{x:d},backend:n,attrs:{shape:[-1,m]}}),y=(0,br.u)(g,g.dtype,"all",n);let b;if(o){const e=f.Wap.expandShapeToKeepDim(p,l);b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:e}})}else b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),null!=c&&n.disposeIntermediateTensorInfo(d),b}};const Tr={kernelName:f.IKK,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:o}=r,i=a.shape.length,l=f.D5U.parseAxisParam(s,a.shape);let u=l;const c=f.Wap.getAxesPermutation(u,i);let d=a;null!=c&&(d=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:c}}),u=f.Wap.getInnerMostAxes(u.length,i)),f.Wap.assertAxesAreInnerMostDims("any",u,i);const[p,h]=f.Wap.computeOutAndReduceShapes(d.shape,u),m=f.D5U.sizeFromShape(h),g=(0,xr.X)({inputs:{x:d},backend:n,attrs:{shape:[-1,m]}}),y=(0,br.u)(g,g.dtype,"any",n);let b;if(o){const e=f.Wap.expandShapeToKeepDim(p,l);b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:e}})}else b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),null!=c&&n.disposeIntermediateTensorInfo(d),b}};class Sr{constructor(e,t,n){this.variableNames=["A"];const{windowSize:r,batchSize:a,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[a,s];const o="max"===t?">":"<",i=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${r};\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ${r}; i++) {\n int inIdx = ${i};\n float candidate = getA(batch, inIdx);\n if (candidate ${o} bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n `}}var Ar=a(1034),Cr=a(5156);class Ir{constructor(e,t,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,f.D5U.assert(e.length>2,(()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`));const a=e[e.length-1],s=Math.ceil(a/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),r||this.variableNames.push("bestIndicesA");const o=this.outputShape,i=o.length,l=(0,Cr.kW)(i),u=(0,Ar.Ky)("coords",i);let c,d;if(1===s){d=i+1;const e=(0,Cr.kW)(d);c=`\n ${e} sourceLocR = ${e}(${u.join()}, 0);\n ++${u[i-1]};\n ${e} sourceLocG = ${e}(${u.join()}, 0);\n ++${u[i-2]};\n ${e} sourceLocA = ${e}(${u.join()}, 0);\n --${u[i-1]};\n ${e} sourceLocB = ${e}(${u.join()}, 0);\n --${u[i-2]};`}else d=i,c=`\n ${l} sourceLocR = coords;\n ++${u[i-1]};\n ${l} sourceLocG = coords;\n ++${u[i-2]};\n ${l} sourceLocA = coords;\n --${u[i-1]};\n ${l} sourceLocB = coords;\n --${u[i-2]};`;const p=["x","y","z","w","u","v"].slice(0,d),h="."+p[d-1],m=p.map((e=>"int "+e)),g=(0,Ar.Ky)("sourceLocR",d-1).concat("inIdx.r"),y=(0,Ar.Ky)("sourceLocG",d-1).concat("inIdx.g"),b=(0,Ar.Ky)("sourceLocB",d-1).concat("inIdx.b"),x=(0,Ar.Ky)("sourceLocA",d-1).concat("inIdx.a"),v="max"===n?"greaterThan":"lessThan",w=r?"":`\n inIdx = round(vec4(getBestIndicesAChannel(${g.join()}),\n getBestIndicesAChannel(${y.join()}),\n getBestIndicesAChannel(${b.join()}),\n getBestIndicesAChannel(${x.join()})));`,T=`vec4(\n getAChannel(${g.join()}),\n hasNextCol ? getAChannel(${y.join()}) : 0.,\n hasNextRow ? getAChannel(${b.join()}) : 0.,\n hasNextRow && hasNextCol ? getAChannel(${x.join()}) : 0.)`,S=r?"":`\n float getBestIndicesAChannel(${m.join()}) {\n return getChannel(getBestIndicesA(${p.join()}),\n vec2(${p.slice(-2).join()}));\n }`;this.userCode=`\n float getAChannel(${m.join()}) {\n return getChannel(getA(${p.join()}),\n vec2(${p.slice(-2).join()}));\n }\n ${S}\n void main() {\n ${l} coords = getOutputCoords();\n bool hasNextCol = ${u[i-1]} < ${o[i-1]-1};\n bool hasNextRow = ${u[i-2]} < ${o[i-2]-1};\n ${c}\n ivec4 srcIdx = ivec4(sourceLocR${h}, sourceLocG${h},\n sourceLocB${h}, sourceLocA${h}) * ${t};\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ${T};\n\n for (int i = 0; i < ${t}; i++) {\n inIdx = srcIdx;\n ${w}\n vec4 candidate = ${T};\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(${v}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n `}}function kr(e,t,n,r=null){let a=t.shape[0],s=t.shape[1];null!=r&&(a=r.shape[0],s=r.shape[1]);const o=f.Wap.computeOptimalWindowSize(s),i={windowSize:o,inSize:s,batchSize:a,outSize:Math.ceil(s/o)},l=new Sr(i,n,null==r),u=[t];null!=r&&u.push(r);const c=e.runWebGLProgram(l,u,"int32");if(1===c.shape[1])return c;const d=kr(e,t,n,c);return e.disposeIntermediateTensorInfo(c),d}function Er(e,t,n,r=null){const a=null!=r?r.shape:t.shape,s=a[a.length-1],o=f.Wap.computeOptimalWindowSize(s),i=new Ir(a,o,n,null==r),l=null==r?[t]:[t,r],u=e.runWebGLProgram(i,l,"int32");if(u.shape.length===t.shape.length){const r=Er(e,t,n,u);return e.disposeIntermediateTensorInfo(u),r}return u}function Nr(e,t,n,r){const a=[n];if(f.Wap.assertAxesAreInnerMostDims("arg"+r.charAt(0).toUpperCase()+r.slice(1),a,t.shape.length),!(0,f.OBj)().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){const n=[],s=e.texData.get(t.dataId);let o=t;null!==s&&s.isPacked&&(o=e.unpackTensor(t),n.push(o));const[i,l]=f.Wap.computeOutAndReduceShapes(o.shape,a),u=f.D5U.sizeFromShape(l),c=(0,xr.X)({inputs:{x:o},backend:e,attrs:{shape:[-1,u]}});n.push(c);const d=kr(e,c,r);n.push(d);const p=(0,xr.X)({inputs:{x:d},backend:e,attrs:{shape:i}});return n.forEach((t=>e.disposeIntermediateTensorInfo(t))),p}return Er(e,t,r)}const Br={kernelName:f.sJF,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let o=f.D5U.parseAxisParam(s,a.shape);const i=f.Wap.getAxesPermutation(o,a.shape.length);let l=a;const u=[];null!=i&&(l=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:i}}),u.push(l),o=f.Wap.getInnerMostAxes(o.length,l.shape.length)),f.Wap.assertAxesAreInnerMostDims("argMax",[o[0]],l.shape.length);const c=Nr(n,l,o[0],"max");return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}};const Rr={kernelName:f.aJk,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let o=f.D5U.parseAxisParam(s,a.shape);const i=f.Wap.getAxesPermutation(o,a.shape.length);let l=a;const u=[];null!=i&&(l=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:i}}),u.push(l),o=f.Wap.getInnerMostAxes(o.length,l.shape.length)),f.Wap.assertAxesAreInnerMostDims("argMin",[o[0]],l.shape.length);const c=Nr(n,l,o[0],"min");return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}},Dr=nr.D1+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n",Mr=(0,or.AJ)({opSnippet:Dr}),Or={kernelName:f.M2y,backendName:"webgl",kernelFunc:Mr},Pr=nr.D1+"return log(x + sqrt(x * x + 1.0));",$r=(0,or.AJ)({opSnippet:Pr}),Fr={kernelName:f.qw7,backendName:"webgl",kernelFunc:$r},_r=nr.D1+"\n return atan(x);\n",Lr=(0,or.AJ)({opSnippet:_r}),Vr={kernelName:f.jMg,backendName:"webgl",kernelFunc:Lr};var Ur=a(4039),Gr=a(4488);const Wr=Ur.D1+"\n return atan(a, b);\n",zr="\n vec4 result = atan(a, b);\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+Gr.my+"\n return result;\n",Hr=(0,or.js)({opSnippet:Wr,packedOpSnippet:zr}),Zr={kernelName:f.QCc,backendName:"webgl",kernelFunc:Hr},jr=nr.D1+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;",Xr=(0,or.AJ)({opSnippet:jr}),Kr={kernelName:f.Oyi,backendName:"webgl",kernelFunc:Xr};var qr=a(789),Qr=a(1906);const Yr={kernelName:f.JhU,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;(0,Qr.assertNotComplex)(a,"avgPool");const{filterSize:s,strides:o,pad:i,dimRoundingMode:l}=r;f.D5U.assert(f.Wap.eitherStridesOrDilationsAreOne(o,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '1'`));const u=f.Wap.computePool2DInfo(a.shape,s,o,1,i,l);if(1===u.filterWidth&&1===u.filterHeight&&f.D5U.arraysEqual(u.inShape,u.outShape))return(0,gr.y)({inputs:{x:a},backend:n});const c=new qr.n(u,"avg",!1);return n.runWebGLProgram(c,[a],"float32")}};const Jr={kernelName:f._k9,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r,c=f.Wap.computePool3DInfo(a.shape,s,o,[1,1,1],i,l,u),d=new qr.I(c,"avg",!1);return n.runWebGLProgram(d,[a],"float32")}};class ea{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=e.dilationHeight,o=e.dilationWidth,i=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=i-1-e.padInfo.top,c=l-1-e.padInfo.left,d=1/(t*n);this.userCode=`\n const ivec2 pads = ivec2(${u}, ${c});\n const float avgMultiplier = float(${d});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${i};\n wR += ${s}) {\n float dyR = float(dyRCorner + wR) / ${r}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${l};\n wC+= ${o}) {\n float dyC = float(dyCCorner + wC) / ${a}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n `}}class ta{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,o=e.strideWidth,i=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,d=e.effectiveFilterHeight,p=e.effectiveFilterWidth,h=c-1-e.padInfo.front,f=d-1-e.padInfo.top,m=p-1-e.padInfo.left,g=1/(t*n*r);this.userCode=`\n const ivec3 pads = ivec3(${h}, ${f}, ${m});\n const float avgMultiplier = float(${g});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${c};\n wD += ${i}) {\n float dyD = float(dyDCorner + wD) / ${a}.0;\n\n if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${d};\n wR += ${l}) {\n float dyR = float(dyRCorner + wR) / ${s}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${p};\n wC += ${u}) {\n float dyC = float(dyCCorner + wC) / ${o}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const na={kernelName:f.IMb,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,o=s,{filterSize:i,strides:l,pad:u,dimRoundingMode:c}=r,d=f.Wap.computePool3DInfo(o.shape,i,l,[1,1,1],u,c),p=new ta(d);return n.runWebGLProgram(p,[a],o.dtype)}};const ra={kernelName:f.ROF,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,o=s;(0,Qr.assertNotComplex)([a,s],"avgPoolGrad");const{filterSize:i,strides:l,pad:u}=r,c=f.Wap.computePool2DInfo(o.shape,i,l,1,u),d=new ea(c);return n.runWebGLProgram(d,[a],o.dtype)}};var aa=a(8163);const sa={kernelName:f.XLW,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a,b:s}=t,{transposeA:o,transposeB:i}=r;return(0,aa.r)({a,b:s,transposeA:o,transposeB:i,backend:n})}};class oa{constructor(e,t,n,r,a,s){this.outputShape=[],this.variableNames=["x","mean","variance"],f.Wap.assertAndGetBroadcastShape(e,t),f.Wap.assertAndGetBroadcastShape(e,n);let o="0.0";null!=r&&(f.Wap.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let i="1.0";null!=a&&(f.Wap.assertAndGetBroadcastShape(e,a),this.variableNames.push("scale"),i="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ${o};\n float scale = ${i};\n float inv = scale * inversesqrt(variance + float(${s}));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n `}}class ia{constructor(e,t,n,r,a,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],f.Wap.assertAndGetBroadcastShape(e,t),f.Wap.assertAndGetBroadcastShape(e,n);let o="vec4(0.0)";null!=r&&(f.Wap.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let i="vec4(1.0)";null!=a&&(f.Wap.assertAndGetBroadcastShape(e,a),this.variableNames.push("scale"),i="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n void main() {\n vec4 offset = ${o};\n vec4 scale = ${i};\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(${s}));\n\n setOutput((x - mean) * inv + offset);\n }\n `}}const la={kernelName:f.sHE,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,mean:a,variance:s,offset:o,scale:i}=e;f.D5U.assert(a.shape.length===s.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),f.D5U.assert(null==o||a.shape.length===o.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),f.D5U.assert(null==i||a.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));let{varianceEpsilon:l}=n;null==l&&(l=.001);const u=[r,a,s];let c=null;null!=o&&(c=o.shape,u.push(o));let d=null;null!=i&&(d=i.shape,u.push(i));const p=(0,f.OBj)().getBool("WEBGL_PACK_NORMALIZATION")?new ia(r.shape,a.shape,s.shape,c,d,l):new oa(r.shape,a.shape,s.shape,c,d,l);return t.runWebGLProgram(p,u,u[0].dtype)}};class ua{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=(0,Cr.kW)(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=function(e){if(1===e)return"sourceLoc";if(e<=6)return ca.slice(0,e).map((e=>"sourceLoc."+e)).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}(this.rank);let r;r=`\n ${t} sourceLoc;\n ${t} coords = getOutputCoords();\n ${e.map(((e,t)=>`sourceLoc.${ca[t]} = start[${t}] + coords.${ca[t]};`)).join("\n")}\n `,this.userCode=`\n void main() {\n ${r}\n setOutput(getSource(${n}));\n }\n `}}const ca=["x","y","z","w","u","v"];class da{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=(0,Cr.kW)(this.rank),n=(0,Ar.Ky)("coords",this.rank),r=(0,Ar.Ky)("sourceLoc",this.rank),a=1===this.rank?"sourceLoc":`vec2(${r.slice(-2).join()})`,s=`getChannel(getSource(${r.join()}), ${a})`,o=`\n result.x = ${s};\n if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n ++${r[this.rank-1]};\n result.y = ${s};\n --${r[this.rank-1]};\n }\n `,i=1===this.rank?"":`\n --${n[this.rank-1]};\n if (++${n[this.rank-2]} < ${e[this.rank-2]}) {\n ++${r[this.rank-2]};\n result.z = ${s};\n if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n ++${r[this.rank-1]};\n result.w = ${s};\n }\n }\n `,l=this.rank<=4?`sourceLoc = coords +\n ${t}(${e.map(((e,t)=>`start[${t}]`)).join()});`:e.map(((e,t)=>`${r[t]} = ${n[t]} + start[${t}];`)).join("\n");this.userCode=`\n void main() {\n ${t} coords = getOutputCoords();\n ${t} sourceLoc;\n ${l}\n vec4 result = vec4(0.);\n ${o}\n ${i}\n setOutput(result);\n }\n `}}function pa(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:o}=r,[i,l]=f.kuN.parseSliceParams(a,s,o);if(f.kuN.assertParamsValid(a,i,l),0===f.D5U.sizeFromShape(l))return n.makeTensorInfo(l,a.dtype,[]);if(n.shouldExecuteOnCPU([a])||"string"===a.dtype){const e=n.texData.get(a.dataId),t=(0,tr.nT)(e.values,i,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,t)}const{isPacked:u}=n.texData.get(a.dataId),c=f.kuN.isSliceContinous(a.shape,i,l);if(u||!c){const e=(0,f.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new da(l):new ua(l),t=[i];return n.runWebGLProgram(e,[a],a.dtype,t)}return n.uploadToGPU(a.dataId),function(e,t,n,r){const a=r.texData.get(e.dataId),s=r.makeTensorInfo(n,e.dtype),o=r.texData.get(s.dataId);Object.assign(o,a),o.refCount=1,o.shape=n,o.dtype=e.dtype;let i=f.kuN.computeFlatOffset(t,f.D5U.computeStrides(e.shape));a.slice&&(i+=a.slice.flatOffset),o.slice={flatOffset:i,origDataId:a.slice&&a.slice.origDataId||e.dataId};const l=r.dataRefCount.get(o.slice.origDataId)||1;return r.dataRefCount.set(o.slice.origDataId,l+1),s}(a,i,l,n)}const ha={kernelName:f.p2w,backendName:"webgl",kernelFunc:pa},fa={kernelName:f.zws,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:o}=r;f.D5U.assert(a.shape.length<=4,(()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"));const i=s.reduce(((e,t)=>e*t)),l=f.Wap.getReshaped(a.shape,s,i),u=f.Wap.getPermuted(l.length,s.length),c=f.Wap.getReshapedPermuted(a.shape,s,i),d=f.Wap.getSliceBeginCoords(o,s.length),p=f.Wap.getSliceSize(c,o,s.length),h=[],m=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:l}}),g=(0,vr.p)({inputs:{x:m},backend:n,attrs:{perm:u}}),y=(0,xr.X)({inputs:{x:g},backend:n,attrs:{shape:c}}),b=pa({inputs:{x:y},backend:n,attrs:{begin:d,size:p}});return h.push(m),h.push(g),h.push(y),h.forEach((e=>n.disposeIntermediateTensorInfo(e))),b}};const ma={kernelName:f.zvY,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:o}=r,i=n.readSync(a.dataId),l=n.readSync(s.dataId),u=(0,tr.qO)(i,l,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,u)}};const ga={kernelName:f.eEB,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{s0:r,s1:a}=t,s=n.readSync(r.dataId),o=n.readSync(a.dataId),i=f.Wap.assertAndGetBroadcastShape(Array.from(s),Array.from(o));return n.makeTensorInfo([i.length],"int32",Int32Array.from(i))}};var ya=a(9709);const ba="return ceil(x);",xa=(0,or.AJ)({opSnippet:ba,packedOpSnippet:ba,cpuKernelImpl:tr.pk}),va={kernelName:f.gJX,backendName:"webgl",kernelFunc:xa};class wa{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "}}class Ta{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n "}}const Sa={kernelName:f.xnO,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{clipValueMin:s,clipValueMax:o}=r;let i;i=(0,f.OBj)().getBool("WEBGL_PACK_CLIP")?new Ta(a.shape):new wa(a.shape);const l=[[s],[o]];return n.runWebGLProgram(i,[a],a.dtype,l)}};var Aa=a(6515);class Ca{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "}}function Ia(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}const ka={kernelName:f.yj2,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=n.texData.get(r.dataId),s=new Ca(r.shape),o=[Ia(r,a.complexTensorInfos.real),Ia(r,a.complexTensorInfos.imag)];return n.runWebGLProgram(s,o,o[0].dtype)}};class Ea{constructor(e){this.outputShape=[],this.outputShape=f.Wap.computeOutShape(e,1),this.variableNames=e.map(((e,t)=>`T${t}`));const t=new Array(e.length-1);t[0]=e[0][1];for(let n=1;n<t.length;n++)t[n]=t[n-1]+e[n][1];const n=[`if (yC < ${t[0]}) setOutput(getT0(yR, yC));`];for(let e=1;e<t.length;e++){const r=t[e-1];n.push(`else if (yC < ${t[e]}) setOutput(getT${e}(yR, yC-${r}));`)}const r=t.length,a=t[t.length-1];n.push(`else setOutput(getT${r}(yR, yC-${a}));`),this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ${n.join("\n ")}\n }\n `}}class Na{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=f.Wap.computeOutShape(e,t);const n=this.outputShape,r=n.length,a=(0,Cr.kW)(r),s=(0,Ar.Ky)("coords",r),o=["x","y","z","w","u","v"].slice(0,r);this.variableNames=e.map(((e,t)=>`T${t}`));const i=new Array(e.length-1);i[0]=e[0][t];for(let n=1;n<i.length;n++)i[n]=i[n-1]+e[n][t];const l=o[t],u=o.slice(-2),c=o.join();let d=`if (${l} < ${i[0]}) {\n return getChannel(\n getT0(${c}), vec2(${u.join()}));\n }`;for(let e=1;e<i.length;e++){const t=i[e-1];d+=`\n if (${l} < ${i[e]} && ${l} >= ${i[e-1]}) {\n return getChannel(\n getT${e}(${Ba(o,l,t)}),\n vec2(${Ba(u,l,t)}));\n }`}const p=i.length,h=i[i.length-1];d+=`\n return getChannel(\n getT${p}(${Ba(o,l,h)}),\n vec2(${Ba(u,l,h)}));`,this.userCode=`\n float getValue(${o.map((e=>"int "+e))}) {\n ${d}\n }\n\n void main() {\n ${a} coords = getOutputCoords();\n vec4 result = vec4(getValue(${s}), 0., 0., 0.);\n\n ${s[r-1]} = ${s[r-1]} + 1;\n if (${s[r-1]} < ${n[r-1]}) {\n result.g = getValue(${s});\n }\n\n ${s[r-2]} = ${s[r-2]} + 1;\n if (${s[r-2]} < ${n[r-2]}) {\n result.a = getValue(${s});\n }\n\n ${s[r-1]} = ${s[r-1]} - 1;\n if (${s[r-2]} < ${n[r-2]} &&\n ${s[r-1]} < ${n[r-1]}) {\n result.b = getValue(${s});\n }\n setOutput(result);\n }\n `}}function Ba(e,t,n){const r=e.indexOf(t);return e.map(((e,t)=>t===r?`${e} - ${n}`:e)).join()}function Ra(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.texData.get(r.dataId);return(0,gr.y)({inputs:{x:a.complexTensorInfos.imag},backend:n})}const Da={kernelName:f.J_u,backendName:"webgl",kernelFunc:Ra};var Ma=a(852);function Oa(e,t,n){const r=e[0].dtype;if("complex64"===r){const r=e.map((e=>(0,Ma.k)({inputs:{input:e},backend:n}))),a=e.map((e=>Ra({inputs:{input:e},backend:n}))),s=Oa(r,t,n),o=Oa(a,t,n),i=(0,Aa.P)({inputs:{real:s,imag:o},backend:n});return r.forEach((e=>n.disposeIntermediateTensorInfo(e))),a.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(o),i}let a=n.shouldExecuteOnCPU(e);if("string"===r&&(a=!0),a){const a=e.map((e=>{const r=[-1,f.D5U.sizeFromShape(e.shape.slice(t))];return(0,xr.X)({inputs:{x:e},backend:n,attrs:{shape:r}})})),s=a.map((e=>({vals:n.readSync(e.dataId),shape:e.shape}))),o=f.Wap.computeOutShape(a.map((e=>e.shape)),1),i=1===a[0].shape[0],l=(0,tr.n7)(s,o,r,i),u=f.Wap.computeOutShape(e.map((e=>e.shape)),t),c=n.makeTensorInfo(u,r,l);return a.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}const s=(0,f.OBj)().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(e.length>s){const r=[];for(let a=0;a<e.length;a+=s){const o=e.slice(a,a+s);r.push(Oa(o,t,n))}const a=Oa(r,t,n);for(const e of r)n.disposeIntermediateTensorInfo(e);return a}if((0,f.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){const a=new Na(e.map((e=>e.shape)),t);return n.runWebGLProgram(a,e,r)}const{tensors2D:o,outShape:i}=function(e,t,n){const r=f.Wap.computeOutShape(e.map((e=>e.shape)),t);return{tensors2D:e.map((e=>(0,xr.X)({inputs:{x:e},attrs:{shape:[-1,f.D5U.sizeFromShape(e.shape.slice(t))]},backend:n}))),outShape:r}}(e,t,n),l=new Ea(o.map((e=>e.shape))),u=n.runWebGLProgram(l,o,r);o.forEach((e=>n.disposeIntermediateTensorInfo(e)));const c=(0,xr.X)({inputs:{x:u},attrs:{shape:i},backend:n});return n.disposeIntermediateTensorInfo(u),c}function Pa(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=f.D5U.parseAxisParam(a,t[0].shape)[0],o=t.map((e=>e.shape));f.Wap.assertParamsConsistent(o,s);const i=f.Wap.computeOutShape(t.map((e=>e.shape)),s);if(0===f.D5U.sizeFromShape(i))return n.makeTensorInfo(i,t[0].dtype,[]);const l=t.filter((e=>f.D5U.sizeFromShape(e.shape)>0));return 1===l.length?(0,gr.y)({inputs:{x:l[0]},backend:n}):Oa(l,s,n)}const $a={kernelName:f.Eh3,backendName:"webgl",kernelFunc:Pa};var Fa=a(8954),_a=a(2734),La=a(7842);const Va={kernelName:f.mhS,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:o,pad:i,dataFormat:l,dilations:u,dimRoundingMode:c}=r,d=f.Wap.convertConv2DDataFormat(l),p=f.Wap.computeConv2DInfo(a.shape,s.shape,o,u,i,c,!1,d);let h;if(1!==p.filterHeight||1!==p.filterWidth||1!==p.dilationHeight||1!==p.dilationWidth||1!==p.strideHeight||1!==p.strideWidth||"SAME"!==p.padInfo.type&&"VALID"!==p.padInfo.type)if(p.strideWidth<=2&&"channelsLast"===d&&(0,f.OBj)().getBool("WEBGL_EXP_CONV")){const e=new _a.i(p),t=[[p.padInfo.top,p.padInfo.left],[p.strideHeight,p.strideWidth],[p.dilationHeight,p.dilationWidth],[p.inHeight,p.inWidth]];h=n.runWebGLProgram(e,[a,s],"float32",t)}else if((0,f.OBj)().getBool("WEBGL_CONV_IM2COL"))h=(0,La.Y)({x:a,filter:s,convInfo:p,backend:n});else{const e=new Fa.I(p);h=n.runWebGLProgram(e,[a,s],"float32")}else h=(0,La.n)({x:a,filter:s,convInfo:p,backend:n});const m=(0,xr.X)({inputs:{x:h},backend:n,attrs:{shape:p.outShape}});return n.disposeIntermediateTensorInfo(h),m}};class Ua{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,s="channelsLast"===e.dataFormat;this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < ${e.batchSize}; b++) {\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${t} - ${r};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${n} - ${a};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n if (${s}) {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class Ga{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s="channelsLast"===e.dataFormat,o=t-1-e.padInfo.top,i=n-1-e.padInfo.left,l=s?1:2,u=s?2:3,c=s?3:1;this.userCode=`\n const ivec2 pads = ivec2(${o}, ${i});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[${c}];\n\n ivec2 dyCorner = ivec2(coords[${l}], coords[${u}]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${t}; wR++) {\n float dyR = float(dyRCorner + wR) / ${r}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${t} - 1 - wR;\n\n for (int wC = 0; wC < ${n}; wC++) {\n float dyC = float(dyCCorner + wC) / ${a}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${n} - 1 - wC;\n\n for (int d2 = 0; d2 < ${e.outChannels}; d2++) {\n\n if (${s}) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class Wa{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.padInfo.front,s=e.padInfo.top,o=e.padInfo.left;this.userCode=`\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < ${e.batchSize}; b++) {\n for (int yF = 0; yF < ${e.outDepth}; yF++) {\n int xF = wF + yF * ${t} - ${a};\n\n if (xF < 0 || xF >= ${e.inDepth}) {\n continue;\n }\n\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${n} - ${s};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${r} - ${o};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class za{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,o=e.strideWidth,i=t-1-e.padInfo.front,l=n-1-e.padInfo.top,u=r-1-e.padInfo.left;this.userCode=`\n const ivec3 pads = ivec3(${i}, ${l}, ${u});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < ${t}; wF++) {\n float dyF = float(dyFCorner + wF) / ${a}.0;\n\n if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ${t} - 1 - wF;\n\n for (int wR = 0; wR < ${n}; wR++) {\n float dyR = float(dyRCorner + wR) / ${s}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${n} - 1 - wR;\n\n for (int wC = 0; wC < ${r}; wC++) {\n float dyC = float(dyCCorner + wC) / ${o}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${r} - 1 - wC;\n\n for (int d2 = 0; d2 < ${e.outChannels}; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const Ha={kernelName:f.wUP,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:o,pad:i,dataFormat:l,dimRoundingMode:u,filterShape:c}=r,d=f.Wap.convertConv2DDataFormat(l),p=f.Wap.computeConv2DInfo(a.shape,c,o,1,i,u,!1,d),h=new Ua(p);return n.runWebGLProgram(h,[a,s],"float32")}};const Za={kernelName:f.wm,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{inputShape:o,strides:i,pad:l,dataFormat:u,dimRoundingMode:c}=r,d=f.Wap.convertConv2DDataFormat(u),p=f.Wap.computeConv2DInfo(o,s.shape,i,1,l,c,!1,d),h=new Ga(p);return n.runWebGLProgram(h,[a,s],"float32")}};const ja={kernelName:f.x12,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:o,pad:i,dilations:l}=r,u=f.Wap.computeConv3DInfo(a.shape,s.shape,o,l,i),c=new Fa.S(u);return n.runWebGLProgram(c,[a,s],"float32")}};const Xa={kernelName:f.o2y,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:o,pad:i,filterShape:l}=r,u=f.Wap.computeConv3DInfo(a.shape,l,o,1,i),c=new Wa(u);return n.runWebGLProgram(c,[a,s],"float32")}};const Ka={kernelName:f.ik2,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{pad:o,strides:i,inputShape:l}=r,u=f.Wap.computeConv3DInfo(l,s.shape,i,1,o),c=new za(u);return n.runWebGLProgram(c,[a,s],"float32")}},qa=or.E6+"\n return cos(x);\n",Qa=(0,or.AJ)({opSnippet:qa}),Ya={kernelName:f.mc4,backendName:"webgl",kernelFunc:Qa},Ja=(0,or.AJ)({opSnippet:"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n"}),es={kernelName:f.TR1,backendName:"webgl",kernelFunc:Ja};class ts{constructor(e,t,n,r,a){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[s,o,i,l]=e,[u]=t,[c,d]=n;this.outputShape=[u,c,d,l];const p="bilinear"===r?1:0,[h,f]=[o-1+".0",i-1+".0"],[m,g,y]=c>1?[""+(o-1)/(c-1),"(y2-y1) * height_ratio",`y1*${h} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${h}`],[b,x,v]=d>1?[""+(i-1)/(d-1),"(x2-x1) * width_ratio",`x1*${f} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${f}`];this.userCode=`\n const float height_ratio = float(${m});\n const float width_ratio = float(${b});\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= ${s}) {\n return;\n }\n\n float height_scale = ${g};\n float width_scale = ${x};\n\n float in_y = ${y};\n if( in_y < 0.0 || in_y > ${h} ) {\n setOutput(float(${a}));\n return;\n }\n float in_x = ${v};\n if( in_x < 0.0 || in_x > ${f} ) {\n setOutput(float(${a}));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(${p} == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n `}}const ns={kernelName:f.VcC,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{image:a,boxes:s,boxInd:o}=t,{cropSize:i,method:l,extrapolationValue:u}=r,c=new ts(a.shape,s.shape,i,l,u);return n.runWebGLProgram(c,[a,s,o],"float32")}};var rs;!function(e){e.Prod="*",e.Sum="+"}(rs||(rs={}));class as{constructor(e,t,n,r){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const a=this.outputShape.length,s=this.op===rs.Prod?"1.0":"0.0",o=n?s:`getX(${ss(a,"coords",this.op)})`,i=this.outputShape[this.outputShape.length-1];let l="",u="";n?(l=r?"end != "+(i-1):"end != 0",u=r?"end + 1":"end - 1"):(l=r?`end + pow2 < ${i}`:"end >= pow2",u=r?"end + pow2":"end - pow2"),this.userCode=`\n void main() {\n ${(0,Cr.kW)(a)} coords = getOutputCoords();\n int end = ${os(a,"coords",this.op)};\n float val = ${o};\n int pow2 = int(pow(2.0, index));\n if (${l}) {\n int idx = ${u};\n ${os(a,"coords",this.op)} = idx;\n val ${this.op}= getX(${ss(a,"coords",this.op)});\n }\n setOutput(val);\n }\n `}}function ss(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.x, ${t}.y`;if(3===e)return`${t}.x, ${t}.y, ${t}.z`;if(4===e)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function os(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.y`;if(3===e)return`${t}.z`;if(4===e)return`${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function is(e,t,n,r,a,s){const o=t.shape.length,i=f.Wap.getAxesPermutation([r],o);let l=t;null!=i&&(l=(0,vr.p)({inputs:{x:t},backend:n,attrs:{perm:i}}));const u=f.Wap.getInnerMostAxes(1,o)[0];if(u!==o-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${t.shape.length-1} but got axis=${r}`);const c=l.shape[u];let d=(0,gr.y)({inputs:{x:l},backend:n});for(let t=0;t<=Math.ceil(Math.log2(c))-1;t++){const r=new as(e,l.shape,!1,s),a=[[t]],o=d;d=n.runWebGLProgram(r,[d],d.dtype,a),n.disposeIntermediateTensorInfo(o)}if(a){const t=new as(e,l.shape,a,s),r=d;d=n.runWebGLProgram(t,[d],d.dtype),n.disposeIntermediateTensorInfo(r)}if(null!=i){const e=f.Wap.getUndoAxesPermutation(i),t=(0,vr.p)({inputs:{x:d},backend:n,attrs:{perm:e}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(l),t}return d}const ls={kernelName:f.Byc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:o,reverse:i}=r;return is(rs.Prod,a,n,s,o,i)}};const us={kernelName:f.iHb,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:o,reverse:i}=r;return is(rs.Sum,a,n,s,o,i)}};const cs={kernelName:f.QRR,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:o,binaryOutput:i}=r;if(1===a.shape.length){const e=n.readSync(a.dataId),t=n.readSync(s.dataId),r=(0,tr.qO)(e,t,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,r)}if(2===a.shape.length){const e=n.bufferSync(a),t=n.bufferSync(s),r=(0,tr.cx)(e,t,o,i);return n.makeTensorInfo(r.shape,s.dtype,r.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${a.shape.length}.`)}};class ds{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = ${this.getHeightCoordString()};\n int w = ${this.getWidthCoordString()};\n int d = ${this.getDepthCoordString()};\n\n int in_h = h / ${t};\n int offset_h = imod(h, ${t});\n int in_w = w / ${t};\n int offset_w = imod(w, ${t});\n int offset_d = (offset_h * ${t} + offset_w) *\n ${this.getOutputDepthSize()};\n int in_d = d + offset_d;\n\n float result = ${this.getInputSamplingString()};\n setOutput(result);\n }\n `}getHeightCoordString(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"}getWidthCoordString(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"}getDepthCoordString(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"}getOutputDepthSize(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}const ps={kernelName:f.T0n,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockSize:s,dataFormat:o}=r,i=a.shape[0],l=("NHWC"===o?a.shape[1]:a.shape[2])*s,u=("NHWC"===o?a.shape[2]:a.shape[3])*s,c=("NHWC"===o?a.shape[3]:a.shape[1])/(s*s),d=new ds("NHWC"===o?[i,l,u,c]:[i,c,l,u],s,o);return n.runWebGLProgram(d,[a],a.dtype)}};var hs=a(5710);class fs{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * ${s} + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ${e.batchSize}; b++) {\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${t} - ${r};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${n} - ${a};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class ms{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=t-1-e.padInfo.top,o=n-1-e.padInfo.left,i=e.outChannels/e.inChannels;this.userCode=`\n const ivec2 pads = ivec2(${s}, ${o});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < ${t}; wR++) {\n float dyR = float(dyRCorner + wR) / ${r}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${t} - 1 - wR;\n\n for (int wC = 0; wC < ${n}; wC++) {\n float dyC = float(dyCCorner + wC) / ${a}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${n} - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ${i}; dm++) {\n int d2 = d1 * ${i} + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const gs={kernelName:f.sL$,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:o,dilations:i,pad:l,dimRoundingMode:u,filterShape:c}=r,d=f.Wap.computeConv2DInfo(a.shape,c,o,i,l,u,!0),p=new fs(d);return n.runWebGLProgram(p,[a,s],"float32")}};const ys={kernelName:f.y7R,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{strides:o,dilations:i,pad:l,dimRoundingMode:u,inputShape:c}=r,d=f.Wap.computeConv2DInfo(c,s.shape,o,i,l,u,!0),p=new ms(d);return n.runWebGLProgram(p,[a,s],"float32")}};class bs{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "}}const xs={kernelName:f.$w,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=[...r.shape,...r.shape],s=f.D5U.sizeFromShape(r.shape),o=(0,xr.X)({inputs:{x:r},backend:n,attrs:{shape:[s]}}),i=new bs(s),l=n.runWebGLProgram(i,[o],o.dtype),u=(0,xr.X)({inputs:{x:l},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}};class vs{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:n,padInfo:r,strideHeight:a,strideWidth:s,filterHeight:o,filterWidth:i,dilationHeight:l,dilationWidth:u}=e,{top:c,left:d}=r;this.userCode=`\n const ivec2 strides = ivec2(${a}, ${s});\n const ivec2 pads = ivec2(${c}, ${d});\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ${o}; h++) {\n int hIn = hBeg + h * ${l};\n\n if (hIn >= 0 && hIn < ${t}) {\n for (int w = 0; w < ${i}; w++) {\n int wIn = wBeg + w * ${u};\n\n if (wIn >= 0 && wIn < ${n}) {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n `}}const ws={kernelName:f.p4S,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:o,pad:i,dilations:l}=r,u=f.Wap.computeDilation2DInfo(a.shape,s.shape,o,i,"NHWC",l);let c;const d=new vs(u);c=n.runWebGLProgram(d,[a,s],"float32");const p=(0,xr.X)({inputs:{x:c},backend:n,attrs:{shape:u.outShape}});return n.disposeIntermediateTensorInfo(c),p}};var Ts=a(106),Ss=a(3255);const As={kernelName:f.$g6,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:o,summedDims:i,idDims:l}=f.Wap.decodeEinsumEquation(a,s.length);f.Wap.checkEinsumDimSizes(o.length,l,s);const{path:u,steps:c}=f.Wap.getEinsumComputePath(i,l),d=c.length;let p=null,h=o.length;const m=[];for(let e=0;e<d;++e){for(const t of c[e]){const{permutationIndices:e,expandDims:r}=f.Wap.getEinsumPermutation(h,l[t]);let a;f.Wap.isIdentityPermutation(e)?a=s[t]:(a=(0,vr.p)({inputs:{x:s[t]},backend:n,attrs:{perm:e}}),m.push(a));const o=a.shape.slice();for(let e=0;e<r.length;++e)o.splice(r[e],0,1);f.D5U.arraysEqual(a.shape,o)||(a=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:o}}),m.push(a)),null===p?p=a:(p=(0,Ts.J)({inputs:{a,b:p},backend:n}),m.push(p))}e<d-1&&(u[e]>=0&&(p=(0,Ss.S)({inputs:{x:p},backend:n,attrs:{axis:u[e]-(o.length-h),keepDims:!1}}),m.push(p)),h--)}for(const e of m)e!==p&&n.disposeIntermediateTensorInfo(e);return p}},Cs=(0,or.AJ)({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:"\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n"}),Is={kernelName:f.SX0,backendName:"webgl",kernelFunc:Cs},ks={kernelName:f.HEU,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n}=e,{dy:r,y:a}=t,s=(0,f.OBj)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr.E2("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",r.shape,a.shape):new Ur.t6("return (b >= 1.0) ? a : a * (b + 1.0);",r.shape,a.shape);return n.runWebGLProgram(s,[r,a],r.dtype)}},Es=(0,or.js)({opSnippet:"return float(a == b);",packedOpSnippet:"\n return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:tr.gv}),Ns={kernelName:f.hdR,backendName:"webgl",kernelFunc:Es},Bs=`\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = ${f.Wap.ERF_P};\n float a1 = ${f.Wap.ERF_A1};\n float a2 = ${f.Wap.ERF_A2};\n float a3 = ${f.Wap.ERF_A3};\n float a4 = ${f.Wap.ERF_A4};\n float a5 = ${f.Wap.ERF_A5};\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n`,Rs=(0,or.AJ)({opSnippet:Bs}),Ds={kernelName:f.Omj,backendName:"webgl",kernelFunc:Rs};var Ms=a(3041),Os=a(6623);const Ps="return exp(x) - 1.0;",$s=(0,or.AJ)({opSnippet:Ps,packedOpSnippet:Ps,cpuKernelImpl:tr.tx}),Fs={kernelName:f.Y0y,backendName:"webgl",kernelFunc:$s};class _s{constructor(e,t,n){this.variableNames=["real","imag"];const r=t[1];this.outputShape=t;const a=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${r}.0`:"1.0";let o;if("real"===e)o="return real * expR - imag * expI;";else{if("imag"!==e)throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);o="return real * expI + imag * expR;"}this.userCode=`\n const float exponentMultiplier = ${a};\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ${o}\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(${r});\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ${r}; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / ${s};\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n `}}function Ls(e,t,n){const r=n.texData.get(e.dataId),a=f.D5U.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],o=a/s,i=(0,xr.X)({inputs:{x:e},backend:n,attrs:{shape:[o,s]}}),l=i.shape,u=new _s("real",l,t),c=new _s("imag",l,t),d=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:l},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:l}],p=n.runWebGLProgram(u,d,"float32"),h=n.runWebGLProgram(c,d,"float32"),m=(0,Aa.P)({inputs:{real:p,imag:h},backend:n});n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h);const g=(0,xr.X)({inputs:{x:m},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(m),g}const Vs={kernelName:f.vwp,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t;return Ls(r,!1,n)}};var Us=a(853);class Gs{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ${t} - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ${t}) {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n `}}const Ws={kernelName:f.Uyb,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{const{image:n}=e,r=t,a=new Gs(n.shape);return r.runWebGLProgram(a,[n],n.dtype)}},zs="return floor(x);",Hs=(0,or.AJ)({opSnippet:zs,packedOpSnippet:zs,cpuKernelImpl:tr.MZ}),Zs={kernelName:f.OR,backendName:"webgl",kernelFunc:Hs},js=(0,or.js)({opSnippet:"\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",packedOpSnippet:"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n",dtype:"int32"}),Xs={kernelName:f.jeX,backendName:"webgl",kernelFunc:js};var Ks=a(619),qs=a(7650),Qs=a(2812);class Ys{constructor(e,t,n,r){this.sliceDim=e,this.strides=t,this.paramsShape=r,this.variableNames=["x","indices"],this.outputShape=n;const a=(0,Cr.kW)(n.length);let s="\n int index;";for(let e=0;e<this.sliceDim;e++)s+=`\n index = round(getIndices(coords[0], ${e}));\n out_of_bounds = out_of_bounds || index < 0;\n out_of_bounds = out_of_bounds || index >= ${this.paramsShape[e]};\n flattenIndex += index * ${this.strides[e]};`;this.userCode=`\n void main() {\n ${a} coords = getOutputCoords();\n int flattenIndex = 0;\n bool out_of_bounds = false;\n\n ${s}\n\n setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n }\n `}}const Js={kernelName:f.q1x,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{params:r,indices:a}=t,s=a.shape,o=s[s.length-1],i=f.D5U.sizeFromShape(r.shape),[l,u,c,d]=f.Wap.prepareAndValidate(r,a),p=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:[u,o]}}),h=(0,xr.X)({inputs:{x:r},backend:n,attrs:{shape:[f.D5U.sizeFromShape(r.shape)/c,c]}});if(n.shouldExecuteOnCPU([r,a])||"string"===r.dtype){const e=n.readSync(a.dataId),t=n.bufferSync(r),s=(0,tr.TD)(e,t,r.dtype,u,o,c,d,r.shape,i);return n.makeTensorInfo(l,r.dtype,s.values)}const m=new Ys(o,d,[u,c],r.shape),g=n.runWebGLProgram(m,[h,p],h.dtype),y=(0,xr.X)({inputs:{x:g},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(g),y}};class eo{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;const n=(0,Cr.kW)(this.rank),r=function(e,t){const n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[];for(let t=0;t<e.length;t++)2===t?r.push("index"):r.push(`${n[t]}`);return r.join()}(e);this.userCode=`\n void main() {\n ${n} resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ${e[2]}) ? 1.0 : 0.0;\n setOutput(inBounds * getA(${r}));\n }\n `}}function to(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:o,batchDims:i}=r,l=f.D5U.parseAxisParam(o,a.shape)[0];if((0,f.OBj)().get("DEBUG")){const e=n.readSync(s.dataId),t=a.shape[l];for(let n=0;n<e.length;++n){const r=e[n];f.D5U.assert(r<=t-1&&r>=0,(()=>`GatherV2: the index value ${r} is not in [0, ${t-1}]`))}}const u=f.Wap.segment_util.collectGatherOpShapeInfo(a,s,l,i),c=f.D5U.sizeFromShape(s.shape),d=[],p=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]}}),h=(0,xr.X)({inputs:{x:s},backend:n,attrs:{shape:[u.batchSize,c/u.batchSize]}});d.push(p),d.push(h);const m=[u.batchSize,u.outerSize,c/u.batchSize,u.sliceSize];if(n.shouldExecuteOnCPU([a,s])||"string"===a.dtype){const e=n.bufferSync(h),t=n.bufferSync(p),r=(0,tr.m$)(t,e,m);return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(u.outputShape,r.dtype,r.values)}const g=new eo(p.shape,m),y=n.runWebGLProgram(g,[p,h],p.dtype);d.push(y);const b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:u.outputShape}});return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),b}const no={kernelName:f.qi_,backendName:"webgl",kernelFunc:to},ro=(0,or.js)({opSnippet:"return float(a > b);",packedOpSnippet:"\n return vec4(greaterThan(a, b));\n",cpuKernelImpl:tr.B_,dtype:"bool"}),ao={kernelName:f.iZT,backendName:"webgl",kernelFunc:ro},so=(0,or.js)({opSnippet:"return float(a >= b);",packedOpSnippet:"\n return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:tr.ji}),oo={kernelName:f.Acj,backendName:"webgl",kernelFunc:so};const io={kernelName:f.Qg5,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t;return Ls(r,!0,n)}},lo=(0,or.AJ)({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),uo={kernelName:f.avt,backendName:"webgl",kernelFunc:lo},co=(0,or.AJ)({opSnippet:"return float(isinf(x));",dtype:"bool"}),po={kernelName:f.iWB,backendName:"webgl",kernelFunc:co},ho=(0,or.AJ)({opSnippet:"return float(isnan(x));",dtype:"bool"}),fo={kernelName:f.r7n,backendName:"webgl",kernelFunc:ho};var mo=a(1736);const go=(0,or.js)({opSnippet:"return float(a < b);",packedOpSnippet:"\n return vec4(lessThan(a, b));\n",cpuKernelImpl:tr.kY,dtype:"bool"}),yo={kernelName:f.vtC,backendName:"webgl",kernelFunc:go},bo=(0,or.js)({opSnippet:"return float(a <= b);",packedOpSnippet:"\n return vec4(lessThanEqual(a, b));\n",cpuKernelImpl:tr.Rn,dtype:"bool"}),xo={kernelName:f.CAk,backendName:"webgl",kernelFunc:bo};const vo={kernelName:f.e7N,backendName:"webgl",kernelFunc:function(e){const{backend:t,attrs:n}=e,{start:r,stop:a,num:s}=n,o=(0,tr.PQ)(r,a,s);return t.makeTensorInfo([o.length],"float32",o)}},wo=or.E6+"\n return x < 0.0 ? 0./0. : log(x);\n",To=(0,or.AJ)({opSnippet:wo,packedOpSnippet:"\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n",cpuKernelImpl:tr.Sd}),So={kernelName:f.ZbH,backendName:"webgl",kernelFunc:To},Ao=or.E6+"\n return log(1.0 + x);\n",Co=(0,or.AJ)({opSnippet:Ao}),Io={kernelName:f.kU,backendName:"webgl",kernelFunc:Co},ko=(0,or.js)({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n",dtype:"bool"}),Eo={kernelName:f.PYm,backendName:"webgl",kernelFunc:ko},No=(0,or.AJ)({opSnippet:"return float(!(x >= 1.0));"}),Bo={kernelName:f.VfG,backendName:"webgl",kernelFunc:No},Ro=(0,or.js)({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n",dtype:"bool"}),Do={kernelName:f.MZg,backendName:"webgl",kernelFunc:Ro};class Mo{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[];const s=t,o=e[3]-1;let i;this.outputShape=e;const l=`float(${n}) + float(${r}) * sum`;i=.5===a?`inversesqrt(${l})`:1===a?`1.0/(${l})`:`exp(log(${l}) * float(-${a}));`,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -${s}; j <= ${s}; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ${o}) {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ${i};\n setOutput(val);\n }\n `}}class Oo{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const s=t,o=e[3]-1;let i;this.outputShape=e;const l=`float(${n}) + float(${r}) * sum`;i=.5===a?`inversesqrt(${l})`:1===a?`1.0/(${l})`:`exp(log(${l}) * float(-${a}));`,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ${this.outputShape[3]};\n bool hasNextRow = c < ${this.outputShape[2]};\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ${s};\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ${s}; j <= ${s}; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${o}));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ${i};\n setOutput(result);\n }\n `}}const Po={kernelName:f.eZ0,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{depthRadius:s,bias:o,alpha:i,beta:l}=r,u=(0,f.OBj)().getBool("WEBGL_PACK_NORMALIZATION")?new Oo(a.shape,s,o,i,l):new Mo(a.shape,s,o,i,l);return n.runWebGLProgram(u,[a],a.dtype)}};class $o{constructor(e,t,n,r,a){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=r,this.beta=a,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < ${this.depth}; ++d) {\n int depthBegin = int(max(0.0, float(d - ${t})));\n int depthEnd = int(min(float(${this.depth}),\n float(d + ${t} + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ${this.depth};\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float(${r}) * norm + float(${n});\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float(${r})\n * float(${a})\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ${a});\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n `}}const Fo={kernelName:f.Hhh,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a,y:s,dy:o}=t,{depthRadius:i,bias:l,alpha:u,beta:c}=r,d=new $o(a.shape,i,l,u,c);return n.runWebGLProgram(d,[a,s,o],a.dtype)}};var _o=a(2489);const Lo=Ur.D1+"\n return max(a, b);\n",Vo="\n vec4 result = vec4(max(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+Gr.my+"\n return result;\n",Uo=(0,or.js)({opSnippet:Lo,packedOpSnippet:Vo,cpuKernelImpl:tr.nL}),Go={kernelName:f.BMI,backendName:"webgl",kernelFunc:Uo};var Wo=a(2079);const zo={kernelName:f.OAf,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:o,pad:i,dataFormat:l,dimRoundingMode:u}=r,c=f.Wap.computePool3DInfo(a.shape,s,o,[1,1,1],i,u,l),d=new qr.I(c,"max",!1);return n.runWebGLProgram(d,[a],a.dtype)}};class Ho{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,n=e.strideWidth,r=e.dilationHeight,a=e.effectiveFilterHeight,s=e.effectiveFilterWidth,o=a-1-e.padInfo.top,i=s-1-e.padInfo.left,l=a*s-1;this.userCode=`\n const ivec2 pads = ivec2(${o}, ${i});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${a};\n wR += ${r}) {\n float dyR = float(dyRCorner + wR) / ${t}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${s}; wC++) {\n float dyC = float(dyCCorner + wC) / ${n}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = ${l} - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * ${s} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n `}}class Zo{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,o=e.dilationWidth,i=e.effectiveFilterDepth,l=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=i-1-e.padInfo.front,d=l-1-e.padInfo.top,p=u-1-e.padInfo.left,h=i*l*u-1;this.userCode=`\n const ivec3 pads = ivec3(${c}, ${d}, ${p});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${i};\n wD += ${a}) {\n float dyD = float(dyDCorner + wD) / ${t}.0;\n\n if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${l};\n wR += ${s}) {\n float dyR = float(dyRCorner + wR) / ${n}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${u};\n wC += ${o}) {\n float dyC = float(dyCCorner + wC) / ${r}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ${h} -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ${l} * ${u} +\n wR * ${u} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const jo={kernelName:f.OU7,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,o=s,{filterSize:i,strides:l,pad:u,dimRoundingMode:c}=r,d=f.Wap.computePool3DInfo(o.shape,i,l,[1,1,1],u,c),p=new qr.I(d,"max",!0),h=n.runWebGLProgram(p,[o],o.dtype),m=new Zo(d),g=n.runWebGLProgram(m,[a,h],o.dtype);return n.disposeIntermediateTensorInfo(h),g}};const Xo={kernelName:f.OV7,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:o}=t,i=s;(0,Qr.assertNotComplex)([s,o],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,p=f.Wap.computePool2DInfo(i.shape,l,u,1,c,d),h=new qr.n(p,"max",!0),m=n.runWebGLProgram(h,[i],i.dtype),g=new Ho(p),y=n.runWebGLProgram(g,[a,m],i.dtype);return n.disposeIntermediateTensorInfo(m),y}};const Ko={kernelName:f.vFR,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{filterSize:a,strides:s,pad:o,includeBatchInIndex:i}=t,l=n;f.D5U.assert(4===r.shape.length,(()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`));const u=[1,1];f.D5U.assert(f.Wap.eitherStridesOrDilationsAreOne(s,u),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${u}'`));const c=f.Wap.computePool2DInfo(r.shape,a,s,u,o),[d,p]=function(e,t,n,r){let a=new qr.n(n,"max",!1);const s=r.runWebGLProgram(a,[e],"float32");return a=new qr.n(n,"max",!0,!0,t),[s,r.runWebGLProgram(a,[e],"float32")]}(r,i,c,l);return[d,p]}};var qo=a(5452);const Qo={kernelName:f.c17,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:o}=r,i=a.shape.length,l=f.D5U.parseAxisParam(s,a.shape);let u=l;const c=f.Wap.getAxesPermutation(u,i);let d=a;null!=c&&(d=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:c}}),u=f.Wap.getInnerMostAxes(u.length,a.shape.length)),f.Wap.assertAxesAreInnerMostDims("min",u,i);const[p,h]=f.Wap.computeOutAndReduceShapes(d.shape,u),m=f.D5U.sizeFromShape(h),g=(0,xr.X)({inputs:{x:d},backend:n,attrs:{shape:[-1,m]}}),y=(0,br.u)(g,g.dtype,"min",n);let b;if(o){const e=f.Wap.expandShapeToKeepDim(p,l);b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:e}})}else b=(0,xr.X)({inputs:{x:y},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),null!=c&&n.disposeIntermediateTensorInfo(d),b}},Yo=Ur.D1+"\n return min(a, b);\n",Jo="\n vec4 result = vec4(min(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+Gr.my+"\n return result;\n",ei=(0,or.js)({opSnippet:Yo,packedOpSnippet:Jo,cpuKernelImpl:tr.r}),ti={kernelName:f.q8u,backendName:"webgl",kernelFunc:ei};class ni{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=(0,Cr.kW)(r),s=t.map((e=>e[0])).join(","),o=t.map(((t,n)=>t[0]+e[n])).join(","),i=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r),l="reflect"===n?0:1;this.userCode=1!==r?`\n ${a} start = ${a}(${s});\n ${a} end = ${a}(${o});\n\n void main() {\n ${a} outC = getOutputCoords();\n for (int i = 0; i < ${r}; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ${l};\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ${l};\n }\n }\n ${a} coords = outC - start;\n setOutput(getX(${i}));\n }\n `:`\n int start = ${s};\n int end = ${o};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ${l};\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ${l};\n }\n setOutput(getX(outC - start));\n }\n `}}class ri{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=(0,Cr.kW)(r),s=t.map((e=>e[0])).join(","),o=t.map(((t,n)=>t[0]+e[n])).join(","),i=(0,Ar.Ky)("rc",r),l=(0,Ar.Ky)("source",r),u=`${i[r-1]} < ${this.outputShape[r-1]}`,c=1===r?"source":`vec2(${l.slice(-2).join()})`,d="reflect"===n?0:1;let p="";if(1===r){const e=`\n ${a} source = rc;\n if (source < start) {\n source = start * 2 - source - ${d};\n } else if (source >= end) {\n source = (end - 1) * 2 - source + ${d};\n }\n source -= start;\n `;p=`\n ${a} rc = outputLoc;\n ${e}\n result[0] = getChannel(getX(${l.join()}), ${c});\n ${i[r-1]} += 1;\n if(${u}) {\n ${e}\n result[1] = getChannel(getX(${l.join()}), ${c});\n }\n `}else{const e=`\n ${a} source = rc;\n ${a} lt = ${a}(lessThan(source, start));\n ${a} gte = ${a}(greaterThanEqual(source, end));\n ${a} orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ${d}) +\n gte * ((end - 1) * 2 - source + ${d});\n source -= start;\n `;p=`\n ${a} rc = outputLoc;\n ${e}\n result[0] = getChannel(getX(${l.join()}), ${c});\n ${i[r-1]} += 1;\n if(${u}) {\n ${e}\n result[1] = getChannel(getX(${l.join()}), ${c});\n }\n rc = outputLoc;\n ${i[r-2]} += 1;\n if(${i[r-2]} < ${this.outputShape[r-2]}) {\n ${e}\n result[2] = getChannel(getX(${l.join()}), ${c});\n ${i[r-1]} += 1;\n if(${u}) {\n ${e}\n result[3] = getChannel(getX(${l.join()}), ${c});\n }\n }\n `}this.userCode=`\n const ${a} start = ${a}(${s});\n const ${a} end = ${a}(${o});\n\n void main() {\n ${a} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${p}\n setOutput(result);\n }\n `}}const ai={kernelName:f.jQs,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r}=e,{paddings:a,mode:s}=n,o=(0,f.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new ri(r.shape,a,s):new ni(r.shape,a,s);return t.runWebGLProgram(o,[r],r.dtype)}},si="\n vec4 result = mod(a, b);\n bvec4 isNaN = equal(b, vec4(0.0));\n "+Gr.my+"\n return result;\n",oi=(0,or.js)({opSnippet:"if (b == 0.0) return NAN;\n return mod(a, b);",packedOpSnippet:si}),ii={kernelName:f.Vbg,backendName:"webgl",kernelFunc:oi};class li{constructor(e,t,n){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,n],this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < ${t-1}; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float(${t-1}));\n }\n `}}var ui=a(9486);const ci={kernelName:f.NZg,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{numSamples:s,seed:o,normalized:i}=r,l=i?a:(0,ui.X)({inputs:{logits:a},backend:n,attrs:{dim:a.shape.length-1}}),u=l.shape[0],c=l.shape[1],d=new li(u,c,s),p=[[o]],h=n.runWebGLProgram(d,[l],"int32",p);return i||n.disposeIntermediateTensorInfo(l),h}},di=nr.D1+"\n return -x;\n";const pi={kernelName:f.kuV,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])){const e=n.texData.get(r.dataId),[t,a]=(0,tr.Bo)(e.values,r.shape,r.dtype);return n.makeTensorInfo(a,r.dtype,t)}let a;return a=(0,f.OBj)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new rr.cc(r.shape,"\n vec4 result = -x;\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"):new nr.l(r.shape,di),n.runWebGLProgram(a,[r],r.dtype)}},hi=f.GDt.nonMaxSuppressionV3Impl;const fi={kernelName:f.uv1,backendName:"webgl",kernelFunc:function(e){f.Wap.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l}=r,u=n.readSync(a.dataId),c=n.readSync(s.dataId),{selectedIndices:d}=hi(u,c,o,i,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},mi=f.GDt.nonMaxSuppressionV4Impl;const gi={kernelName:f.cye,backendName:"webgl",kernelFunc:function(e){f.Wap.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,padToMaxOutputSize:u}=r,c=n.readSync(a.dataId),d=n.readSync(s.dataId),{selectedIndices:p,validOutputs:h}=mi(c,d,o,i,l,u);return[n.makeTensorInfo([p.length],"int32",new Int32Array(p)),n.makeTensorInfo([],"int32",new Int32Array([h]))]}},yi=f.GDt.nonMaxSuppressionV5Impl;const bi={kernelName:f.W0H,backendName:"webgl",kernelFunc:function(e){f.Wap.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,softNmsSigma:u}=r,c=n.readSync(a.dataId),d=n.readSync(s.dataId),p=o,h=i,m=l,g=u,{selectedIndices:y,selectedScores:b}=yi(c,d,p,h,m,g);return[n.makeTensorInfo([y.length],"int32",new Int32Array(y)),n.makeTensorInfo([b.length],"float32",new Float32Array(b))]}};var xi=a(4299);class vi{constructor(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float(${r}), float(${n}),\n float(index == coords.y)));\n }\n `}}const wi={kernelName:f.we_,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{indices:a}=t,{dtype:s,depth:o,onValue:i,offValue:l}=r,u=f.D5U.sizeFromShape(a.shape),c=new vi(u,o,i,l),d=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:[u]}}),p=n.runWebGLProgram(c,[d],s);n.disposeIntermediateTensorInfo(d);const h=[...a.shape,o],m=(0,xr.X)({inputs:{x:p},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(p),m}};function Ti(e){const{inputs:t,backend:n}=e,{x:r}=t;if("complex64"===r.dtype){const e=(0,Ma.k)({inputs:{input:r},backend:n}),t=Ti({inputs:{x:e},backend:n}),a=Ra({inputs:{input:r},backend:n}),s=Ti({inputs:{x:a},backend:n}),o=(0,Aa.P)({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),o}return(0,Us.h)({attrs:{shape:r.shape,dtype:r.dtype,value:"string"===r.dtype?"":0},backend:n})}const Si={kernelName:f.RuY,backendName:"webgl",kernelFunc:Ti};const Ai={kernelName:f.qWM,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:r}=t,{x:a}=n;if("string"===a.dtype)throw new Error("onesLike is not supported under string dtype");if("complex64"===a.dtype){const t=(0,Ma.k)({inputs:{input:a},backend:r}),n=e({inputs:{x:t},backend:r}),s=Ra({inputs:{input:a},backend:r}),o=Ti({inputs:{x:s},backend:r}),i=(0,Aa.P)({inputs:{real:n,imag:o},backend:r});return r.disposeIntermediateTensorInfo(t),r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(o),i}return(0,Us.h)({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:r})}};const Ci={kernelName:f.QiL,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(1===t.length)return(0,Os.d)({inputs:{input:t[0]},backend:n,attrs:{dim:a}});const s=t[0].shape,o=t[0].dtype;t.forEach((e=>{f.D5U.assertShapesMatch(s,e.shape,"All tensors passed to stack must have matching shapes"),f.D5U.assert(o===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const i=[],l=Pa({inputs:t.map((e=>{const t=(0,Os.d)({inputs:{input:e},backend:n,attrs:{dim:a}});return i.push(t),t})),backend:n,attrs:{axis:a}});return i.forEach((e=>n.disposeIntermediateTensorInfo(e))),l}};var Ii=a(4443);const ki="\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n bvec4 isNaN1 = lessThan(a, vec4(0.0));\n bvec4 isNaN2 = lessThan(floor(b), b);\n bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n "+Gr.my+"\n return result;\n",Ei=(0,or.js)({opSnippet:"\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",packedOpSnippet:ki}),Ni={kernelName:f.pe_,backendName:"webgl",kernelFunc:Ei};var Bi=a(3525);const Ri={kernelName:f.DlI,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:o}=r,i=a.shape.length,l=[],u=f.D5U.parseAxisParam(s,a.shape);let c=u;const d=f.Wap.getAxesPermutation(c,i);let p,h=a;if(null!=d&&(h=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:d}}),c=f.Wap.getInnerMostAxes(c.length,i),l.push(h)),f.Wap.assertAxesAreInnerMostDims("prod",c,i),n.shouldExecuteOnCPU([h])){const e=n.texData.get(h.dataId).values,{outVals:t,outShape:r,outDtype:a}=(0,tr.Tg)(h.shape,h.dtype,e,c);p=n.makeTensorInfo(r,a,t)}else{const[e,t]=f.Wap.computeOutAndReduceShapes(h.shape,c),r=f.D5U.sizeFromShape(t),s=(0,xr.X)({inputs:{x:h},backend:n,attrs:{shape:[-1,r]}}),o=(0,f.z4k)(a.dtype),i=(0,br.u)(s,o,"prod",n);p=(0,xr.X)({inputs:{x:i},backend:n,attrs:{shape:e}}),l.push(s),l.push(i)}if(o){l.push(p);const e=f.Wap.expandShapeToKeepDim(p.shape,u);p=(0,xr.X)({inputs:{x:p},backend:n,attrs:{shape:e}})}return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}};const Di={kernelName:f.dDz,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{paramsNestedSplits:a,paramsDenseValues:s,indices:o}=t,{outputRaggedRank:i}=r,l=a.map((e=>n.readSync(e.dataId))),u=a.map((e=>e.shape)),c=n.readSync(s.dataId),d=n.readSync(o.dataId),[p,h,f]=(0,tr.Qs)(l,u,c,s.shape,s.dtype,d,o.shape,i),m=p.map((e=>n.makeTensorInfo([e.length],"int32",e))),g=n.makeTensorInfo(f,s.dtype,h);return m.concat([g])}};const Mi={kernelName:f.BiW,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{shape:a,values:s,defaultValue:o,rowPartitionTensors:i}=t,{rowPartitionTypes:l}=r,u=n.readSync(a.dataId),c=n.readSync(s.dataId),d=n.readSync(o.dataId),p=i.map((e=>n.readSync(e.dataId))),h=i.map((e=>e.shape)),[f,m]=(0,tr.fy)(u,a.shape,c,s.shape,s.dtype,d,o.shape,p,h,l);return n.makeTensorInfo(f,s.dtype,m)}},Oi=e=>{const{backend:t,attrs:n}=e,{start:r,stop:a,step:s,dtype:o}=n,i=(0,tr.hO)(r,a,s,o);return t.makeTensorInfo([i.length],o,i)},Pi={kernelName:f.e6w,backendName:"webgl",kernelFunc:Oi};var $i=a(5937);const Fi=(0,or.AJ)({opSnippet:"return 1.0 / x;"}),_i={kernelName:f.$HU,backendName:"webgl",kernelFunc:Fi},Li=nr.D1+"\n return (x < 0.0) ? 0.0 : x;\n",Vi=(0,or.AJ)({opSnippet:Li,packedOpSnippet:"\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"}),Ui={kernelName:f.qkr,backendName:"webgl",kernelFunc:Vi};var Gi=a(8632),Wi=a(7721);class zi{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,s,o]=e,i=[n&&s>1?r-1:r,n&&o>1?a-1:a],l=[n&&s>1?s-1:s,n&&o>1?o-1:o],u=i[0]/l[0],c=i[1]/l[1],d=1/u,p=1/c,h=2*Math.ceil(d)+2,f=2*Math.ceil(p)+2;this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${u});\n const float widthScale = float(${c});\n\n const float invHeightScale = float(${d});\n const float invWidthScale = float(${p});\n\n const int winHeight = int(${h});\n const int winWidth = int(${f});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${s}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${o}) {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ${r-1}.0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), ${a-1}.0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `}}const Hi={kernelName:f.zbQ,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:o}=r,i=new zi(s.shape,a.shape,o);return n.runWebGLProgram(i,[s],s.dtype)}};class Zi{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[s,o,i,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let p;p=a?"max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${u[0]/c[0]},\n ${u[1]/c[1]});\n const vec2 inputShapeRC = vec2(${o}.0, ${i}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${p};\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n `}}class ji{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,o,i,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let p;p=a?"max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${u[0]/c[0]},\n ${u[1]/c[1]},\n ${u[1]/c[1]});\n const vec3 inputShapeRC = vec3(${o}.0, ${i}.0,\n ${i}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${p};\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${l-1};\n bool hasNextRow = coords.z < ${n-1};\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n `}}const Xi={kernelName:f.dpD,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:o,size:i}=r,[l,u]=i,c=(0,f.OBj)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new ji(a.shape,l,u,s,o):new Zi(a.shape,l,u,s,o);return n.runWebGLProgram(c,[a],a.dtype)}};class Ki{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,s,o]=e,i=[n&&s>1?r-1:r,n&&o>1?a-1:a],l=[n&&s>1?s-1:s,n&&o>1?o-1:o],u=i[0]/l[0],c=i[1]/l[1],d=1/u,p=1/c,h=2*Math.ceil(d)+2,f=2*Math.ceil(p)+2;this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${u});\n const float widthScale = float(${c});\n\n const float invHeightScale = float(${d});\n const float invWidthScale = float(${p});\n\n const int winHeight = int(${h});\n const int winWidth = int(${f});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${s}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${o}) {\n continue;\n }\n\n float sourceFracRow =\n float(${i[0]}) *\n (float(dyR) / float(${l[0]}));\n\n float sourceFracCol =\n float(${i[1]}) *\n (float(dyC) / float(${l[1]}));\n\n int sourceNearestRow = int(min(\n float(int(${r}) - 1),\n ${n} ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(${a}) - 1),\n ${n} ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `}}const qi={kernelName:f.Hmb,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:o}=r,i=new Ki(s.shape,a.shape,o);return n.runWebGLProgram(i,[s],s.dtype)}};class Qi{constructor(e,t){this.variableNames=["x"];const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,1===n)return void(this.userCode=`\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(${e[0]} - coord - 1));\n }\n `);const r=e.map(((n,r)=>(n=>-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - coords[${n}] - 1`:`coords[${n}]`)(r))).join(","),a=(0,Cr.kW)(n);this.userCode=`\n void main() {\n ${a} coords = getOutputCoords();\n setOutput(getX(${r}));\n }\n `}}class Yi{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;const r=(0,Ar.Ky)("rc",n),a=`${r[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${r[n-2]} + 1 < ${this.outputShape[n-2]}`,o=(0,Cr.kW)(n);function i(n){const r=e.map(((r,a)=>function(n,r){return-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - ${r[n]} - 1`:`${r[n]}`}(a,n)));return`getChannel(getX(${r.join(",")}), vec2(${r.slice(-2).join(",")}))`}this.userCode=1===n?`\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(${e[0]} - rc - 1),\n ${e[0]} - rc - 1);\n if(${a}){\n result.g = getChannel(getX(${e[0]} - (rc + 1) - 1),\n ${e[0]} - (rc + 1) - 1);\n }\n setOutput(result);\n }\n `:`\n void main() {\n ${o} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ${function(e){return i(e)}(r.slice())};\n if(${a}){\n result.g = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",i(e)}(r.slice())};\n }\n if(${s}) {\n result.b = ${function(e){return e[n-2]="("+e[n-2]+" + 1)",i(e)}(r.slice())};\n if(${a}) {\n result.a = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",e[n-2]="("+e[n-2]+" + 1)",i(e)}(r.slice())};\n }\n }\n setOutput(result);\n }\n `}}const Ji={kernelName:f.mKl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r,o=a.shape.length,i=f.D5U.parseAxisParam(s,a.shape);if(0===o)return(0,gr.y)({inputs:{x:a},backend:n});const l=(0,f.OBj)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Yi(a.shape,i):new Qi(a.shape,i);return n.runWebGLProgram(l,[a],a.dtype)}};class el{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const n=e[1],r=e[2];this.outputShape=e;let a="";a="number"==typeof t?`float outputValue = ${t.toFixed(2)};`:`\n vec3 fill = vec3(${t.join(",")});\n float outputValue = fill[coords[3]];`,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ${a}\n if(coordX >= 0 && coordX < ${r} && coordY >= 0 && coordY < ${n}) {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n `}}const tl={kernelName:f.b9H,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,{radians:a,fillValue:s,center:o}=t,i=n,l=new el(r.shape,s),[u,c]=f.Wap.getImageCenter(o,r.shape[1],r.shape[2]),d=[[u,c,Math.sin(a),Math.cos(a)]];return i.runWebGLProgram(l,[r],r.dtype,d)}},nl=(0,or.AJ)({opSnippet:"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n"}),rl={kernelName:f.e07,backendName:"webgl",kernelFunc:nl},al=(0,or.AJ)({opSnippet:"return inversesqrt(x);",cpuKernelImpl:tr.St}),sl={kernelName:f.bV0,backendName:"webgl",kernelFunc:al};class ol{constructor(e,t,n,r,a,s,o=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;const i=(0,Cr.kW)(a.length),l=(0,Cr.kW)(s.length);let u="";1===n?u="i":2===n&&(u="i, j");const c=`getIndices(${u})`;let d="";1===r?d="i":2===r&&(d="i, coords[1]");const p=`getUpdates(${d})`,h=t>1?"strides[j]":"strides";this.userCode=`\n ${i} strides = ${i}(${a});\n\n void main() {\n ${l} coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ${e}; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ${t}; j++) {\n int index = round(${c});\n flattenedIndex += index * ${h};\n }\n if (flattenedIndex == coords[0]) {\n sum += ${p};\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n `}}const il={kernelName:f.xQA,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{indices:a,updates:s}=t,{shape:o}=r,{sliceRank:i,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=f.Wap.calculateShapes(s,a,o),p=[d/u,u];if(0===d)return n.makeTensorInfo(o,a.dtype);const h=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:[l,i]}}),m=(0,xr.X)({inputs:{x:s},backend:n,attrs:{shape:[l,u]}}),g=n.makeTensorInfo([],"float32",new Float32Array([0])),y=new ol(l,i,h.shape.length,m.shape.length,c,p),b=n.runWebGLProgram(y,[m,h,g],m.dtype),x=(0,xr.X)({inputs:{x:b},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(g),x}};class ll{constructor(e,t,n,r){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,n];const a=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,s=2===(0,f.OBj)().getNumber("WEBGL_VERSION")?"while (left < right) {":a,o="left"===r?"<":"<=";this.userCode=`\n int findBound(int batch, float value) {\n int left = 0;\n int right = numInputs;\n int mid;\n ${s}\n mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ${o} value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int valueIndex = coords[1];\n\n float value = getValues(batch, valueIndex);\n\n setOutput(float(findBound(batch, value)));\n }\n `}}const ul={kernelName:f.nr8,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sortedSequence:a,values:s}=t,{side:o}=r,i=new ll(a.shape[0],a.shape[1],s.shape[1],o),l=[[a.shape[1]]];return n.runWebGLProgram(i,[a,s],"int32",l)}};class cl{constructor(e,t,n){let r,a;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error(`Where for rank ${n} is not yet supported`);if(1===n)a="resRC",r="resRC";else{const n=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[],o=[];for(let r=0;r<t.length;r++)o.push(`${n[r]}`),r<e&&s.push(`${n[r]}`);r=s.join(),a=o.join()}const s=(0,Cr.kW)(n);this.userCode=`\n void main() {\n ${s} resRC = getOutputCoords();\n float cVal = getC(${r});\n if (cVal >= 1.0) {\n setOutput(getA(${a}));\n } else {\n setOutput(getB(${a}));\n }\n }\n `}}const dl={kernelName:f.PhF,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t,o=new cl(r.shape.length,a.shape,a.shape.length);return n.runWebGLProgram(o,[r,a,s],(0,f.x8V)(a.dtype,s.dtype))}},pl=`\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ${f.Wap.SELU_SCALEALPHA};\n float scale = ${f.Wap.SELU_SCALE};\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`,hl=(0,or.AJ)({opSnippet:pl}),fl={kernelName:f.oFR,backendName:"webgl",kernelFunc:hl};var ml=a(3351);const gl=(0,or.AJ)({opSnippet:"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n"}),yl={kernelName:f.i5y,backendName:"webgl",kernelFunc:gl},bl=or.E6+"\n return sin(x);\n",xl=(0,or.AJ)({opSnippet:bl}),vl={kernelName:f.RQH,backendName:"webgl",kernelFunc:xl},wl=(0,or.AJ)({opSnippet:"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n"}),Tl={kernelName:f.wYB,backendName:"webgl",kernelFunc:wl},Sl=(0,or.AJ)({opSnippet:"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n"}),Al={kernelName:f.MRv,backendName:"webgl",kernelFunc:Sl},Cl={kernelName:f.TQc,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,paddings:o}=r;f.D5U.assert(a.shape.length<=4,(()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"));const i=s.reduce(((e,t)=>e*t)),l=[[0,0]];l.push(...o);for(let e=1+s.length;e<a.shape.length;++e)l.push([0,0]);const u=[],c=(0,Ii.Y)({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),d=f.Wap.getReshaped(c.shape,s,i,!1),p=f.Wap.getPermuted(d.length,s.length,!1),h=f.Wap.getReshapedPermuted(c.shape,s,i,!1),m=(0,xr.X)({inputs:{x:c},backend:n,attrs:{shape:d}}),g=(0,vr.p)({inputs:{x:m},backend:n,attrs:{perm:p}}),y=(0,xr.X)({inputs:{x:g},backend:n,attrs:{shape:h}});return u.push(c),u.push(m),u.push(g),u.forEach((e=>n.disposeIntermediateTensorInfo(e))),y}};const Il={kernelName:f.O3z,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{indices:r,values:a,denseShape:s,defaultValue:o}=t;if(1!==s.shape.length)throw new Error(`Dense shape must be a vector, saw:\n ${s.shape}`);if(2!==r.shape.length)throw new Error(`Indices must be a matrix, saw:\n ${r.shape}`);if(1!==a.shape.length)throw new Error(`Values must be a vector, saw:\n ${a.shape}`);if(0!==o.shape.length)throw new Error(`Default value must be a scalar, saw:\n ${o.shape}`);const i=n.readSync(r.dataId),l=n.readSync(a.dataId),u=n.readSync(s.dataId),c=n.readSync(o.dataId)[0],[d,p,h,f,m]=(0,tr.X8)(i,r.shape,r.dtype,l,a.dtype,u,c);return[n.makeTensorInfo(p,r.dtype,d),n.makeTensorInfo([p[0]],a.dtype,h),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map((e=>Number(e))))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}};const kl={kernelName:f.nhH,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{inputIndices:r,inputShape:a,newShape:s}=t;if(2!==r.shape.length)throw new Error(`Input indices should be a matrix but received shape ${r.shape}`);if(1!==a.shape.length)throw new Error(`Input shape should be a vector but received shape ${a.shape}`);if(1!==s.shape.length)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);const o=Array.from(n.readSync(a.dataId)),i=n.readSync(r.dataId),l=Array.from(n.readSync(s.dataId)),[u,c,d]=(0,tr.LS)(i,r.shape,r.dtype,o,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],s.dtype,new Int32Array(d))]}};const El={kernelName:f.w3H,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);const o=n.readSync(r.dataId),i=n.readSync(a.dataId),l=n.readSync(s.dataId),[u,c]=(0,tr.AR)(o,r.shape,r.dtype,i,l,!0);return n.makeTensorInfo(c,r.dtype,u)}};const Nl={kernelName:f.ZjV,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);const o=n.readSync(r.dataId),i=n.readSync(a.dataId),l=n.readSync(s.dataId),[u,c]=(0,tr.AR)(o,r.shape,r.dtype,i,l);return n.makeTensorInfo(c,r.dtype,u)}};const Bl={kernelName:f.D2d,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sparseIndices:a,sparseValues:s,defaultValue:o}=t,{outputShape:i}=r,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:p}=f.Wap.calculateShapes(s,a,i);if("string"===s.dtype){const e=n.bufferSync(a),t=n.bufferSync(s),r=f.D5U.decodeString(n.readSync(o.dataId)[0]),h=(0,tr.Y1)(e,t,i,p,c,u,l,d,r,false);return n.makeTensorInfo(i,h.dtype,h.values)}const h=new ol(u,l,a.shape.length,s.shape.length,d,[p,1],false),m=n.runWebGLProgram(h,[s,a,o],s.dtype),g=(0,xr.X)({inputs:{x:m},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(m),g}};const Rl={kernelName:f.L8s,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:o}=r,i=f.D5U.parseAxisParam(o,a.shape)[0],l=f.Wap.prepareSplitSize(a,s,i),u=a.shape.length,c=new Array(u).fill(0),d=a.shape.slice();return l.map((e=>{const t=[...d];t[i]=e;const r=pa({inputs:{x:a},backend:n,attrs:{begin:c,size:t}});return c[i]+=e,r}))}},Dl="return sqrt(x);",Ml=(0,or.AJ)({opSnippet:Dl,packedOpSnippet:Dl,cpuKernelImpl:tr.Bk}),Ol={kernelName:f.FKq,backendName:"webgl",kernelFunc:Ml},Pl=(0,or.AJ)({opSnippet:"return x * x;"}),$l={kernelName:f.bK0,backendName:"webgl",kernelFunc:Pl},Fl="return (a - b) * (a - b);",_l=(0,or.js)({opSnippet:Fl,packedOpSnippet:Fl}),Ll={kernelName:f._tC,backendName:"webgl",kernelFunc:_l};const Vl={kernelName:f.h8e,backendName:"webgl",kernelFunc:function({inputs:e,attrs:t,backend:n}){const{x:r}=e,a=nr.D1+`\n return x > 0.0 ? 1.0 : float(${t.alpha});\n `,s=new nr.l(r.shape,a);return n.runWebGLProgram(s,[r],r.dtype)}};class Ul{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;const r=n.length,a=(0,Cr.kW)(n.length),s=(0,Cr.kW)(n.length);let o="";if(1===r)o="coords * strides + begin";else{let e=0;o=n.map(((t,r)=>(e++,1===n.length?`coords * strides[${r}] + begin[${r}]`:`coords[${e-1}] * strides[${r}] + begin[${r}]`))).join(",")}this.userCode=`\n ${a} begin = ${a}(${e});\n ${a} strides = ${a}(${t});\n\n void main() {\n ${s} coords = getOutputCoords();\n setOutput(getX(${o}));\n }\n `}}const Gl={kernelName:f.jQk,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,end:o,strides:i,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:p}=r,{finalShapeSparse:h,finalShape:m,isIdentity:g,sliceDim0:y,isSimpleSlice:b,begin:x,end:v,strides:w}=f.kuN.sliceInfo(a.shape,s,o,i,l,u,c,d,p);let T;if(g)T=(0,xr.X)({inputs:{x:a},backend:n,attrs:{shape:m}});else if(y||b){f.D5U.assert(a.shape.length>=1,(()=>`Input must have rank at least 1, got: ${a.shape.length}`));const e=f.kuN.computeOutShape(x,v,w),t=pa({inputs:{x:a},backend:n,attrs:{begin:x,size:e}});T=(0,xr.X)({inputs:{x:t},backend:n,attrs:{shape:m}}),n.disposeIntermediateTensorInfo(t)}else{if(n.shouldExecuteOnCPU([a])){const e=n.readSync(a.dataId),t=(0,f.f3b)(a.shape,a.dtype,e),r=(0,tr.$u)(h,t,w,x);T=n.makeTensorInfo(m,a.dtype,r.values)}else{const e=new Ul(x,w,h);T=n.runWebGLProgram(e,[a],a.dtype)}}const S=(0,xr.X)({inputs:{x:T},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(T),S}};const Wl={kernelName:f._JP,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{separator:a,nGramWidths:s,leftPad:o,rightPad:i,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=t,p=n.readSync(c.dataId),h=n.readSync(d.dataId),[f,m]=(0,tr.$j)(p,h,a,s,o,i,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}};const zl={kernelName:f.s1s,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{skipEmpty:a}=r,{input:s,delimiter:o}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(0!==o.shape.length)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);const i=n.readSync(s.dataId),l=n.readSync(o.dataId)[0],[u,c,d]=(0,tr.A0)(i,l,a),p=c.length;return[n.makeTensorInfo([p,2],"int32",u),n.makeTensorInfo([p],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}};const Hl={kernelName:f.XkS,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{numBuckets:a}=r,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(a<=0)throw new Error("Number of buckets must be at least 1");const o=n.readSync(s.dataId),i=(0,tr._9)(o,a);return n.makeTensorInfo(s.shape,"int32",i)}};var Zl=a(1119);const jl=(0,or.AJ)({opSnippet:"return tan(x);"}),Xl={kernelName:f.sEM,backendName:"webgl",kernelFunc:jl},Kl=(0,or.AJ)({opSnippet:"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"}),ql={kernelName:f.MIZ,backendName:"webgl",kernelFunc:Kl};class Ql{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[r]*t[r];this.outputShape=n,this.rank=n.length;const r=(0,Cr.kW)(this.rank),a=function(e){const t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(1===t)return`imod(resRC, ${e[0]})`;const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[];for(let t=0;t<e.length;t++)r.push(`imod(${n[t]}, ${e[t]})`);return r.join()}(e);this.userCode=`\n void main() {\n ${r} resRC = getOutputCoords();\n setOutput(getA(${a}));\n }\n `}}function Yl(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reps:s}=r;if("string"===a.dtype||a.shape.length>5){const e=n.readSync(a.dataId),t="string"===a.dtype?e.map((e=>f.D5U.decodeString(e))):e,r=(0,f.f3b)(a.shape,a.dtype,t),o=(0,tr.KX)(r,s);return n.makeTensorInfo(o.shape,o.dtype,o.values)}const o=new Ql(a.shape,s);return n.runWebGLProgram(o,[a],a.dtype)}const Jl={kernelName:f.n9L,backendName:"webgl",kernelFunc:Yl};class eu{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n "}}class tu{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n "}}function nu(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function ru(e){let t=1;for(;t<e;)t*=2;return t}const au={kernelName:f.cWu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{k:s,sorted:o}=r,i=(0,f.OBj)().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),l=(0,f.OBj)().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),u=a.shape,c=u[u.length-1];if(n.shouldExecuteOnCPU([a])||c<i||s>l){const e=n.readSync(a.dataId),[t,r]=(0,tr.oC)(e,u,a.dtype,s,o);return[n.makeTensorInfo(t.shape,t.dtype,t.values),n.makeTensorInfo(r.shape,r.dtype,r.values)]}if(0===s)return u[u.length-1]=0,[n.makeTensorInfo(u,a.dtype,[]),n.makeTensorInfo(u,"int32",[])];if(1===c)return[a,(0,Us.h)({attrs:{shape:u,dtype:"int32",value:0},backend:n})];const d=n.texData.get(a.dataId),p=null!==d&&d.isPacked,h=p?n.unpackTensor(a):a,m=f.D5U.sizeFromShape(u)/c,g=(0,xr.X)({inputs:{x:h},attrs:{shape:[m,c]},backend:n});p&&nu(n,h);const y=ru(s),b=ru(c);let x=null;const v=()=>null===x?[g,g]:[g,x],w=(e,t,r)=>{const a=v(),s=new eu(r),o=[[c],[null===x?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],i=x;x=n.runWebGLProgram(s,a,"int32",o),nu(n,i)};for(let e=1;e<y;e*=2){const t=2*e;for(let n=e;n>=1;n/=2)w(t,n,[m,b])}for(let e=b;e>y;e/=2){const t=v(),r=new tu([m,e/2]),a=[[c],[null===x?1:0],[y]],s=x;x=n.runWebGLProgram(r,t,"int32",a),nu(n,s);const o=y/2,i=2*o;for(let e=o;e>=1;e/=2)w(i,e,x.shape)}let T=x;x=pa({inputs:{x},backend:n,attrs:{begin:0,size:[m,s]}}),nu(n,T);let S=to({inputs:{x:g,indices:x},backend:n,attrs:{axis:1,batchDims:1}});nu(n,g);const A=u.slice(0,-1);A.push(s),T=x,x=(0,xr.X)({inputs:{x},attrs:{shape:A},backend:n}),nu(n,T);const C=S;return S=(0,xr.X)({inputs:{x:S},attrs:{shape:A},backend:n}),nu(n,C),[S,x]}};class su{constructor(e,t,n,r,a,s){this.variableNames=["Image","Transforms"],this.outputShape=s;const o="nearest"===n?1:2;let i;switch(r){case"constant":default:i=1;break;case"reflect":i=2;break;case"wrap":i=3;break;case"nearest":i=4}this.userCode=`\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(${i} == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${i} == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${i} == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${t}) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(${a});\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(${a});\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(${t}));\n float mapY = mapCoord(inY, float(${e}));\n\n if (${o} == 1) {\n int coordY = int(round(mapY));\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n `}}const ou={kernelName:f.wx7,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{image:a,transforms:s}=t,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=r,[c,d,p,h]=a.shape,[f,m]=null!=u?u:[d,p],g=new su(d,p,o,i,l,[c,f,m,h]);return n.runWebGLProgram(g,[a,s],"float32")}};const iu={kernelName:f.kpP,backendName:"webgl",kernelFunc:function(e){const{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;(0,Qr.assertNotComplex)(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const o=r.readSync(s.dataId),{outputValues:i,outputShape:l,indices:u}=(0,tr.CV)(o,a,s.shape,s.dtype);return[r.makeTensorInfo(l,s.dtype,i),r.makeTensorInfo([u.length],"int32",u)]}};const lu={kernelName:f.ToN,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{value:a}=t;let{axis:s}=r;s<0&&(s+=a.shape.length);const o=a,i=o.shape.length,l=a.shape[s],u=new Array(i-1);let c=0;for(let e=0;e<i;e++)e!==s&&(u[c++]=o.shape[e]);const d=[],p=new Array(i).fill(0),h=o.shape.slice();h[s]=1;const f=new Array(l);for(let e=0;e<f.length;e++){p[s]=e;const t=pa({inputs:{x:o},backend:n,attrs:{begin:p,size:h}}),r=(0,xr.X)({inputs:{x:t},backend:n,attrs:{shape:u}});f[e]=r,d.push(t)}return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),f}};class uu{constructor(e,t){this.variableNames=["x","segmentIds"];const n=e.windowSize,r=e.batchSize,a=e.inSize,s=e.numSegments,o=s*Math.ceil(a/n);this.outputShape=[r,o];const i=4*Math.floor(n/4),l=n%4,u="\n sumValue += dot(values, segFilter);\n ";let c="";a%n>0&&(c=`\n if (inIdx < 0 || inIdx >= ${a}) {\n return initializationValue;\n }\n `);let d="";a%n>0&&(d=`\n if (inIdx < 0 || inIdx >= ${a}) {\n return -1.0;\n }\n `),this.userCode=`\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n ${c}\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ${d}\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n ${s})) * float(${n}));\n int currentSeg = int(mod(float(outIdx), float(${s})));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${i}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n ${u}\n }\n\n int inIdx = inOffset + ${i};\n if (${1===l}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n ${u}\n } else if (${2===l}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n ${u}\n } else if (${3===l}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n ${u}\n }\n setOutput(sumValue);\n }\n `}}const cu={kernelName:f.Qvg,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,segmentIds:s}=t,{numSegments:o}=r,i=a.shape.length,l=[];let u=0;const c=f.Wap.getAxesPermutation([u],i);let d=a;null!=c&&(d=(0,vr.p)({inputs:{x:a},backend:n,attrs:{perm:c}}),l.push(d),u=f.Wap.getInnerMostAxes(1,i)[0]);const p=f.Wap.segment_util.computeOutShape(d.shape,u,o),h=f.D5U.sizeFromShape([d.shape[u]]),m=(0,xr.X)({inputs:{x:d},backend:n,attrs:{shape:[-1,h]}});l.push(m);const g=(0,f.z4k)(a.dtype),y=(e,t,r,a,s)=>{const o=e.shape[0],i=e.shape[1],u=f.Wap.segment_util.segOpComputeOptimalWindowSize(i,s),c=new uu({windowSize:u,inSize:i,batchSize:o,numSegments:s},t),d=n.compileAndRun(c,[e,r],a);if(l.push(d),d.shape[1]===s)return d;const p=Oi({backend:n,attrs:{start:0,stop:s,step:1,dtype:"float32"}}),h=Yl({inputs:{x:p},backend:n,attrs:{reps:[i/u]}});l.push(p),l.push(h);return y(d,t,h,a,s)},b=y(m,"unsortedSegmentSum",s,g,o),x=(0,xr.X)({inputs:{x:b},backend:n,attrs:{shape:p}});let v=x;if(null!=c){l.push(x);const e=f.Wap.getUndoAxesPermutation(c);v=(0,vr.p)({inputs:{x:v},backend:n,attrs:{perm:e}})}return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),v}},du=[er.d,sr,ur,pr,hr.j,yr,wr,Tr,Br,Rr,Or,Fr,Vr,Zr,Kr,Yr,Jr,na,ra,sa,la,fa,ma,ga,ya.M,va,Sa,Aa.z,ka,$a,Va,Ha,Za,ja,Xa,Ka,Ya,es,ns,ls,us,cs,ps,hs.X,gs,ys,xs,ws,As,Is,ks,Ns,Ds,Ms.SX,Os.p,Fs,Vs,Us.v,Ws,Zs,Xs,Ks.x,qs.L,Qs.X,Js,no,ao,oo,gr.I,io,Da,uo,po,fo,mo.Ou,yo,xo,vo,So,Io,Eo,Bo,Do,Po,Fo,_o.F,Go,Wo.u,zo,jo,Xo,Ko,qo.$,Qo,ti,ai,ii,ci,Ts.f,pi,fi,gi,bi,xi.n,wi,Ai,Ci,Ii.S,Ni,Bi.ML,Ri,Di,Mi,Pi,Ma.O,$i.v,_i,Ui,Gi.N,xr.b,Wi.T,Hi,Xi,qi,Ji,tl,rl,sl,il,ul,dl,fl,ml.B,yl,vl,Tl,ha,ui.D,Al,Cl,Il,kl,El,Nl,Bl,Rl,Ol,$l,Ll,Vl,Gl,Wl,zl,Hl,Zl.G,Ss.y,Xl,ql,Jl,au,ou,vr.b,iu,lu,cu,Si];for(const e of du)(0,f.wCN)(e);const pu=new ImageData(Uint8ClampedArray.from([0,0,0,0]),1,1),hu=e=>{const t="pdf"===e?"proccessPDF":"checkMrz";de.Z.execute("module",e,"allocate");const n=de.Z.execute("module",e,t,pu);n?.error&&"licenceKeyError"===n?.error?.errorType&&(0,Ye.Z)(n?.error?.errorVal)},fu="bl",mu={async postInit(){h.Z.loop=An,re(),Hn(this),D.Z.messageBox.updateByTypesCount(h.Z.config.types.length),await(0,f.CQI)(h.Z.RUNTIME),h.Z.config.useCDN&&Jn(),h.Z.uploader=new B("vc-uploader-drop-area",{type:"face",img:null},Qn,(()=>{(0,Se.E9)({name:fu})}),de.Z,h.Z.config.useHeic?["heic"]:[]),h.Z.config.isShowDocumentTypeSelect||1!==h.Z.config.types.length?(D.Z.selectDocumentType.show(),this.generateTypesInSelect()):(h.Z.type=t.Z.idByName(h.Z.config.types[0]),h.Z.config.steps=h.Z.config.documentTypes[h.Z.config.types[0]],mu.mount()),(()=>{const{config:{isShowGuidelinesButton:e}}=h.Z;e||(D.Z.guidlinesBtn.style.display="none"),D.Z.version.innerText=h.Z.VERSION})()},async mount(){D.Z.updateKeyError(),(0,Se.E9)({name:fu,bottomText:"awaiting"}),this.resetSteps(),Bt(),(()=>{const e=h.Z.steps.map((({type:e})=>e)).filter((e=>"mrz"===e||"pdf"===e));e.length&&(e.includes("pdf")&&hu("pdf"),e.includes("mrz")&&hu("mrz"))})()},async start(){D.Z.updateKeyError(),(0,Se.E9)({name:fu,bottomText:"awaiting"}),h.Z.currentStep=-1;const e=Mt();Dt(e)},changeDocumentType(){(0,Se.E9)({name:fu}),_e(),Ke(),D.Z.selectDocumentType.showCancelButton(),D.Z.selectDocumentType.show()},async resetAllSteps(){if((0,Se.E9)({name:fu}),_e(),Ke(),h.Z.config.onReset){const e=h.Z.steps.map(((e,t)=>e.prepareStepForCallback(t)));h.Z.config.onReset(R.formDataForSubmit(e,h.Z,{}))}h.Z.passpFront=null,h.Z.currentStep=-1,h.Z.config.isShowDocumentTypeSelect||1!==h.Z.config.types.length?(D.Z.selectDocumentType.showCancelButton(),D.Z.selectDocumentType.show()):mu.mount()},resetSteps(){h.Z.sizeK=1.44,h.Z.steps=[],h.Z.steps=Object.values(h.Z.config.steps).map((e=>It.Z.createStep(e))),D.Z.updateStepImg(),Dt(0)},generateTypesInSelect(){let e='<option value="0" disabled selected>Press change</option>';h.Z.config.types.forEach((n=>{e=`${e}<option value="${t.Z.idByName(n)}">${t.Z.humanNameByName(n)}</option>`})),D.Z.dialogSelectType.innerHTML=e},async updateDocumentTypes(e){return this.reloadComponent({...h.Z.config,documentTypes:e})},async reloadComponent(e){_e(),Ke(),h.Z.config.validate(e),re(),h.Z.init(),le(),ze(),document.getElementById("VC-browser-compatibility").classList.remove("browser-not-compability--enable"),oe()&&await We(h.Z.steps[0].camera),ae(),await se(),await this.postInit()},showSpinner(e){"boolean"==typeof e?e?(0,Se.E9)({name:fu}):(0,Se.ud)(fu):console.error(typeof e+" not allowed. Only Boolean")}},gu=mu,yu={wasmSupport:!1,mediaSupport:!1,secureConnection:!1},bu=()=>navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&"function"==typeof navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.enumerateDevices&&"function"==typeof navigator.mediaDevices.enumerateDevices&&window.MediaStreamTrack&&"function"==typeof window.MediaStreamTrack,xu=()=>{yu.wasmSupport=(()=>{let e=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=[0,97,115,109,1,0,0,0],n=new WebAssembly.Module(Uint8Array.of(...t));n instanceof WebAssembly.Module&&(e=new WebAssembly.Instance(n)instanceof WebAssembly.Instance)}}catch(t){return e}return e})(),yu.mediaSupport=bu(),yu.secureConnection=bu()};const vu=class{constructor(e){console.info(`%cIDVC version: ${h.Z.VERSION}`,"background-color:#f48020; color:#fff; padding: 4px 8px"),h.Z.config=new p(e);document.getElementById(h.Z.config.el).innerHTML='<div class="idvc">\r\n <div class="vc-loading-mask vc-loading-mask--enabled" id="VC-loading">\r\n <div class="el-loading-spinner">\r\n <p class="el-loading-text" id="VC-loading-text-top"></p>\r\n <svg viewBox="25 25 50 50" class="circular">\r\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\r\n </svg>\r\n <p class="el-loading-text" id="VC-loading-text-bottom"></p>\r\n </div>\r\n </div>\r\n <div class="vc-dialog-type-background d-none" id="vc-dialog-type-background"></div>\r\n <div class="vc-dialog-bottom vc-predicted-type-dialog d-none" id="vc-predicted-type-dialog">\r\n <div class="vc-dialog-bottom__main" id="vc-predicted-type-dialog-main">\r\n <p id="vc-dialog-type-text" class="vc-dialog-bottom__main__static">Your document type is</p>\r\n <span class="vc-dialog-bottom__main__dynamic" id="vc-predicted-type-dialog-name">Driver’s License or ID card.</span>\r\n </div>\r\n <div class="vc-dialog-bottom__footer">\r\n <button id="vc-predicted-type-dialog-change" class="el-button el-button--transparent el-button--primary">\r\n Change\r\n </button>\r\n <button id="vc-predicted-type-dialog-correct" class="el-button el-button--outline el-button--primary">\r\n Correct\r\n </button>\r\n </div>\r\n </div>\r\n <div class="vc-dialog-bottom select-doctype-dialog d-none" id="vc-select-type-dialog">\r\n <div class="vc-dialog-bottom__header">\r\n <div class="vc-dialog-bottom__header__cancel v-none">\r\n <button class="el-button el-button--transparent el-button--transparent-border" id="vc-btn-doctype-cancel">\r\n Cancel\r\n </button>\r\n </div>\r\n <div id="vc-select-type-dialog-text" class="vc-dialog-bottom__header__text">\r\n Select Document Type\r\n </div>\r\n <div class="vc-dialog-bottom__header__done">\r\n <button class="el-button el-button--transparent el-button--transparent-border" id="vc-btn-doctype-done">Done\r\n </button>\r\n </div>\r\n </div>\r\n <div class="select-doctype-dialog__content" id="vc-doctype-dialog-container">\r\n <label class="select-doctype-dialog__content__element">\r\n <span class="select-doctype-dialog__content__element__text">Driver’s License or ID card</span>\r\n <input type="radio" id="id" name="doctype" value="ID" checked\r\n class="select-doctype-dialog__content__element__radio">\r\n <span class="select-doctype-dialog__content__element__checkmark"></span>\r\n </label>\r\n <label class="select-doctype-dialog__content__element">\r\n <span class="select-doctype-dialog__content__element__text">Passport</span>\r\n <input type="radio" id="passport" name="doctype" value="Passport"\r\n class="select-doctype-dialog__content__element__radio">\r\n <span class="select-doctype-dialog__content__element__checkmark"></span>\r\n </label>\r\n <label class="select-doctype-dialog__content__element">\r\n <span class="select-doctype-dialog__content__element__text">Passport Card</span>\r\n <input type="radio" id="passportcard" name="doctype" value="PassportCard"\r\n class="select-doctype-dialog__content__element__radio">\r\n <span class="select-doctype-dialog__content__element__checkmark"></span>\r\n </label>\r\n <label class="select-doctype-dialog__content__element">\r\n <span class="select-doctype-dialog__content__element__text">Green Card or Employment Authorization</span>\r\n <input type="radio" id="gc" name="doctype" value="GC" class="select-doctype-dialog__content__element__radio">\r\n <span class="select-doctype-dialog__content__element__checkmark"></span>\r\n </label>\r\n <label class="select-doctype-dialog__content__element">\r\n <span class="select-doctype-dialog__content__element__text">International ID</span>\r\n <input type="radio" id="iid" name="doctype" value="iid" class="select-doctype-dialog__content__element__radio">\r\n <span class="select-doctype-dialog__content__element__checkmark"></span>\r\n </label>\r\n </div>\r\n </div>\r\n <div class="vc-dialog-type d-none" id="vc-dialog-type">\r\n <div class="vc-dialog-type__header">\r\n <h2>\r\n Type not defined. <br>\r\n Please select manually\r\n </h2>\r\n </div>\r\n <div class="vc-dialog-type__body">\r\n <select id="VC-dialog-select-type" class="d-none">\r\n <option value="1">Driver\\\'s License</option>\r\n <option value="2">Passport</option>\r\n <option value="3">Passport Card</option>\r\n <option value="6">Green Card or Employment Authorization</option>\r\n <option value="7">International ID</option>\r\n </select>\r\n <div class="VC-dialog-type-error-body d-none" id="VC-allowed-types">\r\n <span class="VC-dialog-type-error-body__text" id="VC-allowed-types-text">Only the following document types are allowed:</span>\r\n <ul class="vc-dialog-type-allowed-types__list" id="VC-allowed-types-list"></ul>\r\n <button class="el-button el-button--primary w-100 m-t-20" id="closeTypeDialog">CLOSE</button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="browser-not-compability" id="VC-browser-compatibility">\r\n Your browser is not supported\r\n </div>\r\n <div class="idvc-steps" id="VC-steps"></div>\r\n <div class="message-box" id="vc-message-box"><span class="message-box__text">Scan your document</span><button class="idvc-caret idvc-caret__right" id="idvc-change-document-type-btn"></button></div>\r\n <main class="main-container" id="vc-main-content">\r\n <div class="uploader-wrap" id="VC-uploader">\r\n <div class="uploader" id="vc-uploader-drop-area">\r\n <div class="uploader__background"></div>\r\n <label for="vc-upload-drop-file" title="Drop a document face your document here">\r\n <div class="uploader__message">\r\n <i class="uploader__icon-camera">\r\n <svg\r\n version="1.1"\r\n preserveAspectRatio="xMidYMid meet"\r\n viewBox="0 0 32 32"\r\n width="32"\r\n height="32"\r\n id="svg79"\r\n xmlns:xlink="http://www.w3.org/1999/xlink"\r\n xmlns="http://www.w3.org/2000/svg"\r\n xmlns:svg="http://www.w3.org/2000/svg">\r\n <defs\r\n id="defs49">\r\n <path\r\n d="M 500,465.91 V 204.55"\r\n id="a4KFoJh3yX"/>\r\n <path\r\n d="m 400.8,303.75 c 58.63,-59.11 91.21,-91.95 97.72,-98.52 0.78,-0.82 2.08,-0.85 2.89,-0.07 0.03,0.03 0.05,0.05 0.07,0.07 6.51,6.57 39.09,39.41 97.72,98.52"\r\n id="cBLjNQRHu"/>\r\n <path\r\n d="m 681.82,431.82 c 0,42.13 0,65.54 0,70.23 0,36.52 -29.61,66.13 -66.14,66.13 -23.13,0 -208.23,0 -231.36,0 -36.53,0 -66.14,-29.61 -66.14,-66.13 0,-4.69 0,-28.1 0,-70.23"\r\n id="a1tVkyC5hP"/>\r\n </defs>\r\n <g\r\n id="g77"\r\n style="fill:#000000"\r\n transform="matrix(0.08751689,0,0,0.08753503,-27.758447,-17.822243)">\r\n <g\r\n id="g75"\r\n style="fill:#000000">\r\n <g\r\n id="g57"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#a4KFoJh3yX"\r\n opacity="1"\r\n fill="#000000"\r\n fill-opacity="0"\r\n id="use51"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n <g\r\n id="g55"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#a4KFoJh3yX"\r\n opacity="1"\r\n fill-opacity="0"\r\n stroke="#ffffff"\r\n stroke-width="2"\r\n stroke-opacity="1"\r\n id="use53"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n </g>\r\n </g>\r\n <g\r\n id="g65"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#cBLjNQRHu"\r\n opacity="1"\r\n fill="#000000"\r\n fill-opacity="0"\r\n id="use59"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n <g\r\n id="g63"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#cBLjNQRHu"\r\n opacity="1"\r\n fill-opacity="0"\r\n stroke="#ffffff"\r\n stroke-width="2"\r\n stroke-opacity="1"\r\n id="use61"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n </g>\r\n </g>\r\n <g\r\n id="g73"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#a1tVkyC5hP"\r\n opacity="1"\r\n fill="#000000"\r\n fill-opacity="0"\r\n id="use67"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n <g\r\n id="g71"\r\n style="fill:#000000">\r\n <use\r\n xlink:href="#a1tVkyC5hP"\r\n opacity="1"\r\n fill-opacity="0"\r\n stroke="#ffffff"\r\n stroke-width="2"\r\n stroke-opacity="1"\r\n id="use69"\r\n style="fill:#000000"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"/>\r\n </g>\r\n </g>\r\n </g>\r\n </g>\r\n </svg>\r\n </i>\r\n\r\n <div class="uploader__text uploader__pass--enabled uploader__front--enabled" id="uploader-text-front">\r\n Click here to upload the front of your ID\r\n </div>\r\n <div class="uploader__text uploader__back--enabled" id="uploader-text-back">\r\n Click here to upload the back of your ID\r\n </div>\r\n <div class="uploader__text uploader__face--enabled" id="uploader-text-face">\r\n Click here to upload a photo of your face\r\n </div>\r\n <div class="uploader__text uploader__pdf--enabled" id="uploader-text-pdf">\r\n Click here to upload the back of a ID\r\n </div>\r\n <div class="uploader__text uploader__mrz--enabled uploader__capturing--enabled" id="uploader-text-mrz">\r\n Click here to upload a photo of your document\r\n </div>\r\n\r\n <div class="uploader__text uploader__front--enabled uploader__back--enabled" id="uploader-text-front-back">\r\n Please make sure your ID fills up the entire <br> camera\r\n screen with little to no background.\r\n </div>\r\n\r\n <div class="uploader__text uploader__pass--enabled" id="uploader-text-pass">\r\n Please make sure your ID fills up the entire camera screen\r\n <br>\r\n with little to no background, and the full MRZ code is\r\n included.\r\n </div>\r\n <div class="uploader__text uploader__face--enabled" id="uploader-text-face-postion">\r\n Please position your face to take up <br> the full camera\r\n screen with little to no background.\r\n </div>\r\n </div>\r\n\r\n <div class="uploader__error">\r\n <span class="uploader__error--alert">\r\n <svg\r\n xmlns="http://www.w3.org/2000/svg"\r\n width="512"\r\n height="512"\r\n fill="#ff0000"\r\n viewBox="0 0 512 512">\r\n <path\r\n d="M502.876 379.713l-189.486-316.329c-6.088-9.895-14.349-17.903-24.154-23.52l-0.329-0.174c-20.048-11.267-45.677-11.292-65.788 0.022-10.123 5.785-18.372 13.786-24.282 23.381l-0.167 0.291c-0.022 0.045-0.042 0.066-0.064 0.109l-189.619 316.546c-18.512 32.098-7.501 73.127 24.596 91.642 9.476 5.56 20.852 8.88 32.997 8.972h379.12c37.046-0.406 66.736-30.765 66.347-67.804-0.137-12.231-3.526-23.642-9.34-33.446l0.171 0.31zM233.656 189.931c0.138-12.246 10.097-22.12 22.363-22.12s22.225 9.874 22.363 22.107v89.466c0 0.002 0 0.003 0 0.005 0 12.347-10.010 22.356-22.356 22.356-0.002 0-0.004 0-0.005 0h0c-0.002 0-0.005 0-0.008 0-12.345 0-22.352-10.005-22.357-22.348v-0zM278.413 368.985c0 12.368-10.026 22.394-22.394 22.394s-22.394-10.026-22.394-22.394c0-12.367 10.024-22.392 22.391-22.394v0c0.001 0 0.002 0 0.002 0 12.368 0 22.394 10.026 22.394 22.394v0z"/>\r\n </svg>\r\n </span>\r\n <div class="uploader__error__text">\r\n <b id="vc-uploader-error-text">\r\n Error file type. Only jpeg and png supported.\r\n </b>\r\n <br>\r\n <em class="uploader__press-update text-center" id="vc-uploader-press-to-update">\r\n Press to update\r\n </em>\r\n </div>\r\n </div>\r\n <div class="uploader__success">\r\n <i class="uploader__success--circle">\r\n <div class="uploader__success--circle--check"></div>\r\n </i>\r\n <div class="uploader__success__text">\r\n <div class="m-b-5">\r\n <b>\r\n <span id="vc-uploader-drop-step-name"></span> uploaded successfully\r\n </b>\r\n </div>\r\n <em class="text-center" id="vc-uploader-press-to-update-success">\r\n Press to update\r\n </em>\r\n </div>\r\n </div>\r\n\r\n </label>\r\n <div class="uploader__guidlines" id="VC-guidlines">See Guidelines</div>\r\n <input type="file" accept="image/*,.heic" id="vc-upload-drop-file" style="display:none">\r\n </div>\r\n </div>\r\n <div class="video-wrap" id="VC-videoWrap">\r\n <div id="VC-step-img" class="step-img">\r\n <div class="step-img step-img--front"></div>\r\n <div class="step-img step-img--back"></div>\r\n </div>\r\n <div id="VC-video-wrap-error" class="video-wrap__error video-wrap__error--disabled">\r\n <span class="uploader__error--alert">\r\n <svg\r\n xmlns="http://www.w3.org/2000/svg"\r\n width="512"\r\n height="512"\r\n fill="#ff0000"\r\n viewBox="0 0 512 512">\r\n <path\r\n d="M502.876 379.713l-189.486-316.329c-6.088-9.895-14.349-17.903-24.154-23.52l-0.329-0.174c-20.048-11.267-45.677-11.292-65.788 0.022-10.123 5.785-18.372 13.786-24.282 23.381l-0.167 0.291c-0.022 0.045-0.042 0.066-0.064 0.109l-189.619 316.546c-18.512 32.098-7.501 73.127 24.596 91.642 9.476 5.56 20.852 8.88 32.997 8.972h379.12c37.046-0.406 66.736-30.765 66.347-67.804-0.137-12.231-3.526-23.642-9.34-33.446l0.171 0.31zM233.656 189.931c0.138-12.246 10.097-22.12 22.363-22.12s22.225 9.874 22.363 22.107v89.466c0 0.002 0 0.003 0 0.005 0 12.347-10.010 22.356-22.356 22.356-0.002 0-0.004 0-0.005 0h0c-0.002 0-0.005 0-0.008 0-12.345 0-22.352-10.005-22.357-22.348v-0zM278.413 368.985c0 12.368-10.026 22.394-22.394 22.394s-22.394-10.026-22.394-22.394c0-12.367 10.024-22.392 22.391-22.394v0c0.001 0 0.002 0 0.002 0 12.368 0 22.394 10.026 22.394 22.394v0z"/>\r\n </svg>\r\n </span>\r\n <div class="video-wrap__error__text">\r\n <b id="VC-video-wrap-error-text">\r\n </b>\r\n </div>\r\n </div>\r\n <div class="force-btn" id="VC-force-btn" style="display: none">\r\n <svg\r\n version="1.1"\r\n xmlns="http://www.w3.org/2000/svg"\r\n x="0px"\r\n y="0px"\r\n width="487.811px"\r\n height="487.811px"\r\n viewBox="0 0 487.811 487.811"\r\n class="force-btn__icon"\r\n >\r\n <g>\r\n <polygon points="0,124.814 0,124.814 0,124.805"/>\r\n <path d="M487.592,118.178l-1.425-1.521c-0.794-0.851-2.247-1.874-4.657-1.874l-77.169,0.067c-2.229,0-7.43-6.101-9.209-11.733\r\n l-16.639-47.392c-2.477-7.889-10.49-7.889-13.502-7.889l-181.238,0.077l-3.691-0.029c-3.825,0-12.785,0-15.195,8.319\r\n l-14.564,51.102c-1.1,3.806-5.508,7.545-8.902,7.545l-121.473-0.019c-7.449,0-19.918,0-19.928,9.974\r\n c0.01-5.69,14.563-0.517,24.604-0.411l116.796,0.019c5.852,0,11.886-6.655,13.493-12.192l14.563-52.316\r\n c1.559-5.384,8.052-2.61,13.789-2.458l176.974,0.029H183.753c-0.163,0-0.334,0-0.497,0c-5.728,0-12.23-2.936-13.789,2.438\r\n l-14.564,52.316c-1.597,5.518-7.612,12.135-13.435,12.183c8.558-0.038,16.017-7.506,18.025-14.458l14.563-51.083l-14.563,51.093\r\n c-2.018,6.952-9.505,14.449-18.092,14.449l0,0c0.019,0,0.038,0,0.057,0c-0.019,0-0.038,0-0.057,0l0,0l0,0l0,0H24.93\r\n c-0.105,0-0.22,0-0.325,0c-10.041,0-24.595-5.288-24.604,0.401c0,0,0-0.009,0,0v287.229l0,0c0,23.084,13.56,27.932,24.93,27.932\r\n l0,0l0,0h451.102c2.878,0,5.412-1.041,7.354-3.031c4.771-4.896,4.532-14.314,4.351-21.199c-0.038-1.367-0.048-2.602-0.048-3.701\r\n V121.171L487.592,118.178z M478.173,415.982c0.048,1.998,0.134,5.068-0.048,7.879C478.307,421.051,478.221,417.98,478.173,415.982\r\n c-0.038-1.482-0.048-2.811-0.048-3.93c0,0,0-0.01,0-0.02v-0.096c0,0.029,0,0.086,0,0.115\r\n C478.105,413.172,478.135,414.5,478.173,415.982z M404.341,124.413L404.341,124.413\r\n C404.341,124.413,404.331,124.413,404.341,124.413L404.341,124.413z M274.922,148.319c59.412,0,107.578,48.167,107.578,107.578\r\n c0,59.412-48.166,107.578-107.578,107.578c-59.412,0-107.578-48.166-107.578-107.578\r\n C167.344,196.485,215.51,148.319,274.922,148.319z"/>\r\n </g>\r\n </svg>\r\n\x3c!-- <svg xmlns="http://www.w3.org/2000/svg" class="force-btn__icon" viewBox="0 0 512 512" xml:space="preserve"><path d="M445.217 378.435v66.782H66.783v-66.782H0V512h512V378.435zM256 0 121.322 134.678h89.6v239.17h90.156v-239.17h89.6z"/></svg>--\x3e\r\n </div>\r\n <div class="video-pos" id="VC-videoPos">\r\n <div class="vc-flashlight-icon vc-flashlight-icon--hide" id="vc-flashlight">\r\n <svg class="vc-flashlight-icon--switched-off" viewBox="0 0 10 15" fill="none" xmlns="http://www.w3.org/2000/svg" id="vc-flashlight-icon--switched-off">\r\n <path d="M9.89977 6.06903C9.87501 5.97312 9.81907 5.88817 9.74075 5.82754C9.66243 5.7669 9.56617 5.73402 9.46712 5.73407H6.42991L7.21733 1.42514C7.21873 1.41677 7.22012 1.40867 7.22096 1.4003C7.23517 1.28857 7.21237 1.17526 7.15603 1.07773C7.0997 0.980197 7.01295 0.903823 6.90906 0.860306C6.80518 0.816788 6.68989 0.808527 6.58086 0.836788C6.47184 0.865049 6.37508 0.928273 6.30541 1.01678L3.72123 4.2117C3.70386 4.23318 3.69508 4.26034 3.69658 4.28792C3.69807 4.3155 3.70974 4.34155 3.72932 4.36103L7.94419 8.57589C7.95525 8.58697 7.96852 8.5956 7.98313 8.60122C7.99775 8.60684 8.01338 8.60932 8.02902 8.60851C8.04465 8.60769 8.05994 8.60359 8.07389 8.59649C8.08784 8.58938 8.10014 8.57941 8.10999 8.56724L9.8071 6.4693C9.85272 6.41445 9.88487 6.34968 9.90096 6.28017C9.91705 6.21066 9.91665 6.13835 9.89977 6.06903Z" fill="#FED40B"/>\r\n <path d="M6.27304 10.68L2.05817 6.4651C2.04711 6.45407 2.03386 6.44548 2.01927 6.43989C2.00469 6.4343 1.98909 6.43183 1.97349 6.43265C1.95789 6.43346 1.94263 6.43754 1.92871 6.44463C1.91478 6.45171 1.9025 6.46163 1.89265 6.47376L0.194422 8.57114C0.148809 8.6261 0.116716 8.691 0.100719 8.76061C0.084722 8.83022 0.0852667 8.90261 0.102309 8.97197C0.127071 9.06788 0.183013 9.15283 0.261334 9.21346C0.339655 9.2741 0.435911 9.30698 0.534961 9.30693H3.57273L2.78866 13.6156V13.6186C2.76931 13.7309 2.7879 13.8465 2.84151 13.947C2.89511 14.0475 2.98067 14.1273 3.08469 14.1738C3.1887 14.2204 3.30524 14.2309 3.41591 14.2038C3.52657 14.1767 3.62506 14.1135 3.69583 14.0242L6.28085 10.8293C6.29825 10.8079 6.30708 10.7807 6.30564 10.7531C6.30419 10.7256 6.29258 10.6995 6.27304 10.68Z" fill="#FED40B"/>\r\n <path d="M3.69658 4.28792C3.69508 4.26034 3.70386 4.23318 3.72123 4.2117L1.89265 6.47376C1.9025 6.46163 1.91478 6.45171 1.92871 6.44463C1.94263 6.43754 1.95789 6.43346 1.97349 6.43265C1.98909 6.43183 2.00469 6.4343 2.01927 6.43989C2.03386 6.44548 2.04711 6.45407 2.05817 6.4651L6.27304 10.68C6.29258 10.6995 6.30419 10.7256 6.30564 10.7531C6.30708 10.7807 6.29825 10.8079 6.28085 10.8293L8.10999 8.56724C8.10014 8.57941 8.08784 8.58938 8.07389 8.59649C8.05994 8.60359 8.04465 8.60769 8.02902 8.60851C8.01338 8.60932 7.99775 8.60684 7.98313 8.60122C7.96852 8.5956 7.95525 8.58697 7.94419 8.57589L3.72932 4.36103C3.70974 4.34155 3.69807 4.3155 3.69658 4.28792Z" fill="#FED40B"/>\r\n </svg>\r\n <svg class="vc-flashlight-icon--switched-on d-none" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg" id="vc-flashlight-icon--switched-on">\r\n <path d="M10.9138 12.8798C10.8551 12.8799 10.7971 12.8683 10.7429 12.8459C10.6887 12.8234 10.6395 12.7904 10.5981 12.7489L0.772729 2.92348C0.69251 2.83904 0.648448 2.72661 0.649939 2.61015C0.65143 2.49369 0.698356 2.38242 0.780711 2.30007C0.863066 2.21771 0.974335 2.17079 1.09079 2.1693C1.20725 2.1678 1.31968 2.21187 1.40412 2.29209L11.2295 12.1175C11.2919 12.1799 11.3344 12.2595 11.3516 12.3461C11.3688 12.4327 11.36 12.5225 11.3262 12.604C11.2924 12.6856 11.2352 12.7554 11.1618 12.8044C11.0884 12.8535 11.0021 12.8797 10.9138 12.8798Z" fill="white"/>\r\n <path d="M10.8998 6.06903C10.8751 5.97312 10.8191 5.88817 10.7408 5.82754C10.6625 5.7669 10.5662 5.73402 10.4672 5.73407H7.42998L8.2174 1.42514C8.2188 1.41677 8.22019 1.40867 8.22103 1.4003C8.23525 1.28857 8.21244 1.17526 8.15611 1.07773C8.09977 0.980197 8.01302 0.903823 7.90913 0.860306C7.80525 0.816788 7.68996 0.808527 7.58094 0.836788C7.47191 0.865049 7.37515 0.928273 7.30549 1.01678L4.7213 4.2117C4.70394 4.23318 4.69516 4.26034 4.69665 4.28792C4.69815 4.3155 4.70981 4.34155 4.72939 4.36103L8.94426 8.5759C8.95532 8.58698 8.96859 8.5956 8.9832 8.60122C8.99782 8.60684 9.01345 8.60932 9.02909 8.60851C9.04472 8.60769 9.06001 8.60359 9.07396 8.59649C9.08791 8.58938 9.10021 8.57941 9.11006 8.56724L10.8072 6.4693C10.8528 6.41445 10.8849 6.34968 10.901 6.28017C10.9171 6.21066 10.9167 6.13835 10.8998 6.06903Z" fill="white"/>\r\n <path d="M7.27311 10.68L3.05825 6.46511C3.04719 6.45407 3.03393 6.44548 3.01935 6.43989C3.00476 6.4343 2.98916 6.43183 2.97356 6.43265C2.95796 6.43346 2.9427 6.43754 2.92878 6.44463C2.91485 6.45171 2.90257 6.46163 2.89272 6.47376L1.19449 8.57114C1.14888 8.6261 1.11679 8.691 1.10079 8.76061C1.08479 8.83022 1.08534 8.90261 1.10238 8.97197C1.12714 9.06788 1.18309 9.15283 1.26141 9.21346C1.33973 9.2741 1.43598 9.30698 1.53503 9.30693H4.57281L3.78873 13.6156V13.6186C3.76938 13.7309 3.78797 13.8465 3.84158 13.947C3.89518 14.0475 3.98075 14.1273 4.08476 14.1739C4.18877 14.2204 4.30531 14.2309 4.41598 14.2038C4.52664 14.1767 4.62514 14.1135 4.6959 14.0242L7.28093 10.8293C7.29832 10.8079 7.30715 10.7807 7.30571 10.7531C7.30427 10.7256 7.29265 10.6995 7.27311 10.68Z" fill="white"/>\r\n </svg>\r\n </div>\r\n <div class="video-mask">\r\n <svg\r\n id="vc-video-mask-overlay"\r\n class="video-mask-overlay"\r\n xmlns="http://www.w3.org/2000/svg"\r\n x="0"\r\n y="0"\r\n width="100%"\r\n height="100%"\r\n >\r\n <defs>\r\n <mask id="mask">\r\n <rect class="video-mask-overlay__dark" width="100%"/>\r\n <rect rx="16px" class="video-mask-overlay__clean"/>\r\n </mask>\r\n </defs>\r\n <g width="100%" height="100%">\r\n <rect rx="16px" class="video-mask-overlay__stroke video-mask-overlay__stroke--white"/>\r\n <rect rx="16px" class="video-mask-overlay__stroke video-mask-overlay__stroke--success"/>\r\n <rect mask="url(#mask)" class="video-mask-overlay__mask" width="100%" height="100%"/>\r\n </g>\r\n </svg>\r\n <div class="video-hint-container" id="VC-video-hint-container">\r\n <div id="vc-arrow-up-hint-container" class="d-none">\r\n <svg width="15" height="34" viewBox="0 0 15 34" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <path d="M7.28451 24.0729L0.588879 29.5287C0.531814 29.5753 0.499858 29.6385 0.5 29.7043L0.500001 33.7515C0.499687 33.8885 0.63573 33.9997 0.803816 33.9999C0.884848 34.0001 0.962599 33.9738 1.01984 33.9271L7.27538 28.8294C7.40617 28.7228 7.59386 28.7228 7.72465 28.8294L13.9802 33.9271C14.0989 34.024 14.2916 34.0242 14.4106 33.9275C14.468 33.8809 14.5001 33.8175 14.5 33.7515L14.5 29.7043C14.5001 29.6385 14.4682 29.5753 14.4111 29.5287L7.71546 24.0729C7.59677 23.9759 7.40406 23.9757 7.28505 24.0724L7.28451 24.0729Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M7.28451 16.0729L0.588879 21.5287C0.531814 21.5753 0.499858 21.6385 0.5 21.7043L0.500001 25.7515C0.499687 25.8885 0.63573 25.9997 0.803816 25.9999C0.884848 26.0001 0.962599 25.9738 1.01984 25.9271L7.27538 20.8294C7.40617 20.7228 7.59386 20.7228 7.72465 20.8294L13.9802 25.9271C14.0989 26.024 14.2916 26.0242 14.4106 25.9275C14.468 25.8809 14.5001 25.8175 14.5 25.7515L14.5 21.7043C14.5001 21.6385 14.4682 21.5753 14.4111 21.5287L7.71546 16.0729C7.59677 15.9759 7.40406 15.9757 7.28505 16.0724L7.28451 16.0729Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M7.28451 8.07286L0.588879 13.5287C0.531814 13.5753 0.499858 13.6385 0.5 13.7043L0.500001 17.7515C0.499687 17.8885 0.63573 17.9997 0.803816 17.9999C0.884848 18.0001 0.962599 17.9738 1.01984 17.9271L7.27538 12.8294C7.40617 12.7228 7.59386 12.7228 7.72465 12.8294L13.9802 17.9271C14.0989 18.024 14.2916 18.0242 14.4106 17.9275C14.468 17.8809 14.5001 17.8175 14.5 17.7515L14.5 13.7043C14.5001 13.6385 14.4682 13.5753 14.4111 13.5287L7.71546 8.07286C7.59677 7.97588 7.40406 7.9757 7.28505 8.07241L7.28451 8.07286Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M7.28451 0.0728556L0.588879 5.52871C0.531814 5.5753 0.499858 5.63847 0.5 5.70429L0.500001 9.75149C0.499687 9.88846 0.63573 9.99968 0.803816 9.99994C0.884848 10.0001 0.962599 9.97383 1.01984 9.92707L7.27538 4.82937C7.40617 4.72278 7.59386 4.72278 7.72465 4.82937L13.9802 9.92707C14.0989 10.024 14.2916 10.0242 14.4106 9.92751C14.468 9.88088 14.5001 9.81752 14.5 9.75149L14.5 5.70429C14.5001 5.63847 14.4682 5.5753 14.4111 5.52871L7.71546 0.0728556C7.59677 -0.0241168 7.40406 -0.0243037 7.28505 0.0724141L7.28451 0.0728556Z" fill="white" fill-opacity="0.4"/>\r\n </svg>\r\n </div>\r\n <div id="vc-arrow-left-hint-container" class="d-none">\r\n <svg width="34" height="14" viewBox="0 0 34 14" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <path d="M24.0729 7.21549L29.5287 13.9111C29.5753 13.9682 29.6385 14.0001 29.7043 14L33.7515 14C33.8885 14.0003 33.9997 13.8643 33.9999 13.6962C34.0001 13.6152 33.9738 13.5374 33.9271 13.4802L28.8294 7.22462C28.7228 7.09383 28.7228 6.90614 28.8294 6.77535L33.9271 0.519834C34.024 0.401138 34.0242 0.208429 33.9275 0.0894203C33.8809 0.0320416 33.8175 -0.000143989 33.7515 -9.32291e-07L29.7043 -5.84033e-07C29.6385 -0.00014363 29.5753 0.0318121 29.5287 0.0888771L24.0729 6.78454C23.9759 6.90323 23.9757 7.09594 24.0724 7.21495L24.0729 7.21549Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M16.0729 7.21549L21.5287 13.9111C21.5753 13.9682 21.6385 14.0001 21.7043 14L25.7515 14C25.8885 14.0003 25.9997 13.8643 25.9999 13.6962C26.0001 13.6152 25.9738 13.5374 25.9271 13.4802L20.8294 7.22462C20.7228 7.09383 20.7228 6.90614 20.8294 6.77535L25.9271 0.519834C26.024 0.401138 26.0242 0.208429 25.9275 0.0894203C25.8809 0.0320416 25.8175 -0.000143989 25.7515 -9.32291e-07L21.7043 -5.84033e-07C21.6385 -0.00014363 21.5753 0.0318121 21.5287 0.0888771L16.0729 6.78454C15.9759 6.90323 15.9757 7.09594 16.0724 7.21495L16.0729 7.21549Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M8.07286 7.21549L13.5287 13.9111C13.5753 13.9682 13.6385 14.0001 13.7043 14L17.7515 14C17.8885 14.0003 17.9997 13.8643 17.9999 13.6962C18.0001 13.6152 17.9738 13.5374 17.9271 13.4802L12.8294 7.22462C12.7228 7.09383 12.7228 6.90614 12.8294 6.77535L17.9271 0.519834C18.024 0.401138 18.0242 0.208429 17.9275 0.0894203C17.8809 0.0320416 17.8175 -0.000143989 17.7515 -9.32291e-07L13.7043 -5.84033e-07C13.6385 -0.00014363 13.5753 0.0318121 13.5287 0.0888771L8.07286 6.78454C7.97588 6.90323 7.9757 7.09594 8.07241 7.21495L8.07286 7.21549Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M0.0728553 7.21549L5.52871 13.9111C5.5753 13.9682 5.63847 14.0001 5.70429 14L9.75149 14C9.88846 14.0003 9.99968 13.8643 9.99994 13.6962C10.0001 13.6152 9.97383 13.5374 9.92707 13.4802L4.82937 7.22462C4.72278 7.09383 4.72278 6.90614 4.82937 6.77535L9.92707 0.519834C10.024 0.401138 10.0242 0.208429 9.92751 0.0894203C9.88087 0.0320416 9.81752 -0.000143989 9.75149 -9.32291e-07L5.70429 -5.84033e-07C5.63847 -0.00014363 5.5753 0.0318121 5.52871 0.0888771L0.0728553 6.78454C-0.0241171 6.90323 -0.024304 7.09594 0.0724138 7.21495L0.0728553 7.21549Z" fill="white" fill-opacity="0.4"/>\r\n </svg>\r\n </div>\r\n <div id="vc-arrow-left-face-the-camera-container" class="d-none">\r\n <svg width="35" height="14" viewBox="0 0 35 14" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <path d="M10.4271 6.78451L4.97129 0.0888788C4.9247 0.0318136 4.86153 -0.000142848 4.79571 -1.73758e-07L0.748506 4.98871e-07C0.611545 -0.000313336 0.50032 0.13573 0.500064 0.303816C0.499948 0.384848 0.526173 0.462599 0.572928 0.519836L5.67063 6.77538C5.77722 6.90617 5.77722 7.09386 5.67063 7.22465L0.57293 13.4802C0.475957 13.5989 0.475771 13.7916 0.572488 13.9106C0.619126 13.968 0.682481 14.0001 0.748509 14L4.79571 14C4.86153 14.0001 4.9247 13.9682 4.97129 13.9111L10.4271 7.21546C10.5241 7.09677 10.5243 6.90406 10.4276 6.78505L10.4271 6.78451Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M18.4271 6.78451L12.9713 0.0888788C12.9247 0.0318136 12.8615 -0.000142848 12.7957 -1.73758e-07L8.74851 4.98871e-07C8.61154 -0.000313336 8.50032 0.13573 8.50006 0.303816C8.49995 0.384848 8.52617 0.462599 8.57293 0.519836L13.6706 6.77538C13.7772 6.90617 13.7772 7.09386 13.6706 7.22465L8.57293 13.4802C8.47596 13.5989 8.47577 13.7916 8.57249 13.9106C8.61913 13.968 8.68248 14.0001 8.74851 14L12.7957 14C12.8615 14.0001 12.9247 13.9682 12.9713 13.9111L18.4271 7.21546C18.5241 7.09677 18.5243 6.90406 18.4276 6.78505L18.4271 6.78451Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M26.4271 6.78451L20.9713 0.0888788C20.9247 0.0318136 20.8615 -0.000142848 20.7957 -1.73758e-07L16.7485 4.98871e-07C16.6115 -0.000313336 16.5003 0.13573 16.5001 0.303816C16.4999 0.384848 16.5262 0.462599 16.5729 0.519836L21.6706 6.77538C21.7772 6.90617 21.7772 7.09386 21.6706 7.22465L16.5729 13.4802C16.476 13.5989 16.4758 13.7916 16.5725 13.9106C16.6191 13.968 16.6825 14.0001 16.7485 14L20.7957 14C20.8615 14.0001 20.9247 13.9682 20.9713 13.9111L26.4271 7.21546C26.5241 7.09677 26.5243 6.90406 26.4276 6.78505L26.4271 6.78451Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M34.4271 6.78451L28.9713 0.0888788C28.9247 0.0318136 28.8615 -0.000142848 28.7957 -1.73758e-07L24.7485 4.98871e-07C24.6115 -0.000313336 24.5003 0.13573 24.5001 0.303816C24.4999 0.384848 24.5262 0.462599 24.5729 0.519836L29.6706 6.77538C29.7772 6.90617 29.7772 7.09386 29.6706 7.22465L24.5729 13.4802C24.476 13.5989 24.4758 13.7916 24.5725 13.9106C24.6191 13.968 24.6825 14.0001 24.7485 14L28.7957 14C28.8615 14.0001 28.9247 13.9682 28.9713 13.9111L34.4271 7.21546C34.5241 7.09677 34.5243 6.90406 34.4276 6.78505L34.4271 6.78451Z" fill="#17EA4C" fill-opacity="1"/>\r\n </svg>\r\n </div>\r\n <span class="video-hold-text" id="VC-hold-text"></span>\r\n <div id="vc-arrow-right-face-the-camera-container" class="d-none">\r\n <svg width="34" height="14" viewBox="0 0 34 14" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <path d="M24.0729 7.21549L29.5287 13.9111C29.5753 13.9682 29.6385 14.0001 29.7043 14L33.7515 14C33.8885 14.0003 33.9997 13.8643 33.9999 13.6962C34.0001 13.6152 33.9738 13.5374 33.9271 13.4802L28.8294 7.22462C28.7228 7.09383 28.7228 6.90614 28.8294 6.77535L33.9271 0.519834C34.024 0.401138 34.0242 0.208429 33.9275 0.0894203C33.8809 0.0320416 33.8175 -0.000143989 33.7515 -9.32291e-07L29.7043 -5.84033e-07C29.6385 -0.00014363 29.5753 0.0318121 29.5287 0.0888771L24.0729 6.78454C23.9759 6.90323 23.9757 7.09594 24.0724 7.21495L24.0729 7.21549Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M16.0729 7.21549L21.5287 13.9111C21.5753 13.9682 21.6385 14.0001 21.7043 14L25.7515 14C25.8885 14.0003 25.9997 13.8643 25.9999 13.6962C26.0001 13.6152 25.9738 13.5374 25.9271 13.4802L20.8294 7.22462C20.7228 7.09383 20.7228 6.90614 20.8294 6.77535L25.9271 0.519834C26.024 0.401138 26.0242 0.208429 25.9275 0.0894203C25.8809 0.0320416 25.8175 -0.000143989 25.7515 -9.32291e-07L21.7043 -5.84033e-07C21.6385 -0.00014363 21.5753 0.0318121 21.5287 0.0888771L16.0729 6.78454C15.9759 6.90323 15.9757 7.09594 16.0724 7.21495L16.0729 7.21549Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M8.07286 7.21549L13.5287 13.9111C13.5753 13.9682 13.6385 14.0001 13.7043 14L17.7515 14C17.8885 14.0003 17.9997 13.8643 17.9999 13.6962C18.0001 13.6152 17.9738 13.5374 17.9271 13.4802L12.8294 7.22462C12.7228 7.09383 12.7228 6.90614 12.8294 6.77535L17.9271 0.519834C18.024 0.401138 18.0242 0.208429 17.9275 0.0894203C17.8809 0.0320416 17.8175 -0.000143989 17.7515 -9.32291e-07L13.7043 -5.84033e-07C13.6385 -0.00014363 13.5753 0.0318121 13.5287 0.0888771L8.07286 6.78454C7.97588 6.90323 7.9757 7.09594 8.07241 7.21495L8.07286 7.21549Z" fill="#17EA4C" fill-opacity="1"/>\r\n <path d="M0.0728553 7.21549L5.52871 13.9111C5.5753 13.9682 5.63847 14.0001 5.70429 14L9.75149 14C9.88846 14.0003 9.99968 13.8643 9.99994 13.6962C10.0001 13.6152 9.97383 13.5374 9.92707 13.4802L4.82937 7.22462C4.72278 7.09383 4.72278 6.90614 4.82937 6.77535L9.92707 0.519834C10.024 0.401138 10.0242 0.208429 9.92751 0.0894203C9.88087 0.0320416 9.81752 -0.000143989 9.75149 -9.32291e-07L5.70429 -5.84033e-07C5.63847 -0.00014363 5.5753 0.0318121 5.52871 0.0888771L0.0728553 6.78454C-0.0241171 6.90323 -0.024304 7.09594 0.0724138 7.21495L0.0728553 7.21549Z" fill="#17EA4C" fill-opacity="1"/>\r\n </svg>\r\n </div>\r\n <div id="vc-arrow-right-hint-container" class="d-none">\r\n <svg width="35" height="14" viewBox="0 0 35 14" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <path d="M10.4271 6.78451L4.97129 0.0888788C4.9247 0.0318136 4.86153 -0.000142848 4.79571 -1.73758e-07L0.748506 4.98871e-07C0.611545 -0.000313336 0.50032 0.13573 0.500064 0.303816C0.499948 0.384848 0.526173 0.462599 0.572928 0.519836L5.67063 6.77538C5.77722 6.90617 5.77722 7.09386 5.67063 7.22465L0.57293 13.4802C0.475957 13.5989 0.475771 13.7916 0.572488 13.9106C0.619126 13.968 0.682481 14.0001 0.748509 14L4.79571 14C4.86153 14.0001 4.9247 13.9682 4.97129 13.9111L10.4271 7.21546C10.5241 7.09677 10.5243 6.90406 10.4276 6.78505L10.4271 6.78451Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M18.4271 6.78451L12.9713 0.0888788C12.9247 0.0318136 12.8615 -0.000142848 12.7957 -1.73758e-07L8.74851 4.98871e-07C8.61154 -0.000313336 8.50032 0.13573 8.50006 0.303816C8.49995 0.384848 8.52617 0.462599 8.57293 0.519836L13.6706 6.77538C13.7772 6.90617 13.7772 7.09386 13.6706 7.22465L8.57293 13.4802C8.47596 13.5989 8.47577 13.7916 8.57249 13.9106C8.61913 13.968 8.68248 14.0001 8.74851 14L12.7957 14C12.8615 14.0001 12.9247 13.9682 12.9713 13.9111L18.4271 7.21546C18.5241 7.09677 18.5243 6.90406 18.4276 6.78505L18.4271 6.78451Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M26.4271 6.78451L20.9713 0.0888788C20.9247 0.0318136 20.8615 -0.000142848 20.7957 -1.73758e-07L16.7485 4.98871e-07C16.6115 -0.000313336 16.5003 0.13573 16.5001 0.303816C16.4999 0.384848 16.5262 0.462599 16.5729 0.519836L21.6706 6.77538C21.7772 6.90617 21.7772 7.09386 21.6706 7.22465L16.5729 13.4802C16.476 13.5989 16.4758 13.7916 16.5725 13.9106C16.6191 13.968 16.6825 14.0001 16.7485 14L20.7957 14C20.8615 14.0001 20.9247 13.9682 20.9713 13.9111L26.4271 7.21546C26.5241 7.09677 26.5243 6.90406 26.4276 6.78505L26.4271 6.78451Z" fill="white" fill-opacity="0.4"/>\r\n <path d="M34.4271 6.78451L28.9713 0.0888788C28.9247 0.0318136 28.8615 -0.000142848 28.7957 -1.73758e-07L24.7485 4.98871e-07C24.6115 -0.000313336 24.5003 0.13573 24.5001 0.303816C24.4999 0.384848 24.5262 0.462599 24.5729 0.519836L29.6706 6.77538C29.7772 6.90617 29.7772 7.09386 29.6706 7.22465L24.5729 13.4802C24.476 13.5989 24.4758 13.7916 24.5725 13.9106C24.6191 13.968 24.6825 14.0001 24.7485 14L28.7957 14C28.8615 14.0001 28.9247 13.9682 28.9713 13.9111L34.4271 7.21546C34.5241 7.09677 34.5243 6.90406 34.4276 6.78505L34.4271 6.78451Z" fill="white" fill-opacity="0.4"/>\r\n </svg>\r\n </div>\r\n\x3c!-- <div id="vc-arrow-down-hint-container" class="d-none">--\x3e\r\n\x3c!-- <svg width="15" height="34" viewBox="0 0 15 34" fill="none" xmlns="http://www.w3.org/2000/svg">--\x3e\r\n\x3c!-- <path d="M7.71549 9.92714L14.4111 4.47129C14.4682 4.4247 14.5001 4.36153 14.5 4.29571L14.5 0.248506C14.5003 0.111545 14.3643 0.000319751 14.1962 6.40308e-05C14.1152 -5.22051e-05 14.0374 0.0261731 13.9802 0.0729275L7.72462 5.17063C7.59383 5.27722 7.40614 5.27722 7.27535 5.17063L1.01983 0.0729292C0.901138 -0.0240438 0.708429 -0.0242297 0.58942 0.0724876C0.532042 0.119126 0.499856 0.18248 0.499999 0.248508L0.5 4.29571C0.499857 4.36153 0.531812 4.4247 0.588877 4.47129L7.28454 9.92715C7.40323 10.0241 7.59594 10.0243 7.71495 9.92759L7.71549 9.92714Z" fill="white" fill-opacity="0.4"/>--\x3e\r\n\x3c!-- <path d="M7.71549 17.9271L14.4111 12.4713C14.4682 12.4247 14.5001 12.3615 14.5 12.2957L14.5 8.24851C14.5003 8.11154 14.3643 8.00032 14.1962 8.00006C14.1152 7.99995 14.0374 8.02617 13.9802 8.07293L7.72462 13.1706C7.59383 13.2772 7.40614 13.2772 7.27535 13.1706L1.01983 8.07293C0.901138 7.97596 0.708429 7.97577 0.58942 8.07249C0.532042 8.11913 0.499856 8.18248 0.499999 8.24851L0.5 12.2957C0.499857 12.3615 0.531812 12.4247 0.588877 12.4713L7.28454 17.9271C7.40323 18.0241 7.59594 18.0243 7.71495 17.9276L7.71549 17.9271Z" fill="white" fill-opacity="0.4"/>--\x3e\r\n\x3c!-- <path d="M7.71549 25.9271L14.4111 20.4713C14.4682 20.4247 14.5001 20.3615 14.5 20.2957L14.5 16.2485C14.5003 16.1115 14.3643 16.0003 14.1962 16.0001C14.1152 15.9999 14.0374 16.0262 13.9802 16.0729L7.72462 21.1706C7.59383 21.2772 7.40614 21.2772 7.27535 21.1706L1.01983 16.0729C0.901138 15.976 0.708429 15.9758 0.58942 16.0725C0.532042 16.1191 0.499856 16.1825 0.499999 16.2485L0.5 20.2957C0.499857 20.3615 0.531812 20.4247 0.588877 20.4713L7.28454 25.9271C7.40323 26.0241 7.59594 26.0243 7.71495 25.9276L7.71549 25.9271Z" fill="white" fill-opacity="0.4"/>--\x3e\r\n\x3c!-- <path d="M7.71549 33.9271L14.4111 28.4713C14.4682 28.4247 14.5001 28.3615 14.5 28.2957L14.5 24.2485C14.5003 24.1115 14.3643 24.0003 14.1962 24.0001C14.1152 23.9999 14.0374 24.0262 13.9802 24.0729L7.72462 29.1706C7.59383 29.2772 7.40614 29.2772 7.27535 29.1706L1.01983 24.0729C0.901138 23.976 0.708429 23.9758 0.58942 24.0725C0.532042 24.1191 0.499856 24.1825 0.499999 24.2485L0.5 28.2957C0.499857 28.3615 0.531812 28.4247 0.588877 28.4713L7.28454 33.9271C7.40323 34.0241 7.59594 34.0243 7.71495 33.9276L7.71549 33.9271Z" fill="white" fill-opacity="0.4"/>--\x3e\r\n\x3c!-- </svg>--\x3e\r\n\x3c!-- </div>--\x3e\r\n </div>\r\n </div>\r\n <div class="video-container" id="VC-videoContainer">\r\n <div class="fake-contour" id="VC-fakeContour"></div>\r\n <canvas id="VC-borderCanvas" class="border-canvas"></canvas>\r\n <video id="VC-video" playsinline muted></video>\r\n </div>\r\n </div>\r\n <canvas class="resizedCanvas mw-100 d-none" id="resizedCanvas"></canvas>\r\n <canvas class="mrzCanvas mw-100 d-none" id="mrzCanvas"></canvas>\r\n <canvas class="videoCanvas d-none" id="videoCanvas"></canvas>\r\n </div>\r\n </main>\r\n\r\n <div class="manual-switch-btn-wrap" id="manualSwitchBtnWrap">\r\n <button class="el-button el-button--primary w-100 m-t-20 manual-switch-btn" id="manualSwitchBtn">&nbsp;</button>\r\n <div class="el-loading-spinner" id="manualSwitchBtnLoading" style="display: none;">\r\n <svg viewBox="25 25 50 50" class="circular">\r\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\r\n </svg>\r\n </div>\r\n </div>\r\n\r\n <div class="video-wrap__btns video-wrap__btns--two-btn" id="VC-btns">\r\n <button id="VS-retake-btn" class="el-button idvc-again-btn">Retake</button>\r\n <button id="VS-continue-btn"\r\n class="el-button el-button--outline idvc-submit-btn el-button--primary">\r\n CONTINUE\r\n </button>\r\n <button id="VS-submit-btn" class="el-button el-button--primary idvc-submit-btn d-none">\r\n SUBMIT\r\n </button>\r\n </div>\r\n <div class="idvc__footer">\r\n <div class="idvc__reset-all d-none" id="VC-reset-all">\r\n Reset all steps\r\n </div>\r\n <div class="idvc__version" id="VC-version">&nbsp;</div>\r\n </div>\r\n</div>\r\n',D.Z.init(),this.init()}async init(){h.Z.init(),h.Z.config.isShowDocumentTypeSelect||1!==h.Z.config.types.length||h.Z.fillSteps(),xu();const e=oe();if(e&&!yu.mediaSupport)return void he(new pe(ce.MediaDevicesNotSupported));ie();const t=await be();if(h.Z.cameraSupported=!(t instanceof pe||0===(null==t?void 0:t.length)),e||h.Z.cameraSupported){try{await We(h.Z.steps[0].camera)}catch{h.Z.cameraSupported||he(t instanceof pe?t:new pe(ce.CameraNotFound))}if(!h.Z.isBrowserSupport)return void gu.showSpinner(!1)}h.Z.cameraSupported||(await Fn()).default(),se(),D.Z.initGeneralText(),this.addPublicHandlers(),await gu.postInit(),h.Z.config.onMounted&&"function"==typeof h.Z.config.onMounted&&h.Z.config.onMounted()}setLoading(){h.Z.videoLoading=!0,D.Z.setVideoLoading()}addPublicHandlers(){this.resetAllSteps=()=>{gu.resetAllSteps()},this.reloadComponent=e=>{gu.reloadComponent(e)},this.updateDocumentTypes=e=>{gu.updateDocumentTypes(e)},this.showSpinner=e=>{gu.showSpinner(e)},this.changeLanguage=e=>{J(e)}}}})();var o=s.Z;export{o as default};